Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/makesrna/intern
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt446
-rw-r--r--source/blender/makesrna/intern/makesrna.c8004
-rw-r--r--source/blender/makesrna/intern/rna_ID.c2091
-rw-r--r--source/blender/makesrna/intern/rna_access.c12483
-rw-r--r--source/blender/makesrna/intern/rna_action.c1263
-rw-r--r--source/blender/makesrna/intern/rna_action_api.c10
-rw-r--r--source/blender/makesrna/intern/rna_animation.c1821
-rw-r--r--source/blender/makesrna/intern/rna_animation_api.c57
-rw-r--r--source/blender/makesrna/intern/rna_animviz.c459
-rw-r--r--source/blender/makesrna/intern/rna_armature.c2085
-rw-r--r--source/blender/makesrna/intern/rna_armature_api.c274
-rw-r--r--source/blender/makesrna/intern/rna_boid.c1044
-rw-r--r--source/blender/makesrna/intern/rna_brush.c3730
-rw-r--r--source/blender/makesrna/intern/rna_cachefile.c243
-rw-r--r--source/blender/makesrna/intern/rna_camera.c1102
-rw-r--r--source/blender/makesrna/intern/rna_camera_api.c88
-rw-r--r--source/blender/makesrna/intern/rna_cloth.c1270
-rw-r--r--source/blender/makesrna/intern/rna_collection.c558
-rw-r--r--source/blender/makesrna/intern/rna_color.c1907
-rw-r--r--source/blender/makesrna/intern/rna_constraint.c4848
-rw-r--r--source/blender/makesrna/intern/rna_context.c374
-rw-r--r--source/blender/makesrna/intern/rna_curve.c2880
-rw-r--r--source/blender/makesrna/intern/rna_curve_api.c81
-rw-r--r--source/blender/makesrna/intern/rna_define.c6073
-rw-r--r--source/blender/makesrna/intern/rna_depsgraph.c929
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c1711
-rw-r--r--source/blender/makesrna/intern/rna_fcurve.c3477
-rw-r--r--source/blender/makesrna/intern/rna_fcurve_api.c205
-rw-r--r--source/blender/makesrna/intern/rna_fluidsim.c1236
-rw-r--r--source/blender/makesrna/intern/rna_gpencil.c2919
-rw-r--r--source/blender/makesrna/intern/rna_gpencil_modifier.c2995
-rw-r--r--source/blender/makesrna/intern/rna_image.c1302
-rw-r--r--source/blender/makesrna/intern/rna_image_api.c605
-rw-r--r--source/blender/makesrna/intern/rna_internal.h351
-rw-r--r--source/blender/makesrna/intern/rna_internal_types.h621
-rw-r--r--source/blender/makesrna/intern/rna_key.c1353
-rw-r--r--source/blender/makesrna/intern/rna_lattice.c515
-rw-r--r--source/blender/makesrna/intern/rna_lattice_api.c25
-rw-r--r--source/blender/makesrna/intern/rna_layer.c605
-rw-r--r--source/blender/makesrna/intern/rna_light.c881
-rw-r--r--source/blender/makesrna/intern/rna_lightprobe.c350
-rw-r--r--source/blender/makesrna/intern/rna_linestyle.c3623
-rw-r--r--source/blender/makesrna/intern/rna_main.c491
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c3123
-rw-r--r--source/blender/makesrna/intern/rna_mask.c1648
-rw-r--r--source/blender/makesrna/intern/rna_material.c1560
-rw-r--r--source/blender/makesrna/intern/rna_material_api.c6
-rw-r--r--source/blender/makesrna/intern/rna_mesh.c4115
-rw-r--r--source/blender/makesrna/intern/rna_mesh_api.c431
-rw-r--r--source/blender/makesrna/intern/rna_mesh_utils.h190
-rw-r--r--source/blender/makesrna/intern/rna_meta.c567
-rw-r--r--source/blender/makesrna/intern/rna_meta_api.c23
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c9825
-rw-r--r--source/blender/makesrna/intern/rna_movieclip.c658
-rw-r--r--source/blender/makesrna/intern/rna_nla.c1368
-rw-r--r--source/blender/makesrna/intern/rna_nodetree.c13867
-rw-r--r--source/blender/makesrna/intern/rna_object.c4266
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c1680
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c3121
-rw-r--r--source/blender/makesrna/intern/rna_packedfile.c43
-rw-r--r--source/blender/makesrna/intern/rna_palette.c194
-rw-r--r--source/blender/makesrna/intern/rna_particle.c6410
-rw-r--r--source/blender/makesrna/intern/rna_pose.c2310
-rw-r--r--source/blender/makesrna/intern/rna_pose_api.c195
-rw-r--r--source/blender/makesrna/intern/rna_render.c1634
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c2270
-rw-r--r--source/blender/makesrna/intern/rna_rna.c4632
-rw-r--r--source/blender/makesrna/intern/rna_scene.c12305
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c705
-rw-r--r--source/blender/makesrna/intern/rna_screen.c894
-rw-r--r--source/blender/makesrna/intern/rna_sculpt_paint.c2592
-rw-r--r--source/blender/makesrna/intern/rna_sequencer.c4307
-rw-r--r--source/blender/makesrna/intern/rna_sequencer_api.c1002
-rw-r--r--source/blender/makesrna/intern/rna_shader_fx.c1134
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c1988
-rw-r--r--source/blender/makesrna/intern/rna_sound.c92
-rw-r--r--source/blender/makesrna/intern/rna_sound_api.c35
-rw-r--r--source/blender/makesrna/intern/rna_space.c9400
-rw-r--r--source/blender/makesrna/intern/rna_space_api.c115
-rw-r--r--source/blender/makesrna/intern/rna_speaker.c218
-rw-r--r--source/blender/makesrna/intern/rna_test.c268
-rw-r--r--source/blender/makesrna/intern/rna_text.c262
-rw-r--r--source/blender/makesrna/intern/rna_text_api.c31
-rw-r--r--source/blender/makesrna/intern/rna_texture.c2745
-rw-r--r--source/blender/makesrna/intern/rna_texture_api.c52
-rw-r--r--source/blender/makesrna/intern/rna_timeline.c69
-rw-r--r--source/blender/makesrna/intern/rna_tracking.c3809
-rw-r--r--source/blender/makesrna/intern/rna_ui.c2488
-rw-r--r--source/blender/makesrna/intern/rna_ui_api.c2355
-rw-r--r--source/blender/makesrna/intern/rna_userdef.c9295
-rw-r--r--source/blender/makesrna/intern/rna_vfont.c63
-rw-r--r--source/blender/makesrna/intern/rna_vfont_api.c35
-rw-r--r--source/blender/makesrna/intern/rna_wm.c3960
-rw-r--r--source/blender/makesrna/intern/rna_wm_api.c1755
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo.c2205
-rw-r--r--source/blender/makesrna/intern/rna_wm_gizmo_api.c428
-rw-r--r--source/blender/makesrna/intern/rna_workspace.c532
-rw-r--r--source/blender/makesrna/intern/rna_workspace_api.c219
-rw-r--r--source/blender/makesrna/intern/rna_world.c327
99 files changed, 109240 insertions, 97966 deletions
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 4d8907cabd7..eae47469f10 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -19,112 +19,112 @@
# ***** END GPL LICENSE BLOCK *****
if(CMAKE_COMPILER_IS_GNUCC)
- # add here so we fail early.
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
+ # add here so we fail early.
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
endif()
# files rna_access.c rna_define.c makesrna.c intentionally excluded.
set(DEFSRC
- rna_ID.c
- rna_action.c
- rna_animation.c
- rna_animviz.c
- rna_armature.c
- rna_boid.c
- rna_brush.c
- rna_cachefile.c
- rna_camera.c
- rna_cloth.c
- rna_collection.c
- rna_color.c
- rna_constraint.c
- rna_context.c
- rna_curve.c
- rna_depsgraph.c
- rna_dynamicpaint.c
- rna_fcurve.c
- rna_fluidsim.c
- rna_gpencil.c
- rna_gpencil_modifier.c
- rna_image.c
- rna_key.c
- rna_lattice.c
- rna_layer.c
- rna_light.c
- rna_lightprobe.c
- rna_linestyle.c
- rna_main.c
- rna_mask.c
- rna_material.c
- rna_mesh.c
- rna_meta.c
- rna_modifier.c
- rna_movieclip.c
- rna_nla.c
- rna_nodetree.c
- rna_object.c
- rna_object_force.c
- rna_packedfile.c
- rna_palette.c
- rna_particle.c
- rna_pose.c
- rna_render.c
- rna_rigidbody.c
- rna_rna.c
- rna_scene.c
- rna_screen.c
- rna_sculpt_paint.c
- rna_sequencer.c
- rna_shader_fx.c
- rna_smoke.c
- rna_sound.c
- rna_space.c
- rna_speaker.c
- rna_test.c
- rna_text.c
- rna_texture.c
- rna_timeline.c
- rna_tracking.c
- rna_ui.c
- rna_userdef.c
- rna_vfont.c
- rna_wm.c
- rna_wm_gizmo.c
- rna_workspace.c
- rna_world.c
+ rna_ID.c
+ rna_action.c
+ rna_animation.c
+ rna_animviz.c
+ rna_armature.c
+ rna_boid.c
+ rna_brush.c
+ rna_cachefile.c
+ rna_camera.c
+ rna_cloth.c
+ rna_collection.c
+ rna_color.c
+ rna_constraint.c
+ rna_context.c
+ rna_curve.c
+ rna_depsgraph.c
+ rna_dynamicpaint.c
+ rna_fcurve.c
+ rna_fluidsim.c
+ rna_gpencil.c
+ rna_gpencil_modifier.c
+ rna_image.c
+ rna_key.c
+ rna_lattice.c
+ rna_layer.c
+ rna_light.c
+ rna_lightprobe.c
+ rna_linestyle.c
+ rna_main.c
+ rna_mask.c
+ rna_material.c
+ rna_mesh.c
+ rna_meta.c
+ rna_modifier.c
+ rna_movieclip.c
+ rna_nla.c
+ rna_nodetree.c
+ rna_object.c
+ rna_object_force.c
+ rna_packedfile.c
+ rna_palette.c
+ rna_particle.c
+ rna_pose.c
+ rna_render.c
+ rna_rigidbody.c
+ rna_rna.c
+ rna_scene.c
+ rna_screen.c
+ rna_sculpt_paint.c
+ rna_sequencer.c
+ rna_shader_fx.c
+ rna_smoke.c
+ rna_sound.c
+ rna_space.c
+ rna_speaker.c
+ rna_test.c
+ rna_text.c
+ rna_texture.c
+ rna_timeline.c
+ rna_tracking.c
+ rna_ui.c
+ rna_userdef.c
+ rna_vfont.c
+ rna_wm.c
+ rna_wm_gizmo.c
+ rna_workspace.c
+ rna_world.c
)
set(APISRC
- rna_action_api.c
- rna_animation_api.c
- rna_armature_api.c
- rna_camera_api.c
- rna_curve_api.c
- rna_fcurve_api.c
- rna_image_api.c
- rna_lattice_api.c
- rna_main_api.c
- rna_material_api.c
- rna_mesh_api.c
- rna_meta_api.c
- rna_object_api.c
- rna_pose_api.c
- rna_scene_api.c
- rna_sequencer_api.c
- rna_sound_api.c
- rna_space_api.c
- rna_text_api.c
- rna_texture_api.c
- rna_ui_api.c
- rna_vfont_api.c
- rna_wm_api.c
- rna_wm_gizmo_api.c
- rna_workspace_api.c
+ rna_action_api.c
+ rna_animation_api.c
+ rna_armature_api.c
+ rna_camera_api.c
+ rna_curve_api.c
+ rna_fcurve_api.c
+ rna_image_api.c
+ rna_lattice_api.c
+ rna_main_api.c
+ rna_material_api.c
+ rna_mesh_api.c
+ rna_meta_api.c
+ rna_object_api.c
+ rna_pose_api.c
+ rna_scene_api.c
+ rna_sequencer_api.c
+ rna_sound_api.c
+ rna_space_api.c
+ rna_text_api.c
+ rna_texture_api.c
+ rna_ui_api.c
+ rna_vfont_api.c
+ rna_wm_api.c
+ rna_wm_gizmo_api.c
+ rna_workspace_api.c
)
string(REGEX REPLACE "rna_([a-zA-Z0-9_-]*).c" "${CMAKE_CURRENT_BINARY_DIR}/rna_\\1_gen.c" GENSRC "${DEFSRC}")
list(APPEND GENSRC
- "${CMAKE_CURRENT_BINARY_DIR}/rna_prototypes_gen.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/rna_prototypes_gen.h"
)
set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE)
@@ -134,36 +134,36 @@ set_source_files_properties(${GENSRC} PROPERTIES GENERATED TRUE)
# less strict flags for generated source
set(GENSRC_CFLAGS)
if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
- set(GENSRC_CFLAGS "-Wno-missing-prototypes")
+ set(GENSRC_CFLAGS "-Wno-missing-prototypes")
endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
- set(GENSRC_CFLAGS "${GENSRC_CFLAGS} -Wno-missing-variable-declarations")
+ set(GENSRC_CFLAGS "${GENSRC_CFLAGS} -Wno-missing-variable-declarations")
endif()
if(GENSRC_CFLAGS)
- set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
+ set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
endif()
unset(GENSRC_CFLAGS)
set(SRC_RNA_INC
- ../RNA_access.h
- ../RNA_define.h
- ../RNA_documentation.h
- ../RNA_enum_types.h
- ../RNA_types.h
+ ../RNA_access.h
+ ../RNA_define.h
+ ../RNA_documentation.h
+ ../RNA_enum_types.h
+ ../RNA_types.h
)
set(SRC
- makesrna.c
- rna_define.c
- ${DEFSRC}
- ${APISRC}
- ../../../../intern/clog/clog.c
- ../../../../intern/guardedalloc/intern/mallocn.c
- ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
- ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
- ../../../../intern/guardedalloc/intern/mmap_win.c
+ makesrna.c
+ rna_define.c
+ ${DEFSRC}
+ ${APISRC}
+ ../../../../intern/clog/clog.c
+ ../../../../intern/guardedalloc/intern/mallocn.c
+ ../../../../intern/guardedalloc/intern/mallocn_guarded_impl.c
+ ../../../../intern/guardedalloc/intern/mallocn_lockfree_impl.c
+ ../../../../intern/guardedalloc/intern/mmap_win.c
)
set(INC
@@ -175,174 +175,174 @@ set(INC_SYS
)
if(WITH_CYCLES)
- add_definitions(-DWITH_CYCLES)
+ add_definitions(-DWITH_CYCLES)
endif()
if(WITH_PYTHON)
- add_definitions(-DWITH_PYTHON)
- list(APPEND INC
- ../../python
- )
+ add_definitions(-DWITH_PYTHON)
+ list(APPEND INC
+ ../../python
+ )
endif()
if(WITH_IMAGE_OPENEXR)
- add_definitions(-DWITH_OPENEXR)
+ add_definitions(-DWITH_OPENEXR)
endif()
if(WITH_OPENIMAGEIO)
- add_definitions(-DWITH_OPENIMAGEIO)
+ add_definitions(-DWITH_OPENIMAGEIO)
endif()
if(WITH_IMAGE_TIFF)
- add_definitions(-DWITH_TIFF)
+ add_definitions(-DWITH_TIFF)
endif()
if(WITH_IMAGE_OPENJPEG)
- add_definitions(-DWITH_OPENJPEG)
+ add_definitions(-DWITH_OPENJPEG)
endif()
if(WITH_IMAGE_DDS)
- add_definitions(-DWITH_DDS)
+ add_definitions(-DWITH_DDS)
endif()
if(WITH_IMAGE_CINEON)
- add_definitions(-DWITH_CINEON)
+ add_definitions(-DWITH_CINEON)
endif()
if(WITH_IMAGE_HDR)
- add_definitions(-DWITH_HDR)
+ add_definitions(-DWITH_HDR)
endif()
if(WITH_AUDASPACE)
- add_definitions(-DWITH_AUDASPACE)
+ add_definitions(-DWITH_AUDASPACE)
- list(APPEND INC_SYS
- ${AUDASPACE_C_INCLUDE_DIRS}
- )
+ list(APPEND INC_SYS
+ ${AUDASPACE_C_INCLUDE_DIRS}
+ )
endif()
if(WITH_CODEC_FFMPEG)
- list(APPEND INC
- ../../../../intern/ffmpeg
- )
- list(APPEND INC_SYS
- ${FFMPEG_INCLUDE_DIRS}
- )
- add_definitions(-DWITH_FFMPEG)
+ list(APPEND INC
+ ../../../../intern/ffmpeg
+ )
+ list(APPEND INC_SYS
+ ${FFMPEG_INCLUDE_DIRS}
+ )
+ add_definitions(-DWITH_FFMPEG)
endif()
if(WITH_MOD_FLUID)
- add_definitions(-DWITH_MOD_FLUID)
+ add_definitions(-DWITH_MOD_FLUID)
endif()
if(WITH_FFTW3)
- add_definitions(-DWITH_FFTW3)
+ add_definitions(-DWITH_FFTW3)
endif()
if(WITH_MOD_SMOKE)
- add_definitions(-DWITH_SMOKE)
+ add_definitions(-DWITH_SMOKE)
endif()
if(WITH_MOD_OCEANSIM)
- add_definitions(-DWITH_OCEANSIM)
+ add_definitions(-DWITH_OCEANSIM)
endif()
if(WITH_SDL)
- if(WITH_SDL_DYNLOAD)
- add_definitions(-DWITH_SDL_DYNLOAD)
- list(APPEND INC
- ../../../../extern/sdlew/include
- )
- endif()
- add_definitions(-DWITH_SDL)
+ if(WITH_SDL_DYNLOAD)
+ add_definitions(-DWITH_SDL_DYNLOAD)
+ list(APPEND INC
+ ../../../../extern/sdlew/include
+ )
+ endif()
+ add_definitions(-DWITH_SDL)
endif()
if(WITH_OPENAL)
- add_definitions(-DWITH_OPENAL)
+ add_definitions(-DWITH_OPENAL)
endif()
if(WITH_JACK)
- add_definitions(-DWITH_JACK)
+ add_definitions(-DWITH_JACK)
endif()
if(WITH_OPENCOLLADA)
- add_definitions(-DWITH_COLLADA)
+ add_definitions(-DWITH_COLLADA)
endif()
if(WITH_INTERNATIONAL)
- add_definitions(-DWITH_INTERNATIONAL)
+ add_definitions(-DWITH_INTERNATIONAL)
endif()
if(WITH_ALEMBIC)
- list(APPEND INC
- ../../alembic
- )
- add_definitions(-DWITH_ALEMBIC)
+ list(APPEND INC
+ ../../alembic
+ )
+ add_definitions(-DWITH_ALEMBIC)
endif()
if(WITH_BULLET)
- list(APPEND INC
- ../../../../intern/rigidbody
- )
- add_definitions(-DWITH_BULLET)
+ list(APPEND INC
+ ../../../../intern/rigidbody
+ )
+ add_definitions(-DWITH_BULLET)
endif()
if(WITH_FREESTYLE)
- list(APPEND INC
- ../../freestyle
- )
- add_definitions(-DWITH_FREESTYLE)
+ list(APPEND INC
+ ../../freestyle
+ )
+ add_definitions(-DWITH_FREESTYLE)
endif()
if(WITH_OPENSUBDIV)
- list(APPEND INC
- ../../../../intern/opensubdiv
- )
- add_definitions(-DWITH_OPENSUBDIV)
+ list(APPEND INC
+ ../../../../intern/opensubdiv
+ )
+ add_definitions(-DWITH_OPENSUBDIV)
endif()
if(WITH_OPENVDB)
- add_definitions(-DWITH_OPENVDB)
+ add_definitions(-DWITH_OPENVDB)
- if(WITH_OPENVDB_BLOSC)
- add_definitions(-DWITH_OPENVDB_BLOSC)
- endif()
+ if(WITH_OPENVDB_BLOSC)
+ add_definitions(-DWITH_OPENVDB_BLOSC)
+ endif()
endif()
if(WITH_INPUT_NDOF)
- add_definitions(-DWITH_INPUT_NDOF)
+ add_definitions(-DWITH_INPUT_NDOF)
endif()
# Build makesrna executable
blender_include_dirs(
- .
- ..
- ../../blenfont
- ../../blenkernel
- ../../blenlib
- ../../bmesh
- ../../blentranslation
- ../../depsgraph
- ../../draw
- ../../gpu
- ../../imbuf
- ../../ikplugin
- ../../makesdna
- ../../nodes/
- ../../physics
- ../../windowmanager
- ../../editors/include
- ../../render/extern/include
- ../../../../intern/cycles/blender
- ../../../../intern/guardedalloc
- ../../../../intern/glew-mx
- ../../../../intern/atomic
- ../../../../intern/memutil
- ../../../../intern/smoke/extern
+ .
+ ..
+ ../../blenfont
+ ../../blenkernel
+ ../../blenlib
+ ../../bmesh
+ ../../blentranslation
+ ../../depsgraph
+ ../../draw
+ ../../gpu
+ ../../imbuf
+ ../../ikplugin
+ ../../makesdna
+ ../../nodes/
+ ../../physics
+ ../../windowmanager
+ ../../editors/include
+ ../../render/extern/include
+ ../../../../intern/cycles/blender
+ ../../../../intern/guardedalloc
+ ../../../../intern/glew-mx
+ ../../../../intern/atomic
+ ../../../../intern/memutil
+ ../../../../intern/smoke/extern
)
blender_include_dirs_sys(
- "${GLEW_INCLUDE_PATH}"
+ "${GLEW_INCLUDE_PATH}"
)
add_cc_flags_custom_test(makesrna)
@@ -356,41 +356,41 @@ target_link_libraries(makesrna bf_dna_blenlib)
# Output rna_*_gen.c
# note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes
add_custom_command(
- OUTPUT ${GENSRC}
- COMMAND "$<TARGET_FILE:makesrna>" ${CMAKE_CURRENT_BINARY_DIR}/
- DEPENDS makesrna
+ OUTPUT ${GENSRC}
+ COMMAND "$<TARGET_FILE:makesrna>" ${CMAKE_CURRENT_BINARY_DIR}/
+ DEPENDS makesrna
)
# Build bf_rna
set(SRC
- rna_access.c
- ${GENSRC}
+ rna_access.c
+ ${GENSRC}
- ${SRC_RNA_INC}
- rna_internal.h
- rna_internal_types.h
- rna_mesh_utils.h
+ ${SRC_RNA_INC}
+ rna_internal.h
+ rna_internal_types.h
+ rna_mesh_utils.h
)
set(LIB
- bf_dna
- bf_editor_armature
- bf_editor_curve
- bf_editor_gizmo_library
- bf_editor_gpencil
- bf_editor_mesh
- bf_editor_object
- bf_editor_physics
- bf_editor_render
- bf_editor_scene
- bf_editor_sculpt_paint
- bf_editor_space_clip
- bf_editor_space_file
- bf_editor_space_image
- bf_editor_space_info
- bf_editor_space_node
- bf_editor_space_view3d
- bf_editor_transform
+ bf_dna
+ bf_editor_armature
+ bf_editor_curve
+ bf_editor_gizmo_library
+ bf_editor_gpencil
+ bf_editor_mesh
+ bf_editor_object
+ bf_editor_physics
+ bf_editor_render
+ bf_editor_scene
+ bf_editor_sculpt_paint
+ bf_editor_space_clip
+ bf_editor_space_file
+ bf_editor_space_image
+ bf_editor_space_info
+ bf_editor_space_node
+ bf_editor_space_view3d
+ bf_editor_transform
)
add_definitions(${GL_DEFINITIONS})
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 8e0af001eec..30b21e131ed 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -57,7 +57,7 @@ static int debugSRNA = 0;
#ifndef NDEBUG
void BLI_system_backtrace(FILE *fp)
{
- (void)fp;
+ (void)fp;
}
#endif
@@ -68,162 +68,173 @@ void BLI_system_backtrace(FILE *fp)
#include <sys/stat.h>
static int file_older(const char *file1, const char *file2)
{
- struct stat st1, st2;
- if (debugSRNA > 0) {
- printf("compare: %s %s\n", file1, file2);
- }
+ struct stat st1, st2;
+ if (debugSRNA > 0) {
+ printf("compare: %s %s\n", file1, file2);
+ }
- if (stat(file1, &st1)) return 0;
- if (stat(file2, &st2)) return 0;
+ if (stat(file1, &st1))
+ return 0;
+ if (stat(file2, &st2))
+ return 0;
- return (st1.st_mtime < st2.st_mtime);
+ return (st1.st_mtime < st2.st_mtime);
}
static const char *makesrna_path = NULL;
/* forward declarations */
-static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc,
- const char *name_override, int close_prototype);
+static void rna_generate_static_parameter_prototypes(FILE *f,
+ StructRNA *srna,
+ FunctionDefRNA *dfunc,
+ const char *name_override,
+ int close_prototype);
/* helpers */
#define WRITE_COMMA \
- { \
- if (!first) \
- fprintf(f, ", "); \
- first = 0; \
- } (void)0
+ { \
+ if (!first) \
+ fprintf(f, ", "); \
+ first = 0; \
+ } \
+ (void)0
#define WRITE_PARAM(param) \
- { \
- WRITE_COMMA; \
- fprintf(f, param); \
- } (void)0
+ { \
+ WRITE_COMMA; \
+ fprintf(f, param); \
+ } \
+ (void)0
static int replace_if_different(const char *tmpfile, const char *dep_files[])
{
- /* return 0; *//* use for testing had edited rna */
-
-#define REN_IF_DIFF \
- { \
- FILE *file_test = fopen(orgfile, "rb"); \
- if (file_test) { \
- fclose(file_test); \
- if (fp_org) fclose(fp_org); \
- if (fp_new) fclose(fp_new); \
- if (remove(orgfile) != 0) { \
- CLOG_ERROR(&LOG, "remove error (%s): \"%s\"", \
- strerror(errno), orgfile); \
- return -1; \
- } \
- } \
- } \
- if (rename(tmpfile, orgfile) != 0) { \
- CLOG_ERROR(&LOG, "rename error (%s): \"%s\" -> \"%s\"", \
- strerror(errno), tmpfile, orgfile); \
- return -1; \
- } \
- remove(tmpfile); \
- return 1 \
-
-/* end REN_IF_DIFF */
-
-
- FILE *fp_new = NULL, *fp_org = NULL;
- int len_new, len_org;
- char *arr_new, *arr_org;
- int cmp;
-
- char orgfile[4096];
-
- strcpy(orgfile, tmpfile);
- orgfile[strlen(orgfile) - strlen(TMP_EXT)] = '\0'; /* strip '.tmp' */
-
- fp_org = fopen(orgfile, "rb");
-
- if (fp_org == NULL) {
- REN_IF_DIFF;
- }
-
-
- /* XXX, trick to work around dependency problem
- * assumes dep_files is in the same dir as makesrna.c, which is true for now. */
-
- if (1) {
- /* first check if makesrna.c is newer then generated files
- * for development on makesrna.c you may want to disable this */
- if (file_older(orgfile, __FILE__)) {
- REN_IF_DIFF;
- }
-
- if (file_older(orgfile, makesrna_path)) {
- REN_IF_DIFF;
- }
-
- /* now check if any files we depend on are newer then any generated files */
- if (dep_files) {
- int pass;
- for (pass = 0; dep_files[pass]; pass++) {
- char from_path[4096] = __FILE__;
- char *p1, *p2;
-
- /* dir only */
- p1 = strrchr(from_path, '/');
- p2 = strrchr(from_path, '\\');
- strcpy((p1 > p2 ? p1 : p2) + 1, dep_files[pass]);
- /* account for build deps, if makesrna.c (this file) is newer */
- if (file_older(orgfile, from_path)) {
- REN_IF_DIFF;
- }
- }
- }
- }
- /* XXX end dep trick */
-
-
- fp_new = fopen(tmpfile, "rb");
-
- if (fp_new == NULL) {
- /* shouldn't happen, just to be safe */
- CLOG_ERROR(&LOG, "open error: \"%s\"", tmpfile);
- fclose(fp_org);
- return -1;
- }
-
- fseek(fp_new, 0L, SEEK_END); len_new = ftell(fp_new); fseek(fp_new, 0L, SEEK_SET);
- fseek(fp_org, 0L, SEEK_END); len_org = ftell(fp_org); fseek(fp_org, 0L, SEEK_SET);
-
-
- if (len_new != len_org) {
- fclose(fp_new); fp_new = NULL;
- fclose(fp_org); fp_org = NULL;
- REN_IF_DIFF;
- }
-
- /* now compare the files... */
- arr_new = MEM_mallocN(sizeof(char) * len_new, "rna_cmp_file_new");
- arr_org = MEM_mallocN(sizeof(char) * len_org, "rna_cmp_file_org");
-
- if (fread(arr_new, sizeof(char), len_new, fp_new) != len_new) {
- CLOG_ERROR(&LOG, "unable to read file %s for comparison.", tmpfile);
- }
- if (fread(arr_org, sizeof(char), len_org, fp_org) != len_org) {
- CLOG_ERROR(&LOG, "unable to read file %s for comparison.", orgfile);
- }
-
- fclose(fp_new); fp_new = NULL;
- fclose(fp_org); fp_org = NULL;
-
- cmp = memcmp(arr_new, arr_org, len_new);
-
- MEM_freeN(arr_new);
- MEM_freeN(arr_org);
-
- if (cmp) {
- REN_IF_DIFF;
- }
- else {
- remove(tmpfile);
- return 0;
- }
+ /* return 0; */ /* use for testing had edited rna */
+
+#define REN_IF_DIFF \
+ { \
+ FILE *file_test = fopen(orgfile, "rb"); \
+ if (file_test) { \
+ fclose(file_test); \
+ if (fp_org) \
+ fclose(fp_org); \
+ if (fp_new) \
+ fclose(fp_new); \
+ if (remove(orgfile) != 0) { \
+ CLOG_ERROR(&LOG, "remove error (%s): \"%s\"", strerror(errno), orgfile); \
+ return -1; \
+ } \
+ } \
+ } \
+ if (rename(tmpfile, orgfile) != 0) { \
+ CLOG_ERROR(&LOG, "rename error (%s): \"%s\" -> \"%s\"", strerror(errno), tmpfile, orgfile); \
+ return -1; \
+ } \
+ remove(tmpfile); \
+ return 1
+
+ /* end REN_IF_DIFF */
+
+ FILE *fp_new = NULL, *fp_org = NULL;
+ int len_new, len_org;
+ char *arr_new, *arr_org;
+ int cmp;
+
+ char orgfile[4096];
+
+ strcpy(orgfile, tmpfile);
+ orgfile[strlen(orgfile) - strlen(TMP_EXT)] = '\0'; /* strip '.tmp' */
+
+ fp_org = fopen(orgfile, "rb");
+
+ if (fp_org == NULL) {
+ REN_IF_DIFF;
+ }
+
+ /* XXX, trick to work around dependency problem
+ * assumes dep_files is in the same dir as makesrna.c, which is true for now. */
+
+ if (1) {
+ /* first check if makesrna.c is newer then generated files
+ * for development on makesrna.c you may want to disable this */
+ if (file_older(orgfile, __FILE__)) {
+ REN_IF_DIFF;
+ }
+
+ if (file_older(orgfile, makesrna_path)) {
+ REN_IF_DIFF;
+ }
+
+ /* now check if any files we depend on are newer then any generated files */
+ if (dep_files) {
+ int pass;
+ for (pass = 0; dep_files[pass]; pass++) {
+ char from_path[4096] = __FILE__;
+ char *p1, *p2;
+
+ /* dir only */
+ p1 = strrchr(from_path, '/');
+ p2 = strrchr(from_path, '\\');
+ strcpy((p1 > p2 ? p1 : p2) + 1, dep_files[pass]);
+ /* account for build deps, if makesrna.c (this file) is newer */
+ if (file_older(orgfile, from_path)) {
+ REN_IF_DIFF;
+ }
+ }
+ }
+ }
+ /* XXX end dep trick */
+
+ fp_new = fopen(tmpfile, "rb");
+
+ if (fp_new == NULL) {
+ /* shouldn't happen, just to be safe */
+ CLOG_ERROR(&LOG, "open error: \"%s\"", tmpfile);
+ fclose(fp_org);
+ return -1;
+ }
+
+ fseek(fp_new, 0L, SEEK_END);
+ len_new = ftell(fp_new);
+ fseek(fp_new, 0L, SEEK_SET);
+ fseek(fp_org, 0L, SEEK_END);
+ len_org = ftell(fp_org);
+ fseek(fp_org, 0L, SEEK_SET);
+
+ if (len_new != len_org) {
+ fclose(fp_new);
+ fp_new = NULL;
+ fclose(fp_org);
+ fp_org = NULL;
+ REN_IF_DIFF;
+ }
+
+ /* now compare the files... */
+ arr_new = MEM_mallocN(sizeof(char) * len_new, "rna_cmp_file_new");
+ arr_org = MEM_mallocN(sizeof(char) * len_org, "rna_cmp_file_org");
+
+ if (fread(arr_new, sizeof(char), len_new, fp_new) != len_new) {
+ CLOG_ERROR(&LOG, "unable to read file %s for comparison.", tmpfile);
+ }
+ if (fread(arr_org, sizeof(char), len_org, fp_org) != len_org) {
+ CLOG_ERROR(&LOG, "unable to read file %s for comparison.", orgfile);
+ }
+
+ fclose(fp_new);
+ fp_new = NULL;
+ fclose(fp_org);
+ fp_org = NULL;
+
+ cmp = memcmp(arr_new, arr_org, len_new);
+
+ MEM_freeN(arr_new);
+ MEM_freeN(arr_org);
+
+ if (cmp) {
+ REN_IF_DIFF;
+ }
+ else {
+ remove(tmpfile);
+ return 0;
+ }
#undef REN_IF_DIFF
}
@@ -232,4017 +243,4510 @@ static int replace_if_different(const char *tmpfile, const char *dep_files[])
static const char *rna_safe_id(const char *id)
{
- if (STREQ(id, "default"))
- return "default_value";
- else if (STREQ(id, "operator"))
- return "operator_value";
- else if (STREQ(id, "new"))
- return "create";
- else if (STREQ(id, "co_return")) {
- /* MSVC2015, C++ uses for coroutines */
- return "coord_return";
- }
-
- return id;
+ if (STREQ(id, "default"))
+ return "default_value";
+ else if (STREQ(id, "operator"))
+ return "operator_value";
+ else if (STREQ(id, "new"))
+ return "create";
+ else if (STREQ(id, "co_return")) {
+ /* MSVC2015, C++ uses for coroutines */
+ return "coord_return";
+ }
+
+ return id;
}
/* Sorting */
static int cmp_struct(const void *a, const void *b)
{
- const StructRNA *structa = *(const StructRNA **)a;
- const StructRNA *structb = *(const StructRNA **)b;
+ const StructRNA *structa = *(const StructRNA **)a;
+ const StructRNA *structb = *(const StructRNA **)b;
- return strcmp(structa->identifier, structb->identifier);
+ return strcmp(structa->identifier, structb->identifier);
}
static int cmp_property(const void *a, const void *b)
{
- const PropertyRNA *propa = *(const PropertyRNA **)a;
- const PropertyRNA *propb = *(const PropertyRNA **)b;
+ const PropertyRNA *propa = *(const PropertyRNA **)a;
+ const PropertyRNA *propb = *(const PropertyRNA **)b;
- if (STREQ(propa->identifier, "rna_type")) return -1;
- else if (STREQ(propb->identifier, "rna_type")) return 1;
+ if (STREQ(propa->identifier, "rna_type"))
+ return -1;
+ else if (STREQ(propb->identifier, "rna_type"))
+ return 1;
- if (STREQ(propa->identifier, "name")) return -1;
- else if (STREQ(propb->identifier, "name")) return 1;
+ if (STREQ(propa->identifier, "name"))
+ return -1;
+ else if (STREQ(propb->identifier, "name"))
+ return 1;
- return strcmp(propa->name, propb->name);
+ return strcmp(propa->name, propb->name);
}
static int cmp_def_struct(const void *a, const void *b)
{
- const StructDefRNA *dsa = *(const StructDefRNA **)a;
- const StructDefRNA *dsb = *(const StructDefRNA **)b;
+ const StructDefRNA *dsa = *(const StructDefRNA **)a;
+ const StructDefRNA *dsb = *(const StructDefRNA **)b;
- return cmp_struct(&dsa->srna, &dsb->srna);
+ return cmp_struct(&dsa->srna, &dsb->srna);
}
static int cmp_def_property(const void *a, const void *b)
{
- const PropertyDefRNA *dpa = *(const PropertyDefRNA **)a;
- const PropertyDefRNA *dpb = *(const PropertyDefRNA **)b;
+ const PropertyDefRNA *dpa = *(const PropertyDefRNA **)a;
+ const PropertyDefRNA *dpb = *(const PropertyDefRNA **)b;
- return cmp_property(&dpa->prop, &dpb->prop);
+ return cmp_property(&dpa->prop, &dpb->prop);
}
static void rna_sortlist(ListBase *listbase, int (*cmp)(const void *, const void *))
{
- Link *link;
- void **array;
- int a, size;
+ Link *link;
+ void **array;
+ int a, size;
- if (listbase->first == listbase->last)
- return;
+ if (listbase->first == listbase->last)
+ return;
- for (size = 0, link = listbase->first; link; link = link->next)
- size++;
+ for (size = 0, link = listbase->first; link; link = link->next)
+ size++;
- array = MEM_mallocN(sizeof(void *) * size, "rna_sortlist");
- for (a = 0, link = listbase->first; link; link = link->next, a++)
- array[a] = link;
+ array = MEM_mallocN(sizeof(void *) * size, "rna_sortlist");
+ for (a = 0, link = listbase->first; link; link = link->next, a++)
+ array[a] = link;
- qsort(array, size, sizeof(void *), cmp);
+ qsort(array, size, sizeof(void *), cmp);
- listbase->first = listbase->last = NULL;
- for (a = 0; a < size; a++) {
- link = array[a];
- link->next = link->prev = NULL;
- rna_addtail(listbase, link);
- }
+ listbase->first = listbase->last = NULL;
+ for (a = 0; a < size; a++) {
+ link = array[a];
+ link->next = link->prev = NULL;
+ rna_addtail(listbase, link);
+ }
- MEM_freeN(array);
+ MEM_freeN(array);
}
/* Preprocessing */
static void rna_print_c_string(FILE *f, const char *str)
{
- static const char *escape[] = {"\''", "\"\"", "\??", "\\\\", "\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
- int i, j;
-
- if (!str) {
- fprintf(f, "NULL");
- return;
- }
-
- fprintf(f, "\"");
- for (i = 0; str[i]; i++) {
- for (j = 0; escape[j]; j++)
- if (str[i] == escape[j][0])
- break;
-
- if (escape[j]) fprintf(f, "\\%c", escape[j][1]);
- else fprintf(f, "%c", str[i]);
- }
- fprintf(f, "\"");
+ static const char *escape[] = {
+ "\''", "\"\"", "\??", "\\\\", "\aa", "\bb", "\ff", "\nn", "\rr", "\tt", "\vv", NULL};
+ int i, j;
+
+ if (!str) {
+ fprintf(f, "NULL");
+ return;
+ }
+
+ fprintf(f, "\"");
+ for (i = 0; str[i]; i++) {
+ for (j = 0; escape[j]; j++)
+ if (str[i] == escape[j][0])
+ break;
+
+ if (escape[j])
+ fprintf(f, "\\%c", escape[j][1]);
+ else
+ fprintf(f, "%c", str[i]);
+ }
+ fprintf(f, "\"");
}
static void rna_print_data_get(FILE *f, PropertyDefRNA *dp)
{
- if (dp->dnastructfromname && dp->dnastructfromprop)
- fprintf(f, " %s *data = (%s *)(((%s *)ptr->data)->%s);\n", dp->dnastructname, dp->dnastructname,
- dp->dnastructfromname, dp->dnastructfromprop);
- else
- fprintf(f, " %s *data = (%s *)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
+ if (dp->dnastructfromname && dp->dnastructfromprop)
+ fprintf(f,
+ " %s *data = (%s *)(((%s *)ptr->data)->%s);\n",
+ dp->dnastructname,
+ dp->dnastructname,
+ dp->dnastructfromname,
+ dp->dnastructfromprop);
+ else
+ fprintf(f, " %s *data = (%s *)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
}
static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp))
{
- fprintf(f, " ID *id = ptr->id.data;\n");
+ fprintf(f, " ID *id = ptr->id.data;\n");
}
-static void rna_construct_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
+static void rna_construct_function_name(
+ char *buffer, int size, const char *structname, const char *propname, const char *type)
{
- snprintf(buffer, size, "%s_%s_%s", structname, propname, type);
+ snprintf(buffer, size, "%s_%s_%s", structname, propname, type);
}
-static void rna_construct_wrapper_function_name(char *buffer, int size, const char *structname, const char *propname, const char *type)
+static void rna_construct_wrapper_function_name(
+ char *buffer, int size, const char *structname, const char *propname, const char *type)
{
- if (type == NULL || type[0] == '\0')
- snprintf(buffer, size, "%s_%s", structname, propname);
- else
- snprintf(buffer, size, "%s_%s_%s", structname, propname, type);
+ if (type == NULL || type[0] == '\0')
+ snprintf(buffer, size, "%s_%s", structname, propname);
+ else
+ snprintf(buffer, size, "%s_%s_%s", structname, propname, type);
}
-static char *rna_alloc_function_name(const char *structname, const char *propname, const char *type)
+static char *rna_alloc_function_name(const char *structname,
+ const char *propname,
+ const char *type)
{
- AllocDefRNA *alloc;
- char buffer[2048];
- char *result;
+ AllocDefRNA *alloc;
+ char buffer[2048];
+ char *result;
- rna_construct_function_name(buffer, sizeof(buffer), structname, propname, type);
- result = MEM_callocN(sizeof(char) * strlen(buffer) + 1, "rna_alloc_function_name");
- strcpy(result, buffer);
+ rna_construct_function_name(buffer, sizeof(buffer), structname, propname, type);
+ result = MEM_callocN(sizeof(char) * strlen(buffer) + 1, "rna_alloc_function_name");
+ strcpy(result, buffer);
- alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA");
- alloc->mem = result;
- rna_addtail(&DefRNA.allocs, alloc);
+ alloc = MEM_callocN(sizeof(AllocDefRNA), "AllocDefRNA");
+ alloc->mem = result;
+ rna_addtail(&DefRNA.allocs, alloc);
- return result;
+ return result;
}
static StructRNA *rna_find_struct(const char *identifier)
{
- StructDefRNA *ds;
+ StructDefRNA *ds;
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (STREQ(ds->srna->identifier, identifier))
- return ds->srna;
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (STREQ(ds->srna->identifier, identifier))
+ return ds->srna;
- return NULL;
+ return NULL;
}
static const char *rna_find_type(const char *type)
{
- StructDefRNA *ds;
+ StructDefRNA *ds;
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (ds->dnaname && STREQ(ds->dnaname, type))
- return ds->srna->identifier;
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (ds->dnaname && STREQ(ds->dnaname, type))
+ return ds->srna->identifier;
- return NULL;
+ return NULL;
}
static const char *rna_find_dna_type(const char *type)
{
- StructDefRNA *ds;
+ StructDefRNA *ds;
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (STREQ(ds->srna->identifier, type))
- return ds->dnaname;
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (STREQ(ds->srna->identifier, type))
+ return ds->dnaname;
- return NULL;
+ return NULL;
}
static const char *rna_type_type_name(PropertyRNA *prop)
{
- switch (prop->type) {
- case PROP_BOOLEAN:
- return "bool";
- case PROP_INT:
- case PROP_ENUM:
- return "int";
- case PROP_FLOAT:
- return "float";
- case PROP_STRING:
- if (prop->flag & PROP_THICK_WRAP) {
- return "char *";
- }
- else {
- return "const char *";
- }
- default:
- return NULL;
- }
+ switch (prop->type) {
+ case PROP_BOOLEAN:
+ return "bool";
+ case PROP_INT:
+ case PROP_ENUM:
+ return "int";
+ case PROP_FLOAT:
+ return "float";
+ case PROP_STRING:
+ if (prop->flag & PROP_THICK_WRAP) {
+ return "char *";
+ }
+ else {
+ return "const char *";
+ }
+ default:
+ return NULL;
+ }
}
static const char *rna_type_type(PropertyRNA *prop)
{
- const char *type;
+ const char *type;
- type = rna_type_type_name(prop);
+ type = rna_type_type_name(prop);
- if (type)
- return type;
+ if (type)
+ return type;
- return "PointerRNA";
+ return "PointerRNA";
}
static const char *rna_type_struct(PropertyRNA *prop)
{
- const char *type;
+ const char *type;
- type = rna_type_type_name(prop);
+ type = rna_type_type_name(prop);
- if (type)
- return "";
+ if (type)
+ return "";
- return "struct ";
+ return "struct ";
}
static const char *rna_parameter_type_name(PropertyRNA *parm)
{
- const char *type;
-
- type = rna_type_type_name(parm);
-
- if (type)
- return type;
-
- switch (parm->type) {
- case PROP_POINTER:
- {
- PointerPropertyRNA *pparm = (PointerPropertyRNA *)parm;
-
- if (parm->flag_parameter & PARM_RNAPTR)
- return "PointerRNA";
- else
- return rna_find_dna_type((const char *)pparm->type);
- }
- case PROP_COLLECTION:
- {
- return "CollectionListBase";
- }
- default:
- return "<error, no type specified>";
- }
+ const char *type;
+
+ type = rna_type_type_name(parm);
+
+ if (type)
+ return type;
+
+ switch (parm->type) {
+ case PROP_POINTER: {
+ PointerPropertyRNA *pparm = (PointerPropertyRNA *)parm;
+
+ if (parm->flag_parameter & PARM_RNAPTR)
+ return "PointerRNA";
+ else
+ return rna_find_dna_type((const char *)pparm->type);
+ }
+ case PROP_COLLECTION: {
+ return "CollectionListBase";
+ }
+ default:
+ return "<error, no type specified>";
+ }
}
static int rna_enum_bitmask(PropertyRNA *prop)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- int a, mask = 0;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ int a, mask = 0;
- if (eprop->item) {
- for (a = 0; a < eprop->totitem; a++)
- if (eprop->item[a].identifier[0])
- mask |= eprop->item[a].value;
- }
+ if (eprop->item) {
+ for (a = 0; a < eprop->totitem; a++)
+ if (eprop->item[a].identifier[0])
+ mask |= eprop->item[a].value;
+ }
- return mask;
+ return mask;
}
static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp)
{
- return ( (prop->type == PROP_FLOAT) &&
- (prop->subtype == PROP_COLOR || prop->subtype == PROP_COLOR_GAMMA) &&
- (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) );
+ return ((prop->type == PROP_FLOAT) &&
+ (prop->subtype == PROP_COLOR || prop->subtype == PROP_COLOR_GAMMA) &&
+ (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0));
}
static const char *rna_function_string(void *func)
{
- return (func) ? (const char *)func : "NULL";
+ return (func) ? (const char *)func : "NULL";
}
static void rna_float_print(FILE *f, float num)
{
- if (num == -FLT_MAX) fprintf(f, "-FLT_MAX");
- else if (num == FLT_MAX) fprintf(f, "FLT_MAX");
- else if ((ABS(num) < INT64_MAX) && ((int64_t)num == num)) fprintf(f, "%.1ff", num);
- else fprintf(f, "%.10ff", num);
+ if (num == -FLT_MAX)
+ fprintf(f, "-FLT_MAX");
+ else if (num == FLT_MAX)
+ fprintf(f, "FLT_MAX");
+ else if ((ABS(num) < INT64_MAX) && ((int64_t)num == num))
+ fprintf(f, "%.1ff", num);
+ else
+ fprintf(f, "%.10ff", num);
}
static void rna_int_print(FILE *f, int num)
{
- if (num == INT_MIN) fprintf(f, "INT_MIN");
- else if (num == INT_MAX) fprintf(f, "INT_MAX");
- else fprintf(f, "%d", num);
+ if (num == INT_MIN)
+ fprintf(f, "INT_MIN");
+ else if (num == INT_MAX)
+ fprintf(f, "INT_MAX");
+ else
+ fprintf(f, "%d", num);
}
-static char *rna_def_property_get_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
- const char *manualfunc)
+static char *rna_def_property_get_func(
+ FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
{
- char *func;
-
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
-
- if (!manualfunc) {
- if (!dp->dnastructname || !dp->dnaname) {
- CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return NULL;
- }
-
- /* typecheck, */
- if (dp->dnatype && *dp->dnatype) {
-
- if (prop->type == PROP_FLOAT) {
- if (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
- if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
- CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
- srna->identifier, prop->identifier, dp->dnatype,
- RNA_property_typename(prop->type));
- DefRNA.error = 1;
- return NULL;
- }
- }
- }
- else if (prop->type == PROP_INT || prop->type == PROP_BOOLEAN || prop->type == PROP_ENUM) {
- if (IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
- CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
- srna->identifier, prop->identifier, dp->dnatype,
- RNA_property_typename(prop->type));
- DefRNA.error = 1;
- return NULL;
- }
- }
- }
-
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
-
- switch (prop->type) {
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
- }
- else {
- const PropertySubType subtype = prop->subtype;
- const char *string_copy_func = (subtype == PROP_FILEPATH ||
- subtype == PROP_DIRPATH ||
- subtype == PROP_FILENAME ||
- subtype == PROP_BYTESTRING) ?
- "BLI_strncpy" : "BLI_strncpy_utf8";
-
- rna_print_data_get(f, dp);
-
- if (!(prop->flag & PROP_NEVER_NULL)) {
- fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
- fprintf(f, " *value = '\\0';\n");
- fprintf(f, " return;\n");
- fprintf(f, " }\n");
- }
-
- if (sprop->maxlength)
- fprintf(f, " %s(value, data->%s, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
- else
- fprintf(f, " %s(value, data->%s, sizeof(data->%s));\n", string_copy_func,
- dp->dnaname, dp->dnaname);
- }
- fprintf(f, "}\n\n");
- break;
- }
- case PROP_POINTER:
- {
- fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
- }
- else {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- rna_print_data_get(f, dp);
- if (dp->dnapointerlevel == 0)
- fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n",
- (const char *)pprop->type, dp->dnaname);
- else
- fprintf(f, " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
- (const char *)pprop->type, dp->dnaname);
- }
- fprintf(f, "}\n\n");
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
-
- fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- if (STREQ(manualfunc, "rna_iterator_listbase_get") ||
- STREQ(manualfunc, "rna_iterator_array_get") ||
- STREQ(manualfunc, "rna_iterator_array_dereference_get"))
- {
- fprintf(f, " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
- (cprop->item_type) ? (const char *)cprop->item_type : "UnknownType", manualfunc);
- }
- else {
- fprintf(f, " return %s(iter);\n", manualfunc);
- }
- }
- fprintf(f, "}\n\n");
- break;
- }
- default:
- if (prop->arraydimension) {
- if (prop->flag & PROP_DYNAMIC)
- fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
- else
- fprintf(f, "void %s(PointerRNA *ptr, %s values[%u])\n", func, rna_type_type(prop),
- prop->totarraylength);
- fprintf(f, "{\n");
-
- if (manualfunc) {
- fprintf(f, " %s(ptr, values);\n", manualfunc);
- }
- else {
- rna_print_data_get(f, dp);
-
- if (prop->flag & PROP_DYNAMIC) {
- char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
- "get_length");
- fprintf(f, " unsigned int arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
- fprintf(f, " unsigned int i;\n");
- fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
- fprintf(f, " for (i = 0; i < len; i++) {\n");
- MEM_freeN(lenfunc);
- }
- else {
- fprintf(f, " unsigned int i;\n\n");
- fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength);
- }
-
- if (dp->dnaarraylength == 1) {
- if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " values[i] = %s((data->%s & (%du << i)) != 0);\n",
- (dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit);
- }
- else {
- fprintf(f, " values[i] = (%s)%s((&data->%s)[i]);\n",
- rna_type_type(prop), (dp->booleannegative) ? "!" : "", dp->dnaname);
- }
- }
- else {
- if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " values[i] = %s((data->%s[i] & ", (dp->booleannegative) ? "!" : "",
- dp->dnaname);
- rna_int_print(f, dp->booleanbit);
- fprintf(f, ") != 0);\n");
- }
- else if (rna_color_quantize(prop, dp)) {
- fprintf(f, " values[i] = (%s)(data->%s[i] * (1.0f / 255.0f));\n",
- rna_type_type(prop), dp->dnaname);
- }
- else if (dp->dnatype) {
- fprintf(f, " values[i] = (%s)%s(((%s *)data->%s)[i]);\n",
- rna_type_type(prop), (dp->booleannegative) ? "!" : "", dp->dnatype, dp->dnaname);
- }
- else {
- fprintf(f, " values[i] = (%s)%s((data->%s)[i]);\n",
- rna_type_type(prop), (dp->booleannegative) ? "!" : "", dp->dnaname);
- }
- }
- fprintf(f, " }\n");
- }
- fprintf(f, "}\n\n");
- }
- else {
- fprintf(f, "%s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
- fprintf(f, "{\n");
-
- if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
- }
- else {
- rna_print_data_get(f, dp);
- if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " return %s(((data->%s) & ", (dp->booleannegative) ? "!" : "", dp->dnaname);
- rna_int_print(f, dp->booleanbit);
- fprintf(f, ") != 0);\n");
- }
- else if (prop->type == PROP_ENUM && dp->enumbitflags) {
- fprintf(f, " return ((data->%s) & ", dp->dnaname);
- rna_int_print(f, rna_enum_bitmask(prop));
- fprintf(f, ");\n");
- }
- else
- fprintf(f, " return (%s)%s(data->%s);\n", rna_type_type(prop),
- (dp->booleannegative) ? "!" : "", dp->dnaname);
- }
-
- fprintf(f, "}\n\n");
- }
- break;
- }
-
- return func;
+ char *func;
+
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname) {
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return NULL;
+ }
+
+ /* typecheck, */
+ if (dp->dnatype && *dp->dnatype) {
+
+ if (prop->type == PROP_FLOAT) {
+ if (IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
+ if (prop->subtype !=
+ PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
+ CLOG_ERROR(&LOG,
+ "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier,
+ prop->identifier,
+ dp->dnatype,
+ RNA_property_typename(prop->type));
+ DefRNA.error = 1;
+ return NULL;
+ }
+ }
+ }
+ else if (prop->type == PROP_INT || prop->type == PROP_BOOLEAN || prop->type == PROP_ENUM) {
+ if (IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
+ CLOG_ERROR(&LOG,
+ "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier,
+ prop->identifier,
+ dp->dnatype,
+ RNA_property_typename(prop->type));
+ DefRNA.error = 1;
+ return NULL;
+ }
+ }
+ }
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
+
+ switch (prop->type) {
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ fprintf(f, "void %s(PointerRNA *ptr, char *value)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
+ }
+ else {
+ const PropertySubType subtype = prop->subtype;
+ const char *string_copy_func = (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH ||
+ subtype == PROP_FILENAME || subtype == PROP_BYTESTRING) ?
+ "BLI_strncpy" :
+ "BLI_strncpy_utf8";
+
+ rna_print_data_get(f, dp);
+
+ if (!(prop->flag & PROP_NEVER_NULL)) {
+ fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
+ fprintf(f, " *value = '\\0';\n");
+ fprintf(f, " return;\n");
+ fprintf(f, " }\n");
+ }
+
+ if (sprop->maxlength)
+ fprintf(f,
+ " %s(value, data->%s, %d);\n",
+ string_copy_func,
+ dp->dnaname,
+ sprop->maxlength);
+ else
+ fprintf(f,
+ " %s(value, data->%s, sizeof(data->%s));\n",
+ string_copy_func,
+ dp->dnaname,
+ dp->dnaname);
+ }
+ fprintf(f, "}\n\n");
+ break;
+ }
+ case PROP_POINTER: {
+ fprintf(f, "PointerRNA %s(PointerRNA *ptr)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ fprintf(f, " return %s(ptr);\n", manualfunc);
+ }
+ else {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ rna_print_data_get(f, dp);
+ if (dp->dnapointerlevel == 0)
+ fprintf(f,
+ " return rna_pointer_inherit_refine(ptr, &RNA_%s, &data->%s);\n",
+ (const char *)pprop->type,
+ dp->dnaname);
+ else
+ fprintf(f,
+ " return rna_pointer_inherit_refine(ptr, &RNA_%s, data->%s);\n",
+ (const char *)pprop->type,
+ dp->dnaname);
+ }
+ fprintf(f, "}\n\n");
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+
+ fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ if (STREQ(manualfunc, "rna_iterator_listbase_get") ||
+ STREQ(manualfunc, "rna_iterator_array_get") ||
+ STREQ(manualfunc, "rna_iterator_array_dereference_get")) {
+ fprintf(f,
+ " return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
+ (cprop->item_type) ? (const char *)cprop->item_type : "UnknownType",
+ manualfunc);
+ }
+ else {
+ fprintf(f, " return %s(iter);\n", manualfunc);
+ }
+ }
+ fprintf(f, "}\n\n");
+ break;
+ }
+ default:
+ if (prop->arraydimension) {
+ if (prop->flag & PROP_DYNAMIC)
+ fprintf(f, "void %s(PointerRNA *ptr, %s values[])\n", func, rna_type_type(prop));
+ else
+ fprintf(f,
+ "void %s(PointerRNA *ptr, %s values[%u])\n",
+ func,
+ rna_type_type(prop),
+ prop->totarraylength);
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, " %s(ptr, values);\n", manualfunc);
+ }
+ else {
+ rna_print_data_get(f, dp);
+
+ if (prop->flag & PROP_DYNAMIC) {
+ char *lenfunc = rna_alloc_function_name(
+ srna->identifier, rna_safe_id(prop->identifier), "get_length");
+ fprintf(f, " unsigned int arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
+ fprintf(f, " unsigned int i;\n");
+ fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
+ fprintf(f, " for (i = 0; i < len; i++) {\n");
+ MEM_freeN(lenfunc);
+ }
+ else {
+ fprintf(f, " unsigned int i;\n\n");
+ fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength);
+ }
+
+ if (dp->dnaarraylength == 1) {
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(f,
+ " values[i] = %s((data->%s & (%du << i)) != 0);\n",
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname,
+ dp->booleanbit);
+ }
+ else {
+ fprintf(f,
+ " values[i] = (%s)%s((&data->%s)[i]);\n",
+ rna_type_type(prop),
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
+ }
+ }
+ else {
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(f,
+ " values[i] = %s((data->%s[i] & ",
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
+ rna_int_print(f, dp->booleanbit);
+ fprintf(f, ") != 0);\n");
+ }
+ else if (rna_color_quantize(prop, dp)) {
+ fprintf(f,
+ " values[i] = (%s)(data->%s[i] * (1.0f / 255.0f));\n",
+ rna_type_type(prop),
+ dp->dnaname);
+ }
+ else if (dp->dnatype) {
+ fprintf(f,
+ " values[i] = (%s)%s(((%s *)data->%s)[i]);\n",
+ rna_type_type(prop),
+ (dp->booleannegative) ? "!" : "",
+ dp->dnatype,
+ dp->dnaname);
+ }
+ else {
+ fprintf(f,
+ " values[i] = (%s)%s((data->%s)[i]);\n",
+ rna_type_type(prop),
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
+ }
+ }
+ fprintf(f, " }\n");
+ }
+ fprintf(f, "}\n\n");
+ }
+ else {
+ fprintf(f, "%s %s(PointerRNA *ptr)\n", rna_type_type(prop), func);
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, " return %s(ptr);\n", manualfunc);
+ }
+ else {
+ rna_print_data_get(f, dp);
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(
+ f, " return %s(((data->%s) & ", (dp->booleannegative) ? "!" : "", dp->dnaname);
+ rna_int_print(f, dp->booleanbit);
+ fprintf(f, ") != 0);\n");
+ }
+ else if (prop->type == PROP_ENUM && dp->enumbitflags) {
+ fprintf(f, " return ((data->%s) & ", dp->dnaname);
+ rna_int_print(f, rna_enum_bitmask(prop));
+ fprintf(f, ");\n");
+ }
+ else
+ fprintf(f,
+ " return (%s)%s(data->%s);\n",
+ rna_type_type(prop),
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
+ }
+
+ fprintf(f, "}\n\n");
+ }
+ break;
+ }
+
+ return func;
}
/* defined min/max variables to be used by rna_clamp_value() */
static void rna_clamp_value_range(FILE *f, PropertyRNA *prop)
{
- if (prop->type == PROP_FLOAT) {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- if (fprop->range) {
- fprintf(f,
- " float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;\n");
- fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
- rna_function_string(fprop->range));
- }
- }
- else if (prop->type == PROP_INT) {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- if (iprop->range) {
- fprintf(f, " int prop_clamp_min = INT_MIN, prop_clamp_max = INT_MAX, prop_soft_min, prop_soft_max;\n");
- fprintf(f, " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
- rna_function_string(iprop->range));
- }
- }
+ if (prop->type == PROP_FLOAT) {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ if (fprop->range) {
+ fprintf(f,
+ " float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, "
+ "prop_soft_max;\n");
+ fprintf(f,
+ " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
+ rna_function_string(fprop->range));
+ }
+ }
+ else if (prop->type == PROP_INT) {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ if (iprop->range) {
+ fprintf(f,
+ " int prop_clamp_min = INT_MIN, prop_clamp_max = INT_MAX, prop_soft_min, "
+ "prop_soft_max;\n");
+ fprintf(f,
+ " %s(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);\n",
+ rna_function_string(iprop->range));
+ }
+ }
}
#ifdef USE_RNA_RANGE_CHECK
-static void rna_clamp_value_range_check(
- FILE *f, PropertyRNA *prop,
- const char *dnaname_prefix, const char *dnaname)
+static void rna_clamp_value_range_check(FILE *f,
+ PropertyRNA *prop,
+ const char *dnaname_prefix,
+ const char *dnaname)
{
- if (prop->type == PROP_INT) {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- fprintf(f,
- " { BLI_STATIC_ASSERT("
- "(TYPEOF_MAX(%s%s) >= %d) && "
- "(TYPEOF_MIN(%s%s) <= %d), "
- "\"invalid limits\"); }\n",
- dnaname_prefix, dnaname, iprop->hardmax,
- dnaname_prefix, dnaname, iprop->hardmin);
- }
+ if (prop->type == PROP_INT) {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ fprintf(f,
+ " { BLI_STATIC_ASSERT("
+ "(TYPEOF_MAX(%s%s) >= %d) && "
+ "(TYPEOF_MIN(%s%s) <= %d), "
+ "\"invalid limits\"); }\n",
+ dnaname_prefix,
+ dnaname,
+ iprop->hardmax,
+ dnaname_prefix,
+ dnaname,
+ iprop->hardmin);
+ }
}
-#endif /* USE_RNA_RANGE_CHECK */
+#endif /* USE_RNA_RANGE_CHECK */
static void rna_clamp_value(FILE *f, PropertyRNA *prop, int array)
{
- if (prop->type == PROP_INT) {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
-
- if (iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX || iprop->range) {
- if (array) fprintf(f, "CLAMPIS(values[i], ");
- else fprintf(f, "CLAMPIS(value, ");
- if (iprop->range) {
- fprintf(f, "prop_clamp_min, prop_clamp_max);");
- }
- else {
- rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
- rna_int_print(f, iprop->hardmax); fprintf(f, ");\n");
- }
- return;
- }
- }
- else if (prop->type == PROP_FLOAT) {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- if (fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX || fprop->range) {
- if (array) fprintf(f, "CLAMPIS(values[i], ");
- else fprintf(f, "CLAMPIS(value, ");
- if (fprop->range) {
- fprintf(f, "prop_clamp_min, prop_clamp_max);");
- }
- else {
- rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
- rna_float_print(f, fprop->hardmax); fprintf(f, ");\n");
- }
- return;
- }
- }
-
- if (array)
- fprintf(f, "values[i];\n");
- else
- fprintf(f, "value;\n");
+ if (prop->type == PROP_INT) {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+
+ if (iprop->hardmin != INT_MIN || iprop->hardmax != INT_MAX || iprop->range) {
+ if (array)
+ fprintf(f, "CLAMPIS(values[i], ");
+ else
+ fprintf(f, "CLAMPIS(value, ");
+ if (iprop->range) {
+ fprintf(f, "prop_clamp_min, prop_clamp_max);");
+ }
+ else {
+ rna_int_print(f, iprop->hardmin);
+ fprintf(f, ", ");
+ rna_int_print(f, iprop->hardmax);
+ fprintf(f, ");\n");
+ }
+ return;
+ }
+ }
+ else if (prop->type == PROP_FLOAT) {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ if (fprop->hardmin != -FLT_MAX || fprop->hardmax != FLT_MAX || fprop->range) {
+ if (array)
+ fprintf(f, "CLAMPIS(values[i], ");
+ else
+ fprintf(f, "CLAMPIS(value, ");
+ if (fprop->range) {
+ fprintf(f, "prop_clamp_min, prop_clamp_max);");
+ }
+ else {
+ rna_float_print(f, fprop->hardmin);
+ fprintf(f, ", ");
+ rna_float_print(f, fprop->hardmax);
+ fprintf(f, ");\n");
+ }
+ return;
+ }
+ }
+
+ if (array)
+ fprintf(f, "values[i];\n");
+ else
+ fprintf(f, "value;\n");
}
-static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
- const char *manualfunc)
+static char *rna_def_property_set_func(
+ FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
{
- char *func;
-
- if (!(prop->flag & PROP_EDITABLE))
- return NULL;
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
-
- if (!manualfunc) {
- if (!dp->dnastructname || !dp->dnaname) {
- if (prop->flag & PROP_EDITABLE) {
- CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- return NULL;
- }
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set");
-
- switch (prop->type) {
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
- }
- else {
- const PropertySubType subtype = prop->subtype;
- const char *string_copy_func = (subtype == PROP_FILEPATH ||
- subtype == PROP_DIRPATH ||
- subtype == PROP_FILENAME ||
- subtype == PROP_BYTESTRING) ?
- "BLI_strncpy" : "BLI_strncpy_utf8";
-
- rna_print_data_get(f, dp);
-
- if (!(prop->flag & PROP_NEVER_NULL)) {
- fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
- fprintf(f, " return;\n");
- fprintf(f, " }\n");
- }
-
- if (sprop->maxlength)
- fprintf(f, " %s(data->%s, value, %d);\n", string_copy_func, dp->dnaname, sprop->maxlength);
- else
- fprintf(f, " %s(data->%s, value, sizeof(data->%s));\n", string_copy_func,
- dp->dnaname, dp->dnaname);
- }
- fprintf(f, "}\n\n");
- break;
- }
- case PROP_POINTER:
- {
- fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
- }
- else {
- rna_print_data_get(f, dp);
-
- if (prop->flag & PROP_ID_SELF_CHECK) {
- rna_print_id_get(f, dp);
- fprintf(f, " if (id == value.data) return;\n\n");
- }
-
- if (prop->flag & PROP_ID_REFCOUNT) {
- fprintf(f, "\n if (data->%s)\n", dp->dnaname);
- fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname);
- fprintf(f, " if (value.data)\n");
- fprintf(f, " id_us_plus((ID *)value.data);\n\n");
- }
- else {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
- StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL;
- if (type && (type->flag & STRUCT_ID)) {
- fprintf(f, " if (value.data)\n");
- fprintf(f, " id_lib_extern((ID *)value.data);\n\n");
- }
- }
-
- fprintf(f, " data->%s = value.data;\n", dp->dnaname);
-
- }
- fprintf(f, "}\n\n");
- break;
- }
- default:
- if (prop->arraydimension) {
- if (prop->flag & PROP_DYNAMIC)
- fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
- else
- fprintf(f, "void %s(PointerRNA *ptr, const %s values[%u])\n", func,
- rna_type_type(prop), prop->totarraylength);
- fprintf(f, "{\n");
-
- if (manualfunc) {
- fprintf(f, " %s(ptr, values);\n", manualfunc);
- }
- else {
- rna_print_data_get(f, dp);
-
- if (prop->flag & PROP_DYNAMIC) {
- char *lenfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier),
- "set_length");
- fprintf(f, " unsigned int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
- fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
- rna_clamp_value_range(f, prop);
- fprintf(f, " for (i = 0; i < len; i++) {\n");
- MEM_freeN(lenfunc);
- }
- else {
- fprintf(f, " unsigned int i;\n\n");
- rna_clamp_value_range(f, prop);
- fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength);
- }
-
- if (dp->dnaarraylength == 1) {
- if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if (%svalues[i]) data->%s |= (%du << i);\n",
- (dp->booleannegative) ? "!" : "", dp->dnaname, dp->booleanbit);
- fprintf(f, " else data->%s &= ~(%du << i);\n", dp->dnaname, dp->booleanbit);
- }
- else {
- fprintf(f, " (&data->%s)[i] = %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
- rna_clamp_value(f, prop, 1);
- }
- }
- else {
- if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if (%svalues[i]) data->%s[i] |= ", (dp->booleannegative) ? "!" : "",
- dp->dnaname);
- rna_int_print(f, dp->booleanbit);
- fprintf(f, ";\n");
- fprintf(f, " else data->%s[i] &= ~", dp->dnaname);
- rna_int_print(f, dp->booleanbit);
- fprintf(f, ";\n");
- }
- else if (rna_color_quantize(prop, dp)) {
- fprintf(f, " data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->dnaname);
- }
- else {
- if (dp->dnatype)
- fprintf(f, " ((%s *)data->%s)[i] = %s", dp->dnatype, dp->dnaname,
- (dp->booleannegative) ? "!" : "");
- else
- fprintf(f, " (data->%s)[i] = %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
- rna_clamp_value(f, prop, 1);
- }
- }
- fprintf(f, " }\n");
- }
+ char *func;
+
+ if (!(prop->flag & PROP_EDITABLE))
+ return NULL;
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname) {
+ if (prop->flag & PROP_EDITABLE) {
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+ return NULL;
+ }
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "set");
+
+ switch (prop->type) {
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ fprintf(f, "void %s(PointerRNA *ptr, const char *value)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
+ }
+ else {
+ const PropertySubType subtype = prop->subtype;
+ const char *string_copy_func = (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH ||
+ subtype == PROP_FILENAME || subtype == PROP_BYTESTRING) ?
+ "BLI_strncpy" :
+ "BLI_strncpy_utf8";
+
+ rna_print_data_get(f, dp);
+
+ if (!(prop->flag & PROP_NEVER_NULL)) {
+ fprintf(f, " if (data->%s == NULL) {\n", dp->dnaname);
+ fprintf(f, " return;\n");
+ fprintf(f, " }\n");
+ }
+
+ if (sprop->maxlength)
+ fprintf(f,
+ " %s(data->%s, value, %d);\n",
+ string_copy_func,
+ dp->dnaname,
+ sprop->maxlength);
+ else
+ fprintf(f,
+ " %s(data->%s, value, sizeof(data->%s));\n",
+ string_copy_func,
+ dp->dnaname,
+ dp->dnaname);
+ }
+ fprintf(f, "}\n\n");
+ break;
+ }
+ case PROP_POINTER: {
+ fprintf(f, "void %s(PointerRNA *ptr, PointerRNA value)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
+ }
+ else {
+ rna_print_data_get(f, dp);
+
+ if (prop->flag & PROP_ID_SELF_CHECK) {
+ rna_print_id_get(f, dp);
+ fprintf(f, " if (id == value.data) return;\n\n");
+ }
+
+ if (prop->flag & PROP_ID_REFCOUNT) {
+ fprintf(f, "\n if (data->%s)\n", dp->dnaname);
+ fprintf(f, " id_us_min((ID *)data->%s);\n", dp->dnaname);
+ fprintf(f, " if (value.data)\n");
+ fprintf(f, " id_us_plus((ID *)value.data);\n\n");
+ }
+ else {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
+ StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL;
+ if (type && (type->flag & STRUCT_ID)) {
+ fprintf(f, " if (value.data)\n");
+ fprintf(f, " id_lib_extern((ID *)value.data);\n\n");
+ }
+ }
+
+ fprintf(f, " data->%s = value.data;\n", dp->dnaname);
+ }
+ fprintf(f, "}\n\n");
+ break;
+ }
+ default:
+ if (prop->arraydimension) {
+ if (prop->flag & PROP_DYNAMIC)
+ fprintf(f, "void %s(PointerRNA *ptr, const %s values[])\n", func, rna_type_type(prop));
+ else
+ fprintf(f,
+ "void %s(PointerRNA *ptr, const %s values[%u])\n",
+ func,
+ rna_type_type(prop),
+ prop->totarraylength);
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, " %s(ptr, values);\n", manualfunc);
+ }
+ else {
+ rna_print_data_get(f, dp);
+
+ if (prop->flag & PROP_DYNAMIC) {
+ char *lenfunc = rna_alloc_function_name(
+ srna->identifier, rna_safe_id(prop->identifier), "set_length");
+ fprintf(f, " unsigned int i, arraylen[RNA_MAX_ARRAY_DIMENSION];\n");
+ fprintf(f, " unsigned int len = %s(ptr, arraylen);\n\n", lenfunc);
+ rna_clamp_value_range(f, prop);
+ fprintf(f, " for (i = 0; i < len; i++) {\n");
+ MEM_freeN(lenfunc);
+ }
+ else {
+ fprintf(f, " unsigned int i;\n\n");
+ rna_clamp_value_range(f, prop);
+ fprintf(f, " for (i = 0; i < %u; i++) {\n", prop->totarraylength);
+ }
+
+ if (dp->dnaarraylength == 1) {
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(f,
+ " if (%svalues[i]) data->%s |= (%du << i);\n",
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname,
+ dp->booleanbit);
+ fprintf(f, " else data->%s &= ~(%du << i);\n", dp->dnaname, dp->booleanbit);
+ }
+ else {
+ fprintf(
+ f, " (&data->%s)[i] = %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
+ rna_clamp_value(f, prop, 1);
+ }
+ }
+ else {
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(f,
+ " if (%svalues[i]) data->%s[i] |= ",
+ (dp->booleannegative) ? "!" : "",
+ dp->dnaname);
+ rna_int_print(f, dp->booleanbit);
+ fprintf(f, ";\n");
+ fprintf(f, " else data->%s[i] &= ~", dp->dnaname);
+ rna_int_print(f, dp->booleanbit);
+ fprintf(f, ";\n");
+ }
+ else if (rna_color_quantize(prop, dp)) {
+ fprintf(
+ f, " data->%s[i] = unit_float_to_uchar_clamp(values[i]);\n", dp->dnaname);
+ }
+ else {
+ if (dp->dnatype)
+ fprintf(f,
+ " ((%s *)data->%s)[i] = %s",
+ dp->dnatype,
+ dp->dnaname,
+ (dp->booleannegative) ? "!" : "");
+ else
+ fprintf(f,
+ " (data->%s)[i] = %s",
+ dp->dnaname,
+ (dp->booleannegative) ? "!" : "");
+ rna_clamp_value(f, prop, 1);
+ }
+ }
+ fprintf(f, " }\n");
+ }
#ifdef USE_RNA_RANGE_CHECK
- if (dp->dnaname && manualfunc == NULL) {
- if (dp->dnaarraylength == 1) {
- rna_clamp_value_range_check(f, prop, "data->", dp->dnaname);
- }
- else {
- rna_clamp_value_range_check(f, prop, "*data->", dp->dnaname);
- }
- }
+ if (dp->dnaname && manualfunc == NULL) {
+ if (dp->dnaarraylength == 1) {
+ rna_clamp_value_range_check(f, prop, "data->", dp->dnaname);
+ }
+ else {
+ rna_clamp_value_range_check(f, prop, "*data->", dp->dnaname);
+ }
+ }
#endif
- fprintf(f, "}\n\n");
- }
- else {
- fprintf(f, "void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
- fprintf(f, "{\n");
-
- if (manualfunc) {
- fprintf(f, " %s(ptr, value);\n", manualfunc);
- }
- else {
- rna_print_data_get(f, dp);
- if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
- fprintf(f, " if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
- rna_int_print(f, dp->booleanbit);
- fprintf(f, ";\n");
- fprintf(f, " else data->%s &= ~", dp->dnaname);
- rna_int_print(f, dp->booleanbit);
- fprintf(f, ";\n");
- }
- else if (prop->type == PROP_ENUM && dp->enumbitflags) {
- fprintf(f, " data->%s &= ~", dp->dnaname);
- rna_int_print(f, rna_enum_bitmask(prop));
- fprintf(f, ";\n");
- fprintf(f, " data->%s |= value;\n", dp->dnaname);
- }
- else {
- rna_clamp_value_range(f, prop);
- fprintf(f, " data->%s = %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
- rna_clamp_value(f, prop, 0);
- }
- }
+ fprintf(f, "}\n\n");
+ }
+ else {
+ fprintf(f, "void %s(PointerRNA *ptr, %s value)\n", func, rna_type_type(prop));
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, " %s(ptr, value);\n", manualfunc);
+ }
+ else {
+ rna_print_data_get(f, dp);
+ if (prop->type == PROP_BOOLEAN && dp->booleanbit) {
+ fprintf(
+ f, " if (%svalue) data->%s |= ", (dp->booleannegative) ? "!" : "", dp->dnaname);
+ rna_int_print(f, dp->booleanbit);
+ fprintf(f, ";\n");
+ fprintf(f, " else data->%s &= ~", dp->dnaname);
+ rna_int_print(f, dp->booleanbit);
+ fprintf(f, ";\n");
+ }
+ else if (prop->type == PROP_ENUM && dp->enumbitflags) {
+ fprintf(f, " data->%s &= ~", dp->dnaname);
+ rna_int_print(f, rna_enum_bitmask(prop));
+ fprintf(f, ";\n");
+ fprintf(f, " data->%s |= value;\n", dp->dnaname);
+ }
+ else {
+ rna_clamp_value_range(f, prop);
+ fprintf(f, " data->%s = %s", dp->dnaname, (dp->booleannegative) ? "!" : "");
+ rna_clamp_value(f, prop, 0);
+ }
+ }
#ifdef USE_RNA_RANGE_CHECK
- if (dp->dnaname && manualfunc == NULL) {
- rna_clamp_value_range_check(f, prop, "data->", dp->dnaname);
- }
+ if (dp->dnaname && manualfunc == NULL) {
+ rna_clamp_value_range_check(f, prop, "data->", dp->dnaname);
+ }
#endif
- fprintf(f, "}\n\n");
- }
- break;
- }
+ fprintf(f, "}\n\n");
+ }
+ break;
+ }
- return func;
+ return func;
}
-static char *rna_def_property_length_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
- const char *manualfunc)
+static char *rna_def_property_length_func(
+ FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
{
- char *func = NULL;
-
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
-
- if (prop->type == PROP_STRING) {
- if (!manualfunc) {
- if (!dp->dnastructname || !dp->dnaname) {
- CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return NULL;
- }
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
-
- fprintf(f, "int %s(PointerRNA *ptr)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
- }
- else {
- rna_print_data_get(f, dp);
- if (!(prop->flag & PROP_NEVER_NULL)) {
- fprintf(f, " if (data->%s == NULL) return 0;\n", dp->dnaname);
- }
- fprintf(f, " return strlen(data->%s);\n", dp->dnaname);
- }
- fprintf(f, "}\n\n");
- }
- else if (prop->type == PROP_COLLECTION) {
- if (!manualfunc) {
- if (prop->type == PROP_COLLECTION && (!(dp->dnalengthname || dp->dnalengthfixed) || !dp->dnaname)) {
- CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return NULL;
- }
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
-
- fprintf(f, "int %s(PointerRNA *ptr)\n", func);
- fprintf(f, "{\n");
- if (manualfunc) {
- fprintf(f, " return %s(ptr);\n", manualfunc);
- }
- else {
- if (dp->dnaarraylength <= 1 || dp->dnalengthname)
- rna_print_data_get(f, dp);
-
- if (dp->dnaarraylength > 1)
- fprintf(f, " return ");
- else
- fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname);
-
- if (dp->dnalengthname)
- fprintf(f, "data->%s;\n", dp->dnalengthname);
- else
- fprintf(f, "%d;\n", dp->dnalengthfixed);
- }
- fprintf(f, "}\n\n");
- }
-
- return func;
+ char *func = NULL;
+
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (prop->type == PROP_STRING) {
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname) {
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return NULL;
+ }
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
+
+ fprintf(f, "int %s(PointerRNA *ptr)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ fprintf(f, " return %s(ptr);\n", manualfunc);
+ }
+ else {
+ rna_print_data_get(f, dp);
+ if (!(prop->flag & PROP_NEVER_NULL)) {
+ fprintf(f, " if (data->%s == NULL) return 0;\n", dp->dnaname);
+ }
+ fprintf(f, " return strlen(data->%s);\n", dp->dnaname);
+ }
+ fprintf(f, "}\n\n");
+ }
+ else if (prop->type == PROP_COLLECTION) {
+ if (!manualfunc) {
+ if (prop->type == PROP_COLLECTION &&
+ (!(dp->dnalengthname || dp->dnalengthfixed) || !dp->dnaname)) {
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return NULL;
+ }
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "length");
+
+ fprintf(f, "int %s(PointerRNA *ptr)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc) {
+ fprintf(f, " return %s(ptr);\n", manualfunc);
+ }
+ else {
+ if (dp->dnaarraylength <= 1 || dp->dnalengthname)
+ rna_print_data_get(f, dp);
+
+ if (dp->dnaarraylength > 1)
+ fprintf(f, " return ");
+ else
+ fprintf(f, " return (data->%s == NULL) ? 0 : ", dp->dnaname);
+
+ if (dp->dnalengthname)
+ fprintf(f, "data->%s;\n", dp->dnalengthname);
+ else
+ fprintf(f, "%d;\n", dp->dnalengthfixed);
+ }
+ fprintf(f, "}\n\n");
+ }
+
+ return func;
}
-static char *rna_def_property_begin_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
- const char *manualfunc)
+static char *rna_def_property_begin_func(
+ FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp, const char *manualfunc)
{
- char *func, *getfunc;
-
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
-
- if (!manualfunc) {
- if (!dp->dnastructname || !dp->dnaname) {
- CLOG_ERROR(&LOG, "%s.%s has no valid dna info.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return NULL;
- }
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin");
-
- fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
- fprintf(f, "{\n");
-
- if (!manualfunc)
- rna_print_data_get(f, dp);
-
- fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n");
- fprintf(f, " iter->parent = *ptr;\n");
- fprintf(f, " iter->prop = (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier);
-
- if (dp->dnalengthname || dp->dnalengthfixed) {
- if (manualfunc) {
- fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
- }
- else {
- if (dp->dnalengthname)
- fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, NULL);\n",
- dp->dnaname, dp->dnaname, dp->dnalengthname);
- else
- fprintf(f, "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n",
- dp->dnaname, dp->dnaname, dp->dnalengthfixed);
- }
- }
- else {
- if (manualfunc)
- fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
- else if (dp->dnapointerlevel == 0)
- fprintf(f, "\n rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
- else
- fprintf(f, "\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname);
- }
-
- getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
-
- fprintf(f, "\n if (iter->valid)\n");
- fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
-
- fprintf(f, "}\n\n");
-
-
- return func;
+ char *func, *getfunc;
+
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname) {
+ CLOG_ERROR(&LOG, "%s.%s has no valid dna info.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return NULL;
+ }
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "begin");
+
+ fprintf(f, "void %s(CollectionPropertyIterator *iter, PointerRNA *ptr)\n", func);
+ fprintf(f, "{\n");
+
+ if (!manualfunc)
+ rna_print_data_get(f, dp);
+
+ fprintf(f, "\n memset(iter, 0, sizeof(*iter));\n");
+ fprintf(f, " iter->parent = *ptr;\n");
+ fprintf(f, " iter->prop = (PropertyRNA *)&rna_%s_%s;\n", srna->identifier, prop->identifier);
+
+ if (dp->dnalengthname || dp->dnalengthfixed) {
+ if (manualfunc) {
+ fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
+ }
+ else {
+ if (dp->dnalengthname)
+ fprintf(f,
+ "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), data->%s, 0, "
+ "NULL);\n",
+ dp->dnaname,
+ dp->dnaname,
+ dp->dnalengthname);
+ else
+ fprintf(
+ f,
+ "\n rna_iterator_array_begin(iter, data->%s, sizeof(data->%s[0]), %d, 0, NULL);\n",
+ dp->dnaname,
+ dp->dnaname,
+ dp->dnalengthfixed);
+ }
+ }
+ else {
+ if (manualfunc)
+ fprintf(f, "\n %s(iter, ptr);\n", manualfunc);
+ else if (dp->dnapointerlevel == 0)
+ fprintf(f, "\n rna_iterator_listbase_begin(iter, &data->%s, NULL);\n", dp->dnaname);
+ else
+ fprintf(f, "\n rna_iterator_listbase_begin(iter, data->%s, NULL);\n", dp->dnaname);
+ }
+
+ getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
+
+ fprintf(f, "\n if (iter->valid)\n");
+ fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
+
+ fprintf(f, "}\n\n");
+
+ return func;
}
-static char *rna_def_property_lookup_int_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
- const char *manualfunc, const char *nextfunc)
+static char *rna_def_property_lookup_int_func(FILE *f,
+ StructRNA *srna,
+ PropertyRNA *prop,
+ PropertyDefRNA *dp,
+ const char *manualfunc,
+ const char *nextfunc)
{
- /* note on indices, this is for external functions and ignores skipped values.
- * so the index can only be checked against the length when there is no 'skip' function. */
- char *func;
-
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
-
- if (!manualfunc) {
- if (!dp->dnastructname || !dp->dnaname)
- return NULL;
-
- /* only supported in case of standard next functions */
- if (STREQ(nextfunc, "rna_iterator_array_next")) {}
- else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {}
- else return NULL;
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int");
-
- fprintf(f, "int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func);
- fprintf(f, "{\n");
-
- if (manualfunc) {
- fprintf(f, "\n return %s(ptr, index, r_ptr);\n", manualfunc);
- fprintf(f, "}\n\n");
- return func;
- }
-
- fprintf(f, " int found = 0;\n");
- fprintf(f, " CollectionPropertyIterator iter;\n\n");
-
- fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
- fprintf(f, " if (iter.valid) {\n");
-
- if (STREQ(nextfunc, "rna_iterator_array_next")) {
- fprintf(f, " ArrayIterator *internal = &iter.internal.array;\n");
- fprintf(f, " if (index < 0 || index >= internal->length) {\n");
- fprintf(f, "#ifdef __GNUC__\n");
- fprintf(f, " printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, index);\n");
- fprintf(f, "#else\n");
- fprintf(f, " printf(\"Array iterator out of range: (index %%d)\\n\", index);\n");
- fprintf(f, "#endif\n");
- fprintf(f, " }\n");
- fprintf(f, " else if (internal->skip) {\n");
- fprintf(f, " while (index-- > 0 && iter.valid) {\n");
- fprintf(f, " rna_iterator_array_next(&iter);\n");
- fprintf(f, " }\n");
- fprintf(f, " found = (index == -1 && iter.valid);\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " internal->ptr += internal->itemsize * index;\n");
- fprintf(f, " found = 1;\n");
- fprintf(f, " }\n");
- }
- else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {
- fprintf(f, " ListBaseIterator *internal = &iter.internal.listbase;\n");
- fprintf(f, " if (internal->skip) {\n");
- fprintf(f, " while (index-- > 0 && iter.valid) {\n");
- fprintf(f, " rna_iterator_listbase_next(&iter);\n");
- fprintf(f, " }\n");
- fprintf(f, " found = (index == -1 && iter.valid);\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " while (index-- > 0 && internal->link)\n");
- fprintf(f, " internal->link = internal->link->next;\n");
- fprintf(f, " found = (index == -1 && internal->link);\n");
- fprintf(f, " }\n");
- }
-
- fprintf(f, " if (found) *r_ptr = %s_%s_get(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
- fprintf(f, " }\n\n");
- fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-
- fprintf(f, " return found;\n");
+ /* note on indices, this is for external functions and ignores skipped values.
+ * so the index can only be checked against the length when there is no 'skip' function. */
+ char *func;
+
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname)
+ return NULL;
+
+ /* only supported in case of standard next functions */
+ if (STREQ(nextfunc, "rna_iterator_array_next")) {
+ }
+ else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {
+ }
+ else
+ return NULL;
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_int");
+
+ fprintf(f, "int %s(PointerRNA *ptr, int index, PointerRNA *r_ptr)\n", func);
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, "\n return %s(ptr, index, r_ptr);\n", manualfunc);
+ fprintf(f, "}\n\n");
+ return func;
+ }
+
+ fprintf(f, " int found = 0;\n");
+ fprintf(f, " CollectionPropertyIterator iter;\n\n");
+
+ fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, " if (iter.valid) {\n");
+
+ if (STREQ(nextfunc, "rna_iterator_array_next")) {
+ fprintf(f, " ArrayIterator *internal = &iter.internal.array;\n");
+ fprintf(f, " if (index < 0 || index >= internal->length) {\n");
+ fprintf(f, "#ifdef __GNUC__\n");
+ fprintf(f,
+ " printf(\"Array iterator out of range: %%s (index %%d)\\n\", __func__, "
+ "index);\n");
+ fprintf(f, "#else\n");
+ fprintf(f, " printf(\"Array iterator out of range: (index %%d)\\n\", index);\n");
+ fprintf(f, "#endif\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else if (internal->skip) {\n");
+ fprintf(f, " while (index-- > 0 && iter.valid) {\n");
+ fprintf(f, " rna_iterator_array_next(&iter);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " found = (index == -1 && iter.valid);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " internal->ptr += internal->itemsize * index;\n");
+ fprintf(f, " found = 1;\n");
+ fprintf(f, " }\n");
+ }
+ else if (STREQ(nextfunc, "rna_iterator_listbase_next")) {
+ fprintf(f, " ListBaseIterator *internal = &iter.internal.listbase;\n");
+ fprintf(f, " if (internal->skip) {\n");
+ fprintf(f, " while (index-- > 0 && iter.valid) {\n");
+ fprintf(f, " rna_iterator_listbase_next(&iter);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " found = (index == -1 && iter.valid);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " while (index-- > 0 && internal->link)\n");
+ fprintf(f, " internal->link = internal->link->next;\n");
+ fprintf(f, " found = (index == -1 && internal->link);\n");
+ fprintf(f, " }\n");
+ }
+
+ fprintf(f,
+ " if (found) *r_ptr = %s_%s_get(&iter);\n",
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+ fprintf(f, " }\n\n");
+ fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " return found;\n");
#if 0
- rna_print_data_get(f, dp);
- item_type = (cprop->item_type) ? (const char *)cprop->item_type : "UnknownType";
-
- if (dp->dnalengthname || dp->dnalengthfixed) {
- if (dp->dnalengthname)
- fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n",
- item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
- else
- fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
- item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
- }
- else {
- if (dp->dnapointerlevel == 0)
- fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
- item_type, dp->dnaname);
- else
- fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname);
- }
+ rna_print_data_get(f, dp);
+ item_type = (cprop->item_type) ? (const char *)cprop->item_type : "UnknownType";
+
+ if (dp->dnalengthname || dp->dnalengthfixed) {
+ if (dp->dnalengthname)
+ fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), data->%s, index);\n",
+ item_type, dp->dnaname, dp->dnaname, dp->dnalengthname);
+ else
+ fprintf(f, "\n rna_array_lookup_int(ptr, &RNA_%s, data->%s, sizeof(data->%s[0]), %d, index);\n",
+ item_type, dp->dnaname, dp->dnaname, dp->dnalengthfixed);
+ }
+ else {
+ if (dp->dnapointerlevel == 0)
+ fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, &data->%s, index);\n",
+ item_type, dp->dnaname);
+ else
+ fprintf(f, "\n return rna_listbase_lookup_int(ptr, &RNA_%s, data->%s, index);\n", item_type, dp->dnaname);
+ }
#endif
- fprintf(f, "}\n\n");
+ fprintf(f, "}\n\n");
- return func;
+ return func;
}
-static char *rna_def_property_lookup_string_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
- const char *manualfunc, const char *item_type)
+static char *rna_def_property_lookup_string_func(FILE *f,
+ StructRNA *srna,
+ PropertyRNA *prop,
+ PropertyDefRNA *dp,
+ const char *manualfunc,
+ const char *item_type)
{
- char *func;
- StructRNA *item_srna, *item_name_base;
- PropertyRNA *item_name_prop;
- const int namebuflen = 1024;
-
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
-
- if (!manualfunc) {
- if (!dp->dnastructname || !dp->dnaname)
- return NULL;
-
- /* only supported for collection items with name properties */
- item_srna = rna_find_struct(item_type);
- if (item_srna && item_srna->nameproperty) {
- item_name_prop = item_srna->nameproperty;
- item_name_base = item_srna;
- while (item_name_base->base && item_name_base->base->nameproperty == item_name_prop)
- item_name_base = item_name_base->base;
- }
- else
- return NULL;
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string");
-
- fprintf(f, "int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
- fprintf(f, "{\n");
-
- if (manualfunc) {
- fprintf(f, " return %s(ptr, key, r_ptr);\n", manualfunc);
- fprintf(f, "}\n\n");
- return func;
- }
-
- /* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of unknown
- * DNA types in functions, leading to conflicting function signatures.
- */
- fprintf(f, " extern int %s_%s_length(PointerRNA *);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " extern void %s_%s_get(PointerRNA *, char *);\n\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
-
- fprintf(f, " bool found = false;\n");
- fprintf(f, " CollectionPropertyIterator iter;\n");
- fprintf(f, " char namebuf[%d];\n", namebuflen);
- fprintf(f, " char *name;\n\n");
-
- fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-
- fprintf(f, " while (iter.valid) {\n");
- fprintf(f, " if (iter.ptr.data) {\n");
- fprintf(f, " int namelen = %s_%s_length(&iter.ptr);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " if (namelen < %d) {\n", namebuflen);
- fprintf(f, " %s_%s_get(&iter.ptr, namebuf);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
- fprintf(f, " found = true;\n");
- fprintf(f, " *r_ptr = iter.ptr;\n");
- fprintf(f, " break;\n");
- fprintf(f, " }\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
- fprintf(f, " %s_%s_get(&iter.ptr, name);\n", item_name_base->identifier, rna_safe_id(item_name_prop->identifier));
- fprintf(f, " if (strcmp(name, key) == 0) {\n");
- fprintf(f, " MEM_freeN(name);\n\n");
- fprintf(f, " found = true;\n");
- fprintf(f, " *r_ptr = iter.ptr;\n");
- fprintf(f, " break;\n");
- fprintf(f, " }\n");
- fprintf(f, " else {\n");
- fprintf(f, " MEM_freeN(name);\n");
- fprintf(f, " }\n");
- fprintf(f, " }\n");
- fprintf(f, " }\n");
- fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
- fprintf(f, " }\n");
- fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
-
- fprintf(f, " return found;\n");
- fprintf(f, "}\n\n");
-
- return func;
+ char *func;
+ StructRNA *item_srna, *item_name_base;
+ PropertyRNA *item_name_prop;
+ const int namebuflen = 1024;
+
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
+
+ if (!manualfunc) {
+ if (!dp->dnastructname || !dp->dnaname)
+ return NULL;
+
+ /* only supported for collection items with name properties */
+ item_srna = rna_find_struct(item_type);
+ if (item_srna && item_srna->nameproperty) {
+ item_name_prop = item_srna->nameproperty;
+ item_name_base = item_srna;
+ while (item_name_base->base && item_name_base->base->nameproperty == item_name_prop)
+ item_name_base = item_name_base->base;
+ }
+ else
+ return NULL;
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "lookup_string");
+
+ fprintf(f, "int %s(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)\n", func);
+ fprintf(f, "{\n");
+
+ if (manualfunc) {
+ fprintf(f, " return %s(ptr, key, r_ptr);\n", manualfunc);
+ fprintf(f, "}\n\n");
+ return func;
+ }
+
+ /* XXX extern declaration could be avoid by including RNA_blender.h, but this has lots of unknown
+ * DNA types in functions, leading to conflicting function signatures.
+ */
+ fprintf(f,
+ " extern int %s_%s_length(PointerRNA *);\n",
+ item_name_base->identifier,
+ rna_safe_id(item_name_prop->identifier));
+ fprintf(f,
+ " extern void %s_%s_get(PointerRNA *, char *);\n\n",
+ item_name_base->identifier,
+ rna_safe_id(item_name_prop->identifier));
+
+ fprintf(f, " bool found = false;\n");
+ fprintf(f, " CollectionPropertyIterator iter;\n");
+ fprintf(f, " char namebuf[%d];\n", namebuflen);
+ fprintf(f, " char *name;\n\n");
+
+ fprintf(f, " %s_%s_begin(&iter, ptr);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " while (iter.valid) {\n");
+ fprintf(f, " if (iter.ptr.data) {\n");
+ fprintf(f,
+ " int namelen = %s_%s_length(&iter.ptr);\n",
+ item_name_base->identifier,
+ rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (namelen < %d) {\n", namebuflen);
+ fprintf(f,
+ " %s_%s_get(&iter.ptr, namebuf);\n",
+ item_name_base->identifier,
+ rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (strcmp(namebuf, key) == 0) {\n");
+ fprintf(f, " found = true;\n");
+ fprintf(f, " *r_ptr = iter.ptr;\n");
+ fprintf(f, " break;\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " name = MEM_mallocN(namelen+1, \"name string\");\n");
+ fprintf(f,
+ " %s_%s_get(&iter.ptr, name);\n",
+ item_name_base->identifier,
+ rna_safe_id(item_name_prop->identifier));
+ fprintf(f, " if (strcmp(name, key) == 0) {\n");
+ fprintf(f, " MEM_freeN(name);\n\n");
+ fprintf(f, " found = true;\n");
+ fprintf(f, " *r_ptr = iter.ptr;\n");
+ fprintf(f, " break;\n");
+ fprintf(f, " }\n");
+ fprintf(f, " else {\n");
+ fprintf(f, " MEM_freeN(name);\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " }\n");
+ fprintf(f, " %s_%s_next(&iter);\n", srna->identifier, rna_safe_id(prop->identifier));
+ fprintf(f, " }\n");
+ fprintf(f, " %s_%s_end(&iter);\n\n", srna->identifier, rna_safe_id(prop->identifier));
+
+ fprintf(f, " return found;\n");
+ fprintf(f, "}\n\n");
+
+ return func;
}
-static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp),
+static char *rna_def_property_next_func(FILE *f,
+ StructRNA *srna,
+ PropertyRNA *prop,
+ PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
{
- char *func, *getfunc;
+ char *func, *getfunc;
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
- if (!manualfunc)
- return NULL;
+ if (!manualfunc)
+ return NULL;
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "next");
- fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
- fprintf(f, "{\n");
- fprintf(f, " %s(iter);\n", manualfunc);
+ fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
+ fprintf(f, "{\n");
+ fprintf(f, " %s(iter);\n", manualfunc);
- getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
+ getfunc = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "get");
- fprintf(f, "\n if (iter->valid)\n");
- fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
+ fprintf(f, "\n if (iter->valid)\n");
+ fprintf(f, " iter->ptr = %s(iter);\n", getfunc);
- fprintf(f, "}\n\n");
+ fprintf(f, "}\n\n");
- return func;
+ return func;
}
-static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp),
+static char *rna_def_property_end_func(FILE *f,
+ StructRNA *srna,
+ PropertyRNA *prop,
+ PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
{
- char *func;
+ char *func;
- if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
- return NULL;
+ if (prop->flag & PROP_IDPROPERTY && manualfunc == NULL)
+ return NULL;
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "end");
- fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
- fprintf(f, "{\n");
- if (manualfunc)
- fprintf(f, " %s(iter);\n", manualfunc);
- fprintf(f, "}\n\n");
+ fprintf(f, "void %s(CollectionPropertyIterator *iter)\n", func);
+ fprintf(f, "{\n");
+ if (manualfunc)
+ fprintf(f, " %s(iter);\n", manualfunc);
+ fprintf(f, "}\n\n");
- return func;
+ return func;
}
static void rna_set_raw_property(PropertyDefRNA *dp, PropertyRNA *prop)
{
- if (dp->dnapointerlevel != 0)
- return;
- if (!dp->dnatype || !dp->dnaname || !dp->dnastructname)
- return;
-
- if (STREQ(dp->dnatype, "char")) {
- prop->rawtype = PROP_RAW_CHAR;
- prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
- }
- else if (STREQ(dp->dnatype, "short")) {
- prop->rawtype = PROP_RAW_SHORT;
- prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
- }
- else if (STREQ(dp->dnatype, "int")) {
- prop->rawtype = PROP_RAW_INT;
- prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
- }
- else if (STREQ(dp->dnatype, "float")) {
- prop->rawtype = PROP_RAW_FLOAT;
- prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
- }
- else if (STREQ(dp->dnatype, "double")) {
- prop->rawtype = PROP_RAW_DOUBLE;
- prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
- }
+ if (dp->dnapointerlevel != 0)
+ return;
+ if (!dp->dnatype || !dp->dnaname || !dp->dnastructname)
+ return;
+
+ if (STREQ(dp->dnatype, "char")) {
+ prop->rawtype = PROP_RAW_CHAR;
+ prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
+ }
+ else if (STREQ(dp->dnatype, "short")) {
+ prop->rawtype = PROP_RAW_SHORT;
+ prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
+ }
+ else if (STREQ(dp->dnatype, "int")) {
+ prop->rawtype = PROP_RAW_INT;
+ prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
+ }
+ else if (STREQ(dp->dnatype, "float")) {
+ prop->rawtype = PROP_RAW_FLOAT;
+ prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
+ }
+ else if (STREQ(dp->dnatype, "double")) {
+ prop->rawtype = PROP_RAW_DOUBLE;
+ prop->flag_internal |= PROP_INTERN_RAW_ACCESS;
+ }
}
static void rna_set_raw_offset(FILE *f, StructRNA *srna, PropertyRNA *prop)
{
- PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop);
+ PropertyDefRNA *dp = rna_find_struct_property_def(srna, prop);
- fprintf(f, "\toffsetof(%s, %s), %d", dp->dnastructname, dp->dnaname, prop->rawtype);
+ fprintf(f, "\toffsetof(%s, %s), %d", dp->dnastructname, dp->dnaname, prop->rawtype);
}
static void rna_def_property_funcs(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
{
- PropertyRNA *prop;
-
- prop = dp->prop;
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
-
- if (!prop->arraydimension) {
- if (!bprop->get && !bprop->set && !dp->booleanbit)
- rna_set_raw_property(dp, prop);
-
- bprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)bprop->get);
- bprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)bprop->set);
- }
- else {
- bprop->getarray = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)bprop->getarray);
- bprop->setarray = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)bprop->setarray);
- }
- break;
- }
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
-
- if (!prop->arraydimension) {
- if (!iprop->get && !iprop->set)
- rna_set_raw_property(dp, prop);
-
- iprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)iprop->get);
- iprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)iprop->set);
- }
- else {
- if (!iprop->getarray && !iprop->setarray)
- rna_set_raw_property(dp, prop);
-
- iprop->getarray = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)iprop->getarray);
- iprop->setarray = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)iprop->setarray);
- }
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- if (!prop->arraydimension) {
- if (!fprop->get && !fprop->set)
- rna_set_raw_property(dp, prop);
-
- fprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)fprop->get);
- fprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)fprop->set);
- }
- else {
- if (!fprop->getarray && !fprop->setarray)
- rna_set_raw_property(dp, prop);
-
- fprop->getarray = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)fprop->getarray);
- fprop->setarray = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)fprop->setarray);
- }
- break;
- }
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
-
- eprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)eprop->get);
- eprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)eprop->set);
- break;
- }
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
-
- sprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)sprop->get);
- sprop->length = (void *)rna_def_property_length_func(f, srna, prop, dp, (const char *)sprop->length);
- sprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)sprop->set);
- break;
- }
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
-
- pprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get);
- pprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)pprop->set);
- if (!pprop->type) {
- CLOG_ERROR(&LOG, "%s.%s, pointer must have a struct type.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- const char *nextfunc = (const char *)cprop->next;
- const char *item_type = (const char *)cprop->item_type;
-
- if (cprop->length) {
- /* always generate if we have a manual implementation */
- cprop->length = (void *)rna_def_property_length_func(f, srna, prop, dp, (const char *)cprop->length);
- }
- else if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
- /* pass */
- }
- else if (dp->dnalengthname || dp->dnalengthfixed) {
- cprop->length = (void *)rna_def_property_length_func(f, srna, prop, dp, (const char *)cprop->length);
- }
-
- /* test if we can allow raw array access, if it is using our standard
- * array get/next function, we can be sure it is an actual array */
- if (cprop->next && cprop->get)
- if (STREQ((const char *)cprop->next, "rna_iterator_array_next") &&
- STREQ((const char *)cprop->get, "rna_iterator_array_get"))
- {
- prop->flag_internal |= PROP_INTERN_RAW_ARRAY;
- }
-
- cprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get);
- cprop->begin = (void *)rna_def_property_begin_func(f, srna, prop, dp, (const char *)cprop->begin);
- cprop->next = (void *)rna_def_property_next_func(f, srna, prop, dp, (const char *)cprop->next);
- cprop->end = (void *)rna_def_property_end_func(f, srna, prop, dp, (const char *)cprop->end);
- cprop->lookupint = (void *)rna_def_property_lookup_int_func(f, srna, prop, dp,
- (const char *)cprop->lookupint, nextfunc);
- cprop->lookupstring = (void *)rna_def_property_lookup_string_func(f, srna, prop, dp,
- (const char *)cprop->lookupstring, item_type);
-
- if (!(prop->flag & PROP_IDPROPERTY)) {
- if (!cprop->begin) {
- CLOG_ERROR(&LOG, "%s.%s, collection must have a begin function.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- if (!cprop->next) {
- CLOG_ERROR(&LOG, "%s.%s, collection must have a next function.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- if (!cprop->get) {
- CLOG_ERROR(&LOG, "%s.%s, collection must have a get function.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- }
- if (!cprop->item_type) {
- CLOG_ERROR(&LOG, "%s.%s, collection must have a struct type.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- break;
- }
- }
+ PropertyRNA *prop;
+
+ prop = dp->prop;
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+
+ if (!prop->arraydimension) {
+ if (!bprop->get && !bprop->set && !dp->booleanbit)
+ rna_set_raw_property(dp, prop);
+
+ bprop->get = (void *)rna_def_property_get_func(
+ f, srna, prop, dp, (const char *)bprop->get);
+ bprop->set = (void *)rna_def_property_set_func(
+ f, srna, prop, dp, (const char *)bprop->set);
+ }
+ else {
+ bprop->getarray = (void *)rna_def_property_get_func(
+ f, srna, prop, dp, (const char *)bprop->getarray);
+ bprop->setarray = (void *)rna_def_property_set_func(
+ f, srna, prop, dp, (const char *)bprop->setarray);
+ }
+ break;
+ }
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+
+ if (!prop->arraydimension) {
+ if (!iprop->get && !iprop->set)
+ rna_set_raw_property(dp, prop);
+
+ iprop->get = (void *)rna_def_property_get_func(
+ f, srna, prop, dp, (const char *)iprop->get);
+ iprop->set = (void *)rna_def_property_set_func(
+ f, srna, prop, dp, (const char *)iprop->set);
+ }
+ else {
+ if (!iprop->getarray && !iprop->setarray)
+ rna_set_raw_property(dp, prop);
+
+ iprop->getarray = (void *)rna_def_property_get_func(
+ f, srna, prop, dp, (const char *)iprop->getarray);
+ iprop->setarray = (void *)rna_def_property_set_func(
+ f, srna, prop, dp, (const char *)iprop->setarray);
+ }
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ if (!prop->arraydimension) {
+ if (!fprop->get && !fprop->set)
+ rna_set_raw_property(dp, prop);
+
+ fprop->get = (void *)rna_def_property_get_func(
+ f, srna, prop, dp, (const char *)fprop->get);
+ fprop->set = (void *)rna_def_property_set_func(
+ f, srna, prop, dp, (const char *)fprop->set);
+ }
+ else {
+ if (!fprop->getarray && !fprop->setarray)
+ rna_set_raw_property(dp, prop);
+
+ fprop->getarray = (void *)rna_def_property_get_func(
+ f, srna, prop, dp, (const char *)fprop->getarray);
+ fprop->setarray = (void *)rna_def_property_set_func(
+ f, srna, prop, dp, (const char *)fprop->setarray);
+ }
+ break;
+ }
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+
+ eprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)eprop->get);
+ eprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)eprop->set);
+ break;
+ }
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+
+ sprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)sprop->get);
+ sprop->length = (void *)rna_def_property_length_func(
+ f, srna, prop, dp, (const char *)sprop->length);
+ sprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)sprop->set);
+ break;
+ }
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+
+ pprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)pprop->get);
+ pprop->set = (void *)rna_def_property_set_func(f, srna, prop, dp, (const char *)pprop->set);
+ if (!pprop->type) {
+ CLOG_ERROR(
+ &LOG, "%s.%s, pointer must have a struct type.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ const char *nextfunc = (const char *)cprop->next;
+ const char *item_type = (const char *)cprop->item_type;
+
+ if (cprop->length) {
+ /* always generate if we have a manual implementation */
+ cprop->length = (void *)rna_def_property_length_func(
+ f, srna, prop, dp, (const char *)cprop->length);
+ }
+ else if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
+ /* pass */
+ }
+ else if (dp->dnalengthname || dp->dnalengthfixed) {
+ cprop->length = (void *)rna_def_property_length_func(
+ f, srna, prop, dp, (const char *)cprop->length);
+ }
+
+ /* test if we can allow raw array access, if it is using our standard
+ * array get/next function, we can be sure it is an actual array */
+ if (cprop->next && cprop->get)
+ if (STREQ((const char *)cprop->next, "rna_iterator_array_next") &&
+ STREQ((const char *)cprop->get, "rna_iterator_array_get")) {
+ prop->flag_internal |= PROP_INTERN_RAW_ARRAY;
+ }
+
+ cprop->get = (void *)rna_def_property_get_func(f, srna, prop, dp, (const char *)cprop->get);
+ cprop->begin = (void *)rna_def_property_begin_func(
+ f, srna, prop, dp, (const char *)cprop->begin);
+ cprop->next = (void *)rna_def_property_next_func(
+ f, srna, prop, dp, (const char *)cprop->next);
+ cprop->end = (void *)rna_def_property_end_func(f, srna, prop, dp, (const char *)cprop->end);
+ cprop->lookupint = (void *)rna_def_property_lookup_int_func(
+ f, srna, prop, dp, (const char *)cprop->lookupint, nextfunc);
+ cprop->lookupstring = (void *)rna_def_property_lookup_string_func(
+ f, srna, prop, dp, (const char *)cprop->lookupstring, item_type);
+
+ if (!(prop->flag & PROP_IDPROPERTY)) {
+ if (!cprop->begin) {
+ CLOG_ERROR(&LOG,
+ "%s.%s, collection must have a begin function.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ }
+ if (!cprop->next) {
+ CLOG_ERROR(&LOG,
+ "%s.%s, collection must have a next function.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ }
+ if (!cprop->get) {
+ CLOG_ERROR(&LOG,
+ "%s.%s, collection must have a get function.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ }
+ }
+ if (!cprop->item_type) {
+ CLOG_ERROR(&LOG,
+ "%s.%s, collection must have a struct type.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ }
+ break;
+ }
+ }
}
static void rna_def_property_funcs_header(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
{
- PropertyRNA *prop;
- const char *func;
-
- prop = dp->prop;
-
- if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) {
- return;
- }
-
- func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "");
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- if (!prop->arraydimension) {
- fprintf(f, "bool %sget(PointerRNA *ptr);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func);
- }
- else if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength);
- fprintf(f, "void %sset(PointerRNA *ptr, const bool values[%u]);\n", func, prop->totarraylength);
- }
- else {
- fprintf(f, "void %sget(PointerRNA *ptr, bool values[]);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, const bool values[]);\n", func);
- }
- break;
- }
- case PROP_INT:
- {
- if (!prop->arraydimension) {
- fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
- }
- else if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength);
- fprintf(f, "void %sset(PointerRNA *ptr, const int values[%u]);\n", func, prop->totarraylength);
- }
- else {
- fprintf(f, "void %sget(PointerRNA *ptr, int values[]);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, const int values[]);\n", func);
- }
- break;
- }
- case PROP_FLOAT:
- {
- if (!prop->arraydimension) {
- fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
- }
- else if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength);
- fprintf(f, "void %sset(PointerRNA *ptr, const float values[%u]);\n", func, prop->totarraylength);
- }
- else {
- fprintf(f, "void %sget(PointerRNA *ptr, float values[]);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, const float values[]);", func);
- }
- break;
- }
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- int i;
-
- if (eprop->item && eprop->totitem) {
- fprintf(f, "enum {\n");
-
- for (i = 0; i < eprop->totitem; i++)
- if (eprop->item[i].identifier[0])
- fprintf(f, "\t%s_%s_%s = %d,\n", srna->identifier, prop->identifier,
- eprop->item[i].identifier, eprop->item[i].value);
-
- fprintf(f, "};\n\n");
- }
-
- fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
-
- break;
- }
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
-
- if (sprop->maxlength) {
- fprintf(f, "#define %s_%s_MAX %d\n\n", srna->identifier, prop->identifier, sprop->maxlength);
- }
-
- fprintf(f, "void %sget(PointerRNA *ptr, char *value);\n", func);
- fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
- fprintf(f, "void %sset(PointerRNA *ptr, const char *value);\n", func);
-
- break;
- }
- case PROP_POINTER:
- {
- fprintf(f, "PointerRNA %sget(PointerRNA *ptr);\n", func);
- /*fprintf(f, "void %sset(PointerRNA *ptr, PointerRNA value);\n", func); */
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- fprintf(f, "void %sbegin(CollectionPropertyIterator *iter, PointerRNA *ptr);\n", func);
- fprintf(f, "void %snext(CollectionPropertyIterator *iter);\n", func);
- fprintf(f, "void %send(CollectionPropertyIterator *iter);\n", func);
- if (cprop->length)
- fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
- if (cprop->lookupint)
- fprintf(f, "int %slookup_int(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n", func);
- if (cprop->lookupstring)
- fprintf(f, "int %slookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n", func);
- break;
- }
- }
-
- if (prop->getlength) {
- char funcname[2048];
- rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, prop->identifier, "get_length");
- fprintf(f, "int %s(PointerRNA *ptr, int *arraylen);\n", funcname);
- }
-
- fprintf(f, "\n");
+ PropertyRNA *prop;
+ const char *func;
+
+ prop = dp->prop;
+
+ if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) {
+ return;
+ }
+
+ func = rna_alloc_function_name(srna->identifier, rna_safe_id(prop->identifier), "");
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ if (!prop->arraydimension) {
+ fprintf(f, "bool %sget(PointerRNA *ptr);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, bool value);\n", func);
+ }
+ else if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f, "void %sget(PointerRNA *ptr, bool values[%u]);\n", func, prop->totarraylength);
+ fprintf(f,
+ "void %sset(PointerRNA *ptr, const bool values[%u]);\n",
+ func,
+ prop->totarraylength);
+ }
+ else {
+ fprintf(f, "void %sget(PointerRNA *ptr, bool values[]);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, const bool values[]);\n", func);
+ }
+ break;
+ }
+ case PROP_INT: {
+ if (!prop->arraydimension) {
+ fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
+ }
+ else if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f, "void %sget(PointerRNA *ptr, int values[%u]);\n", func, prop->totarraylength);
+ fprintf(
+ f, "void %sset(PointerRNA *ptr, const int values[%u]);\n", func, prop->totarraylength);
+ }
+ else {
+ fprintf(f, "void %sget(PointerRNA *ptr, int values[]);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, const int values[]);\n", func);
+ }
+ break;
+ }
+ case PROP_FLOAT: {
+ if (!prop->arraydimension) {
+ fprintf(f, "float %sget(PointerRNA *ptr);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, float value);\n", func);
+ }
+ else if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f, "void %sget(PointerRNA *ptr, float values[%u]);\n", func, prop->totarraylength);
+ fprintf(f,
+ "void %sset(PointerRNA *ptr, const float values[%u]);\n",
+ func,
+ prop->totarraylength);
+ }
+ else {
+ fprintf(f, "void %sget(PointerRNA *ptr, float values[]);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, const float values[]);", func);
+ }
+ break;
+ }
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ int i;
+
+ if (eprop->item && eprop->totitem) {
+ fprintf(f, "enum {\n");
+
+ for (i = 0; i < eprop->totitem; i++)
+ if (eprop->item[i].identifier[0])
+ fprintf(f,
+ "\t%s_%s_%s = %d,\n",
+ srna->identifier,
+ prop->identifier,
+ eprop->item[i].identifier,
+ eprop->item[i].value);
+
+ fprintf(f, "};\n\n");
+ }
+
+ fprintf(f, "int %sget(PointerRNA *ptr);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, int value);\n", func);
+
+ break;
+ }
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+
+ if (sprop->maxlength) {
+ fprintf(
+ f, "#define %s_%s_MAX %d\n\n", srna->identifier, prop->identifier, sprop->maxlength);
+ }
+
+ fprintf(f, "void %sget(PointerRNA *ptr, char *value);\n", func);
+ fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
+ fprintf(f, "void %sset(PointerRNA *ptr, const char *value);\n", func);
+
+ break;
+ }
+ case PROP_POINTER: {
+ fprintf(f, "PointerRNA %sget(PointerRNA *ptr);\n", func);
+ /*fprintf(f, "void %sset(PointerRNA *ptr, PointerRNA value);\n", func); */
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ fprintf(f, "void %sbegin(CollectionPropertyIterator *iter, PointerRNA *ptr);\n", func);
+ fprintf(f, "void %snext(CollectionPropertyIterator *iter);\n", func);
+ fprintf(f, "void %send(CollectionPropertyIterator *iter);\n", func);
+ if (cprop->length)
+ fprintf(f, "int %slength(PointerRNA *ptr);\n", func);
+ if (cprop->lookupint)
+ fprintf(f, "int %slookup_int(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n", func);
+ if (cprop->lookupstring)
+ fprintf(f,
+ "int %slookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n",
+ func);
+ break;
+ }
+ }
+
+ if (prop->getlength) {
+ char funcname[2048];
+ rna_construct_wrapper_function_name(
+ funcname, sizeof(funcname), srna->identifier, prop->identifier, "get_length");
+ fprintf(f, "int %s(PointerRNA *ptr, int *arraylen);\n", funcname);
+ }
+
+ fprintf(f, "\n");
}
static void rna_def_function_funcs_header(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
{
- FunctionRNA *func = dfunc->func;
- char funcname[2048];
+ FunctionRNA *func = dfunc->func;
+ char funcname[2048];
- rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
- rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 1);
+ rna_construct_wrapper_function_name(
+ funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
+ rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 1);
}
static void rna_def_property_funcs_header_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = dp->prop;
+ prop = dp->prop;
- if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) {
- return;
- }
+ if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) {
+ return;
+ }
- /* disabled for now to avoid msvc compiler error due to large file size */
+ /* disabled for now to avoid msvc compiler error due to large file size */
#if 0
- if (prop->name && prop->description && prop->description[0] != '\0')
- fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description);
- else if (prop->name)
- fprintf(f, "\t/* %s */\n", prop->name);
- else
- fprintf(f, "\t/* */\n");
+ if (prop->name && prop->description && prop->description[0] != '\0')
+ fprintf(f, "\t/* %s: %s */\n", prop->name, prop->description);
+ else if (prop->name)
+ fprintf(f, "\t/* %s */\n", prop->name);
+ else
+ fprintf(f, "\t/* */\n");
#endif
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- if (!prop->arraydimension) {
- fprintf(f, "\tinline bool %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(bool value);", rna_safe_id(prop->identifier));
- }
- else if (prop->totarraylength) {
- fprintf(f, "\tinline Array<bool, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(bool values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
- }
- else if (prop->getlength) {
- fprintf(f, "\tinline DynamicArray<bool> %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(bool values[]);", rna_safe_id(prop->identifier));
- }
- break;
- }
- case PROP_INT:
- {
- if (!prop->arraydimension) {
- fprintf(f, "\tinline int %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier));
- }
- else if (prop->totarraylength) {
- fprintf(f, "\tinline Array<int, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(int values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
- }
- else if (prop->getlength) {
- fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier));
- }
- break;
- }
- case PROP_FLOAT:
- {
- if (!prop->arraydimension) {
- fprintf(f, "\tinline float %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(float value);", rna_safe_id(prop->identifier));
- }
- else if (prop->totarraylength) {
- fprintf(f, "\tinline Array<float, %u> %s(void);\n", prop->totarraylength, rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(float values[%u]);", rna_safe_id(prop->identifier), prop->totarraylength);
- }
- else if (prop->getlength) {
- fprintf(f, "\tinline DynamicArray<float> %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(float values[]);", rna_safe_id(prop->identifier));
- }
- break;
- }
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- int i;
-
- if (eprop->item) {
- fprintf(f, "\tenum %s_enum {\n", rna_safe_id(prop->identifier));
-
- for (i = 0; i < eprop->totitem; i++)
- if (eprop->item[i].identifier[0])
- fprintf(f, "\t\t%s_%s = %d,\n", rna_safe_id(prop->identifier), eprop->item[i].identifier,
- eprop->item[i].value);
-
- fprintf(f, "\t};\n");
- }
-
- fprintf(f, "\tinline %s_enum %s(void);\n", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(%s_enum value);", rna_safe_id(prop->identifier), rna_safe_id(prop->identifier));
- break;
- }
- case PROP_STRING:
- {
- fprintf(f, "\tinline std::string %s(void);\n", rna_safe_id(prop->identifier));
- fprintf(f, "\tinline void %s(const std::string& value);", rna_safe_id(prop->identifier));
- break;
- }
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
-
- if (pprop->type)
- fprintf(f, "\tinline %s %s(void);", (const char *)pprop->type, rna_safe_id(prop->identifier));
- else
- fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier));
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
- const char *collection_funcs = "DefaultCollectionFunctions";
-
- if (!(dp->prop->flag & PROP_IDPROPERTY || dp->prop->flag_internal & PROP_INTERN_BUILTIN) && cprop->property.srna) {
- collection_funcs = (char *)cprop->property.srna;
- }
-
- if (cprop->item_type)
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, (const char *)cprop->item_type, srna->identifier,
- rna_safe_id(prop->identifier), (cprop->length ? "true" : "false"),
- (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false"));
- else
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)", collection_funcs, "UnknownType", srna->identifier,
- rna_safe_id(prop->identifier), (cprop->length ? "true" : "false"),
- (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false"));
- break;
- }
- }
-
- fprintf(f, "\n");
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ if (!prop->arraydimension) {
+ fprintf(f, "\tinline bool %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(bool value);", rna_safe_id(prop->identifier));
+ }
+ else if (prop->totarraylength) {
+ fprintf(f,
+ "\tinline Array<bool, %u> %s(void);\n",
+ prop->totarraylength,
+ rna_safe_id(prop->identifier));
+ fprintf(f,
+ "\tinline void %s(bool values[%u]);",
+ rna_safe_id(prop->identifier),
+ prop->totarraylength);
+ }
+ else if (prop->getlength) {
+ fprintf(f, "\tinline DynamicArray<bool> %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(bool values[]);", rna_safe_id(prop->identifier));
+ }
+ break;
+ }
+ case PROP_INT: {
+ if (!prop->arraydimension) {
+ fprintf(f, "\tinline int %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(int value);", rna_safe_id(prop->identifier));
+ }
+ else if (prop->totarraylength) {
+ fprintf(f,
+ "\tinline Array<int, %u> %s(void);\n",
+ prop->totarraylength,
+ rna_safe_id(prop->identifier));
+ fprintf(f,
+ "\tinline void %s(int values[%u]);",
+ rna_safe_id(prop->identifier),
+ prop->totarraylength);
+ }
+ else if (prop->getlength) {
+ fprintf(f, "\tinline DynamicArray<int> %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(int values[]);", rna_safe_id(prop->identifier));
+ }
+ break;
+ }
+ case PROP_FLOAT: {
+ if (!prop->arraydimension) {
+ fprintf(f, "\tinline float %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(float value);", rna_safe_id(prop->identifier));
+ }
+ else if (prop->totarraylength) {
+ fprintf(f,
+ "\tinline Array<float, %u> %s(void);\n",
+ prop->totarraylength,
+ rna_safe_id(prop->identifier));
+ fprintf(f,
+ "\tinline void %s(float values[%u]);",
+ rna_safe_id(prop->identifier),
+ prop->totarraylength);
+ }
+ else if (prop->getlength) {
+ fprintf(f, "\tinline DynamicArray<float> %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(float values[]);", rna_safe_id(prop->identifier));
+ }
+ break;
+ }
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ int i;
+
+ if (eprop->item) {
+ fprintf(f, "\tenum %s_enum {\n", rna_safe_id(prop->identifier));
+
+ for (i = 0; i < eprop->totitem; i++)
+ if (eprop->item[i].identifier[0])
+ fprintf(f,
+ "\t\t%s_%s = %d,\n",
+ rna_safe_id(prop->identifier),
+ eprop->item[i].identifier,
+ eprop->item[i].value);
+
+ fprintf(f, "\t};\n");
+ }
+
+ fprintf(f,
+ "\tinline %s_enum %s(void);\n",
+ rna_safe_id(prop->identifier),
+ rna_safe_id(prop->identifier));
+ fprintf(f,
+ "\tinline void %s(%s_enum value);",
+ rna_safe_id(prop->identifier),
+ rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_STRING: {
+ fprintf(f, "\tinline std::string %s(void);\n", rna_safe_id(prop->identifier));
+ fprintf(f, "\tinline void %s(const std::string& value);", rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
+
+ if (pprop->type)
+ fprintf(
+ f, "\tinline %s %s(void);", (const char *)pprop->type, rna_safe_id(prop->identifier));
+ else
+ fprintf(f, "\tinline %s %s(void);", "UnknownType", rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
+ const char *collection_funcs = "DefaultCollectionFunctions";
+
+ if (!(dp->prop->flag & PROP_IDPROPERTY || dp->prop->flag_internal & PROP_INTERN_BUILTIN) &&
+ cprop->property.srna) {
+ collection_funcs = (char *)cprop->property.srna;
+ }
+
+ if (cprop->item_type)
+ fprintf(f,
+ "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)",
+ collection_funcs,
+ (const char *)cprop->item_type,
+ srna->identifier,
+ rna_safe_id(prop->identifier),
+ (cprop->length ? "true" : "false"),
+ (cprop->lookupint ? "true" : "false"),
+ (cprop->lookupstring ? "true" : "false"));
+ else
+ fprintf(f,
+ "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s, %s)",
+ collection_funcs,
+ "UnknownType",
+ srna->identifier,
+ rna_safe_id(prop->identifier),
+ (cprop->length ? "true" : "false"),
+ (cprop->lookupint ? "true" : "false"),
+ (cprop->lookupstring ? "true" : "false"));
+ break;
+ }
+ }
+
+ fprintf(f, "\n");
}
static const char *rna_parameter_type_cpp_name(PropertyRNA *prop)
{
- if (prop->type == PROP_POINTER) {
- /* for cpp api we need to use RNA structures names for pointers */
- PointerPropertyRNA *pprop = (PointerPropertyRNA *) prop;
-
- return (const char *) pprop->type;
- }
- else {
- return rna_parameter_type_name(prop);
- }
+ if (prop->type == PROP_POINTER) {
+ /* for cpp api we need to use RNA structures names for pointers */
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+
+ return (const char *)pprop->type;
+ }
+ else {
+ return rna_parameter_type_name(prop);
+ }
}
-static void rna_def_struct_function_prototype_cpp(FILE *f, StructRNA *UNUSED(srna), FunctionDefRNA *dfunc,
- const char *namespace, int close_prototype)
+static void rna_def_struct_function_prototype_cpp(FILE *f,
+ StructRNA *UNUSED(srna),
+ FunctionDefRNA *dfunc,
+ const char *namespace,
+ int close_prototype)
{
- PropertyDefRNA *dp;
- FunctionRNA *func = dfunc->func;
-
- int first = 1;
- const char *retval_type = "void";
-
- if (func->c_ret) {
- dp = rna_find_parameter_def(func->c_ret);
- retval_type = rna_parameter_type_cpp_name(dp->prop);
- }
-
- if (namespace && namespace[0])
- fprintf(f, "\tinline %s %s::%s(", retval_type, namespace, rna_safe_id(func->identifier));
- else
- fprintf(f, "\tinline %s %s(", retval_type, rna_safe_id(func->identifier));
-
- if (func->flag & FUNC_USE_MAIN)
- WRITE_PARAM("void *main");
-
- if (func->flag & FUNC_USE_CONTEXT)
- WRITE_PARAM("Context C");
-
- for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
- int type, flag, flag_parameter, pout;
- const char *ptrstr;
-
- if (dp->prop == func->c_ret)
- continue;
-
- type = dp->prop->type;
- flag = dp->prop->flag;
- flag_parameter = dp->prop->flag_parameter;
- pout = (flag_parameter & PARM_OUTPUT);
-
- if (flag & PROP_DYNAMIC)
- ptrstr = pout ? "**" : "*";
- else if (type == PROP_POINTER)
- ptrstr = pout ? "*" : "";
- else if (dp->prop->arraydimension)
- ptrstr = "*";
- else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
- ptrstr = "";
- else
- ptrstr = pout ? "*" : "";
-
- WRITE_COMMA;
-
- if (flag & PROP_DYNAMIC)
- fprintf(f, "int %s%s_len, ", (flag_parameter & PARM_OUTPUT) ? "*" : "", dp->prop->identifier);
-
- if (!(flag & PROP_DYNAMIC) && dp->prop->arraydimension)
- fprintf(f, "%s %s[%u]", rna_parameter_type_cpp_name(dp->prop),
- rna_safe_id(dp->prop->identifier), dp->prop->totarraylength);
- else {
- fprintf(f, "%s%s%s%s",
- rna_parameter_type_cpp_name(dp->prop),
- (dp->prop->type == PROP_POINTER && ptrstr[0] == '\0') ? "& " : " ",
- ptrstr,
- rna_safe_id(dp->prop->identifier));
- }
- }
-
- fprintf(f, ")");
- if (close_prototype)
- fprintf(f, ";\n");
+ PropertyDefRNA *dp;
+ FunctionRNA *func = dfunc->func;
+
+ int first = 1;
+ const char *retval_type = "void";
+
+ if (func->c_ret) {
+ dp = rna_find_parameter_def(func->c_ret);
+ retval_type = rna_parameter_type_cpp_name(dp->prop);
+ }
+
+ if (namespace && namespace[0])
+ fprintf(f, "\tinline %s %s::%s(", retval_type, namespace, rna_safe_id(func->identifier));
+ else
+ fprintf(f, "\tinline %s %s(", retval_type, rna_safe_id(func->identifier));
+
+ if (func->flag & FUNC_USE_MAIN)
+ WRITE_PARAM("void *main");
+
+ if (func->flag & FUNC_USE_CONTEXT)
+ WRITE_PARAM("Context C");
+
+ for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
+ int type, flag, flag_parameter, pout;
+ const char *ptrstr;
+
+ if (dp->prop == func->c_ret)
+ continue;
+
+ type = dp->prop->type;
+ flag = dp->prop->flag;
+ flag_parameter = dp->prop->flag_parameter;
+ pout = (flag_parameter & PARM_OUTPUT);
+
+ if (flag & PROP_DYNAMIC)
+ ptrstr = pout ? "**" : "*";
+ else if (type == PROP_POINTER)
+ ptrstr = pout ? "*" : "";
+ else if (dp->prop->arraydimension)
+ ptrstr = "*";
+ else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
+ ptrstr = "";
+ else
+ ptrstr = pout ? "*" : "";
+
+ WRITE_COMMA;
+
+ if (flag & PROP_DYNAMIC)
+ fprintf(
+ f, "int %s%s_len, ", (flag_parameter & PARM_OUTPUT) ? "*" : "", dp->prop->identifier);
+
+ if (!(flag & PROP_DYNAMIC) && dp->prop->arraydimension)
+ fprintf(f,
+ "%s %s[%u]",
+ rna_parameter_type_cpp_name(dp->prop),
+ rna_safe_id(dp->prop->identifier),
+ dp->prop->totarraylength);
+ else {
+ fprintf(f,
+ "%s%s%s%s",
+ rna_parameter_type_cpp_name(dp->prop),
+ (dp->prop->type == PROP_POINTER && ptrstr[0] == '\0') ? "& " : " ",
+ ptrstr,
+ rna_safe_id(dp->prop->identifier));
+ }
+ }
+
+ fprintf(f, ")");
+ if (close_prototype)
+ fprintf(f, ";\n");
}
static void rna_def_struct_function_header_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
{
- if (dfunc->call) {
- /* disabled for now to avoid msvc compiler error due to large file size */
+ if (dfunc->call) {
+ /* disabled for now to avoid msvc compiler error due to large file size */
#if 0
- FunctionRNA *func = dfunc->func;
- fprintf(f, "\n\t/* %s */\n", func->description);
+ FunctionRNA *func = dfunc->func;
+ fprintf(f, "\n\t/* %s */\n", func->description);
#endif
- rna_def_struct_function_prototype_cpp(f, srna, dfunc, NULL, 1);
- }
+ rna_def_struct_function_prototype_cpp(f, srna, dfunc, NULL, 1);
+ }
}
static void rna_def_property_funcs_impl_cpp(FILE *f, StructRNA *srna, PropertyDefRNA *dp)
{
- PropertyRNA *prop;
-
- prop = dp->prop;
-
- if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) {
- return;
- }
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- if (!prop->arraydimension)
- fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- else if (prop->totarraylength)
- fprintf(f, "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
- rna_safe_id(prop->identifier));
- else if (prop->getlength)
- fprintf(f, "\tBOOLEAN_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier,
- rna_safe_id(prop->identifier));
- break;
- }
- case PROP_INT:
- {
- if (!prop->arraydimension)
- fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- else if (prop->totarraylength)
- fprintf(f, "\tINT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
- rna_safe_id(prop->identifier));
- else if (prop->getlength)
- fprintf(f, "\tINT_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier,
- rna_safe_id(prop->identifier));
- break;
- }
- case PROP_FLOAT:
- {
- if (!prop->arraydimension)
- fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- else if (prop->totarraylength)
- fprintf(f, "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)", srna->identifier, prop->totarraylength,
- rna_safe_id(prop->identifier));
- else if (prop->getlength)
- fprintf(f, "\tFLOAT_DYNAMIC_ARRAY_PROPERTY(%s, %s)", srna->identifier,
- rna_safe_id(prop->identifier));
- break;
- }
- case PROP_ENUM:
- {
- fprintf(f, "\tENUM_PROPERTY(%s_enum, %s, %s)", rna_safe_id(prop->identifier), srna->identifier,
- rna_safe_id(prop->identifier));
-
- break;
- }
- case PROP_STRING:
- {
- fprintf(f, "\tSTRING_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
- break;
- }
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
-
- if (pprop->type)
- fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", (const char *)pprop->type, srna->identifier,
- rna_safe_id(prop->identifier));
- else
- fprintf(f, "\tPOINTER_PROPERTY(%s, %s, %s)", "UnknownType", srna->identifier,
- rna_safe_id(prop->identifier));
- break;
- }
- case PROP_COLLECTION:
- {
+ PropertyRNA *prop;
+
+ prop = dp->prop;
+
+ if (prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN) {
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ if (!prop->arraydimension)
+ fprintf(f, "\tBOOLEAN_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
+ else if (prop->totarraylength)
+ fprintf(f,
+ "\tBOOLEAN_ARRAY_PROPERTY(%s, %u, %s)",
+ srna->identifier,
+ prop->totarraylength,
+ rna_safe_id(prop->identifier));
+ else if (prop->getlength)
+ fprintf(f,
+ "\tBOOLEAN_DYNAMIC_ARRAY_PROPERTY(%s, %s)",
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_INT: {
+ if (!prop->arraydimension)
+ fprintf(f, "\tINT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
+ else if (prop->totarraylength)
+ fprintf(f,
+ "\tINT_ARRAY_PROPERTY(%s, %u, %s)",
+ srna->identifier,
+ prop->totarraylength,
+ rna_safe_id(prop->identifier));
+ else if (prop->getlength)
+ fprintf(f,
+ "\tINT_DYNAMIC_ARRAY_PROPERTY(%s, %s)",
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_FLOAT: {
+ if (!prop->arraydimension)
+ fprintf(f, "\tFLOAT_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
+ else if (prop->totarraylength)
+ fprintf(f,
+ "\tFLOAT_ARRAY_PROPERTY(%s, %u, %s)",
+ srna->identifier,
+ prop->totarraylength,
+ rna_safe_id(prop->identifier));
+ else if (prop->getlength)
+ fprintf(f,
+ "\tFLOAT_DYNAMIC_ARRAY_PROPERTY(%s, %s)",
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_ENUM: {
+ fprintf(f,
+ "\tENUM_PROPERTY(%s_enum, %s, %s)",
+ rna_safe_id(prop->identifier),
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+
+ break;
+ }
+ case PROP_STRING: {
+ fprintf(f, "\tSTRING_PROPERTY(%s, %s)", srna->identifier, rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
+
+ if (pprop->type)
+ fprintf(f,
+ "\tPOINTER_PROPERTY(%s, %s, %s)",
+ (const char *)pprop->type,
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+ else
+ fprintf(f,
+ "\tPOINTER_PROPERTY(%s, %s, %s)",
+ "UnknownType",
+ srna->identifier,
+ rna_safe_id(prop->identifier));
+ break;
+ }
+ case PROP_COLLECTION: {
#if 0
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
-
- if (cprop->type)
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)", (const char *)cprop->type, srna->identifier,
- prop->identifier, (cprop->length ? "true" : "false"),
- (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false"));
- else
- fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)", "UnknownType", srna->identifier,
- prop->identifier, (cprop->length ? "true" : "false"),
- (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false"));
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
+
+ if (cprop->type)
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)", (const char *)cprop->type, srna->identifier,
+ prop->identifier, (cprop->length ? "true" : "false"),
+ (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false"));
+ else
+ fprintf(f, "\tCOLLECTION_PROPERTY(%s, %s, %s, %s, %s, %s)", "UnknownType", srna->identifier,
+ prop->identifier, (cprop->length ? "true" : "false"),
+ (cprop->lookupint ? "true" : "false"), (cprop->lookupstring ? "true" : "false"));
#endif
- break;
- }
- }
+ break;
+ }
+ }
- fprintf(f, "\n");
+ fprintf(f, "\n");
}
static void rna_def_struct_function_call_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
{
- PropertyDefRNA *dp;
- StructDefRNA *dsrna;
- FunctionRNA *func = dfunc->func;
- char funcname[2048];
-
- int first = 1;
-
- rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
-
- fprintf(f, "%s(", funcname);
-
- dsrna = rna_find_struct_def(srna);
-
- if (func->flag & FUNC_USE_SELF_ID)
- WRITE_PARAM("(::ID *) ptr.id.data");
-
- if ((func->flag & FUNC_NO_SELF) == 0) {
- WRITE_COMMA;
- if (dsrna->dnafromprop) fprintf(f, "(::%s *) this->ptr.data", dsrna->dnafromname);
- else if (dsrna->dnaname) fprintf(f, "(::%s *) this->ptr.data", dsrna->dnaname);
- else fprintf(f, "(::%s *) this->ptr.data", srna->identifier);
- }
- else if (func->flag & FUNC_USE_SELF_TYPE) {
- WRITE_COMMA;
- fprintf(f, "this->ptr.type");
- }
-
- if (func->flag & FUNC_USE_MAIN)
- WRITE_PARAM("(::Main *) main");
-
- if (func->flag & FUNC_USE_CONTEXT)
- WRITE_PARAM("(::bContext *) C.ptr.data");
-
- if (func->flag & FUNC_USE_REPORTS)
- WRITE_PARAM("NULL");
-
- dp = dfunc->cont.properties.first;
- for (; dp; dp = dp->next) {
- if (dp->prop == func->c_ret)
- continue;
-
- WRITE_COMMA;
-
- if (dp->prop->flag & PROP_DYNAMIC)
- fprintf(f, "%s_len, ", dp->prop->identifier);
-
- if (dp->prop->type == PROP_POINTER)
- if ((dp->prop->flag_parameter & PARM_RNAPTR) && !(dp->prop->flag & PROP_THICK_WRAP))
- fprintf(f, "(::%s *) &%s.ptr", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier));
- else if (dp->prop->flag_parameter & PARM_OUTPUT) {
- if (dp->prop->flag_parameter & PARM_RNAPTR) {
- fprintf(f, "&%s->ptr",
- rna_safe_id(dp->prop->identifier));
- }
- else {
- fprintf(f, "(::%s **) &%s->ptr.data",
- rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier));
- }
- }
- else
- fprintf(f, "(::%s *) %s.ptr.data", rna_parameter_type_name(dp->prop), rna_safe_id(dp->prop->identifier));
- else
- fprintf(f, "%s", rna_safe_id(dp->prop->identifier));
- }
-
- fprintf(f, ");\n");
+ PropertyDefRNA *dp;
+ StructDefRNA *dsrna;
+ FunctionRNA *func = dfunc->func;
+ char funcname[2048];
+
+ int first = 1;
+
+ rna_construct_wrapper_function_name(
+ funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
+
+ fprintf(f, "%s(", funcname);
+
+ dsrna = rna_find_struct_def(srna);
+
+ if (func->flag & FUNC_USE_SELF_ID)
+ WRITE_PARAM("(::ID *) ptr.id.data");
+
+ if ((func->flag & FUNC_NO_SELF) == 0) {
+ WRITE_COMMA;
+ if (dsrna->dnafromprop)
+ fprintf(f, "(::%s *) this->ptr.data", dsrna->dnafromname);
+ else if (dsrna->dnaname)
+ fprintf(f, "(::%s *) this->ptr.data", dsrna->dnaname);
+ else
+ fprintf(f, "(::%s *) this->ptr.data", srna->identifier);
+ }
+ else if (func->flag & FUNC_USE_SELF_TYPE) {
+ WRITE_COMMA;
+ fprintf(f, "this->ptr.type");
+ }
+
+ if (func->flag & FUNC_USE_MAIN)
+ WRITE_PARAM("(::Main *) main");
+
+ if (func->flag & FUNC_USE_CONTEXT)
+ WRITE_PARAM("(::bContext *) C.ptr.data");
+
+ if (func->flag & FUNC_USE_REPORTS)
+ WRITE_PARAM("NULL");
+
+ dp = dfunc->cont.properties.first;
+ for (; dp; dp = dp->next) {
+ if (dp->prop == func->c_ret)
+ continue;
+
+ WRITE_COMMA;
+
+ if (dp->prop->flag & PROP_DYNAMIC)
+ fprintf(f, "%s_len, ", dp->prop->identifier);
+
+ if (dp->prop->type == PROP_POINTER)
+ if ((dp->prop->flag_parameter & PARM_RNAPTR) && !(dp->prop->flag & PROP_THICK_WRAP))
+ fprintf(f,
+ "(::%s *) &%s.ptr",
+ rna_parameter_type_name(dp->prop),
+ rna_safe_id(dp->prop->identifier));
+ else if (dp->prop->flag_parameter & PARM_OUTPUT) {
+ if (dp->prop->flag_parameter & PARM_RNAPTR) {
+ fprintf(f, "&%s->ptr", rna_safe_id(dp->prop->identifier));
+ }
+ else {
+ fprintf(f,
+ "(::%s **) &%s->ptr.data",
+ rna_parameter_type_name(dp->prop),
+ rna_safe_id(dp->prop->identifier));
+ }
+ }
+ else
+ fprintf(f,
+ "(::%s *) %s.ptr.data",
+ rna_parameter_type_name(dp->prop),
+ rna_safe_id(dp->prop->identifier));
+ else
+ fprintf(f, "%s", rna_safe_id(dp->prop->identifier));
+ }
+
+ fprintf(f, ");\n");
}
static void rna_def_struct_function_impl_cpp(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc)
{
- PropertyDefRNA *dp;
- PointerPropertyRNA *pprop;
-
- FunctionRNA *func = dfunc->func;
-
- if (!dfunc->call)
- return;
-
- rna_def_struct_function_prototype_cpp(f, srna, dfunc, srna->identifier, 0);
-
- fprintf(f, " {\n");
-
- if (func->c_ret) {
- dp = rna_find_parameter_def(func->c_ret);
-
- if (dp->prop->type == PROP_POINTER) {
- pprop = (PointerPropertyRNA *) dp->prop;
-
- fprintf(f, "\t\tPointerRNA result;\n");
-
- if ((dp->prop->flag_parameter & PARM_RNAPTR) == 0) {
- StructRNA *ret_srna = rna_find_struct((const char *) pprop->type);
- fprintf(f, "\t\t::%s *retdata = ", rna_parameter_type_name(dp->prop));
- rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
- if (ret_srna->flag & STRUCT_ID)
- fprintf(f, "\t\tRNA_id_pointer_create((::ID *) retdata, &result);\n");
- else
- fprintf(f, "\t\tRNA_pointer_create((::ID *) ptr.id.data, &RNA_%s, retdata, &result);\n", (const char *) pprop->type);
- }
- else {
- fprintf(f, "\t\tresult = ");
- rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
- }
-
- fprintf(f, "\t\treturn %s(result);\n", (const char *) pprop->type);
- }
- else {
- fprintf(f, "\t\treturn ");
- rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
- }
- }
- else {
- fprintf(f, "\t\t");
- rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
- }
-
- fprintf(f, "\t}\n\n");
+ PropertyDefRNA *dp;
+ PointerPropertyRNA *pprop;
+
+ FunctionRNA *func = dfunc->func;
+
+ if (!dfunc->call)
+ return;
+
+ rna_def_struct_function_prototype_cpp(f, srna, dfunc, srna->identifier, 0);
+
+ fprintf(f, " {\n");
+
+ if (func->c_ret) {
+ dp = rna_find_parameter_def(func->c_ret);
+
+ if (dp->prop->type == PROP_POINTER) {
+ pprop = (PointerPropertyRNA *)dp->prop;
+
+ fprintf(f, "\t\tPointerRNA result;\n");
+
+ if ((dp->prop->flag_parameter & PARM_RNAPTR) == 0) {
+ StructRNA *ret_srna = rna_find_struct((const char *)pprop->type);
+ fprintf(f, "\t\t::%s *retdata = ", rna_parameter_type_name(dp->prop));
+ rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+ if (ret_srna->flag & STRUCT_ID)
+ fprintf(f, "\t\tRNA_id_pointer_create((::ID *) retdata, &result);\n");
+ else
+ fprintf(f,
+ "\t\tRNA_pointer_create((::ID *) ptr.id.data, &RNA_%s, retdata, &result);\n",
+ (const char *)pprop->type);
+ }
+ else {
+ fprintf(f, "\t\tresult = ");
+ rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+ }
+
+ fprintf(f, "\t\treturn %s(result);\n", (const char *)pprop->type);
+ }
+ else {
+ fprintf(f, "\t\treturn ");
+ rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+ }
+ }
+ else {
+ fprintf(f, "\t\t");
+ rna_def_struct_function_call_impl_cpp(f, srna, dfunc);
+ }
+
+ fprintf(f, "\t}\n\n");
}
static void rna_def_property_wrapper_funcs(FILE *f, StructDefRNA *dsrna, PropertyDefRNA *dp)
{
- if (dp->prop->getlength) {
- char funcname[2048];
- rna_construct_wrapper_function_name(funcname, sizeof(funcname), dsrna->srna->identifier, dp->prop->identifier, "get_length");
- fprintf(f, "int %s(PointerRNA *ptr, int *arraylen)\n", funcname);
- fprintf(f, "{\n");
- fprintf(f, "\treturn %s(ptr, arraylen);\n", rna_function_string(dp->prop->getlength));
- fprintf(f, "}\n\n");
- }
+ if (dp->prop->getlength) {
+ char funcname[2048];
+ rna_construct_wrapper_function_name(
+ funcname, sizeof(funcname), dsrna->srna->identifier, dp->prop->identifier, "get_length");
+ fprintf(f, "int %s(PointerRNA *ptr, int *arraylen)\n", funcname);
+ fprintf(f, "{\n");
+ fprintf(f, "\treturn %s(ptr, arraylen);\n", rna_function_string(dp->prop->getlength));
+ fprintf(f, "}\n\n");
+ }
}
static void rna_def_function_wrapper_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
{
- StructRNA *srna = dsrna->srna;
- FunctionRNA *func = dfunc->func;
- PropertyDefRNA *dparm;
+ StructRNA *srna = dsrna->srna;
+ FunctionRNA *func = dfunc->func;
+ PropertyDefRNA *dparm;
- int first;
- char funcname[2048];
+ int first;
+ char funcname[2048];
- if (!dfunc->call)
- return;
+ if (!dfunc->call)
+ return;
- rna_construct_wrapper_function_name(funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
+ rna_construct_wrapper_function_name(
+ funcname, sizeof(funcname), srna->identifier, func->identifier, NULL);
- rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 0);
+ rna_generate_static_parameter_prototypes(f, srna, dfunc, funcname, 0);
- fprintf(f, "\n{\n");
+ fprintf(f, "\n{\n");
- if (func->c_ret)
- fprintf(f, "\treturn %s(", dfunc->call);
- else
- fprintf(f, "\t%s(", dfunc->call);
+ if (func->c_ret)
+ fprintf(f, "\treturn %s(", dfunc->call);
+ else
+ fprintf(f, "\t%s(", dfunc->call);
- first = 1;
+ first = 1;
- if (func->flag & FUNC_USE_SELF_ID)
- WRITE_PARAM("_selfid");
+ if (func->flag & FUNC_USE_SELF_ID)
+ WRITE_PARAM("_selfid");
- if ((func->flag & FUNC_NO_SELF) == 0) {
- WRITE_PARAM("_self");
- }
- else if (func->flag & FUNC_USE_SELF_TYPE) {
- WRITE_PARAM("_type");
- }
+ if ((func->flag & FUNC_NO_SELF) == 0) {
+ WRITE_PARAM("_self");
+ }
+ else if (func->flag & FUNC_USE_SELF_TYPE) {
+ WRITE_PARAM("_type");
+ }
- if (func->flag & FUNC_USE_MAIN)
- WRITE_PARAM("bmain");
+ if (func->flag & FUNC_USE_MAIN)
+ WRITE_PARAM("bmain");
- if (func->flag & FUNC_USE_CONTEXT)
- WRITE_PARAM("C");
+ if (func->flag & FUNC_USE_CONTEXT)
+ WRITE_PARAM("C");
- if (func->flag & FUNC_USE_REPORTS)
- WRITE_PARAM("reports");
+ if (func->flag & FUNC_USE_REPORTS)
+ WRITE_PARAM("reports");
- dparm = dfunc->cont.properties.first;
- for (; dparm; dparm = dparm->next) {
- if (dparm->prop == func->c_ret)
- continue;
+ dparm = dfunc->cont.properties.first;
+ for (; dparm; dparm = dparm->next) {
+ if (dparm->prop == func->c_ret)
+ continue;
- WRITE_COMMA;
+ WRITE_COMMA;
- if (dparm->prop->flag & PROP_DYNAMIC)
- fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
- else
- fprintf(f, "%s", rna_safe_id(dparm->prop->identifier));
- }
+ if (dparm->prop->flag & PROP_DYNAMIC)
+ fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
+ else
+ fprintf(f, "%s", rna_safe_id(dparm->prop->identifier));
+ }
- fprintf(f, ");\n");
- fprintf(f, "}\n\n");
+ fprintf(f, ");\n");
+ fprintf(f, "}\n\n");
}
static void rna_def_function_funcs(FILE *f, StructDefRNA *dsrna, FunctionDefRNA *dfunc)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyDefRNA *dparm;
- PropertyType type;
- const char *funcname, *valstr;
- const char *ptrstr;
- const bool has_data = (dfunc->cont.properties.first != NULL);
- int flag, flag_parameter, pout, cptr, first;
-
- srna = dsrna->srna;
- func = dfunc->func;
-
- if (!dfunc->call)
- return;
-
- funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call");
-
- /* function definition */
- fprintf(f, "void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)", funcname);
- fprintf(f, "\n{\n");
-
- /* variable definitions */
-
- if (func->flag & FUNC_USE_SELF_ID) {
- fprintf(f, "\tstruct ID *_selfid;\n");
- }
-
- if ((func->flag & FUNC_NO_SELF) == 0) {
- if (dsrna->dnafromprop) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnafromname);
- else if (dsrna->dnaname) fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
- else fprintf(f, "\tstruct %s *_self;\n", srna->identifier);
- }
- else if (func->flag & FUNC_USE_SELF_TYPE) {
- fprintf(f, "\tstruct StructRNA *_type;\n");
- }
-
- dparm = dfunc->cont.properties.first;
- for (; dparm; dparm = dparm->next) {
- type = dparm->prop->type;
- flag = dparm->prop->flag;
- flag_parameter = dparm->prop->flag_parameter;
- pout = (flag_parameter & PARM_OUTPUT);
- cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR));
-
- if (dparm->prop == func->c_ret)
- ptrstr = cptr || dparm->prop->arraydimension ? "*" : "";
- /* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */
- else if (cptr || (flag & PROP_DYNAMIC))
- ptrstr = pout ? "**" : "*";
- /* fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, pass a pointer to it */
- else if (type == PROP_POINTER || dparm->prop->arraydimension)
- ptrstr = "*";
- else if ((type == PROP_POINTER) && (flag_parameter & PARM_RNAPTR) && !(flag & PROP_THICK_WRAP))
- ptrstr = "*";
- /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack,
- * but type name for string props is already (char *), so leave empty */
- else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
- ptrstr = "";
- else
- ptrstr = pout ? "*" : "";
-
- /* for dynamic parameters we pass an additional int for the length of the parameter */
- if (flag & PROP_DYNAMIC)
- fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
-
- fprintf(f, "\t%s%s %s%s;\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
- ptrstr, dparm->prop->identifier);
- }
-
- if (has_data) {
- fprintf(f, "\tchar *_data");
- if (func->c_ret) fprintf(f, ", *_retdata");
- fprintf(f, ";\n");
- fprintf(f, "\t\n");
- }
-
- /* assign self */
- if (func->flag & FUNC_USE_SELF_ID) {
- fprintf(f, "\t_selfid = (struct ID *)_ptr->id.data;\n");
- }
-
- if ((func->flag & FUNC_NO_SELF) == 0) {
- if (dsrna->dnafromprop) fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnafromname);
- else if (dsrna->dnaname) fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnaname);
- else fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", srna->identifier);
- }
- else if (func->flag & FUNC_USE_SELF_TYPE) {
- fprintf(f, "\t_type = _ptr->type;\n");
- }
-
- if (has_data) {
- fprintf(f, "\t_data = (char *)_parms->data;\n");
- }
-
- dparm = dfunc->cont.properties.first;
- for (; dparm; dparm = dparm->next) {
- type = dparm->prop->type;
- flag = dparm->prop->flag;
- flag_parameter = dparm->prop->flag_parameter;
- pout = (flag_parameter & PARM_OUTPUT);
- cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR));
-
- if (dparm->prop == func->c_ret)
- fprintf(f, "\t_retdata = _data;\n");
- else {
- const char *data_str;
- if (cptr || (flag & PROP_DYNAMIC)) {
- ptrstr = "**";
- valstr = "*";
- }
- else if ((type == PROP_POINTER) && !(flag & PROP_THICK_WRAP)) {
- ptrstr = "**";
- valstr = "*";
- }
- else if (type == PROP_POINTER || dparm->prop->arraydimension) {
- ptrstr = "*";
- valstr = "";
- }
- else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) {
- ptrstr = "";
- valstr = "";
- }
- else {
- ptrstr = "*";
- valstr = "*";
- }
-
- /* this must be kept in sync with RNA_parameter_dynamic_length_get_data and RNA_parameter_get,
- * we could just call the function directly, but this is faster */
- if (flag & PROP_DYNAMIC) {
- fprintf(f, "\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n", dparm->prop->identifier,
- pout ? "(int *)&" : "(int)");
- data_str = "(&(((ParameterDynAlloc *)_data)->array))";
- }
- else {
- data_str = "_data";
- }
- fprintf(f, "\t%s = ", dparm->prop->identifier);
-
- if (!pout)
- fprintf(f, "%s", valstr);
-
- fprintf(f, "((%s%s %s)%s);\n", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
- ptrstr, data_str);
- }
-
- if (dparm->next)
- fprintf(f, "\t_data += %d;\n", rna_parameter_size(dparm->prop));
- }
-
- if (dfunc->call) {
- fprintf(f, "\t\n");
- fprintf(f, "\t");
- if (func->c_ret) fprintf(f, "%s = ", func->c_ret->identifier);
- fprintf(f, "%s(", dfunc->call);
-
- first = 1;
-
- if (func->flag & FUNC_USE_SELF_ID) {
- fprintf(f, "_selfid");
- first = 0;
- }
-
- if ((func->flag & FUNC_NO_SELF) == 0) {
- if (!first) fprintf(f, ", ");
- fprintf(f, "_self");
- first = 0;
- }
- else if (func->flag & FUNC_USE_SELF_TYPE) {
- if (!first) fprintf(f, ", ");
- fprintf(f, "_type");
- first = 0;
- }
-
- if (func->flag & FUNC_USE_MAIN) {
- if (!first) fprintf(f, ", ");
- first = 0;
- fprintf(f, "CTX_data_main(C)"); /* may have direct access later */
- }
-
- if (func->flag & FUNC_USE_CONTEXT) {
- if (!first) fprintf(f, ", ");
- first = 0;
- fprintf(f, "C");
- }
-
- if (func->flag & FUNC_USE_REPORTS) {
- if (!first) fprintf(f, ", ");
- first = 0;
- fprintf(f, "reports");
- }
-
- dparm = dfunc->cont.properties.first;
- for (; dparm; dparm = dparm->next) {
- if (dparm->prop == func->c_ret)
- continue;
-
- if (!first) fprintf(f, ", ");
- first = 0;
-
- if (dparm->prop->flag & PROP_DYNAMIC)
- fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
- else
- fprintf(f, "%s", dparm->prop->identifier);
- }
-
- fprintf(f, ");\n");
-
- if (func->c_ret) {
- dparm = rna_find_parameter_def(func->c_ret);
- ptrstr = (((dparm->prop->type == PROP_POINTER) && !(dparm->prop->flag_parameter & PARM_RNAPTR)) ||
- (dparm->prop->arraydimension)) ? "*" : "";
- fprintf(f, "\t*((%s%s %s*)_retdata) = %s;\n", rna_type_struct(dparm->prop),
- rna_parameter_type_name(dparm->prop), ptrstr, func->c_ret->identifier);
- }
- }
-
- fprintf(f, "}\n\n");
-
- dfunc->gencall = funcname;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyDefRNA *dparm;
+ PropertyType type;
+ const char *funcname, *valstr;
+ const char *ptrstr;
+ const bool has_data = (dfunc->cont.properties.first != NULL);
+ int flag, flag_parameter, pout, cptr, first;
+
+ srna = dsrna->srna;
+ func = dfunc->func;
+
+ if (!dfunc->call)
+ return;
+
+ funcname = rna_alloc_function_name(srna->identifier, func->identifier, "call");
+
+ /* function definition */
+ fprintf(f,
+ "void %s(bContext *C, ReportList *reports, PointerRNA *_ptr, ParameterList *_parms)",
+ funcname);
+ fprintf(f, "\n{\n");
+
+ /* variable definitions */
+
+ if (func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "\tstruct ID *_selfid;\n");
+ }
+
+ if ((func->flag & FUNC_NO_SELF) == 0) {
+ if (dsrna->dnafromprop)
+ fprintf(f, "\tstruct %s *_self;\n", dsrna->dnafromname);
+ else if (dsrna->dnaname)
+ fprintf(f, "\tstruct %s *_self;\n", dsrna->dnaname);
+ else
+ fprintf(f, "\tstruct %s *_self;\n", srna->identifier);
+ }
+ else if (func->flag & FUNC_USE_SELF_TYPE) {
+ fprintf(f, "\tstruct StructRNA *_type;\n");
+ }
+
+ dparm = dfunc->cont.properties.first;
+ for (; dparm; dparm = dparm->next) {
+ type = dparm->prop->type;
+ flag = dparm->prop->flag;
+ flag_parameter = dparm->prop->flag_parameter;
+ pout = (flag_parameter & PARM_OUTPUT);
+ cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR));
+
+ if (dparm->prop == func->c_ret)
+ ptrstr = cptr || dparm->prop->arraydimension ? "*" : "";
+ /* XXX only arrays and strings are allowed to be dynamic, is this checked anywhere? */
+ else if (cptr || (flag & PROP_DYNAMIC))
+ ptrstr = pout ? "**" : "*";
+ /* fixed size arrays and RNA pointers are pre-allocated on the ParameterList stack, pass a pointer to it */
+ else if (type == PROP_POINTER || dparm->prop->arraydimension)
+ ptrstr = "*";
+ else if ((type == PROP_POINTER) && (flag_parameter & PARM_RNAPTR) && !(flag & PROP_THICK_WRAP))
+ ptrstr = "*";
+ /* PROP_THICK_WRAP strings are pre-allocated on the ParameterList stack,
+ * but type name for string props is already (char *), so leave empty */
+ else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
+ ptrstr = "";
+ else
+ ptrstr = pout ? "*" : "";
+
+ /* for dynamic parameters we pass an additional int for the length of the parameter */
+ if (flag & PROP_DYNAMIC)
+ fprintf(f, "\tint %s%s_len;\n", pout ? "*" : "", dparm->prop->identifier);
+
+ fprintf(f,
+ "\t%s%s %s%s;\n",
+ rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop),
+ ptrstr,
+ dparm->prop->identifier);
+ }
+
+ if (has_data) {
+ fprintf(f, "\tchar *_data");
+ if (func->c_ret)
+ fprintf(f, ", *_retdata");
+ fprintf(f, ";\n");
+ fprintf(f, "\t\n");
+ }
+
+ /* assign self */
+ if (func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "\t_selfid = (struct ID *)_ptr->id.data;\n");
+ }
+
+ if ((func->flag & FUNC_NO_SELF) == 0) {
+ if (dsrna->dnafromprop)
+ fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnafromname);
+ else if (dsrna->dnaname)
+ fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", dsrna->dnaname);
+ else
+ fprintf(f, "\t_self = (struct %s *)_ptr->data;\n", srna->identifier);
+ }
+ else if (func->flag & FUNC_USE_SELF_TYPE) {
+ fprintf(f, "\t_type = _ptr->type;\n");
+ }
+
+ if (has_data) {
+ fprintf(f, "\t_data = (char *)_parms->data;\n");
+ }
+
+ dparm = dfunc->cont.properties.first;
+ for (; dparm; dparm = dparm->next) {
+ type = dparm->prop->type;
+ flag = dparm->prop->flag;
+ flag_parameter = dparm->prop->flag_parameter;
+ pout = (flag_parameter & PARM_OUTPUT);
+ cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR));
+
+ if (dparm->prop == func->c_ret)
+ fprintf(f, "\t_retdata = _data;\n");
+ else {
+ const char *data_str;
+ if (cptr || (flag & PROP_DYNAMIC)) {
+ ptrstr = "**";
+ valstr = "*";
+ }
+ else if ((type == PROP_POINTER) && !(flag & PROP_THICK_WRAP)) {
+ ptrstr = "**";
+ valstr = "*";
+ }
+ else if (type == PROP_POINTER || dparm->prop->arraydimension) {
+ ptrstr = "*";
+ valstr = "";
+ }
+ else if (type == PROP_STRING && (flag & PROP_THICK_WRAP)) {
+ ptrstr = "";
+ valstr = "";
+ }
+ else {
+ ptrstr = "*";
+ valstr = "*";
+ }
+
+ /* this must be kept in sync with RNA_parameter_dynamic_length_get_data and RNA_parameter_get,
+ * we could just call the function directly, but this is faster */
+ if (flag & PROP_DYNAMIC) {
+ fprintf(f,
+ "\t%s_len = %s((ParameterDynAlloc *)_data)->array_tot;\n",
+ dparm->prop->identifier,
+ pout ? "(int *)&" : "(int)");
+ data_str = "(&(((ParameterDynAlloc *)_data)->array))";
+ }
+ else {
+ data_str = "_data";
+ }
+ fprintf(f, "\t%s = ", dparm->prop->identifier);
+
+ if (!pout)
+ fprintf(f, "%s", valstr);
+
+ fprintf(f,
+ "((%s%s %s)%s);\n",
+ rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop),
+ ptrstr,
+ data_str);
+ }
+
+ if (dparm->next)
+ fprintf(f, "\t_data += %d;\n", rna_parameter_size(dparm->prop));
+ }
+
+ if (dfunc->call) {
+ fprintf(f, "\t\n");
+ fprintf(f, "\t");
+ if (func->c_ret)
+ fprintf(f, "%s = ", func->c_ret->identifier);
+ fprintf(f, "%s(", dfunc->call);
+
+ first = 1;
+
+ if (func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "_selfid");
+ first = 0;
+ }
+
+ if ((func->flag & FUNC_NO_SELF) == 0) {
+ if (!first)
+ fprintf(f, ", ");
+ fprintf(f, "_self");
+ first = 0;
+ }
+ else if (func->flag & FUNC_USE_SELF_TYPE) {
+ if (!first)
+ fprintf(f, ", ");
+ fprintf(f, "_type");
+ first = 0;
+ }
+
+ if (func->flag & FUNC_USE_MAIN) {
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+ fprintf(f, "CTX_data_main(C)"); /* may have direct access later */
+ }
+
+ if (func->flag & FUNC_USE_CONTEXT) {
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+ fprintf(f, "C");
+ }
+
+ if (func->flag & FUNC_USE_REPORTS) {
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+ fprintf(f, "reports");
+ }
+
+ dparm = dfunc->cont.properties.first;
+ for (; dparm; dparm = dparm->next) {
+ if (dparm->prop == func->c_ret)
+ continue;
+
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+
+ if (dparm->prop->flag & PROP_DYNAMIC)
+ fprintf(f, "%s_len, %s", dparm->prop->identifier, dparm->prop->identifier);
+ else
+ fprintf(f, "%s", dparm->prop->identifier);
+ }
+
+ fprintf(f, ");\n");
+
+ if (func->c_ret) {
+ dparm = rna_find_parameter_def(func->c_ret);
+ ptrstr = (((dparm->prop->type == PROP_POINTER) &&
+ !(dparm->prop->flag_parameter & PARM_RNAPTR)) ||
+ (dparm->prop->arraydimension)) ?
+ "*" :
+ "";
+ fprintf(f,
+ "\t*((%s%s %s*)_retdata) = %s;\n",
+ rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop),
+ ptrstr,
+ func->c_ret->identifier);
+ }
+ }
+
+ fprintf(f, "}\n\n");
+
+ dfunc->gencall = funcname;
}
static void rna_auto_types(void)
{
- StructDefRNA *ds;
- PropertyDefRNA *dp;
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- /* DNA name for Screen is patched in 2.5, we do the reverse here .. */
- if (ds->dnaname) {
- if (STREQ(ds->dnaname, "Screen"))
- ds->dnaname = "bScreen";
- if (STREQ(ds->dnaname, "Group"))
- ds->dnaname = "Collection";
- if (STREQ(ds->dnaname, "GroupObject"))
- ds->dnaname = "CollectionObject";
- }
-
- for (dp = ds->cont.properties.first; dp; dp = dp->next) {
- if (dp->dnastructname) {
- if (STREQ(dp->dnastructname, "Screen"))
- dp->dnastructname = "bScreen";
- if (STREQ(dp->dnastructname, "Group"))
- dp->dnastructname = "Collection";
- if (STREQ(dp->dnastructname, "GroupObject"))
- dp->dnastructname = "CollectionObject";
- }
-
- if (dp->dnatype) {
- if (dp->prop->type == PROP_POINTER) {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
- StructRNA *type;
-
- if (!pprop->type && !pprop->get)
- pprop->type = (StructRNA *)rna_find_type(dp->dnatype);
-
- if (pprop->type) {
- type = rna_find_struct((const char *)pprop->type);
- if (type && (type->flag & STRUCT_ID_REFCOUNT))
- pprop->property.flag |= PROP_ID_REFCOUNT;
- }
- }
- else if (dp->prop->type == PROP_COLLECTION) {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
-
- if (!cprop->item_type && !cprop->get && STREQ(dp->dnatype, "ListBase"))
- cprop->item_type = (StructRNA *)rna_find_type(dp->dnatype);
- }
- }
- }
- }
+ StructDefRNA *ds;
+ PropertyDefRNA *dp;
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ /* DNA name for Screen is patched in 2.5, we do the reverse here .. */
+ if (ds->dnaname) {
+ if (STREQ(ds->dnaname, "Screen"))
+ ds->dnaname = "bScreen";
+ if (STREQ(ds->dnaname, "Group"))
+ ds->dnaname = "Collection";
+ if (STREQ(ds->dnaname, "GroupObject"))
+ ds->dnaname = "CollectionObject";
+ }
+
+ for (dp = ds->cont.properties.first; dp; dp = dp->next) {
+ if (dp->dnastructname) {
+ if (STREQ(dp->dnastructname, "Screen"))
+ dp->dnastructname = "bScreen";
+ if (STREQ(dp->dnastructname, "Group"))
+ dp->dnastructname = "Collection";
+ if (STREQ(dp->dnastructname, "GroupObject"))
+ dp->dnastructname = "CollectionObject";
+ }
+
+ if (dp->dnatype) {
+ if (dp->prop->type == PROP_POINTER) {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
+ StructRNA *type;
+
+ if (!pprop->type && !pprop->get)
+ pprop->type = (StructRNA *)rna_find_type(dp->dnatype);
+
+ if (pprop->type) {
+ type = rna_find_struct((const char *)pprop->type);
+ if (type && (type->flag & STRUCT_ID_REFCOUNT))
+ pprop->property.flag |= PROP_ID_REFCOUNT;
+ }
+ }
+ else if (dp->prop->type == PROP_COLLECTION) {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)dp->prop;
+
+ if (!cprop->item_type && !cprop->get && STREQ(dp->dnatype, "ListBase"))
+ cprop->item_type = (StructRNA *)rna_find_type(dp->dnatype);
+ }
+ }
+ }
+ }
}
static void rna_sort(BlenderRNA *brna)
{
- StructDefRNA *ds;
- StructRNA *srna;
+ StructDefRNA *ds;
+ StructRNA *srna;
- rna_sortlist(&brna->structs, cmp_struct);
- rna_sortlist(&DefRNA.structs, cmp_def_struct);
+ rna_sortlist(&brna->structs, cmp_struct);
+ rna_sortlist(&DefRNA.structs, cmp_def_struct);
- for (srna = brna->structs.first; srna; srna = srna->cont.next)
- rna_sortlist(&srna->cont.properties, cmp_property);
+ for (srna = brna->structs.first; srna; srna = srna->cont.next)
+ rna_sortlist(&srna->cont.properties, cmp_property);
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- rna_sortlist(&ds->cont.properties, cmp_def_property);
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ rna_sortlist(&ds->cont.properties, cmp_def_property);
}
static const char *rna_property_structname(PropertyType type)
{
- switch (type) {
- case PROP_BOOLEAN: return "BoolPropertyRNA";
- case PROP_INT: return "IntPropertyRNA";
- case PROP_FLOAT: return "FloatPropertyRNA";
- case PROP_STRING: return "StringPropertyRNA";
- case PROP_ENUM: return "EnumPropertyRNA";
- case PROP_POINTER: return "PointerPropertyRNA";
- case PROP_COLLECTION: return "CollectionPropertyRNA";
- default: return "UnknownPropertyRNA";
- }
+ switch (type) {
+ case PROP_BOOLEAN:
+ return "BoolPropertyRNA";
+ case PROP_INT:
+ return "IntPropertyRNA";
+ case PROP_FLOAT:
+ return "FloatPropertyRNA";
+ case PROP_STRING:
+ return "StringPropertyRNA";
+ case PROP_ENUM:
+ return "EnumPropertyRNA";
+ case PROP_POINTER:
+ return "PointerPropertyRNA";
+ case PROP_COLLECTION:
+ return "CollectionPropertyRNA";
+ default:
+ return "UnknownPropertyRNA";
+ }
}
static const char *rna_property_subtypename(PropertySubType type)
{
- switch (type) {
- case PROP_NONE: return "PROP_NONE";
- case PROP_FILEPATH: return "PROP_FILEPATH";
- case PROP_FILENAME: return "PROP_FILENAME";
- case PROP_DIRPATH: return "PROP_DIRPATH";
- case PROP_PIXEL: return "PROP_PIXEL";
- case PROP_BYTESTRING: return "PROP_BYTESTRING";
- case PROP_UNSIGNED: return "PROP_UNSIGNED";
- case PROP_PERCENTAGE: return "PROP_PERCENTAGE";
- case PROP_FACTOR: return "PROP_FACTOR";
- case PROP_ANGLE: return "PROP_ANGLE";
- case PROP_TIME: return "PROP_TIME";
- case PROP_DISTANCE: return "PROP_DISTANCE";
- case PROP_DISTANCE_CAMERA: return "PROP_DISTANCE_CAMERA";
- case PROP_COLOR: return "PROP_COLOR";
- case PROP_TRANSLATION: return "PROP_TRANSLATION";
- case PROP_DIRECTION: return "PROP_DIRECTION";
- case PROP_MATRIX: return "PROP_MATRIX";
- case PROP_EULER: return "PROP_EULER";
- case PROP_QUATERNION: return "PROP_QUATERNION";
- case PROP_AXISANGLE: return "PROP_AXISANGLE";
- case PROP_VELOCITY: return "PROP_VELOCITY";
- case PROP_ACCELERATION: return "PROP_ACCELERATION";
- case PROP_XYZ: return "PROP_XYZ";
- case PROP_COLOR_GAMMA: return "PROP_COLOR_GAMMA";
- case PROP_COORDS: return "PROP_COORDS";
- case PROP_LAYER: return "PROP_LAYER";
- case PROP_LAYER_MEMBER: return "PROP_LAYER_MEMBER";
- case PROP_PASSWORD: return "PROP_PASSWORD";
- case PROP_POWER: return "PROP_POWER";
- default:
- {
- /* in case we don't have a type preset that includes the subtype */
- if (RNA_SUBTYPE_UNIT(type)) {
- return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
- }
- else {
- return "PROP_SUBTYPE_UNKNOWN";
- }
- }
- }
+ switch (type) {
+ case PROP_NONE:
+ return "PROP_NONE";
+ case PROP_FILEPATH:
+ return "PROP_FILEPATH";
+ case PROP_FILENAME:
+ return "PROP_FILENAME";
+ case PROP_DIRPATH:
+ return "PROP_DIRPATH";
+ case PROP_PIXEL:
+ return "PROP_PIXEL";
+ case PROP_BYTESTRING:
+ return "PROP_BYTESTRING";
+ case PROP_UNSIGNED:
+ return "PROP_UNSIGNED";
+ case PROP_PERCENTAGE:
+ return "PROP_PERCENTAGE";
+ case PROP_FACTOR:
+ return "PROP_FACTOR";
+ case PROP_ANGLE:
+ return "PROP_ANGLE";
+ case PROP_TIME:
+ return "PROP_TIME";
+ case PROP_DISTANCE:
+ return "PROP_DISTANCE";
+ case PROP_DISTANCE_CAMERA:
+ return "PROP_DISTANCE_CAMERA";
+ case PROP_COLOR:
+ return "PROP_COLOR";
+ case PROP_TRANSLATION:
+ return "PROP_TRANSLATION";
+ case PROP_DIRECTION:
+ return "PROP_DIRECTION";
+ case PROP_MATRIX:
+ return "PROP_MATRIX";
+ case PROP_EULER:
+ return "PROP_EULER";
+ case PROP_QUATERNION:
+ return "PROP_QUATERNION";
+ case PROP_AXISANGLE:
+ return "PROP_AXISANGLE";
+ case PROP_VELOCITY:
+ return "PROP_VELOCITY";
+ case PROP_ACCELERATION:
+ return "PROP_ACCELERATION";
+ case PROP_XYZ:
+ return "PROP_XYZ";
+ case PROP_COLOR_GAMMA:
+ return "PROP_COLOR_GAMMA";
+ case PROP_COORDS:
+ return "PROP_COORDS";
+ case PROP_LAYER:
+ return "PROP_LAYER";
+ case PROP_LAYER_MEMBER:
+ return "PROP_LAYER_MEMBER";
+ case PROP_PASSWORD:
+ return "PROP_PASSWORD";
+ case PROP_POWER:
+ return "PROP_POWER";
+ default: {
+ /* in case we don't have a type preset that includes the subtype */
+ if (RNA_SUBTYPE_UNIT(type)) {
+ return rna_property_subtypename(type & ~RNA_SUBTYPE_UNIT(type));
+ }
+ else {
+ return "PROP_SUBTYPE_UNKNOWN";
+ }
+ }
+ }
}
static const char *rna_property_subtype_unit(PropertySubType type)
{
- switch (RNA_SUBTYPE_UNIT(type)) {
- case PROP_UNIT_NONE: return "PROP_UNIT_NONE";
- case PROP_UNIT_LENGTH: return "PROP_UNIT_LENGTH";
- case PROP_UNIT_AREA: return "PROP_UNIT_AREA";
- case PROP_UNIT_VOLUME: return "PROP_UNIT_VOLUME";
- case PROP_UNIT_MASS: return "PROP_UNIT_MASS";
- case PROP_UNIT_ROTATION: return "PROP_UNIT_ROTATION";
- case PROP_UNIT_TIME: return "PROP_UNIT_TIME";
- case PROP_UNIT_VELOCITY: return "PROP_UNIT_VELOCITY";
- case PROP_UNIT_ACCELERATION: return "PROP_UNIT_ACCELERATION";
- case PROP_UNIT_CAMERA: return "PROP_UNIT_CAMERA";
- case PROP_UNIT_POWER: return "PROP_UNIT_POWER";
- default: return "PROP_UNIT_UNKNOWN";
- }
+ switch (RNA_SUBTYPE_UNIT(type)) {
+ case PROP_UNIT_NONE:
+ return "PROP_UNIT_NONE";
+ case PROP_UNIT_LENGTH:
+ return "PROP_UNIT_LENGTH";
+ case PROP_UNIT_AREA:
+ return "PROP_UNIT_AREA";
+ case PROP_UNIT_VOLUME:
+ return "PROP_UNIT_VOLUME";
+ case PROP_UNIT_MASS:
+ return "PROP_UNIT_MASS";
+ case PROP_UNIT_ROTATION:
+ return "PROP_UNIT_ROTATION";
+ case PROP_UNIT_TIME:
+ return "PROP_UNIT_TIME";
+ case PROP_UNIT_VELOCITY:
+ return "PROP_UNIT_VELOCITY";
+ case PROP_UNIT_ACCELERATION:
+ return "PROP_UNIT_ACCELERATION";
+ case PROP_UNIT_CAMERA:
+ return "PROP_UNIT_CAMERA";
+ case PROP_UNIT_POWER:
+ return "PROP_UNIT_POWER";
+ default:
+ return "PROP_UNIT_UNKNOWN";
+ }
}
static void rna_generate_prototypes(BlenderRNA *brna, FILE *f)
{
- StructRNA *srna;
+ StructRNA *srna;
- for (srna = brna->structs.first; srna; srna = srna->cont.next)
- fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
- fprintf(f, "\n");
+ for (srna = brna->structs.first; srna; srna = srna->cont.next)
+ fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
+ fprintf(f, "\n");
}
static void rna_generate_blender(BlenderRNA *brna, FILE *f)
{
- StructRNA *srna;
-
- fprintf(f,
- "BlenderRNA BLENDER_RNA = {\n"
- "\t.structs = {"
- );
- srna = brna->structs.first;
- if (srna) fprintf(f, "&RNA_%s, ", srna->identifier);
- else fprintf(f, "NULL, ");
-
- srna = brna->structs.last;
- if (srna) fprintf(f, "&RNA_%s},\n", srna->identifier);
- else fprintf(f, "NULL},\n");
-
- fprintf(f,
- "\t.structs_map = NULL,\n"
- "\t.structs_len = 0,\n"
- "};\n\n"
- );
+ StructRNA *srna;
+
+ fprintf(f,
+ "BlenderRNA BLENDER_RNA = {\n"
+ "\t.structs = {");
+ srna = brna->structs.first;
+ if (srna)
+ fprintf(f, "&RNA_%s, ", srna->identifier);
+ else
+ fprintf(f, "NULL, ");
+
+ srna = brna->structs.last;
+ if (srna)
+ fprintf(f, "&RNA_%s},\n", srna->identifier);
+ else
+ fprintf(f, "NULL},\n");
+
+ fprintf(f,
+ "\t.structs_map = NULL,\n"
+ "\t.structs_len = 0,\n"
+ "};\n\n");
}
static void rna_generate_property_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
{
- PropertyRNA *prop;
- StructRNA *base;
-
- base = srna->base;
- while (base) {
- fprintf(f, "\n");
- for (prop = base->cont.properties.first; prop; prop = prop->next)
- fprintf(f, "%s%s rna_%s_%s;\n", "extern ", rna_property_structname(prop->type),
- base->identifier, prop->identifier);
- base = base->base;
- }
-
- if (srna->cont.properties.first)
- fprintf(f, "\n");
-
- for (prop = srna->cont.properties.first; prop; prop = prop->next)
- fprintf(f, "%s rna_%s_%s;\n", rna_property_structname(prop->type),
- srna->identifier, prop->identifier);
- fprintf(f, "\n");
+ PropertyRNA *prop;
+ StructRNA *base;
+
+ base = srna->base;
+ while (base) {
+ fprintf(f, "\n");
+ for (prop = base->cont.properties.first; prop; prop = prop->next)
+ fprintf(f,
+ "%s%s rna_%s_%s;\n",
+ "extern ",
+ rna_property_structname(prop->type),
+ base->identifier,
+ prop->identifier);
+ base = base->base;
+ }
+
+ if (srna->cont.properties.first)
+ fprintf(f, "\n");
+
+ for (prop = srna->cont.properties.first; prop; prop = prop->next)
+ fprintf(f,
+ "%s rna_%s_%s;\n",
+ rna_property_structname(prop->type),
+ srna->identifier,
+ prop->identifier);
+ fprintf(f, "\n");
}
-static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FunctionRNA *func, FILE *f)
+static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna),
+ StructRNA *srna,
+ FunctionRNA *func,
+ FILE *f)
{
- PropertyRNA *parm;
-
- for (parm = func->cont.properties.first; parm; parm = parm->next)
- fprintf(f, "%s%s rna_%s_%s_%s;\n", "extern ", rna_property_structname(parm->type), srna->identifier,
- func->identifier, parm->identifier);
-
- if (func->cont.properties.first)
- fprintf(f, "\n");
+ PropertyRNA *parm;
+
+ for (parm = func->cont.properties.first; parm; parm = parm->next)
+ fprintf(f,
+ "%s%s rna_%s_%s_%s;\n",
+ "extern ",
+ rna_property_structname(parm->type),
+ srna->identifier,
+ func->identifier,
+ parm->identifier);
+
+ if (func->cont.properties.first)
+ fprintf(f, "\n");
}
static void rna_generate_function_prototypes(BlenderRNA *brna, StructRNA *srna, FILE *f)
{
- FunctionRNA *func;
- StructRNA *base;
-
- base = srna->base;
- while (base) {
- for (func = base->functions.first; func; func = func->cont.next) {
- fprintf(f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", base->identifier, func->identifier);
- rna_generate_parameter_prototypes(brna, base, func, f);
- }
-
- if (base->functions.first)
- fprintf(f, "\n");
-
- base = base->base;
- }
-
- for (func = srna->functions.first; func; func = func->cont.next) {
- fprintf(f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
- rna_generate_parameter_prototypes(brna, srna, func, f);
- }
-
- if (srna->functions.first)
- fprintf(f, "\n");
+ FunctionRNA *func;
+ StructRNA *base;
+
+ base = srna->base;
+ while (base) {
+ for (func = base->functions.first; func; func = func->cont.next) {
+ fprintf(f,
+ "%s%s rna_%s_%s_func;\n",
+ "extern ",
+ "FunctionRNA",
+ base->identifier,
+ func->identifier);
+ rna_generate_parameter_prototypes(brna, base, func, f);
+ }
+
+ if (base->functions.first)
+ fprintf(f, "\n");
+
+ base = base->base;
+ }
+
+ for (func = srna->functions.first; func; func = func->cont.next) {
+ fprintf(
+ f, "%s%s rna_%s_%s_func;\n", "extern ", "FunctionRNA", srna->identifier, func->identifier);
+ rna_generate_parameter_prototypes(brna, srna, func, f);
+ }
+
+ if (srna->functions.first)
+ fprintf(f, "\n");
}
-static void rna_generate_static_parameter_prototypes(FILE *f, StructRNA *srna, FunctionDefRNA *dfunc, const char *name_override, int close_prototype)
+static void rna_generate_static_parameter_prototypes(FILE *f,
+ StructRNA *srna,
+ FunctionDefRNA *dfunc,
+ const char *name_override,
+ int close_prototype)
{
- FunctionRNA *func;
- PropertyDefRNA *dparm;
- StructDefRNA *dsrna;
- PropertyType type;
- int flag, flag_parameter, pout, cptr, first;
- const char *ptrstr;
-
- dsrna = rna_find_struct_def(srna);
- func = dfunc->func;
-
- /* return type */
- for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
- if (dparm->prop == func->c_ret) {
- if (dparm->prop->arraydimension)
- fprintf(f, "XXX no array return types yet"); /* XXX not supported */
- else if (dparm->prop->type == PROP_POINTER && !(dparm->prop->flag_parameter & PARM_RNAPTR))
- fprintf(f, "%s%s *", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
- else
- fprintf(f, "%s%s ", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
-
- break;
- }
- }
-
- /* void if nothing to return */
- if (!dparm)
- fprintf(f, "void ");
-
- /* function name */
- if (name_override == NULL || name_override[0] == '\0')
- fprintf(f, "%s(", dfunc->call);
- else
- fprintf(f, "%s(", name_override);
-
- first = 1;
-
- /* self, context and reports parameters */
- if (func->flag & FUNC_USE_SELF_ID) {
- fprintf(f, "struct ID *_selfid");
- first = 0;
- }
-
- if ((func->flag & FUNC_NO_SELF) == 0) {
- if (!first) fprintf(f, ", ");
- if (dsrna->dnafromprop) fprintf(f, "struct %s *_self", dsrna->dnafromname);
- else if (dsrna->dnaname) fprintf(f, "struct %s *_self", dsrna->dnaname);
- else fprintf(f, "struct %s *_self", srna->identifier);
- first = 0;
- }
- else if (func->flag & FUNC_USE_SELF_TYPE) {
- if (!first) fprintf(f, ", ");
- fprintf(f, "struct StructRNA *_type");
- first = 0;
- }
-
- if (func->flag & FUNC_USE_MAIN) {
- if (!first) fprintf(f, ", ");
- first = 0;
- fprintf(f, "Main *bmain");
- }
-
- if (func->flag & FUNC_USE_CONTEXT) {
- if (!first) fprintf(f, ", ");
- first = 0;
- fprintf(f, "bContext *C");
- }
-
- if (func->flag & FUNC_USE_REPORTS) {
- if (!first) fprintf(f, ", ");
- first = 0;
- fprintf(f, "ReportList *reports");
- }
-
- /* defined parameters */
- for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
- type = dparm->prop->type;
- flag = dparm->prop->flag;
- flag_parameter = dparm->prop->flag_parameter;
- pout = (flag_parameter & PARM_OUTPUT);
- cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR));
-
- if (dparm->prop == func->c_ret)
- continue;
-
- if (cptr || (flag & PROP_DYNAMIC))
- ptrstr = pout ? "**" : "*";
- else if (type == PROP_POINTER || dparm->prop->arraydimension)
- ptrstr = "*";
- else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
- ptrstr = "";
- else
- ptrstr = pout ? "*" : "";
-
- if (!first) fprintf(f, ", ");
- first = 0;
-
- if (flag & PROP_DYNAMIC)
- fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
-
- if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
- fprintf(f, "%s%s %s[%u]", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
- rna_safe_id(dparm->prop->identifier), dparm->prop->totarraylength);
- else
- fprintf(f, "%s%s %s%s", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop),
- ptrstr, rna_safe_id(dparm->prop->identifier));
-
- }
-
- /* ensure func(void) if there are no args */
- if (first) fprintf(f, "void");
-
- fprintf(f, ")");
-
- if (close_prototype)
- fprintf(f, ";\n");
+ FunctionRNA *func;
+ PropertyDefRNA *dparm;
+ StructDefRNA *dsrna;
+ PropertyType type;
+ int flag, flag_parameter, pout, cptr, first;
+ const char *ptrstr;
+
+ dsrna = rna_find_struct_def(srna);
+ func = dfunc->func;
+
+ /* return type */
+ for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
+ if (dparm->prop == func->c_ret) {
+ if (dparm->prop->arraydimension)
+ fprintf(f, "XXX no array return types yet"); /* XXX not supported */
+ else if (dparm->prop->type == PROP_POINTER && !(dparm->prop->flag_parameter & PARM_RNAPTR))
+ fprintf(f, "%s%s *", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
+ else
+ fprintf(f, "%s%s ", rna_type_struct(dparm->prop), rna_parameter_type_name(dparm->prop));
+
+ break;
+ }
+ }
+
+ /* void if nothing to return */
+ if (!dparm)
+ fprintf(f, "void ");
+
+ /* function name */
+ if (name_override == NULL || name_override[0] == '\0')
+ fprintf(f, "%s(", dfunc->call);
+ else
+ fprintf(f, "%s(", name_override);
+
+ first = 1;
+
+ /* self, context and reports parameters */
+ if (func->flag & FUNC_USE_SELF_ID) {
+ fprintf(f, "struct ID *_selfid");
+ first = 0;
+ }
+
+ if ((func->flag & FUNC_NO_SELF) == 0) {
+ if (!first)
+ fprintf(f, ", ");
+ if (dsrna->dnafromprop)
+ fprintf(f, "struct %s *_self", dsrna->dnafromname);
+ else if (dsrna->dnaname)
+ fprintf(f, "struct %s *_self", dsrna->dnaname);
+ else
+ fprintf(f, "struct %s *_self", srna->identifier);
+ first = 0;
+ }
+ else if (func->flag & FUNC_USE_SELF_TYPE) {
+ if (!first)
+ fprintf(f, ", ");
+ fprintf(f, "struct StructRNA *_type");
+ first = 0;
+ }
+
+ if (func->flag & FUNC_USE_MAIN) {
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+ fprintf(f, "Main *bmain");
+ }
+
+ if (func->flag & FUNC_USE_CONTEXT) {
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+ fprintf(f, "bContext *C");
+ }
+
+ if (func->flag & FUNC_USE_REPORTS) {
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+ fprintf(f, "ReportList *reports");
+ }
+
+ /* defined parameters */
+ for (dparm = dfunc->cont.properties.first; dparm; dparm = dparm->next) {
+ type = dparm->prop->type;
+ flag = dparm->prop->flag;
+ flag_parameter = dparm->prop->flag_parameter;
+ pout = (flag_parameter & PARM_OUTPUT);
+ cptr = ((type == PROP_POINTER) && !(flag_parameter & PARM_RNAPTR));
+
+ if (dparm->prop == func->c_ret)
+ continue;
+
+ if (cptr || (flag & PROP_DYNAMIC))
+ ptrstr = pout ? "**" : "*";
+ else if (type == PROP_POINTER || dparm->prop->arraydimension)
+ ptrstr = "*";
+ else if (type == PROP_STRING && (flag & PROP_THICK_WRAP))
+ ptrstr = "";
+ else
+ ptrstr = pout ? "*" : "";
+
+ if (!first)
+ fprintf(f, ", ");
+ first = 0;
+
+ if (flag & PROP_DYNAMIC)
+ fprintf(f, "int %s%s_len, ", pout ? "*" : "", dparm->prop->identifier);
+
+ if (!(flag & PROP_DYNAMIC) && dparm->prop->arraydimension)
+ fprintf(f,
+ "%s%s %s[%u]",
+ rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop),
+ rna_safe_id(dparm->prop->identifier),
+ dparm->prop->totarraylength);
+ else
+ fprintf(f,
+ "%s%s %s%s",
+ rna_type_struct(dparm->prop),
+ rna_parameter_type_name(dparm->prop),
+ ptrstr,
+ rna_safe_id(dparm->prop->identifier));
+ }
+
+ /* ensure func(void) if there are no args */
+ if (first)
+ fprintf(f, "void");
+
+ fprintf(f, ")");
+
+ if (close_prototype)
+ fprintf(f, ";\n");
}
-static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
+static void rna_generate_static_function_prototypes(BlenderRNA *UNUSED(brna),
+ StructRNA *srna,
+ FILE *f)
{
- FunctionRNA *func;
- FunctionDefRNA *dfunc;
- int first = 1;
+ FunctionRNA *func;
+ FunctionDefRNA *dfunc;
+ int first = 1;
- for (func = srna->functions.first; func; func = func->cont.next) {
- dfunc = rna_find_function_def(func);
+ for (func = srna->functions.first; func; func = func->cont.next) {
+ dfunc = rna_find_function_def(func);
- if (dfunc->call) {
- if (first) {
- fprintf(f, "/* Repeated prototypes to detect errors */\n\n");
- first = 0;
- }
+ if (dfunc->call) {
+ if (first) {
+ fprintf(f, "/* Repeated prototypes to detect errors */\n\n");
+ first = 0;
+ }
- rna_generate_static_parameter_prototypes(f, srna, dfunc, NULL, 1);
- }
- }
+ rna_generate_static_parameter_prototypes(f, srna, dfunc, NULL, 1);
+ }
+ }
- fprintf(f, "\n");
+ fprintf(f, "\n");
}
static void rna_generate_struct_prototypes(FILE *f)
{
- StructDefRNA *ds;
- PropertyDefRNA *dp;
- FunctionDefRNA *dfunc;
- const char *structures[2048];
- int all_structures = 0;
-
- /* structures definitions */
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
- if (dfunc->call) {
- for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
- if (dp->prop->type == PROP_POINTER) {
- int a, found = 0;
- const char *struct_name = rna_parameter_type_name(dp->prop);
- if (struct_name == NULL) {
- printf("No struct found for property '%s'\n", dp->prop->identifier);
- exit(1);
- }
-
- for (a = 0; a < all_structures; a++) {
- if (STREQ(struct_name, structures[a])) {
- found = 1;
- break;
- }
- }
-
- if (found == 0) {
- fprintf(f, "struct %s;\n", struct_name);
-
- if (all_structures >= sizeof(structures) / sizeof(structures[0])) {
- printf("Array size to store all structures names is too small\n");
- exit(1);
- }
-
- structures[all_structures++] = struct_name;
- }
- }
- }
- }
- }
- }
-
- fprintf(f, "\n");
+ StructDefRNA *ds;
+ PropertyDefRNA *dp;
+ FunctionDefRNA *dfunc;
+ const char *structures[2048];
+ int all_structures = 0;
+
+ /* structures definitions */
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
+ if (dfunc->call) {
+ for (dp = dfunc->cont.properties.first; dp; dp = dp->next) {
+ if (dp->prop->type == PROP_POINTER) {
+ int a, found = 0;
+ const char *struct_name = rna_parameter_type_name(dp->prop);
+ if (struct_name == NULL) {
+ printf("No struct found for property '%s'\n", dp->prop->identifier);
+ exit(1);
+ }
+
+ for (a = 0; a < all_structures; a++) {
+ if (STREQ(struct_name, structures[a])) {
+ found = 1;
+ break;
+ }
+ }
+
+ if (found == 0) {
+ fprintf(f, "struct %s;\n", struct_name);
+
+ if (all_structures >= sizeof(structures) / sizeof(structures[0])) {
+ printf("Array size to store all structures names is too small\n");
+ exit(1);
+ }
+
+ structures[all_structures++] = struct_name;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ fprintf(f, "\n");
}
static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, PropertyRNA *prop)
{
- char *strnest = (char *)"", *errnest = (char *)"";
- int len, freenest = 0;
-
- if (nest != NULL) {
- len = strlen(nest);
-
- strnest = MEM_mallocN(sizeof(char) * (len + 2), "rna_generate_property -> strnest");
- errnest = MEM_mallocN(sizeof(char) * (len + 2), "rna_generate_property -> errnest");
-
- strcpy(strnest, "_"); strcat(strnest, nest);
- strcpy(errnest, "."); strcat(errnest, nest);
-
- freenest = 1;
- }
-
- switch (prop->type) {
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- int i, defaultfound = 0, totflag = 0;
-
- if (eprop->item) {
- fprintf(f, "static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t", srna->identifier,
- strnest, prop->identifier, eprop->totitem + 1);
-
- for (i = 0; i < eprop->totitem; i++) {
- fprintf(f, "{%d, ", eprop->item[i].value);
- rna_print_c_string(f, eprop->item[i].identifier); fprintf(f, ", ");
- fprintf(f, "%d, ", eprop->item[i].icon);
- rna_print_c_string(f, eprop->item[i].name); fprintf(f, ", ");
- rna_print_c_string(f, eprop->item[i].description); fprintf(f, "},\n\t");
-
- if (eprop->item[i].identifier[0]) {
- if (prop->flag & PROP_ENUM_FLAG) {
- totflag |= eprop->item[i].value;
- }
- else {
- if (eprop->defaultvalue == eprop->item[i].value) {
- defaultfound = 1;
- }
- }
- }
- }
-
- fprintf(f, "{0, NULL, 0, NULL, NULL}\n};\n\n");
-
- if (prop->flag & PROP_ENUM_FLAG) {
- if (eprop->defaultvalue & ~totflag) {
- CLOG_ERROR(&LOG, "%s%s.%s, enum default includes unused bits (%d).",
- srna->identifier, errnest, prop->identifier,
- eprop->defaultvalue & ~totflag);
- DefRNA.error = 1;
- }
- }
- else {
- if (!defaultfound &&
- !(eprop->itemf && eprop->item == DummyRNA_NULL_items))
- {
- CLOG_ERROR(&LOG, "%s%s.%s, enum default is not in items.",
- srna->identifier, errnest, prop->identifier);
- DefRNA.error = 1;
- }
- }
- }
- else {
- CLOG_ERROR(&LOG, "%s%s.%s, enum must have items defined.",
- srna->identifier, errnest, prop->identifier);
- DefRNA.error = 1;
- }
- break;
- }
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- unsigned int i;
-
- if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static bool rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
- prop->identifier, prop->totarraylength);
-
- for (i = 0; i < prop->totarraylength; i++) {
- if (bprop->defaultarray)
- fprintf(f, "%d", bprop->defaultarray[i]);
- else
- fprintf(f, "%d", bprop->defaultvalue);
- if (i != prop->totarraylength - 1)
- fprintf(f, ",\n\t");
- }
-
- fprintf(f, "\n};\n\n");
- }
- break;
- }
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- unsigned int i;
-
- if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static int rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
- prop->identifier, prop->totarraylength);
-
- for (i = 0; i < prop->totarraylength; i++) {
- if (iprop->defaultarray)
- fprintf(f, "%d", iprop->defaultarray[i]);
- else
- fprintf(f, "%d", iprop->defaultvalue);
- if (i != prop->totarraylength - 1)
- fprintf(f, ",\n\t");
- }
-
- fprintf(f, "\n};\n\n");
- }
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- unsigned int i;
-
- if (prop->arraydimension && prop->totarraylength) {
- fprintf(f, "static float rna_%s%s_%s_default[%u] = {\n\t", srna->identifier, strnest,
- prop->identifier, prop->totarraylength);
-
- for (i = 0; i < prop->totarraylength; i++) {
- if (fprop->defaultarray)
- rna_float_print(f, fprop->defaultarray[i]);
- else
- rna_float_print(f, fprop->defaultvalue);
- if (i != prop->totarraylength - 1)
- fprintf(f, ",\n\t");
- }
-
- fprintf(f, "\n};\n\n");
- }
- break;
- }
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
-
- /* XXX This systematically enforces that flag on ID pointers... we'll probably have to revisit. :/ */
- StructRNA *type = rna_find_struct((const char *)pprop->type);
- if (type && (type->flag & STRUCT_ID)) {
- prop->flag |= PROP_PTR_NO_OWNERSHIP;
- }
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
-
- /* XXX This systematically enforces that flag on ID pointers... we'll probably have to revisit. :/ */
- StructRNA *type = rna_find_struct((const char *)cprop->item_type);
- if (type && (type->flag & STRUCT_ID)) {
- prop->flag |= PROP_PTR_NO_OWNERSHIP;
- }
- break;
- }
- default:
- break;
- }
-
- fprintf(f, "%s rna_%s%s_%s = {\n",
- rna_property_structname(prop->type),
- srna->identifier, strnest, prop->identifier);
-
- if (prop->next) fprintf(f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
- else fprintf(f, "\t{NULL, ");
- if (prop->prev) fprintf(f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier);
- else fprintf(f, "NULL,\n");
- fprintf(f, "\t%d, ", prop->magic);
- rna_print_c_string(f, prop->identifier);
- fprintf(f, ", %d, %d, %d, %d, %d, ", prop->flag, prop->flag_override, prop->flag_parameter, prop->flag_internal, prop->tags);
- rna_print_c_string(f, prop->name); fprintf(f, ",\n\t");
- rna_print_c_string(f, prop->description); fprintf(f, ",\n\t");
- fprintf(f, "%d, ", prop->icon);
- rna_print_c_string(f, prop->translation_context); fprintf(f, ",\n");
- fprintf(f, "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n",
- RNA_property_typename(prop->type),
- rna_property_subtypename(prop->subtype),
- rna_property_subtype_unit(prop->subtype),
- rna_function_string(prop->getlength),
- prop->arraydimension,
- prop->arraylength[0],
- prop->arraylength[1],
- prop->arraylength[2],
- prop->totarraylength);
- fprintf(f, "\t%s%s, %d, %s, %s, %s, %s, %s,\n",
- (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "",
- rna_function_string(prop->update),
- prop->noteflag,
- rna_function_string(prop->editable),
- rna_function_string(prop->itemeditable),
- rna_function_string(prop->override_diff),
- rna_function_string(prop->override_store),
- rna_function_string(prop->override_apply));
-
- if (prop->flag_internal & PROP_INTERN_RAW_ACCESS) rna_set_raw_offset(f, srna, prop);
- else fprintf(f, "\t0, -1");
-
- /* our own type - collections/arrays only */
- if (prop->srna) fprintf(f, ", &RNA_%s", (const char *)prop->srna);
- else fprintf(f, ", NULL");
-
- fprintf(f, "},\n");
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, %d, ",
- rna_function_string(bprop->get),
- rna_function_string(bprop->set),
- rna_function_string(bprop->getarray),
- rna_function_string(bprop->setarray),
- rna_function_string(bprop->get_ex),
- rna_function_string(bprop->set_ex),
- rna_function_string(bprop->getarray_ex),
- rna_function_string(bprop->setarray_ex),
- bprop->defaultvalue);
- if (prop->arraydimension && prop->totarraylength)
- fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
- else fprintf(f, "NULL\n");
- break;
- }
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,\n\t",
- rna_function_string(iprop->get),
- rna_function_string(iprop->set),
- rna_function_string(iprop->getarray),
- rna_function_string(iprop->setarray),
- rna_function_string(iprop->range),
- rna_function_string(iprop->get_ex),
- rna_function_string(iprop->set_ex),
- rna_function_string(iprop->getarray_ex),
- rna_function_string(iprop->setarray_ex),
- rna_function_string(iprop->range_ex));
- rna_int_print(f, iprop->softmin); fprintf(f, ", ");
- rna_int_print(f, iprop->softmax); fprintf(f, ", ");
- rna_int_print(f, iprop->hardmin); fprintf(f, ", ");
- rna_int_print(f, iprop->hardmax); fprintf(f, ", ");
- rna_int_print(f, iprop->step); fprintf(f, ", ");
- rna_int_print(f, iprop->defaultvalue); fprintf(f, ", ");
- if (prop->arraydimension && prop->totarraylength)
- fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
- else fprintf(f, "NULL\n");
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, ",
- rna_function_string(fprop->get),
- rna_function_string(fprop->set),
- rna_function_string(fprop->getarray),
- rna_function_string(fprop->setarray),
- rna_function_string(fprop->range),
- rna_function_string(fprop->get_ex),
- rna_function_string(fprop->set_ex),
- rna_function_string(fprop->getarray_ex),
- rna_function_string(fprop->setarray_ex),
- rna_function_string(fprop->range_ex));
- rna_float_print(f, fprop->softmin); fprintf(f, ", ");
- rna_float_print(f, fprop->softmax); fprintf(f, ", ");
- rna_float_print(f, fprop->hardmin); fprintf(f, ", ");
- rna_float_print(f, fprop->hardmax); fprintf(f, ", ");
- rna_float_print(f, fprop->step); fprintf(f, ", ");
- rna_int_print(f, (int)fprop->precision); fprintf(f, ", ");
- rna_float_print(f, fprop->defaultvalue); fprintf(f, ", ");
- if (prop->arraydimension && prop->totarraylength)
- fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
- else fprintf(f, "NULL\n");
- break;
- }
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, %s, %d, ",
- rna_function_string(sprop->get),
- rna_function_string(sprop->length),
- rna_function_string(sprop->set),
- rna_function_string(sprop->get_ex),
- rna_function_string(sprop->length_ex),
- rna_function_string(sprop->set_ex),
- sprop->maxlength);
- rna_print_c_string(f, sprop->defaultvalue); fprintf(f, "\n");
- break;
- }
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, NULL, ",
- rna_function_string(eprop->get),
- rna_function_string(eprop->set),
- rna_function_string(eprop->itemf),
- rna_function_string(eprop->get_ex),
- rna_function_string(eprop->set_ex));
- if (eprop->item)
- fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
- else
- fprintf(f, "NULL, ");
- fprintf(f, "%d, %d\n", eprop->totitem, eprop->defaultvalue);
- break;
- }
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s,", rna_function_string(pprop->get),
- rna_function_string(pprop->set),
- rna_function_string(pprop->typef),
- rna_function_string(pprop->poll));
- if (pprop->type) fprintf(f, "&RNA_%s\n", (const char *)pprop->type);
- else fprintf(f, "NULL\n");
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- fprintf(f, "\t%s, %s, %s, %s, %s, %s, %s, %s, ",
- rna_function_string(cprop->begin),
- rna_function_string(cprop->next),
- rna_function_string(cprop->end),
- rna_function_string(cprop->get),
- rna_function_string(cprop->length),
- rna_function_string(cprop->lookupint),
- rna_function_string(cprop->lookupstring),
- rna_function_string(cprop->assignint));
- if (cprop->item_type) fprintf(f, "&RNA_%s\n", (const char *)cprop->item_type);
- else fprintf(f, "NULL\n");
- break;
- }
- }
-
- fprintf(f, "};\n\n");
-
- if (freenest) {
- MEM_freeN(strnest);
- MEM_freeN(errnest);
- }
+ char *strnest = (char *)"", *errnest = (char *)"";
+ int len, freenest = 0;
+
+ if (nest != NULL) {
+ len = strlen(nest);
+
+ strnest = MEM_mallocN(sizeof(char) * (len + 2), "rna_generate_property -> strnest");
+ errnest = MEM_mallocN(sizeof(char) * (len + 2), "rna_generate_property -> errnest");
+
+ strcpy(strnest, "_");
+ strcat(strnest, nest);
+ strcpy(errnest, ".");
+ strcat(errnest, nest);
+
+ freenest = 1;
+ }
+
+ switch (prop->type) {
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ int i, defaultfound = 0, totflag = 0;
+
+ if (eprop->item) {
+ fprintf(f,
+ "static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t",
+ srna->identifier,
+ strnest,
+ prop->identifier,
+ eprop->totitem + 1);
+
+ for (i = 0; i < eprop->totitem; i++) {
+ fprintf(f, "{%d, ", eprop->item[i].value);
+ rna_print_c_string(f, eprop->item[i].identifier);
+ fprintf(f, ", ");
+ fprintf(f, "%d, ", eprop->item[i].icon);
+ rna_print_c_string(f, eprop->item[i].name);
+ fprintf(f, ", ");
+ rna_print_c_string(f, eprop->item[i].description);
+ fprintf(f, "},\n\t");
+
+ if (eprop->item[i].identifier[0]) {
+ if (prop->flag & PROP_ENUM_FLAG) {
+ totflag |= eprop->item[i].value;
+ }
+ else {
+ if (eprop->defaultvalue == eprop->item[i].value) {
+ defaultfound = 1;
+ }
+ }
+ }
+ }
+
+ fprintf(f, "{0, NULL, 0, NULL, NULL}\n};\n\n");
+
+ if (prop->flag & PROP_ENUM_FLAG) {
+ if (eprop->defaultvalue & ~totflag) {
+ CLOG_ERROR(&LOG,
+ "%s%s.%s, enum default includes unused bits (%d).",
+ srna->identifier,
+ errnest,
+ prop->identifier,
+ eprop->defaultvalue & ~totflag);
+ DefRNA.error = 1;
+ }
+ }
+ else {
+ if (!defaultfound && !(eprop->itemf && eprop->item == DummyRNA_NULL_items)) {
+ CLOG_ERROR(&LOG,
+ "%s%s.%s, enum default is not in items.",
+ srna->identifier,
+ errnest,
+ prop->identifier);
+ DefRNA.error = 1;
+ }
+ }
+ }
+ else {
+ CLOG_ERROR(&LOG,
+ "%s%s.%s, enum must have items defined.",
+ srna->identifier,
+ errnest,
+ prop->identifier);
+ DefRNA.error = 1;
+ }
+ break;
+ }
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ unsigned int i;
+
+ if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f,
+ "static bool rna_%s%s_%s_default[%u] = {\n\t",
+ srna->identifier,
+ strnest,
+ prop->identifier,
+ prop->totarraylength);
+
+ for (i = 0; i < prop->totarraylength; i++) {
+ if (bprop->defaultarray)
+ fprintf(f, "%d", bprop->defaultarray[i]);
+ else
+ fprintf(f, "%d", bprop->defaultvalue);
+ if (i != prop->totarraylength - 1)
+ fprintf(f, ",\n\t");
+ }
+
+ fprintf(f, "\n};\n\n");
+ }
+ break;
+ }
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ unsigned int i;
+
+ if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f,
+ "static int rna_%s%s_%s_default[%u] = {\n\t",
+ srna->identifier,
+ strnest,
+ prop->identifier,
+ prop->totarraylength);
+
+ for (i = 0; i < prop->totarraylength; i++) {
+ if (iprop->defaultarray)
+ fprintf(f, "%d", iprop->defaultarray[i]);
+ else
+ fprintf(f, "%d", iprop->defaultvalue);
+ if (i != prop->totarraylength - 1)
+ fprintf(f, ",\n\t");
+ }
+
+ fprintf(f, "\n};\n\n");
+ }
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ unsigned int i;
+
+ if (prop->arraydimension && prop->totarraylength) {
+ fprintf(f,
+ "static float rna_%s%s_%s_default[%u] = {\n\t",
+ srna->identifier,
+ strnest,
+ prop->identifier,
+ prop->totarraylength);
+
+ for (i = 0; i < prop->totarraylength; i++) {
+ if (fprop->defaultarray)
+ rna_float_print(f, fprop->defaultarray[i]);
+ else
+ rna_float_print(f, fprop->defaultvalue);
+ if (i != prop->totarraylength - 1)
+ fprintf(f, ",\n\t");
+ }
+
+ fprintf(f, "\n};\n\n");
+ }
+ break;
+ }
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+
+ /* XXX This systematically enforces that flag on ID pointers... we'll probably have to revisit. :/ */
+ StructRNA *type = rna_find_struct((const char *)pprop->type);
+ if (type && (type->flag & STRUCT_ID)) {
+ prop->flag |= PROP_PTR_NO_OWNERSHIP;
+ }
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+
+ /* XXX This systematically enforces that flag on ID pointers... we'll probably have to revisit. :/ */
+ StructRNA *type = rna_find_struct((const char *)cprop->item_type);
+ if (type && (type->flag & STRUCT_ID)) {
+ prop->flag |= PROP_PTR_NO_OWNERSHIP;
+ }
+ break;
+ }
+ default:
+ break;
+ }
+
+ fprintf(f,
+ "%s rna_%s%s_%s = {\n",
+ rna_property_structname(prop->type),
+ srna->identifier,
+ strnest,
+ prop->identifier);
+
+ if (prop->next)
+ fprintf(
+ f, "\t{(PropertyRNA *)&rna_%s%s_%s, ", srna->identifier, strnest, prop->next->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+ if (prop->prev)
+ fprintf(
+ f, "(PropertyRNA *)&rna_%s%s_%s,\n", srna->identifier, strnest, prop->prev->identifier);
+ else
+ fprintf(f, "NULL,\n");
+ fprintf(f, "\t%d, ", prop->magic);
+ rna_print_c_string(f, prop->identifier);
+ fprintf(f,
+ ", %d, %d, %d, %d, %d, ",
+ prop->flag,
+ prop->flag_override,
+ prop->flag_parameter,
+ prop->flag_internal,
+ prop->tags);
+ rna_print_c_string(f, prop->name);
+ fprintf(f, ",\n\t");
+ rna_print_c_string(f, prop->description);
+ fprintf(f, ",\n\t");
+ fprintf(f, "%d, ", prop->icon);
+ rna_print_c_string(f, prop->translation_context);
+ fprintf(f, ",\n");
+ fprintf(f,
+ "\t%s, %s | %s, %s, %u, {%u, %u, %u}, %u,\n",
+ RNA_property_typename(prop->type),
+ rna_property_subtypename(prop->subtype),
+ rna_property_subtype_unit(prop->subtype),
+ rna_function_string(prop->getlength),
+ prop->arraydimension,
+ prop->arraylength[0],
+ prop->arraylength[1],
+ prop->arraylength[2],
+ prop->totarraylength);
+ fprintf(f,
+ "\t%s%s, %d, %s, %s, %s, %s, %s,\n",
+ (prop->flag & PROP_CONTEXT_UPDATE) ? "(UpdateFunc)" : "",
+ rna_function_string(prop->update),
+ prop->noteflag,
+ rna_function_string(prop->editable),
+ rna_function_string(prop->itemeditable),
+ rna_function_string(prop->override_diff),
+ rna_function_string(prop->override_store),
+ rna_function_string(prop->override_apply));
+
+ if (prop->flag_internal & PROP_INTERN_RAW_ACCESS)
+ rna_set_raw_offset(f, srna, prop);
+ else
+ fprintf(f, "\t0, -1");
+
+ /* our own type - collections/arrays only */
+ if (prop->srna)
+ fprintf(f, ", &RNA_%s", (const char *)prop->srna);
+ else
+ fprintf(f, ", NULL");
+
+ fprintf(f, "},\n");
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s, %s, %s, %s, %s, %d, ",
+ rna_function_string(bprop->get),
+ rna_function_string(bprop->set),
+ rna_function_string(bprop->getarray),
+ rna_function_string(bprop->setarray),
+ rna_function_string(bprop->get_ex),
+ rna_function_string(bprop->set_ex),
+ rna_function_string(bprop->getarray_ex),
+ rna_function_string(bprop->setarray_ex),
+ bprop->defaultvalue);
+ if (prop->arraydimension && prop->totarraylength)
+ fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+ else
+ fprintf(f, "NULL\n");
+ break;
+ }
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s,\n\t",
+ rna_function_string(iprop->get),
+ rna_function_string(iprop->set),
+ rna_function_string(iprop->getarray),
+ rna_function_string(iprop->setarray),
+ rna_function_string(iprop->range),
+ rna_function_string(iprop->get_ex),
+ rna_function_string(iprop->set_ex),
+ rna_function_string(iprop->getarray_ex),
+ rna_function_string(iprop->setarray_ex),
+ rna_function_string(iprop->range_ex));
+ rna_int_print(f, iprop->softmin);
+ fprintf(f, ", ");
+ rna_int_print(f, iprop->softmax);
+ fprintf(f, ", ");
+ rna_int_print(f, iprop->hardmin);
+ fprintf(f, ", ");
+ rna_int_print(f, iprop->hardmax);
+ fprintf(f, ", ");
+ rna_int_print(f, iprop->step);
+ fprintf(f, ", ");
+ rna_int_print(f, iprop->defaultvalue);
+ fprintf(f, ", ");
+ if (prop->arraydimension && prop->totarraylength)
+ fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+ else
+ fprintf(f, "NULL\n");
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, ",
+ rna_function_string(fprop->get),
+ rna_function_string(fprop->set),
+ rna_function_string(fprop->getarray),
+ rna_function_string(fprop->setarray),
+ rna_function_string(fprop->range),
+ rna_function_string(fprop->get_ex),
+ rna_function_string(fprop->set_ex),
+ rna_function_string(fprop->getarray_ex),
+ rna_function_string(fprop->setarray_ex),
+ rna_function_string(fprop->range_ex));
+ rna_float_print(f, fprop->softmin);
+ fprintf(f, ", ");
+ rna_float_print(f, fprop->softmax);
+ fprintf(f, ", ");
+ rna_float_print(f, fprop->hardmin);
+ fprintf(f, ", ");
+ rna_float_print(f, fprop->hardmax);
+ fprintf(f, ", ");
+ rna_float_print(f, fprop->step);
+ fprintf(f, ", ");
+ rna_int_print(f, (int)fprop->precision);
+ fprintf(f, ", ");
+ rna_float_print(f, fprop->defaultvalue);
+ fprintf(f, ", ");
+ if (prop->arraydimension && prop->totarraylength)
+ fprintf(f, "rna_%s%s_%s_default\n", srna->identifier, strnest, prop->identifier);
+ else
+ fprintf(f, "NULL\n");
+ break;
+ }
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s, %s, %s, %d, ",
+ rna_function_string(sprop->get),
+ rna_function_string(sprop->length),
+ rna_function_string(sprop->set),
+ rna_function_string(sprop->get_ex),
+ rna_function_string(sprop->length_ex),
+ rna_function_string(sprop->set_ex),
+ sprop->maxlength);
+ rna_print_c_string(f, sprop->defaultvalue);
+ fprintf(f, "\n");
+ break;
+ }
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s, %s, NULL, ",
+ rna_function_string(eprop->get),
+ rna_function_string(eprop->set),
+ rna_function_string(eprop->itemf),
+ rna_function_string(eprop->get_ex),
+ rna_function_string(eprop->set_ex));
+ if (eprop->item)
+ fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
+ else
+ fprintf(f, "NULL, ");
+ fprintf(f, "%d, %d\n", eprop->totitem, eprop->defaultvalue);
+ break;
+ }
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s,",
+ rna_function_string(pprop->get),
+ rna_function_string(pprop->set),
+ rna_function_string(pprop->typef),
+ rna_function_string(pprop->poll));
+ if (pprop->type)
+ fprintf(f, "&RNA_%s\n", (const char *)pprop->type);
+ else
+ fprintf(f, "NULL\n");
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ fprintf(f,
+ "\t%s, %s, %s, %s, %s, %s, %s, %s, ",
+ rna_function_string(cprop->begin),
+ rna_function_string(cprop->next),
+ rna_function_string(cprop->end),
+ rna_function_string(cprop->get),
+ rna_function_string(cprop->length),
+ rna_function_string(cprop->lookupint),
+ rna_function_string(cprop->lookupstring),
+ rna_function_string(cprop->assignint));
+ if (cprop->item_type)
+ fprintf(f, "&RNA_%s\n", (const char *)cprop->item_type);
+ else
+ fprintf(f, "NULL\n");
+ break;
+ }
+ }
+
+ fprintf(f, "};\n\n");
+
+ if (freenest) {
+ MEM_freeN(strnest);
+ MEM_freeN(errnest);
+ }
}
static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
{
- FunctionRNA *func;
- FunctionDefRNA *dfunc;
- PropertyRNA *prop, *parm;
- StructRNA *base;
-
- fprintf(f, "/* %s */\n", srna->name);
-
- for (prop = srna->cont.properties.first; prop; prop = prop->next)
- rna_generate_property(f, srna, NULL, prop);
-
- for (func = srna->functions.first; func; func = func->cont.next) {
- for (parm = func->cont.properties.first; parm; parm = parm->next)
- rna_generate_property(f, srna, func->identifier, parm);
-
- fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
-
- if (func->cont.next)
- fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier,
- ((FunctionRNA *)func->cont.next)->identifier);
- else
- fprintf(f, "\t{NULL, ");
- if (func->cont.prev)
- fprintf(f, "(FunctionRNA *)&rna_%s_%s_func,\n", srna->identifier,
- ((FunctionRNA *)func->cont.prev)->identifier);
- else
- fprintf(f, "NULL,\n");
-
- fprintf(f, "\tNULL,\n");
-
- parm = func->cont.properties.first;
- if (parm) fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s_%s, ", srna->identifier, func->identifier, parm->identifier);
- else fprintf(f, "\t{NULL, ");
-
- parm = func->cont.properties.last;
- if (parm) fprintf(f, "(PropertyRNA *)&rna_%s_%s_%s}},\n", srna->identifier, func->identifier, parm->identifier);
- else fprintf(f, "NULL}},\n");
-
- fprintf(f, "\t");
- rna_print_c_string(f, func->identifier);
- fprintf(f, ", %d, ", func->flag);
- rna_print_c_string(f, func->description); fprintf(f, ",\n");
-
- dfunc = rna_find_function_def(func);
- if (dfunc->gencall) fprintf(f, "\t%s,\n", dfunc->gencall);
- else fprintf(f, "\tNULL,\n");
-
- if (func->c_ret)
- fprintf(f, "\t(PropertyRNA *)&rna_%s_%s_%s\n", srna->identifier, func->identifier, func->c_ret->identifier);
- else
- fprintf(f, "\tNULL\n");
-
- fprintf(f, "};\n");
- fprintf(f, "\n");
- }
-
- fprintf(f, "StructRNA RNA_%s = {\n", srna->identifier);
-
- if (srna->cont.next) fprintf(f, "\t{(ContainerRNA *)&RNA_%s, ", ((StructRNA *)srna->cont.next)->identifier);
- else fprintf(f, "\t{NULL, ");
- if (srna->cont.prev) fprintf(f, "(ContainerRNA *)&RNA_%s,\n", ((StructRNA *)srna->cont.prev)->identifier);
- else fprintf(f, "NULL,\n");
-
- fprintf(f, "\tNULL,\n");
-
- prop = srna->cont.properties.first;
- if (prop) fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s, ", srna->identifier, prop->identifier);
- else fprintf(f, "\t{NULL, ");
-
- prop = srna->cont.properties.last;
- if (prop) fprintf(f, "(PropertyRNA *)&rna_%s_%s}},\n", srna->identifier, prop->identifier);
- else fprintf(f, "NULL}},\n");
- fprintf(f, "\t");
- rna_print_c_string(f, srna->identifier);
- fprintf(f, ", NULL, NULL"); /* PyType - Cant initialize here */
- fprintf(f, ", %d, NULL, ", srna->flag);
- rna_print_c_string(f, srna->name);
- fprintf(f, ",\n\t");
- rna_print_c_string(f, srna->description);
- fprintf(f, ",\n\t");
- rna_print_c_string(f, srna->translation_context);
- fprintf(f, ", %d,\n", srna->icon);
-
- prop = srna->nameproperty;
- if (prop) {
- base = srna;
- while (base->base && base->base->nameproperty == prop)
- base = base->base;
-
- fprintf(f, "\t(PropertyRNA *)&rna_%s_%s, ", base->identifier, prop->identifier);
- }
- else {
- fprintf(f, "\tNULL, ");
- }
-
- prop = srna->iteratorproperty;
- base = srna;
- while (base->base && base->base->iteratorproperty == prop)
- base = base->base;
- fprintf(f, "(PropertyRNA *)&rna_%s_rna_properties,\n", base->identifier);
-
- if (srna->base) fprintf(f, "\t&RNA_%s,\n", srna->base->identifier);
- else fprintf(f, "\tNULL,\n");
-
- if (srna->nested) fprintf(f, "\t&RNA_%s,\n", srna->nested->identifier);
- else fprintf(f, "\tNULL,\n");
-
- fprintf(f, "\t%s,\n", rna_function_string(srna->refine));
- fprintf(f, "\t%s,\n", rna_function_string(srna->path));
- fprintf(f, "\t%s,\n", rna_function_string(srna->reg));
- fprintf(f, "\t%s,\n", rna_function_string(srna->unreg));
- fprintf(f, "\t%s,\n", rna_function_string(srna->instance));
- fprintf(f, "\t%s,\n", rna_function_string(srna->idproperties));
-
- if (srna->reg && !srna->refine) {
- CLOG_ERROR(&LOG, "%s has a register function, must also have refine function.",
- srna->identifier);
- DefRNA.error = 1;
- }
-
- func = srna->functions.first;
- if (func) fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, func->identifier);
- else fprintf(f, "\t{NULL, ");
-
- func = srna->functions.last;
- if (func) fprintf(f, "(FunctionRNA *)&rna_%s_%s_func}\n", srna->identifier, func->identifier);
- else fprintf(f, "NULL}\n");
-
- fprintf(f, "};\n");
-
- fprintf(f, "\n");
+ FunctionRNA *func;
+ FunctionDefRNA *dfunc;
+ PropertyRNA *prop, *parm;
+ StructRNA *base;
+
+ fprintf(f, "/* %s */\n", srna->name);
+
+ for (prop = srna->cont.properties.first; prop; prop = prop->next)
+ rna_generate_property(f, srna, NULL, prop);
+
+ for (func = srna->functions.first; func; func = func->cont.next) {
+ for (parm = func->cont.properties.first; parm; parm = parm->next)
+ rna_generate_property(f, srna, func->identifier, parm);
+
+ fprintf(f, "%s%s rna_%s_%s_func = {\n", "", "FunctionRNA", srna->identifier, func->identifier);
+
+ if (func->cont.next)
+ fprintf(f,
+ "\t{(FunctionRNA *)&rna_%s_%s_func, ",
+ srna->identifier,
+ ((FunctionRNA *)func->cont.next)->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+ if (func->cont.prev)
+ fprintf(f,
+ "(FunctionRNA *)&rna_%s_%s_func,\n",
+ srna->identifier,
+ ((FunctionRNA *)func->cont.prev)->identifier);
+ else
+ fprintf(f, "NULL,\n");
+
+ fprintf(f, "\tNULL,\n");
+
+ parm = func->cont.properties.first;
+ if (parm)
+ fprintf(f,
+ "\t{(PropertyRNA *)&rna_%s_%s_%s, ",
+ srna->identifier,
+ func->identifier,
+ parm->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+
+ parm = func->cont.properties.last;
+ if (parm)
+ fprintf(f,
+ "(PropertyRNA *)&rna_%s_%s_%s}},\n",
+ srna->identifier,
+ func->identifier,
+ parm->identifier);
+ else
+ fprintf(f, "NULL}},\n");
+
+ fprintf(f, "\t");
+ rna_print_c_string(f, func->identifier);
+ fprintf(f, ", %d, ", func->flag);
+ rna_print_c_string(f, func->description);
+ fprintf(f, ",\n");
+
+ dfunc = rna_find_function_def(func);
+ if (dfunc->gencall)
+ fprintf(f, "\t%s,\n", dfunc->gencall);
+ else
+ fprintf(f, "\tNULL,\n");
+
+ if (func->c_ret)
+ fprintf(f,
+ "\t(PropertyRNA *)&rna_%s_%s_%s\n",
+ srna->identifier,
+ func->identifier,
+ func->c_ret->identifier);
+ else
+ fprintf(f, "\tNULL\n");
+
+ fprintf(f, "};\n");
+ fprintf(f, "\n");
+ }
+
+ fprintf(f, "StructRNA RNA_%s = {\n", srna->identifier);
+
+ if (srna->cont.next)
+ fprintf(f, "\t{(ContainerRNA *)&RNA_%s, ", ((StructRNA *)srna->cont.next)->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+ if (srna->cont.prev)
+ fprintf(f, "(ContainerRNA *)&RNA_%s,\n", ((StructRNA *)srna->cont.prev)->identifier);
+ else
+ fprintf(f, "NULL,\n");
+
+ fprintf(f, "\tNULL,\n");
+
+ prop = srna->cont.properties.first;
+ if (prop)
+ fprintf(f, "\t{(PropertyRNA *)&rna_%s_%s, ", srna->identifier, prop->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+
+ prop = srna->cont.properties.last;
+ if (prop)
+ fprintf(f, "(PropertyRNA *)&rna_%s_%s}},\n", srna->identifier, prop->identifier);
+ else
+ fprintf(f, "NULL}},\n");
+ fprintf(f, "\t");
+ rna_print_c_string(f, srna->identifier);
+ fprintf(f, ", NULL, NULL"); /* PyType - Cant initialize here */
+ fprintf(f, ", %d, NULL, ", srna->flag);
+ rna_print_c_string(f, srna->name);
+ fprintf(f, ",\n\t");
+ rna_print_c_string(f, srna->description);
+ fprintf(f, ",\n\t");
+ rna_print_c_string(f, srna->translation_context);
+ fprintf(f, ", %d,\n", srna->icon);
+
+ prop = srna->nameproperty;
+ if (prop) {
+ base = srna;
+ while (base->base && base->base->nameproperty == prop)
+ base = base->base;
+
+ fprintf(f, "\t(PropertyRNA *)&rna_%s_%s, ", base->identifier, prop->identifier);
+ }
+ else {
+ fprintf(f, "\tNULL, ");
+ }
+
+ prop = srna->iteratorproperty;
+ base = srna;
+ while (base->base && base->base->iteratorproperty == prop)
+ base = base->base;
+ fprintf(f, "(PropertyRNA *)&rna_%s_rna_properties,\n", base->identifier);
+
+ if (srna->base)
+ fprintf(f, "\t&RNA_%s,\n", srna->base->identifier);
+ else
+ fprintf(f, "\tNULL,\n");
+
+ if (srna->nested)
+ fprintf(f, "\t&RNA_%s,\n", srna->nested->identifier);
+ else
+ fprintf(f, "\tNULL,\n");
+
+ fprintf(f, "\t%s,\n", rna_function_string(srna->refine));
+ fprintf(f, "\t%s,\n", rna_function_string(srna->path));
+ fprintf(f, "\t%s,\n", rna_function_string(srna->reg));
+ fprintf(f, "\t%s,\n", rna_function_string(srna->unreg));
+ fprintf(f, "\t%s,\n", rna_function_string(srna->instance));
+ fprintf(f, "\t%s,\n", rna_function_string(srna->idproperties));
+
+ if (srna->reg && !srna->refine) {
+ CLOG_ERROR(
+ &LOG, "%s has a register function, must also have refine function.", srna->identifier);
+ DefRNA.error = 1;
+ }
+
+ func = srna->functions.first;
+ if (func)
+ fprintf(f, "\t{(FunctionRNA *)&rna_%s_%s_func, ", srna->identifier, func->identifier);
+ else
+ fprintf(f, "\t{NULL, ");
+
+ func = srna->functions.last;
+ if (func)
+ fprintf(f, "(FunctionRNA *)&rna_%s_%s_func}\n", srna->identifier, func->identifier);
+ else
+ fprintf(f, "NULL}\n");
+
+ fprintf(f, "};\n");
+
+ fprintf(f, "\n");
}
typedef struct RNAProcessItem {
- const char *filename;
- const char *api_filename;
- void (*define)(BlenderRNA *brna);
+ const char *filename;
+ const char *api_filename;
+ void (*define)(BlenderRNA *brna);
} RNAProcessItem;
static RNAProcessItem PROCESS_ITEMS[] = {
- {"rna_rna.c", NULL, RNA_def_rna},
- {"rna_ID.c", NULL, RNA_def_ID},
- {"rna_texture.c", "rna_texture_api.c", RNA_def_texture},
- {"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_armature.c", "rna_armature_api.c", RNA_def_armature},
- {"rna_boid.c", NULL, RNA_def_boid},
- {"rna_brush.c", NULL, RNA_def_brush},
- {"rna_cachefile.c", NULL, RNA_def_cachefile},
- {"rna_camera.c", "rna_camera_api.c", RNA_def_camera},
- {"rna_cloth.c", NULL, RNA_def_cloth},
- {"rna_collection.c", NULL, RNA_def_collections},
- {"rna_color.c", NULL, RNA_def_color},
- {"rna_constraint.c", NULL, RNA_def_constraint},
- {"rna_context.c", NULL, RNA_def_context},
- {"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},
- {"rna_fluidsim.c", NULL, RNA_def_fluidsim},
- {"rna_gpencil.c", NULL, RNA_def_gpencil},
- {"rna_image.c", "rna_image_api.c", RNA_def_image},
- {"rna_key.c", NULL, RNA_def_key},
- {"rna_light.c", NULL, RNA_def_light},
- {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice},
- {"rna_layer.c", NULL, RNA_def_view_layer},
- {"rna_linestyle.c", NULL, RNA_def_linestyle},
- {"rna_main.c", "rna_main_api.c", RNA_def_main},
- {"rna_material.c", "rna_material_api.c", RNA_def_material},
- {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
- {"rna_meta.c", "rna_meta_api.c", RNA_def_meta},
- {"rna_modifier.c", NULL, RNA_def_modifier},
- {"rna_gpencil_modifier.c", NULL, RNA_def_greasepencil_modifier},
- {"rna_shader_fx.c", NULL, RNA_def_shader_fx },
- {"rna_nla.c", NULL, RNA_def_nla},
- {"rna_nodetree.c", NULL, RNA_def_nodetree},
- {"rna_object.c", "rna_object_api.c", RNA_def_object},
- {"rna_object_force.c", NULL, RNA_def_object_force},
- {"rna_depsgraph.c", NULL, RNA_def_depsgraph},
- {"rna_packedfile.c", NULL, RNA_def_packedfile},
- {"rna_palette.c", NULL, RNA_def_palette},
- {"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_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_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},
- {"rna_speaker.c", NULL, RNA_def_speaker},
- {"rna_test.c", NULL, RNA_def_test},
- {"rna_text.c", "rna_text_api.c", RNA_def_text},
- {"rna_timeline.c", NULL, RNA_def_timeline_marker},
- {"rna_sound.c", "rna_sound_api.c", RNA_def_sound},
- {"rna_ui.c", "rna_ui_api.c", RNA_def_ui},
- {"rna_userdef.c", NULL, RNA_def_userdef},
- {"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont},
- {"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
- {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo},
- {"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace},
- {"rna_world.c", NULL, RNA_def_world},
- {"rna_movieclip.c", NULL, RNA_def_movieclip},
- {"rna_tracking.c", NULL, RNA_def_tracking},
- {"rna_mask.c", NULL, RNA_def_mask},
- {NULL, NULL},
+ {"rna_rna.c", NULL, RNA_def_rna},
+ {"rna_ID.c", NULL, RNA_def_ID},
+ {"rna_texture.c", "rna_texture_api.c", RNA_def_texture},
+ {"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_armature.c", "rna_armature_api.c", RNA_def_armature},
+ {"rna_boid.c", NULL, RNA_def_boid},
+ {"rna_brush.c", NULL, RNA_def_brush},
+ {"rna_cachefile.c", NULL, RNA_def_cachefile},
+ {"rna_camera.c", "rna_camera_api.c", RNA_def_camera},
+ {"rna_cloth.c", NULL, RNA_def_cloth},
+ {"rna_collection.c", NULL, RNA_def_collections},
+ {"rna_color.c", NULL, RNA_def_color},
+ {"rna_constraint.c", NULL, RNA_def_constraint},
+ {"rna_context.c", NULL, RNA_def_context},
+ {"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},
+ {"rna_fluidsim.c", NULL, RNA_def_fluidsim},
+ {"rna_gpencil.c", NULL, RNA_def_gpencil},
+ {"rna_image.c", "rna_image_api.c", RNA_def_image},
+ {"rna_key.c", NULL, RNA_def_key},
+ {"rna_light.c", NULL, RNA_def_light},
+ {"rna_lattice.c", "rna_lattice_api.c", RNA_def_lattice},
+ {"rna_layer.c", NULL, RNA_def_view_layer},
+ {"rna_linestyle.c", NULL, RNA_def_linestyle},
+ {"rna_main.c", "rna_main_api.c", RNA_def_main},
+ {"rna_material.c", "rna_material_api.c", RNA_def_material},
+ {"rna_mesh.c", "rna_mesh_api.c", RNA_def_mesh},
+ {"rna_meta.c", "rna_meta_api.c", RNA_def_meta},
+ {"rna_modifier.c", NULL, RNA_def_modifier},
+ {"rna_gpencil_modifier.c", NULL, RNA_def_greasepencil_modifier},
+ {"rna_shader_fx.c", NULL, RNA_def_shader_fx},
+ {"rna_nla.c", NULL, RNA_def_nla},
+ {"rna_nodetree.c", NULL, RNA_def_nodetree},
+ {"rna_object.c", "rna_object_api.c", RNA_def_object},
+ {"rna_object_force.c", NULL, RNA_def_object_force},
+ {"rna_depsgraph.c", NULL, RNA_def_depsgraph},
+ {"rna_packedfile.c", NULL, RNA_def_packedfile},
+ {"rna_palette.c", NULL, RNA_def_palette},
+ {"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_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_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},
+ {"rna_speaker.c", NULL, RNA_def_speaker},
+ {"rna_test.c", NULL, RNA_def_test},
+ {"rna_text.c", "rna_text_api.c", RNA_def_text},
+ {"rna_timeline.c", NULL, RNA_def_timeline_marker},
+ {"rna_sound.c", "rna_sound_api.c", RNA_def_sound},
+ {"rna_ui.c", "rna_ui_api.c", RNA_def_ui},
+ {"rna_userdef.c", NULL, RNA_def_userdef},
+ {"rna_vfont.c", "rna_vfont_api.c", RNA_def_vfont},
+ {"rna_wm.c", "rna_wm_api.c", RNA_def_wm},
+ {"rna_wm_gizmo.c", "rna_wm_gizmo_api.c", RNA_def_wm_gizmo},
+ {"rna_workspace.c", "rna_workspace_api.c", RNA_def_workspace},
+ {"rna_world.c", NULL, RNA_def_world},
+ {"rna_movieclip.c", NULL, RNA_def_movieclip},
+ {"rna_tracking.c", NULL, RNA_def_tracking},
+ {"rna_mask.c", NULL, RNA_def_mask},
+ {NULL, NULL},
};
static void rna_generate(BlenderRNA *brna, FILE *f, const char *filename, const char *api_filename)
{
- StructDefRNA *ds;
- PropertyDefRNA *dp;
- FunctionDefRNA *dfunc;
-
- fprintf(f,
- "\n"
- "/* Automatically generated struct definitions for the Data API.\n"
- " * Do not edit manually, changes will be overwritten. */\n\n"
- "#define RNA_RUNTIME\n\n");
-
- fprintf(f, "#include <float.h>\n");
- fprintf(f, "#include <stdio.h>\n");
- fprintf(f, "#include <limits.h>\n");
- fprintf(f, "#include <string.h>\n\n");
- fprintf(f, "#include <stddef.h>\n\n");
-
- fprintf(f, "#include \"MEM_guardedalloc.h\"\n\n");
-
- fprintf(f, "#include \"DNA_ID.h\"\n");
- fprintf(f, "#include \"DNA_scene_types.h\"\n");
-
- fprintf(f, "#include \"BLI_blenlib.h\"\n\n");
- fprintf(f, "#include \"BLI_utildefines.h\"\n\n");
-
- fprintf(f, "#include \"BKE_context.h\"\n");
- fprintf(f, "#include \"BKE_library.h\"\n");
- fprintf(f, "#include \"BKE_main.h\"\n");
- fprintf(f, "#include \"BKE_report.h\"\n");
-
- fprintf(f, "#include \"RNA_define.h\"\n");
- fprintf(f, "#include \"RNA_types.h\"\n");
- fprintf(f, "#include \"rna_internal.h\"\n\n");
-
-
- /* include the generated prototypes header */
- fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n");
-
- fprintf(f, "#include \"%s\"\n", filename);
- if (api_filename)
- fprintf(f, "#include \"%s\"\n", api_filename);
- fprintf(f, "\n");
-
- /* we want the included C files to have warnings enabled but for the generated code
- * ignore unused-parameter warnings which are hard to prevent */
-#if defined( __GNUC__) || defined(__clang__)
- fprintf(f, "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n");
+ StructDefRNA *ds;
+ PropertyDefRNA *dp;
+ FunctionDefRNA *dfunc;
+
+ fprintf(f,
+ "\n"
+ "/* Automatically generated struct definitions for the Data API.\n"
+ " * Do not edit manually, changes will be overwritten. */\n\n"
+ "#define RNA_RUNTIME\n\n");
+
+ fprintf(f, "#include <float.h>\n");
+ fprintf(f, "#include <stdio.h>\n");
+ fprintf(f, "#include <limits.h>\n");
+ fprintf(f, "#include <string.h>\n\n");
+ fprintf(f, "#include <stddef.h>\n\n");
+
+ fprintf(f, "#include \"MEM_guardedalloc.h\"\n\n");
+
+ fprintf(f, "#include \"DNA_ID.h\"\n");
+ fprintf(f, "#include \"DNA_scene_types.h\"\n");
+
+ fprintf(f, "#include \"BLI_blenlib.h\"\n\n");
+ fprintf(f, "#include \"BLI_utildefines.h\"\n\n");
+
+ fprintf(f, "#include \"BKE_context.h\"\n");
+ fprintf(f, "#include \"BKE_library.h\"\n");
+ fprintf(f, "#include \"BKE_main.h\"\n");
+ fprintf(f, "#include \"BKE_report.h\"\n");
+
+ fprintf(f, "#include \"RNA_define.h\"\n");
+ fprintf(f, "#include \"RNA_types.h\"\n");
+ fprintf(f, "#include \"rna_internal.h\"\n\n");
+
+ /* include the generated prototypes header */
+ fprintf(f, "#include \"rna_prototypes_gen.h\"\n\n");
+
+ fprintf(f, "#include \"%s\"\n", filename);
+ if (api_filename)
+ fprintf(f, "#include \"%s\"\n", api_filename);
+ fprintf(f, "\n");
+
+ /* we want the included C files to have warnings enabled but for the generated code
+ * ignore unused-parameter warnings which are hard to prevent */
+#if defined(__GNUC__) || defined(__clang__)
+ fprintf(f, "#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\n");
#endif
- fprintf(f, "/* Autogenerated Functions */\n\n");
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- if (!filename || ds->filename == filename) {
- rna_generate_property_prototypes(brna, ds->srna, f);
- rna_generate_function_prototypes(brna, ds->srna, f);
- }
- }
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (!filename || ds->filename == filename)
- for (dp = ds->cont.properties.first; dp; dp = dp->next)
- rna_def_property_funcs(f, ds->srna, dp);
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- if (!filename || ds->filename == filename) {
- for (dp = ds->cont.properties.first; dp; dp = dp->next)
- rna_def_property_wrapper_funcs(f, ds, dp);
-
- for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
- rna_def_function_wrapper_funcs(f, ds, dfunc);
- rna_def_function_funcs(f, ds, dfunc);
- }
-
- rna_generate_static_function_prototypes(brna, ds->srna, f);
- }
- }
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (!filename || ds->filename == filename)
- rna_generate_struct(brna, ds->srna, f);
-
- if (STREQ(filename, "rna_ID.c")) {
- /* this is ugly, but we cannot have c files compiled for both
- * makesrna and blender with some build systems at the moment */
- fprintf(f, "#include \"rna_define.c\"\n\n");
-
- rna_generate_blender(brna, f);
- }
+ fprintf(f, "/* Autogenerated Functions */\n\n");
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ if (!filename || ds->filename == filename) {
+ rna_generate_property_prototypes(brna, ds->srna, f);
+ rna_generate_function_prototypes(brna, ds->srna, f);
+ }
+ }
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (!filename || ds->filename == filename)
+ for (dp = ds->cont.properties.first; dp; dp = dp->next)
+ rna_def_property_funcs(f, ds->srna, dp);
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ if (!filename || ds->filename == filename) {
+ for (dp = ds->cont.properties.first; dp; dp = dp->next)
+ rna_def_property_wrapper_funcs(f, ds, dp);
+
+ for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next) {
+ rna_def_function_wrapper_funcs(f, ds, dfunc);
+ rna_def_function_funcs(f, ds, dfunc);
+ }
+
+ rna_generate_static_function_prototypes(brna, ds->srna, f);
+ }
+ }
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (!filename || ds->filename == filename)
+ rna_generate_struct(brna, ds->srna, f);
+
+ if (STREQ(filename, "rna_ID.c")) {
+ /* this is ugly, but we cannot have c files compiled for both
+ * makesrna and blender with some build systems at the moment */
+ fprintf(f, "#include \"rna_define.c\"\n\n");
+
+ rna_generate_blender(brna, f);
+ }
}
static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
{
- StructDefRNA *ds;
- PropertyDefRNA *dp;
- StructRNA *srna;
- FunctionDefRNA *dfunc;
+ StructDefRNA *ds;
+ PropertyDefRNA *dp;
+ StructRNA *srna;
+ FunctionDefRNA *dfunc;
- fprintf(f, "\n#ifndef __RNA_BLENDER_H__\n");
- fprintf(f, "#define __RNA_BLENDER_H__\n\n");
+ fprintf(f, "\n#ifndef __RNA_BLENDER_H__\n");
+ fprintf(f, "#define __RNA_BLENDER_H__\n\n");
- fprintf(f,
- "/* Automatically generated function declarations for the Data API.\n"
- " * Do not edit manually, changes will be overwritten. */\n\n");
+ fprintf(f,
+ "/* Automatically generated function declarations for the Data API.\n"
+ " * Do not edit manually, changes will be overwritten. */\n\n");
- fprintf(f, "#include \"RNA_types.h\"\n\n");
+ fprintf(f, "#include \"RNA_types.h\"\n\n");
- fprintf(f, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
+ fprintf(f, "#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n");
- fprintf(f, "#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
- fprintf(f, " { \\\n");
- fprintf(f, " CollectionPropertyIterator rna_macro_iter; \\\n");
- fprintf(f, " for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
- "property##_next(&rna_macro_iter)) { \\\n");
- fprintf(f, " itemptr = rna_macro_iter.ptr;\n\n");
+ fprintf(f, "#define FOREACH_BEGIN(property, sptr, itemptr) \\\n");
+ fprintf(f, " { \\\n");
+ fprintf(f, " CollectionPropertyIterator rna_macro_iter; \\\n");
+ fprintf(f,
+ " for (property##_begin(&rna_macro_iter, sptr); rna_macro_iter.valid; "
+ "property##_next(&rna_macro_iter)) { \\\n");
+ fprintf(f, " itemptr = rna_macro_iter.ptr;\n\n");
- fprintf(f, "#define FOREACH_END(property) \\\n");
- fprintf(f, " } \\\n");
- fprintf(f, " property##_end(&rna_macro_iter); \\\n");
- fprintf(f, " }\n\n");
+ fprintf(f, "#define FOREACH_END(property) \\\n");
+ fprintf(f, " } \\\n");
+ fprintf(f, " property##_end(&rna_macro_iter); \\\n");
+ fprintf(f, " }\n\n");
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- srna = ds->srna;
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ srna = ds->srna;
- fprintf(f, "/**************** %s ****************/\n\n", srna->name);
+ fprintf(f, "/**************** %s ****************/\n\n", srna->name);
- while (srna) {
- fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
- srna = srna->base;
- }
- fprintf(f, "\n");
+ while (srna) {
+ fprintf(f, "extern StructRNA RNA_%s;\n", srna->identifier);
+ srna = srna->base;
+ }
+ fprintf(f, "\n");
- for (dp = ds->cont.properties.first; dp; dp = dp->next)
- rna_def_property_funcs_header(f, ds->srna, dp);
+ for (dp = ds->cont.properties.first; dp; dp = dp->next)
+ rna_def_property_funcs_header(f, ds->srna, dp);
- for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
- rna_def_function_funcs_header(f, ds->srna, dfunc);
- }
+ for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+ rna_def_function_funcs_header(f, ds->srna, dfunc);
+ }
- fprintf(f, "#ifdef __cplusplus\n}\n#endif\n\n");
+ fprintf(f, "#ifdef __cplusplus\n}\n#endif\n\n");
- fprintf(f, "#endif /* __RNA_BLENDER_H__ */\n\n");
+ fprintf(f, "#endif /* __RNA_BLENDER_H__ */\n\n");
}
-static const char *cpp_classes = ""
-"\n"
-"#include <stdlib.h> /* for malloc */\n"
-"#include <string>\n"
-"#include <string.h> /* for memcpy */\n"
-"\n"
-"namespace BL {\n"
-"\n"
-"#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
-" inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: false; } \\\n"
-" inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n"
-"\n"
-"#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<bool, size> sname::identifier(void) \\\n"
-" { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(bool values[size]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
-"\n"
-"#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<bool> sname::identifier(void) { \\\n"
-" int arraylen[3]; \\\n"
-" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<bool> ar(len); \\\n"
-" sname##_##identifier##_get(&ptr, ar.data); \\\n"
-" return ar; } \\\n"
-" inline void sname::identifier(bool values[]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
-"\n"
-"#define INT_PROPERTY(sname, identifier) \\\n"
-" inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
-" inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
-"\n"
-"#define INT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<int, size> sname::identifier(void) \\\n"
-" { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(int values[size]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
-"\n"
-"#define INT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<int> sname::identifier(void) { \\\n"
-" int arraylen[3]; \\\n"
-" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<int> ar(len); \\\n"
-" sname##_##identifier##_get(&ptr, ar.data); \\\n"
-" return ar; } \\\n"
-" inline void sname::identifier(int values[]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
-"\n"
-"#define FLOAT_PROPERTY(sname, identifier) \\\n"
-" inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
-" inline void sname::identifier(float value) { sname##_##identifier##_set(&ptr, value); }\n"
-"\n"
-"#define FLOAT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
-" inline Array<float, size> sname::identifier(void) \\\n"
-" { Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
-" inline void sname::identifier(float values[size]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
-"\n"
-"#define FLOAT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
-" inline DynamicArray<float> sname::identifier(void) { \\\n"
-" int arraylen[3]; \\\n"
-" int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
-" DynamicArray<float> ar(len); \\\n"
-" sname##_##identifier##_get(&ptr, ar.data); \\\n"
-" return ar; } \\\n"
-" inline void sname::identifier(float values[]) \\\n"
-" { sname##_##identifier##_set(&ptr, values); } \\\n"
-"\n"
-"#define ENUM_PROPERTY(type, sname, identifier) \\\n"
-" inline sname::type sname::identifier(void) { return (type)sname##_##identifier##_get(&ptr); } \\\n"
-" inline void sname::identifier(sname::type value) { sname##_##identifier##_set(&ptr, value); }\n"
-"\n"
-"#define STRING_PROPERTY(sname, identifier) \\\n"
-" inline std::string sname::identifier(void) { \\\n"
-" int len = sname##_##identifier##_length(&ptr); \\\n"
-" std::string str; str.resize(len); \\\n"
-" sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n"
-" inline void sname::identifier(const std::string& value) { \\\n"
-" sname##_##identifier##_set(&ptr, value.c_str()); } \\\n"
-"\n"
-"#define POINTER_PROPERTY(type, sname, identifier) \\\n"
-" inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n"
-"\n"
-"#define COLLECTION_PROPERTY_LENGTH_false(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
-" { \\\n"
-" CollectionPropertyIterator iter; \\\n"
-" int length = 0; \\\n"
-" sname##_##identifier##_begin(&iter, ptr); \\\n"
-" while (iter.valid) { \\\n"
-" sname##_##identifier##_next(&iter); \\\n"
-" ++length; \\\n"
-" } \\\n"
-" sname##_##identifier##_end(&iter); \\\n"
-" return length; \\\n"
-" } \n"
-"#define COLLECTION_PROPERTY_LENGTH_true(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
-" { return sname##_##identifier##_length(ptr); } \n"
-"\n"
-"#define COLLECTION_PROPERTY_LOOKUP_INT_false(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" CollectionPropertyIterator iter; \\\n"
-" int i = 0, found = 0; \\\n"
-" sname##_##identifier##_begin(&iter, ptr); \\\n"
-" while (iter.valid) { \\\n"
-" if (i == key) { \\\n"
-" *r_ptr = iter.ptr; \\\n"
-" found = 1; \\\n"
-" break; \\\n"
-" } \\\n"
-" sname##_##identifier##_next(&iter); \\\n"
-" ++i; \\\n"
-" } \\\n"
-" sname##_##identifier##_end(&iter); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
-"#define COLLECTION_PROPERTY_LOOKUP_INT_true(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
-"#define COLLECTION_PROPERTY_LOOKUP_STRING_false(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" CollectionPropertyIterator iter; \\\n"
-" int found = 0; \\\n"
-" PropertyRNA *item_name_prop = RNA_struct_name_property(ptr->type); \\\n"
-" sname##_##identifier##_begin(&iter, ptr); \\\n"
-" while (iter.valid && !found) { \\\n"
-" char name_fixed[32]; \\\n"
-" const char *name; \\\n"
-" int name_length; \\\n"
-" name = RNA_property_string_get_alloc(&iter.ptr, item_name_prop, name_fixed, sizeof(name_fixed), &name_length); \\\n"
-" if (!strncmp(name, key, name_length)) { \\\n"
-" *r_ptr = iter.ptr; \\\n"
-" found = 1; \\\n"
-" } \\\n"
-" if (name_fixed != name) \\\n"
-" MEM_freeN((void *) name); \\\n"
-" sname##_##identifier##_next(&iter); \\\n"
-" } \\\n"
-" sname##_##identifier##_end(&iter); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
-"#define COLLECTION_PROPERTY_LOOKUP_STRING_true(sname, identifier) \\\n"
-" inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char *key, PointerRNA *r_ptr) \\\n"
-" { \\\n"
-" int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
-" if (!found) \\\n"
-" memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
-" return found; \\\n"
-" } \n"
-"#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, has_lookup_int, has_lookup_string) \\\n"
-" typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n"
-" sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n"
-" COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
-" COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
-" COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
-" CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
-" sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
-" sname##_##identifier##_length_wrap, \\\n"
-" sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n"
-"\n"
-"class Pointer {\n"
-"public:\n"
-" Pointer(const PointerRNA &p) : ptr(p) { }\n"
-" operator const PointerRNA&() { return ptr; }\n"
-" bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
-" operator void*() { return ptr.data; }\n"
-" operator bool() { return ptr.data != NULL; }\n"
-"\n"
-" bool operator==(const Pointer &other) { return ptr.data == other.ptr.data; }\n"
-" bool operator!=(const Pointer &other) { return ptr.data != other.ptr.data; }\n"
-"\n"
-" PointerRNA ptr;\n"
-"};\n"
-"\n"
-"\n"
-"template<typename T, int Tsize>\n"
-"class Array {\n"
-"public:\n"
-" T data[Tsize];\n"
-"\n"
-" Array() {}\n"
-" Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); }\n"
-" const Array<T, Tsize>& operator = (const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); "
-"return *this; }\n"
-"\n"
-" operator T*() { return data; }\n"
-" operator const T*() const { return data; }\n"
-"};\n"
-"\n"
-"template<typename T>\n"
-"class DynamicArray {\n"
-"public:\n"
-" T *data;\n"
-" int length;\n"
-"\n"
-" DynamicArray() : data(NULL), length(0) {}\n"
-" DynamicArray(int new_length) : data(NULL), length(new_length) { data = (T *)malloc(sizeof(T) * new_length); }\n"
-" DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n"
-" const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); return *this; }\n"
-"\n"
-" ~DynamicArray() { if (data) free(data); }\n"
-"\n"
-" operator T*() { return data; }\n"
-"\n"
-"protected:\n"
-" void copy_from(const DynamicArray<T>& other) {\n"
-" if (data) free(data);\n"
-" data = (T *)malloc(sizeof(T) * other.length);\n"
-" memcpy(data, other.data, sizeof(T) * other.length);\n"
-" length = other.length;\n"
-" }\n"
-"};\n"
-"\n"
-"typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n"
-"typedef void (*TNextFunc)(CollectionPropertyIterator *iter);\n"
-"typedef void (*TEndFunc)(CollectionPropertyIterator *iter);\n"
-"typedef int (*TLengthFunc)(PointerRNA *ptr);\n"
-"typedef int (*TLookupIntFunc)(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n"
-"typedef int (*TLookupStringFunc)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n"
-"\n"
-"template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
-"class CollectionIterator {\n"
-"public:\n"
-" CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n"
-" ~CollectionIterator(void) { if (init) Tend(&iter); };\n"
-"\n"
-" operator bool(void)\n"
-" { return iter.valid != 0; }\n"
-" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = T(iter.ptr); return *this; }\n"
-"\n"
-" T& operator*(void) { return t; }\n"
-" T* operator->(void) { return &t; }\n"
-" bool operator == (const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
-"{ return iter.valid == other.iter.valid; }\n"
-" bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
-"{ return iter.valid != other.iter.valid; }\n"
-"\n"
-" void begin(const Pointer &ptr)\n"
-" { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA *)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
-"\n"
-"private:\n"
-" const CollectionIterator<T, Tbegin, Tnext, Tend>& operator = "
-"(const CollectionIterator<T, Tbegin, Tnext, Tend>& /*copy*/) {}\n"
-""
-" CollectionPropertyIterator iter;\n"
-" T t;\n"
-" bool init;\n"
-"};\n"
-"\n"
-"template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
-" TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n"
-" typename Tcollection_funcs>\n"
-"class CollectionRef : public Tcollection_funcs {\n"
-"public:\n"
-" CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
-"\n"
-" void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
-" { iter.begin(ptr); }\n"
-" CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
-" { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
-""
-" int length()\n"
-" { return Tlength(&ptr); }\n"
-" T operator[](int key)\n"
-" { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
-" T operator[](const std::string &key)\n"
-" { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
-"\n"
-"private:\n"
-" PointerRNA ptr;\n"
-"};\n"
-"\n"
-"class DefaultCollectionFunctions {\n"
-"public:\n"
-" DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n"
-"};\n"
-"\n"
-"\n";
+static const char *cpp_classes =
+ ""
+ "\n"
+ "#include <stdlib.h> /* for malloc */\n"
+ "#include <string>\n"
+ "#include <string.h> /* for memcpy */\n"
+ "\n"
+ "namespace BL {\n"
+ "\n"
+ "#define BOOLEAN_PROPERTY(sname, identifier) \\\n"
+ " inline bool sname::identifier(void) { return sname##_##identifier##_get(&ptr) ? true: "
+ "false; } \\\n"
+ " inline void sname::identifier(bool value) { sname##_##identifier##_set(&ptr, value); }\n"
+ "\n"
+ "#define BOOLEAN_ARRAY_PROPERTY(sname, size, identifier) \\\n"
+ " inline Array<bool, size> sname::identifier(void) \\\n"
+ " { Array<bool, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+ " inline void sname::identifier(bool values[size]) \\\n"
+ " { sname##_##identifier##_set(&ptr, values); } \\\n"
+ "\n"
+ "#define BOOLEAN_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
+ " inline DynamicArray<bool> sname::identifier(void) { \\\n"
+ " int arraylen[3]; \\\n"
+ " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+ " DynamicArray<bool> ar(len); \\\n"
+ " sname##_##identifier##_get(&ptr, ar.data); \\\n"
+ " return ar; } \\\n"
+ " inline void sname::identifier(bool values[]) \\\n"
+ " { sname##_##identifier##_set(&ptr, values); } \\\n"
+ "\n"
+ "#define INT_PROPERTY(sname, identifier) \\\n"
+ " inline int sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
+ " inline void sname::identifier(int value) { sname##_##identifier##_set(&ptr, value); }\n"
+ "\n"
+ "#define INT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
+ " inline Array<int, size> sname::identifier(void) \\\n"
+ " { Array<int, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+ " inline void sname::identifier(int values[size]) \\\n"
+ " { sname##_##identifier##_set(&ptr, values); } \\\n"
+ "\n"
+ "#define INT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
+ " inline DynamicArray<int> sname::identifier(void) { \\\n"
+ " int arraylen[3]; \\\n"
+ " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+ " DynamicArray<int> ar(len); \\\n"
+ " sname##_##identifier##_get(&ptr, ar.data); \\\n"
+ " return ar; } \\\n"
+ " inline void sname::identifier(int values[]) \\\n"
+ " { sname##_##identifier##_set(&ptr, values); } \\\n"
+ "\n"
+ "#define FLOAT_PROPERTY(sname, identifier) \\\n"
+ " inline float sname::identifier(void) { return sname##_##identifier##_get(&ptr); } \\\n"
+ " inline void sname::identifier(float value) { sname##_##identifier##_set(&ptr, value); }\n"
+ "\n"
+ "#define FLOAT_ARRAY_PROPERTY(sname, size, identifier) \\\n"
+ " inline Array<float, size> sname::identifier(void) \\\n"
+ " { Array<float, size> ar; sname##_##identifier##_get(&ptr, ar.data); return ar; } \\\n"
+ " inline void sname::identifier(float values[size]) \\\n"
+ " { sname##_##identifier##_set(&ptr, values); } \\\n"
+ "\n"
+ "#define FLOAT_DYNAMIC_ARRAY_PROPERTY(sname, identifier) \\\n"
+ " inline DynamicArray<float> sname::identifier(void) { \\\n"
+ " int arraylen[3]; \\\n"
+ " int len = sname##_##identifier##_get_length(&ptr, arraylen); \\\n"
+ " DynamicArray<float> ar(len); \\\n"
+ " sname##_##identifier##_get(&ptr, ar.data); \\\n"
+ " return ar; } \\\n"
+ " inline void sname::identifier(float values[]) \\\n"
+ " { sname##_##identifier##_set(&ptr, values); } \\\n"
+ "\n"
+ "#define ENUM_PROPERTY(type, sname, identifier) \\\n"
+ " inline sname::type sname::identifier(void) { return "
+ "(type)sname##_##identifier##_get(&ptr); } \\\n"
+ " inline void sname::identifier(sname::type value) { sname##_##identifier##_set(&ptr, "
+ "value); }\n"
+ "\n"
+ "#define STRING_PROPERTY(sname, identifier) \\\n"
+ " inline std::string sname::identifier(void) { \\\n"
+ " int len = sname##_##identifier##_length(&ptr); \\\n"
+ " std::string str; str.resize(len); \\\n"
+ " sname##_##identifier##_get(&ptr, &str[0]); return str; } \\\n"
+ " inline void sname::identifier(const std::string& value) { \\\n"
+ " sname##_##identifier##_set(&ptr, value.c_str()); } \\\n"
+ "\n"
+ "#define POINTER_PROPERTY(type, sname, identifier) \\\n"
+ " inline type sname::identifier(void) { return type(sname##_##identifier##_get(&ptr)); }\n"
+ "\n"
+ "#define COLLECTION_PROPERTY_LENGTH_false(sname, identifier) \\\n"
+ " inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
+ " { \\\n"
+ " CollectionPropertyIterator iter; \\\n"
+ " int length = 0; \\\n"
+ " sname##_##identifier##_begin(&iter, ptr); \\\n"
+ " while (iter.valid) { \\\n"
+ " sname##_##identifier##_next(&iter); \\\n"
+ " ++length; \\\n"
+ " } \\\n"
+ " sname##_##identifier##_end(&iter); \\\n"
+ " return length; \\\n"
+ " } \n"
+ "#define COLLECTION_PROPERTY_LENGTH_true(sname, identifier) \\\n"
+ " inline static int sname##_##identifier##_length_wrap(PointerRNA *ptr) \\\n"
+ " { return sname##_##identifier##_length(ptr); } \n"
+ "\n"
+ "#define COLLECTION_PROPERTY_LOOKUP_INT_false(sname, identifier) \\\n"
+ " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, "
+ "PointerRNA *r_ptr) \\\n"
+ " { \\\n"
+ " CollectionPropertyIterator iter; \\\n"
+ " int i = 0, found = 0; \\\n"
+ " sname##_##identifier##_begin(&iter, ptr); \\\n"
+ " while (iter.valid) { \\\n"
+ " if (i == key) { \\\n"
+ " *r_ptr = iter.ptr; \\\n"
+ " found = 1; \\\n"
+ " break; \\\n"
+ " } \\\n"
+ " sname##_##identifier##_next(&iter); \\\n"
+ " ++i; \\\n"
+ " } \\\n"
+ " sname##_##identifier##_end(&iter); \\\n"
+ " if (!found) \\\n"
+ " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " return found; \\\n"
+ " } \n"
+ "#define COLLECTION_PROPERTY_LOOKUP_INT_true(sname, identifier) \\\n"
+ " inline static int sname##_##identifier##_lookup_int_wrap(PointerRNA *ptr, int key, "
+ "PointerRNA *r_ptr) \\\n"
+ " { \\\n"
+ " int found = sname##_##identifier##_lookup_int(ptr, key, r_ptr); \\\n"
+ " if (!found) \\\n"
+ " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " return found; \\\n"
+ " } \n"
+ "#define COLLECTION_PROPERTY_LOOKUP_STRING_false(sname, identifier) \\\n"
+ " inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char "
+ "*key, PointerRNA *r_ptr) \\\n"
+ " { \\\n"
+ " CollectionPropertyIterator iter; \\\n"
+ " int found = 0; \\\n"
+ " PropertyRNA *item_name_prop = RNA_struct_name_property(ptr->type); \\\n"
+ " sname##_##identifier##_begin(&iter, ptr); \\\n"
+ " while (iter.valid && !found) { \\\n"
+ " char name_fixed[32]; \\\n"
+ " const char *name; \\\n"
+ " int name_length; \\\n"
+ " name = RNA_property_string_get_alloc(&iter.ptr, item_name_prop, name_fixed, "
+ "sizeof(name_fixed), &name_length); \\\n"
+ " if (!strncmp(name, key, name_length)) { \\\n"
+ " *r_ptr = iter.ptr; \\\n"
+ " found = 1; \\\n"
+ " } \\\n"
+ " if (name_fixed != name) \\\n"
+ " MEM_freeN((void *) name); \\\n"
+ " sname##_##identifier##_next(&iter); \\\n"
+ " } \\\n"
+ " sname##_##identifier##_end(&iter); \\\n"
+ " if (!found) \\\n"
+ " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " return found; \\\n"
+ " } \n"
+ "#define COLLECTION_PROPERTY_LOOKUP_STRING_true(sname, identifier) \\\n"
+ " inline static int sname##_##identifier##_lookup_string_wrap(PointerRNA *ptr, const char "
+ "*key, PointerRNA *r_ptr) \\\n"
+ " { \\\n"
+ " int found = sname##_##identifier##_lookup_string(ptr, key, r_ptr); \\\n"
+ " if (!found) \\\n"
+ " memset(r_ptr, 0, sizeof(*r_ptr)); \\\n"
+ " return found; \\\n"
+ " } \n"
+ "#define COLLECTION_PROPERTY(collection_funcs, type, sname, identifier, has_length, "
+ "has_lookup_int, has_lookup_string) \\\n"
+ " typedef CollectionIterator<type, sname##_##identifier##_begin, \\\n"
+ " sname##_##identifier##_next, sname##_##identifier##_end> identifier##_iterator; \\\n"
+ " COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
+ " COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
+ " COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
+ " CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
+ " sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
+ " sname##_##identifier##_length_wrap, \\\n"
+ " sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, "
+ "collection_funcs> identifier;\n"
+ "\n"
+ "class Pointer {\n"
+ "public:\n"
+ " Pointer(const PointerRNA &p) : ptr(p) { }\n"
+ " operator const PointerRNA&() { return ptr; }\n"
+ " bool is_a(StructRNA *type) { return RNA_struct_is_a(ptr.type, type) ? true: false; }\n"
+ " operator void*() { return ptr.data; }\n"
+ " operator bool() { return ptr.data != NULL; }\n"
+ "\n"
+ " bool operator==(const Pointer &other) { return ptr.data == other.ptr.data; }\n"
+ " bool operator!=(const Pointer &other) { return ptr.data != other.ptr.data; }\n"
+ "\n"
+ " PointerRNA ptr;\n"
+ "};\n"
+ "\n"
+ "\n"
+ "template<typename T, int Tsize>\n"
+ "class Array {\n"
+ "public:\n"
+ " T data[Tsize];\n"
+ "\n"
+ " Array() {}\n"
+ " Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T) * Tsize); }\n"
+ " const Array<T, Tsize>& operator = (const Array<T, Tsize>& other) { memcpy(data, "
+ "other.data, sizeof(T) * Tsize); "
+ "return *this; }\n"
+ "\n"
+ " operator T*() { return data; }\n"
+ " operator const T*() const { return data; }\n"
+ "};\n"
+ "\n"
+ "template<typename T>\n"
+ "class DynamicArray {\n"
+ "public:\n"
+ " T *data;\n"
+ " int length;\n"
+ "\n"
+ " DynamicArray() : data(NULL), length(0) {}\n"
+ " DynamicArray(int new_length) : data(NULL), length(new_length) { data = (T "
+ "*)malloc(sizeof(T) * new_length); }\n"
+ " DynamicArray(const DynamicArray<T>& other) { copy_from(other); }\n"
+ " const DynamicArray<T>& operator = (const DynamicArray<T>& other) { copy_from(other); "
+ "return *this; }\n"
+ "\n"
+ " ~DynamicArray() { if (data) free(data); }\n"
+ "\n"
+ " operator T*() { return data; }\n"
+ "\n"
+ "protected:\n"
+ " void copy_from(const DynamicArray<T>& other) {\n"
+ " if (data) free(data);\n"
+ " data = (T *)malloc(sizeof(T) * other.length);\n"
+ " memcpy(data, other.data, sizeof(T) * other.length);\n"
+ " length = other.length;\n"
+ " }\n"
+ "};\n"
+ "\n"
+ "typedef void (*TBeginFunc)(CollectionPropertyIterator *iter, PointerRNA *ptr);\n"
+ "typedef void (*TNextFunc)(CollectionPropertyIterator *iter);\n"
+ "typedef void (*TEndFunc)(CollectionPropertyIterator *iter);\n"
+ "typedef int (*TLengthFunc)(PointerRNA *ptr);\n"
+ "typedef int (*TLookupIntFunc)(PointerRNA *ptr, int key, PointerRNA *r_ptr);\n"
+ "typedef int (*TLookupStringFunc)(PointerRNA *ptr, const char *key, PointerRNA *r_ptr);\n"
+ "\n"
+ "template<typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend>\n"
+ "class CollectionIterator {\n"
+ "public:\n"
+ " CollectionIterator() : iter(), t(iter.ptr), init(false) { iter.valid = false; }\n"
+ " ~CollectionIterator(void) { if (init) Tend(&iter); };\n"
+ "\n"
+ " operator bool(void)\n"
+ " { return iter.valid != 0; }\n"
+ " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = "
+ "T(iter.ptr); return *this; }\n"
+ "\n"
+ " T& operator*(void) { return t; }\n"
+ " T* operator->(void) { return &t; }\n"
+ " bool operator == (const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+ "{ return iter.valid == other.iter.valid; }\n"
+ " bool operator!=(const CollectionIterator<T, Tbegin, Tnext, Tend>& other) "
+ "{ return iter.valid != other.iter.valid; }\n"
+ "\n"
+ " void begin(const Pointer &ptr)\n"
+ " { if (init) Tend(&iter); Tbegin(&iter, (PointerRNA *)&ptr.ptr); t = T(iter.ptr); init = "
+ "true; }\n"
+ "\n"
+ "private:\n"
+ " const CollectionIterator<T, Tbegin, Tnext, Tend>& operator = "
+ "(const CollectionIterator<T, Tbegin, Tnext, Tend>& /*copy*/) {}\n"
+ ""
+ " CollectionPropertyIterator iter;\n"
+ " T t;\n"
+ " bool init;\n"
+ "};\n"
+ "\n"
+ "template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
+ " TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n"
+ " typename Tcollection_funcs>\n"
+ "class CollectionRef : public Tcollection_funcs {\n"
+ "public:\n"
+ " CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
+ "\n"
+ " void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
+ " { iter.begin(ptr); }\n"
+ " CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
+ " { return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
+ ""
+ " int length()\n"
+ " { return Tlength(&ptr); }\n"
+ " T operator[](int key)\n"
+ " { PointerRNA r_ptr; Tlookup_int(&ptr, key, &r_ptr); return T(r_ptr); }\n"
+ " T operator[](const std::string &key)\n"
+ " { PointerRNA r_ptr; Tlookup_string(&ptr, key.c_str(), &r_ptr); return T(r_ptr); }\n"
+ "\n"
+ "private:\n"
+ " PointerRNA ptr;\n"
+ "};\n"
+ "\n"
+ "class DefaultCollectionFunctions {\n"
+ "public:\n"
+ " DefaultCollectionFunctions(const PointerRNA & /*p*/) {}\n"
+ "};\n"
+ "\n"
+ "\n";
static int rna_is_collection_prop(PropertyRNA *prop)
{
- if (!(prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN)) {
- if (prop->type == PROP_COLLECTION) {
- return 1;
- }
- }
+ if (!(prop->flag & PROP_IDPROPERTY || prop->flag_internal & PROP_INTERN_BUILTIN)) {
+ if (prop->type == PROP_COLLECTION) {
+ return 1;
+ }
+ }
- return 0;
+ return 0;
}
-static int rna_is_collection_functions_struct(const char **collection_structs, const char *struct_name)
+static int rna_is_collection_functions_struct(const char **collection_structs,
+ const char *struct_name)
{
- int a = 0, found = 0;
+ int a = 0, found = 0;
- while (collection_structs[a]) {
- if (STREQ(collection_structs[a], struct_name)) {
- found = 1;
- break;
- }
- a++;
- }
+ while (collection_structs[a]) {
+ if (STREQ(collection_structs[a], struct_name)) {
+ found = 1;
+ break;
+ }
+ a++;
+ }
- return found;
+ return found;
}
static void rna_generate_header_class_cpp(StructDefRNA *ds, FILE *f)
{
- StructRNA *srna = ds->srna;
- PropertyDefRNA *dp;
- FunctionDefRNA *dfunc;
-
- fprintf(f, "/**************** %s ****************/\n\n", srna->name);
-
- fprintf(f, "class %s : public %s {\n", srna->identifier, (srna->base) ? srna->base->identifier : "Pointer");
- fprintf(f, "public:\n");
- fprintf(f, "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)", srna->identifier,
- (srna->base) ? srna->base->identifier : "Pointer");
- for (dp = ds->cont.properties.first; dp; dp = dp->next)
- if (rna_is_collection_prop(dp->prop))
- fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier);
- fprintf(f, "\n\t\t{}\n\n");
-
- for (dp = ds->cont.properties.first; dp; dp = dp->next)
- rna_def_property_funcs_header_cpp(f, ds->srna, dp);
-
- fprintf(f, "\n");
- for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
- rna_def_struct_function_header_cpp(f, srna, dfunc);
-
- fprintf(f, "};\n\n");
+ StructRNA *srna = ds->srna;
+ PropertyDefRNA *dp;
+ FunctionDefRNA *dfunc;
+
+ fprintf(f, "/**************** %s ****************/\n\n", srna->name);
+
+ fprintf(f,
+ "class %s : public %s {\n",
+ srna->identifier,
+ (srna->base) ? srna->base->identifier : "Pointer");
+ fprintf(f, "public:\n");
+ fprintf(f,
+ "\t%s(const PointerRNA &ptr_arg) :\n\t\t%s(ptr_arg)",
+ srna->identifier,
+ (srna->base) ? srna->base->identifier : "Pointer");
+ for (dp = ds->cont.properties.first; dp; dp = dp->next)
+ if (rna_is_collection_prop(dp->prop))
+ fprintf(f, ",\n\t\t%s(ptr_arg)", dp->prop->identifier);
+ fprintf(f, "\n\t\t{}\n\n");
+
+ for (dp = ds->cont.properties.first; dp; dp = dp->next)
+ rna_def_property_funcs_header_cpp(f, ds->srna, dp);
+
+ fprintf(f, "\n");
+ for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+ rna_def_struct_function_header_cpp(f, srna, dfunc);
+
+ fprintf(f, "};\n\n");
}
static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
{
- StructDefRNA *ds;
- PropertyDefRNA *dp;
- StructRNA *srna;
- FunctionDefRNA *dfunc;
- const char *first_collection_func_struct = NULL;
- const char *collection_func_structs[256] = {NULL};
- int all_collection_func_structs = 0;
- int max_collection_func_structs = sizeof(collection_func_structs) / sizeof(collection_func_structs[0]) - 1;
-
- fprintf(f, "\n#ifndef __RNA_BLENDER_CPP_H__\n");
- fprintf(f, "#define __RNA_BLENDER_CPP_H__\n\n");
-
- fprintf(f,
- "/* Automatically generated classes for the Data API.\n"
- " * Do not edit manually, changes will be overwritten. */\n\n");
-
- fprintf(f, "#include \"RNA_blender.h\"\n");
- fprintf(f, "#include \"RNA_types.h\"\n");
- fprintf(f, "#include \"RNA_access.h\"\n");
-
- fprintf(f, "%s", cpp_classes);
-
- fprintf(f, "/**************** Declarations ****************/\n\n");
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- fprintf(f, "class %s;\n", ds->srna->identifier);
- }
- fprintf(f, "\n");
-
- /* first get list of all structures used as collection functions, so they'll be declared first */
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- for (dp = ds->cont.properties.first; dp; dp = dp->next) {
- if (rna_is_collection_prop(dp->prop)) {
- PropertyRNA *prop = dp->prop;
-
- if (prop->srna) {
- /* store name of structure which first uses custom functions for collections */
- if (first_collection_func_struct == NULL)
- first_collection_func_struct = ds->srna->identifier;
-
- if (!rna_is_collection_functions_struct(collection_func_structs, (char *)prop->srna)) {
- if (all_collection_func_structs >= max_collection_func_structs) {
- printf("Array size to store all collection structures names is too small\n");
- exit(1);
- }
-
- collection_func_structs[all_collection_func_structs++] = (char *)prop->srna;
- }
- }
- }
- }
- }
-
- /* declare all structures in such order:
- * - first N structures which doesn't use custom functions for collections
- * - all structures used for custom functions in collections
- * - all the rest structures
- * such an order prevents usage of non-declared classes
- */
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- srna = ds->srna;
-
- if (STREQ(srna->identifier, first_collection_func_struct)) {
- StructDefRNA *ds2;
- StructRNA *srna2;
-
- for (ds2 = DefRNA.structs.first; ds2; ds2 = ds2->cont.next) {
- srna2 = ds2->srna;
-
- if (rna_is_collection_functions_struct(collection_func_structs, srna2->identifier)) {
- rna_generate_header_class_cpp(ds2, f);
- }
- }
- }
-
- if (!rna_is_collection_functions_struct(collection_func_structs, srna->identifier))
- rna_generate_header_class_cpp(ds, f);
- }
-
- fprintf(f, "} /* namespace BL */\n");
-
- fprintf(f, "\n");
- fprintf(f, "/**************** Implementation ****************/\n");
- fprintf(f, "\n");
-
- fprintf(f, "/* Structure prototypes */\n\n");
- fprintf(f, "extern \"C\" {\n");
- rna_generate_struct_prototypes(f);
- fprintf(f, "}\n\n");
-
- fprintf(f, "namespace BL {\n");
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- srna = ds->srna;
-
- for (dp = ds->cont.properties.first; dp; dp = dp->next)
- rna_def_property_funcs_impl_cpp(f, ds->srna, dp);
-
- fprintf(f, "\n");
-
- for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
- rna_def_struct_function_impl_cpp(f, srna, dfunc);
-
- fprintf(f, "\n");
- }
+ StructDefRNA *ds;
+ PropertyDefRNA *dp;
+ StructRNA *srna;
+ FunctionDefRNA *dfunc;
+ const char *first_collection_func_struct = NULL;
+ const char *collection_func_structs[256] = {NULL};
+ int all_collection_func_structs = 0;
+ int max_collection_func_structs = sizeof(collection_func_structs) /
+ sizeof(collection_func_structs[0]) -
+ 1;
+
+ fprintf(f, "\n#ifndef __RNA_BLENDER_CPP_H__\n");
+ fprintf(f, "#define __RNA_BLENDER_CPP_H__\n\n");
+
+ fprintf(f,
+ "/* Automatically generated classes for the Data API.\n"
+ " * Do not edit manually, changes will be overwritten. */\n\n");
+
+ fprintf(f, "#include \"RNA_blender.h\"\n");
+ fprintf(f, "#include \"RNA_types.h\"\n");
+ fprintf(f, "#include \"RNA_access.h\"\n");
+
+ fprintf(f, "%s", cpp_classes);
+
+ fprintf(f, "/**************** Declarations ****************/\n\n");
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ fprintf(f, "class %s;\n", ds->srna->identifier);
+ }
+ fprintf(f, "\n");
+
+ /* first get list of all structures used as collection functions, so they'll be declared first */
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ for (dp = ds->cont.properties.first; dp; dp = dp->next) {
+ if (rna_is_collection_prop(dp->prop)) {
+ PropertyRNA *prop = dp->prop;
+
+ if (prop->srna) {
+ /* store name of structure which first uses custom functions for collections */
+ if (first_collection_func_struct == NULL)
+ first_collection_func_struct = ds->srna->identifier;
+
+ if (!rna_is_collection_functions_struct(collection_func_structs, (char *)prop->srna)) {
+ if (all_collection_func_structs >= max_collection_func_structs) {
+ printf("Array size to store all collection structures names is too small\n");
+ exit(1);
+ }
+
+ collection_func_structs[all_collection_func_structs++] = (char *)prop->srna;
+ }
+ }
+ }
+ }
+ }
+
+ /* declare all structures in such order:
+ * - first N structures which doesn't use custom functions for collections
+ * - all structures used for custom functions in collections
+ * - all the rest structures
+ * such an order prevents usage of non-declared classes
+ */
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ srna = ds->srna;
+
+ if (STREQ(srna->identifier, first_collection_func_struct)) {
+ StructDefRNA *ds2;
+ StructRNA *srna2;
+
+ for (ds2 = DefRNA.structs.first; ds2; ds2 = ds2->cont.next) {
+ srna2 = ds2->srna;
+
+ if (rna_is_collection_functions_struct(collection_func_structs, srna2->identifier)) {
+ rna_generate_header_class_cpp(ds2, f);
+ }
+ }
+ }
+
+ if (!rna_is_collection_functions_struct(collection_func_structs, srna->identifier))
+ rna_generate_header_class_cpp(ds, f);
+ }
+
+ fprintf(f, "} /* namespace BL */\n");
+
+ fprintf(f, "\n");
+ fprintf(f, "/**************** Implementation ****************/\n");
+ fprintf(f, "\n");
+
+ fprintf(f, "/* Structure prototypes */\n\n");
+ fprintf(f, "extern \"C\" {\n");
+ rna_generate_struct_prototypes(f);
+ fprintf(f, "}\n\n");
+
+ fprintf(f, "namespace BL {\n");
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ srna = ds->srna;
+
+ for (dp = ds->cont.properties.first; dp; dp = dp->next)
+ rna_def_property_funcs_impl_cpp(f, ds->srna, dp);
+
+ fprintf(f, "\n");
+
+ for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+ rna_def_struct_function_impl_cpp(f, srna, dfunc);
+
+ fprintf(f, "\n");
+ }
- fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
+ fprintf(f, "}\n\n#endif /* __RNA_BLENDER_CPP_H__ */\n\n");
}
static void make_bad_file(const char *file, int line)
{
- FILE *fp = fopen(file, "w");
- fprintf(fp,
- "#error \"Error! can't make correct RNA file from %s:%d, "
- "check DNA properties.\"\n",
- __FILE__, line);
- fclose(fp);
+ FILE *fp = fopen(file, "w");
+ fprintf(fp,
+ "#error \"Error! can't make correct RNA file from %s:%d, "
+ "check DNA properties.\"\n",
+ __FILE__,
+ line);
+ fclose(fp);
}
static int rna_preprocess(const char *outfile)
{
- BlenderRNA *brna;
- StructDefRNA *ds;
- FILE *file;
- char deffile[4096];
- int i, status;
- const char *deps[3]; /* expand as needed */
-
- /* define rna */
- brna = RNA_create();
-
- for (i = 0; PROCESS_ITEMS[i].filename; i++) {
- if (PROCESS_ITEMS[i].define) {
- PROCESS_ITEMS[i].define(brna);
-
- /* sanity check */
- if (!DefRNA.animate) {
- fprintf(stderr,
- "Error: DefRNA.animate left disabled in %s\n",
- PROCESS_ITEMS[i].filename);
- }
-
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (!ds->filename)
- ds->filename = PROCESS_ITEMS[i].filename;
- }
- }
-
- rna_auto_types();
-
- status = (DefRNA.error != 0);
-
- /* create rna prototype header file */
- strcpy(deffile, outfile);
- strcat(deffile, "rna_prototypes_gen.h");
- if (status) {
- make_bad_file(deffile, __LINE__);
- }
- file = fopen(deffile, "w");
- if (!file) {
- fprintf(stderr, "Unable to open file: %s\n", deffile);
- status = 1;
- }
- else {
- fprintf(file,
- "/* Automatically generated function declarations for the Data API.\n"
- " * Do not edit manually, changes will be overwritten. */\n\n");
- rna_generate_prototypes(brna, file);
- fclose(file);
- status = (DefRNA.error != 0);
- }
-
- /* create rna_gen_*.c files */
- for (i = 0; PROCESS_ITEMS[i].filename; i++) {
- strcpy(deffile, outfile);
- strcat(deffile, PROCESS_ITEMS[i].filename);
- deffile[strlen(deffile) - 2] = '\0';
- strcat(deffile, "_gen.c" TMP_EXT);
-
- if (status) {
- make_bad_file(deffile, __LINE__);
- }
- else {
- file = fopen(deffile, "w");
-
- if (!file) {
- fprintf(stderr, "Unable to open file: %s\n", deffile);
- status = 1;
- }
- else {
- rna_generate(brna, file, PROCESS_ITEMS[i].filename, PROCESS_ITEMS[i].api_filename);
- fclose(file);
- status = (DefRNA.error != 0);
- }
- }
-
- /* avoid unneeded rebuilds */
- deps[0] = PROCESS_ITEMS[i].filename;
- deps[1] = PROCESS_ITEMS[i].api_filename;
- deps[2] = NULL;
-
- replace_if_different(deffile, deps);
- }
-
- /* create RNA_blender_cpp.h */
- strcpy(deffile, outfile);
- strcat(deffile, "RNA_blender_cpp.h" TMP_EXT);
-
- if (status) {
- make_bad_file(deffile, __LINE__);
- }
- else {
- file = fopen(deffile, "w");
-
- if (!file) {
- fprintf(stderr, "Unable to open file: %s\n", deffile);
- status = 1;
- }
- else {
- rna_generate_header_cpp(brna, file);
- fclose(file);
- status = (DefRNA.error != 0);
- }
- }
-
- replace_if_different(deffile, NULL);
-
- rna_sort(brna);
-
- /* create RNA_blender.h */
- strcpy(deffile, outfile);
- strcat(deffile, "RNA_blender.h" TMP_EXT);
-
- if (status) {
- make_bad_file(deffile, __LINE__);
- }
- else {
- file = fopen(deffile, "w");
-
- if (!file) {
- fprintf(stderr, "Unable to open file: %s\n", deffile);
- status = 1;
- }
- else {
- rna_generate_header(brna, file);
- fclose(file);
- status = (DefRNA.error != 0);
- }
- }
-
- replace_if_different(deffile, NULL);
-
- /* free RNA */
- RNA_define_free(brna);
- RNA_free(brna);
-
- return status;
+ BlenderRNA *brna;
+ StructDefRNA *ds;
+ FILE *file;
+ char deffile[4096];
+ int i, status;
+ const char *deps[3]; /* expand as needed */
+
+ /* define rna */
+ brna = RNA_create();
+
+ for (i = 0; PROCESS_ITEMS[i].filename; i++) {
+ if (PROCESS_ITEMS[i].define) {
+ PROCESS_ITEMS[i].define(brna);
+
+ /* sanity check */
+ if (!DefRNA.animate) {
+ fprintf(stderr, "Error: DefRNA.animate left disabled in %s\n", PROCESS_ITEMS[i].filename);
+ }
+
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (!ds->filename)
+ ds->filename = PROCESS_ITEMS[i].filename;
+ }
+ }
+
+ rna_auto_types();
+
+ status = (DefRNA.error != 0);
+
+ /* create rna prototype header file */
+ strcpy(deffile, outfile);
+ strcat(deffile, "rna_prototypes_gen.h");
+ if (status) {
+ make_bad_file(deffile, __LINE__);
+ }
+ file = fopen(deffile, "w");
+ if (!file) {
+ fprintf(stderr, "Unable to open file: %s\n", deffile);
+ status = 1;
+ }
+ else {
+ fprintf(file,
+ "/* Automatically generated function declarations for the Data API.\n"
+ " * Do not edit manually, changes will be overwritten. */\n\n");
+ rna_generate_prototypes(brna, file);
+ fclose(file);
+ status = (DefRNA.error != 0);
+ }
+
+ /* create rna_gen_*.c files */
+ for (i = 0; PROCESS_ITEMS[i].filename; i++) {
+ strcpy(deffile, outfile);
+ strcat(deffile, PROCESS_ITEMS[i].filename);
+ deffile[strlen(deffile) - 2] = '\0';
+ strcat(deffile, "_gen.c" TMP_EXT);
+
+ if (status) {
+ make_bad_file(deffile, __LINE__);
+ }
+ else {
+ file = fopen(deffile, "w");
+
+ if (!file) {
+ fprintf(stderr, "Unable to open file: %s\n", deffile);
+ status = 1;
+ }
+ else {
+ rna_generate(brna, file, PROCESS_ITEMS[i].filename, PROCESS_ITEMS[i].api_filename);
+ fclose(file);
+ status = (DefRNA.error != 0);
+ }
+ }
+
+ /* avoid unneeded rebuilds */
+ deps[0] = PROCESS_ITEMS[i].filename;
+ deps[1] = PROCESS_ITEMS[i].api_filename;
+ deps[2] = NULL;
+
+ replace_if_different(deffile, deps);
+ }
+
+ /* create RNA_blender_cpp.h */
+ strcpy(deffile, outfile);
+ strcat(deffile, "RNA_blender_cpp.h" TMP_EXT);
+
+ if (status) {
+ make_bad_file(deffile, __LINE__);
+ }
+ else {
+ file = fopen(deffile, "w");
+
+ if (!file) {
+ fprintf(stderr, "Unable to open file: %s\n", deffile);
+ status = 1;
+ }
+ else {
+ rna_generate_header_cpp(brna, file);
+ fclose(file);
+ status = (DefRNA.error != 0);
+ }
+ }
+
+ replace_if_different(deffile, NULL);
+
+ rna_sort(brna);
+
+ /* create RNA_blender.h */
+ strcpy(deffile, outfile);
+ strcat(deffile, "RNA_blender.h" TMP_EXT);
+
+ if (status) {
+ make_bad_file(deffile, __LINE__);
+ }
+ else {
+ file = fopen(deffile, "w");
+
+ if (!file) {
+ fprintf(stderr, "Unable to open file: %s\n", deffile);
+ status = 1;
+ }
+ else {
+ rna_generate_header(brna, file);
+ fclose(file);
+ status = (DefRNA.error != 0);
+ }
+ }
+
+ replace_if_different(deffile, NULL);
+
+ /* free RNA */
+ RNA_define_free(brna);
+ RNA_free(brna);
+
+ return status;
}
static void mem_error_cb(const char *errorStr)
{
- fprintf(stderr, "%s", errorStr);
- fflush(stderr);
+ fprintf(stderr, "%s", errorStr);
+ fflush(stderr);
}
int main(int argc, char **argv)
{
- int totblock, return_status = 0;
-
- CLG_init();
-
- /* Some useful defaults since this runs standalone. */
- CLG_output_use_basename_set(true);
- CLG_level_set(debugSRNA);
-
- if (argc < 2) {
- fprintf(stderr, "Usage: %s outdirectory/\n", argv[0]);
- return_status = 1;
- }
- else {
- if (debugSRNA > 0) {
- fprintf(stderr, "Running makesrna\n");
- }
- makesrna_path = argv[0];
- return_status = rna_preprocess(argv[1]);
- }
-
- CLG_exit();
-
- totblock = MEM_get_memory_blocks_in_use();
- if (totblock != 0) {
- fprintf(stderr, "Error Totblock: %d\n", totblock);
- MEM_set_error_callback(mem_error_cb);
- MEM_printmemlist();
- }
-
- return return_status;
+ int totblock, return_status = 0;
+
+ CLG_init();
+
+ /* Some useful defaults since this runs standalone. */
+ CLG_output_use_basename_set(true);
+ CLG_level_set(debugSRNA);
+
+ if (argc < 2) {
+ fprintf(stderr, "Usage: %s outdirectory/\n", argv[0]);
+ return_status = 1;
+ }
+ else {
+ if (debugSRNA > 0) {
+ fprintf(stderr, "Running makesrna\n");
+ }
+ makesrna_path = argv[0];
+ return_status = rna_preprocess(argv[1]);
+ }
+
+ CLG_exit();
+
+ totblock = MEM_get_memory_blocks_in_use();
+ if (totblock != 0) {
+ fprintf(stderr, "Error Totblock: %d\n", totblock);
+ MEM_set_error_callback(mem_error_cb);
+ MEM_printmemlist();
+ }
+
+ return return_status;
}
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 70c342f4665..8a3cf3be55e 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -44,1296 +44,1528 @@
* NOTE: need to keep this in line with the other defines for these
*/
const EnumPropertyItem rna_enum_id_type_items[] = {
- {ID_AC, "ACTION", ICON_ACTION, "Action", ""},
- {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""},
- {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""},
- {ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""},
- {ID_CF, "CACHEFILE", ICON_FILE, "Cache File", ""},
- {ID_CU, "CURVE", ICON_CURVE_DATA, "Curve", ""},
- {ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
- {ID_GD, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""},
- {ID_GR, "COLLECTION", ICON_GROUP, "Collection", ""},
- {ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
- {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
- {ID_LA, "LIGHT", ICON_LIGHT_DATA, "Light", ""},
- {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""},
- {ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""},
- {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""},
- {ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""},
- {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""},
- {ID_MB, "META", ICON_META_DATA, "Metaball", ""},
- {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""},
- {ID_MC, "MOVIECLIP", ICON_TRACKER, "Movie Clip", ""},
- {ID_NT, "NODETREE", ICON_NODETREE, "Node Tree", ""},
- {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""},
- {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
- {ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
- {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
- {ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probe", ""},
- {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
- {ID_SO, "SOUND", ICON_SOUND, "Sound", ""},
- {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
- {ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
- {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
- {ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
- {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
- {ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
- {0, NULL, 0, NULL, NULL},
+ {ID_AC, "ACTION", ICON_ACTION, "Action", ""},
+ {ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armature", ""},
+ {ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brush", ""},
+ {ID_CA, "CAMERA", ICON_CAMERA_DATA, "Camera", ""},
+ {ID_CF, "CACHEFILE", ICON_FILE, "Cache File", ""},
+ {ID_CU, "CURVE", ICON_CURVE_DATA, "Curve", ""},
+ {ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
+ {ID_GD, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""},
+ {ID_GR, "COLLECTION", ICON_GROUP, "Collection", ""},
+ {ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
+ {ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
+ {ID_LA, "LIGHT", ICON_LIGHT_DATA, "Light", ""},
+ {ID_LI, "LIBRARY", ICON_LIBRARY_DATA_DIRECT, "Library", ""},
+ {ID_LS, "LINESTYLE", ICON_LINE_DATA, "Line Style", ""},
+ {ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattice", ""},
+ {ID_MSK, "MASK", ICON_MOD_MASK, "Mask", ""},
+ {ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Material", ""},
+ {ID_MB, "META", ICON_META_DATA, "Metaball", ""},
+ {ID_ME, "MESH", ICON_MESH_DATA, "Mesh", ""},
+ {ID_MC, "MOVIECLIP", ICON_TRACKER, "Movie Clip", ""},
+ {ID_NT, "NODETREE", ICON_NODETREE, "Node Tree", ""},
+ {ID_OB, "OBJECT", ICON_OBJECT_DATA, "Object", ""},
+ {ID_PC, "PAINTCURVE", ICON_CURVE_BEZCURVE, "Paint Curve", ""},
+ {ID_PAL, "PALETTE", ICON_COLOR, "Palette", ""},
+ {ID_PA, "PARTICLE", ICON_PARTICLE_DATA, "Particle", ""},
+ {ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probe", ""},
+ {ID_SCE, "SCENE", ICON_SCENE_DATA, "Scene", ""},
+ {ID_SO, "SOUND", ICON_SOUND, "Sound", ""},
+ {ID_SPK, "SPEAKER", ICON_SPEAKER, "Speaker", ""},
+ {ID_TXT, "TEXT", ICON_TEXT, "Text", ""},
+ {ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Texture", ""},
+ {ID_WM, "WINDOWMANAGER", ICON_WINDOW, "Window Manager", ""},
+ {ID_WO, "WORLD", ICON_WORLD_DATA, "World", ""},
+ {ID_WS, "WORKSPACE", ICON_WORKSPACE, "Workspace", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "DNA_anim_types.h"
+# include "DNA_anim_types.h"
-#include "BLI_listbase.h"
-#include "BLI_math_base.h"
+# include "BLI_listbase.h"
+# include "BLI_math_base.h"
-#include "BKE_font.h"
-#include "BKE_idprop.h"
-#include "BKE_library_query.h"
-#include "BKE_library_override.h"
-#include "BKE_library_remap.h"
-#include "BKE_animsys.h"
-#include "BKE_material.h"
-#include "BKE_global.h" /* XXX, remove me */
+# include "BKE_font.h"
+# include "BKE_idprop.h"
+# include "BKE_library_query.h"
+# include "BKE_library_override.h"
+# include "BKE_library_remap.h"
+# include "BKE_animsys.h"
+# include "BKE_material.h"
+# include "BKE_global.h" /* XXX, remove me */
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph_query.h"
-#include "WM_api.h"
+# include "WM_api.h"
void rna_ID_override_static_property_operation_refname_get(PointerRNA *ptr, char *value)
{
- IDOverrideStaticPropertyOperation *opop = ptr->data;
- strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name);
+ IDOverrideStaticPropertyOperation *opop = ptr->data;
+ strcpy(value, (opop->subitem_reference_name == NULL) ? "" : opop->subitem_reference_name);
}
int rna_ID_override_static_property_operation_refname_length(PointerRNA *ptr)
{
- IDOverrideStaticPropertyOperation *opop = ptr->data;
- return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name);
+ IDOverrideStaticPropertyOperation *opop = ptr->data;
+ return (opop->subitem_reference_name == NULL) ? 0 : strlen(opop->subitem_reference_name);
}
void rna_ID_override_static_property_operation_locname_get(PointerRNA *ptr, char *value)
{
- IDOverrideStaticPropertyOperation *opop = ptr->data;
- strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name);
+ IDOverrideStaticPropertyOperation *opop = ptr->data;
+ strcpy(value, (opop->subitem_local_name == NULL) ? "" : opop->subitem_local_name);
}
int rna_ID_override_static_property_operation_locname_length(PointerRNA *ptr)
{
- IDOverrideStaticPropertyOperation *opop = ptr->data;
- return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name);
+ IDOverrideStaticPropertyOperation *opop = ptr->data;
+ return (opop->subitem_local_name == NULL) ? 0 : strlen(opop->subitem_local_name);
}
-
/* name functions that ignore the first two ID characters */
void rna_ID_name_get(PointerRNA *ptr, char *value)
{
- ID *id = (ID *)ptr->data;
- BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2);
+ ID *id = (ID *)ptr->data;
+ BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2);
}
int rna_ID_name_length(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
- return strlen(id->name + 2);
+ ID *id = (ID *)ptr->data;
+ return strlen(id->name + 2);
}
void rna_ID_name_set(PointerRNA *ptr, const char *value)
{
- ID *id = (ID *)ptr->data;
- BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2);
- BLI_assert(BKE_id_is_in_global_main(id));
- BLI_libblock_ensure_unique_name(G_MAIN, id->name);
+ ID *id = (ID *)ptr->data;
+ BLI_strncpy_utf8(id->name + 2, value, sizeof(id->name) - 2);
+ BLI_assert(BKE_id_is_in_global_main(id));
+ BLI_libblock_ensure_unique_name(G_MAIN, id->name);
- if (GS(id->name) == ID_OB) {
- Object *ob = (Object *)id;
- if (ob->type == OB_MBALL) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
- }
+ if (GS(id->name) == ID_OB) {
+ Object *ob = (Object *)id;
+ if (ob->type == OB_MBALL) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+ }
}
static int rna_ID_name_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- ID *id = (ID *)ptr->data;
+ ID *id = (ID *)ptr->data;
- if (GS(id->name) == ID_VF) {
- VFont *vfont = (VFont *)id;
- if (BKE_vfont_is_builtin(vfont))
- return 0;
- }
- else if (!BKE_id_is_in_global_main(id)) {
- return 0;
- }
+ if (GS(id->name) == ID_VF) {
+ VFont *vfont = (VFont *)id;
+ if (BKE_vfont_is_builtin(vfont))
+ return 0;
+ }
+ else if (!BKE_id_is_in_global_main(id)) {
+ return 0;
+ }
- return PROP_EDITABLE;
+ return PROP_EDITABLE;
}
void rna_ID_name_full_get(PointerRNA *ptr, char *value)
{
- ID *id = (ID *)ptr->data;
- BKE_id_full_name_get(value, id);
+ ID *id = (ID *)ptr->data;
+ BKE_id_full_name_get(value, id);
}
int rna_ID_name_full_length(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
- char name[MAX_ID_FULL_NAME];
- BKE_id_full_name_get(name, id);
- return strlen(name);
+ ID *id = (ID *)ptr->data;
+ char name[MAX_ID_FULL_NAME];
+ BKE_id_full_name_get(name, id);
+ return strlen(name);
}
static int rna_ID_is_evaluated_get(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
+ ID *id = (ID *)ptr->data;
- return (DEG_get_original_id(id) != id);
+ return (DEG_get_original_id(id) != id);
}
static PointerRNA rna_ID_original_get(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
+ ID *id = (ID *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_ID, DEG_get_original_id(id));
+ return rna_pointer_inherit_refine(ptr, &RNA_ID, DEG_get_original_id(id));
}
short RNA_type_to_ID_code(const StructRNA *type)
{
- const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
- if (UNLIKELY(base_type == NULL)) {
- return 0;
- }
- if (base_type == &RNA_Action) return ID_AC;
- if (base_type == &RNA_Armature) return ID_AR;
- if (base_type == &RNA_Brush) return ID_BR;
- if (base_type == &RNA_CacheFile) return ID_CF;
- if (base_type == &RNA_Camera) return ID_CA;
- if (base_type == &RNA_Curve) return ID_CU;
- if (base_type == &RNA_GreasePencil) return ID_GD;
- if (base_type == &RNA_Collection) return ID_GR;
- if (base_type == &RNA_Image) return ID_IM;
- if (base_type == &RNA_Key) return ID_KE;
- if (base_type == &RNA_Light) return ID_LA;
- if (base_type == &RNA_Library) return ID_LI;
- if (base_type == &RNA_FreestyleLineStyle) return ID_LS;
- if (base_type == &RNA_Lattice) return ID_LT;
- if (base_type == &RNA_Material) return ID_MA;
- if (base_type == &RNA_MetaBall) return ID_MB;
- if (base_type == &RNA_MovieClip) return ID_MC;
- if (base_type == &RNA_Mesh) return ID_ME;
- if (base_type == &RNA_Mask) return ID_MSK;
- if (base_type == &RNA_NodeTree) return ID_NT;
- if (base_type == &RNA_Object) return ID_OB;
- if (base_type == &RNA_ParticleSettings) return ID_PA;
- if (base_type == &RNA_Palette) return ID_PAL;
- if (base_type == &RNA_PaintCurve) return ID_PC;
- if (base_type == &RNA_LightProbe) return ID_LP;
- if (base_type == &RNA_Scene) return ID_SCE;
- if (base_type == &RNA_Screen) return ID_SCR;
- if (base_type == &RNA_Sound) return ID_SO;
- if (base_type == &RNA_Speaker) return ID_SPK;
- if (base_type == &RNA_Texture) return ID_TE;
- if (base_type == &RNA_Text) return ID_TXT;
- if (base_type == &RNA_VectorFont) return ID_VF;
- if (base_type == &RNA_WorkSpace) return ID_WS;
- if (base_type == &RNA_World) return ID_WO;
- if (base_type == &RNA_WindowManager) return ID_WM;
-
- return 0;
+ const StructRNA *base_type = RNA_struct_base_child_of(type, &RNA_ID);
+ if (UNLIKELY(base_type == NULL)) {
+ return 0;
+ }
+ if (base_type == &RNA_Action)
+ return ID_AC;
+ if (base_type == &RNA_Armature)
+ return ID_AR;
+ if (base_type == &RNA_Brush)
+ return ID_BR;
+ if (base_type == &RNA_CacheFile)
+ return ID_CF;
+ if (base_type == &RNA_Camera)
+ return ID_CA;
+ if (base_type == &RNA_Curve)
+ return ID_CU;
+ if (base_type == &RNA_GreasePencil)
+ return ID_GD;
+ if (base_type == &RNA_Collection)
+ return ID_GR;
+ if (base_type == &RNA_Image)
+ return ID_IM;
+ if (base_type == &RNA_Key)
+ return ID_KE;
+ if (base_type == &RNA_Light)
+ return ID_LA;
+ if (base_type == &RNA_Library)
+ return ID_LI;
+ if (base_type == &RNA_FreestyleLineStyle)
+ return ID_LS;
+ if (base_type == &RNA_Lattice)
+ return ID_LT;
+ if (base_type == &RNA_Material)
+ return ID_MA;
+ if (base_type == &RNA_MetaBall)
+ return ID_MB;
+ if (base_type == &RNA_MovieClip)
+ return ID_MC;
+ if (base_type == &RNA_Mesh)
+ return ID_ME;
+ if (base_type == &RNA_Mask)
+ return ID_MSK;
+ if (base_type == &RNA_NodeTree)
+ return ID_NT;
+ if (base_type == &RNA_Object)
+ return ID_OB;
+ if (base_type == &RNA_ParticleSettings)
+ return ID_PA;
+ if (base_type == &RNA_Palette)
+ return ID_PAL;
+ if (base_type == &RNA_PaintCurve)
+ return ID_PC;
+ if (base_type == &RNA_LightProbe)
+ return ID_LP;
+ if (base_type == &RNA_Scene)
+ return ID_SCE;
+ if (base_type == &RNA_Screen)
+ return ID_SCR;
+ if (base_type == &RNA_Sound)
+ return ID_SO;
+ if (base_type == &RNA_Speaker)
+ return ID_SPK;
+ if (base_type == &RNA_Texture)
+ return ID_TE;
+ if (base_type == &RNA_Text)
+ return ID_TXT;
+ if (base_type == &RNA_VectorFont)
+ return ID_VF;
+ if (base_type == &RNA_WorkSpace)
+ return ID_WS;
+ if (base_type == &RNA_World)
+ return ID_WO;
+ if (base_type == &RNA_WindowManager)
+ return ID_WM;
+
+ return 0;
}
StructRNA *ID_code_to_RNA_type(short idcode)
{
- /* Note, this switch doesn't use a 'default',
- * so adding new ID's causes a warning. */
- switch ((ID_Type)idcode) {
- case ID_AC: return &RNA_Action;
- case ID_AR: return &RNA_Armature;
- case ID_BR: return &RNA_Brush;
- case ID_CA: return &RNA_Camera;
- case ID_CF: return &RNA_CacheFile;
- case ID_CU: return &RNA_Curve;
- case ID_GD: return &RNA_GreasePencil;
- case ID_GR: return &RNA_Collection;
- case ID_IM: return &RNA_Image;
- case ID_KE: return &RNA_Key;
- case ID_LA: return &RNA_Light;
- case ID_LI: return &RNA_Library;
- case ID_LS: return &RNA_FreestyleLineStyle;
- case ID_LT: return &RNA_Lattice;
- case ID_MA: return &RNA_Material;
- case ID_MB: return &RNA_MetaBall;
- case ID_MC: return &RNA_MovieClip;
- case ID_ME: return &RNA_Mesh;
- case ID_MSK: return &RNA_Mask;
- case ID_NT: return &RNA_NodeTree;
- case ID_OB: return &RNA_Object;
- case ID_PA: return &RNA_ParticleSettings;
- case ID_PAL: return &RNA_Palette;
- case ID_PC: return &RNA_PaintCurve;
- case ID_LP: return &RNA_LightProbe;
- case ID_SCE: return &RNA_Scene;
- case ID_SCR: return &RNA_Screen;
- case ID_SO: return &RNA_Sound;
- case ID_SPK: return &RNA_Speaker;
- case ID_TE: return &RNA_Texture;
- case ID_TXT: return &RNA_Text;
- case ID_VF: return &RNA_VectorFont;
- case ID_WM: return &RNA_WindowManager;
- case ID_WO: return &RNA_World;
- case ID_WS: return &RNA_WorkSpace;
-
- /* deprecated */
- case ID_IP: break;
- }
-
- return &RNA_ID;
+ /* Note, this switch doesn't use a 'default',
+ * so adding new ID's causes a warning. */
+ switch ((ID_Type)idcode) {
+ case ID_AC:
+ return &RNA_Action;
+ case ID_AR:
+ return &RNA_Armature;
+ case ID_BR:
+ return &RNA_Brush;
+ case ID_CA:
+ return &RNA_Camera;
+ case ID_CF:
+ return &RNA_CacheFile;
+ case ID_CU:
+ return &RNA_Curve;
+ case ID_GD:
+ return &RNA_GreasePencil;
+ case ID_GR:
+ return &RNA_Collection;
+ case ID_IM:
+ return &RNA_Image;
+ case ID_KE:
+ return &RNA_Key;
+ case ID_LA:
+ return &RNA_Light;
+ case ID_LI:
+ return &RNA_Library;
+ case ID_LS:
+ return &RNA_FreestyleLineStyle;
+ case ID_LT:
+ return &RNA_Lattice;
+ case ID_MA:
+ return &RNA_Material;
+ case ID_MB:
+ return &RNA_MetaBall;
+ case ID_MC:
+ return &RNA_MovieClip;
+ case ID_ME:
+ return &RNA_Mesh;
+ case ID_MSK:
+ return &RNA_Mask;
+ case ID_NT:
+ return &RNA_NodeTree;
+ case ID_OB:
+ return &RNA_Object;
+ case ID_PA:
+ return &RNA_ParticleSettings;
+ case ID_PAL:
+ return &RNA_Palette;
+ case ID_PC:
+ return &RNA_PaintCurve;
+ case ID_LP:
+ return &RNA_LightProbe;
+ case ID_SCE:
+ return &RNA_Scene;
+ case ID_SCR:
+ return &RNA_Screen;
+ case ID_SO:
+ return &RNA_Sound;
+ case ID_SPK:
+ return &RNA_Speaker;
+ case ID_TE:
+ return &RNA_Texture;
+ case ID_TXT:
+ return &RNA_Text;
+ case ID_VF:
+ return &RNA_VectorFont;
+ case ID_WM:
+ return &RNA_WindowManager;
+ case ID_WO:
+ return &RNA_World;
+ case ID_WS:
+ return &RNA_WorkSpace;
+
+ /* deprecated */
+ case ID_IP:
+ break;
+ }
+
+ return &RNA_ID;
}
StructRNA *rna_ID_refine(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
+ ID *id = (ID *)ptr->data;
- return ID_code_to_RNA_type(GS(id->name));
+ return ID_code_to_RNA_type(GS(id->name));
}
IDProperty *rna_ID_idprops(PointerRNA *ptr, bool create)
{
- return IDP_GetProperties(ptr->data, create);
+ return IDP_GetProperties(ptr->data, create);
}
void rna_ID_fake_user_set(PointerRNA *ptr, bool value)
{
- ID *id = (ID *)ptr->data;
+ ID *id = (ID *)ptr->data;
- if (value) {
- id_fake_user_set(id);
- }
- else {
- id_fake_user_clear(id);
- }
+ if (value) {
+ id_fake_user_set(id);
+ }
+ else {
+ id_fake_user_clear(id);
+ }
}
IDProperty *rna_PropertyGroup_idprops(PointerRNA *ptr, bool UNUSED(create))
{
- return ptr->data;
+ return ptr->data;
}
void rna_PropertyGroup_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free(&BLENDER_RNA, type);
}
-StructRNA *rna_PropertyGroup_register(
- Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc UNUSED(call),
- StructFreeFunc UNUSED(free))
+StructRNA *rna_PropertyGroup_register(Main *UNUSED(bmain),
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc UNUSED(call),
+ StructFreeFunc UNUSED(free))
{
- PointerRNA dummyptr;
+ PointerRNA dummyptr;
- /* create dummy pointer */
- RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummyptr);
+ /* create dummy pointer */
+ RNA_pointer_create(NULL, &RNA_PropertyGroup, NULL, &dummyptr);
- /* validate the python class */
- if (validate(&dummyptr, data, NULL) != 0)
- return NULL;
+ /* validate the python class */
+ if (validate(&dummyptr, data, NULL) != 0)
+ return NULL;
- /* note: it looks like there is no length limit on the srna id since its
- * just a char pointer, but take care here, also be careful that python
- * owns the string pointer which it could potentially free while blender
- * is running. */
- if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) {
- BKE_reportf(reports, RPT_ERROR, "Registering id property class: '%s' is too long, maximum length is %d",
- identifier, MAX_IDPROP_NAME);
- return NULL;
- }
+ /* note: it looks like there is no length limit on the srna id since its
+ * just a char pointer, but take care here, also be careful that python
+ * owns the string pointer which it could potentially free while blender
+ * is running. */
+ if (BLI_strnlen(identifier, MAX_IDPROP_NAME) == MAX_IDPROP_NAME) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering id property class: '%s' is too long, maximum length is %d",
+ identifier,
+ MAX_IDPROP_NAME);
+ return NULL;
+ }
- return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
+ return RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_PropertyGroup); /* XXX */
}
StructRNA *rna_PropertyGroup_refine(PointerRNA *ptr)
{
- return ptr->type;
+ return ptr->type;
}
static ID *rna_ID_copy(ID *id, Main *bmain)
{
- ID *newid;
+ ID *newid;
- if (BKE_id_copy(bmain, id, &newid)) {
- if (newid != NULL) {
- id_us_min(newid);
- }
- return newid;
- }
+ if (BKE_id_copy(bmain, id, &newid)) {
+ if (newid != NULL) {
+ id_us_min(newid);
+ }
+ return newid;
+ }
- return NULL;
+ return NULL;
}
static ID *rna_ID_override_create(ID *id, Main *bmain)
{
- if (!BKE_override_static_is_enabled() || id->lib == NULL) {
- return NULL;
- }
+ if (!BKE_override_static_is_enabled() || id->lib == NULL) {
+ return NULL;
+ }
- return BKE_override_static_create_from_id(bmain, id);
+ return BKE_override_static_create_from_id(bmain, id);
}
static void rna_ID_update_tag(ID *id, ReportList *reports, int flag)
{
- /* XXX, new function for this! */
-#if 0
- if (ob->type == OB_FONT) {
- Curve *cu = ob->data;
- freedisplist(&cu->disp);
- BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL);
- }
-#endif
-
- if (flag == 0) {
- /* pass */
- }
- else {
- /* ensure flag us correct for the type */
- switch (GS(id->name)) {
- case ID_OB:
- /* TODO(sergey): This is kind of difficult to predict since different
- * object types supports different flags. Maybe does not worth checking
- * for this at all. Or maybe let dependency graph to return whether
- * the tag was valid or not. */
- if (flag & ~(ID_RECALC_ALL)) {
- BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with Object ID type");
- return;
- }
- break;
- /* Could add particle updates later */
-#if 0
- case ID_PA:
- if (flag & ~(OB_RECALC_ALL | PSYS_RECALC)) {
- BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with ParticleSettings ID type");
- return;
- }
- break;
-#endif
- default:
- BKE_report(reports, RPT_ERROR, "This ID type is not compatible with any 'refresh' options");
- return;
- }
- }
-
- DEG_id_tag_update(id, flag);
+ /* XXX, new function for this! */
+# if 0
+ if (ob->type == OB_FONT) {
+ Curve *cu = ob->data;
+ freedisplist(&cu->disp);
+ BKE_vfont_to_curve(bmain, sce, ob, FO_EDIT, NULL);
+ }
+# endif
+
+ if (flag == 0) {
+ /* pass */
+ }
+ else {
+ /* ensure flag us correct for the type */
+ switch (GS(id->name)) {
+ case ID_OB:
+ /* TODO(sergey): This is kind of difficult to predict since different
+ * object types supports different flags. Maybe does not worth checking
+ * for this at all. Or maybe let dependency graph to return whether
+ * the tag was valid or not. */
+ if (flag & ~(ID_RECALC_ALL)) {
+ BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with Object ID type");
+ return;
+ }
+ break;
+ /* Could add particle updates later */
+# if 0
+ case ID_PA:
+ if (flag & ~(OB_RECALC_ALL | PSYS_RECALC)) {
+ BKE_report(reports, RPT_ERROR, "'Refresh' incompatible with ParticleSettings ID type");
+ return;
+ }
+ break;
+# endif
+ default:
+ BKE_report(
+ reports, RPT_ERROR, "This ID type is not compatible with any 'refresh' options");
+ return;
+ }
+ }
+
+ DEG_id_tag_update(id, flag);
}
static void rna_ID_user_clear(ID *id)
{
- id_fake_user_clear(id);
- id->us = 0; /* don't save */
+ id_fake_user_clear(id);
+ id->us = 0; /* don't save */
}
static void rna_ID_user_remap(ID *id, Main *bmain, ID *new_id)
{
- if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) {
- /* For now, do not allow remapping data in linked data from here... */
- BKE_libblock_remap(bmain, id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
- }
+ if ((GS(id->name) == GS(new_id->name)) && (id != new_id)) {
+ /* For now, do not allow remapping data in linked data from here... */
+ BKE_libblock_remap(
+ bmain, id, new_id, ID_REMAP_SKIP_INDIRECT_USAGE | ID_REMAP_SKIP_NEVER_NULL_USAGE);
+ }
}
static struct ID *rna_ID_make_local(struct ID *self, Main *bmain, bool clear_proxy)
{
- /* Special case, as we can't rely on id_make_local(); it clears proxies. */
- if (!clear_proxy && GS(self->name) == ID_OB) {
- BKE_object_make_local_ex(bmain, (Object *)self, false, clear_proxy);
- }
- else {
- id_make_local(bmain, self, false, false);
- }
+ /* Special case, as we can't rely on id_make_local(); it clears proxies. */
+ if (!clear_proxy && GS(self->name) == ID_OB) {
+ BKE_object_make_local_ex(bmain, (Object *)self, false, clear_proxy);
+ }
+ else {
+ id_make_local(bmain, self, false, false);
+ }
- ID *ret_id = self->newid ? self->newid : self;
- BKE_id_clear_newpoin(self);
- return ret_id;
+ ID *ret_id = self->newid ? self->newid : self;
+ BKE_id_clear_newpoin(self);
+ return ret_id;
}
-
static AnimData *rna_ID_animation_data_create(ID *id, Main *bmain)
{
- AnimData *adt = BKE_animdata_add_id(id);
- DEG_relations_tag_update(bmain);
- return adt;
+ AnimData *adt = BKE_animdata_add_id(id);
+ DEG_relations_tag_update(bmain);
+ return adt;
}
static void rna_ID_animation_data_free(ID *id, Main *bmain)
{
- BKE_animdata_free(id, true);
- DEG_relations_tag_update(bmain);
+ BKE_animdata_free(id, true);
+ DEG_relations_tag_update(bmain);
}
-#ifdef WITH_PYTHON
+# ifdef WITH_PYTHON
void **rna_ID_instance(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
- return &id->py_instance;
+ ID *id = (ID *)ptr->data;
+ return &id->py_instance;
}
-#endif
+# endif
static void rna_IDPArray_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- IDProperty *prop = (IDProperty *)ptr->data;
- rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
+ IDProperty *prop = (IDProperty *)ptr->data;
+ rna_iterator_array_begin(iter, IDP_IDPArray(prop), sizeof(IDProperty), prop->len, 0, NULL);
}
static int rna_IDPArray_length(PointerRNA *ptr)
{
- IDProperty *prop = (IDProperty *)ptr->data;
- return prop->len;
+ IDProperty *prop = (IDProperty *)ptr->data;
+ return prop->len;
}
int rna_IDMaterials_assign_int(PointerRNA *ptr, int key, const PointerRNA *assign_ptr)
{
- ID *id = ptr->id.data;
- short *totcol = give_totcolp_id(id);
- Material *mat_id = assign_ptr->id.data;
- if (totcol && (key >= 0 && key < *totcol)) {
- BLI_assert(BKE_id_is_in_global_main(id));
- BLI_assert(BKE_id_is_in_global_main(&mat_id->id));
- assign_material_id(G_MAIN, id, mat_id, key + 1);
- return 1;
- }
- else {
- return 0;
- }
+ ID *id = ptr->id.data;
+ short *totcol = give_totcolp_id(id);
+ Material *mat_id = assign_ptr->id.data;
+ if (totcol && (key >= 0 && key < *totcol)) {
+ BLI_assert(BKE_id_is_in_global_main(id));
+ BLI_assert(BKE_id_is_in_global_main(&mat_id->id));
+ assign_material_id(G_MAIN, id, mat_id, key + 1);
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
static void rna_IDMaterials_append_id(ID *id, Main *bmain, Material *ma)
{
- BKE_material_append_id(bmain, id, ma);
+ BKE_material_append_id(bmain, id, ma);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
- WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
+ WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
}
static Material *rna_IDMaterials_pop_id(
- ID *id, Main *bmain, ReportList *reports, int index_i, bool remove_material_slot)
+ ID *id, Main *bmain, ReportList *reports, int index_i, bool remove_material_slot)
{
- Material *ma;
- short *totcol = give_totcolp_id(id);
- const short totcol_orig = *totcol;
- if (index_i < 0) {
- index_i += (*totcol);
- }
+ Material *ma;
+ short *totcol = give_totcolp_id(id);
+ const short totcol_orig = *totcol;
+ if (index_i < 0) {
+ index_i += (*totcol);
+ }
- if ((index_i < 0) || (index_i >= (*totcol))) {
- BKE_report(reports, RPT_ERROR, "Index out of range");
- return NULL;
- }
+ if ((index_i < 0) || (index_i >= (*totcol))) {
+ BKE_report(reports, RPT_ERROR, "Index out of range");
+ return NULL;
+ }
- ma = BKE_material_pop_id(bmain, id, index_i, remove_material_slot);
+ ma = BKE_material_pop_id(bmain, id, index_i, remove_material_slot);
- if (*totcol == totcol_orig) {
- BKE_report(reports, RPT_ERROR, "No material to removed");
- return NULL;
- }
+ if (*totcol == totcol_orig) {
+ BKE_report(reports, RPT_ERROR, "No material to removed");
+ return NULL;
+ }
- DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
- WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
+ WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
- return ma;
+ return ma;
}
static void rna_IDMaterials_clear_id(ID *id, Main *bmain, bool remove_material_slot)
{
- BKE_material_clear_id(bmain, id, remove_material_slot);
+ BKE_material_clear_id(bmain, id, remove_material_slot);
- DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
- WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, id);
+ WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, id);
}
static void rna_Library_filepath_set(PointerRNA *ptr, const char *value)
{
- Library *lib = (Library *)ptr->data;
- BLI_assert(BKE_id_is_in_global_main(&lib->id));
- BKE_library_filepath_set(G_MAIN, lib, value);
+ Library *lib = (Library *)ptr->data;
+ BLI_assert(BKE_id_is_in_global_main(&lib->id));
+ BKE_library_filepath_set(G_MAIN, lib, value);
}
/* ***** ImagePreview ***** */
static void rna_ImagePreview_is_custom_set(PointerRNA *ptr, int value, enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) || (!value && !(prv_img->flag[size] & PRV_USER_EDITED))) {
- return;
- }
+ if ((value && (prv_img->flag[size] & PRV_USER_EDITED)) ||
+ (!value && !(prv_img->flag[size] & PRV_USER_EDITED))) {
+ return;
+ }
- if (value)
- prv_img->flag[size] |= PRV_USER_EDITED;
- else
- prv_img->flag[size] &= ~PRV_USER_EDITED;
+ if (value)
+ prv_img->flag[size] |= PRV_USER_EDITED;
+ else
+ prv_img->flag[size] &= ~PRV_USER_EDITED;
- prv_img->flag[size] |= PRV_CHANGED;
+ prv_img->flag[size] |= PRV_CHANGED;
- BKE_previewimg_clear_single(prv_img, size);
+ BKE_previewimg_clear_single(prv_img, size);
}
static void rna_ImagePreview_size_get(PointerRNA *ptr, int *values, enum eIconSizes size)
{
- ID *id = (ID *)ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = (ID *)ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- BKE_previewimg_ensure(prv_img, size);
+ BKE_previewimg_ensure(prv_img, size);
- values[0] = prv_img->w[size];
- values[1] = prv_img->h[size];
+ values[0] = prv_img->w[size];
+ values[1] = prv_img->h[size];
}
static void rna_ImagePreview_size_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
{
- ID *id = (ID *)ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = (ID *)ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- BKE_previewimg_clear_single(prv_img, size);
+ BKE_previewimg_clear_single(prv_img, size);
- if (values[0] && values[1]) {
- prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect");
+ if (values[0] && values[1]) {
+ prv_img->rect[size] = MEM_callocN(values[0] * values[1] * sizeof(unsigned int), "prv_rect");
- prv_img->w[size] = values[0];
- prv_img->h[size] = values[1];
- }
+ prv_img->w[size] = values[0];
+ prv_img->h[size] = values[1];
+ }
- prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
+ prv_img->flag[size] |= (PRV_CHANGED | PRV_USER_EDITED);
}
-
-static int rna_ImagePreview_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION], enum eIconSizes size)
+static int rna_ImagePreview_pixels_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION],
+ enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- BKE_previewimg_ensure(prv_img, size);
+ BKE_previewimg_ensure(prv_img, size);
- length[0] = prv_img->w[size] * prv_img->h[size];
+ length[0] = prv_img->w[size] * prv_img->h[size];
- return length[0];
+ return length[0];
}
static void rna_ImagePreview_pixels_get(PointerRNA *ptr, int *values, enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- BKE_previewimg_ensure(prv_img, size);
+ BKE_previewimg_ensure(prv_img, size);
- memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
+ memcpy(values, prv_img->rect[size], prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
}
static void rna_ImagePreview_pixels_set(PointerRNA *ptr, const int *values, enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
- prv_img->flag[size] |= PRV_USER_EDITED;
+ memcpy(prv_img->rect[size], values, prv_img->w[size] * prv_img->h[size] * sizeof(unsigned int));
+ prv_img->flag[size] |= PRV_USER_EDITED;
}
-
-static int rna_ImagePreview_pixels_float_get_length(
- PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION], enum eIconSizes size)
+static int rna_ImagePreview_pixels_float_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION],
+ enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- BLI_assert(sizeof(unsigned int) == 4);
+ BLI_assert(sizeof(unsigned int) == 4);
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- BKE_previewimg_ensure(prv_img, size);
+ BKE_previewimg_ensure(prv_img, size);
- length[0] = prv_img->w[size] * prv_img->h[size] * 4;
+ length[0] = prv_img->w[size] * prv_img->h[size] * 4;
- return length[0];
+ return length[0];
}
static void rna_ImagePreview_pixels_float_get(PointerRNA *ptr, float *values, enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- unsigned char *data = (unsigned char *)prv_img->rect[size];
- const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
- size_t i;
+ unsigned char *data = (unsigned char *)prv_img->rect[size];
+ const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
+ size_t i;
- BLI_assert(sizeof(unsigned int) == 4);
+ BLI_assert(sizeof(unsigned int) == 4);
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- BKE_previewimg_ensure(prv_img, size);
+ BKE_previewimg_ensure(prv_img, size);
- for (i = 0; i < len; i++) {
- values[i] = data[i] * (1.0f / 255.0f);
- }
+ for (i = 0; i < len; i++) {
+ values[i] = data[i] * (1.0f / 255.0f);
+ }
}
-static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr, const float *values, enum eIconSizes size)
+static void rna_ImagePreview_pixels_float_set(PointerRNA *ptr,
+ const float *values,
+ enum eIconSizes size)
{
- ID *id = ptr->id.data;
- PreviewImage *prv_img = (PreviewImage *)ptr->data;
+ ID *id = ptr->id.data;
+ PreviewImage *prv_img = (PreviewImage *)ptr->data;
- unsigned char *data = (unsigned char *)prv_img->rect[size];
- const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
- size_t i;
+ unsigned char *data = (unsigned char *)prv_img->rect[size];
+ const size_t len = prv_img->w[size] * prv_img->h[size] * 4;
+ size_t i;
- BLI_assert(sizeof(unsigned int) == 4);
+ BLI_assert(sizeof(unsigned int) == 4);
- if (id != NULL) {
- BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
- }
+ if (id != NULL) {
+ BLI_assert(prv_img == BKE_previewimg_id_ensure(id));
+ }
- for (i = 0; i < len; i++) {
- data[i] = unit_float_to_uchar_clamp(values[i]);
- }
- prv_img->flag[size] |= PRV_USER_EDITED;
+ for (i = 0; i < len; i++) {
+ data[i] = unit_float_to_uchar_clamp(values[i]);
+ }
+ prv_img->flag[size] |= PRV_USER_EDITED;
}
-
static void rna_ImagePreview_is_image_custom_set(PointerRNA *ptr, bool value)
{
- rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_size_get(PointerRNA *ptr, int *values)
{
- rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_size_get(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_size_set(PointerRNA *ptr, const int *values)
{
- rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_size_set(ptr, values, ICON_SIZE_PREVIEW);
}
-static int rna_ImagePreview_image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_ImagePreview_image_pixels_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW);
+ return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_get(PointerRNA *ptr, int *values)
{
- rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_set(PointerRNA *ptr, const int *values)
{
- rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_PREVIEW);
}
-static int rna_ImagePreview_image_pixels_float_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_ImagePreview_image_pixels_float_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW);
+ return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_float_get(PointerRNA *ptr, float *values)
{
- rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_PREVIEW);
}
static void rna_ImagePreview_image_pixels_float_set(PointerRNA *ptr, const float *values)
{
- rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW);
+ rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_PREVIEW);
}
-
static void rna_ImagePreview_is_icon_custom_set(PointerRNA *ptr, bool value)
{
- rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON);
+ rna_ImagePreview_is_custom_set(ptr, value, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_size_get(PointerRNA *ptr, int *values)
{
- rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON);
+ rna_ImagePreview_size_get(ptr, values, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_size_set(PointerRNA *ptr, const int *values)
{
- rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON);
+ rna_ImagePreview_size_set(ptr, values, ICON_SIZE_ICON);
}
-static int rna_ImagePreview_icon_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_ImagePreview_icon_pixels_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON);
+ return rna_ImagePreview_pixels_get_length(ptr, length, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_get(PointerRNA *ptr, int *values)
{
- rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON);
+ rna_ImagePreview_pixels_get(ptr, values, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_set(PointerRNA *ptr, const int *values)
{
- rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON);
+ rna_ImagePreview_pixels_set(ptr, values, ICON_SIZE_ICON);
}
-static int rna_ImagePreview_icon_pixels_float_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_ImagePreview_icon_pixels_float_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON);
+ return rna_ImagePreview_pixels_float_get_length(ptr, length, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_float_get(PointerRNA *ptr, float *values)
{
- rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON);
+ rna_ImagePreview_pixels_float_get(ptr, values, ICON_SIZE_ICON);
}
static void rna_ImagePreview_icon_pixels_float_set(PointerRNA *ptr, const float *values)
{
- rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON);
+ rna_ImagePreview_pixels_float_set(ptr, values, ICON_SIZE_ICON);
}
-
static int rna_ImagePreview_icon_id_get(PointerRNA *ptr)
{
- /* Using a callback here allows us to only generate icon matching that preview when icon_id is requested. */
- return BKE_icon_preview_ensure(ptr->id.data, (PreviewImage *)(ptr->data));
+ /* Using a callback here allows us to only generate icon matching that preview when icon_id is requested. */
+ return BKE_icon_preview_ensure(ptr->id.data, (PreviewImage *)(ptr->data));
}
static void rna_ImagePreview_icon_reload(PreviewImage *prv)
{
- /* will lazy load on next use, but only in case icon is not user-modified! */
- if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) && !(prv->flag[ICON_SIZE_PREVIEW] & PRV_USER_EDITED)) {
- BKE_previewimg_clear(prv);
- }
+ /* will lazy load on next use, but only in case icon is not user-modified! */
+ if (!(prv->flag[ICON_SIZE_ICON] & PRV_USER_EDITED) &&
+ !(prv->flag[ICON_SIZE_PREVIEW] & PRV_USER_EDITED)) {
+ BKE_previewimg_clear(prv);
+ }
}
static PointerRNA rna_IDPreview_get(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->data;
- PreviewImage *prv_img = BKE_previewimg_id_ensure(id);
+ ID *id = (ID *)ptr->data;
+ PreviewImage *prv_img = BKE_previewimg_id_ensure(id);
- return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img);
+ return rna_pointer_inherit_refine(ptr, &RNA_ImagePreview, prv_img);
}
static IDProperty *rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr, bool UNUSED(create))
{
- if (ptr == NULL) {
- return NULL;
- }
- return ptr->data;
+ if (ptr == NULL) {
+ return NULL;
+ }
+ return ptr->data;
}
static void rna_Library_version_get(PointerRNA *ptr, int *value)
{
- Library *lib = (Library *)ptr->data;
- value[0] = lib->versionfile / 100;
- value[1] = lib->versionfile % 100;
- value[2] = lib->subversionfile;
+ Library *lib = (Library *)ptr->data;
+ value[0] = lib->versionfile / 100;
+ value[1] = lib->versionfile % 100;
+ value[2] = lib->subversionfile;
}
#else
static void rna_def_ID_properties(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* this is struct is used for holding the virtual
- * PropertyRNA's for ID properties */
- srna = RNA_def_struct(brna, "PropertyGroupItem", NULL);
- RNA_def_struct_sdna(srna, "IDProperty");
- RNA_def_struct_ui_text(srna, "ID Property", "Property that stores arbitrary, user defined properties");
-
- /* IDP_STRING */
- prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
-
- /* IDP_INT */
- prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
-
- prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_array(prop, 1);
-
- /* IDP_FLOAT */
- prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
-
- prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_array(prop, 1);
-
- /* IDP_DOUBLE */
- prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
-
- prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_array(prop, 1);
-
- /* IDP_GROUP */
- prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "PropertyGroup");
-
- prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_struct_type(prop, "PropertyGroup");
-
- prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "PropertyGroup");
- RNA_def_property_collection_funcs(prop, "rna_IDPArray_begin", "rna_iterator_array_next", "rna_iterator_array_end",
- "rna_iterator_array_get", "rna_IDPArray_length", NULL, NULL, NULL);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
-
- /* never tested, maybe its useful to have this? */
-#if 0
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
- RNA_def_struct_name_property(srna, prop);
-#endif
-
- /* IDP_ID */
- prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY | PROP_NEVER_UNLINK);
- RNA_def_property_struct_type(prop, "ID");
-
-
- /* ID property groups > level 0, since level 0 group is merged
- * with native RNA properties. the builtin_properties will take
- * care of the properties here */
- srna = RNA_def_struct(brna, "PropertyGroup", NULL);
- RNA_def_struct_sdna(srna, "IDPropertyGroup");
- RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
- RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
- RNA_def_struct_register_funcs(srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL);
- RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
-
- /* important so python types can have their name used in list views
- * however this isn't prefect because it overrides how python would set the name
- * when we only really want this so RNA_def_struct_name_property() is set to something useful */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
- RNA_def_struct_name_property(srna, prop);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* this is struct is used for holding the virtual
+ * PropertyRNA's for ID properties */
+ srna = RNA_def_struct(brna, "PropertyGroupItem", NULL);
+ RNA_def_struct_sdna(srna, "IDProperty");
+ RNA_def_struct_ui_text(
+ srna, "ID Property", "Property that stores arbitrary, user defined properties");
+
+ /* IDP_STRING */
+ prop = RNA_def_property(srna, "string", PROP_STRING, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+
+ /* IDP_INT */
+ prop = RNA_def_property(srna, "int", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+
+ prop = RNA_def_property(srna, "int_array", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 1);
+
+ /* IDP_FLOAT */
+ prop = RNA_def_property(srna, "float", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+
+ prop = RNA_def_property(srna, "float_array", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 1);
+
+ /* IDP_DOUBLE */
+ prop = RNA_def_property(srna, "double", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+
+ prop = RNA_def_property(srna, "double_array", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 1);
+
+ /* IDP_GROUP */
+ prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "PropertyGroup");
+
+ prop = RNA_def_property(srna, "collection", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_struct_type(prop, "PropertyGroup");
+
+ prop = RNA_def_property(srna, "idp_array", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "PropertyGroup");
+ RNA_def_property_collection_funcs(prop,
+ "rna_IDPArray_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_IDPArray_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+
+ /* never tested, maybe its useful to have this? */
+# if 0
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
+ RNA_def_struct_name_property(srna, prop);
+# endif
+
+ /* IDP_ID */
+ prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY | PROP_NEVER_UNLINK);
+ RNA_def_property_struct_type(prop, "ID");
+
+ /* ID property groups > level 0, since level 0 group is merged
+ * with native RNA properties. the builtin_properties will take
+ * care of the properties here */
+ srna = RNA_def_struct(brna, "PropertyGroup", NULL);
+ RNA_def_struct_sdna(srna, "IDPropertyGroup");
+ RNA_def_struct_ui_text(srna, "ID Property Group", "Group of ID properties");
+ RNA_def_struct_idprops_func(srna, "rna_PropertyGroup_idprops");
+ RNA_def_struct_register_funcs(
+ srna, "rna_PropertyGroup_register", "rna_PropertyGroup_unregister", NULL);
+ RNA_def_struct_refine_func(srna, "rna_PropertyGroup_refine");
+
+ /* important so python types can have their name used in list views
+ * however this isn't prefect because it overrides how python would set the name
+ * when we only really want this so RNA_def_struct_name_property() is set to something useful */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_ui_text(prop, "Name", "Unique name used in the code and scripting");
+ RNA_def_struct_name_property(srna, prop);
}
-
static void rna_def_ID_materials(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* for mesh/mball/curve materials */
- srna = RNA_def_struct(brna, "IDMaterials", NULL);
- RNA_def_struct_sdna(srna, "ID");
- RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
-
- func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Add a new material to the data-block");
- parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Remove a material from the data-block");
- parm = RNA_def_int(func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
- RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
- parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Remove all materials from the data-block");
- RNA_def_boolean(func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* for mesh/mball/curve materials */
+ srna = RNA_def_struct(brna, "IDMaterials", NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "ID Materials", "Collection of materials");
+
+ func = RNA_def_function(srna, "append", "rna_IDMaterials_append_id");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add a new material to the data-block");
+ parm = RNA_def_pointer(func, "material", "Material", "", "Material to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "pop", "rna_IDMaterials_pop_id");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Remove a material from the data-block");
+ parm = RNA_def_int(
+ func, "index", -1, -MAXMAT, MAXMAT, "", "Index of material to remove", 0, MAXMAT);
+ RNA_def_boolean(
+ func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
+ parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "clear", "rna_IDMaterials_clear_id");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Remove all materials from the data-block");
+ RNA_def_boolean(
+ func, "update_data", 0, "", "Update data by re-adjusting the material slots assigned");
}
static void rna_def_image_preview(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ImagePreview", NULL);
- RNA_def_struct_sdna(srna, "PreviewImage");
- RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");
-
- prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set");
- RNA_def_property_ui_text(prop, "Custom Image", "True if this preview image has been modified by py script,"
- "and is no more auto-generated by Blender");
-
- prop = RNA_def_int_vector(srna, "image_size", 2, NULL, 0, 0, "Image Size",
- "Width and height in pixels", 0, 0);
- RNA_def_property_subtype(prop, PROP_PIXEL);
- RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL);
-
- prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_multi_array(prop, 1, NULL);
- RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits)");
- RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
- RNA_def_property_int_funcs(prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);
-
- prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_multi_array(prop, 1, NULL);
- RNA_def_property_ui_text(prop, "Float Image Pixels",
- "Image pixels components, as floats (RGBA concatenated values)");
- RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
- RNA_def_property_float_funcs(prop, "rna_ImagePreview_image_pixels_float_get",
- "rna_ImagePreview_image_pixels_float_set", NULL);
-
-
- prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
- RNA_def_property_ui_text(prop, "Custom Icon", "True if this preview icon has been modified by py script,"
- "and is no more auto-generated by Blender");
-
- prop = RNA_def_int_vector(srna, "icon_size", 2, NULL, 0, 0, "Icon Size",
- "Width and height in pixels", 0, 0);
- RNA_def_property_subtype(prop, PROP_PIXEL);
- RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL);
-
- prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_multi_array(prop, 1, NULL);
- RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits)");
- RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
- RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);
-
- prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_multi_array(prop, 1, NULL);
- RNA_def_property_ui_text(prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
- RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
- RNA_def_property_float_funcs(prop, "rna_ImagePreview_icon_pixels_float_get",
- "rna_ImagePreview_icon_pixels_float_set", NULL);
-
- prop = RNA_def_int(srna, "icon_id", 0, INT_MIN, INT_MAX, "Icon ID",
- "Unique integer identifying this preview as an icon (zero means invalid)", INT_MIN, INT_MAX);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL);
-
- func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
- RNA_def_function_ui_description(func, "Reload the preview from its source path");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ImagePreview", NULL);
+ RNA_def_struct_sdna(srna, "PreviewImage");
+ RNA_def_struct_ui_text(srna, "Image Preview", "Preview image and icon");
+
+ prop = RNA_def_property(srna, "is_image_custom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_PREVIEW]", PRV_USER_EDITED);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_image_custom_set");
+ RNA_def_property_ui_text(prop,
+ "Custom Image",
+ "True if this preview image has been modified by py script,"
+ "and is no more auto-generated by Blender");
+
+ prop = RNA_def_int_vector(
+ srna, "image_size", 2, NULL, 0, 0, "Image Size", "Width and height in pixels", 0, 0);
+ RNA_def_property_subtype(prop, PROP_PIXEL);
+ RNA_def_property_int_funcs(
+ prop, "rna_ImagePreview_image_size_get", "rna_ImagePreview_image_size_set", NULL);
+
+ prop = RNA_def_property(srna, "image_pixels", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(prop, "Image Pixels", "Image pixels, as bytes (always RGBA 32bits)");
+ RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_get_length");
+ RNA_def_property_int_funcs(
+ prop, "rna_ImagePreview_image_pixels_get", "rna_ImagePreview_image_pixels_set", NULL);
+
+ prop = RNA_def_property(srna, "image_pixels_float", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(
+ prop, "Float Image Pixels", "Image pixels components, as floats (RGBA concatenated values)");
+ RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_image_pixels_float_get_length");
+ RNA_def_property_float_funcs(prop,
+ "rna_ImagePreview_image_pixels_float_get",
+ "rna_ImagePreview_image_pixels_float_set",
+ NULL);
+
+ prop = RNA_def_property(srna, "is_icon_custom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag[ICON_SIZE_ICON]", PRV_USER_EDITED);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ImagePreview_is_icon_custom_set");
+ RNA_def_property_ui_text(prop,
+ "Custom Icon",
+ "True if this preview icon has been modified by py script,"
+ "and is no more auto-generated by Blender");
+
+ prop = RNA_def_int_vector(
+ srna, "icon_size", 2, NULL, 0, 0, "Icon Size", "Width and height in pixels", 0, 0);
+ RNA_def_property_subtype(prop, PROP_PIXEL);
+ RNA_def_property_int_funcs(
+ prop, "rna_ImagePreview_icon_size_get", "rna_ImagePreview_icon_size_set", NULL);
+
+ prop = RNA_def_property(srna, "icon_pixels", PROP_INT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(prop, "Icon Pixels", "Icon pixels, as bytes (always RGBA 32bits)");
+ RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_get_length");
+ RNA_def_property_int_funcs(
+ prop, "rna_ImagePreview_icon_pixels_get", "rna_ImagePreview_icon_pixels_set", NULL);
+
+ prop = RNA_def_property(srna, "icon_pixels_float", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(
+ prop, "Float Icon Pixels", "Icon pixels components, as floats (RGBA concatenated values)");
+ RNA_def_property_dynamic_array_funcs(prop, "rna_ImagePreview_icon_pixels_float_get_length");
+ RNA_def_property_float_funcs(prop,
+ "rna_ImagePreview_icon_pixels_float_get",
+ "rna_ImagePreview_icon_pixels_float_set",
+ NULL);
+
+ prop = RNA_def_int(srna,
+ "icon_id",
+ 0,
+ INT_MIN,
+ INT_MAX,
+ "Icon ID",
+ "Unique integer identifying this preview as an icon (zero means invalid)",
+ INT_MIN,
+ INT_MAX);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_ImagePreview_icon_id_get", NULL, NULL);
+
+ func = RNA_def_function(srna, "reload", "rna_ImagePreview_icon_reload");
+ RNA_def_function_ui_description(func, "Reload the preview from its source path");
}
static void rna_def_ID_override_static_property_operation(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem static_override_property_operation_items[] = {
- {IDOVERRIDESTATIC_OP_NOOP, "NOOP", 0, "No-Op", "Does nothing, prevents adding actual overrides (NOT USED)"},
- {IDOVERRIDESTATIC_OP_REPLACE, "REPLACE", 0, "Replace", "Replace value of reference by overriding one"},
- {IDOVERRIDESTATIC_OP_ADD, "DIFF_ADD", 0, "Differential",
- "Stores and apply difference between reference and local value (NOT USED)"},
- {IDOVERRIDESTATIC_OP_SUBTRACT, "DIFF_SUB", 0, "Differential",
- "Stores and apply difference between reference and local value (NOT USED)"},
- {IDOVERRIDESTATIC_OP_MULTIPLY, "FACT_MULTIPLY", 0, "Factor",
- "Stores and apply multiplication factor between reference and local value (NOT USED)"},
- {IDOVERRIDESTATIC_OP_INSERT_AFTER, "INSERT_AFTER", 0, "Insert After",
- "Insert a new item into collection after the one referenced in subitem_reference_name or _index"},
- {IDOVERRIDESTATIC_OP_INSERT_BEFORE, "INSERT_BEFORE", 0, "Insert Before",
- "Insert a new item into collection after the one referenced in subitem_reference_name or _index (NOT USED)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem static_override_property_flag_items[] = {
- {IDOVERRIDESTATIC_FLAG_MANDATORY, "MANDATORY", 0, "Mandatory",
- "For templates, prevents the user from removing pre-defined operation (NOT USED)"},
- {IDOVERRIDESTATIC_FLAG_LOCKED, "LOCKED", 0, "Locked",
- "Prevents the user from modifying that override operation (NOT USED)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "IDOverrideStaticPropertyOperation", NULL);
- RNA_def_struct_ui_text(srna, "ID Static Override Property Operation",
- "Description of an override operation over an overridden property");
-
- prop = RNA_def_enum(srna, "operation", static_override_property_operation_items, IDOVERRIDESTATIC_OP_REPLACE,
- "Operation", "What override operation is performed");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
-
- prop = RNA_def_enum(srna, "flag", static_override_property_flag_items, 0,
- "Flags", "Optional flags (NOT USED)");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
-
- prop = RNA_def_string(srna, "subitem_reference_name", NULL, INT_MAX, "Subitem Reference Name",
- "Used to handle insertions into collection");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
- RNA_def_property_string_funcs(prop, "rna_ID_override_static_property_operation_refname_get",
- "rna_ID_override_static_property_operation_refname_length", NULL);
-
- prop = RNA_def_string(srna, "subitem_local_name", NULL, INT_MAX, "Subitem Local Name",
- "Used to handle insertions into collection");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
- RNA_def_property_string_funcs(prop, "rna_ID_override_static_property_operation_locname_get",
- "rna_ID_override_static_property_operation_locname_length", NULL);
-
- prop = RNA_def_int(srna, "subitem_reference_index", -1, -1, INT_MAX, "Subitem Reference Index",
- "Used to handle insertions into collection", -1, INT_MAX);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
-
- prop = RNA_def_int(srna, "subitem_local_index", -1, -1, INT_MAX, "Subitem Local Index",
- "Used to handle insertions into collection", -1, INT_MAX);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem static_override_property_operation_items[] = {
+ {IDOVERRIDESTATIC_OP_NOOP,
+ "NOOP",
+ 0,
+ "No-Op",
+ "Does nothing, prevents adding actual overrides (NOT USED)"},
+ {IDOVERRIDESTATIC_OP_REPLACE,
+ "REPLACE",
+ 0,
+ "Replace",
+ "Replace value of reference by overriding one"},
+ {IDOVERRIDESTATIC_OP_ADD,
+ "DIFF_ADD",
+ 0,
+ "Differential",
+ "Stores and apply difference between reference and local value (NOT USED)"},
+ {IDOVERRIDESTATIC_OP_SUBTRACT,
+ "DIFF_SUB",
+ 0,
+ "Differential",
+ "Stores and apply difference between reference and local value (NOT USED)"},
+ {IDOVERRIDESTATIC_OP_MULTIPLY,
+ "FACT_MULTIPLY",
+ 0,
+ "Factor",
+ "Stores and apply multiplication factor between reference and local value (NOT USED)"},
+ {IDOVERRIDESTATIC_OP_INSERT_AFTER,
+ "INSERT_AFTER",
+ 0,
+ "Insert After",
+ "Insert a new item into collection after the one referenced in subitem_reference_name or "
+ "_index"},
+ {IDOVERRIDESTATIC_OP_INSERT_BEFORE,
+ "INSERT_BEFORE",
+ 0,
+ "Insert Before",
+ "Insert a new item into collection after the one referenced in subitem_reference_name or "
+ "_index (NOT USED)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem static_override_property_flag_items[] = {
+ {IDOVERRIDESTATIC_FLAG_MANDATORY,
+ "MANDATORY",
+ 0,
+ "Mandatory",
+ "For templates, prevents the user from removing pre-defined operation (NOT USED)"},
+ {IDOVERRIDESTATIC_FLAG_LOCKED,
+ "LOCKED",
+ 0,
+ "Locked",
+ "Prevents the user from modifying that override operation (NOT USED)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "IDOverrideStaticPropertyOperation", NULL);
+ RNA_def_struct_ui_text(srna,
+ "ID Static Override Property Operation",
+ "Description of an override operation over an overridden property");
+
+ prop = RNA_def_enum(srna,
+ "operation",
+ static_override_property_operation_items,
+ IDOVERRIDESTATIC_OP_REPLACE,
+ "Operation",
+ "What override operation is performed");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+
+ prop = RNA_def_enum(
+ srna, "flag", static_override_property_flag_items, 0, "Flags", "Optional flags (NOT USED)");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+
+ prop = RNA_def_string(srna,
+ "subitem_reference_name",
+ NULL,
+ INT_MAX,
+ "Subitem Reference Name",
+ "Used to handle insertions into collection");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+ RNA_def_property_string_funcs(prop,
+ "rna_ID_override_static_property_operation_refname_get",
+ "rna_ID_override_static_property_operation_refname_length",
+ NULL);
+
+ prop = RNA_def_string(srna,
+ "subitem_local_name",
+ NULL,
+ INT_MAX,
+ "Subitem Local Name",
+ "Used to handle insertions into collection");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+ RNA_def_property_string_funcs(prop,
+ "rna_ID_override_static_property_operation_locname_get",
+ "rna_ID_override_static_property_operation_locname_length",
+ NULL);
+
+ prop = RNA_def_int(srna,
+ "subitem_reference_index",
+ -1,
+ -1,
+ INT_MAX,
+ "Subitem Reference Index",
+ "Used to handle insertions into collection",
+ -1,
+ INT_MAX);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+
+ prop = RNA_def_int(srna,
+ "subitem_local_index",
+ -1,
+ -1,
+ INT_MAX,
+ "Subitem Local Index",
+ "Used to handle insertions into collection",
+ -1,
+ INT_MAX);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
}
static void rna_def_ID_override_static_property(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "IDOverrideStaticProperty", NULL);
- RNA_def_struct_ui_text(srna, "ID Static Override Property", "Description of an overridden property");
+ srna = RNA_def_struct(brna, "IDOverrideStaticProperty", NULL);
+ RNA_def_struct_ui_text(
+ srna, "ID Static Override Property", "Description of an overridden property");
- /* String pointer, we *should* add get/set/etc. But NULL rna_path would be a nasty bug anyway... */
- prop = RNA_def_string(srna, "rna_path", NULL, INT_MAX, "RNA Path",
- "RNA path leading to that property, from owning ID");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
+ /* String pointer, we *should* add get/set/etc. But NULL rna_path would be a nasty bug anyway... */
+ prop = RNA_def_string(srna,
+ "rna_path",
+ NULL,
+ INT_MAX,
+ "RNA Path",
+ "RNA path leading to that property, from owning ID");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* For now. */
- RNA_def_collection(srna, "operations", "IDOverrideStaticPropertyOperation", "Operations",
- "List of overriding operations for a property");
+ RNA_def_collection(srna,
+ "operations",
+ "IDOverrideStaticPropertyOperation",
+ "Operations",
+ "List of overriding operations for a property");
- rna_def_ID_override_static_property_operation(brna);
+ rna_def_ID_override_static_property_operation(brna);
}
static void rna_def_ID_override_static(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "IDOverrideStatic", NULL);
- RNA_def_struct_ui_text(srna, "ID Static Override", "Struct gathering all data needed by statically overridden IDs");
+ srna = RNA_def_struct(brna, "IDOverrideStatic", NULL);
+ RNA_def_struct_ui_text(
+ srna, "ID Static Override", "Struct gathering all data needed by statically overridden IDs");
- RNA_def_pointer(srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override");
+ RNA_def_pointer(
+ srna, "reference", "ID", "Reference ID", "Linked ID used as reference by this override");
- prop = RNA_def_boolean(srna, "auto_generate", true, "Auto Generate Override",
- "Automatically generate overriding operations by detecting changes in properties");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", STATICOVERRIDE_AUTO);
+ prop = RNA_def_boolean(
+ srna,
+ "auto_generate",
+ true,
+ "Auto Generate Override",
+ "Automatically generate overriding operations by detecting changes in properties");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", STATICOVERRIDE_AUTO);
- RNA_def_collection(srna, "properties", "IDOverrideStaticProperty", "Properties",
- "List of overridden properties");
+ RNA_def_collection(srna,
+ "properties",
+ "IDOverrideStaticProperty",
+ "Properties",
+ "List of overridden properties");
- rna_def_ID_override_static_property(brna);
+ rna_def_ID_override_static_property(brna);
}
static void rna_def_ID(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop, *parm;
-
- static const EnumPropertyItem update_flag_items[] = {
- {ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
- {ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
- {ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ID", NULL);
- RNA_def_struct_ui_text(srna, "ID",
- "Base type for data-blocks, defining a unique name, linking from other libraries "
- "and garbage collection");
- RNA_def_struct_flag(srna, STRUCT_ID | STRUCT_ID_REFCOUNT);
- RNA_def_struct_refine_func(srna, "rna_ID_refine");
- RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Unique data-block ID name");
- RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_editable_func(prop, "rna_ID_name_editable");
- RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Full Name", "Unique data-block ID name, including library one is any");
- RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", NULL);
- RNA_def_property_string_maxlength(prop, MAX_ID_FULL_NAME);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Is Evaluated",
- "Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file");
- RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_ui_text(prop, "Original ID",
- "Actual data-block from .blend file (Main database) that generated that evaluated one");
- RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
-
- prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "us");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");
-
- prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
- RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
- RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
-
- prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_DOIT);
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
- RNA_def_property_ui_text(prop, "Tag",
- "Tools can use this to tag data for their own purposes "
- "(initial state is undefined)");
-
- prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
-
- prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "lib");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");
-
- prop = RNA_def_pointer(srna, "override_static", "IDOverrideStatic", "Static Override", "Static override data");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_pointer(srna, "preview", "ImagePreview", "Preview",
- "Preview image and icon of this data-block (None if not supported for this type of data)");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL);
-
- /* functions */
- func = RNA_def_function(srna, "copy", "rna_ID_copy");
- RNA_def_function_ui_description(func, "Create a copy of this data-block (not supported for all data-blocks)");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "override_create", "rna_ID_override_create");
- RNA_def_function_ui_description(func, "Create an overridden local copy of this linked data-block (not supported for all data-blocks)");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
- RNA_def_function_ui_description(func, "Clear the user count of a data-block so its not saved, "
- "on reload the data will be removed");
-
- func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap");
- RNA_def_function_ui_description(func, "Replace all usage in the .blend file of this ID by new given one");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "make_local", "rna_ID_make_local");
- RNA_def_function_ui_description(func, "Make this datablock local, return local one "
- "(may be a copy of the original, in case it is also indirectly used)");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_boolean(func, "clear_proxy", true, "",
- "Whether to clear proxies (the default behavior, "
- "note that if object has to be duplicated to be made local, proxies are always cleared)");
- parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID");
- RNA_def_function_ui_description(func, "Count the number of times that ID uses/references given one");
- parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "count", 0, 0, INT_MAX,
- "", "Number of usages/references of given id by current data-block", 0, INT_MAX);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Create animation data to this ID, note that not all ID types support this");
- parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Clear animation on this this ID");
-
- func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func,
- "Tag the ID to update its display data, "
- "e.g. when calling :class:`bpy.types.Scene.update`");
- RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
-
-#ifdef WITH_PYTHON
- RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance");
-#endif
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop, *parm;
+
+ static const EnumPropertyItem update_flag_items[] = {
+ {ID_RECALC_TRANSFORM, "OBJECT", 0, "Object", ""},
+ {ID_RECALC_GEOMETRY, "DATA", 0, "Data", ""},
+ {ID_RECALC_ANIMATION, "TIME", 0, "Time", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ID", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "ID",
+ "Base type for data-blocks, defining a unique name, linking from other libraries "
+ "and garbage collection");
+ RNA_def_struct_flag(srna, STRUCT_ID | STRUCT_ID_REFCOUNT);
+ RNA_def_struct_refine_func(srna, "rna_ID_refine");
+ RNA_def_struct_idprops_func(srna, "rna_ID_idprops");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique data-block ID name");
+ RNA_def_property_string_funcs(prop, "rna_ID_name_get", "rna_ID_name_length", "rna_ID_name_set");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_editable_func(prop, "rna_ID_name_editable");
+ RNA_def_property_update(prop, NC_ID | NA_RENAME, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "name_full", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Full Name", "Unique data-block ID name, including library one is any");
+ RNA_def_property_string_funcs(prop, "rna_ID_name_full_get", "rna_ID_name_full_length", NULL);
+ RNA_def_property_string_maxlength(prop, MAX_ID_FULL_NAME);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_evaluated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Is Evaluated",
+ "Whether this ID is runtime-only, evaluated data-block, or actual data from .blend file");
+ RNA_def_property_boolean_funcs(prop, "rna_ID_is_evaluated_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "original", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_ui_text(
+ prop,
+ "Original ID",
+ "Actual data-block from .blend file (Main database) that generated that evaluated one");
+ RNA_def_property_pointer_funcs(prop, "rna_ID_original_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
+
+ prop = RNA_def_property(srna, "users", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "us");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Users", "Number of times this data-block is referenced");
+
+ prop = RNA_def_property(srna, "use_fake_user", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIB_FAKEUSER);
+ RNA_def_property_ui_text(prop, "Fake User", "Save this data-block even if it has no users");
+ RNA_def_property_ui_icon(prop, ICON_FAKE_USER_OFF, true);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ID_fake_user_set");
+
+ prop = RNA_def_property(srna, "tag", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_DOIT);
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ RNA_def_property_ui_text(prop,
+ "Tag",
+ "Tools can use this to tag data for their own purposes "
+ "(initial state is undefined)");
+
+ prop = RNA_def_property(srna, "is_library_indirect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "tag", LIB_TAG_INDIRECT);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Indirect", "Is this ID block linked indirectly");
+
+ prop = RNA_def_property(srna, "library", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "lib");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Library", "Library file the data-block is linked from");
+
+ prop = RNA_def_pointer(
+ srna, "override_static", "IDOverrideStatic", "Static Override", "Static override data");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_pointer(
+ srna,
+ "preview",
+ "ImagePreview",
+ "Preview",
+ "Preview image and icon of this data-block (None if not supported for this type of data)");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_IDPreview_get", NULL, NULL, NULL);
+
+ /* functions */
+ func = RNA_def_function(srna, "copy", "rna_ID_copy");
+ RNA_def_function_ui_description(
+ func, "Create a copy of this data-block (not supported for all data-blocks)");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "id", "ID", "", "New copy of the ID");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "override_create", "rna_ID_override_create");
+ RNA_def_function_ui_description(func,
+ "Create an overridden local copy of this linked data-block (not "
+ "supported for all data-blocks)");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "id", "ID", "", "New overridden local copy of the ID");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "user_clear", "rna_ID_user_clear");
+ RNA_def_function_ui_description(func,
+ "Clear the user count of a data-block so its not saved, "
+ "on reload the data will be removed");
+
+ func = RNA_def_function(srna, "user_remap", "rna_ID_user_remap");
+ RNA_def_function_ui_description(
+ func, "Replace all usage in the .blend file of this ID by new given one");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "new_id", "ID", "", "New ID to use");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "make_local", "rna_ID_make_local");
+ RNA_def_function_ui_description(
+ func,
+ "Make this datablock local, return local one "
+ "(may be a copy of the original, in case it is also indirectly used)");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_boolean(
+ func,
+ "clear_proxy",
+ true,
+ "",
+ "Whether to clear proxies (the default behavior, "
+ "note that if object has to be duplicated to be made local, proxies are always cleared)");
+ parm = RNA_def_pointer(func, "id", "ID", "", "This ID, or the new ID if it was copied");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "user_of_id", "BKE_library_ID_use_ID");
+ RNA_def_function_ui_description(func,
+ "Count the number of times that ID uses/references given one");
+ parm = RNA_def_pointer(func, "id", "ID", "", "ID to count usages");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "count",
+ 0,
+ 0,
+ INT_MAX,
+ "",
+ "Number of usages/references of given id by current data-block",
+ 0,
+ INT_MAX);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "animation_data_create", "rna_ID_animation_data_create");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(
+ func, "Create animation data to this ID, note that not all ID types support this");
+ parm = RNA_def_pointer(func, "anim_data", "AnimData", "", "New animation data or NULL");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "animation_data_clear", "rna_ID_animation_data_free");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Clear animation on this this ID");
+
+ func = RNA_def_function(srna, "update_tag", "rna_ID_update_tag");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func,
+ "Tag the ID to update its display data, "
+ "e.g. when calling :class:`bpy.types.Scene.update`");
+ RNA_def_enum_flag(func, "refresh", update_flag_items, 0, "", "Type of updates to perform");
+
+# ifdef WITH_PYTHON
+ RNA_def_struct_register_funcs(srna, NULL, NULL, "rna_ID_instance");
+# endif
}
static void rna_def_library(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Library", "ID");
- RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
- RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
-
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Library");
- RNA_def_property_ui_text(prop, "Parent", "");
-
- prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
- RNA_def_property_ui_text(prop, "Packed File", "");
-
- prop = RNA_def_int_vector(srna, "version", 3, NULL, 0, INT_MAX,
- "Version", "Version of Blender the library .blend was saved with", 0, INT_MAX);
- RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_THICK_WRAP);
-
- func = RNA_def_function(srna, "reload", "WM_lib_reload");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Library", "ID");
+ RNA_def_struct_ui_text(srna, "Library", "External .blend file from which data is linked");
+ RNA_def_struct_ui_icon(srna, ICON_LIBRARY_DATA_DIRECT);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "File Path", "Path to the library .blend file");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Library_filepath_set");
+
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Library");
+ RNA_def_property_ui_text(prop, "Parent", "");
+
+ prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
+ RNA_def_property_ui_text(prop, "Packed File", "");
+
+ prop = RNA_def_int_vector(srna,
+ "version",
+ 3,
+ NULL,
+ 0,
+ INT_MAX,
+ "Version",
+ "Version of Blender the library .blend was saved with",
+ 0,
+ INT_MAX);
+ RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_THICK_WRAP);
+
+ func = RNA_def_function(srna, "reload", "WM_lib_reload");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks");
}
/**
@@ -1342,32 +1574,33 @@ static void rna_def_library(BlenderRNA *brna)
*/
static void rna_def_idproperty_wrap_ptr(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "IDPropertyWrapPtr", NULL);
- RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
+ srna = RNA_def_struct(brna, "IDPropertyWrapPtr", NULL);
+ RNA_def_struct_idprops_func(srna, "rna_IDPropertyWrapPtr_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
void RNA_def_ID(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- /* built-in unknown type */
- srna = RNA_def_struct(brna, "UnknownType", NULL);
- RNA_def_struct_ui_text(srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
+ /* built-in unknown type */
+ srna = RNA_def_struct(brna, "UnknownType", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Unknown Type", "Stub RNA type used for pointers to unknown or internal data");
- /* built-in any type */
- srna = RNA_def_struct(brna, "AnyType", NULL);
- RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
+ /* built-in any type */
+ srna = RNA_def_struct(brna, "AnyType", NULL);
+ RNA_def_struct_ui_text(srna, "Any Type", "RNA type used for pointers to any possible data");
- rna_def_ID(brna);
- rna_def_ID_override_static(brna);
- rna_def_image_preview(brna);
- rna_def_ID_properties(brna);
- rna_def_ID_materials(brna);
- rna_def_library(brna);
- rna_def_idproperty_wrap_ptr(brna);
+ rna_def_ID(brna);
+ rna_def_ID_override_static(brna);
+ rna_def_image_preview(brna);
+ rna_def_ID_properties(brna);
+ rna_def_ID_materials(brna);
+ rna_def_library(brna);
+ rna_def_idproperty_wrap_ptr(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c
index b1c5ef66958..541c2184a94 100644
--- a/source/blender/makesrna/intern/rna_access.c
+++ b/source/blender/makesrna/intern/rna_access.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
@@ -75,633 +74,646 @@ const PointerRNA PointerRNA_NULL = {{NULL}};
void RNA_init(void)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- BLENDER_RNA.structs_map = BLI_ghash_str_new_ex(__func__, 2048);
- BLENDER_RNA.structs_len = 0;
+ BLENDER_RNA.structs_map = BLI_ghash_str_new_ex(__func__, 2048);
+ BLENDER_RNA.structs_len = 0;
- for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
- if (!srna->cont.prophash) {
- srna->cont.prophash = BLI_ghash_str_new("RNA_init gh");
+ for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
+ if (!srna->cont.prophash) {
+ srna->cont.prophash = BLI_ghash_str_new("RNA_init gh");
- for (prop = srna->cont.properties.first; prop; prop = prop->next) {
- if (!(prop->flag_internal & PROP_INTERN_BUILTIN)) {
- BLI_ghash_insert(srna->cont.prophash, (void *)prop->identifier, prop);
- }
- }
- }
- BLI_assert(srna->flag & STRUCT_PUBLIC_NAMESPACE);
- BLI_ghash_insert(BLENDER_RNA.structs_map, (void *)srna->identifier, srna);
- BLENDER_RNA.structs_len += 1;
- }
+ for (prop = srna->cont.properties.first; prop; prop = prop->next) {
+ if (!(prop->flag_internal & PROP_INTERN_BUILTIN)) {
+ BLI_ghash_insert(srna->cont.prophash, (void *)prop->identifier, prop);
+ }
+ }
+ }
+ BLI_assert(srna->flag & STRUCT_PUBLIC_NAMESPACE);
+ BLI_ghash_insert(BLENDER_RNA.structs_map, (void *)srna->identifier, srna);
+ BLENDER_RNA.structs_len += 1;
+ }
}
void RNA_exit(void)
{
- StructRNA *srna;
+ StructRNA *srna;
- RNA_property_update_cache_free();
+ RNA_property_update_cache_free();
- for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
- if (srna->cont.prophash) {
- BLI_ghash_free(srna->cont.prophash, NULL, NULL);
- srna->cont.prophash = NULL;
- }
- }
+ for (srna = BLENDER_RNA.structs.first; srna; srna = srna->cont.next) {
+ if (srna->cont.prophash) {
+ BLI_ghash_free(srna->cont.prophash, NULL, NULL);
+ srna->cont.prophash = NULL;
+ }
+ }
- RNA_free(&BLENDER_RNA);
+ RNA_free(&BLENDER_RNA);
}
/* Pointer */
void RNA_main_pointer_create(struct Main *main, PointerRNA *r_ptr)
{
- r_ptr->id.data = NULL;
- r_ptr->type = &RNA_BlendData;
- r_ptr->data = main;
+ r_ptr->id.data = NULL;
+ r_ptr->type = &RNA_BlendData;
+ r_ptr->data = main;
}
void RNA_id_pointer_create(ID *id, PointerRNA *r_ptr)
{
- StructRNA *type, *idtype = NULL;
+ StructRNA *type, *idtype = NULL;
- if (id) {
- PointerRNA tmp = {{NULL}};
- tmp.data = id;
- idtype = rna_ID_refine(&tmp);
+ if (id) {
+ PointerRNA tmp = {{NULL}};
+ tmp.data = id;
+ idtype = rna_ID_refine(&tmp);
- while (idtype->refine) {
- type = idtype->refine(&tmp);
+ while (idtype->refine) {
+ type = idtype->refine(&tmp);
- if (type == idtype)
- break;
- else
- idtype = type;
- }
- }
+ if (type == idtype)
+ break;
+ else
+ idtype = type;
+ }
+ }
- r_ptr->id.data = id;
- r_ptr->type = idtype;
- r_ptr->data = id;
+ r_ptr->id.data = id;
+ r_ptr->type = idtype;
+ r_ptr->data = id;
}
void RNA_pointer_create(ID *id, StructRNA *type, void *data, PointerRNA *r_ptr)
{
#if 0 /* UNUSED */
- StructRNA *idtype = NULL;
+ StructRNA *idtype = NULL;
- if (id) {
- PointerRNA tmp = {{0}};
- tmp.data = id;
- idtype = rna_ID_refine(&tmp);
- }
+ if (id) {
+ PointerRNA tmp = {{0}};
+ tmp.data = id;
+ idtype = rna_ID_refine(&tmp);
+ }
#endif
- r_ptr->id.data = id;
- r_ptr->type = type;
- r_ptr->data = data;
+ r_ptr->id.data = id;
+ r_ptr->type = type;
+ r_ptr->data = data;
- if (data) {
- while (r_ptr->type && r_ptr->type->refine) {
- StructRNA *rtype = r_ptr->type->refine(r_ptr);
+ if (data) {
+ while (r_ptr->type && r_ptr->type->refine) {
+ StructRNA *rtype = r_ptr->type->refine(r_ptr);
- if (rtype == r_ptr->type)
- break;
- else
- r_ptr->type = rtype;
- }
- }
+ if (rtype == r_ptr->type)
+ break;
+ else
+ r_ptr->type = rtype;
+ }
+ }
}
bool RNA_pointer_is_null(const PointerRNA *ptr)
{
- return !((ptr->data != NULL) && (ptr->id.data != NULL) && (ptr->type != NULL));
+ return !((ptr->data != NULL) && (ptr->id.data != NULL) && (ptr->type != NULL));
}
static void rna_pointer_inherit_id(StructRNA *type, PointerRNA *parent, PointerRNA *ptr)
{
- if (type && type->flag & STRUCT_ID) {
- ptr->id.data = ptr->data;
- }
- else {
- ptr->id.data = parent->id.data;
- }
+ if (type && type->flag & STRUCT_ID) {
+ ptr->id.data = ptr->data;
+ }
+ else {
+ ptr->id.data = parent->id.data;
+ }
}
void RNA_blender_rna_pointer_create(PointerRNA *r_ptr)
{
- r_ptr->id.data = NULL;
- r_ptr->type = &RNA_BlenderRNA;
- r_ptr->data = &BLENDER_RNA;
+ r_ptr->id.data = NULL;
+ r_ptr->type = &RNA_BlenderRNA;
+ r_ptr->data = &BLENDER_RNA;
}
PointerRNA rna_pointer_inherit_refine(PointerRNA *ptr, StructRNA *type, void *data)
{
- if (data) {
- PointerRNA result;
- result.data = data;
- result.type = type;
- rna_pointer_inherit_id(type, ptr, &result);
+ if (data) {
+ PointerRNA result;
+ result.data = data;
+ result.type = type;
+ rna_pointer_inherit_id(type, ptr, &result);
- while (result.type->refine) {
- type = result.type->refine(&result);
+ while (result.type->refine) {
+ type = result.type->refine(&result);
- if (type == result.type)
- break;
- else
- result.type = type;
- }
- return result;
- }
- else {
- return PointerRNA_NULL;
- }
+ if (type == result.type)
+ break;
+ else
+ result.type = type;
+ }
+ return result;
+ }
+ else {
+ return PointerRNA_NULL;
+ }
}
void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr)
{
#if 0 /* works but this case if covered by more general code below. */
- if (RNA_struct_is_ID(ptr->type)) {
- /* simple case */
- RNA_id_pointer_create(ptr->id.data, r_ptr);
- }
- else
+ if (RNA_struct_is_ID(ptr->type)) {
+ /* simple case */
+ RNA_id_pointer_create(ptr->id.data, r_ptr);
+ }
+ else
#endif
- {
- StructRNA *base;
- PointerRNA t_ptr;
- *r_ptr = *ptr; /* initialize as the same in case cant recast */
+ {
+ StructRNA *base;
+ PointerRNA t_ptr;
+ *r_ptr = *ptr; /* initialize as the same in case cant recast */
- for (base = ptr->type->base; base; base = base->base) {
- t_ptr = rna_pointer_inherit_refine(ptr, base, ptr->data);
- if (t_ptr.type && t_ptr.type != ptr->type) {
- *r_ptr = t_ptr;
- }
- }
- }
+ for (base = ptr->type->base; base; base = base->base) {
+ t_ptr = rna_pointer_inherit_refine(ptr, base, ptr->data);
+ if (t_ptr.type && t_ptr.type != ptr->type) {
+ *r_ptr = t_ptr;
+ }
+ }
+ }
}
/* ID Properties */
static void rna_idproperty_touch(IDProperty *idprop)
{
- /* so the property is seen as 'set' by rna */
- idprop->flag &= ~IDP_FLAG_GHOST;
+ /* so the property is seen as 'set' by rna */
+ idprop->flag &= ~IDP_FLAG_GHOST;
}
static IDProperty *rna_idproperty_ui_container(PropertyRNA *prop)
{
- IDProperty *idprop;
+ IDProperty *idprop;
- for (idprop = ((IDProperty *)prop)->prev; idprop; idprop = idprop->prev) {
- if (STREQ(RNA_IDP_UI, idprop->name))
- break;
- }
+ for (idprop = ((IDProperty *)prop)->prev; idprop; idprop = idprop->prev) {
+ if (STREQ(RNA_IDP_UI, idprop->name))
+ break;
+ }
- if (idprop == NULL) {
- for (idprop = ((IDProperty *)prop)->next; idprop; idprop = idprop->next) {
- if (STREQ(RNA_IDP_UI, idprop->name))
- break;
- }
- }
+ if (idprop == NULL) {
+ for (idprop = ((IDProperty *)prop)->next; idprop; idprop = idprop->next) {
+ if (STREQ(RNA_IDP_UI, idprop->name))
+ break;
+ }
+ }
- return idprop;
+ return idprop;
}
/* return a UI local ID prop definition for this prop */
static IDProperty *rna_idproperty_ui(PropertyRNA *prop)
{
- IDProperty *idprop = rna_idproperty_ui_container(prop);
+ IDProperty *idprop = rna_idproperty_ui_container(prop);
- if (idprop) {
- return IDP_GetPropertyTypeFromGroup(idprop, ((IDProperty *)prop)->name, IDP_GROUP);
- }
+ if (idprop) {
+ return IDP_GetPropertyTypeFromGroup(idprop, ((IDProperty *)prop)->name, IDP_GROUP);
+ }
- return NULL;
+ return NULL;
}
/* return or create a UI local ID prop definition for this prop */
static IDProperty *rna_idproperty_ui_ensure(PointerRNA *ptr, PropertyRNA *prop, bool create)
{
- IDProperty *idprop = rna_idproperty_ui_container(prop);
- IDPropertyTemplate dummy = { 0 };
-
- if (idprop == NULL && create) {
- IDProperty *props = RNA_struct_idprops(ptr, false);
-
- /* Sanity check: props is the actual container of this property. */
- if (props != NULL && BLI_findindex(&props->data.group, prop) >= 0) {
- idprop = IDP_New(IDP_GROUP, &dummy, RNA_IDP_UI);
-
- if (!IDP_AddToGroup(props, idprop)) {
- IDP_FreeProperty(idprop);
- return NULL;
- }
- }
- }
-
- if (idprop) {
- const char *name = ((IDProperty *)prop)->name;
- IDProperty *rv = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_GROUP);
-
- if (rv == NULL && create) {
- rv = IDP_New(IDP_GROUP, &dummy, name);
-
- if (!IDP_AddToGroup(idprop, rv)) {
- IDP_FreeProperty(rv);
- return NULL;
- }
- }
-
- return rv;
- }
-
- return NULL;
-}
-
-static bool rna_idproperty_ui_set_default(PointerRNA *ptr, PropertyRNA *prop, const char type, IDPropertyTemplate *value)
-{
- BLI_assert(ELEM(type, IDP_INT, IDP_DOUBLE));
-
- if (prop->magic == RNA_MAGIC) {
- return false;
- }
-
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui_ensure(ptr, prop, value != NULL);
-
- if (idp_ui == NULL) {
- return (value == NULL);
- }
-
- IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", type);
-
- if (value == NULL) {
- if (item != NULL) {
- IDP_RemoveFromGroup(idp_ui, item);
- }
- }
- else {
- if (item != NULL) {
- switch (type) {
- case IDP_INT:
- IDP_Int(item) = value->i;
- break;
- case IDP_DOUBLE:
- IDP_Double(item) = value->d;
- break;
- default:
- BLI_assert(false);
- return false;
- }
- }
- else {
- item = IDP_New(type, value, "default");
-
- if (!IDP_AddToGroup(idp_ui, item)) {
- IDP_FreeProperty(item);
- return false;
- }
- }
- }
-
- return true;
+ IDProperty *idprop = rna_idproperty_ui_container(prop);
+ IDPropertyTemplate dummy = {0};
+
+ if (idprop == NULL && create) {
+ IDProperty *props = RNA_struct_idprops(ptr, false);
+
+ /* Sanity check: props is the actual container of this property. */
+ if (props != NULL && BLI_findindex(&props->data.group, prop) >= 0) {
+ idprop = IDP_New(IDP_GROUP, &dummy, RNA_IDP_UI);
+
+ if (!IDP_AddToGroup(props, idprop)) {
+ IDP_FreeProperty(idprop);
+ return NULL;
+ }
+ }
+ }
+
+ if (idprop) {
+ const char *name = ((IDProperty *)prop)->name;
+ IDProperty *rv = IDP_GetPropertyTypeFromGroup(idprop, name, IDP_GROUP);
+
+ if (rv == NULL && create) {
+ rv = IDP_New(IDP_GROUP, &dummy, name);
+
+ if (!IDP_AddToGroup(idprop, rv)) {
+ IDP_FreeProperty(rv);
+ return NULL;
+ }
+ }
+
+ return rv;
+ }
+
+ return NULL;
+}
+
+static bool rna_idproperty_ui_set_default(PointerRNA *ptr,
+ PropertyRNA *prop,
+ const char type,
+ IDPropertyTemplate *value)
+{
+ BLI_assert(ELEM(type, IDP_INT, IDP_DOUBLE));
+
+ if (prop->magic == RNA_MAGIC) {
+ return false;
+ }
+
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui_ensure(ptr, prop, value != NULL);
+
+ if (idp_ui == NULL) {
+ return (value == NULL);
+ }
+
+ IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", type);
+
+ if (value == NULL) {
+ if (item != NULL) {
+ IDP_RemoveFromGroup(idp_ui, item);
+ }
+ }
+ else {
+ if (item != NULL) {
+ switch (type) {
+ case IDP_INT:
+ IDP_Int(item) = value->i;
+ break;
+ case IDP_DOUBLE:
+ IDP_Double(item) = value->d;
+ break;
+ default:
+ BLI_assert(false);
+ return false;
+ }
+ }
+ else {
+ item = IDP_New(type, value, "default");
+
+ if (!IDP_AddToGroup(idp_ui, item)) {
+ IDP_FreeProperty(item);
+ return false;
+ }
+ }
+ }
+
+ return true;
}
IDProperty *RNA_struct_idprops(PointerRNA *ptr, bool create)
{
- StructRNA *type = ptr->type;
+ StructRNA *type = ptr->type;
- if (type && type->idproperties) {
- return type->idproperties(ptr, create);
- }
+ if (type && type->idproperties) {
+ return type->idproperties(ptr, create);
+ }
- return NULL;
+ return NULL;
}
bool RNA_struct_idprops_check(StructRNA *srna)
{
- return (srna && srna->idproperties);
+ return (srna && srna->idproperties);
}
static IDProperty *rna_idproperty_find(PointerRNA *ptr, const char *name)
{
- IDProperty *group = RNA_struct_idprops(ptr, 0);
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
- if (group) {
- if (group->type == IDP_GROUP) {
- return IDP_GetPropertyFromGroup(group, name);
- }
- else {
- /* Not sure why that happens sometimes, with nested properties... */
- /* Seems to be actually array prop, name is usually "0"... To be sorted out later. */
-// printf("Got unexpected IDProp container when trying to retrieve %s: %d\n", name, group->type);
- }
- }
+ if (group) {
+ if (group->type == IDP_GROUP) {
+ return IDP_GetPropertyFromGroup(group, name);
+ }
+ else {
+ /* Not sure why that happens sometimes, with nested properties... */
+ /* Seems to be actually array prop, name is usually "0"... To be sorted out later. */
+ // printf("Got unexpected IDProp container when trying to retrieve %s: %d\n", name, group->type);
+ }
+ }
- return NULL;
+ return NULL;
}
static void rna_idproperty_free(PointerRNA *ptr, const char *name)
{
- IDProperty *group = RNA_struct_idprops(ptr, 0);
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
- if (group) {
- IDProperty *idprop = IDP_GetPropertyFromGroup(group, name);
- if (idprop) {
- IDP_FreeFromGroup(group, idprop);
- }
- }
+ if (group) {
+ IDProperty *idprop = IDP_GetPropertyFromGroup(group, name);
+ if (idprop) {
+ IDP_FreeFromGroup(group, idprop);
+ }
+ }
}
static int rna_ensure_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
{
- if (prop->magic == RNA_MAGIC) {
- int arraylen[RNA_MAX_ARRAY_DIMENSION];
- return (prop->getlength && ptr->data) ? prop->getlength(ptr, arraylen) : prop->totarraylength;
- }
- else {
- IDProperty *idprop = (IDProperty *)prop;
+ if (prop->magic == RNA_MAGIC) {
+ int arraylen[RNA_MAX_ARRAY_DIMENSION];
+ return (prop->getlength && ptr->data) ? prop->getlength(ptr, arraylen) : prop->totarraylength;
+ }
+ else {
+ IDProperty *idprop = (IDProperty *)prop;
- if (idprop->type == IDP_ARRAY)
- return idprop->len;
- else
- return 0;
- }
+ if (idprop->type == IDP_ARRAY)
+ return idprop->len;
+ else
+ return 0;
+ }
}
static bool rna_ensure_property_array_check(PropertyRNA *prop)
{
- if (prop->magic == RNA_MAGIC) {
- return (prop->getlength || prop->totarraylength);
- }
- else {
- IDProperty *idprop = (IDProperty *)prop;
+ if (prop->magic == RNA_MAGIC) {
+ return (prop->getlength || prop->totarraylength);
+ }
+ else {
+ IDProperty *idprop = (IDProperty *)prop;
- return (idprop->type == IDP_ARRAY);
- }
+ return (idprop->type == IDP_ARRAY);
+ }
}
-static void rna_ensure_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int length[])
+static void rna_ensure_property_multi_array_length(PointerRNA *ptr,
+ PropertyRNA *prop,
+ int length[])
{
- if (prop->magic == RNA_MAGIC) {
- if (prop->getlength)
- prop->getlength(ptr, length);
- else
- memcpy(length, prop->arraylength, prop->arraydimension * sizeof(int));
- }
- else {
- IDProperty *idprop = (IDProperty *)prop;
+ if (prop->magic == RNA_MAGIC) {
+ if (prop->getlength)
+ prop->getlength(ptr, length);
+ else
+ memcpy(length, prop->arraylength, prop->arraydimension * sizeof(int));
+ }
+ else {
+ IDProperty *idprop = (IDProperty *)prop;
- if (idprop->type == IDP_ARRAY)
- length[0] = idprop->len;
- else
- length[0] = 0;
- }
+ if (idprop->type == IDP_ARRAY)
+ length[0] = idprop->len;
+ else
+ length[0] = 0;
+ }
}
static bool rna_idproperty_verify_valid(PointerRNA *ptr, PropertyRNA *prop, IDProperty *idprop)
{
- /* this verifies if the idproperty actually matches the property
- * description and otherwise removes it. this is to ensure that
- * rna property access is type safe, e.g. if you defined the rna
- * to have a certain array length you can count on that staying so */
-
- switch (idprop->type) {
- case IDP_IDPARRAY:
- if (prop->type != PROP_COLLECTION)
- return false;
- break;
- case IDP_ARRAY:
- if (rna_ensure_property_array_length(ptr, prop) != idprop->len)
- return false;
-
- if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT)
- return false;
- if (idprop->subtype == IDP_INT && !ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
- return false;
-
- break;
- case IDP_INT:
- if (!ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
- return false;
- break;
- case IDP_FLOAT:
- case IDP_DOUBLE:
- if (prop->type != PROP_FLOAT)
- return false;
- break;
- case IDP_STRING:
- if (prop->type != PROP_STRING)
- return false;
- break;
- case IDP_GROUP:
- case IDP_ID:
- if (prop->type != PROP_POINTER)
- return false;
- break;
- default:
- return false;
- }
-
- return true;
+ /* this verifies if the idproperty actually matches the property
+ * description and otherwise removes it. this is to ensure that
+ * rna property access is type safe, e.g. if you defined the rna
+ * to have a certain array length you can count on that staying so */
+
+ switch (idprop->type) {
+ case IDP_IDPARRAY:
+ if (prop->type != PROP_COLLECTION)
+ return false;
+ break;
+ case IDP_ARRAY:
+ if (rna_ensure_property_array_length(ptr, prop) != idprop->len)
+ return false;
+
+ if (idprop->subtype == IDP_FLOAT && prop->type != PROP_FLOAT)
+ return false;
+ if (idprop->subtype == IDP_INT && !ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
+ return false;
+
+ break;
+ case IDP_INT:
+ if (!ELEM(prop->type, PROP_BOOLEAN, PROP_INT, PROP_ENUM))
+ return false;
+ break;
+ case IDP_FLOAT:
+ case IDP_DOUBLE:
+ if (prop->type != PROP_FLOAT)
+ return false;
+ break;
+ case IDP_STRING:
+ if (prop->type != PROP_STRING)
+ return false;
+ break;
+ case IDP_GROUP:
+ case IDP_ID:
+ if (prop->type != PROP_POINTER)
+ return false;
+ break;
+ default:
+ return false;
+ }
+
+ return true;
}
static PropertyRNA *typemap[IDP_NUMTYPES] = {
- (PropertyRNA *)&rna_PropertyGroupItem_string,
- (PropertyRNA *)&rna_PropertyGroupItem_int,
- (PropertyRNA *)&rna_PropertyGroupItem_float,
- NULL, NULL, NULL,
- (PropertyRNA *)&rna_PropertyGroupItem_group,
- (PropertyRNA *)&rna_PropertyGroupItem_id,
- (PropertyRNA *)&rna_PropertyGroupItem_double,
- (PropertyRNA *)&rna_PropertyGroupItem_idp_array,
+ (PropertyRNA *)&rna_PropertyGroupItem_string,
+ (PropertyRNA *)&rna_PropertyGroupItem_int,
+ (PropertyRNA *)&rna_PropertyGroupItem_float,
+ NULL,
+ NULL,
+ NULL,
+ (PropertyRNA *)&rna_PropertyGroupItem_group,
+ (PropertyRNA *)&rna_PropertyGroupItem_id,
+ (PropertyRNA *)&rna_PropertyGroupItem_double,
+ (PropertyRNA *)&rna_PropertyGroupItem_idp_array,
};
static PropertyRNA *arraytypemap[IDP_NUMTYPES] = {
- NULL, (PropertyRNA *)&rna_PropertyGroupItem_int_array,
- (PropertyRNA *)&rna_PropertyGroupItem_float_array,
- NULL, NULL, NULL,
- (PropertyRNA *)&rna_PropertyGroupItem_collection, NULL,
- (PropertyRNA *)&rna_PropertyGroupItem_double_array,
+ NULL,
+ (PropertyRNA *)&rna_PropertyGroupItem_int_array,
+ (PropertyRNA *)&rna_PropertyGroupItem_float_array,
+ NULL,
+ NULL,
+ NULL,
+ (PropertyRNA *)&rna_PropertyGroupItem_collection,
+ NULL,
+ (PropertyRNA *)&rna_PropertyGroupItem_double_array,
};
-static void *rna_idproperty_check_ex(PropertyRNA **prop, PointerRNA *ptr, const bool return_rnaprop)
+static void *rna_idproperty_check_ex(PropertyRNA **prop,
+ PointerRNA *ptr,
+ const bool return_rnaprop)
{
- /* This is quite a hack, but avoids some complexity in the API. we
- * pass IDProperty structs as PropertyRNA pointers to the outside.
- * We store some bytes in PropertyRNA structs that allows us to
- * distinguish it from IDProperty structs. If it is an ID property,
- * we look up an IDP PropertyRNA based on the type, and set the data
- * pointer to the IDProperty. */
+ /* This is quite a hack, but avoids some complexity in the API. we
+ * pass IDProperty structs as PropertyRNA pointers to the outside.
+ * We store some bytes in PropertyRNA structs that allows us to
+ * distinguish it from IDProperty structs. If it is an ID property,
+ * we look up an IDP PropertyRNA based on the type, and set the data
+ * pointer to the IDProperty. */
- if ((*prop)->magic == RNA_MAGIC) {
- if ((*prop)->flag & PROP_IDPROPERTY) {
- IDProperty *idprop = rna_idproperty_find(ptr, (*prop)->identifier);
+ if ((*prop)->magic == RNA_MAGIC) {
+ if ((*prop)->flag & PROP_IDPROPERTY) {
+ IDProperty *idprop = rna_idproperty_find(ptr, (*prop)->identifier);
- if (idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) {
- IDProperty *group = RNA_struct_idprops(ptr, 0);
+ if (idprop && !rna_idproperty_verify_valid(ptr, *prop, idprop)) {
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
- IDP_FreeFromGroup(group, idprop);
- return NULL;
- }
+ IDP_FreeFromGroup(group, idprop);
+ return NULL;
+ }
- return idprop;
- }
- else {
- return return_rnaprop ? *prop : NULL;
- }
- }
+ return idprop;
+ }
+ else {
+ return return_rnaprop ? *prop : NULL;
+ }
+ }
- {
- IDProperty *idprop = (IDProperty *)(*prop);
+ {
+ IDProperty *idprop = (IDProperty *)(*prop);
- if (idprop->type == IDP_ARRAY)
- *prop = arraytypemap[(int)(idprop->subtype)];
- else
- *prop = typemap[(int)(idprop->type)];
+ if (idprop->type == IDP_ARRAY)
+ *prop = arraytypemap[(int)(idprop->subtype)];
+ else
+ *prop = typemap[(int)(idprop->type)];
- return idprop;
- }
+ return idprop;
+ }
}
/* This function only returns an IDProperty,
* or NULL (in case IDProp could not be found, or prop is a real RNA property). */
IDProperty *rna_idproperty_check(PropertyRNA **prop, PointerRNA *ptr)
{
- return rna_idproperty_check_ex(prop, ptr, false);
+ return rna_idproperty_check_ex(prop, ptr, false);
}
/* This function always return the valid, real data pointer, be it a regular RNA property one, or an IDProperty one. */
PropertyRNA *rna_ensure_property_realdata(PropertyRNA **prop, PointerRNA *ptr)
{
- return rna_idproperty_check_ex(prop, ptr, true);
+ return rna_idproperty_check_ex(prop, ptr, true);
}
static PropertyRNA *rna_ensure_property(PropertyRNA *prop)
{
- /* the quick version if we don't need the idproperty */
+ /* the quick version if we don't need the idproperty */
- if (prop->magic == RNA_MAGIC)
- return prop;
+ if (prop->magic == RNA_MAGIC)
+ return prop;
- {
- IDProperty *idprop = (IDProperty *)prop;
+ {
+ IDProperty *idprop = (IDProperty *)prop;
- if (idprop->type == IDP_ARRAY)
- return arraytypemap[(int)(idprop->subtype)];
- else
- return typemap[(int)(idprop->type)];
- }
+ if (idprop->type == IDP_ARRAY)
+ return arraytypemap[(int)(idprop->subtype)];
+ else
+ return typemap[(int)(idprop->type)];
+ }
}
static const char *rna_ensure_property_identifier(const PropertyRNA *prop)
{
- if (prop->magic == RNA_MAGIC)
- return prop->identifier;
- else
- return ((const IDProperty *)prop)->name;
+ if (prop->magic == RNA_MAGIC)
+ return prop->identifier;
+ else
+ return ((const IDProperty *)prop)->name;
}
static const char *rna_ensure_property_description(PropertyRNA *prop)
{
- const char *description = NULL;
+ const char *description = NULL;
- if (prop->magic == RNA_MAGIC)
- description = prop->description;
- else {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic == RNA_MAGIC)
+ description = prop->description;
+ else {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
- if (item)
- description = IDP_String(item);
- }
+ if (idp_ui) {
+ IDProperty *item = IDP_GetPropertyTypeFromGroup(idp_ui, "description", IDP_STRING);
+ if (item)
+ description = IDP_String(item);
+ }
- if (description == NULL)
- description = ((IDProperty *)prop)->name; /* XXX - not correct */
- }
+ if (description == NULL)
+ description = ((IDProperty *)prop)->name; /* XXX - not correct */
+ }
- return description;
+ return description;
}
static const char *rna_ensure_property_name(const PropertyRNA *prop)
{
- const char *name;
+ const char *name;
- if (prop->magic == RNA_MAGIC)
- name = prop->name;
- else
- name = ((const IDProperty *)prop)->name;
+ if (prop->magic == RNA_MAGIC)
+ name = prop->name;
+ else
+ name = ((const IDProperty *)prop)->name;
- return name;
+ return name;
}
/* Structs */
StructRNA *RNA_struct_find(const char *identifier)
{
- return BLI_ghash_lookup(BLENDER_RNA.structs_map, identifier);
+ return BLI_ghash_lookup(BLENDER_RNA.structs_map, identifier);
}
const char *RNA_struct_identifier(const StructRNA *type)
{
- return type->identifier;
+ return type->identifier;
}
const char *RNA_struct_ui_name(const StructRNA *type)
{
- return CTX_IFACE_(type->translation_context, type->name);
+ return CTX_IFACE_(type->translation_context, type->name);
}
const char *RNA_struct_ui_name_raw(const StructRNA *type)
{
- return type->name;
+ return type->name;
}
int RNA_struct_ui_icon(const StructRNA *type)
{
- if (type)
- return type->icon;
- else
- return ICON_DOT;
+ if (type)
+ return type->icon;
+ else
+ return ICON_DOT;
}
const char *RNA_struct_ui_description(const StructRNA *type)
{
- return TIP_(type->description);
+ return TIP_(type->description);
}
const char *RNA_struct_ui_description_raw(const StructRNA *type)
{
- return type->description;
+ return type->description;
}
const char *RNA_struct_translation_context(const StructRNA *type)
{
- return type->translation_context;
+ return type->translation_context;
}
PropertyRNA *RNA_struct_name_property(const StructRNA *type)
{
- return type->nameproperty;
+ return type->nameproperty;
}
const EnumPropertyItem *RNA_struct_property_tag_defines(const StructRNA *type)
{
- return type->prop_tag_defines;
+ return type->prop_tag_defines;
}
PropertyRNA *RNA_struct_iterator_property(StructRNA *type)
{
- return type->iteratorproperty;
+ return type->iteratorproperty;
}
StructRNA *RNA_struct_base(StructRNA *type)
{
- return type->base;
+ return type->base;
}
/**
@@ -711,33 +723,33 @@ StructRNA *RNA_struct_base(StructRNA *type)
*/
const StructRNA *RNA_struct_base_child_of(const StructRNA *type, const StructRNA *parent_type)
{
- while (type) {
- if (type->base == parent_type) {
- return type;
- }
- type = type->base;
- }
- return NULL;
+ while (type) {
+ if (type->base == parent_type) {
+ return type;
+ }
+ type = type->base;
+ }
+ return NULL;
}
bool RNA_struct_is_ID(const StructRNA *type)
{
- return (type->flag & STRUCT_ID) != 0;
+ return (type->flag & STRUCT_ID) != 0;
}
bool RNA_struct_undo_check(const StructRNA *type)
{
- return (type->flag & STRUCT_UNDO) != 0;
+ return (type->flag & STRUCT_UNDO) != 0;
}
bool RNA_struct_idprops_register_check(const StructRNA *type)
{
- return (type->flag & STRUCT_NO_IDPROPERTIES) == 0;
+ return (type->flag & STRUCT_NO_IDPROPERTIES) == 0;
}
bool RNA_struct_idprops_datablock_allowed(const StructRNA *type)
{
- return (type->flag & (STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_NO_IDPROPERTIES)) == 0;
+ return (type->flag & (STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_NO_IDPROPERTIES)) == 0;
}
/**
@@ -747,234 +759,230 @@ bool RNA_struct_idprops_datablock_allowed(const StructRNA *type)
*/
bool RNA_struct_idprops_contains_datablock(const StructRNA *type)
{
- return (type->flag & (STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES | STRUCT_ID)) != 0;
+ return (type->flag & (STRUCT_CONTAINS_DATABLOCK_IDPROPERTIES | STRUCT_ID)) != 0;
}
/* remove an id-property */
bool RNA_struct_idprops_unset(PointerRNA *ptr, const char *identifier)
{
- IDProperty *group = RNA_struct_idprops(ptr, 0);
+ IDProperty *group = RNA_struct_idprops(ptr, 0);
- if (group) {
- IDProperty *idp = IDP_GetPropertyFromGroup(group, identifier);
- if (idp) {
- IDP_FreeFromGroup(group, idp);
+ if (group) {
+ IDProperty *idp = IDP_GetPropertyFromGroup(group, identifier);
+ if (idp) {
+ IDP_FreeFromGroup(group, idp);
- return true;
- }
- }
- return false;
+ return true;
+ }
+ }
+ return false;
}
bool RNA_struct_is_a(const StructRNA *type, const StructRNA *srna)
{
- const StructRNA *base;
+ const StructRNA *base;
- if (srna == &RNA_AnyType)
- return true;
+ if (srna == &RNA_AnyType)
+ return true;
- if (!type)
- return false;
+ if (!type)
+ return false;
- /* ptr->type is always maximally refined */
- for (base = type; base; base = base->base)
- if (base == srna)
- return true;
+ /* ptr->type is always maximally refined */
+ for (base = type; base; base = base->base)
+ if (base == srna)
+ return true;
- return false;
+ return false;
}
PropertyRNA *RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
{
- if (identifier[0] == '[' && identifier[1] == '"') { /* " (dummy comment to avoid confusing some
- * function lists in text editors) */
- /* id prop lookup, not so common */
- PropertyRNA *r_prop = NULL;
- PointerRNA r_ptr; /* only support single level props */
- if (RNA_path_resolve_property(ptr, identifier, &r_ptr, &r_prop) &&
- (r_ptr.type == ptr->type) && (r_ptr.data == ptr->data))
- {
- return r_prop;
- }
- }
- else {
- /* most common case */
- PropertyRNA *iterprop = RNA_struct_iterator_property(ptr->type);
- PointerRNA propptr;
-
- if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr))
- return propptr.data;
- }
-
- return NULL;
+ if (identifier[0] == '[' && identifier[1] == '"') { /* " (dummy comment to avoid confusing some
+ * function lists in text editors) */
+ /* id prop lookup, not so common */
+ PropertyRNA *r_prop = NULL;
+ PointerRNA r_ptr; /* only support single level props */
+ if (RNA_path_resolve_property(ptr, identifier, &r_ptr, &r_prop) && (r_ptr.type == ptr->type) &&
+ (r_ptr.data == ptr->data)) {
+ return r_prop;
+ }
+ }
+ else {
+ /* most common case */
+ PropertyRNA *iterprop = RNA_struct_iterator_property(ptr->type);
+ PointerRNA propptr;
+
+ if (RNA_property_collection_lookup_string(ptr, iterprop, identifier, &propptr))
+ return propptr.data;
+ }
+
+ return NULL;
}
/* Find the property which uses the given nested struct */
static PropertyRNA *RNA_struct_find_nested(PointerRNA *ptr, StructRNA *srna)
{
- PropertyRNA *prop = NULL;
+ PropertyRNA *prop = NULL;
- RNA_STRUCT_BEGIN (ptr, iprop)
- {
- /* This assumes that there can only be one user of this nested struct */
- if (RNA_property_pointer_type(ptr, iprop) == srna) {
- prop = iprop;
- break;
- }
- }
- RNA_PROP_END;
+ RNA_STRUCT_BEGIN (ptr, iprop) {
+ /* This assumes that there can only be one user of this nested struct */
+ if (RNA_property_pointer_type(ptr, iprop) == srna) {
+ prop = iprop;
+ break;
+ }
+ }
+ RNA_PROP_END;
- return prop;
+ return prop;
}
bool RNA_struct_contains_property(PointerRNA *ptr, PropertyRNA *prop_test)
{
- /* note, prop_test could be freed memory, only use for comparison */
+ /* note, prop_test could be freed memory, only use for comparison */
- /* validate the RNA is ok */
- PropertyRNA *iterprop;
- bool found = false;
+ /* validate the RNA is ok */
+ PropertyRNA *iterprop;
+ bool found = false;
- iterprop = RNA_struct_iterator_property(ptr->type);
+ iterprop = RNA_struct_iterator_property(ptr->type);
- RNA_PROP_BEGIN (ptr, itemptr, iterprop)
- {
- /* PropertyRNA *prop = itemptr.data; */
- if (prop_test == (PropertyRNA *)itemptr.data) {
- found = true;
- break;
- }
- }
- RNA_PROP_END;
+ RNA_PROP_BEGIN (ptr, itemptr, iterprop) {
+ /* PropertyRNA *prop = itemptr.data; */
+ if (prop_test == (PropertyRNA *)itemptr.data) {
+ found = true;
+ break;
+ }
+ }
+ RNA_PROP_END;
- return found;
+ return found;
}
unsigned int RNA_struct_count_properties(StructRNA *srna)
{
- PointerRNA struct_ptr;
- unsigned int counter = 0;
+ PointerRNA struct_ptr;
+ unsigned int counter = 0;
- RNA_pointer_create(NULL, srna, NULL, &struct_ptr);
+ RNA_pointer_create(NULL, srna, NULL, &struct_ptr);
- RNA_STRUCT_BEGIN (&struct_ptr, prop)
- {
- counter++;
- UNUSED_VARS(prop);
- }
- RNA_STRUCT_END;
+ RNA_STRUCT_BEGIN (&struct_ptr, prop) {
+ counter++;
+ UNUSED_VARS(prop);
+ }
+ RNA_STRUCT_END;
- return counter;
+ return counter;
}
/* low level direct access to type->properties, note this ignores parent classes so should be used with care */
const struct ListBase *RNA_struct_type_properties(StructRNA *srna)
{
- return &srna->cont.properties;
+ return &srna->cont.properties;
}
PropertyRNA *RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
{
- return BLI_findstring_ptr(&srna->cont.properties, identifier, offsetof(PropertyRNA, identifier));
+ return BLI_findstring_ptr(&srna->cont.properties, identifier, offsetof(PropertyRNA, identifier));
}
FunctionRNA *RNA_struct_find_function(StructRNA *srna, const char *identifier)
{
#if 1
- FunctionRNA *func;
- StructRNA *type;
- for (type = srna; type; type = type->base) {
- func = (FunctionRNA *)BLI_findstring_ptr(&type->functions, identifier, offsetof(FunctionRNA, identifier));
- if (func) {
- return func;
- }
- }
- return NULL;
-
- /* functional but slow */
+ FunctionRNA *func;
+ StructRNA *type;
+ for (type = srna; type; type = type->base) {
+ func = (FunctionRNA *)BLI_findstring_ptr(
+ &type->functions, identifier, offsetof(FunctionRNA, identifier));
+ if (func) {
+ return func;
+ }
+ }
+ return NULL;
+
+ /* functional but slow */
#else
- PointerRNA tptr;
- PropertyRNA *iterprop;
- FunctionRNA *func;
+ PointerRNA tptr;
+ PropertyRNA *iterprop;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, &RNA_Struct, srna, &tptr);
- iterprop = RNA_struct_find_property(&tptr, "functions");
+ RNA_pointer_create(NULL, &RNA_Struct, srna, &tptr);
+ iterprop = RNA_struct_find_property(&tptr, "functions");
- func = NULL;
+ func = NULL;
- RNA_PROP_BEGIN (&tptr, funcptr, iterprop)
- {
- if (STREQ(identifier, RNA_function_identifier(funcptr.data))) {
- func = funcptr.data;
- break;
- }
- }
- RNA_PROP_END;
+ RNA_PROP_BEGIN (&tptr, funcptr, iterprop) {
+ if (STREQ(identifier, RNA_function_identifier(funcptr.data))) {
+ func = funcptr.data;
+ break;
+ }
+ }
+ RNA_PROP_END;
- return func;
+ return func;
#endif
}
const ListBase *RNA_struct_type_functions(StructRNA *srna)
{
- return &srna->functions;
+ return &srna->functions;
}
StructRegisterFunc RNA_struct_register(StructRNA *type)
{
- return type->reg;
+ return type->reg;
}
StructUnregisterFunc RNA_struct_unregister(StructRNA *type)
{
- do {
- if (type->unreg)
- return type->unreg;
- } while ((type = type->base));
+ do {
+ if (type->unreg)
+ return type->unreg;
+ } while ((type = type->base));
- return NULL;
+ return NULL;
}
void **RNA_struct_instance(PointerRNA *ptr)
{
- StructRNA *type = ptr->type;
+ StructRNA *type = ptr->type;
- do {
- if (type->instance)
- return type->instance(ptr);
- } while ((type = type->base));
+ do {
+ if (type->instance)
+ return type->instance(ptr);
+ } while ((type = type->base));
- return NULL;
+ return NULL;
}
void *RNA_struct_py_type_get(StructRNA *srna)
{
- return srna->py_type;
+ return srna->py_type;
}
void RNA_struct_py_type_set(StructRNA *srna, void *py_type)
{
- srna->py_type = py_type;
+ srna->py_type = py_type;
}
void *RNA_struct_blender_type_get(StructRNA *srna)
{
- return srna->blender_type;
+ return srna->blender_type;
}
void RNA_struct_blender_type_set(StructRNA *srna, void *blender_type)
{
- srna->blender_type = blender_type;
+ srna->blender_type = blender_type;
}
char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, int *r_len)
{
- PropertyRNA *nameprop;
+ PropertyRNA *nameprop;
- if (ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
- return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len);
+ if (ptr->data && (nameprop = RNA_struct_name_property(ptr->type)))
+ return RNA_property_string_get_alloc(ptr, nameprop, fixedbuf, fixedlen, r_len);
- return NULL;
+ return NULL;
}
/**
@@ -982,119 +990,118 @@ char *RNA_struct_name_get_alloc(PointerRNA *ptr, char *fixedbuf, int fixedlen, i
*/
bool RNA_struct_available_or_report(ReportList *reports, const char *identifier)
{
- const StructRNA *srna_exists = RNA_struct_find(identifier);
- if (UNLIKELY(srna_exists != NULL)) {
- /* Use comprehensive string construction since this is such a rare occurrence
- * and information here may cut down time troubleshooting. */
- DynStr *dynstr = BLI_dynstr_new();
- BLI_dynstr_appendf(dynstr, "Type identifier '%s' is already in use: '", identifier);
- BLI_dynstr_append(dynstr, srna_exists->identifier);
- int i = 0;
- if (srna_exists->base) {
- for (const StructRNA *base = srna_exists->base; base; base = base->base) {
- BLI_dynstr_append(dynstr, "(");
- BLI_dynstr_append(dynstr, base->identifier);
- i += 1;
- }
- while (i--) {
- BLI_dynstr_append(dynstr, ")");
- }
- }
- BLI_dynstr_append(dynstr, "'.");
- char *result = BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
- BKE_report(reports, RPT_ERROR, result);
- MEM_freeN(result);
- return false;
- }
- else {
- return true;
- }
-}
-
-bool RNA_struct_bl_idname_ok_or_report(ReportList *reports, const char *identifier, const char *sep)
-{
- const int len_sep = strlen(sep);
- const int len_id = strlen(identifier);
- const char *p = strstr(identifier, sep);
- /* TODO: make error, for now warning until add-ons update. */
+ const StructRNA *srna_exists = RNA_struct_find(identifier);
+ if (UNLIKELY(srna_exists != NULL)) {
+ /* Use comprehensive string construction since this is such a rare occurrence
+ * and information here may cut down time troubleshooting. */
+ DynStr *dynstr = BLI_dynstr_new();
+ BLI_dynstr_appendf(dynstr, "Type identifier '%s' is already in use: '", identifier);
+ BLI_dynstr_append(dynstr, srna_exists->identifier);
+ int i = 0;
+ if (srna_exists->base) {
+ for (const StructRNA *base = srna_exists->base; base; base = base->base) {
+ BLI_dynstr_append(dynstr, "(");
+ BLI_dynstr_append(dynstr, base->identifier);
+ i += 1;
+ }
+ while (i--) {
+ BLI_dynstr_append(dynstr, ")");
+ }
+ }
+ BLI_dynstr_append(dynstr, "'.");
+ char *result = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ BKE_report(reports, RPT_ERROR, result);
+ MEM_freeN(result);
+ return false;
+ }
+ else {
+ return true;
+ }
+}
+
+bool RNA_struct_bl_idname_ok_or_report(ReportList *reports,
+ const char *identifier,
+ const char *sep)
+{
+ const int len_sep = strlen(sep);
+ const int len_id = strlen(identifier);
+ const char *p = strstr(identifier, sep);
+ /* TODO: make error, for now warning until add-ons update. */
#if 1
- const int report_level = RPT_WARNING;
- const bool failure = true;
+ const int report_level = RPT_WARNING;
+ const bool failure = true;
#else
- const int report_level = RPT_ERROR;
- const bool failure = false;
+ const int report_level = RPT_ERROR;
+ const bool failure = false;
#endif
- if (p == NULL || p == identifier || p + len_sep >= identifier + len_id) {
- BKE_reportf(reports, report_level, "'%s' doesn't contain '%s' with prefix & suffix", identifier, sep);
- return failure;
- }
-
- const char *c, *start, *end, *last;
- start = identifier;
- end = p;
- last = end - 1;
- for (c = start; c != end; c++) {
- if (((*c >= 'A' && *c <= 'Z') ||
- ((c != start) && (*c >= '0' && *c <= '9')) ||
- ((c != start) && (c != last) && (*c == '_'))) == 0)
- {
- BKE_reportf(reports, report_level, "'%s' doesn't have upper case alpha-numeric prefix", identifier);
- return failure;
- }
- }
-
- start = p + len_sep;
- end = identifier + len_id;
- last = end - 1;
- for (c = start; c != end; c++) {
- if (((*c >= 'A' && *c <= 'Z') ||
- (*c >= 'a' && *c <= 'z') ||
- (*c >= '0' && *c <= '9') ||
- ((c != start) && (c != last) && (*c == '_'))) == 0)
- {
- BKE_reportf(reports, report_level, "'%s' doesn't have an alpha-numeric suffix", identifier);
- return failure;
- }
- }
- return true;
+ if (p == NULL || p == identifier || p + len_sep >= identifier + len_id) {
+ BKE_reportf(
+ reports, report_level, "'%s' doesn't contain '%s' with prefix & suffix", identifier, sep);
+ return failure;
+ }
+
+ const char *c, *start, *end, *last;
+ start = identifier;
+ end = p;
+ last = end - 1;
+ for (c = start; c != end; c++) {
+ if (((*c >= 'A' && *c <= 'Z') || ((c != start) && (*c >= '0' && *c <= '9')) ||
+ ((c != start) && (c != last) && (*c == '_'))) == 0) {
+ BKE_reportf(
+ reports, report_level, "'%s' doesn't have upper case alpha-numeric prefix", identifier);
+ return failure;
+ }
+ }
+
+ start = p + len_sep;
+ end = identifier + len_id;
+ last = end - 1;
+ for (c = start; c != end; c++) {
+ if (((*c >= 'A' && *c <= 'Z') || (*c >= 'a' && *c <= 'z') || (*c >= '0' && *c <= '9') ||
+ ((c != start) && (c != last) && (*c == '_'))) == 0) {
+ BKE_reportf(reports, report_level, "'%s' doesn't have an alpha-numeric suffix", identifier);
+ return failure;
+ }
+ }
+ return true;
}
/* Property Information */
const char *RNA_property_identifier(const PropertyRNA *prop)
{
- return rna_ensure_property_identifier(prop);
+ return rna_ensure_property_identifier(prop);
}
const char *RNA_property_description(PropertyRNA *prop)
{
- return TIP_(rna_ensure_property_description(prop));
+ return TIP_(rna_ensure_property_description(prop));
}
PropertyType RNA_property_type(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->type;
+ return rna_ensure_property(prop)->type;
}
PropertySubType RNA_property_subtype(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->subtype;
+ return rna_ensure_property(prop)->subtype;
}
PropertyUnit RNA_property_unit(PropertyRNA *prop)
{
- return RNA_SUBTYPE_UNIT(rna_ensure_property(prop)->subtype);
+ return RNA_SUBTYPE_UNIT(rna_ensure_property(prop)->subtype);
}
int RNA_property_flag(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->flag;
+ return rna_ensure_property(prop)->flag;
}
int RNA_property_override_flag(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->flag_override;
+ return rna_ensure_property(prop)->flag_override;
}
/**
@@ -1105,651 +1112,686 @@ int RNA_property_override_flag(PropertyRNA *prop)
*/
int RNA_property_tags(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->tags;
+ return rna_ensure_property(prop)->tags;
}
bool RNA_property_builtin(PropertyRNA *prop)
{
- return (rna_ensure_property(prop)->flag_internal & PROP_INTERN_BUILTIN) != 0;
+ return (rna_ensure_property(prop)->flag_internal & PROP_INTERN_BUILTIN) != 0;
}
void *RNA_property_py_data_get(PropertyRNA *prop)
{
- return prop->py_data;
+ return prop->py_data;
}
int RNA_property_array_length(PointerRNA *ptr, PropertyRNA *prop)
{
- return rna_ensure_property_array_length(ptr, prop);
+ return rna_ensure_property_array_length(ptr, prop);
}
bool RNA_property_array_check(PropertyRNA *prop)
{
- return rna_ensure_property_array_check(prop);
+ return rna_ensure_property_array_check(prop);
}
/* used by BPY to make an array from the python object */
int RNA_property_array_dimension(PointerRNA *ptr, PropertyRNA *prop, int length[])
{
- PropertyRNA *rprop = rna_ensure_property(prop);
+ PropertyRNA *rprop = rna_ensure_property(prop);
- if (length)
- rna_ensure_property_multi_array_length(ptr, prop, length);
+ if (length)
+ rna_ensure_property_multi_array_length(ptr, prop, length);
- return rprop->arraydimension;
+ return rprop->arraydimension;
}
/* Return the size of Nth dimension. */
int RNA_property_multi_array_length(PointerRNA *ptr, PropertyRNA *prop, int dim)
{
- int len[RNA_MAX_ARRAY_DIMENSION];
+ int len[RNA_MAX_ARRAY_DIMENSION];
- rna_ensure_property_multi_array_length(ptr, prop, len);
+ rna_ensure_property_multi_array_length(ptr, prop, len);
- return len[dim];
+ return len[dim];
}
char RNA_property_array_item_char(PropertyRNA *prop, int index)
{
- const char *vectoritem = "XYZW";
- const char *quatitem = "WXYZ";
- const char *coloritem = "RGBA";
- PropertySubType subtype = rna_ensure_property(prop)->subtype;
-
- BLI_assert(index >= 0);
-
- /* get string to use for array index */
- if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
- return quatitem[index];
- }
- else if ((index < 4) && ELEM(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
- PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION, PROP_COORDS))
- {
- return vectoritem[index];
- }
- else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
- return coloritem[index];
- }
-
- return '\0';
+ const char *vectoritem = "XYZW";
+ const char *quatitem = "WXYZ";
+ const char *coloritem = "RGBA";
+ PropertySubType subtype = rna_ensure_property(prop)->subtype;
+
+ BLI_assert(index >= 0);
+
+ /* get string to use for array index */
+ if ((index < 4) && ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
+ return quatitem[index];
+ }
+ else if ((index < 4) && ELEM(subtype,
+ PROP_TRANSLATION,
+ PROP_DIRECTION,
+ PROP_XYZ,
+ PROP_XYZ_LENGTH,
+ PROP_EULER,
+ PROP_VELOCITY,
+ PROP_ACCELERATION,
+ PROP_COORDS)) {
+ return vectoritem[index];
+ }
+ else if ((index < 4) && ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
+ return coloritem[index];
+ }
+
+ return '\0';
}
int RNA_property_array_item_index(PropertyRNA *prop, char name)
{
- PropertySubType subtype = rna_ensure_property(prop)->subtype;
-
- /* get index based on string name/alias */
- /* maybe a function to find char index in string would be better than all the switches */
- if (ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
- switch (name) {
- case 'w':
- return 0;
- case 'x':
- return 1;
- case 'y':
- return 2;
- case 'z':
- return 3;
- }
- }
- else if (ELEM(subtype, PROP_TRANSLATION, PROP_DIRECTION, PROP_XYZ, PROP_XYZ_LENGTH,
- PROP_EULER, PROP_VELOCITY, PROP_ACCELERATION))
- {
- switch (name) {
- case 'x':
- return 0;
- case 'y':
- return 1;
- case 'z':
- return 2;
- case 'w':
- return 3;
- }
- }
- else if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
- switch (name) {
- case 'r':
- return 0;
- case 'g':
- return 1;
- case 'b':
- return 2;
- case 'a':
- return 3;
- }
- }
-
- return -1;
+ PropertySubType subtype = rna_ensure_property(prop)->subtype;
+
+ /* get index based on string name/alias */
+ /* maybe a function to find char index in string would be better than all the switches */
+ if (ELEM(subtype, PROP_QUATERNION, PROP_AXISANGLE)) {
+ switch (name) {
+ case 'w':
+ return 0;
+ case 'x':
+ return 1;
+ case 'y':
+ return 2;
+ case 'z':
+ return 3;
+ }
+ }
+ else if (ELEM(subtype,
+ PROP_TRANSLATION,
+ PROP_DIRECTION,
+ PROP_XYZ,
+ PROP_XYZ_LENGTH,
+ PROP_EULER,
+ PROP_VELOCITY,
+ PROP_ACCELERATION)) {
+ switch (name) {
+ case 'x':
+ return 0;
+ case 'y':
+ return 1;
+ case 'z':
+ return 2;
+ case 'w':
+ return 3;
+ }
+ }
+ else if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
+ switch (name) {
+ case 'r':
+ return 0;
+ case 'g':
+ return 1;
+ case 'b':
+ return 2;
+ case 'a':
+ return 3;
+ }
+ }
+
+ return -1;
}
-
void RNA_property_int_range(PointerRNA *ptr, PropertyRNA *prop, int *hardmin, int *hardmax)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
- int softmin, softmax;
+ IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
+ int softmin, softmax;
- if (prop->magic != RNA_MAGIC) {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item;
+ if (idp_ui) {
+ IDProperty *item;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
- *hardmin = item ? IDP_Int(item) : INT_MIN;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_INT);
+ *hardmin = item ? IDP_Int(item) : INT_MIN;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
- *hardmax = item ? IDP_Int(item) : INT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_INT);
+ *hardmax = item ? IDP_Int(item) : INT_MAX;
- return;
- }
- }
+ return;
+ }
+ }
- if (iprop->range) {
- *hardmin = INT_MIN;
- *hardmax = INT_MAX;
+ if (iprop->range) {
+ *hardmin = INT_MIN;
+ *hardmax = INT_MAX;
- iprop->range(ptr, hardmin, hardmax, &softmin, &softmax);
- }
- else if (iprop->range_ex) {
- *hardmin = INT_MIN;
- *hardmax = INT_MAX;
+ iprop->range(ptr, hardmin, hardmax, &softmin, &softmax);
+ }
+ else if (iprop->range_ex) {
+ *hardmin = INT_MIN;
+ *hardmax = INT_MAX;
- iprop->range_ex(ptr, prop, hardmin, hardmax, &softmin, &softmax);
- }
- else {
- *hardmin = iprop->hardmin;
- *hardmax = iprop->hardmax;
- }
+ iprop->range_ex(ptr, prop, hardmin, hardmax, &softmin, &softmax);
+ }
+ else {
+ *hardmin = iprop->hardmin;
+ *hardmax = iprop->hardmax;
+ }
}
-void RNA_property_int_ui_range(PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step)
+void RNA_property_int_ui_range(
+ PointerRNA *ptr, PropertyRNA *prop, int *softmin, int *softmax, int *step)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
- int hardmin, hardmax;
+ IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
+ int hardmin, hardmax;
- if (prop->magic != RNA_MAGIC) {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item;
+ if (idp_ui) {
+ IDProperty *item;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
- *softmin = item ? IDP_Int(item) : INT_MIN;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_INT);
+ *softmin = item ? IDP_Int(item) : INT_MIN;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
- *softmax = item ? IDP_Int(item) : INT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_INT);
+ *softmax = item ? IDP_Int(item) : INT_MAX;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
- *step = item ? IDP_Int(item) : 1;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_INT);
+ *step = item ? IDP_Int(item) : 1;
- return;
- }
- }
+ return;
+ }
+ }
- *softmin = iprop->softmin;
- *softmax = iprop->softmax;
+ *softmin = iprop->softmin;
+ *softmax = iprop->softmax;
- if (iprop->range) {
- hardmin = INT_MIN;
- hardmax = INT_MAX;
+ if (iprop->range) {
+ hardmin = INT_MIN;
+ hardmax = INT_MAX;
- iprop->range(ptr, &hardmin, &hardmax, softmin, softmax);
+ iprop->range(ptr, &hardmin, &hardmax, softmin, softmax);
- *softmin = max_ii(*softmin, hardmin);
- *softmax = min_ii(*softmax, hardmax);
- }
- else if (iprop->range_ex) {
- hardmin = INT_MIN;
- hardmax = INT_MAX;
+ *softmin = max_ii(*softmin, hardmin);
+ *softmax = min_ii(*softmax, hardmax);
+ }
+ else if (iprop->range_ex) {
+ hardmin = INT_MIN;
+ hardmax = INT_MAX;
- iprop->range_ex(ptr, prop, &hardmin, &hardmax, softmin, softmax);
+ iprop->range_ex(ptr, prop, &hardmin, &hardmax, softmin, softmax);
- *softmin = max_ii(*softmin, hardmin);
- *softmax = min_ii(*softmax, hardmax);
- }
+ *softmin = max_ii(*softmin, hardmin);
+ *softmax = min_ii(*softmax, hardmax);
+ }
- *step = iprop->step;
+ *step = iprop->step;
}
void RNA_property_float_range(PointerRNA *ptr, PropertyRNA *prop, float *hardmin, float *hardmax)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
- float softmin, softmax;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
+ float softmin, softmax;
- if (prop->magic != RNA_MAGIC) {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item;
+ if (idp_ui) {
+ IDProperty *item;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
- *hardmin = item ? (float)IDP_Double(item) : -FLT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "min", IDP_DOUBLE);
+ *hardmin = item ? (float)IDP_Double(item) : -FLT_MAX;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
- *hardmax = item ? (float)IDP_Double(item) : FLT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "max", IDP_DOUBLE);
+ *hardmax = item ? (float)IDP_Double(item) : FLT_MAX;
- return;
- }
- }
+ return;
+ }
+ }
- if (fprop->range) {
- *hardmin = -FLT_MAX;
- *hardmax = FLT_MAX;
+ if (fprop->range) {
+ *hardmin = -FLT_MAX;
+ *hardmax = FLT_MAX;
- fprop->range(ptr, hardmin, hardmax, &softmin, &softmax);
- }
- else if (fprop->range_ex) {
- *hardmin = -FLT_MAX;
- *hardmax = FLT_MAX;
+ fprop->range(ptr, hardmin, hardmax, &softmin, &softmax);
+ }
+ else if (fprop->range_ex) {
+ *hardmin = -FLT_MAX;
+ *hardmax = FLT_MAX;
- fprop->range_ex(ptr, prop, hardmin, hardmax, &softmin, &softmax);
- }
- else {
- *hardmin = fprop->hardmin;
- *hardmax = fprop->hardmax;
- }
+ fprop->range_ex(ptr, prop, hardmin, hardmax, &softmin, &softmax);
+ }
+ else {
+ *hardmin = fprop->hardmin;
+ *hardmax = fprop->hardmax;
+ }
}
-void RNA_property_float_ui_range(PointerRNA *ptr, PropertyRNA *prop, float *softmin, float *softmax,
- float *step, float *precision)
+void RNA_property_float_ui_range(PointerRNA *ptr,
+ PropertyRNA *prop,
+ float *softmin,
+ float *softmax,
+ float *step,
+ float *precision)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
- float hardmin, hardmax;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
+ float hardmin, hardmax;
- if (prop->magic != RNA_MAGIC) {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item;
+ if (idp_ui) {
+ IDProperty *item;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
- *softmin = item ? (float)IDP_Double(item) : -FLT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_min", IDP_DOUBLE);
+ *softmin = item ? (float)IDP_Double(item) : -FLT_MAX;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
- *softmax = item ? (float)IDP_Double(item) : FLT_MAX;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "soft_max", IDP_DOUBLE);
+ *softmax = item ? (float)IDP_Double(item) : FLT_MAX;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
- *step = item ? (float)IDP_Double(item) : 1.0f;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "step", IDP_DOUBLE);
+ *step = item ? (float)IDP_Double(item) : 1.0f;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
- *precision = item ? (float)IDP_Double(item) : 3.0f;
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "precision", IDP_DOUBLE);
+ *precision = item ? (float)IDP_Double(item) : 3.0f;
- return;
- }
- }
+ return;
+ }
+ }
- *softmin = fprop->softmin;
- *softmax = fprop->softmax;
+ *softmin = fprop->softmin;
+ *softmax = fprop->softmax;
- if (fprop->range) {
- hardmin = -FLT_MAX;
- hardmax = FLT_MAX;
+ if (fprop->range) {
+ hardmin = -FLT_MAX;
+ hardmax = FLT_MAX;
- fprop->range(ptr, &hardmin, &hardmax, softmin, softmax);
+ fprop->range(ptr, &hardmin, &hardmax, softmin, softmax);
- *softmin = max_ff(*softmin, hardmin);
- *softmax = min_ff(*softmax, hardmax);
- }
- else if (fprop->range_ex) {
- hardmin = -FLT_MAX;
- hardmax = FLT_MAX;
+ *softmin = max_ff(*softmin, hardmin);
+ *softmax = min_ff(*softmax, hardmax);
+ }
+ else if (fprop->range_ex) {
+ hardmin = -FLT_MAX;
+ hardmax = FLT_MAX;
- fprop->range_ex(ptr, prop, &hardmin, &hardmax, softmin, softmax);
+ fprop->range_ex(ptr, prop, &hardmin, &hardmax, softmin, softmax);
- *softmin = max_ff(*softmin, hardmin);
- *softmax = min_ff(*softmax, hardmax);
- }
+ *softmin = max_ff(*softmin, hardmin);
+ *softmax = min_ff(*softmax, hardmax);
+ }
- *step = fprop->step;
- *precision = (float)fprop->precision;
+ *step = fprop->step;
+ *precision = (float)fprop->precision;
}
int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value)
{
- float min, max;
+ float min, max;
- RNA_property_float_range(ptr, prop, &min, &max);
+ RNA_property_float_range(ptr, prop, &min, &max);
- if (*value < min) {
- *value = min;
- return -1;
- }
- else if (*value > max) {
- *value = max;
- return 1;
- }
- else {
- return 0;
- }
+ if (*value < min) {
+ *value = min;
+ return -1;
+ }
+ else if (*value > max) {
+ *value = max;
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value)
{
- int min, max;
+ int min, max;
- RNA_property_int_range(ptr, prop, &min, &max);
+ RNA_property_int_range(ptr, prop, &min, &max);
- if (*value < min) {
- *value = min;
- return -1;
- }
- else if (*value > max) {
- *value = max;
- return 1;
- }
- else {
- return 0;
- }
+ if (*value < min) {
+ *value = min;
+ return -1;
+ }
+ else if (*value > max) {
+ *value = max;
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
/* this is the max length including \0 terminator.
* '0' used when their is no maximum */
int RNA_property_string_maxlength(PropertyRNA *prop)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
- return sprop->maxlength;
+ StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
+ return sprop->maxlength;
}
StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop)
{
- prop = rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if (prop->type == PROP_POINTER) {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ if (prop->type == PROP_POINTER) {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- if (pprop->typef)
- return pprop->typef(ptr);
- else if (pprop->type)
- return pprop->type;
- }
- else if (prop->type == PROP_COLLECTION) {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ if (pprop->typef)
+ return pprop->typef(ptr);
+ else if (pprop->type)
+ return pprop->type;
+ }
+ else if (prop->type == PROP_COLLECTION) {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- if (cprop->item_type)
- return cprop->item_type;
- }
- /* ignore other types, RNA_struct_find_nested calls with unchecked props */
+ if (cprop->item_type)
+ return cprop->item_type;
+ }
+ /* ignore other types, RNA_struct_find_nested calls with unchecked props */
- return &RNA_UnknownType;
+ return &RNA_UnknownType;
}
bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value)
{
- prop = rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if (prop->type == PROP_POINTER) {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ if (prop->type == PROP_POINTER) {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- if (pprop->poll) {
- if (rna_idproperty_check(&prop, ptr)) {
- return ((PropPointerPollFuncPy) pprop->poll)(ptr, *value, prop);
- }
- else {
- return pprop->poll(ptr, *value);
- }
- }
+ if (pprop->poll) {
+ if (rna_idproperty_check(&prop, ptr)) {
+ return ((PropPointerPollFuncPy)pprop->poll)(ptr, *value, prop);
+ }
+ else {
+ return pprop->poll(ptr, *value);
+ }
+ }
- return 1;
- }
+ return 1;
+ }
- printf("%s: %s is not a pointer property.\n", __func__, prop->identifier);
- return 0;
+ printf("%s: %s is not a pointer property.\n", __func__, prop->identifier);
+ return 0;
}
-void RNA_property_enum_items_ex(
- bContext *C, PointerRNA *ptr, PropertyRNA *prop, const bool use_static,
- const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
+void RNA_property_enum_items_ex(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const bool use_static,
+ const EnumPropertyItem **r_item,
+ int *r_totitem,
+ bool *r_free)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
- *r_free = false;
+ *r_free = false;
- if (!use_static && eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
- const EnumPropertyItem *item;
+ if (!use_static && eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
+ const EnumPropertyItem *item;
- if (prop->flag & PROP_ENUM_NO_CONTEXT)
- item = eprop->itemf(NULL, ptr, prop, r_free);
- else
- item = eprop->itemf(C, ptr, prop, r_free);
+ if (prop->flag & PROP_ENUM_NO_CONTEXT)
+ item = eprop->itemf(NULL, ptr, prop, r_free);
+ else
+ item = eprop->itemf(C, ptr, prop, r_free);
- /* any callbacks returning NULL should be fixed */
- BLI_assert(item != NULL);
+ /* any callbacks returning NULL should be fixed */
+ BLI_assert(item != NULL);
- if (r_totitem) {
- int tot;
- for (tot = 0; item[tot].identifier; tot++) {
- /* pass */
- }
- *r_totitem = tot;
- }
+ if (r_totitem) {
+ int tot;
+ for (tot = 0; item[tot].identifier; tot++) {
+ /* pass */
+ }
+ *r_totitem = tot;
+ }
- *r_item = item;
- }
- else {
- *r_item = eprop->item;
- if (r_totitem)
- *r_totitem = eprop->totitem;
- }
+ *r_item = item;
+ }
+ else {
+ *r_item = eprop->item;
+ if (r_totitem)
+ *r_totitem = eprop->totitem;
+ }
}
-void RNA_property_enum_items(
- bContext *C, PointerRNA *ptr, PropertyRNA *prop,
- const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
+void RNA_property_enum_items(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const EnumPropertyItem **r_item,
+ int *r_totitem,
+ bool *r_free)
{
- RNA_property_enum_items_ex(C, ptr, prop, false, r_item, r_totitem, r_free);
+ RNA_property_enum_items_ex(C, ptr, prop, false, r_item, r_totitem, r_free);
}
#ifdef WITH_INTERNATIONAL
-static void property_enum_translate(
- PropertyRNA *prop, EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
-{
- if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
- int i;
-
- /* Note: Only do those tests once, and then use BLT_pgettext. */
- bool do_iface = BLT_translate_iface();
- bool do_tooltip = BLT_translate_tooltips();
- EnumPropertyItem *nitem;
-
- if (!(do_iface || do_tooltip))
- return;
-
- if (*r_free) {
- nitem = *r_item;
- }
- else {
- const EnumPropertyItem *item = *r_item;
- int tot;
-
- if (r_totitem) {
- tot = *r_totitem;
- }
- else {
- /* count */
- for (tot = 0; item[tot].identifier; tot++) {
- /* pass */
- }
- }
-
- nitem = MEM_mallocN(sizeof(EnumPropertyItem) * (tot + 1), "enum_items_gettexted");
- memcpy(nitem, item, sizeof(EnumPropertyItem) * (tot + 1));
-
- *r_free = true;
- }
-
- for (i = 0; nitem[i].identifier; i++) {
- if (nitem[i].name && do_iface) {
- nitem[i].name = BLT_pgettext(prop->translation_context, nitem[i].name);
- }
- if (nitem[i].description && do_tooltip) {
- nitem[i].description = BLT_pgettext(NULL, nitem[i].description);
- }
- }
-
- *r_item = nitem;
- }
+static void property_enum_translate(PropertyRNA *prop,
+ EnumPropertyItem **r_item,
+ int *r_totitem,
+ bool *r_free)
+{
+ if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
+ int i;
+
+ /* Note: Only do those tests once, and then use BLT_pgettext. */
+ bool do_iface = BLT_translate_iface();
+ bool do_tooltip = BLT_translate_tooltips();
+ EnumPropertyItem *nitem;
+
+ if (!(do_iface || do_tooltip))
+ return;
+
+ if (*r_free) {
+ nitem = *r_item;
+ }
+ else {
+ const EnumPropertyItem *item = *r_item;
+ int tot;
+
+ if (r_totitem) {
+ tot = *r_totitem;
+ }
+ else {
+ /* count */
+ for (tot = 0; item[tot].identifier; tot++) {
+ /* pass */
+ }
+ }
+
+ nitem = MEM_mallocN(sizeof(EnumPropertyItem) * (tot + 1), "enum_items_gettexted");
+ memcpy(nitem, item, sizeof(EnumPropertyItem) * (tot + 1));
+
+ *r_free = true;
+ }
+
+ for (i = 0; nitem[i].identifier; i++) {
+ if (nitem[i].name && do_iface) {
+ nitem[i].name = BLT_pgettext(prop->translation_context, nitem[i].name);
+ }
+ if (nitem[i].description && do_tooltip) {
+ nitem[i].description = BLT_pgettext(NULL, nitem[i].description);
+ }
+ }
+
+ *r_item = nitem;
+ }
}
#endif
-void RNA_property_enum_items_gettexted(
- bContext *C, PointerRNA *ptr, PropertyRNA *prop,
- const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
+void RNA_property_enum_items_gettexted(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const EnumPropertyItem **r_item,
+ int *r_totitem,
+ bool *r_free)
{
- RNA_property_enum_items(C, ptr, prop, r_item, r_totitem, r_free);
+ RNA_property_enum_items(C, ptr, prop, r_item, r_totitem, r_free);
#ifdef WITH_INTERNATIONAL
- /* Normally dropping 'const' is _not_ ok, in this case it's only modified if we own the memory
- * so allow the exception (callers are creating new arrays in this case). */
- property_enum_translate(prop, (EnumPropertyItem **)r_item, r_totitem, r_free);
+ /* Normally dropping 'const' is _not_ ok, in this case it's only modified if we own the memory
+ * so allow the exception (callers are creating new arrays in this case). */
+ property_enum_translate(prop, (EnumPropertyItem **)r_item, r_totitem, r_free);
#endif
}
-void RNA_property_enum_items_gettexted_all(
- bContext *C, PointerRNA *ptr, PropertyRNA *prop,
- const EnumPropertyItem **r_item, int *r_totitem, bool *r_free)
-{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
- int mem_size = sizeof(EnumPropertyItem) * (eprop->totitem + 1);
- /* first return all items */
- EnumPropertyItem *item_array = MEM_mallocN(mem_size, "enum_gettext_all");
- *r_free = true;
- memcpy(item_array, eprop->item, mem_size);
-
- if (r_totitem) {
- *r_totitem = eprop->totitem;
- }
-
- if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
- const EnumPropertyItem *item;
- int i;
- bool free = false;
-
- if (prop->flag & PROP_ENUM_NO_CONTEXT)
- item = eprop->itemf(NULL, ptr, prop, &free);
- else
- item = eprop->itemf(C, ptr, prop, &free);
-
- /* any callbacks returning NULL should be fixed */
- BLI_assert(item != NULL);
-
- for (i = 0; i < eprop->totitem; i++) {
- bool exists = false;
- int i_fixed;
-
- /* items that do not exist on list are returned, but have their names/identifiers NULLed out */
- for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) {
- if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) {
- exists = true;
- break;
- }
- }
-
- if (!exists) {
- item_array[i].name = NULL;
- item_array[i].identifier = "";
- }
- }
-
- if (free) {
- MEM_freeN((void *)item);
- }
- }
+void RNA_property_enum_items_gettexted_all(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const EnumPropertyItem **r_item,
+ int *r_totitem,
+ bool *r_free)
+{
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
+ int mem_size = sizeof(EnumPropertyItem) * (eprop->totitem + 1);
+ /* first return all items */
+ EnumPropertyItem *item_array = MEM_mallocN(mem_size, "enum_gettext_all");
+ *r_free = true;
+ memcpy(item_array, eprop->item, mem_size);
+
+ if (r_totitem) {
+ *r_totitem = eprop->totitem;
+ }
+
+ if (eprop->itemf && (C != NULL || (prop->flag & PROP_ENUM_NO_CONTEXT))) {
+ const EnumPropertyItem *item;
+ int i;
+ bool free = false;
+
+ if (prop->flag & PROP_ENUM_NO_CONTEXT)
+ item = eprop->itemf(NULL, ptr, prop, &free);
+ else
+ item = eprop->itemf(C, ptr, prop, &free);
+
+ /* any callbacks returning NULL should be fixed */
+ BLI_assert(item != NULL);
+
+ for (i = 0; i < eprop->totitem; i++) {
+ bool exists = false;
+ int i_fixed;
+
+ /* items that do not exist on list are returned, but have their names/identifiers NULLed out */
+ for (i_fixed = 0; item[i_fixed].identifier; i_fixed++) {
+ if (STREQ(item[i_fixed].identifier, item_array[i].identifier)) {
+ exists = true;
+ break;
+ }
+ }
+
+ if (!exists) {
+ item_array[i].name = NULL;
+ item_array[i].identifier = "";
+ }
+ }
+
+ if (free) {
+ MEM_freeN((void *)item);
+ }
+ }
#ifdef WITH_INTERNATIONAL
- property_enum_translate(prop, &item_array, r_totitem, r_free);
+ property_enum_translate(prop, &item_array, r_totitem, r_free);
#endif
- *r_item = item_array;
+ *r_item = item_array;
}
-bool RNA_property_enum_value(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value)
+bool RNA_property_enum_value(
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value)
{
- const EnumPropertyItem *item;
- bool free;
- bool found;
+ const EnumPropertyItem *item;
+ bool free;
+ bool found;
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if (item) {
- const int i = RNA_enum_from_identifier(item, identifier);
- if (i != -1) {
- *r_value = item[i].value;
- found = true;
- }
- else {
- found = false;
- }
+ if (item) {
+ const int i = RNA_enum_from_identifier(item, identifier);
+ if (i != -1) {
+ *r_value = item[i].value;
+ found = true;
+ }
+ else {
+ found = false;
+ }
- if (free) {
- MEM_freeN((void *)item);
- }
- }
- else {
- found = false;
- }
- return found;
+ if (free) {
+ MEM_freeN((void *)item);
+ }
+ }
+ else {
+ found = false;
+ }
+ return found;
}
bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **r_identifier)
{
- const int i = RNA_enum_from_value(item, value);
- if (i != -1) {
- *r_identifier = item[i].identifier;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_value(item, value);
+ if (i != -1) {
+ *r_identifier = item[i].identifier;
+ return true;
+ }
+ else {
+ return false;
+ }
}
-int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, const int value, const char **r_identifier)
+int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item,
+ const int value,
+ const char **r_identifier)
{
- int index = 0;
- for (; item->identifier; item++) {
- if (item->identifier[0] && item->value & value) {
- r_identifier[index++] = item->identifier;
- }
- }
- r_identifier[index] = NULL;
- return index;
+ int index = 0;
+ for (; item->identifier; item++) {
+ if (item->identifier[0] && item->value & value) {
+ r_identifier[index++] = item->identifier;
+ }
+ }
+ r_identifier[index] = NULL;
+ return index;
}
bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r_name)
{
- const int i = RNA_enum_from_value(item, value);
- if (i != -1) {
- *r_name = item[i].name;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_value(item, value);
+ if (i != -1) {
+ *r_name = item[i].name;
+ return true;
+ }
+ else {
+ return false;
+ }
}
-bool RNA_enum_description(const EnumPropertyItem *item, const int value, const char **r_description)
+bool RNA_enum_description(const EnumPropertyItem *item,
+ const int value,
+ const char **r_description)
{
- const int i = RNA_enum_from_value(item, value);
- if (i != -1) {
- *r_description = item[i].description;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_value(item, value);
+ if (i != -1) {
+ *r_description = item[i].description;
+ return true;
+ }
+ else {
+ return false;
+ }
}
int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier)
{
- int i = 0;
- for (; item->identifier; item++, i++) {
- if (item->identifier[0] && STREQ(item->identifier, identifier)) {
- return i;
- }
- }
- return -1;
+ int i = 0;
+ for (; item->identifier; item++, i++) {
+ if (item->identifier[0] && STREQ(item->identifier, identifier)) {
+ return i;
+ }
+ }
+ return -1;
}
/**
@@ -1758,199 +1800,198 @@ int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifie
*/
int RNA_enum_from_name(const EnumPropertyItem *item, const char *name)
{
- int i = 0;
- for (; item->identifier; item++, i++) {
- if (item->identifier[0] && STREQ(item->name, name)) {
- return i;
- }
- }
- return -1;
+ int i = 0;
+ for (; item->identifier; item++, i++) {
+ if (item->identifier[0] && STREQ(item->name, name)) {
+ return i;
+ }
+ }
+ return -1;
}
int RNA_enum_from_value(const EnumPropertyItem *item, const int value)
{
- int i = 0;
- for (; item->identifier; item++, i++) {
- if (item->identifier[0] && item->value == value) {
- return i;
- }
- }
- return -1;
+ int i = 0;
+ for (; item->identifier; item++, i++) {
+ if (item->identifier[0] && item->value == value) {
+ return i;
+ }
+ }
+ return -1;
}
unsigned int RNA_enum_items_count(const EnumPropertyItem *item)
{
- unsigned int i = 0;
+ unsigned int i = 0;
- while (item->identifier) {
- item++;
- i++;
- }
+ while (item->identifier) {
+ item++;
+ i++;
+ }
- return i;
+ return i;
}
-bool RNA_property_enum_identifier(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
- const char **identifier)
+bool RNA_property_enum_identifier(
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
{
- const EnumPropertyItem *item = NULL;
- bool free;
+ const EnumPropertyItem *item = NULL;
+ bool free;
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if (item) {
- bool result;
- result = RNA_enum_identifier(item, value, identifier);
- if (free) {
- MEM_freeN((void *)item);
- }
- return result;
- }
- return false;
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ if (item) {
+ bool result;
+ result = RNA_enum_identifier(item, value, identifier);
+ if (free) {
+ MEM_freeN((void *)item);
+ }
+ return result;
+ }
+ return false;
}
-bool RNA_property_enum_name(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
+bool RNA_property_enum_name(
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
{
- const EnumPropertyItem *item = NULL;
- bool free;
+ const EnumPropertyItem *item = NULL;
+ bool free;
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if (item) {
- bool result;
- result = RNA_enum_name(item, value, name);
- if (free) {
- MEM_freeN((void *)item);
- }
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ if (item) {
+ bool result;
+ result = RNA_enum_name(item, value, name);
+ if (free) {
+ MEM_freeN((void *)item);
+ }
- return result;
- }
- return false;
+ return result;
+ }
+ return false;
}
-bool RNA_property_enum_name_gettexted(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
+bool RNA_property_enum_name_gettexted(
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name)
{
- bool result;
+ bool result;
- result = RNA_property_enum_name(C, ptr, prop, value, name);
+ result = RNA_property_enum_name(C, ptr, prop, value, name);
- if (result) {
- if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
- if (BLT_translate_iface()) {
- *name = BLT_pgettext(prop->translation_context, *name);
- }
- }
- }
+ if (result) {
+ if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
+ if (BLT_translate_iface()) {
+ *name = BLT_pgettext(prop->translation_context, *name);
+ }
+ }
+ }
- return result;
+ return result;
}
bool RNA_property_enum_item_from_value(
- bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
- EnumPropertyItem *r_item)
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, EnumPropertyItem *r_item)
{
- const EnumPropertyItem *item = NULL;
- bool free;
+ const EnumPropertyItem *item = NULL;
+ bool free;
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if (item) {
- const int i = RNA_enum_from_value(item, value);
- bool result;
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ if (item) {
+ const int i = RNA_enum_from_value(item, value);
+ bool result;
- if (i != -1) {
- *r_item = item[i];
- result = true;
- }
- else {
- result = false;
- }
+ if (i != -1) {
+ *r_item = item[i];
+ result = true;
+ }
+ else {
+ result = false;
+ }
- if (free) {
- MEM_freeN((void *)item);
- }
+ if (free) {
+ MEM_freeN((void *)item);
+ }
- return result;
- }
- return false;
+ return result;
+ }
+ return false;
}
bool RNA_property_enum_item_from_value_gettexted(
- bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
- EnumPropertyItem *r_item)
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, EnumPropertyItem *r_item)
{
- bool result;
+ bool result;
- result = RNA_property_enum_item_from_value(C, ptr, prop, value, r_item);
+ result = RNA_property_enum_item_from_value(C, ptr, prop, value, r_item);
- if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
- if (BLT_translate_iface()) {
- r_item->name = BLT_pgettext(prop->translation_context, r_item->name);
- }
- }
+ if (!(prop->flag & PROP_ENUM_NO_TRANSLATE)) {
+ if (BLT_translate_iface()) {
+ r_item->name = BLT_pgettext(prop->translation_context, r_item->name);
+ }
+ }
- return result;
+ return result;
}
-int RNA_property_enum_bitflag_identifiers(bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value,
- const char **identifier)
+int RNA_property_enum_bitflag_identifiers(
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **identifier)
{
- const EnumPropertyItem *item = NULL;
- bool free;
+ const EnumPropertyItem *item = NULL;
+ bool free;
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- if (item) {
- int result;
- result = RNA_enum_bitflag_identifiers(item, value, identifier);
- if (free)
- MEM_freeN((void *)item);
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ if (item) {
+ int result;
+ result = RNA_enum_bitflag_identifiers(item, value, identifier);
+ if (free)
+ MEM_freeN((void *)item);
- return result;
- }
- return 0;
+ return result;
+ }
+ return 0;
}
const char *RNA_property_ui_name(PropertyRNA *prop)
{
- return CTX_IFACE_(prop->translation_context, rna_ensure_property_name(prop));
+ return CTX_IFACE_(prop->translation_context, rna_ensure_property_name(prop));
}
const char *RNA_property_ui_name_raw(PropertyRNA *prop)
{
- return rna_ensure_property_name(prop);
+ return rna_ensure_property_name(prop);
}
const char *RNA_property_ui_description(PropertyRNA *prop)
{
- return TIP_(rna_ensure_property_description(prop));
+ return TIP_(rna_ensure_property_description(prop));
}
const char *RNA_property_ui_description_raw(PropertyRNA *prop)
{
- return rna_ensure_property_description(prop);
+ return rna_ensure_property_description(prop);
}
const char *RNA_property_translation_context(PropertyRNA *_prop)
{
- PropertyRNA *prop = rna_ensure_property(_prop);
- return prop->translation_context;
+ PropertyRNA *prop = rna_ensure_property(_prop);
+ return prop->translation_context;
}
int RNA_property_ui_icon(PropertyRNA *prop)
{
- return rna_ensure_property(prop)->icon;
+ return rna_ensure_property(prop)->icon;
}
bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
{
- ID *id = ptr->id.data;
- int flag;
- const char *dummy_info;
+ ID *id = ptr->id.data;
+ int flag;
+ const char *dummy_info;
- prop = rna_ensure_property(prop);
- flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag;
+ prop = rna_ensure_property(prop);
+ flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag;
- return ((flag & PROP_EDITABLE) &&
- (flag & PROP_REGISTER) == 0 &&
- (!id || ((!ID_IS_LINKED(id) || (prop->flag & PROP_LIB_EXCEPTION)) &&
- (!id->override_static || RNA_property_overridable_get(ptr, prop)))));
+ return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0 &&
+ (!id || ((!ID_IS_LINKED(id) || (prop->flag & PROP_LIB_EXCEPTION)) &&
+ (!id->override_static || RNA_property_overridable_get(ptr, prop)))));
}
/**
@@ -1958,259 +1999,260 @@ bool RNA_property_editable(PointerRNA *ptr, PropertyRNA *prop)
*/
bool RNA_property_editable_info(PointerRNA *ptr, PropertyRNA *prop, const char **r_info)
{
- ID *id = ptr->id.data;
- int flag;
-
- prop = rna_ensure_property(prop);
- *r_info = "";
-
- /* get flag */
- if (prop->editable) {
- flag = prop->editable(ptr, r_info);
- }
- else {
- flag = prop->flag;
- if ((flag & PROP_EDITABLE) == 0 || (flag & PROP_REGISTER)) {
- *r_info = N_("This property is for internal use only and can't be edited");
- }
- }
-
- /* property from linked data-block */
- if (id) {
- if (ID_IS_LINKED(id) && (prop->flag & PROP_LIB_EXCEPTION) == 0) {
- if (!(*r_info)[0]) {
- *r_info = N_("Can't edit this property from a linked data-block");
- }
- return false;
- }
- if (id->override_static != NULL && !RNA_property_overridable_get(ptr, prop)) {
- if (!(*r_info)[0]) {
- *r_info = N_("Can't edit this property from an override data-block");
- }
- return false;
- }
- }
-
- return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0);
+ ID *id = ptr->id.data;
+ int flag;
+
+ prop = rna_ensure_property(prop);
+ *r_info = "";
+
+ /* get flag */
+ if (prop->editable) {
+ flag = prop->editable(ptr, r_info);
+ }
+ else {
+ flag = prop->flag;
+ if ((flag & PROP_EDITABLE) == 0 || (flag & PROP_REGISTER)) {
+ *r_info = N_("This property is for internal use only and can't be edited");
+ }
+ }
+
+ /* property from linked data-block */
+ if (id) {
+ if (ID_IS_LINKED(id) && (prop->flag & PROP_LIB_EXCEPTION) == 0) {
+ if (!(*r_info)[0]) {
+ *r_info = N_("Can't edit this property from a linked data-block");
+ }
+ return false;
+ }
+ if (id->override_static != NULL && !RNA_property_overridable_get(ptr, prop)) {
+ if (!(*r_info)[0]) {
+ *r_info = N_("Can't edit this property from an override data-block");
+ }
+ return false;
+ }
+ }
+
+ return ((flag & PROP_EDITABLE) && (flag & PROP_REGISTER) == 0);
}
bool RNA_property_editable_flag(PointerRNA *ptr, PropertyRNA *prop)
{
- int flag;
- const char *dummy_info;
+ int flag;
+ const char *dummy_info;
- prop = rna_ensure_property(prop);
- flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag;
- return (flag & PROP_EDITABLE) != 0;
+ prop = rna_ensure_property(prop);
+ flag = prop->editable ? prop->editable(ptr, &dummy_info) : prop->flag;
+ return (flag & PROP_EDITABLE) != 0;
}
/* same as RNA_property_editable(), except this checks individual items in an array */
bool RNA_property_editable_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- ID *id;
- int flag;
+ ID *id;
+ int flag;
- BLI_assert(index >= 0);
+ BLI_assert(index >= 0);
- prop = rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- flag = prop->flag;
+ flag = prop->flag;
- if (prop->editable) {
- const char *dummy_info;
- flag &= prop->editable(ptr, &dummy_info);
- }
+ if (prop->editable) {
+ const char *dummy_info;
+ flag &= prop->editable(ptr, &dummy_info);
+ }
- if (prop->itemeditable)
- flag &= prop->itemeditable(ptr, index);
+ if (prop->itemeditable)
+ flag &= prop->itemeditable(ptr, index);
- id = ptr->id.data;
+ id = ptr->id.data;
- return (flag & PROP_EDITABLE) && (!id || !ID_IS_LINKED(id) || (prop->flag & PROP_LIB_EXCEPTION));
+ return (flag & PROP_EDITABLE) && (!id || !ID_IS_LINKED(id) || (prop->flag & PROP_LIB_EXCEPTION));
}
bool RNA_property_animateable(PointerRNA *ptr, PropertyRNA *prop)
{
- /* check that base ID-block can support animation data */
- if (!id_can_have_animdata(ptr->id.data))
- return false;
+ /* check that base ID-block can support animation data */
+ if (!id_can_have_animdata(ptr->id.data))
+ return false;
- prop = rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- if (!(prop->flag & PROP_ANIMATABLE))
- return false;
+ if (!(prop->flag & PROP_ANIMATABLE))
+ return false;
- return (prop->flag & PROP_EDITABLE) != 0;
+ return (prop->flag & PROP_EDITABLE) != 0;
}
bool RNA_property_animated(PointerRNA *ptr, PropertyRNA *prop)
{
- int len = 1, index;
- bool driven, special;
+ int len = 1, index;
+ bool driven, special;
- if (!prop)
- return false;
+ if (!prop)
+ return false;
- if (RNA_property_array_check(prop))
- len = RNA_property_array_length(ptr, prop);
+ if (RNA_property_array_check(prop))
+ len = RNA_property_array_length(ptr, prop);
- for (index = 0; index < len; index++) {
- if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special))
- return true;
- }
+ for (index = 0; index < len; index++) {
+ if (rna_get_fcurve(ptr, prop, index, NULL, NULL, &driven, &special))
+ return true;
+ }
- return false;
+ return false;
}
/** \note Does not take into account editable status, this has to be checked separately
* (using #RNA_property_editable_flag() usually). */
bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
{
- if (prop->magic == RNA_MAGIC) {
- /* Special handling for insertions of constraints or modifiers... */
- /* TODO Note We may want to add a more generic system to RNA (like a special property in struct of items)
- * if we get more overrideable collections, for now we can live with those special-cases handling I think. */
- if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
- bConstraint *con = ptr->data;
- if (con->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) {
- return true;
- }
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
- ModifierData *mod = ptr->data;
- if (mod->flag & eModifierFlag_StaticOverride_Local) {
- return true;
- }
- }
- /* If this is a RNA-defined property (real or 'virtual' IDProp), we want to use RNA prop flag. */
- return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC);
- }
- else {
- /* If this is a real 'pure' IDProp (aka custom property), we want to use the IDProp flag. */
- return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) && (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_STATIC);
- }
+ if (prop->magic == RNA_MAGIC) {
+ /* Special handling for insertions of constraints or modifiers... */
+ /* TODO Note We may want to add a more generic system to RNA (like a special property in struct of items)
+ * if we get more overrideable collections, for now we can live with those special-cases handling I think. */
+ if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
+ bConstraint *con = ptr->data;
+ if (con->flag & CONSTRAINT_STATICOVERRIDE_LOCAL) {
+ return true;
+ }
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_Modifier)) {
+ ModifierData *mod = ptr->data;
+ if (mod->flag & eModifierFlag_StaticOverride_Local) {
+ return true;
+ }
+ }
+ /* If this is a RNA-defined property (real or 'virtual' IDProp), we want to use RNA prop flag. */
+ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) &&
+ (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC);
+ }
+ else {
+ /* If this is a real 'pure' IDProp (aka custom property), we want to use the IDProp flag. */
+ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON) &&
+ (((IDProperty *)prop)->flag & IDP_FLAG_OVERRIDABLE_STATIC);
+ }
}
/* Should only be used for custom properties */
-bool RNA_property_overridable_static_set(PointerRNA *UNUSED(ptr), PropertyRNA *prop, const bool is_overridable)
+bool RNA_property_overridable_static_set(PointerRNA *UNUSED(ptr),
+ PropertyRNA *prop,
+ const bool is_overridable)
{
- /* Only works for pure custom properties IDProps. */
- if (prop->magic != RNA_MAGIC) {
- IDProperty *idprop = (IDProperty *)prop;
+ /* Only works for pure custom properties IDProps. */
+ if (prop->magic != RNA_MAGIC) {
+ IDProperty *idprop = (IDProperty *)prop;
- idprop->flag = is_overridable ? (idprop->flag | IDP_FLAG_OVERRIDABLE_STATIC) :
- (idprop->flag & ~IDP_FLAG_OVERRIDABLE_STATIC);
- return true;
- }
+ idprop->flag = is_overridable ? (idprop->flag | IDP_FLAG_OVERRIDABLE_STATIC) :
+ (idprop->flag & ~IDP_FLAG_OVERRIDABLE_STATIC);
+ return true;
+ }
- return false;
+ return false;
}
-
bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop)
{
- char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
- ID *id = ptr->id.data;
+ char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
+ ID *id = ptr->id.data;
- if (rna_path == NULL || id == NULL || id->override_static == NULL) {
- return false;
- }
+ if (rna_path == NULL || id == NULL || id->override_static == NULL) {
+ return false;
+ }
- return (BKE_override_static_property_find(id->override_static, rna_path) != NULL);
+ return (BKE_override_static_property_find(id->override_static, rna_path) != NULL);
}
bool RNA_property_comparable(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- prop = rna_ensure_property(prop);
+ prop = rna_ensure_property(prop);
- return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON);
+ return !(prop->flag_override & PROPOVERRIDE_NO_COMPARISON);
}
/* this function is to check if its possible to create a valid path from the ID
* its slow so don't call in a loop */
bool RNA_property_path_from_ID_check(PointerRNA *ptr, PropertyRNA *prop)
{
- char *path = RNA_path_from_ID_to_property(ptr, prop);
- bool ret = false;
-
- if (path) {
- PointerRNA id_ptr;
- PointerRNA r_ptr;
- PropertyRNA *r_prop;
-
- RNA_id_pointer_create(ptr->id.data, &id_ptr);
- if (RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop) == true) {
- ret = (prop == r_prop);
- }
- MEM_freeN(path);
- }
-
- return ret;
-}
-
-
-static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
-{
- const bool is_rna = (prop->magic == RNA_MAGIC);
- prop = rna_ensure_property(prop);
-
- if (is_rna) {
- if (prop->update) {
- /* ideally no context would be needed for update, but there's some
- * parts of the code that need it still, so we have this exception */
- if (prop->flag & PROP_CONTEXT_UPDATE) {
- if (C) {
- if ((prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) == PROP_CONTEXT_PROPERTY_UPDATE) {
- ((ContextPropUpdateFunc)prop->update)(C, ptr, prop);
- }
- else {
- ((ContextUpdateFunc)prop->update)(C, ptr);
- }
- }
- }
- else
- prop->update(bmain, scene, ptr);
- }
+ char *path = RNA_path_from_ID_to_property(ptr, prop);
+ bool ret = false;
+
+ if (path) {
+ PointerRNA id_ptr;
+ PointerRNA r_ptr;
+ PropertyRNA *r_prop;
+
+ RNA_id_pointer_create(ptr->id.data, &id_ptr);
+ if (RNA_path_resolve(&id_ptr, path, &r_ptr, &r_prop) == true) {
+ ret = (prop == r_prop);
+ }
+ MEM_freeN(path);
+ }
+
+ return ret;
+}
+
+static void rna_property_update(
+ bContext *C, Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
+{
+ const bool is_rna = (prop->magic == RNA_MAGIC);
+ prop = rna_ensure_property(prop);
+
+ if (is_rna) {
+ if (prop->update) {
+ /* ideally no context would be needed for update, but there's some
+ * parts of the code that need it still, so we have this exception */
+ if (prop->flag & PROP_CONTEXT_UPDATE) {
+ if (C) {
+ if ((prop->flag & PROP_CONTEXT_PROPERTY_UPDATE) == PROP_CONTEXT_PROPERTY_UPDATE) {
+ ((ContextPropUpdateFunc)prop->update)(C, ptr, prop);
+ }
+ else {
+ ((ContextUpdateFunc)prop->update)(C, ptr);
+ }
+ }
+ }
+ else
+ prop->update(bmain, scene, ptr);
+ }
#if 1
- /* TODO(campbell): Should eventually be replaced entirely by message bus (below)
- * for now keep since COW, bugs are hard to track when we have other missing updates. */
- if (prop->noteflag) {
- WM_main_add_notifier(prop->noteflag, ptr->id.data);
- }
+ /* TODO(campbell): Should eventually be replaced entirely by message bus (below)
+ * for now keep since COW, bugs are hard to track when we have other missing updates. */
+ if (prop->noteflag) {
+ WM_main_add_notifier(prop->noteflag, ptr->id.data);
+ }
#endif
- /* if C is NULL, we're updating from animation.
- * avoid slow-down from f-curves by not publishing (for now). */
- if (C != NULL) {
- struct wmMsgBus *mbus = CTX_wm_message_bus(C);
- /* we could add NULL check, for now don't */
- WM_msg_publish_rna(mbus, ptr, prop);
- }
- if (ptr->id.data != NULL && ((prop->flag & PROP_NO_DEG_UPDATE) == 0)) {
- const short id_type = GS(((ID *)ptr->id.data)->name);
- if (ID_TYPE_IS_COW(id_type)) {
- DEG_id_tag_update(ptr->id.data, ID_RECALC_COPY_ON_WRITE);
- }
- }
- /* End message bus. */
- }
-
- if (!is_rna || (prop->flag & PROP_IDPROPERTY)) {
- /* WARNING! This is so property drivers update the display!
- * not especially nice */
- DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_WINDOW, NULL);
- /* Not nice as well, but the only way to make sure material preview
- * is updated with custom nodes.
- */
- if ((prop->flag & PROP_IDPROPERTY) != 0 &&
- (ptr->id.data != NULL) &&
- (GS(((ID *)ptr->id.data)->name) == ID_NT))
- {
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
- }
- }
+ /* if C is NULL, we're updating from animation.
+ * avoid slow-down from f-curves by not publishing (for now). */
+ if (C != NULL) {
+ struct wmMsgBus *mbus = CTX_wm_message_bus(C);
+ /* we could add NULL check, for now don't */
+ WM_msg_publish_rna(mbus, ptr, prop);
+ }
+ if (ptr->id.data != NULL && ((prop->flag & PROP_NO_DEG_UPDATE) == 0)) {
+ const short id_type = GS(((ID *)ptr->id.data)->name);
+ if (ID_TYPE_IS_COW(id_type)) {
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+ /* End message bus. */
+ }
+
+ if (!is_rna || (prop->flag & PROP_IDPROPERTY)) {
+ /* WARNING! This is so property drivers update the display!
+ * not especially nice */
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ /* Not nice as well, but the only way to make sure material preview
+ * is updated with custom nodes.
+ */
+ if ((prop->flag & PROP_IDPROPERTY) != 0 && (ptr->id.data != NULL) &&
+ (GS(((ID *)ptr->id.data)->name) == ID_NT)) {
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
+ }
+ }
}
/* must keep in sync with 'rna_property_update'
@@ -2218,20 +2260,19 @@ static void rna_property_update(bContext *C, Main *bmain, Scene *scene, PointerR
* but this isn't likely to be a performance problem. */
bool RNA_property_update_check(PropertyRNA *prop)
{
- return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag);
+ return (prop->magic != RNA_MAGIC || prop->update || prop->noteflag);
}
void RNA_property_update(bContext *C, PointerRNA *ptr, PropertyRNA *prop)
{
- rna_property_update(C, CTX_data_main(C), CTX_data_scene(C), ptr, prop);
+ rna_property_update(C, CTX_data_main(C), CTX_data_scene(C), ptr, prop);
}
void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, PropertyRNA *prop)
{
- rna_property_update(NULL, bmain, scene, ptr, prop);
+ rna_property_update(NULL, bmain, scene, ptr, prop);
}
-
/* RNA Updates Cache ------------------------ */
/* Overview of RNA Update cache system:
*
@@ -2248,10 +2289,10 @@ void RNA_property_update_main(Main *bmain, Scene *scene, PointerRNA *ptr, Proper
/* cache element */
typedef struct tRnaUpdateCacheElem {
- struct tRnaUpdateCacheElem *next, *prev;
+ struct tRnaUpdateCacheElem *next, *prev;
- PointerRNA ptr; /* L1 key - id as primary, data secondary/ignored? */
- ListBase L2Funcs; /* L2 functions (LinkData<RnaUpdateFuncRef>) */
+ PointerRNA ptr; /* L1 key - id as primary, data secondary/ignored? */
+ ListBase L2Funcs; /* L2 functions (LinkData<RnaUpdateFuncRef>) */
} tRnaUpdateCacheElem;
/* cache global (tRnaUpdateCacheElem's) - only accessible using these API calls */
@@ -2261,79 +2302,79 @@ static ListBase rna_updates_cache = {NULL, NULL};
void RNA_property_update_cache_add(PointerRNA *ptr, PropertyRNA *prop)
{
- const bool is_rna = (prop->magic == RNA_MAGIC);
- tRnaUpdateCacheElem *uce = NULL;
- UpdateFunc fn = NULL;
- LinkData *ld;
-
- /* sanity check */
- if (NULL == ptr)
- return;
-
- prop = rna_ensure_property(prop);
-
- /* we can only handle update calls with no context args for now (makes animsys updates easier) */
- if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
- return;
- fn = prop->update;
-
- /* find cache element for which key matches... */
- for (uce = rna_updates_cache.first; uce; uce = uce->next) {
- /* just match by id only for now, since most update calls that we'll encounter only really care about this */
- /* TODO: later, the cache might need to have some nesting on L1 to cope better
- * with these problems + some tagging to indicate we need this */
- if (uce->ptr.id.data == ptr->id.data)
- break;
- }
- if (uce == NULL) {
- /* create new instance */
- uce = MEM_callocN(sizeof(tRnaUpdateCacheElem), "tRnaUpdateCacheElem");
- BLI_addtail(&rna_updates_cache, uce);
-
- /* copy pointer */
- RNA_pointer_create(ptr->id.data, ptr->type, ptr->data, &uce->ptr);
- }
-
- /* check on the update func */
- for (ld = uce->L2Funcs.first; ld; ld = ld->next) {
- /* stop on match - function already cached */
- if (fn == ld->data)
- return;
- }
- /* else... if still here, we need to add it */
- BLI_addtail(&uce->L2Funcs, BLI_genericNodeN(fn));
+ const bool is_rna = (prop->magic == RNA_MAGIC);
+ tRnaUpdateCacheElem *uce = NULL;
+ UpdateFunc fn = NULL;
+ LinkData *ld;
+
+ /* sanity check */
+ if (NULL == ptr)
+ return;
+
+ prop = rna_ensure_property(prop);
+
+ /* we can only handle update calls with no context args for now (makes animsys updates easier) */
+ if ((is_rna == false) || (prop->update == NULL) || (prop->flag & PROP_CONTEXT_UPDATE))
+ return;
+ fn = prop->update;
+
+ /* find cache element for which key matches... */
+ for (uce = rna_updates_cache.first; uce; uce = uce->next) {
+ /* just match by id only for now, since most update calls that we'll encounter only really care about this */
+ /* TODO: later, the cache might need to have some nesting on L1 to cope better
+ * with these problems + some tagging to indicate we need this */
+ if (uce->ptr.id.data == ptr->id.data)
+ break;
+ }
+ if (uce == NULL) {
+ /* create new instance */
+ uce = MEM_callocN(sizeof(tRnaUpdateCacheElem), "tRnaUpdateCacheElem");
+ BLI_addtail(&rna_updates_cache, uce);
+
+ /* copy pointer */
+ RNA_pointer_create(ptr->id.data, ptr->type, ptr->data, &uce->ptr);
+ }
+
+ /* check on the update func */
+ for (ld = uce->L2Funcs.first; ld; ld = ld->next) {
+ /* stop on match - function already cached */
+ if (fn == ld->data)
+ return;
+ }
+ /* else... if still here, we need to add it */
+ BLI_addtail(&uce->L2Funcs, BLI_genericNodeN(fn));
}
void RNA_property_update_cache_flush(Main *bmain, Scene *scene)
{
- tRnaUpdateCacheElem *uce;
+ tRnaUpdateCacheElem *uce;
- /* TODO: should we check that bmain and scene are valid? The above stuff doesn't! */
+ /* TODO: should we check that bmain and scene are valid? The above stuff doesn't! */
- /* execute the cached updates */
- for (uce = rna_updates_cache.first; uce; uce = uce->next) {
- LinkData *ld;
+ /* execute the cached updates */
+ for (uce = rna_updates_cache.first; uce; uce = uce->next) {
+ LinkData *ld;
- for (ld = uce->L2Funcs.first; ld; ld = ld->next) {
- UpdateFunc fn = (UpdateFunc)ld->data;
- fn(bmain, scene, &uce->ptr);
- }
- }
+ for (ld = uce->L2Funcs.first; ld; ld = ld->next) {
+ UpdateFunc fn = (UpdateFunc)ld->data;
+ fn(bmain, scene, &uce->ptr);
+ }
+ }
}
void RNA_property_update_cache_free(void)
{
- tRnaUpdateCacheElem *uce, *ucn;
+ tRnaUpdateCacheElem *uce, *ucn;
- for (uce = rna_updates_cache.first; uce; uce = ucn) {
- ucn = uce->next;
+ for (uce = rna_updates_cache.first; uce; uce = ucn) {
+ ucn = uce->next;
- /* free L2 cache */
- BLI_freelistN(&uce->L2Funcs);
+ /* free L2 cache */
+ BLI_freelistN(&uce->L2Funcs);
- /* remove self */
- BLI_freelinkN(&rna_updates_cache, uce);
- }
+ /* remove self */
+ BLI_freelinkN(&rna_updates_cache, uce);
+ }
}
/* ---------------------------------------------------------------------- */
@@ -2342,1115 +2383,1131 @@ void RNA_property_update_cache_free(void)
bool RNA_property_boolean_get(PointerRNA *ptr, PropertyRNA *prop)
{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- IDProperty *idprop;
- bool value;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ IDProperty *idprop;
+ bool value;
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) == false);
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) == false);
- if ((idprop = rna_idproperty_check(&prop, ptr)))
- value = IDP_Int(idprop) != 0;
- else if (bprop->get)
- value = bprop->get(ptr);
- else if (bprop->get_ex)
- value = bprop->get_ex(ptr, prop);
- else
- value = bprop->defaultvalue;
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
+ value = IDP_Int(idprop) != 0;
+ else if (bprop->get)
+ value = bprop->get(ptr);
+ else if (bprop->get_ex)
+ value = bprop->get_ex(ptr, prop);
+ else
+ value = bprop->defaultvalue;
- BLI_assert(ELEM(value, false, true));
+ BLI_assert(ELEM(value, false, true));
- return value;
+ return value;
}
void RNA_property_boolean_set(PointerRNA *ptr, PropertyRNA *prop, bool value)
{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- IDProperty *idprop;
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) == false);
- BLI_assert(ELEM(value, false, true));
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) == false);
+ BLI_assert(ELEM(value, false, true));
- /* just in case other values are passed */
- BLI_assert(ELEM(value, true, false));
+ /* just in case other values are passed */
+ BLI_assert(ELEM(value, true, false));
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDP_Int(idprop) = (int)value;
- rna_idproperty_touch(idprop);
- }
- else if (bprop->set) {
- bprop->set(ptr, value);
- }
- else if (bprop->set_ex) {
- bprop->set_ex(ptr, prop, value);
- }
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_Int(idprop) = (int)value;
+ rna_idproperty_touch(idprop);
+ }
+ else if (bprop->set) {
+ bprop->set(ptr, value);
+ }
+ else if (bprop->set_ex) {
+ bprop->set_ex(ptr, prop, value);
+ }
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
- val.i = value;
+ val.i = value;
- group = RNA_struct_idprops(ptr, 1);
- if (group)
- IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
- }
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
+ IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
+ }
}
static void rna_property_boolean_get_default_array_values(BoolPropertyRNA *bprop, bool *values)
{
- unsigned int length = bprop->property.totarraylength;
+ unsigned int length = bprop->property.totarraylength;
- if (bprop->defaultarray) {
- memcpy(values, bprop->defaultarray, sizeof(bool) * length);
- }
- else {
- for (unsigned int i = 0; i < length; i++) {
- values[i] = bprop->defaultvalue;
- }
- }
+ if (bprop->defaultarray) {
+ memcpy(values, bprop->defaultarray, sizeof(bool) * length);
+ }
+ else {
+ for (unsigned int i = 0; i < length; i++) {
+ values[i] = bprop->defaultvalue;
+ }
+ }
}
void RNA_property_boolean_get_array(PointerRNA *ptr, PropertyRNA *prop, bool *values)
{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- IDProperty *idprop;
-
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) != false);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- if (prop->arraydimension == 0) {
- values[0] = RNA_property_boolean_get(ptr, prop);
- }
- else {
- int *values_src = IDP_Array(idprop);
- for (uint i = 0; i < idprop->len; i++) {
- values[i] = (bool)values_src[i];
- }
- }
- }
- else if (prop->arraydimension == 0)
- values[0] = RNA_property_boolean_get(ptr, prop);
- else if (bprop->getarray)
- bprop->getarray(ptr, values);
- else if (bprop->getarray_ex)
- bprop->getarray_ex(ptr, prop, values);
- else
- rna_property_boolean_get_default_array_values(bprop, values);
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) != false);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0) {
+ values[0] = RNA_property_boolean_get(ptr, prop);
+ }
+ else {
+ int *values_src = IDP_Array(idprop);
+ for (uint i = 0; i < idprop->len; i++) {
+ values[i] = (bool)values_src[i];
+ }
+ }
+ }
+ else if (prop->arraydimension == 0)
+ values[0] = RNA_property_boolean_get(ptr, prop);
+ else if (bprop->getarray)
+ bprop->getarray(ptr, values);
+ else if (bprop->getarray_ex)
+ bprop->getarray_ex(ptr, prop, values);
+ else
+ rna_property_boolean_get_default_array_values(bprop, values);
}
bool RNA_property_boolean_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- bool tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
- bool value;
+ bool tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
+ bool value;
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < len);
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < len);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_boolean_get_array(ptr, prop, tmp);
- value = tmp[index];
- }
- else {
- bool *tmparray;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_boolean_get_array(ptr, prop, tmp);
+ value = tmp[index];
+ }
+ else {
+ bool *tmparray;
- tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
- RNA_property_boolean_get_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
- }
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
+ RNA_property_boolean_get_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
+ }
- BLI_assert(ELEM(value, false, true));
+ BLI_assert(ELEM(value, false, true));
- return value;
+ return value;
}
void RNA_property_boolean_set_array(PointerRNA *ptr, PropertyRNA *prop, const bool *values)
{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- IDProperty *idprop;
-
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) != false);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- if (prop->arraydimension == 0) {
- IDP_Int(idprop) = values[0];
- }
- else {
- int *values_dst = IDP_Array(idprop);
- for (uint i = 0; i < idprop->len; i++) {
- values_dst[i] = (int)values[i];
- }
- }
- rna_idproperty_touch(idprop);
- }
- else if (prop->arraydimension == 0)
- RNA_property_boolean_set(ptr, prop, values[0]);
- else if (bprop->setarray)
- bprop->setarray(ptr, values);
- else if (bprop->setarray_ex)
- bprop->setarray_ex(ptr, prop, values);
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
-
- val.array.len = prop->totarraylength;
- val.array.type = IDP_INT;
-
- group = RNA_struct_idprops(ptr, 1);
- if (group) {
- idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
- IDP_AddToGroup(group, idprop);
- int *values_dst = IDP_Array(idprop);
- for (uint i = 0; i < idprop->len; i++) {
- values_dst[i] = (int)values[i];
- }
- }
- }
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) != false);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (prop->arraydimension == 0) {
+ IDP_Int(idprop) = values[0];
+ }
+ else {
+ int *values_dst = IDP_Array(idprop);
+ for (uint i = 0; i < idprop->len; i++) {
+ values_dst[i] = (int)values[i];
+ }
+ }
+ rna_idproperty_touch(idprop);
+ }
+ else if (prop->arraydimension == 0)
+ RNA_property_boolean_set(ptr, prop, values[0]);
+ else if (bprop->setarray)
+ bprop->setarray(ptr, values);
+ else if (bprop->setarray_ex)
+ bprop->setarray_ex(ptr, prop, values);
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
+
+ val.array.len = prop->totarraylength;
+ val.array.type = IDP_INT;
+
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
+ IDP_AddToGroup(group, idprop);
+ int *values_dst = IDP_Array(idprop);
+ for (uint i = 0; i < idprop->len; i++) {
+ values_dst[i] = (int)values[i];
+ }
+ }
+ }
}
void RNA_property_boolean_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, bool value)
{
- bool tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ bool tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < len);
- BLI_assert(ELEM(value, false, true));
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < len);
+ BLI_assert(ELEM(value, false, true));
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_boolean_get_array(ptr, prop, tmp);
- tmp[index] = value;
- RNA_property_boolean_set_array(ptr, prop, tmp);
- }
- else {
- bool *tmparray;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_boolean_get_array(ptr, prop, tmp);
+ tmp[index] = value;
+ RNA_property_boolean_set_array(ptr, prop, tmp);
+ }
+ else {
+ bool *tmparray;
- tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
- RNA_property_boolean_get_array(ptr, prop, tmparray);
- tmparray[index] = value;
- RNA_property_boolean_set_array(ptr, prop, tmparray);
- MEM_freeN(tmparray);
- }
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
+ RNA_property_boolean_get_array(ptr, prop, tmparray);
+ tmparray[index] = value;
+ RNA_property_boolean_set_array(ptr, prop, tmparray);
+ MEM_freeN(tmparray);
+ }
}
bool RNA_property_boolean_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) == false);
- BLI_assert(ELEM(bprop->defaultvalue, false, true));
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) == false);
+ BLI_assert(ELEM(bprop->defaultvalue, false, true));
- return bprop->defaultvalue;
+ return bprop->defaultvalue;
}
-void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, bool *values)
+void RNA_property_boolean_get_default_array(PointerRNA *UNUSED(ptr),
+ PropertyRNA *prop,
+ bool *values)
{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) != false);
- if (prop->arraydimension == 0)
- values[0] = bprop->defaultvalue;
- else
- rna_property_boolean_get_default_array_values(bprop, values);
+ if (prop->arraydimension == 0)
+ values[0] = bprop->defaultvalue;
+ else
+ rna_property_boolean_get_default_array_values(bprop, values);
}
bool RNA_property_boolean_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- bool tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ bool tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < prop->totarraylength);
+ BLI_assert(RNA_property_type(prop) == PROP_BOOLEAN);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < prop->totarraylength);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_boolean_get_default_array(ptr, prop, tmp);
- return tmp[index];
- }
- else {
- bool *tmparray, value;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_boolean_get_default_array(ptr, prop, tmp);
+ return tmp[index];
+ }
+ else {
+ bool *tmparray, value;
- tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
- RNA_property_boolean_get_default_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
+ tmparray = MEM_mallocN(sizeof(bool) * len, __func__);
+ RNA_property_boolean_get_default_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
- return value;
- }
+ return value;
+ }
}
int RNA_property_int_get(PointerRNA *ptr, PropertyRNA *prop)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- IDProperty *idprop;
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) == false);
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) == false);
- if ((idprop = rna_idproperty_check(&prop, ptr)))
- return IDP_Int(idprop);
- else if (iprop->get)
- return iprop->get(ptr);
- else if (iprop->get_ex)
- return iprop->get_ex(ptr, prop);
- else
- return iprop->defaultvalue;
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
+ return IDP_Int(idprop);
+ else if (iprop->get)
+ return iprop->get(ptr);
+ else if (iprop->get_ex)
+ return iprop->get_ex(ptr, prop);
+ else
+ return iprop->defaultvalue;
}
void RNA_property_int_set(PointerRNA *ptr, PropertyRNA *prop, int value)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- IDProperty *idprop;
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) == false);
- /* useful to check on bad values but set function should clamp */
- /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) == false);
+ /* useful to check on bad values but set function should clamp */
+ /* BLI_assert(RNA_property_int_clamp(ptr, prop, &value) == 0); */
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- RNA_property_int_clamp(ptr, prop, &value);
- IDP_Int(idprop) = value;
- rna_idproperty_touch(idprop);
- }
- else if (iprop->set)
- iprop->set(ptr, value);
- else if (iprop->set_ex)
- iprop->set_ex(ptr, prop, value);
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ RNA_property_int_clamp(ptr, prop, &value);
+ IDP_Int(idprop) = value;
+ rna_idproperty_touch(idprop);
+ }
+ else if (iprop->set)
+ iprop->set(ptr, value);
+ else if (iprop->set_ex)
+ iprop->set_ex(ptr, prop, value);
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
- RNA_property_int_clamp(ptr, prop, &value);
+ RNA_property_int_clamp(ptr, prop, &value);
- val.i = value;
+ val.i = value;
- group = RNA_struct_idprops(ptr, 1);
- if (group)
- IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
- }
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
+ IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
+ }
}
static void rna_property_int_get_default_array_values(IntPropertyRNA *iprop, int *values)
{
- unsigned int length = iprop->property.totarraylength;
+ unsigned int length = iprop->property.totarraylength;
- if (iprop->defaultarray) {
- memcpy(values, iprop->defaultarray, sizeof(int) * length);
- }
- else {
- for (unsigned int i = 0; i < length; i++) {
- values[i] = iprop->defaultvalue;
- }
- }
+ if (iprop->defaultarray) {
+ memcpy(values, iprop->defaultarray, sizeof(int) * length);
+ }
+ else {
+ for (unsigned int i = 0; i < length; i++) {
+ values[i] = iprop->defaultvalue;
+ }
+ }
}
void RNA_property_int_get_array(PointerRNA *ptr, PropertyRNA *prop, int *values)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- IDProperty *idprop;
-
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) != false);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY));
- if (prop->arraydimension == 0)
- values[0] = RNA_property_int_get(ptr, prop);
- else
- memcpy(values, IDP_Array(idprop), sizeof(int) * idprop->len);
- }
- else if (prop->arraydimension == 0)
- values[0] = RNA_property_int_get(ptr, prop);
- else if (iprop->getarray)
- iprop->getarray(ptr, values);
- else if (iprop->getarray_ex)
- iprop->getarray_ex(ptr, prop, values);
- else
- rna_property_int_get_default_array_values(iprop, values);
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) ||
+ (prop->flag & PROP_IDPROPERTY));
+ if (prop->arraydimension == 0)
+ values[0] = RNA_property_int_get(ptr, prop);
+ else
+ memcpy(values, IDP_Array(idprop), sizeof(int) * idprop->len);
+ }
+ else if (prop->arraydimension == 0)
+ values[0] = RNA_property_int_get(ptr, prop);
+ else if (iprop->getarray)
+ iprop->getarray(ptr, values);
+ else if (iprop->getarray_ex)
+ iprop->getarray_ex(ptr, prop, values);
+ else
+ rna_property_int_get_default_array_values(iprop, values);
}
void RNA_property_int_get_array_range(PointerRNA *ptr, PropertyRNA *prop, int values[2])
{
- const int array_len = RNA_property_array_length(ptr, prop);
-
- if (array_len <= 0) {
- values[0] = 0;
- values[1] = 0;
- }
- else if (array_len == 1) {
- RNA_property_int_get_array(ptr, prop, values);
- values[1] = values[0];
- }
- else {
- int arr_stack[32];
- int *arr;
- int i;
-
- if (array_len > 32) {
- arr = MEM_mallocN(sizeof(int) * array_len, __func__);
- }
- else {
- arr = arr_stack;
- }
-
- RNA_property_int_get_array(ptr, prop, arr);
- values[0] = values[1] = arr[0];
- for (i = 1; i < array_len; i++) {
- values[0] = MIN2(values[0], arr[i]);
- values[1] = MAX2(values[1], arr[i]);
- }
-
- if (arr != arr_stack) {
- MEM_freeN(arr);
- }
- }
+ const int array_len = RNA_property_array_length(ptr, prop);
+
+ if (array_len <= 0) {
+ values[0] = 0;
+ values[1] = 0;
+ }
+ else if (array_len == 1) {
+ RNA_property_int_get_array(ptr, prop, values);
+ values[1] = values[0];
+ }
+ else {
+ int arr_stack[32];
+ int *arr;
+ int i;
+
+ if (array_len > 32) {
+ arr = MEM_mallocN(sizeof(int) * array_len, __func__);
+ }
+ else {
+ arr = arr_stack;
+ }
+
+ RNA_property_int_get_array(ptr, prop, arr);
+ values[0] = values[1] = arr[0];
+ for (i = 1; i < array_len; i++) {
+ values[0] = MIN2(values[0], arr[i]);
+ values[1] = MAX2(values[1], arr[i]);
+ }
+
+ if (arr != arr_stack) {
+ MEM_freeN(arr);
+ }
+ }
}
int RNA_property_int_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- int tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ int tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < len);
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < len);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_int_get_array(ptr, prop, tmp);
- return tmp[index];
- }
- else {
- int *tmparray, value;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_int_get_array(ptr, prop, tmp);
+ return tmp[index];
+ }
+ else {
+ int *tmparray, value;
- tmparray = MEM_mallocN(sizeof(int) * len, __func__);
- RNA_property_int_get_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
+ tmparray = MEM_mallocN(sizeof(int) * len, __func__);
+ RNA_property_int_get_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
- return value;
- }
+ return value;
+ }
}
void RNA_property_int_set_array(PointerRNA *ptr, PropertyRNA *prop, const int *values)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- IDProperty *idprop;
-
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) != false);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY));
- if (prop->arraydimension == 0)
- IDP_Int(idprop) = values[0];
- else
- memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
-
- rna_idproperty_touch(idprop);
- }
- else if (prop->arraydimension == 0)
- RNA_property_int_set(ptr, prop, values[0]);
- else if (iprop->setarray)
- iprop->setarray(ptr, values);
- else if (iprop->setarray_ex)
- iprop->setarray_ex(ptr, prop, values);
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
-
- /* TODO: RNA_property_int_clamp_array(ptr, prop, &value); */
-
- val.array.len = prop->totarraylength;
- val.array.type = IDP_INT;
-
- group = RNA_struct_idprops(ptr, 1);
- if (group) {
- idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
- IDP_AddToGroup(group, idprop);
- memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
- }
- }
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) ||
+ (prop->flag & PROP_IDPROPERTY));
+ if (prop->arraydimension == 0)
+ IDP_Int(idprop) = values[0];
+ else
+ memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
+
+ rna_idproperty_touch(idprop);
+ }
+ else if (prop->arraydimension == 0)
+ RNA_property_int_set(ptr, prop, values[0]);
+ else if (iprop->setarray)
+ iprop->setarray(ptr, values);
+ else if (iprop->setarray_ex)
+ iprop->setarray_ex(ptr, prop, values);
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
+
+ /* TODO: RNA_property_int_clamp_array(ptr, prop, &value); */
+
+ val.array.len = prop->totarraylength;
+ val.array.type = IDP_INT;
+
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
+ IDP_AddToGroup(group, idprop);
+ memcpy(IDP_Array(idprop), values, sizeof(int) * idprop->len);
+ }
+ }
}
void RNA_property_int_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, int value)
{
- int tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ int tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < len);
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < len);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_int_get_array(ptr, prop, tmp);
- tmp[index] = value;
- RNA_property_int_set_array(ptr, prop, tmp);
- }
- else {
- int *tmparray;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_int_get_array(ptr, prop, tmp);
+ tmp[index] = value;
+ RNA_property_int_set_array(ptr, prop, tmp);
+ }
+ else {
+ int *tmparray;
- tmparray = MEM_mallocN(sizeof(int) * len, __func__);
- RNA_property_int_get_array(ptr, prop, tmparray);
- tmparray[index] = value;
- RNA_property_int_set_array(ptr, prop, tmparray);
- MEM_freeN(tmparray);
- }
+ tmparray = MEM_mallocN(sizeof(int) * len, __func__);
+ RNA_property_int_get_array(ptr, prop, tmparray);
+ tmparray[index] = value;
+ RNA_property_int_set_array(ptr, prop, tmparray);
+ MEM_freeN(tmparray);
+ }
}
int RNA_property_int_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
+ IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
- if (prop->magic != RNA_MAGIC) {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item;
+ if (idp_ui) {
+ IDProperty *item;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", IDP_INT);
- return item ? IDP_Int(item) : iprop->defaultvalue;
- }
- }
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", IDP_INT);
+ return item ? IDP_Int(item) : iprop->defaultvalue;
+ }
+ }
- return iprop->defaultvalue;
+ return iprop->defaultvalue;
}
bool RNA_property_int_set_default(PointerRNA *ptr, PropertyRNA *prop, int value)
{
- if (value != 0) {
- IDPropertyTemplate val = { .i = value, };
- return rna_idproperty_ui_set_default(ptr, prop, IDP_INT, &val);
- }
- else {
- return rna_idproperty_ui_set_default(ptr, prop, IDP_INT, NULL);
- }
+ if (value != 0) {
+ IDPropertyTemplate val = {
+ .i = value,
+ };
+ return rna_idproperty_ui_set_default(ptr, prop, IDP_INT, &val);
+ }
+ else {
+ return rna_idproperty_ui_set_default(ptr, prop, IDP_INT, NULL);
+ }
}
void RNA_property_int_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int *values)
{
- IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
+ IntPropertyRNA *iprop = (IntPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) != false);
- if (prop->arraydimension == 0)
- values[0] = iprop->defaultvalue;
- else
- rna_property_int_get_default_array_values(iprop, values);
+ if (prop->arraydimension == 0)
+ values[0] = iprop->defaultvalue;
+ else
+ rna_property_int_get_default_array_values(iprop, values);
}
int RNA_property_int_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- int tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ int tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_INT);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < prop->totarraylength);
+ BLI_assert(RNA_property_type(prop) == PROP_INT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < prop->totarraylength);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_int_get_default_array(ptr, prop, tmp);
- return tmp[index];
- }
- else {
- int *tmparray, value;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_int_get_default_array(ptr, prop, tmp);
+ return tmp[index];
+ }
+ else {
+ int *tmparray, value;
- tmparray = MEM_mallocN(sizeof(int) * len, __func__);
- RNA_property_int_get_default_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
+ tmparray = MEM_mallocN(sizeof(int) * len, __func__);
+ RNA_property_int_get_default_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
- return value;
- }
+ return value;
+ }
}
float RNA_property_float_get(PointerRNA *ptr, PropertyRNA *prop)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- IDProperty *idprop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) == false);
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) == false);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- if (idprop->type == IDP_FLOAT)
- return IDP_Float(idprop);
- else
- return (float)IDP_Double(idprop);
- }
- else if (fprop->get)
- return fprop->get(ptr);
- else if (fprop->get_ex)
- return fprop->get_ex(ptr, prop);
- else
- return fprop->defaultvalue;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (idprop->type == IDP_FLOAT)
+ return IDP_Float(idprop);
+ else
+ return (float)IDP_Double(idprop);
+ }
+ else if (fprop->get)
+ return fprop->get(ptr);
+ else if (fprop->get_ex)
+ return fprop->get_ex(ptr, prop);
+ else
+ return fprop->defaultvalue;
}
void RNA_property_float_set(PointerRNA *ptr, PropertyRNA *prop, float value)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- IDProperty *idprop;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) == false);
- /* useful to check on bad values but set function should clamp */
- /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) == false);
+ /* useful to check on bad values but set function should clamp */
+ /* BLI_assert(RNA_property_float_clamp(ptr, prop, &value) == 0); */
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- RNA_property_float_clamp(ptr, prop, &value);
- if (idprop->type == IDP_FLOAT)
- IDP_Float(idprop) = value;
- else
- IDP_Double(idprop) = value;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ RNA_property_float_clamp(ptr, prop, &value);
+ if (idprop->type == IDP_FLOAT)
+ IDP_Float(idprop) = value;
+ else
+ IDP_Double(idprop) = value;
- rna_idproperty_touch(idprop);
- }
- else if (fprop->set) {
- fprop->set(ptr, value);
- }
- else if (fprop->set_ex) {
- fprop->set_ex(ptr, prop, value);
- }
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
+ rna_idproperty_touch(idprop);
+ }
+ else if (fprop->set) {
+ fprop->set(ptr, value);
+ }
+ else if (fprop->set_ex) {
+ fprop->set_ex(ptr, prop, value);
+ }
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
- RNA_property_float_clamp(ptr, prop, &value);
+ RNA_property_float_clamp(ptr, prop, &value);
- val.f = value;
+ val.f = value;
- group = RNA_struct_idprops(ptr, 1);
- if (group)
- IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier));
- }
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
+ IDP_AddToGroup(group, IDP_New(IDP_FLOAT, &val, prop->identifier));
+ }
}
static void rna_property_float_get_default_array_values(FloatPropertyRNA *fprop, float *values)
{
- unsigned int length = fprop->property.totarraylength;
+ unsigned int length = fprop->property.totarraylength;
- if (fprop->defaultarray) {
- memcpy(values, fprop->defaultarray, sizeof(float) * length);
- }
- else {
- for (unsigned int i = 0; i < length; i++) {
- values[i] = fprop->defaultvalue;
- }
- }
+ if (fprop->defaultarray) {
+ memcpy(values, fprop->defaultarray, sizeof(float) * length);
+ }
+ else {
+ for (unsigned int i = 0; i < length; i++) {
+ values[i] = fprop->defaultvalue;
+ }
+ }
}
void RNA_property_float_get_array(PointerRNA *ptr, PropertyRNA *prop, float *values)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- IDProperty *idprop;
- int i;
-
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) != false);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY));
- if (prop->arraydimension == 0)
- values[0] = RNA_property_float_get(ptr, prop);
- else if (idprop->subtype == IDP_FLOAT) {
- memcpy(values, IDP_Array(idprop), sizeof(float) * idprop->len);
- }
- else {
- for (i = 0; i < idprop->len; i++)
- values[i] = (float)(((double *)IDP_Array(idprop))[i]);
- }
- }
- else if (prop->arraydimension == 0)
- values[0] = RNA_property_float_get(ptr, prop);
- else if (fprop->getarray)
- fprop->getarray(ptr, values);
- else if (fprop->getarray_ex)
- fprop->getarray_ex(ptr, prop, values);
- else
- rna_property_float_get_default_array_values(fprop, values);
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ IDProperty *idprop;
+ int i;
+
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) ||
+ (prop->flag & PROP_IDPROPERTY));
+ if (prop->arraydimension == 0)
+ values[0] = RNA_property_float_get(ptr, prop);
+ else if (idprop->subtype == IDP_FLOAT) {
+ memcpy(values, IDP_Array(idprop), sizeof(float) * idprop->len);
+ }
+ else {
+ for (i = 0; i < idprop->len; i++)
+ values[i] = (float)(((double *)IDP_Array(idprop))[i]);
+ }
+ }
+ else if (prop->arraydimension == 0)
+ values[0] = RNA_property_float_get(ptr, prop);
+ else if (fprop->getarray)
+ fprop->getarray(ptr, values);
+ else if (fprop->getarray_ex)
+ fprop->getarray_ex(ptr, prop, values);
+ else
+ rna_property_float_get_default_array_values(fprop, values);
}
void RNA_property_float_get_array_range(PointerRNA *ptr, PropertyRNA *prop, float values[2])
{
- const int array_len = RNA_property_array_length(ptr, prop);
-
- if (array_len <= 0) {
- values[0] = 0.0f;
- values[1] = 0.0f;
- }
- else if (array_len == 1) {
- RNA_property_float_get_array(ptr, prop, values);
- values[1] = values[0];
- }
- else {
- float arr_stack[32];
- float *arr;
- int i;
-
- if (array_len > 32) {
- arr = MEM_mallocN(sizeof(float) * array_len, __func__);
- }
- else {
- arr = arr_stack;
- }
-
- RNA_property_float_get_array(ptr, prop, arr);
- values[0] = values[1] = arr[0];
- for (i = 1; i < array_len; i++) {
- values[0] = MIN2(values[0], arr[i]);
- values[1] = MAX2(values[1], arr[i]);
- }
-
- if (arr != arr_stack) {
- MEM_freeN(arr);
- }
- }
+ const int array_len = RNA_property_array_length(ptr, prop);
+
+ if (array_len <= 0) {
+ values[0] = 0.0f;
+ values[1] = 0.0f;
+ }
+ else if (array_len == 1) {
+ RNA_property_float_get_array(ptr, prop, values);
+ values[1] = values[0];
+ }
+ else {
+ float arr_stack[32];
+ float *arr;
+ int i;
+
+ if (array_len > 32) {
+ arr = MEM_mallocN(sizeof(float) * array_len, __func__);
+ }
+ else {
+ arr = arr_stack;
+ }
+
+ RNA_property_float_get_array(ptr, prop, arr);
+ values[0] = values[1] = arr[0];
+ for (i = 1; i < array_len; i++) {
+ values[0] = MIN2(values[0], arr[i]);
+ values[1] = MAX2(values[1], arr[i]);
+ }
+
+ if (arr != arr_stack) {
+ MEM_freeN(arr);
+ }
+ }
}
float RNA_property_float_get_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- float tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ float tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < len);
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < len);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_float_get_array(ptr, prop, tmp);
- return tmp[index];
- }
- else {
- float *tmparray, value;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_float_get_array(ptr, prop, tmp);
+ return tmp[index];
+ }
+ else {
+ float *tmparray, value;
- tmparray = MEM_mallocN(sizeof(float) * len, __func__);
- RNA_property_float_get_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
+ tmparray = MEM_mallocN(sizeof(float) * len, __func__);
+ RNA_property_float_get_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
- return value;
- }
+ return value;
+ }
}
void RNA_property_float_set_array(PointerRNA *ptr, PropertyRNA *prop, const float *values)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- IDProperty *idprop;
- int i;
-
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) != false);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) || (prop->flag & PROP_IDPROPERTY));
- if (prop->arraydimension == 0) {
- if (idprop->type == IDP_FLOAT)
- IDP_Float(idprop) = values[0];
- else
- IDP_Double(idprop) = values[0];
- }
- else if (idprop->subtype == IDP_FLOAT) {
- memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
- }
- else {
- for (i = 0; i < idprop->len; i++)
- ((double *)IDP_Array(idprop))[i] = values[i];
- }
-
- rna_idproperty_touch(idprop);
- }
- else if (prop->arraydimension == 0)
- RNA_property_float_set(ptr, prop, values[0]);
- else if (fprop->setarray) {
- fprop->setarray(ptr, values);
- }
- else if (fprop->setarray_ex) {
- fprop->setarray_ex(ptr, prop, values);
- }
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
-
- /* TODO: RNA_property_float_clamp_array(ptr, prop, &value); */
-
- val.array.len = prop->totarraylength;
- val.array.type = IDP_FLOAT;
-
- group = RNA_struct_idprops(ptr, 1);
- if (group) {
- idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
- IDP_AddToGroup(group, idprop);
- memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
- }
- }
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ IDProperty *idprop;
+ int i;
+
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ BLI_assert(idprop->len == RNA_property_array_length(ptr, prop) ||
+ (prop->flag & PROP_IDPROPERTY));
+ if (prop->arraydimension == 0) {
+ if (idprop->type == IDP_FLOAT)
+ IDP_Float(idprop) = values[0];
+ else
+ IDP_Double(idprop) = values[0];
+ }
+ else if (idprop->subtype == IDP_FLOAT) {
+ memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
+ }
+ else {
+ for (i = 0; i < idprop->len; i++)
+ ((double *)IDP_Array(idprop))[i] = values[i];
+ }
+
+ rna_idproperty_touch(idprop);
+ }
+ else if (prop->arraydimension == 0)
+ RNA_property_float_set(ptr, prop, values[0]);
+ else if (fprop->setarray) {
+ fprop->setarray(ptr, values);
+ }
+ else if (fprop->setarray_ex) {
+ fprop->setarray_ex(ptr, prop, values);
+ }
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
+
+ /* TODO: RNA_property_float_clamp_array(ptr, prop, &value); */
+
+ val.array.len = prop->totarraylength;
+ val.array.type = IDP_FLOAT;
+
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_New(IDP_ARRAY, &val, prop->identifier);
+ IDP_AddToGroup(group, idprop);
+ memcpy(IDP_Array(idprop), values, sizeof(float) * idprop->len);
+ }
+ }
}
void RNA_property_float_set_index(PointerRNA *ptr, PropertyRNA *prop, int index, float value)
{
- float tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ float tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < len);
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < len);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_float_get_array(ptr, prop, tmp);
- tmp[index] = value;
- RNA_property_float_set_array(ptr, prop, tmp);
- }
- else {
- float *tmparray;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_float_get_array(ptr, prop, tmp);
+ tmp[index] = value;
+ RNA_property_float_set_array(ptr, prop, tmp);
+ }
+ else {
+ float *tmparray;
- tmparray = MEM_mallocN(sizeof(float) * len, __func__);
- RNA_property_float_get_array(ptr, prop, tmparray);
- tmparray[index] = value;
- RNA_property_float_set_array(ptr, prop, tmparray);
- MEM_freeN(tmparray);
- }
+ tmparray = MEM_mallocN(sizeof(float) * len, __func__);
+ RNA_property_float_get_array(ptr, prop, tmparray);
+ tmparray[index] = value;
+ RNA_property_float_set_array(ptr, prop, tmparray);
+ MEM_freeN(tmparray);
+ }
}
float RNA_property_float_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) == false);
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) == false);
- if (prop->magic != RNA_MAGIC) {
- /* attempt to get the local ID values */
- IDProperty *idp_ui = rna_idproperty_ui(prop);
+ if (prop->magic != RNA_MAGIC) {
+ /* attempt to get the local ID values */
+ IDProperty *idp_ui = rna_idproperty_ui(prop);
- if (idp_ui) {
- IDProperty *item;
+ if (idp_ui) {
+ IDProperty *item;
- item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", IDP_DOUBLE);
- return item ? IDP_Double(item) : fprop->defaultvalue;
- }
- }
+ item = IDP_GetPropertyTypeFromGroup(idp_ui, "default", IDP_DOUBLE);
+ return item ? IDP_Double(item) : fprop->defaultvalue;
+ }
+ }
- return fprop->defaultvalue;
+ return fprop->defaultvalue;
}
bool RNA_property_float_set_default(PointerRNA *ptr, PropertyRNA *prop, float value)
{
- if (value != 0) {
- IDPropertyTemplate val = { .d = value, };
- return rna_idproperty_ui_set_default(ptr, prop, IDP_DOUBLE, &val);
- }
- else {
- return rna_idproperty_ui_set_default(ptr, prop, IDP_DOUBLE, NULL);
- }
+ if (value != 0) {
+ IDPropertyTemplate val = {
+ .d = value,
+ };
+ return rna_idproperty_ui_set_default(ptr, prop, IDP_DOUBLE, &val);
+ }
+ else {
+ return rna_idproperty_ui_set_default(ptr, prop, IDP_DOUBLE, NULL);
+ }
}
-void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr), PropertyRNA *prop, float *values)
+void RNA_property_float_get_default_array(PointerRNA *UNUSED(ptr),
+ PropertyRNA *prop,
+ float *values)
{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) != false);
- if (prop->arraydimension == 0)
- values[0] = fprop->defaultvalue;
- else
- rna_property_float_get_default_array_values(fprop, values);
+ if (prop->arraydimension == 0)
+ values[0] = fprop->defaultvalue;
+ else
+ rna_property_float_get_default_array_values(fprop, values);
}
float RNA_property_float_get_default_index(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- float tmp[RNA_MAX_ARRAY_LENGTH];
- int len = rna_ensure_property_array_length(ptr, prop);
+ float tmp[RNA_MAX_ARRAY_LENGTH];
+ int len = rna_ensure_property_array_length(ptr, prop);
- BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
- BLI_assert(RNA_property_array_check(prop) != false);
- BLI_assert(index >= 0);
- BLI_assert(index < prop->totarraylength);
+ BLI_assert(RNA_property_type(prop) == PROP_FLOAT);
+ BLI_assert(RNA_property_array_check(prop) != false);
+ BLI_assert(index >= 0);
+ BLI_assert(index < prop->totarraylength);
- if (len <= RNA_MAX_ARRAY_LENGTH) {
- RNA_property_float_get_default_array(ptr, prop, tmp);
- return tmp[index];
- }
- else {
- float *tmparray, value;
+ if (len <= RNA_MAX_ARRAY_LENGTH) {
+ RNA_property_float_get_default_array(ptr, prop, tmp);
+ return tmp[index];
+ }
+ else {
+ float *tmparray, value;
- tmparray = MEM_mallocN(sizeof(float) * len, __func__);
- RNA_property_float_get_default_array(ptr, prop, tmparray);
- value = tmparray[index];
- MEM_freeN(tmparray);
+ tmparray = MEM_mallocN(sizeof(float) * len, __func__);
+ RNA_property_float_get_default_array(ptr, prop, tmparray);
+ value = tmparray[index];
+ MEM_freeN(tmparray);
- return value;
- }
+ return value;
+ }
}
void RNA_property_string_get(PointerRNA *ptr, PropertyRNA *prop, char *value)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- IDProperty *idprop;
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- /* editing bytes is not 100% supported
- * since they can contain NIL chars */
- if (idprop->subtype == IDP_STRING_SUB_BYTE) {
- memcpy(value, IDP_String(idprop), idprop->len);
- value[idprop->len] = '\0';
- }
- else {
- memcpy(value, IDP_String(idprop), idprop->len);
- }
- }
- else if (sprop->get) {
- sprop->get(ptr, value);
- }
- else if (sprop->get_ex) {
- sprop->get_ex(ptr, prop, value);
- }
- else {
- strcpy(value, sprop->defaultvalue);
- }
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ /* editing bytes is not 100% supported
+ * since they can contain NIL chars */
+ if (idprop->subtype == IDP_STRING_SUB_BYTE) {
+ memcpy(value, IDP_String(idprop), idprop->len);
+ value[idprop->len] = '\0';
+ }
+ else {
+ memcpy(value, IDP_String(idprop), idprop->len);
+ }
+ }
+ else if (sprop->get) {
+ sprop->get(ptr, value);
+ }
+ else if (sprop->get_ex) {
+ sprop->get_ex(ptr, prop, value);
+ }
+ else {
+ strcpy(value, sprop->defaultvalue);
+ }
}
-char *RNA_property_string_get_alloc(PointerRNA *ptr, PropertyRNA *prop,
- char *fixedbuf, int fixedlen, int *r_len)
+char *RNA_property_string_get_alloc(
+ PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen, int *r_len)
{
- char *buf;
- int length;
+ char *buf;
+ int length;
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- length = RNA_property_string_length(ptr, prop);
+ length = RNA_property_string_length(ptr, prop);
- if (length + 1 < fixedlen)
- buf = fixedbuf;
- else
- buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_string_get_alloc");
+ if (length + 1 < fixedlen)
+ buf = fixedbuf;
+ else
+ buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_string_get_alloc");
#ifndef NDEBUG
- /* safety check to ensure the string is actually set */
- buf[length] = 255;
+ /* safety check to ensure the string is actually set */
+ buf[length] = 255;
#endif
- RNA_property_string_get(ptr, prop, buf);
+ RNA_property_string_get(ptr, prop, buf);
#ifndef NDEBUG
- BLI_assert(buf[length] == '\0');
+ BLI_assert(buf[length] == '\0');
#endif
- if (r_len) {
- *r_len = length;
- }
+ if (r_len) {
+ *r_len = length;
+ }
- return buf;
+ return buf;
}
/* this is the length without \0 terminator */
int RNA_property_string_length(PointerRNA *ptr, PropertyRNA *prop)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- IDProperty *idprop;
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- if (idprop->subtype == IDP_STRING_SUB_BYTE) {
- return idprop->len;
- }
- else {
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ if (idprop->subtype == IDP_STRING_SUB_BYTE) {
+ return idprop->len;
+ }
+ else {
#ifndef NDEBUG
- /* these _must_ stay in sync */
- BLI_assert(strlen(IDP_String(idprop)) == idprop->len - 1);
+ /* these _must_ stay in sync */
+ BLI_assert(strlen(IDP_String(idprop)) == idprop->len - 1);
#endif
- return idprop->len - 1;
- }
- }
- else if (sprop->length)
- return sprop->length(ptr);
- else if (sprop->length_ex)
- return sprop->length_ex(ptr, prop);
- else
- return strlen(sprop->defaultvalue);
+ return idprop->len - 1;
+ }
+ }
+ else if (sprop->length)
+ return sprop->length(ptr);
+ else if (sprop->length_ex)
+ return sprop->length_ex(ptr, prop);
+ else
+ return strlen(sprop->defaultvalue);
}
void RNA_property_string_set(PointerRNA *ptr, PropertyRNA *prop, const char *value)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- IDProperty *idprop;
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- /* both IDP_STRING_SUB_BYTE / IDP_STRING_SUB_UTF8 */
- IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1);
- rna_idproperty_touch(idprop);
- }
- else if (sprop->set)
- sprop->set(ptr, value); /* set function needs to clamp its self */
- else if (sprop->set_ex)
- sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */
- else if (prop->flag & PROP_EDITABLE) {
- IDProperty *group;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ /* both IDP_STRING_SUB_BYTE / IDP_STRING_SUB_UTF8 */
+ IDP_AssignString(idprop, value, RNA_property_string_maxlength(prop) - 1);
+ rna_idproperty_touch(idprop);
+ }
+ else if (sprop->set)
+ sprop->set(ptr, value); /* set function needs to clamp its self */
+ else if (sprop->set_ex)
+ sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */
+ else if (prop->flag & PROP_EDITABLE) {
+ IDProperty *group;
- group = RNA_struct_idprops(ptr, 1);
- if (group)
- IDP_AddToGroup(group, IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop)));
- }
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
+ IDP_AddToGroup(group,
+ IDP_NewString(value, prop->identifier, RNA_property_string_maxlength(prop)));
+ }
}
void RNA_property_string_set_bytes(PointerRNA *ptr, PropertyRNA *prop, const char *value, int len)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- IDProperty *idprop;
-
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
- BLI_assert(RNA_property_subtype(prop) == PROP_BYTESTRING);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDP_ResizeArray(idprop, len);
- memcpy(idprop->data.pointer, value, (size_t)len);
-
- rna_idproperty_touch(idprop);
- }
- else if (sprop->set) {
- /* XXX, should take length argument (currently not used). */
- sprop->set(ptr, value); /* set function needs to clamp its self */
- }
- else if (sprop->set_ex) {
- /* XXX, should take length argument (currently not used). */
- sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */
- }
- else if (prop->flag & PROP_EDITABLE) {
- IDProperty *group;
-
- group = RNA_struct_idprops(ptr, 1);
- if (group) {
- IDPropertyTemplate val = {0};
- val.string.str = value;
- val.string.len = len;
- val.string.subtype = IDP_STRING_SUB_BYTE;
- IDP_AddToGroup(group, IDP_New(IDP_STRING, &val, prop->identifier));
- }
- }
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_subtype(prop) == PROP_BYTESTRING);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_ResizeArray(idprop, len);
+ memcpy(idprop->data.pointer, value, (size_t)len);
+
+ rna_idproperty_touch(idprop);
+ }
+ else if (sprop->set) {
+ /* XXX, should take length argument (currently not used). */
+ sprop->set(ptr, value); /* set function needs to clamp its self */
+ }
+ else if (sprop->set_ex) {
+ /* XXX, should take length argument (currently not used). */
+ sprop->set_ex(ptr, prop, value); /* set function needs to clamp its self */
+ }
+ else if (prop->flag & PROP_EDITABLE) {
+ IDProperty *group;
+
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ IDPropertyTemplate val = {0};
+ val.string.str = value;
+ val.string.len = len;
+ val.string.subtype = IDP_STRING_SUB_BYTE;
+ IDP_AddToGroup(group, IDP_New(IDP_STRING, &val, prop->identifier));
+ }
+ }
}
void RNA_property_string_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop, char *value)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
+ StringPropertyRNA *sprop = (StringPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- strcpy(value, sprop->defaultvalue);
+ strcpy(value, sprop->defaultvalue);
}
-char *RNA_property_string_get_default_alloc(PointerRNA *ptr, PropertyRNA *prop, char *fixedbuf, int fixedlen)
+char *RNA_property_string_get_default_alloc(PointerRNA *ptr,
+ PropertyRNA *prop,
+ char *fixedbuf,
+ int fixedlen)
{
- char *buf;
- int length;
+ char *buf;
+ int length;
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- length = RNA_property_string_default_length(ptr, prop);
+ length = RNA_property_string_default_length(ptr, prop);
- if (length + 1 < fixedlen)
- buf = fixedbuf;
- else
- buf = MEM_callocN(sizeof(char) * (length + 1), "RNA_string_get_alloc");
+ if (length + 1 < fixedlen)
+ buf = fixedbuf;
+ else
+ buf = MEM_callocN(sizeof(char) * (length + 1), "RNA_string_get_alloc");
- RNA_property_string_get_default(ptr, prop, buf);
+ RNA_property_string_get_default(ptr, prop, buf);
- return buf;
+ return buf;
}
/* this is the length without \0 terminator */
int RNA_property_string_default_length(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- BLI_assert(RNA_property_type(prop) == PROP_STRING);
+ BLI_assert(RNA_property_type(prop) == PROP_STRING);
- return strlen(sprop->defaultvalue);
+ return strlen(sprop->defaultvalue);
}
int RNA_property_enum_get(PointerRNA *ptr, PropertyRNA *prop)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- IDProperty *idprop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_ENUM);
+ BLI_assert(RNA_property_type(prop) == PROP_ENUM);
- if ((idprop = rna_idproperty_check(&prop, ptr)))
- return IDP_Int(idprop);
- else if (eprop->get)
- return eprop->get(ptr);
- else if (eprop->get_ex)
- return eprop->get_ex(ptr, prop);
- else
- return eprop->defaultvalue;
+ if ((idprop = rna_idproperty_check(&prop, ptr)))
+ return IDP_Int(idprop);
+ else if (eprop->get)
+ return eprop->get(ptr);
+ else if (eprop->get_ex)
+ return eprop->get_ex(ptr, prop);
+ else
+ return eprop->defaultvalue;
}
void RNA_property_enum_set(PointerRNA *ptr, PropertyRNA *prop, int value)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- IDProperty *idprop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_ENUM);
+ BLI_assert(RNA_property_type(prop) == PROP_ENUM);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDP_Int(idprop) = value;
- rna_idproperty_touch(idprop);
- }
- else if (eprop->set) {
- eprop->set(ptr, value);
- }
- else if (eprop->set_ex) {
- eprop->set_ex(ptr, prop, value);
- }
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_Int(idprop) = value;
+ rna_idproperty_touch(idprop);
+ }
+ else if (eprop->set) {
+ eprop->set(ptr, value);
+ }
+ else if (eprop->set_ex) {
+ eprop->set_ex(ptr, prop, value);
+ }
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
- val.i = value;
+ val.i = value;
- group = RNA_struct_idprops(ptr, 1);
- if (group)
- IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
- }
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
+ IDP_AddToGroup(group, IDP_New(IDP_INT, &val, prop->identifier));
+ }
}
int RNA_property_enum_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *prop)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_ENUM);
+ BLI_assert(RNA_property_type(prop) == PROP_ENUM);
- return eprop->defaultvalue;
+ return eprop->defaultvalue;
}
void *RNA_property_enum_py_data_get(PropertyRNA *prop)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- BLI_assert(RNA_property_type(prop) == PROP_ENUM);
+ BLI_assert(RNA_property_type(prop) == PROP_ENUM);
- return eprop->py_data;
+ return eprop->py_data;
}
/**
@@ -3460,1347 +3517,1431 @@ void *RNA_property_enum_py_data_get(PropertyRNA *prop)
* \param step: Absolute value defines step size, sign defines direction.
* E.g to get the next item, pass 1, for the previous -1.
*/
-int RNA_property_enum_step(const bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step)
+int RNA_property_enum_step(
+ const bContext *C, PointerRNA *ptr, PropertyRNA *prop, int from_value, int step)
{
- const EnumPropertyItem *item_array;
- int totitem;
- bool free;
- int result_value = from_value;
- int i, i_init;
- int single_step = (step < 0) ? -1 : 1;
- int step_tot = 0;
+ const EnumPropertyItem *item_array;
+ int totitem;
+ bool free;
+ int result_value = from_value;
+ int i, i_init;
+ int single_step = (step < 0) ? -1 : 1;
+ int step_tot = 0;
- RNA_property_enum_items((bContext *)C, ptr, prop, &item_array, &totitem, &free);
- i = RNA_enum_from_value(item_array, from_value);
- i_init = i;
+ RNA_property_enum_items((bContext *)C, ptr, prop, &item_array, &totitem, &free);
+ i = RNA_enum_from_value(item_array, from_value);
+ i_init = i;
- do {
- i = mod_i(i + single_step, totitem);
- if (item_array[i].identifier[0]) {
- step_tot += single_step;
- }
- } while ((i != i_init) && (step_tot != step));
+ do {
+ i = mod_i(i + single_step, totitem);
+ if (item_array[i].identifier[0]) {
+ step_tot += single_step;
+ }
+ } while ((i != i_init) && (step_tot != step));
- if (i != i_init) {
- result_value = item_array[i].value;
- }
+ if (i != i_init) {
+ result_value = item_array[i].value;
+ }
- if (free) {
- MEM_freeN((void *)item_array);
- }
+ if (free) {
+ MEM_freeN((void *)item_array);
+ }
- return result_value;
+ return result_value;
}
PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop)
{
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- IDProperty *idprop;
-
- BLI_assert(RNA_property_type(prop) == PROP_POINTER);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- pprop = (PointerPropertyRNA *)prop;
-
- if (RNA_struct_is_ID(pprop->type)) {
- return rna_pointer_inherit_refine(ptr, pprop->type, IDP_Id(idprop));
- }
-
- /* for groups, data is idprop itself */
- if (pprop->typef)
- return rna_pointer_inherit_refine(ptr, pprop->typef(ptr), idprop);
- else
- return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
- }
- else if (pprop->get) {
- return pprop->get(ptr);
- }
- else if (prop->flag & PROP_IDPROPERTY) {
- /* XXX temporary hack to add it automatically, reading should
- * never do any write ops, to ensure thread safety etc .. */
- RNA_property_pointer_add(ptr, prop);
- return RNA_property_pointer_get(ptr, prop);
- }
- else {
- return PointerRNA_NULL;
- }
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ IDProperty *idprop;
+
+ BLI_assert(RNA_property_type(prop) == PROP_POINTER);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ pprop = (PointerPropertyRNA *)prop;
+
+ if (RNA_struct_is_ID(pprop->type)) {
+ return rna_pointer_inherit_refine(ptr, pprop->type, IDP_Id(idprop));
+ }
+
+ /* for groups, data is idprop itself */
+ if (pprop->typef)
+ return rna_pointer_inherit_refine(ptr, pprop->typef(ptr), idprop);
+ else
+ return rna_pointer_inherit_refine(ptr, pprop->type, idprop);
+ }
+ else if (pprop->get) {
+ return pprop->get(ptr);
+ }
+ else if (prop->flag & PROP_IDPROPERTY) {
+ /* XXX temporary hack to add it automatically, reading should
+ * never do any write ops, to ensure thread safety etc .. */
+ RNA_property_pointer_add(ptr, prop);
+ return RNA_property_pointer_get(ptr, prop);
+ }
+ else {
+ return PointerRNA_NULL;
+ }
}
void RNA_property_pointer_set(PointerRNA *ptr, PropertyRNA *prop, PointerRNA ptr_value)
{
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- BLI_assert(RNA_property_type(prop) == PROP_POINTER);
-
- /* Check types */
- if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
- printf("%s: expected %s type, not %s.\n", __func__, pprop->type->identifier, ptr_value.type->identifier);
- return;
- }
-
- /* RNA */
- if (pprop->set &&
- !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
- !((prop->flag & PROP_ID_SELF_CHECK) && ptr->id.data == ptr_value.id.data))
- {
- pprop->set(ptr, ptr_value);
- }
- /* IDProperty */
- else if (prop->flag & PROP_EDITABLE) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
-
- val.id = ptr_value.data;
-
- group = RNA_struct_idprops(ptr, true);
- if (group) {
- IDP_ReplaceInGroup(group, IDP_New(IDP_ID, &val, prop->identifier));
- }
- }
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ BLI_assert(RNA_property_type(prop) == PROP_POINTER);
+
+ /* Check types */
+ if (ptr_value.type != NULL && !RNA_struct_is_a(ptr_value.type, pprop->type)) {
+ printf("%s: expected %s type, not %s.\n",
+ __func__,
+ pprop->type->identifier,
+ ptr_value.type->identifier);
+ return;
+ }
+
+ /* RNA */
+ if (pprop->set && !((prop->flag & PROP_NEVER_NULL) && ptr_value.data == NULL) &&
+ !((prop->flag & PROP_ID_SELF_CHECK) && ptr->id.data == ptr_value.id.data)) {
+ pprop->set(ptr, ptr_value);
+ }
+ /* IDProperty */
+ else if (prop->flag & PROP_EDITABLE) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
+
+ val.id = ptr_value.data;
+
+ group = RNA_struct_idprops(ptr, true);
+ if (group) {
+ IDP_ReplaceInGroup(group, IDP_New(IDP_ID, &val, prop->identifier));
+ }
+ }
}
PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop))
{
- /*PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; */
+ /*PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; */
- /* BLI_assert(RNA_property_type(prop) == PROP_POINTER); */
+ /* BLI_assert(RNA_property_type(prop) == PROP_POINTER); */
- return PointerRNA_NULL; /* FIXME: there has to be a way... */
+ return PointerRNA_NULL; /* FIXME: there has to be a way... */
}
void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop)
{
- /*IDProperty *idprop;*/
+ /*IDProperty *idprop;*/
- BLI_assert(RNA_property_type(prop) == PROP_POINTER);
+ BLI_assert(RNA_property_type(prop) == PROP_POINTER);
- if ((/*idprop=*/ rna_idproperty_check(&prop, ptr))) {
- /* already exists */
- }
- else if (prop->flag & PROP_IDPROPERTY) {
- IDPropertyTemplate val = {0};
- IDProperty *group;
+ if ((/*idprop=*/rna_idproperty_check(&prop, ptr))) {
+ /* already exists */
+ }
+ else if (prop->flag & PROP_IDPROPERTY) {
+ IDPropertyTemplate val = {0};
+ IDProperty *group;
- val.i = 0;
+ val.i = 0;
- group = RNA_struct_idprops(ptr, 1);
- if (group)
- IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier));
- }
- else
- printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);
+ group = RNA_struct_idprops(ptr, 1);
+ if (group)
+ IDP_AddToGroup(group, IDP_New(IDP_GROUP, &val, prop->identifier));
+ }
+ else
+ printf("%s %s.%s: only supported for id properties.\n",
+ __func__,
+ ptr->type->identifier,
+ prop->identifier);
}
void RNA_property_pointer_remove(PointerRNA *ptr, PropertyRNA *prop)
{
- IDProperty *idprop, *group;
+ IDProperty *idprop, *group;
- BLI_assert(RNA_property_type(prop) == PROP_POINTER);
+ BLI_assert(RNA_property_type(prop) == PROP_POINTER);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- group = RNA_struct_idprops(ptr, 0);
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ group = RNA_struct_idprops(ptr, 0);
- if (group) {
- IDP_FreeFromGroup(group, idprop);
- }
- }
- else
- printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);
+ if (group) {
+ IDP_FreeFromGroup(group, idprop);
+ }
+ }
+ else
+ printf("%s %s.%s: only supported for id properties.\n",
+ __func__,
+ ptr->type->identifier,
+ prop->identifier);
}
static void rna_property_collection_get_idp(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)iter->prop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)iter->prop;
- iter->ptr.data = rna_iterator_array_get(iter);
- iter->ptr.type = cprop->item_type;
- rna_pointer_inherit_id(cprop->item_type, &iter->parent, &iter->ptr);
+ iter->ptr.data = rna_iterator_array_get(iter);
+ iter->ptr.type = cprop->item_type;
+ rna_pointer_inherit_id(cprop->item_type, &iter->parent, &iter->ptr);
}
-void RNA_property_collection_begin(PointerRNA *ptr, PropertyRNA *prop, CollectionPropertyIterator *iter)
+void RNA_property_collection_begin(PointerRNA *ptr,
+ PropertyRNA *prop,
+ CollectionPropertyIterator *iter)
{
- IDProperty *idprop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- memset(iter, 0, sizeof(*iter));
+ memset(iter, 0, sizeof(*iter));
- if ((idprop = rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
- iter->parent = *ptr;
- iter->prop = prop;
+ if ((idprop = rna_idproperty_check(&prop, ptr)) || (prop->flag & PROP_IDPROPERTY)) {
+ iter->parent = *ptr;
+ iter->prop = prop;
- if (idprop)
- rna_iterator_array_begin(iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, NULL);
- else
- rna_iterator_array_begin(iter, NULL, sizeof(IDProperty), 0, 0, NULL);
+ if (idprop)
+ rna_iterator_array_begin(
+ iter, IDP_IDPArray(idprop), sizeof(IDProperty), idprop->len, 0, NULL);
+ else
+ rna_iterator_array_begin(iter, NULL, sizeof(IDProperty), 0, 0, NULL);
- if (iter->valid)
- rna_property_collection_get_idp(iter);
+ if (iter->valid)
+ rna_property_collection_get_idp(iter);
- iter->idprop = 1;
- }
- else {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- cprop->begin(iter, ptr);
- }
+ iter->idprop = 1;
+ }
+ else {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ cprop->begin(iter, ptr);
+ }
}
void RNA_property_collection_next(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop);
- if (iter->idprop) {
- rna_iterator_array_next(iter);
+ if (iter->idprop) {
+ rna_iterator_array_next(iter);
- if (iter->valid)
- rna_property_collection_get_idp(iter);
- }
- else
- cprop->next(iter);
+ if (iter->valid)
+ rna_property_collection_get_idp(iter);
+ }
+ else
+ cprop->next(iter);
}
void RNA_property_collection_skip(CollectionPropertyIterator *iter, int num)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop);
- int i;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop);
+ int i;
- if (num > 1 && (iter->idprop || (cprop->property.flag_internal & PROP_INTERN_RAW_ARRAY))) {
- /* fast skip for array */
- ArrayIterator *internal = &iter->internal.array;
+ if (num > 1 && (iter->idprop || (cprop->property.flag_internal & PROP_INTERN_RAW_ARRAY))) {
+ /* fast skip for array */
+ ArrayIterator *internal = &iter->internal.array;
- if (!internal->skip) {
- internal->ptr += internal->itemsize * (num - 1);
- iter->valid = (internal->ptr < internal->endptr);
- if (iter->valid)
- RNA_property_collection_next(iter);
- return;
- }
- }
+ if (!internal->skip) {
+ internal->ptr += internal->itemsize * (num - 1);
+ iter->valid = (internal->ptr < internal->endptr);
+ if (iter->valid)
+ RNA_property_collection_next(iter);
+ return;
+ }
+ }
- /* slow iteration otherwise */
- for (i = 0; i < num && iter->valid; i++)
- RNA_property_collection_next(iter);
+ /* slow iteration otherwise */
+ for (i = 0; i < num && iter->valid; i++)
+ RNA_property_collection_next(iter);
}
void RNA_property_collection_end(CollectionPropertyIterator *iter)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(iter->prop);
- if (iter->idprop)
- rna_iterator_array_end(iter);
- else
- cprop->end(iter);
+ if (iter->idprop)
+ rna_iterator_array_end(iter);
+ else
+ cprop->end(iter);
}
int RNA_property_collection_length(PointerRNA *ptr, PropertyRNA *prop)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- IDProperty *idprop;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- return idprop->len;
- }
- else if (cprop->length) {
- return cprop->length(ptr);
- }
- else {
- CollectionPropertyIterator iter;
- int length = 0;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ return idprop->len;
+ }
+ else if (cprop->length) {
+ return cprop->length(ptr);
+ }
+ else {
+ CollectionPropertyIterator iter;
+ int length = 0;
- RNA_property_collection_begin(ptr, prop, &iter);
- for (; iter.valid; RNA_property_collection_next(&iter))
- length++;
- RNA_property_collection_end(&iter);
+ RNA_property_collection_begin(ptr, prop, &iter);
+ for (; iter.valid; RNA_property_collection_next(&iter))
+ length++;
+ RNA_property_collection_end(&iter);
- return length;
- }
+ return length;
+ }
}
void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
{
- IDProperty *idprop;
-/* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */
-
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
-
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDPropertyTemplate val = {0};
- IDProperty *item;
-
- item = IDP_New(IDP_GROUP, &val, "");
- IDP_AppendArray(idprop, item);
- /* IDP_FreeProperty(item); *//* IDP_AppendArray does a shallow copy (memcpy), only free memory */
- MEM_freeN(item);
- rna_idproperty_touch(idprop);
- }
- else if (prop->flag & PROP_IDPROPERTY) {
- IDProperty *group, *item;
- IDPropertyTemplate val = {0};
-
- group = RNA_struct_idprops(ptr, 1);
- if (group) {
- idprop = IDP_NewIDPArray(prop->identifier);
- IDP_AddToGroup(group, idprop);
-
- item = IDP_New(IDP_GROUP, &val, "");
- IDP_AppendArray(idprop, item);
- /* IDP_FreeProperty(item); *//* IDP_AppendArray does a shallow copy (memcpy), only free memory */
- MEM_freeN(item);
- }
- }
-
- /* py api calls directly */
-#if 0
- else if (cprop->add) {
- if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
- ParameterList params;
- RNA_parameter_list_create(&params, ptr, cprop->add);
- RNA_function_call(NULL, NULL, ptr, cprop->add, &params);
- RNA_parameter_list_free(&params);
- }
- }
+ IDProperty *idprop;
+ /* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */
+
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDPropertyTemplate val = {0};
+ IDProperty *item;
+
+ item = IDP_New(IDP_GROUP, &val, "");
+ IDP_AppendArray(idprop, item);
+ /* IDP_FreeProperty(item); */ /* IDP_AppendArray does a shallow copy (memcpy), only free memory */
+ MEM_freeN(item);
+ rna_idproperty_touch(idprop);
+ }
+ else if (prop->flag & PROP_IDPROPERTY) {
+ IDProperty *group, *item;
+ IDPropertyTemplate val = {0};
+
+ group = RNA_struct_idprops(ptr, 1);
+ if (group) {
+ idprop = IDP_NewIDPArray(prop->identifier);
+ IDP_AddToGroup(group, idprop);
+
+ item = IDP_New(IDP_GROUP, &val, "");
+ IDP_AppendArray(idprop, item);
+ /* IDP_FreeProperty(item); */ /* IDP_AppendArray does a shallow copy (memcpy), only free memory */
+ MEM_freeN(item);
+ }
+ }
+
+ /* py api calls directly */
#if 0
- else {
- printf("%s %s.%s: not implemented for this property.\n", __func__, ptr->type->identifier, prop->identifier);
- }
-#endif
+ else if (cprop->add) {
+ if (!(cprop->add->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+ ParameterList params;
+ RNA_parameter_list_create(&params, ptr, cprop->add);
+ RNA_function_call(NULL, NULL, ptr, cprop->add, &params);
+ RNA_parameter_list_free(&params);
+ }
+ }
+# if 0
+ else {
+ printf("%s %s.%s: not implemented for this property.\n", __func__, ptr->type->identifier, prop->identifier);
+ }
+# endif
#endif
- if (r_ptr) {
- if (idprop) {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ if (r_ptr) {
+ if (idprop) {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- r_ptr->data = IDP_GetIndexArray(idprop, idprop->len - 1);
- r_ptr->type = cprop->item_type;
- rna_pointer_inherit_id(NULL, ptr, r_ptr);
- }
- else
- memset(r_ptr, 0, sizeof(*r_ptr));
- }
+ r_ptr->data = IDP_GetIndexArray(idprop, idprop->len - 1);
+ r_ptr->type = cprop->item_type;
+ rna_pointer_inherit_id(NULL, ptr, r_ptr);
+ }
+ else
+ memset(r_ptr, 0, sizeof(*r_ptr));
+ }
}
bool RNA_property_collection_remove(PointerRNA *ptr, PropertyRNA *prop, int key)
{
- IDProperty *idprop;
-/* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */
+ IDProperty *idprop;
+ /* CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop; */
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDProperty tmp, *array;
- int len;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDProperty tmp, *array;
+ int len;
- len = idprop->len;
- array = IDP_IDPArray(idprop);
+ len = idprop->len;
+ array = IDP_IDPArray(idprop);
- if (key >= 0 && key < len) {
- if (key + 1 < len) {
- /* move element to be removed to the back */
- memcpy(&tmp, &array[key], sizeof(IDProperty));
- memmove(array + key, array + key + 1, sizeof(IDProperty) * (len - (key + 1)));
- memcpy(&array[len - 1], &tmp, sizeof(IDProperty));
- }
+ if (key >= 0 && key < len) {
+ if (key + 1 < len) {
+ /* move element to be removed to the back */
+ memcpy(&tmp, &array[key], sizeof(IDProperty));
+ memmove(array + key, array + key + 1, sizeof(IDProperty) * (len - (key + 1)));
+ memcpy(&array[len - 1], &tmp, sizeof(IDProperty));
+ }
- IDP_ResizeIDPArray(idprop, len - 1);
- }
+ IDP_ResizeIDPArray(idprop, len - 1);
+ }
- return true;
- }
- else if (prop->flag & PROP_IDPROPERTY) {
- return true;
- }
+ return true;
+ }
+ else if (prop->flag & PROP_IDPROPERTY) {
+ return true;
+ }
- /* py api calls directly */
-#if 0
- else if (cprop->remove) {
- if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
- ParameterList params;
- RNA_parameter_list_create(&params, ptr, cprop->remove);
- RNA_function_call(NULL, NULL, ptr, cprop->remove, &params);
- RNA_parameter_list_free(&params);
- }
-
- return false;
- }
+ /* py api calls directly */
#if 0
- else {
- printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);
- }
+ else if (cprop->remove) {
+ if (!(cprop->remove->flag & FUNC_USE_CONTEXT)) { /* XXX check for this somewhere else */
+ ParameterList params;
+ RNA_parameter_list_create(&params, ptr, cprop->remove);
+ RNA_function_call(NULL, NULL, ptr, cprop->remove, &params);
+ RNA_parameter_list_free(&params);
+ }
+
+ return false;
+ }
+# if 0
+ else {
+ printf("%s %s.%s: only supported for id properties.\n", __func__, ptr->type->identifier, prop->identifier);
+ }
+# endif
#endif
-#endif
- return false;
+ return false;
}
bool RNA_property_collection_move(PointerRNA *ptr, PropertyRNA *prop, int key, int pos)
{
- IDProperty *idprop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDProperty tmp, *array;
- int len;
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDProperty tmp, *array;
+ int len;
- len = idprop->len;
- array = IDP_IDPArray(idprop);
+ len = idprop->len;
+ array = IDP_IDPArray(idprop);
- if (key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
- memcpy(&tmp, &array[key], sizeof(IDProperty));
- if (pos < key)
- memmove(array + pos + 1, array + pos, sizeof(IDProperty) * (key - pos));
- else
- memmove(array + key, array + key + 1, sizeof(IDProperty) * (pos - key));
- memcpy(&array[pos], &tmp, sizeof(IDProperty));
- }
+ if (key >= 0 && key < len && pos >= 0 && pos < len && key != pos) {
+ memcpy(&tmp, &array[key], sizeof(IDProperty));
+ if (pos < key)
+ memmove(array + pos + 1, array + pos, sizeof(IDProperty) * (key - pos));
+ else
+ memmove(array + key, array + key + 1, sizeof(IDProperty) * (pos - key));
+ memcpy(&array[pos], &tmp, sizeof(IDProperty));
+ }
- return true;
- }
- else if (prop->flag & PROP_IDPROPERTY) {
- return true;
- }
+ return true;
+ }
+ else if (prop->flag & PROP_IDPROPERTY) {
+ return true;
+ }
- return false;
+ return false;
}
void RNA_property_collection_clear(PointerRNA *ptr, PropertyRNA *prop)
{
- IDProperty *idprop;
+ IDProperty *idprop;
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if ((idprop = rna_idproperty_check(&prop, ptr))) {
- IDP_ResizeIDPArray(idprop, 0);
- rna_idproperty_touch(idprop);
- }
+ if ((idprop = rna_idproperty_check(&prop, ptr))) {
+ IDP_ResizeIDPArray(idprop, 0);
+ rna_idproperty_touch(idprop);
+ }
}
int RNA_property_collection_lookup_index(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *t_ptr)
{
- CollectionPropertyIterator iter;
- int index = 0;
+ CollectionPropertyIterator iter;
+ int index = 0;
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- RNA_property_collection_begin(ptr, prop, &iter);
- for (index = 0; iter.valid; RNA_property_collection_next(&iter), index++) {
- if (iter.ptr.data == t_ptr->data)
- break;
- }
- RNA_property_collection_end(&iter);
+ RNA_property_collection_begin(ptr, prop, &iter);
+ for (index = 0; iter.valid; RNA_property_collection_next(&iter), index++) {
+ if (iter.ptr.data == t_ptr->data)
+ break;
+ }
+ RNA_property_collection_end(&iter);
- /* did we find it? */
- if (iter.valid)
- return index;
- else
- return -1;
+ /* did we find it? */
+ if (iter.valid)
+ return index;
+ else
+ return -1;
}
-int RNA_property_collection_lookup_int(PointerRNA *ptr, PropertyRNA *prop, int key, PointerRNA *r_ptr)
+int RNA_property_collection_lookup_int(PointerRNA *ptr,
+ PropertyRNA *prop,
+ int key,
+ PointerRNA *r_ptr)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if (cprop->lookupint) {
- /* we have a callback defined, use it */
- return cprop->lookupint(ptr, key, r_ptr);
- }
- else {
- /* no callback defined, just iterate and find the nth item */
- CollectionPropertyIterator iter;
- int i;
+ if (cprop->lookupint) {
+ /* we have a callback defined, use it */
+ return cprop->lookupint(ptr, key, r_ptr);
+ }
+ else {
+ /* no callback defined, just iterate and find the nth item */
+ CollectionPropertyIterator iter;
+ int i;
- RNA_property_collection_begin(ptr, prop, &iter);
- for (i = 0; iter.valid; RNA_property_collection_next(&iter), i++) {
- if (i == key) {
- *r_ptr = iter.ptr;
- break;
- }
- }
- RNA_property_collection_end(&iter);
+ RNA_property_collection_begin(ptr, prop, &iter);
+ for (i = 0; iter.valid; RNA_property_collection_next(&iter), i++) {
+ if (i == key) {
+ *r_ptr = iter.ptr;
+ break;
+ }
+ }
+ RNA_property_collection_end(&iter);
- if (!iter.valid)
- memset(r_ptr, 0, sizeof(*r_ptr));
+ if (!iter.valid)
+ memset(r_ptr, 0, sizeof(*r_ptr));
- return iter.valid;
- }
+ return iter.valid;
+ }
}
-int RNA_property_collection_lookup_string(PointerRNA *ptr, PropertyRNA *prop, const char *key, PointerRNA *r_ptr)
+int RNA_property_collection_lookup_string(PointerRNA *ptr,
+ PropertyRNA *prop,
+ const char *key,
+ PointerRNA *r_ptr)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if (cprop->lookupstring) {
- /* we have a callback defined, use it */
- return cprop->lookupstring(ptr, key, r_ptr);
- }
- else {
- /* no callback defined, compare with name properties if they exist */
- CollectionPropertyIterator iter;
- PropertyRNA *nameprop;
- char name[256], *nameptr;
- int found = 0;
- int keylen = strlen(key);
- int namelen;
+ if (cprop->lookupstring) {
+ /* we have a callback defined, use it */
+ return cprop->lookupstring(ptr, key, r_ptr);
+ }
+ else {
+ /* no callback defined, compare with name properties if they exist */
+ CollectionPropertyIterator iter;
+ PropertyRNA *nameprop;
+ char name[256], *nameptr;
+ int found = 0;
+ int keylen = strlen(key);
+ int namelen;
- RNA_property_collection_begin(ptr, prop, &iter);
- for (; iter.valid; RNA_property_collection_next(&iter)) {
- if (iter.ptr.data && iter.ptr.type->nameproperty) {
- nameprop = iter.ptr.type->nameproperty;
+ RNA_property_collection_begin(ptr, prop, &iter);
+ for (; iter.valid; RNA_property_collection_next(&iter)) {
+ if (iter.ptr.data && iter.ptr.type->nameproperty) {
+ nameprop = iter.ptr.type->nameproperty;
- nameptr = RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
+ nameptr = RNA_property_string_get_alloc(&iter.ptr, nameprop, name, sizeof(name), &namelen);
- if ((keylen == namelen) && STREQ(nameptr, key)) {
- *r_ptr = iter.ptr;
- found = 1;
- }
+ if ((keylen == namelen) && STREQ(nameptr, key)) {
+ *r_ptr = iter.ptr;
+ found = 1;
+ }
- if ((char *)&name != nameptr)
- MEM_freeN(nameptr);
+ if ((char *)&name != nameptr)
+ MEM_freeN(nameptr);
- if (found)
- break;
- }
- }
- RNA_property_collection_end(&iter);
+ if (found)
+ break;
+ }
+ }
+ RNA_property_collection_end(&iter);
- if (!iter.valid)
- memset(r_ptr, 0, sizeof(*r_ptr));
+ if (!iter.valid)
+ memset(r_ptr, 0, sizeof(*r_ptr));
- return iter.valid;
- }
+ return iter.valid;
+ }
}
/* zero return is an assignment error */
-int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, const int key, const PointerRNA *assign_ptr)
+int RNA_property_collection_assign_int(PointerRNA *ptr,
+ PropertyRNA *prop,
+ const int key,
+ const PointerRNA *assign_ptr)
{
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)rna_ensure_property(prop);
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
- if (cprop->assignint) {
- /* we have a callback defined, use it */
- return cprop->assignint(ptr, key, assign_ptr);
- }
+ if (cprop->assignint) {
+ /* we have a callback defined, use it */
+ return cprop->assignint(ptr, key, assign_ptr);
+ }
- return 0;
+ return 0;
}
bool RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr)
{
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
-
- *r_ptr = *ptr;
- return ((r_ptr->type = rna_ensure_property(prop)->srna) ? 1 : 0);
-}
-
-int RNA_property_collection_raw_array(PointerRNA *ptr, PropertyRNA *prop, PropertyRNA *itemprop, RawArray *array)
-{
- CollectionPropertyIterator iter;
- ArrayIterator *internal;
- char *arrayp;
-
- BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
-
- if (!(prop->flag_internal & PROP_INTERN_RAW_ARRAY) || !(itemprop->flag_internal & PROP_INTERN_RAW_ACCESS))
- return 0;
-
- RNA_property_collection_begin(ptr, prop, &iter);
-
- if (iter.valid) {
- /* get data from array iterator and item property */
- internal = &iter.internal.array;
- arrayp = (iter.valid) ? iter.ptr.data : NULL;
-
- if (internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
- /* we might skip some items, so it's not a proper array */
- RNA_property_collection_end(&iter);
- return 0;
- }
-
- array->array = arrayp + itemprop->rawoffset;
- array->stride = internal->itemsize;
- array->len = ((char *)internal->endptr - arrayp) / internal->itemsize;
- array->type = itemprop->rawtype;
- }
- else
- memset(array, 0, sizeof(RawArray));
-
- RNA_property_collection_end(&iter);
-
- return 1;
-}
-
-#define RAW_GET(dtype, var, raw, a) \
-{ \
- switch (raw.type) { \
- case PROP_RAW_CHAR: var = (dtype)((char *)raw.array)[a]; break; \
- case PROP_RAW_SHORT: var = (dtype)((short *)raw.array)[a]; break; \
- case PROP_RAW_INT: var = (dtype)((int *)raw.array)[a]; break; \
- case PROP_RAW_BOOLEAN: var = (dtype)((bool *)raw.array)[a]; break; \
- case PROP_RAW_FLOAT: var = (dtype)((float *)raw.array)[a]; break; \
- case PROP_RAW_DOUBLE: var = (dtype)((double *)raw.array)[a]; break; \
- default: var = (dtype)0; \
- } \
-} (void)0
-
-#define RAW_SET(dtype, raw, a, var) \
-{ \
- switch (raw.type) { \
- case PROP_RAW_CHAR: ((char *)raw.array)[a] = (char)var; break; \
- case PROP_RAW_SHORT: ((short *)raw.array)[a] = (short)var; break; \
- case PROP_RAW_INT: ((int *)raw.array)[a] = (int)var; break; \
- case PROP_RAW_BOOLEAN: ((bool *)raw.array)[a] = (bool)var; break; \
- case PROP_RAW_FLOAT: ((float *)raw.array)[a] = (float)var; break; \
- case PROP_RAW_DOUBLE: ((double *)raw.array)[a] = (double)var; break; \
- default: break; \
- } \
-} (void)0
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+
+ *r_ptr = *ptr;
+ return ((r_ptr->type = rna_ensure_property(prop)->srna) ? 1 : 0);
+}
+
+int RNA_property_collection_raw_array(PointerRNA *ptr,
+ PropertyRNA *prop,
+ PropertyRNA *itemprop,
+ RawArray *array)
+{
+ CollectionPropertyIterator iter;
+ ArrayIterator *internal;
+ char *arrayp;
+
+ BLI_assert(RNA_property_type(prop) == PROP_COLLECTION);
+
+ if (!(prop->flag_internal & PROP_INTERN_RAW_ARRAY) ||
+ !(itemprop->flag_internal & PROP_INTERN_RAW_ACCESS))
+ return 0;
+
+ RNA_property_collection_begin(ptr, prop, &iter);
+
+ if (iter.valid) {
+ /* get data from array iterator and item property */
+ internal = &iter.internal.array;
+ arrayp = (iter.valid) ? iter.ptr.data : NULL;
+
+ if (internal->skip || !RNA_property_editable(&iter.ptr, itemprop)) {
+ /* we might skip some items, so it's not a proper array */
+ RNA_property_collection_end(&iter);
+ return 0;
+ }
+
+ array->array = arrayp + itemprop->rawoffset;
+ array->stride = internal->itemsize;
+ array->len = ((char *)internal->endptr - arrayp) / internal->itemsize;
+ array->type = itemprop->rawtype;
+ }
+ else
+ memset(array, 0, sizeof(RawArray));
+
+ RNA_property_collection_end(&iter);
+
+ return 1;
+}
+
+#define RAW_GET(dtype, var, raw, a) \
+ { \
+ switch (raw.type) { \
+ case PROP_RAW_CHAR: \
+ var = (dtype)((char *)raw.array)[a]; \
+ break; \
+ case PROP_RAW_SHORT: \
+ var = (dtype)((short *)raw.array)[a]; \
+ break; \
+ case PROP_RAW_INT: \
+ var = (dtype)((int *)raw.array)[a]; \
+ break; \
+ case PROP_RAW_BOOLEAN: \
+ var = (dtype)((bool *)raw.array)[a]; \
+ break; \
+ case PROP_RAW_FLOAT: \
+ var = (dtype)((float *)raw.array)[a]; \
+ break; \
+ case PROP_RAW_DOUBLE: \
+ var = (dtype)((double *)raw.array)[a]; \
+ break; \
+ default: \
+ var = (dtype)0; \
+ } \
+ } \
+ (void)0
+
+#define RAW_SET(dtype, raw, a, var) \
+ { \
+ switch (raw.type) { \
+ case PROP_RAW_CHAR: \
+ ((char *)raw.array)[a] = (char)var; \
+ break; \
+ case PROP_RAW_SHORT: \
+ ((short *)raw.array)[a] = (short)var; \
+ break; \
+ case PROP_RAW_INT: \
+ ((int *)raw.array)[a] = (int)var; \
+ break; \
+ case PROP_RAW_BOOLEAN: \
+ ((bool *)raw.array)[a] = (bool)var; \
+ break; \
+ case PROP_RAW_FLOAT: \
+ ((float *)raw.array)[a] = (float)var; \
+ break; \
+ case PROP_RAW_DOUBLE: \
+ ((double *)raw.array)[a] = (double)var; \
+ break; \
+ default: \
+ break; \
+ } \
+ } \
+ (void)0
int RNA_raw_type_sizeof(RawPropertyType type)
{
- switch (type) {
- case PROP_RAW_CHAR: return sizeof(char);
- case PROP_RAW_SHORT: return sizeof(short);
- case PROP_RAW_INT: return sizeof(int);
- case PROP_RAW_BOOLEAN: return sizeof(bool);
- case PROP_RAW_FLOAT: return sizeof(float);
- case PROP_RAW_DOUBLE: return sizeof(double);
- default: return 0;
- }
+ switch (type) {
+ case PROP_RAW_CHAR:
+ return sizeof(char);
+ case PROP_RAW_SHORT:
+ return sizeof(short);
+ case PROP_RAW_INT:
+ return sizeof(int);
+ case PROP_RAW_BOOLEAN:
+ return sizeof(bool);
+ case PROP_RAW_FLOAT:
+ return sizeof(float);
+ case PROP_RAW_DOUBLE:
+ return sizeof(double);
+ default:
+ return 0;
+ }
}
static int rna_property_array_length_all_dimensions(PointerRNA *ptr, PropertyRNA *prop)
{
- int i, len[RNA_MAX_ARRAY_DIMENSION];
- const int dim = RNA_property_array_dimension(ptr, prop, len);
- int size;
-
- if (dim == 0)
- return 0;
-
- for (size = 1, i = 0; i < dim; i++)
- size *= len[i];
-
- return size;
-}
-
-static int rna_raw_access(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
- void *inarray, RawPropertyType intype, int inlen, int set)
-{
- StructRNA *ptype;
- PointerRNA itemptr_base;
- PropertyRNA *itemprop, *iprop;
- PropertyType itemtype = 0;
- RawArray in;
- int itemlen = 0;
-
- /* initialize in array, stride assumed 0 in following code */
- in.array = inarray;
- in.type = intype;
- in.len = inlen;
- in.stride = 0;
-
- ptype = RNA_property_pointer_type(ptr, prop);
-
- /* try to get item property pointer */
- RNA_pointer_create(NULL, ptype, NULL, &itemptr_base);
- itemprop = RNA_struct_find_property(&itemptr_base, propname);
-
- if (itemprop) {
- /* we have item property pointer */
- RawArray out;
-
- /* check type */
- itemtype = RNA_property_type(itemprop);
-
- if (!ELEM(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
- BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
- return 0;
- }
-
- /* check item array */
- itemlen = RNA_property_array_length(&itemptr_base, itemprop);
-
- /* dynamic array? need to get length per item */
- if (itemprop->getlength) {
- itemprop = NULL;
- }
- /* try to access as raw array */
- else if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
- int arraylen = (itemlen == 0) ? 1 : itemlen;
- if (in.len != arraylen * out.len) {
- BKE_reportf(reports, RPT_ERROR, "Array length mismatch (expected %d, got %d)",
- out.len * arraylen, in.len);
- return 0;
- }
-
- /* matching raw types */
- if (out.type == in.type) {
- void *inp = in.array;
- void *outp = out.array;
- int a, size;
-
- size = RNA_raw_type_sizeof(out.type) * arraylen;
-
- for (a = 0; a < out.len; a++) {
- if (set) memcpy(outp, inp, size);
- else memcpy(inp, outp, size);
-
- inp = (char *)inp + size;
- outp = (char *)outp + out.stride;
- }
-
- return 1;
- }
-
- /* could also be faster with non-matching types,
- * for now we just do slower loop .. */
- }
- }
-
- {
- void *tmparray = NULL;
- int tmplen = 0;
- int err = 0, j, a = 0;
- int needconv = 1;
-
- if (((itemtype == PROP_INT) && (in.type == PROP_RAW_INT)) ||
- ((itemtype == PROP_BOOLEAN) && (in.type == PROP_RAW_BOOLEAN)) ||
- ((itemtype == PROP_FLOAT) && (in.type == PROP_RAW_FLOAT)))
- {
- /* avoid creating temporary buffer if the data type match */
- needconv = 0;
- }
- /* no item property pointer, can still be id property, or
- * property of a type derived from the collection pointer type */
- RNA_PROP_BEGIN (ptr, itemptr, prop)
- {
- if (itemptr.data) {
- if (itemprop) {
- /* we got the property already */
- iprop = itemprop;
- }
- else {
- /* not yet, look it up and verify if it is valid */
- iprop = RNA_struct_find_property(&itemptr, propname);
-
- if (iprop) {
- itemlen = rna_property_array_length_all_dimensions(&itemptr, iprop);
- itemtype = RNA_property_type(iprop);
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Property named '%s' not found", propname);
- err = 1;
- break;
- }
-
- if (!ELEM(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
- BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
- err = 1;
- break;
- }
- }
-
- /* editable check */
- if (!set || RNA_property_editable(&itemptr, iprop)) {
- if (a + itemlen > in.len) {
- BKE_reportf(reports, RPT_ERROR, "Array length mismatch (got %d, expected more)", in.len);
- err = 1;
- break;
- }
-
- if (itemlen == 0) {
- /* handle conversions */
- if (set) {
- switch (itemtype) {
- case PROP_BOOLEAN:
- {
- int b;
- RAW_GET(bool, b, in, a);
- RNA_property_boolean_set(&itemptr, iprop, b);
- break;
- }
- case PROP_INT:
- {
- int i;
- RAW_GET(int, i, in, a);
- RNA_property_int_set(&itemptr, iprop, i);
- break;
- }
- case PROP_FLOAT:
- {
- float f;
- RAW_GET(float, f, in, a);
- RNA_property_float_set(&itemptr, iprop, f);
- break;
- }
- default:
- break;
- }
- }
- else {
- switch (itemtype) {
- case PROP_BOOLEAN:
- {
- int b = RNA_property_boolean_get(&itemptr, iprop);
- RAW_SET(bool, in, a, b);
- break;
- }
- case PROP_INT:
- {
- int i = RNA_property_int_get(&itemptr, iprop);
- RAW_SET(int, in, a, i);
- break;
- }
- case PROP_FLOAT:
- {
- float f = RNA_property_float_get(&itemptr, iprop);
- RAW_SET(float, in, a, f);
- break;
- }
- default:
- break;
- }
- }
- a++;
- }
- else if (needconv == 1) {
- /* allocate temporary array if needed */
- if (tmparray && tmplen != itemlen) {
- MEM_freeN(tmparray);
- tmparray = NULL;
- }
- if (!tmparray) {
- tmparray = MEM_callocN(sizeof(float) * itemlen, "RNA tmparray");
- tmplen = itemlen;
- }
-
- /* handle conversions */
- if (set) {
- switch (itemtype) {
- case PROP_BOOLEAN:
- {
- for (j = 0; j < itemlen; j++, a++)
- RAW_GET(bool, ((bool *)tmparray)[j], in, a);
- RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
- break;
- }
- case PROP_INT:
- {
- for (j = 0; j < itemlen; j++, a++)
- RAW_GET(int, ((int *)tmparray)[j], in, a);
- RNA_property_int_set_array(&itemptr, iprop, tmparray);
- break;
- }
- case PROP_FLOAT:
- {
- for (j = 0; j < itemlen; j++, a++)
- RAW_GET(float, ((float *)tmparray)[j], in, a);
- RNA_property_float_set_array(&itemptr, iprop, tmparray);
- break;
- }
- default:
- break;
- }
- }
- else {
- switch (itemtype) {
- case PROP_BOOLEAN:
- {
- RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
- for (j = 0; j < itemlen; j++, a++)
- RAW_SET(int, in, a, ((bool *)tmparray)[j]);
- break;
- }
- case PROP_INT:
- {
- RNA_property_int_get_array(&itemptr, iprop, tmparray);
- for (j = 0; j < itemlen; j++, a++)
- RAW_SET(int, in, a, ((int *)tmparray)[j]);
- break;
- }
- case PROP_FLOAT:
- {
- RNA_property_float_get_array(&itemptr, iprop, tmparray);
- for (j = 0; j < itemlen; j++, a++)
- RAW_SET(float, in, a, ((float *)tmparray)[j]);
- break;
- }
- default:
- break;
- }
- }
- }
- else {
- if (set) {
- switch (itemtype) {
- case PROP_BOOLEAN:
- {
- RNA_property_boolean_set_array(&itemptr, iprop, &((bool *)in.array)[a]);
- a += itemlen;
- break;
- }
- case PROP_INT:
- {
- RNA_property_int_set_array(&itemptr, iprop, &((int *)in.array)[a]);
- a += itemlen;
- break;
- }
- case PROP_FLOAT:
- {
- RNA_property_float_set_array(&itemptr, iprop, &((float *)in.array)[a]);
- a += itemlen;
- break;
- }
- default:
- break;
- }
- }
- else {
- switch (itemtype) {
- case PROP_BOOLEAN:
- {
- RNA_property_boolean_get_array(&itemptr, iprop, &((bool *)in.array)[a]);
- a += itemlen;
- break;
- }
- case PROP_INT:
- {
- RNA_property_int_get_array(&itemptr, iprop, &((int *)in.array)[a]);
- a += itemlen;
- break;
- }
- case PROP_FLOAT:
- {
- RNA_property_float_get_array(&itemptr, iprop, &((float *)in.array)[a]);
- a += itemlen;
- break;
- }
- default:
- break;
- }
- }
- }
- }
- }
- }
- RNA_PROP_END;
-
- if (tmparray)
- MEM_freeN(tmparray);
-
- return !err;
- }
+ int i, len[RNA_MAX_ARRAY_DIMENSION];
+ const int dim = RNA_property_array_dimension(ptr, prop, len);
+ int size;
+
+ if (dim == 0)
+ return 0;
+
+ for (size = 1, i = 0; i < dim; i++)
+ size *= len[i];
+
+ return size;
+}
+
+static int rna_raw_access(ReportList *reports,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const char *propname,
+ void *inarray,
+ RawPropertyType intype,
+ int inlen,
+ int set)
+{
+ StructRNA *ptype;
+ PointerRNA itemptr_base;
+ PropertyRNA *itemprop, *iprop;
+ PropertyType itemtype = 0;
+ RawArray in;
+ int itemlen = 0;
+
+ /* initialize in array, stride assumed 0 in following code */
+ in.array = inarray;
+ in.type = intype;
+ in.len = inlen;
+ in.stride = 0;
+
+ ptype = RNA_property_pointer_type(ptr, prop);
+
+ /* try to get item property pointer */
+ RNA_pointer_create(NULL, ptype, NULL, &itemptr_base);
+ itemprop = RNA_struct_find_property(&itemptr_base, propname);
+
+ if (itemprop) {
+ /* we have item property pointer */
+ RawArray out;
+
+ /* check type */
+ itemtype = RNA_property_type(itemprop);
+
+ if (!ELEM(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+ BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
+ return 0;
+ }
+
+ /* check item array */
+ itemlen = RNA_property_array_length(&itemptr_base, itemprop);
+
+ /* dynamic array? need to get length per item */
+ if (itemprop->getlength) {
+ itemprop = NULL;
+ }
+ /* try to access as raw array */
+ else if (RNA_property_collection_raw_array(ptr, prop, itemprop, &out)) {
+ int arraylen = (itemlen == 0) ? 1 : itemlen;
+ if (in.len != arraylen * out.len) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Array length mismatch (expected %d, got %d)",
+ out.len * arraylen,
+ in.len);
+ return 0;
+ }
+
+ /* matching raw types */
+ if (out.type == in.type) {
+ void *inp = in.array;
+ void *outp = out.array;
+ int a, size;
+
+ size = RNA_raw_type_sizeof(out.type) * arraylen;
+
+ for (a = 0; a < out.len; a++) {
+ if (set)
+ memcpy(outp, inp, size);
+ else
+ memcpy(inp, outp, size);
+
+ inp = (char *)inp + size;
+ outp = (char *)outp + out.stride;
+ }
+
+ return 1;
+ }
+
+ /* could also be faster with non-matching types,
+ * for now we just do slower loop .. */
+ }
+ }
+
+ {
+ void *tmparray = NULL;
+ int tmplen = 0;
+ int err = 0, j, a = 0;
+ int needconv = 1;
+
+ if (((itemtype == PROP_INT) && (in.type == PROP_RAW_INT)) ||
+ ((itemtype == PROP_BOOLEAN) && (in.type == PROP_RAW_BOOLEAN)) ||
+ ((itemtype == PROP_FLOAT) && (in.type == PROP_RAW_FLOAT))) {
+ /* avoid creating temporary buffer if the data type match */
+ needconv = 0;
+ }
+ /* no item property pointer, can still be id property, or
+ * property of a type derived from the collection pointer type */
+ RNA_PROP_BEGIN (ptr, itemptr, prop) {
+ if (itemptr.data) {
+ if (itemprop) {
+ /* we got the property already */
+ iprop = itemprop;
+ }
+ else {
+ /* not yet, look it up and verify if it is valid */
+ iprop = RNA_struct_find_property(&itemptr, propname);
+
+ if (iprop) {
+ itemlen = rna_property_array_length_all_dimensions(&itemptr, iprop);
+ itemtype = RNA_property_type(iprop);
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Property named '%s' not found", propname);
+ err = 1;
+ break;
+ }
+
+ if (!ELEM(itemtype, PROP_BOOLEAN, PROP_INT, PROP_FLOAT)) {
+ BKE_report(reports, RPT_ERROR, "Only boolean, int and float properties supported");
+ err = 1;
+ break;
+ }
+ }
+
+ /* editable check */
+ if (!set || RNA_property_editable(&itemptr, iprop)) {
+ if (a + itemlen > in.len) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Array length mismatch (got %d, expected more)", in.len);
+ err = 1;
+ break;
+ }
+
+ if (itemlen == 0) {
+ /* handle conversions */
+ if (set) {
+ switch (itemtype) {
+ case PROP_BOOLEAN: {
+ int b;
+ RAW_GET(bool, b, in, a);
+ RNA_property_boolean_set(&itemptr, iprop, b);
+ break;
+ }
+ case PROP_INT: {
+ int i;
+ RAW_GET(int, i, in, a);
+ RNA_property_int_set(&itemptr, iprop, i);
+ break;
+ }
+ case PROP_FLOAT: {
+ float f;
+ RAW_GET(float, f, in, a);
+ RNA_property_float_set(&itemptr, iprop, f);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ else {
+ switch (itemtype) {
+ case PROP_BOOLEAN: {
+ int b = RNA_property_boolean_get(&itemptr, iprop);
+ RAW_SET(bool, in, a, b);
+ break;
+ }
+ case PROP_INT: {
+ int i = RNA_property_int_get(&itemptr, iprop);
+ RAW_SET(int, in, a, i);
+ break;
+ }
+ case PROP_FLOAT: {
+ float f = RNA_property_float_get(&itemptr, iprop);
+ RAW_SET(float, in, a, f);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ a++;
+ }
+ else if (needconv == 1) {
+ /* allocate temporary array if needed */
+ if (tmparray && tmplen != itemlen) {
+ MEM_freeN(tmparray);
+ tmparray = NULL;
+ }
+ if (!tmparray) {
+ tmparray = MEM_callocN(sizeof(float) * itemlen, "RNA tmparray");
+ tmplen = itemlen;
+ }
+
+ /* handle conversions */
+ if (set) {
+ switch (itemtype) {
+ case PROP_BOOLEAN: {
+ for (j = 0; j < itemlen; j++, a++)
+ RAW_GET(bool, ((bool *)tmparray)[j], in, a);
+ RNA_property_boolean_set_array(&itemptr, iprop, tmparray);
+ break;
+ }
+ case PROP_INT: {
+ for (j = 0; j < itemlen; j++, a++)
+ RAW_GET(int, ((int *)tmparray)[j], in, a);
+ RNA_property_int_set_array(&itemptr, iprop, tmparray);
+ break;
+ }
+ case PROP_FLOAT: {
+ for (j = 0; j < itemlen; j++, a++)
+ RAW_GET(float, ((float *)tmparray)[j], in, a);
+ RNA_property_float_set_array(&itemptr, iprop, tmparray);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ else {
+ switch (itemtype) {
+ case PROP_BOOLEAN: {
+ RNA_property_boolean_get_array(&itemptr, iprop, tmparray);
+ for (j = 0; j < itemlen; j++, a++)
+ RAW_SET(int, in, a, ((bool *)tmparray)[j]);
+ break;
+ }
+ case PROP_INT: {
+ RNA_property_int_get_array(&itemptr, iprop, tmparray);
+ for (j = 0; j < itemlen; j++, a++)
+ RAW_SET(int, in, a, ((int *)tmparray)[j]);
+ break;
+ }
+ case PROP_FLOAT: {
+ RNA_property_float_get_array(&itemptr, iprop, tmparray);
+ for (j = 0; j < itemlen; j++, a++)
+ RAW_SET(float, in, a, ((float *)tmparray)[j]);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ else {
+ if (set) {
+ switch (itemtype) {
+ case PROP_BOOLEAN: {
+ RNA_property_boolean_set_array(&itemptr, iprop, &((bool *)in.array)[a]);
+ a += itemlen;
+ break;
+ }
+ case PROP_INT: {
+ RNA_property_int_set_array(&itemptr, iprop, &((int *)in.array)[a]);
+ a += itemlen;
+ break;
+ }
+ case PROP_FLOAT: {
+ RNA_property_float_set_array(&itemptr, iprop, &((float *)in.array)[a]);
+ a += itemlen;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ else {
+ switch (itemtype) {
+ case PROP_BOOLEAN: {
+ RNA_property_boolean_get_array(&itemptr, iprop, &((bool *)in.array)[a]);
+ a += itemlen;
+ break;
+ }
+ case PROP_INT: {
+ RNA_property_int_get_array(&itemptr, iprop, &((int *)in.array)[a]);
+ a += itemlen;
+ break;
+ }
+ case PROP_FLOAT: {
+ RNA_property_float_get_array(&itemptr, iprop, &((float *)in.array)[a]);
+ a += itemlen;
+ break;
+ }
+ default:
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ RNA_PROP_END;
+
+ if (tmparray)
+ MEM_freeN(tmparray);
+
+ return !err;
+ }
}
RawPropertyType RNA_property_raw_type(PropertyRNA *prop)
{
- if (prop->rawtype == PROP_RAW_UNSET) {
- /* this property has no raw access, yet we try to provide a raw type to help building the array */
- switch (prop->type) {
- case PROP_BOOLEAN:
- return PROP_RAW_BOOLEAN;
- case PROP_INT:
- return PROP_RAW_INT;
- case PROP_FLOAT:
- return PROP_RAW_FLOAT;
- case PROP_ENUM:
- return PROP_RAW_INT;
- default:
- break;
- }
- }
- return prop->rawtype;
-}
-
-int RNA_property_collection_raw_get(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
- void *array, RawPropertyType type, int len)
-{
- return rna_raw_access(reports, ptr, prop, propname, array, type, len, 0);
-}
-
-int RNA_property_collection_raw_set(ReportList *reports, PointerRNA *ptr, PropertyRNA *prop, const char *propname,
- void *array, RawPropertyType type, int len)
-{
- return rna_raw_access(reports, ptr, prop, propname, array, type, len, 1);
+ if (prop->rawtype == PROP_RAW_UNSET) {
+ /* this property has no raw access, yet we try to provide a raw type to help building the array */
+ switch (prop->type) {
+ case PROP_BOOLEAN:
+ return PROP_RAW_BOOLEAN;
+ case PROP_INT:
+ return PROP_RAW_INT;
+ case PROP_FLOAT:
+ return PROP_RAW_FLOAT;
+ case PROP_ENUM:
+ return PROP_RAW_INT;
+ default:
+ break;
+ }
+ }
+ return prop->rawtype;
+}
+
+int RNA_property_collection_raw_get(ReportList *reports,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const char *propname,
+ void *array,
+ RawPropertyType type,
+ int len)
+{
+ return rna_raw_access(reports, ptr, prop, propname, array, type, len, 0);
+}
+
+int RNA_property_collection_raw_set(ReportList *reports,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const char *propname,
+ void *array,
+ RawPropertyType type,
+ int len)
+{
+ return rna_raw_access(reports, ptr, prop, propname, array, type, len, 1);
}
/* Standard iterator functions */
-void rna_iterator_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb, IteratorSkipFunc skip)
+void rna_iterator_listbase_begin(CollectionPropertyIterator *iter,
+ ListBase *lb,
+ IteratorSkipFunc skip)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- internal->link = (lb) ? lb->first : NULL;
- internal->skip = skip;
+ internal->link = (lb) ? lb->first : NULL;
+ internal->skip = skip;
- iter->valid = (internal->link != NULL);
+ iter->valid = (internal->link != NULL);
- if (skip && iter->valid && skip(iter, internal->link))
- rna_iterator_listbase_next(iter);
+ if (skip && iter->valid && skip(iter, internal->link))
+ rna_iterator_listbase_next(iter);
}
void rna_iterator_listbase_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- if (internal->skip) {
- do {
- internal->link = internal->link->next;
- iter->valid = (internal->link != NULL);
- } while (iter->valid && internal->skip(iter, internal->link));
- }
- else {
- internal->link = internal->link->next;
- iter->valid = (internal->link != NULL);
- }
+ if (internal->skip) {
+ do {
+ internal->link = internal->link->next;
+ iter->valid = (internal->link != NULL);
+ } while (iter->valid && internal->skip(iter, internal->link));
+ }
+ else {
+ internal->link = internal->link->next;
+ iter->valid = (internal->link != NULL);
+ }
}
void *rna_iterator_listbase_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- return internal->link;
+ return internal->link;
}
void rna_iterator_listbase_end(CollectionPropertyIterator *UNUSED(iter))
{
}
-PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct ListBase *lb, int index)
+PointerRNA rna_listbase_lookup_int(PointerRNA *ptr,
+ StructRNA *type,
+ struct ListBase *lb,
+ int index)
{
- void *data = BLI_findlink(lb, index);
- return rna_pointer_inherit_refine(ptr, type, data);
+ void *data = BLI_findlink(lb, index);
+ return rna_pointer_inherit_refine(ptr, type, data);
}
-void rna_iterator_array_begin(CollectionPropertyIterator *iter, void *ptr, int itemsize, int length,
- bool free_ptr, IteratorSkipFunc skip)
+void rna_iterator_array_begin(CollectionPropertyIterator *iter,
+ void *ptr,
+ int itemsize,
+ int length,
+ bool free_ptr,
+ IteratorSkipFunc skip)
{
- ArrayIterator *internal;
+ ArrayIterator *internal;
- if (ptr == NULL)
- length = 0;
- else if (length == 0) {
- ptr = NULL;
- itemsize = 0;
- }
+ if (ptr == NULL)
+ length = 0;
+ else if (length == 0) {
+ ptr = NULL;
+ itemsize = 0;
+ }
- internal = &iter->internal.array;
- internal->ptr = ptr;
- internal->free_ptr = free_ptr ? ptr : NULL;
- internal->endptr = ((char *)ptr) + length * itemsize;
- internal->itemsize = itemsize;
- internal->skip = skip;
- internal->length = length;
+ internal = &iter->internal.array;
+ internal->ptr = ptr;
+ internal->free_ptr = free_ptr ? ptr : NULL;
+ internal->endptr = ((char *)ptr) + length * itemsize;
+ internal->itemsize = itemsize;
+ internal->skip = skip;
+ internal->length = length;
- iter->valid = (internal->ptr != internal->endptr);
+ iter->valid = (internal->ptr != internal->endptr);
- if (skip && iter->valid && skip(iter, internal->ptr))
- rna_iterator_array_next(iter);
+ if (skip && iter->valid && skip(iter, internal->ptr))
+ rna_iterator_array_next(iter);
}
void rna_iterator_array_next(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal = &iter->internal.array;
+ ArrayIterator *internal = &iter->internal.array;
- if (internal->skip) {
- do {
- internal->ptr += internal->itemsize;
- iter->valid = (internal->ptr != internal->endptr);
- } while (iter->valid && internal->skip(iter, internal->ptr));
- }
- else {
- internal->ptr += internal->itemsize;
- iter->valid = (internal->ptr != internal->endptr);
- }
+ if (internal->skip) {
+ do {
+ internal->ptr += internal->itemsize;
+ iter->valid = (internal->ptr != internal->endptr);
+ } while (iter->valid && internal->skip(iter, internal->ptr));
+ }
+ else {
+ internal->ptr += internal->itemsize;
+ iter->valid = (internal->ptr != internal->endptr);
+ }
}
void *rna_iterator_array_get(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal = &iter->internal.array;
+ ArrayIterator *internal = &iter->internal.array;
- return internal->ptr;
+ return internal->ptr;
}
void *rna_iterator_array_dereference_get(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal = &iter->internal.array;
+ ArrayIterator *internal = &iter->internal.array;
- /* for ** arrays */
- return *(void **)(internal->ptr);
+ /* for ** arrays */
+ return *(void **)(internal->ptr);
}
void rna_iterator_array_end(CollectionPropertyIterator *iter)
{
- ArrayIterator *internal = &iter->internal.array;
+ ArrayIterator *internal = &iter->internal.array;
- if (internal->free_ptr) {
- MEM_freeN(internal->free_ptr);
- internal->free_ptr = NULL;
- }
+ if (internal->free_ptr) {
+ MEM_freeN(internal->free_ptr);
+ internal->free_ptr = NULL;
+ }
}
-PointerRNA rna_array_lookup_int(PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index)
+PointerRNA rna_array_lookup_int(
+ PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index)
{
- if (index < 0 || index >= length)
- return PointerRNA_NULL;
+ if (index < 0 || index >= length)
+ return PointerRNA_NULL;
- return rna_pointer_inherit_refine(ptr, type, ((char *)data) + index * itemsize);
+ return rna_pointer_inherit_refine(ptr, type, ((char *)data) + index * itemsize);
}
/* RNA Path - Experiment */
static char *rna_path_token(const char **path, char *fixedbuf, int fixedlen, int bracket)
{
- const char *p;
- char *buf;
- char quote = '\0';
- int i, j, len, escape;
-
- len = 0;
-
- if (bracket) {
- /* get data between [], check escaping ] with \] */
- if (**path == '[') (*path)++;
- else return NULL;
-
- p = *path;
-
- /* 2 kinds of lookups now, quoted or unquoted */
- quote = *p;
-
- if (quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */
- quote = 0;
-
- if (quote == 0) {
- while (*p && (*p != ']')) {
- len++;
- p++;
- }
- }
- else {
- escape = 0;
- /* skip the first quote */
- len++;
- p++;
- while (*p && (*p != quote || escape)) {
- escape = (*p == '\\');
- len++;
- p++;
- }
-
- /* skip the last quoted char to get the ']' */
- len++;
- p++;
- }
-
- if (*p != ']') return NULL;
- }
- else {
- /* get data until . or [ */
- p = *path;
-
- while (*p && *p != '.' && *p != '[') {
- len++;
- p++;
- }
- }
-
- /* empty, return */
- if (len == 0)
- return NULL;
-
- /* try to use fixed buffer if possible */
- if (len + 1 < fixedlen)
- buf = fixedbuf;
- else
- buf = MEM_mallocN(sizeof(char) * (len + 1), "rna_path_token");
-
- /* copy string, taking into account escaped ] */
- if (bracket) {
- for (p = *path, i = 0, j = 0; i < len; i++, p++) {
- if (*p == '\\' && *(p + 1) == quote) {}
- else buf[j++] = *p;
- }
-
- buf[j] = 0;
- }
- else {
- memcpy(buf, *path, sizeof(char) * len);
- buf[len] = '\0';
- }
-
- /* set path to start of next token */
- if (*p == ']') p++;
- if (*p == '.') p++;
- *path = p;
-
- return buf;
+ const char *p;
+ char *buf;
+ char quote = '\0';
+ int i, j, len, escape;
+
+ len = 0;
+
+ if (bracket) {
+ /* get data between [], check escaping ] with \] */
+ if (**path == '[')
+ (*path)++;
+ else
+ return NULL;
+
+ p = *path;
+
+ /* 2 kinds of lookups now, quoted or unquoted */
+ quote = *p;
+
+ if (quote != '"') /* " - this comment is hack for Aligorith's text editor's sanity */
+ quote = 0;
+
+ if (quote == 0) {
+ while (*p && (*p != ']')) {
+ len++;
+ p++;
+ }
+ }
+ else {
+ escape = 0;
+ /* skip the first quote */
+ len++;
+ p++;
+ while (*p && (*p != quote || escape)) {
+ escape = (*p == '\\');
+ len++;
+ p++;
+ }
+
+ /* skip the last quoted char to get the ']' */
+ len++;
+ p++;
+ }
+
+ if (*p != ']')
+ return NULL;
+ }
+ else {
+ /* get data until . or [ */
+ p = *path;
+
+ while (*p && *p != '.' && *p != '[') {
+ len++;
+ p++;
+ }
+ }
+
+ /* empty, return */
+ if (len == 0)
+ return NULL;
+
+ /* try to use fixed buffer if possible */
+ if (len + 1 < fixedlen)
+ buf = fixedbuf;
+ else
+ buf = MEM_mallocN(sizeof(char) * (len + 1), "rna_path_token");
+
+ /* copy string, taking into account escaped ] */
+ if (bracket) {
+ for (p = *path, i = 0, j = 0; i < len; i++, p++) {
+ if (*p == '\\' && *(p + 1) == quote) {
+ }
+ else
+ buf[j++] = *p;
+ }
+
+ buf[j] = 0;
+ }
+ else {
+ memcpy(buf, *path, sizeof(char) * len);
+ buf[len] = '\0';
+ }
+
+ /* set path to start of next token */
+ if (*p == ']')
+ p++;
+ if (*p == '.')
+ p++;
+ *path = p;
+
+ return buf;
}
static int rna_token_strip_quotes(char *token)
{
- if (token[0] == '"') {
- int len = strlen(token);
- if (len >= 2 && token[len - 1] == '"') {
- /* strip away "" */
- token[len - 1] = '\0';
- return 1;
- }
- }
- return 0;
-}
-
-static bool rna_path_parse_collection_key(const char **path, PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_nextptr)
-{
- char fixedbuf[256];
- int intkey;
-
- *r_nextptr = *ptr;
-
- /* end of path, ok */
- if (!(**path))
- return true;
-
- if (**path == '[') {
- char *token;
-
- /* resolve the lookup with [] brackets */
- token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 1);
-
- if (!token)
- return false;
-
- /* check for "" to see if it is a string */
- if (rna_token_strip_quotes(token)) {
- if (RNA_property_collection_lookup_string(ptr, prop, token + 1, r_nextptr)) {
- /* pass */
- }
- else {
- r_nextptr->data = NULL;
- }
- }
- else {
- /* otherwise do int lookup */
- intkey = atoi(token);
- if (intkey == 0 && (token[0] != '0' || token[1] != '\0')) {
- return false; /* we can be sure the fixedbuf was used in this case */
- }
- if (RNA_property_collection_lookup_int(ptr, prop, intkey, r_nextptr)) {
- /* pass */
- }
- else {
- r_nextptr->data = NULL;
- }
- }
-
- if (token != fixedbuf) {
- MEM_freeN(token);
- }
- }
- else {
- if (RNA_property_collection_type_get(ptr, prop, r_nextptr)) {
- /* pass */
- }
- else {
- /* ensure we quit on invalid values */
- r_nextptr->data = NULL;
- }
- }
-
- return true;
-}
-
-static bool rna_path_parse_array_index(const char **path, PointerRNA *ptr, PropertyRNA *prop, int *r_index)
-{
- char fixedbuf[256];
- int index_arr[RNA_MAX_ARRAY_DIMENSION] = {0};
- int len[RNA_MAX_ARRAY_DIMENSION];
- const int dim = RNA_property_array_dimension(ptr, prop, len);
- int i;
-
- *r_index = -1;
-
- /* end of path, ok */
- if (!(**path))
- return true;
-
- for (i = 0; i < dim; i++) {
- int temp_index = -1;
- char *token;
-
- /* multi index resolve */
- if (**path == '[') {
- token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 1);
-
- if (token == NULL) {
- /* invalid syntax blah[] */
- return false;
- }
- /* check for "" to see if it is a string */
- else if (rna_token_strip_quotes(token)) {
- temp_index = RNA_property_array_item_index(prop, *(token + 1));
- }
- else {
- /* otherwise do int lookup */
- temp_index = atoi(token);
-
- if (temp_index == 0 && (token[0] != '0' || token[1] != '\0')) {
- if (token != fixedbuf) {
- MEM_freeN(token);
- }
-
- return false;
- }
- }
- }
- else if (dim == 1) {
- /* location.x || scale.X, single dimension arrays only */
- token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 0);
- if (token == NULL) {
- /* invalid syntax blah.. */
- return false;
- }
- temp_index = RNA_property_array_item_index(prop, *token);
- }
- else {
- /* just to avoid uninitialized pointer use */
- token = fixedbuf;
- }
-
- if (token != fixedbuf) {
- MEM_freeN(token);
- }
-
- /* out of range */
- if (temp_index < 0 || temp_index >= len[i])
- return false;
-
- index_arr[i] = temp_index;
- /* end multi index resolve */
- }
-
- /* arrays always contain numbers so further values are not valid */
- if (**path)
- return false;
-
- /* flatten index over all dimensions */
- {
- int totdim = 1;
- int flat_index = 0;
-
- for (i = dim - 1; i >= 0; i--) {
- flat_index += index_arr[i] * totdim;
- totdim *= len[i];
- }
-
- *r_index = flat_index;
- }
- return true;
+ if (token[0] == '"') {
+ int len = strlen(token);
+ if (len >= 2 && token[len - 1] == '"') {
+ /* strip away "" */
+ token[len - 1] = '\0';
+ return 1;
+ }
+ }
+ return 0;
+}
+
+static bool rna_path_parse_collection_key(const char **path,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ PointerRNA *r_nextptr)
+{
+ char fixedbuf[256];
+ int intkey;
+
+ *r_nextptr = *ptr;
+
+ /* end of path, ok */
+ if (!(**path))
+ return true;
+
+ if (**path == '[') {
+ char *token;
+
+ /* resolve the lookup with [] brackets */
+ token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 1);
+
+ if (!token)
+ return false;
+
+ /* check for "" to see if it is a string */
+ if (rna_token_strip_quotes(token)) {
+ if (RNA_property_collection_lookup_string(ptr, prop, token + 1, r_nextptr)) {
+ /* pass */
+ }
+ else {
+ r_nextptr->data = NULL;
+ }
+ }
+ else {
+ /* otherwise do int lookup */
+ intkey = atoi(token);
+ if (intkey == 0 && (token[0] != '0' || token[1] != '\0')) {
+ return false; /* we can be sure the fixedbuf was used in this case */
+ }
+ if (RNA_property_collection_lookup_int(ptr, prop, intkey, r_nextptr)) {
+ /* pass */
+ }
+ else {
+ r_nextptr->data = NULL;
+ }
+ }
+
+ if (token != fixedbuf) {
+ MEM_freeN(token);
+ }
+ }
+ else {
+ if (RNA_property_collection_type_get(ptr, prop, r_nextptr)) {
+ /* pass */
+ }
+ else {
+ /* ensure we quit on invalid values */
+ r_nextptr->data = NULL;
+ }
+ }
+
+ return true;
+}
+
+static bool rna_path_parse_array_index(const char **path,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ int *r_index)
+{
+ char fixedbuf[256];
+ int index_arr[RNA_MAX_ARRAY_DIMENSION] = {0};
+ int len[RNA_MAX_ARRAY_DIMENSION];
+ const int dim = RNA_property_array_dimension(ptr, prop, len);
+ int i;
+
+ *r_index = -1;
+
+ /* end of path, ok */
+ if (!(**path))
+ return true;
+
+ for (i = 0; i < dim; i++) {
+ int temp_index = -1;
+ char *token;
+
+ /* multi index resolve */
+ if (**path == '[') {
+ token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 1);
+
+ if (token == NULL) {
+ /* invalid syntax blah[] */
+ return false;
+ }
+ /* check for "" to see if it is a string */
+ else if (rna_token_strip_quotes(token)) {
+ temp_index = RNA_property_array_item_index(prop, *(token + 1));
+ }
+ else {
+ /* otherwise do int lookup */
+ temp_index = atoi(token);
+
+ if (temp_index == 0 && (token[0] != '0' || token[1] != '\0')) {
+ if (token != fixedbuf) {
+ MEM_freeN(token);
+ }
+
+ return false;
+ }
+ }
+ }
+ else if (dim == 1) {
+ /* location.x || scale.X, single dimension arrays only */
+ token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 0);
+ if (token == NULL) {
+ /* invalid syntax blah.. */
+ return false;
+ }
+ temp_index = RNA_property_array_item_index(prop, *token);
+ }
+ else {
+ /* just to avoid uninitialized pointer use */
+ token = fixedbuf;
+ }
+
+ if (token != fixedbuf) {
+ MEM_freeN(token);
+ }
+
+ /* out of range */
+ if (temp_index < 0 || temp_index >= len[i])
+ return false;
+
+ index_arr[i] = temp_index;
+ /* end multi index resolve */
+ }
+
+ /* arrays always contain numbers so further values are not valid */
+ if (**path)
+ return false;
+
+ /* flatten index over all dimensions */
+ {
+ int totdim = 1;
+ int flat_index = 0;
+
+ for (i = dim - 1; i >= 0; i--) {
+ flat_index += index_arr[i] * totdim;
+ totdim *= len[i];
+ }
+
+ *r_index = flat_index;
+ }
+ return true;
}
/**
@@ -4822,153 +4963,158 @@ static bool rna_path_parse_array_index(const char **path, PointerRNA *ptr, Prope
* Mutually exclusive with \a r_item_ptr.
* \return \a true on success, \a false if the path is somehow invalid.
*/
-static bool rna_path_parse(PointerRNA *ptr, const char *path,
- PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index,
- PointerRNA *r_item_ptr, ListBase *r_elements,
+static bool rna_path_parse(PointerRNA *ptr,
+ const char *path,
+ PointerRNA *r_ptr,
+ PropertyRNA **r_prop,
+ int *r_index,
+ PointerRNA *r_item_ptr,
+ ListBase *r_elements,
const bool eval_pointer)
{
- BLI_assert(r_item_ptr == NULL || !eval_pointer);
- PropertyRNA *prop;
- PointerRNA curptr, nextptr;
- PropertyElemRNA *prop_elem = NULL;
- int index = -1;
- char fixedbuf[256];
- int type;
- const bool do_item_ptr = r_item_ptr != NULL && !eval_pointer;
-
- if (do_item_ptr) {
- RNA_POINTER_INVALIDATE(&nextptr);
- }
-
- prop = NULL;
- curptr = *ptr;
-
- if (path == NULL || *path == '\0')
- return false;
-
- while (*path) {
- if (do_item_ptr) {
- RNA_POINTER_INVALIDATE(&nextptr);
- }
-
- int use_id_prop = (*path == '[') ? 1 : 0;
- char *token;
- /* custom property lookup ?
- * C.object["someprop"]
- */
-
- if (!curptr.data) {
- return false;
- }
-
- /* look up property name in current struct */
- token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
-
- if (!token) {
- return false;
- }
-
- prop = NULL;
- if (use_id_prop) { /* look up property name in current struct */
- IDProperty *group = RNA_struct_idprops(&curptr, 0);
- if (group && rna_token_strip_quotes(token))
- prop = (PropertyRNA *)IDP_GetPropertyFromGroup(group, token + 1);
- }
- else {
- prop = RNA_struct_find_property(&curptr, token);
- }
-
- if (token != fixedbuf) {
- MEM_freeN(token);
- }
-
- if (!prop) {
- return false;
- }
-
- if (r_elements) {
- prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__);
- prop_elem->ptr = curptr;
- prop_elem->prop = prop;
- prop_elem->index = -1; /* index will be added later, if needed. */
- BLI_addtail(r_elements, prop_elem);
- }
-
- type = RNA_property_type(prop);
-
- /* now look up the value of this property if it is a pointer or
- * collection, otherwise return the property rna so that the
- * caller can read the value of the property itself */
- switch (type) {
- case PROP_POINTER: {
- /* resolve pointer if further path elements follow
- * or explicitly requested
- */
- if (do_item_ptr || eval_pointer || *path != '\0') {
- nextptr = RNA_property_pointer_get(&curptr, prop);
- }
-
- if (eval_pointer || *path != '\0') {
- curptr = nextptr;
- prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
- index = -1;
- }
- break;
- }
- case PROP_COLLECTION: {
- /* Resolve pointer if further path elements follow.
- * Note that if path is empty, rna_path_parse_collection_key will do nothing anyway,
- * so do_item_ptr is of no use in that case.
- */
- if (*path) {
- if (!rna_path_parse_collection_key(&path, &curptr, prop, &nextptr)) {
- return false;
- }
-
- if (eval_pointer || *path != '\0') {
- curptr = nextptr;
- prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
- index = -1;
- }
- }
- break;
- }
- default:
- if (r_index || prop_elem) {
- if (!rna_path_parse_array_index(&path, &curptr, prop, &index)) {
- return false;
- }
-
- if (prop_elem) {
- prop_elem->index = index;
- }
- }
- break;
- }
- }
-
- if (r_ptr) {
- *r_ptr = curptr;
- }
- if (r_prop) {
- *r_prop = prop;
- }
- if (r_index) {
- *r_index = index;
- }
- if (r_item_ptr && do_item_ptr) {
- *r_item_ptr = nextptr;
- }
-
- if (prop_elem && (prop_elem->ptr.data != curptr.data || prop_elem->prop != prop || prop_elem->index != index)) {
- prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__);
- prop_elem->ptr = curptr;
- prop_elem->prop = prop;
- prop_elem->index = index;
- BLI_addtail(r_elements, prop_elem);
- }
-
- return true;
+ BLI_assert(r_item_ptr == NULL || !eval_pointer);
+ PropertyRNA *prop;
+ PointerRNA curptr, nextptr;
+ PropertyElemRNA *prop_elem = NULL;
+ int index = -1;
+ char fixedbuf[256];
+ int type;
+ const bool do_item_ptr = r_item_ptr != NULL && !eval_pointer;
+
+ if (do_item_ptr) {
+ RNA_POINTER_INVALIDATE(&nextptr);
+ }
+
+ prop = NULL;
+ curptr = *ptr;
+
+ if (path == NULL || *path == '\0')
+ return false;
+
+ while (*path) {
+ if (do_item_ptr) {
+ RNA_POINTER_INVALIDATE(&nextptr);
+ }
+
+ int use_id_prop = (*path == '[') ? 1 : 0;
+ char *token;
+ /* custom property lookup ?
+ * C.object["someprop"]
+ */
+
+ if (!curptr.data) {
+ return false;
+ }
+
+ /* look up property name in current struct */
+ token = rna_path_token(&path, fixedbuf, sizeof(fixedbuf), use_id_prop);
+
+ if (!token) {
+ return false;
+ }
+
+ prop = NULL;
+ if (use_id_prop) { /* look up property name in current struct */
+ IDProperty *group = RNA_struct_idprops(&curptr, 0);
+ if (group && rna_token_strip_quotes(token))
+ prop = (PropertyRNA *)IDP_GetPropertyFromGroup(group, token + 1);
+ }
+ else {
+ prop = RNA_struct_find_property(&curptr, token);
+ }
+
+ if (token != fixedbuf) {
+ MEM_freeN(token);
+ }
+
+ if (!prop) {
+ return false;
+ }
+
+ if (r_elements) {
+ prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__);
+ prop_elem->ptr = curptr;
+ prop_elem->prop = prop;
+ prop_elem->index = -1; /* index will be added later, if needed. */
+ BLI_addtail(r_elements, prop_elem);
+ }
+
+ type = RNA_property_type(prop);
+
+ /* now look up the value of this property if it is a pointer or
+ * collection, otherwise return the property rna so that the
+ * caller can read the value of the property itself */
+ switch (type) {
+ case PROP_POINTER: {
+ /* resolve pointer if further path elements follow
+ * or explicitly requested
+ */
+ if (do_item_ptr || eval_pointer || *path != '\0') {
+ nextptr = RNA_property_pointer_get(&curptr, prop);
+ }
+
+ if (eval_pointer || *path != '\0') {
+ curptr = nextptr;
+ prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ index = -1;
+ }
+ break;
+ }
+ case PROP_COLLECTION: {
+ /* Resolve pointer if further path elements follow.
+ * Note that if path is empty, rna_path_parse_collection_key will do nothing anyway,
+ * so do_item_ptr is of no use in that case.
+ */
+ if (*path) {
+ if (!rna_path_parse_collection_key(&path, &curptr, prop, &nextptr)) {
+ return false;
+ }
+
+ if (eval_pointer || *path != '\0') {
+ curptr = nextptr;
+ prop = NULL; /* now we have a PointerRNA, the prop is our parent so forget it */
+ index = -1;
+ }
+ }
+ break;
+ }
+ default:
+ if (r_index || prop_elem) {
+ if (!rna_path_parse_array_index(&path, &curptr, prop, &index)) {
+ return false;
+ }
+
+ if (prop_elem) {
+ prop_elem->index = index;
+ }
+ }
+ break;
+ }
+ }
+
+ if (r_ptr) {
+ *r_ptr = curptr;
+ }
+ if (r_prop) {
+ *r_prop = prop;
+ }
+ if (r_index) {
+ *r_index = index;
+ }
+ if (r_item_ptr && do_item_ptr) {
+ *r_item_ptr = nextptr;
+ }
+
+ if (prop_elem && (prop_elem->ptr.data != curptr.data || prop_elem->prop != prop ||
+ prop_elem->index != index)) {
+ prop_elem = MEM_mallocN(sizeof(PropertyElemRNA), __func__);
+ prop_elem->ptr = curptr;
+ prop_elem->prop = prop;
+ prop_elem->index = index;
+ BLI_addtail(r_elements, prop_elem);
+ }
+
+ return true;
}
/**
@@ -4979,10 +5125,10 @@ static bool rna_path_parse(PointerRNA *ptr, const char *path,
*/
bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, true))
- return false;
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, true))
+ return false;
- return r_ptr->data != NULL;
+ return r_ptr->data != NULL;
}
/**
@@ -4991,12 +5137,13 @@ bool RNA_path_resolve(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, Prop
* \note Assumes all pointers provided are valid.
* \return True if path can be resolved to a valid "pointer + property" OR "pointer only"
*/
-bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
+bool RNA_path_resolve_full(
+ PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true))
- return false;
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, true))
+ return false;
- return r_ptr->data != NULL;
+ return r_ptr->data != NULL;
}
/**
@@ -5006,13 +5153,16 @@ bool RNA_path_resolve_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr,
* \note Assumes all pointers provided are valid
* \return True only if both a valid pointer and property are found after resolving the path
*/
-bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
+bool RNA_path_resolve_property(PointerRNA *ptr,
+ const char *path,
+ PointerRNA *r_ptr,
+ PropertyRNA **r_prop)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, false)) {
- return false;
- }
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, NULL, NULL, false)) {
+ return false;
+ }
- return r_ptr->data != NULL && *r_prop != NULL;
+ return r_ptr->data != NULL && *r_prop != NULL;
}
/**
@@ -5023,12 +5173,13 @@ bool RNA_path_resolve_property(PointerRNA *ptr, const char *path, PointerRNA *r_
* \note Assumes all pointers provided are valid
* \return True only if both a valid pointer and property are found after resolving the path
*/
-bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
+bool RNA_path_resolve_property_full(
+ PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, false))
- return false;
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, NULL, NULL, false))
+ return false;
- return r_ptr->data != NULL && *r_prop != NULL;
+ return r_ptr->data != NULL && *r_prop != NULL;
}
/**
@@ -5041,14 +5192,17 @@ bool RNA_path_resolve_property_full(PointerRNA *ptr, const char *path, PointerRN
* \param r_item_pointer: The final Pointer or Collection item value. You must check for its validity before use!
* \return True only if both a valid pointer and property are found after resolving the path
*/
-bool RNA_path_resolve_property_and_item_pointer(
- PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, PointerRNA *r_item_ptr)
+bool RNA_path_resolve_property_and_item_pointer(PointerRNA *ptr,
+ const char *path,
+ PointerRNA *r_ptr,
+ PropertyRNA **r_prop,
+ PointerRNA *r_item_ptr)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, r_item_ptr, NULL, false)) {
- return false;
- }
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, NULL, r_item_ptr, NULL, false)) {
+ return false;
+ }
- return r_ptr->data != NULL && *r_prop != NULL;
+ return r_ptr->data != NULL && *r_prop != NULL;
}
/**
@@ -5061,13 +5215,17 @@ bool RNA_path_resolve_property_and_item_pointer(
* \param r_item_pointer: The final Pointer or Collection item value. You must check for its validity before use!
* \return True only if both a valid pointer and property are found after resolving the path
*/
-bool RNA_path_resolve_property_and_item_pointer_full(
- PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index, PointerRNA *r_item_ptr)
+bool RNA_path_resolve_property_and_item_pointer_full(PointerRNA *ptr,
+ const char *path,
+ PointerRNA *r_ptr,
+ PropertyRNA **r_prop,
+ int *r_index,
+ PointerRNA *r_item_ptr)
{
- if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, NULL, false))
- return false;
+ if (!rna_path_parse(ptr, path, r_ptr, r_prop, r_index, r_item_ptr, NULL, false))
+ return false;
- return r_ptr->data != NULL && *r_prop != NULL;
+ return r_ptr->data != NULL && *r_prop != NULL;
}
/**
* Resolve the given RNA Path into a linked list of PropertyElemRNA's.
@@ -5080,325 +5238,335 @@ bool RNA_path_resolve_property_and_item_pointer_full(
*/
bool RNA_path_resolve_elements(PointerRNA *ptr, const char *path, ListBase *r_elements)
{
- return rna_path_parse(ptr, path, NULL, NULL, NULL, NULL, r_elements, false);
+ return rna_path_parse(ptr, path, NULL, NULL, NULL, NULL, r_elements, false);
}
-char *RNA_path_append(const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *prop, int intkey, const char *strkey)
+char *RNA_path_append(
+ const char *path, PointerRNA *UNUSED(ptr), PropertyRNA *prop, int intkey, const char *strkey)
{
- DynStr *dynstr;
- const char *s;
- char appendstr[128], *result;
+ DynStr *dynstr;
+ const char *s;
+ char appendstr[128], *result;
- dynstr = BLI_dynstr_new();
+ dynstr = BLI_dynstr_new();
- /* add .identifier */
- if (path) {
- BLI_dynstr_append(dynstr, path);
- if (*path)
- BLI_dynstr_append(dynstr, ".");
- }
+ /* add .identifier */
+ if (path) {
+ BLI_dynstr_append(dynstr, path);
+ if (*path)
+ BLI_dynstr_append(dynstr, ".");
+ }
- BLI_dynstr_append(dynstr, RNA_property_identifier(prop));
+ BLI_dynstr_append(dynstr, RNA_property_identifier(prop));
- if (RNA_property_type(prop) == PROP_COLLECTION) {
- /* add ["strkey"] or [intkey] */
- BLI_dynstr_append(dynstr, "[");
+ if (RNA_property_type(prop) == PROP_COLLECTION) {
+ /* add ["strkey"] or [intkey] */
+ BLI_dynstr_append(dynstr, "[");
- if (strkey) {
- BLI_dynstr_append(dynstr, "\"");
- for (s = strkey; *s; s++) {
- if (*s == '[') {
- appendstr[0] = '\\';
- appendstr[1] = *s;
- appendstr[2] = 0;
- }
- else {
- appendstr[0] = *s;
- appendstr[1] = 0;
- }
- BLI_dynstr_append(dynstr, appendstr);
- }
- BLI_dynstr_append(dynstr, "\"");
- }
- else {
- BLI_snprintf(appendstr, sizeof(appendstr), "%d", intkey);
- BLI_dynstr_append(dynstr, appendstr);
- }
+ if (strkey) {
+ BLI_dynstr_append(dynstr, "\"");
+ for (s = strkey; *s; s++) {
+ if (*s == '[') {
+ appendstr[0] = '\\';
+ appendstr[1] = *s;
+ appendstr[2] = 0;
+ }
+ else {
+ appendstr[0] = *s;
+ appendstr[1] = 0;
+ }
+ BLI_dynstr_append(dynstr, appendstr);
+ }
+ BLI_dynstr_append(dynstr, "\"");
+ }
+ else {
+ BLI_snprintf(appendstr, sizeof(appendstr), "%d", intkey);
+ BLI_dynstr_append(dynstr, appendstr);
+ }
- BLI_dynstr_append(dynstr, "]");
- }
+ BLI_dynstr_append(dynstr, "]");
+ }
- result = BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
+ result = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
- return result;
+ return result;
}
char *RNA_path_back(const char *path)
{
- char fixedbuf[256];
- const char *previous, *current;
- char *result;
- int i;
+ char fixedbuf[256];
+ const char *previous, *current;
+ char *result;
+ int i;
- if (!path)
- return NULL;
+ if (!path)
+ return NULL;
- previous = NULL;
- current = path;
+ previous = NULL;
+ current = path;
- /* parse token by token until the end, then we back up to the previous
- * position and strip of the next token to get the path one step back */
- while (*current) {
- char *token;
+ /* parse token by token until the end, then we back up to the previous
+ * position and strip of the next token to get the path one step back */
+ while (*current) {
+ char *token;
- token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 0);
+ token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 0);
- if (!token)
- return NULL;
- if (token != fixedbuf)
- MEM_freeN(token);
+ if (!token)
+ return NULL;
+ if (token != fixedbuf)
+ MEM_freeN(token);
- /* in case of collection we also need to strip off [] */
- token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 1);
- if (token && token != fixedbuf)
- MEM_freeN(token);
+ /* in case of collection we also need to strip off [] */
+ token = rna_path_token(&current, fixedbuf, sizeof(fixedbuf), 1);
+ if (token && token != fixedbuf)
+ MEM_freeN(token);
- if (!*current)
- break;
+ if (!*current)
+ break;
- previous = current;
- }
+ previous = current;
+ }
- if (!previous)
- return NULL;
+ if (!previous)
+ return NULL;
- /* copy and strip off last token */
- i = previous - path;
- result = BLI_strdup(path);
+ /* copy and strip off last token */
+ i = previous - path;
+ result = BLI_strdup(path);
- if (i > 0 && result[i - 1] == '.') i--;
- result[i] = 0;
+ if (i > 0 && result[i - 1] == '.')
+ i--;
+ result[i] = 0;
- return result;
+ return result;
}
/* generic path search func
* if its needed this could also reference the IDProperty direct */
typedef struct IDP_Chain {
- struct IDP_Chain *up; /* parent member, reverse and set to child for path conversion. */
+ struct IDP_Chain *up; /* parent member, reverse and set to child for path conversion. */
- const char *name;
- int index;
+ const char *name;
+ int index;
} IDP_Chain;
static char *rna_idp_path_create(IDP_Chain *child_link)
{
- DynStr *dynstr = BLI_dynstr_new();
- char *path;
- bool is_first = true;
-
- int tot = 0;
- IDP_Chain *link = child_link;
-
- /* reverse the list */
- IDP_Chain *link_prev;
- link_prev = NULL;
- while (link) {
- IDP_Chain *link_next = link->up;
- link->up = link_prev;
- link_prev = link;
- link = link_next;
- tot++;
- }
-
- for (link = link_prev; link; link = link->up) {
- /* pass */
- if (link->index >= 0) {
- BLI_dynstr_appendf(dynstr, is_first ? "%s[%d]" : ".%s[%d]", link->name, link->index);
- }
- else {
- BLI_dynstr_appendf(dynstr, is_first ? "%s" : ".%s", link->name);
- }
-
- is_first = false;
- }
-
- path = BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
-
- if (*path == '\0') {
- MEM_freeN(path);
- path = NULL;
- }
-
- return path;
-}
-
-static char *rna_idp_path(PointerRNA *ptr, IDProperty *haystack, IDProperty *needle, IDP_Chain *parent_link)
-{
- char *path = NULL;
- IDP_Chain link;
-
- IDProperty *iter;
- int i;
-
- BLI_assert(haystack->type == IDP_GROUP);
-
- link.up = parent_link;
- /* always set both name and index,
- * else a stale value might get used */
- link.name = NULL;
- link.index = -1;
-
- for (i = 0, iter = haystack->data.group.first; iter; iter = iter->next, i++) {
- if (needle == iter) { /* found! */
- link.name = iter->name;
- link.index = -1;
- path = rna_idp_path_create(&link);
- break;
- }
- else {
- if (iter->type == IDP_GROUP) {
- /* ensure this is RNA */
- PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
- if (prop && prop->type == PROP_POINTER) {
- PointerRNA child_ptr = RNA_property_pointer_get(ptr, prop);
- link.name = iter->name;
- link.index = -1;
- if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) {
- break;
- }
- }
- }
- else if (iter->type == IDP_IDPARRAY) {
- PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
- if (prop && prop->type == PROP_COLLECTION) {
- IDProperty *array = IDP_IDPArray(iter);
- if (needle >= array && needle < (iter->len + array)) { /* found! */
- link.name = iter->name;
- link.index = (int)(needle - array);
- path = rna_idp_path_create(&link);
- break;
- }
- else {
- int j;
- link.name = iter->name;
- for (j = 0; j < iter->len; j++, array++) {
- PointerRNA child_ptr;
- if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) {
- link.index = j;
- if ((path = rna_idp_path(&child_ptr, array, needle, &link))) {
- break;
- }
- }
- }
- if (path)
- break;
- }
- }
- }
- }
- }
-
- return path;
+ DynStr *dynstr = BLI_dynstr_new();
+ char *path;
+ bool is_first = true;
+
+ int tot = 0;
+ IDP_Chain *link = child_link;
+
+ /* reverse the list */
+ IDP_Chain *link_prev;
+ link_prev = NULL;
+ while (link) {
+ IDP_Chain *link_next = link->up;
+ link->up = link_prev;
+ link_prev = link;
+ link = link_next;
+ tot++;
+ }
+
+ for (link = link_prev; link; link = link->up) {
+ /* pass */
+ if (link->index >= 0) {
+ BLI_dynstr_appendf(dynstr, is_first ? "%s[%d]" : ".%s[%d]", link->name, link->index);
+ }
+ else {
+ BLI_dynstr_appendf(dynstr, is_first ? "%s" : ".%s", link->name);
+ }
+
+ is_first = false;
+ }
+
+ path = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+
+ if (*path == '\0') {
+ MEM_freeN(path);
+ path = NULL;
+ }
+
+ return path;
+}
+
+static char *rna_idp_path(PointerRNA *ptr,
+ IDProperty *haystack,
+ IDProperty *needle,
+ IDP_Chain *parent_link)
+{
+ char *path = NULL;
+ IDP_Chain link;
+
+ IDProperty *iter;
+ int i;
+
+ BLI_assert(haystack->type == IDP_GROUP);
+
+ link.up = parent_link;
+ /* always set both name and index,
+ * else a stale value might get used */
+ link.name = NULL;
+ link.index = -1;
+
+ for (i = 0, iter = haystack->data.group.first; iter; iter = iter->next, i++) {
+ if (needle == iter) { /* found! */
+ link.name = iter->name;
+ link.index = -1;
+ path = rna_idp_path_create(&link);
+ break;
+ }
+ else {
+ if (iter->type == IDP_GROUP) {
+ /* ensure this is RNA */
+ PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
+ if (prop && prop->type == PROP_POINTER) {
+ PointerRNA child_ptr = RNA_property_pointer_get(ptr, prop);
+ link.name = iter->name;
+ link.index = -1;
+ if ((path = rna_idp_path(&child_ptr, iter, needle, &link))) {
+ break;
+ }
+ }
+ }
+ else if (iter->type == IDP_IDPARRAY) {
+ PropertyRNA *prop = RNA_struct_find_property(ptr, iter->name);
+ if (prop && prop->type == PROP_COLLECTION) {
+ IDProperty *array = IDP_IDPArray(iter);
+ if (needle >= array && needle < (iter->len + array)) { /* found! */
+ link.name = iter->name;
+ link.index = (int)(needle - array);
+ path = rna_idp_path_create(&link);
+ break;
+ }
+ else {
+ int j;
+ link.name = iter->name;
+ for (j = 0; j < iter->len; j++, array++) {
+ PointerRNA child_ptr;
+ if (RNA_property_collection_lookup_int(ptr, prop, j, &child_ptr)) {
+ link.index = j;
+ if ((path = rna_idp_path(&child_ptr, array, needle, &link))) {
+ break;
+ }
+ }
+ }
+ if (path)
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ return path;
}
static char *rna_path_from_ID_to_idpgroup(PointerRNA *ptr)
{
- PointerRNA id_ptr;
- IDProperty *haystack;
- IDProperty *needle;
+ PointerRNA id_ptr;
+ IDProperty *haystack;
+ IDProperty *needle;
- BLI_assert(ptr->id.data != NULL);
+ BLI_assert(ptr->id.data != NULL);
- /* TODO, Support Bones/PoseBones. no pointers stored to the bones from here, only the ID. See example in [#25746]
- * Unless this is added only way to find this is to also search all bones and pose bones
- * of an armature or object */
- RNA_id_pointer_create(ptr->id.data, &id_ptr);
+ /* TODO, Support Bones/PoseBones. no pointers stored to the bones from here, only the ID. See example in [#25746]
+ * Unless this is added only way to find this is to also search all bones and pose bones
+ * of an armature or object */
+ RNA_id_pointer_create(ptr->id.data, &id_ptr);
- haystack = RNA_struct_idprops(&id_ptr, false);
- if (haystack) { /* can fail when called on bones */
- needle = ptr->data;
- return rna_idp_path(&id_ptr, haystack, needle, NULL);
- }
- else {
- return NULL;
- }
+ haystack = RNA_struct_idprops(&id_ptr, false);
+ if (haystack) { /* can fail when called on bones */
+ needle = ptr->data;
+ return rna_idp_path(&id_ptr, haystack, needle, NULL);
+ }
+ else {
+ return NULL;
+ }
}
char *RNA_path_from_ID_to_struct(PointerRNA *ptr)
{
- char *ptrpath = NULL;
-
- if (!ptr->id.data || !ptr->data)
- return NULL;
-
- if (!RNA_struct_is_ID(ptr->type)) {
- if (ptr->type->path) {
- /* if type has a path to some ID, use it */
- ptrpath = ptr->type->path(ptr);
- }
- else if (ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) {
- PointerRNA parentptr;
- PropertyRNA *userprop;
-
- /* find the property in the struct we're nested in that references this struct, and
- * use its identifier as the first part of the path used...
- */
- RNA_id_pointer_create(ptr->id.data, &parentptr);
- userprop = RNA_struct_find_nested(&parentptr, ptr->type);
-
- if (userprop)
- ptrpath = BLI_strdup(RNA_property_identifier(userprop));
- else
- return NULL; /* can't do anything about this case yet... */
- }
- else if (RNA_struct_is_a(ptr->type, &RNA_PropertyGroup)) {
- /* special case, easier to deal with here then in ptr->type->path() */
- return rna_path_from_ID_to_idpgroup(ptr);
- }
- else
- return NULL;
- }
-
- return ptrpath;
-}
-
-static void rna_path_array_multi_from_flat_index(
- const int dimsize[RNA_MAX_ARRAY_LENGTH], const int totdims,
- const int index_dim, int index,
- int r_index_multi[RNA_MAX_ARRAY_LENGTH])
-{
- int dimsize_step[RNA_MAX_ARRAY_LENGTH + 1];
- int i = totdims - 1;
- dimsize_step[i + 1] = 1;
- dimsize_step[i] = dimsize[i];
- while (--i != -1) {
- dimsize_step[i] = dimsize[i] * dimsize_step[i + 1];
- }
- while (++i != index_dim) {
- int index_round = index / dimsize_step[i + 1];
- r_index_multi[i] = index_round;
- index -= (index_round * dimsize_step[i + 1]);
- }
- BLI_assert(index == 0);
-}
-
-static void rna_path_array_multi_string_from_flat_index(
- PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index,
- char *index_str, int index_str_len)
-{
- int dimsize[RNA_MAX_ARRAY_LENGTH];
- int totdims = RNA_property_array_dimension(ptr, prop, dimsize);
- int index_multi[RNA_MAX_ARRAY_LENGTH];
-
- rna_path_array_multi_from_flat_index(dimsize, totdims, index_dim, index, index_multi);
-
- for (int i = 0, offset = 0; (i < index_dim) && (offset < index_str_len); i++) {
- offset += BLI_snprintf_rlen(&index_str[offset], index_str_len - offset, "[%d]", index_multi[i]);
- }
+ char *ptrpath = NULL;
+
+ if (!ptr->id.data || !ptr->data)
+ return NULL;
+
+ if (!RNA_struct_is_ID(ptr->type)) {
+ if (ptr->type->path) {
+ /* if type has a path to some ID, use it */
+ ptrpath = ptr->type->path(ptr);
+ }
+ else if (ptr->type->nested && RNA_struct_is_ID(ptr->type->nested)) {
+ PointerRNA parentptr;
+ PropertyRNA *userprop;
+
+ /* find the property in the struct we're nested in that references this struct, and
+ * use its identifier as the first part of the path used...
+ */
+ RNA_id_pointer_create(ptr->id.data, &parentptr);
+ userprop = RNA_struct_find_nested(&parentptr, ptr->type);
+
+ if (userprop)
+ ptrpath = BLI_strdup(RNA_property_identifier(userprop));
+ else
+ return NULL; /* can't do anything about this case yet... */
+ }
+ else if (RNA_struct_is_a(ptr->type, &RNA_PropertyGroup)) {
+ /* special case, easier to deal with here then in ptr->type->path() */
+ return rna_path_from_ID_to_idpgroup(ptr);
+ }
+ else
+ return NULL;
+ }
+
+ return ptrpath;
+}
+
+static void rna_path_array_multi_from_flat_index(const int dimsize[RNA_MAX_ARRAY_LENGTH],
+ const int totdims,
+ const int index_dim,
+ int index,
+ int r_index_multi[RNA_MAX_ARRAY_LENGTH])
+{
+ int dimsize_step[RNA_MAX_ARRAY_LENGTH + 1];
+ int i = totdims - 1;
+ dimsize_step[i + 1] = 1;
+ dimsize_step[i] = dimsize[i];
+ while (--i != -1) {
+ dimsize_step[i] = dimsize[i] * dimsize_step[i + 1];
+ }
+ while (++i != index_dim) {
+ int index_round = index / dimsize_step[i + 1];
+ r_index_multi[i] = index_round;
+ index -= (index_round * dimsize_step[i + 1]);
+ }
+ BLI_assert(index == 0);
+}
+
+static void rna_path_array_multi_string_from_flat_index(PointerRNA *ptr,
+ PropertyRNA *prop,
+ int index_dim,
+ int index,
+ char *index_str,
+ int index_str_len)
+{
+ int dimsize[RNA_MAX_ARRAY_LENGTH];
+ int totdims = RNA_property_array_dimension(ptr, prop, dimsize);
+ int index_multi[RNA_MAX_ARRAY_LENGTH];
+
+ rna_path_array_multi_from_flat_index(dimsize, totdims, index_dim, index, index_multi);
+
+ for (int i = 0, offset = 0; (i < index_dim) && (offset < index_str_len); i++) {
+ offset += BLI_snprintf_rlen(
+ &index_str[offset], index_str_len - offset, "[%d]", index_multi[i]);
+ }
}
/**
@@ -5406,103 +5574,105 @@ static void rna_path_array_multi_string_from_flat_index(
* \param index: The *flattened* index to use when \a ``index_dim > 0``,
* this is expanded when used with multi-dimensional arrays.
*/
-char *RNA_path_from_ID_to_property_index(PointerRNA *ptr, PropertyRNA *prop, int index_dim, int index)
-{
- const bool is_rna = (prop->magic == RNA_MAGIC);
- const char *propname;
- char *ptrpath, *path;
-
- if (!ptr->id.data || !ptr->data)
- return NULL;
-
- /* path from ID to the struct holding this property */
- ptrpath = RNA_path_from_ID_to_struct(ptr);
-
- propname = RNA_property_identifier(prop);
-
- /* support indexing w/ multi-dimensional arrays */
- char index_str[RNA_MAX_ARRAY_LENGTH * 12 + 1];
- if (index_dim == 0) {
- index_str[0] = '\0';
- }
- else {
- rna_path_array_multi_string_from_flat_index(
- ptr, prop, index_dim, index,
- index_str, sizeof(index_str));
- }
-
- if (ptrpath) {
- if (is_rna) {
- path = BLI_sprintfN("%s.%s%s", ptrpath, propname, index_str);
- }
- else {
- char propname_esc[MAX_IDPROP_NAME * 2];
- BLI_strescape(propname_esc, propname, sizeof(propname_esc));
- path = BLI_sprintfN("%s[\"%s\"]%s", ptrpath, propname_esc, index_str);
- }
- MEM_freeN(ptrpath);
- }
- else if (RNA_struct_is_ID(ptr->type)) {
- if (is_rna) {
- path = BLI_sprintfN("%s%s", propname, index_str);
- }
- else {
- char propname_esc[MAX_IDPROP_NAME * 2];
- BLI_strescape(propname_esc, propname, sizeof(propname_esc));
- path = BLI_sprintfN("[\"%s\"]%s", propname_esc, index_str);
- }
- }
- else {
- path = NULL;
- }
-
- return path;
+char *RNA_path_from_ID_to_property_index(PointerRNA *ptr,
+ PropertyRNA *prop,
+ int index_dim,
+ int index)
+{
+ const bool is_rna = (prop->magic == RNA_MAGIC);
+ const char *propname;
+ char *ptrpath, *path;
+
+ if (!ptr->id.data || !ptr->data)
+ return NULL;
+
+ /* path from ID to the struct holding this property */
+ ptrpath = RNA_path_from_ID_to_struct(ptr);
+
+ propname = RNA_property_identifier(prop);
+
+ /* support indexing w/ multi-dimensional arrays */
+ char index_str[RNA_MAX_ARRAY_LENGTH * 12 + 1];
+ if (index_dim == 0) {
+ index_str[0] = '\0';
+ }
+ else {
+ rna_path_array_multi_string_from_flat_index(
+ ptr, prop, index_dim, index, index_str, sizeof(index_str));
+ }
+
+ if (ptrpath) {
+ if (is_rna) {
+ path = BLI_sprintfN("%s.%s%s", ptrpath, propname, index_str);
+ }
+ else {
+ char propname_esc[MAX_IDPROP_NAME * 2];
+ BLI_strescape(propname_esc, propname, sizeof(propname_esc));
+ path = BLI_sprintfN("%s[\"%s\"]%s", ptrpath, propname_esc, index_str);
+ }
+ MEM_freeN(ptrpath);
+ }
+ else if (RNA_struct_is_ID(ptr->type)) {
+ if (is_rna) {
+ path = BLI_sprintfN("%s%s", propname, index_str);
+ }
+ else {
+ char propname_esc[MAX_IDPROP_NAME * 2];
+ BLI_strescape(propname_esc, propname, sizeof(propname_esc));
+ path = BLI_sprintfN("[\"%s\"]%s", propname_esc, index_str);
+ }
+ }
+ else {
+ path = NULL;
+ }
+
+ return path;
}
char *RNA_path_from_ID_to_property(PointerRNA *ptr, PropertyRNA *prop)
{
- return RNA_path_from_ID_to_property_index(ptr, prop, 0, -1);
+ return RNA_path_from_ID_to_property_index(ptr, prop, 0, -1);
}
/**
* \return the path to given ptr/prop from the closest ancestor of given type, if any (else return NULL).
*/
-char *RNA_path_resolve_from_type_to_property(
- PointerRNA *ptr, PropertyRNA *prop,
- const StructRNA *type)
+char *RNA_path_resolve_from_type_to_property(PointerRNA *ptr,
+ PropertyRNA *prop,
+ const StructRNA *type)
{
- /* Try to recursively find an "type"'d ancestor,
- * to handle situations where path from ID is not enough. */
- PointerRNA idptr;
- ListBase path_elems = {NULL};
- char *path = NULL;
- char *full_path = RNA_path_from_ID_to_property(ptr, prop);
+ /* Try to recursively find an "type"'d ancestor,
+ * to handle situations where path from ID is not enough. */
+ PointerRNA idptr;
+ ListBase path_elems = {NULL};
+ char *path = NULL;
+ char *full_path = RNA_path_from_ID_to_property(ptr, prop);
- if (full_path == NULL) {
- return NULL;
- }
+ if (full_path == NULL) {
+ return NULL;
+ }
- RNA_id_pointer_create(ptr->id.data, &idptr);
+ RNA_id_pointer_create(ptr->id.data, &idptr);
- if (RNA_path_resolve_elements(&idptr, full_path, &path_elems)) {
- PropertyElemRNA *prop_elem;
+ if (RNA_path_resolve_elements(&idptr, full_path, &path_elems)) {
+ PropertyElemRNA *prop_elem;
- for (prop_elem = path_elems.last; prop_elem; prop_elem = prop_elem->prev) {
- if (RNA_struct_is_a(prop_elem->ptr.type, type)) {
- char *ref_path = RNA_path_from_ID_to_struct(&prop_elem->ptr);
- if (ref_path) {
- path = BLI_strdup(full_path + strlen(ref_path) + 1); /* +1 for the linking '.' */
- MEM_freeN(ref_path);
- }
- break;
- }
- }
+ for (prop_elem = path_elems.last; prop_elem; prop_elem = prop_elem->prev) {
+ if (RNA_struct_is_a(prop_elem->ptr.type, type)) {
+ char *ref_path = RNA_path_from_ID_to_struct(&prop_elem->ptr);
+ if (ref_path) {
+ path = BLI_strdup(full_path + strlen(ref_path) + 1); /* +1 for the linking '.' */
+ MEM_freeN(ref_path);
+ }
+ break;
+ }
+ }
- BLI_freelistN(&path_elems);
- }
+ BLI_freelistN(&path_elems);
+ }
- MEM_freeN(full_path);
- return path;
+ MEM_freeN(full_path);
+ return path;
}
/**
@@ -5511,11 +5681,11 @@ char *RNA_path_resolve_from_type_to_property(
*/
char *RNA_path_full_ID_py(ID *id)
{
- char id_esc[(sizeof(id->name) - 2) * 2];
+ char id_esc[(sizeof(id->name) - 2) * 2];
- BLI_strescape(id_esc, id->name + 2, sizeof(id_esc));
+ BLI_strescape(id_esc, id->name + 2, sizeof(id_esc));
- return BLI_sprintfN("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
+ return BLI_sprintfN("bpy.data.%s[\"%s\"]", BKE_idcode_to_name_plural(GS(id->name)), id_esc);
}
/**
@@ -5524,89 +5694,88 @@ char *RNA_path_full_ID_py(ID *id)
*/
char *RNA_path_full_struct_py(struct PointerRNA *ptr)
{
- char *id_path;
- char *data_path;
+ char *id_path;
+ char *data_path;
- char *ret;
+ char *ret;
- if (!ptr->id.data) {
- return NULL;
- }
+ if (!ptr->id.data) {
+ return NULL;
+ }
- /* never fails */
- id_path = RNA_path_full_ID_py(ptr->id.data);
+ /* never fails */
+ id_path = RNA_path_full_ID_py(ptr->id.data);
- data_path = RNA_path_from_ID_to_struct(ptr);
+ data_path = RNA_path_from_ID_to_struct(ptr);
- /* XXX data_path may be NULL (see #36788), do we want to get the 'bpy.data.foo["bar"].(null)' stuff? */
- ret = BLI_sprintfN("%s.%s", id_path, data_path);
+ /* XXX data_path may be NULL (see #36788), do we want to get the 'bpy.data.foo["bar"].(null)' stuff? */
+ ret = BLI_sprintfN("%s.%s", id_path, data_path);
- if (data_path) {
- MEM_freeN(data_path);
- }
- MEM_freeN(id_path);
+ if (data_path) {
+ MEM_freeN(data_path);
+ }
+ MEM_freeN(id_path);
- return ret;
+ return ret;
}
/**
* Get the ID.struct.property as a python representation, eg:
* bpy.data.foo["bar"].some_struct.some_prop[10]
*/
-char *RNA_path_full_property_py_ex(PointerRNA *ptr, PropertyRNA *prop, int index, bool use_fallback)
-{
- char *id_path;
- const char *data_delim;
- const char *data_path;
- bool data_path_free;
-
- char *ret;
-
- if (!ptr->id.data) {
- return NULL;
- }
-
- /* never fails */
- id_path = RNA_path_full_ID_py(ptr->id.data);
-
- data_path = RNA_path_from_ID_to_property(ptr, prop);
- if (data_path) {
- data_delim = (data_path[0] == '[') ? "" : ".";
- data_path_free = true;
- }
- else {
- if (use_fallback) {
- /* fuzzy fallback. be explicit in our ignoranc. */
- data_path = RNA_property_identifier(prop);
- data_delim = " ... ";
- }
- else {
- data_delim = ".";
-
- }
- data_path_free = false;
- }
-
-
- if ((index == -1) || (RNA_property_array_check(prop) == false)) {
- ret = BLI_sprintfN("%s%s%s",
- id_path, data_delim, data_path);
- }
- else {
- ret = BLI_sprintfN("%s%s%s[%d]",
- id_path, data_delim, data_path, index);
- }
- MEM_freeN(id_path);
- if (data_path_free) {
- MEM_freeN((void *)data_path);
- }
-
- return ret;
+char *RNA_path_full_property_py_ex(PointerRNA *ptr,
+ PropertyRNA *prop,
+ int index,
+ bool use_fallback)
+{
+ char *id_path;
+ const char *data_delim;
+ const char *data_path;
+ bool data_path_free;
+
+ char *ret;
+
+ if (!ptr->id.data) {
+ return NULL;
+ }
+
+ /* never fails */
+ id_path = RNA_path_full_ID_py(ptr->id.data);
+
+ data_path = RNA_path_from_ID_to_property(ptr, prop);
+ if (data_path) {
+ data_delim = (data_path[0] == '[') ? "" : ".";
+ data_path_free = true;
+ }
+ else {
+ if (use_fallback) {
+ /* fuzzy fallback. be explicit in our ignoranc. */
+ data_path = RNA_property_identifier(prop);
+ data_delim = " ... ";
+ }
+ else {
+ data_delim = ".";
+ }
+ data_path_free = false;
+ }
+
+ if ((index == -1) || (RNA_property_array_check(prop) == false)) {
+ ret = BLI_sprintfN("%s%s%s", id_path, data_delim, data_path);
+ }
+ else {
+ ret = BLI_sprintfN("%s%s%s[%d]", id_path, data_delim, data_path, index);
+ }
+ MEM_freeN(id_path);
+ if (data_path_free) {
+ MEM_freeN((void *)data_path);
+ }
+
+ return ret;
}
char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- return RNA_path_full_property_py_ex(ptr, prop, index, false);
+ return RNA_path_full_property_py_ex(ptr, prop, index, false);
}
/**
@@ -5615,41 +5784,39 @@ char *RNA_path_full_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
*/
char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- char *data_path;
+ char *data_path;
- char *ret;
+ char *ret;
- if (!ptr->id.data) {
- return NULL;
- }
+ if (!ptr->id.data) {
+ return NULL;
+ }
- data_path = RNA_path_from_ID_to_property(ptr, prop);
+ data_path = RNA_path_from_ID_to_property(ptr, prop);
- if (data_path == NULL) {
- /* this may not be an ID at all, check for simple when pointer owns property.
- * TODO, more complex nested case */
- if (!RNA_struct_is_ID(ptr->type)) {
- const char *prop_identifier = RNA_property_identifier(prop);
- if (RNA_struct_find_property(ptr, prop_identifier) == prop) {
- data_path = BLI_strdup(prop_identifier);
- }
- }
- }
+ if (data_path == NULL) {
+ /* this may not be an ID at all, check for simple when pointer owns property.
+ * TODO, more complex nested case */
+ if (!RNA_struct_is_ID(ptr->type)) {
+ const char *prop_identifier = RNA_property_identifier(prop);
+ if (RNA_struct_find_property(ptr, prop_identifier) == prop) {
+ data_path = BLI_strdup(prop_identifier);
+ }
+ }
+ }
- if ((index == -1) || (RNA_property_array_check(prop) == false)) {
- ret = BLI_sprintfN("%s",
- data_path);
- }
- else {
- ret = BLI_sprintfN("%s[%d]",
- data_path, index);
- }
+ if ((index == -1) || (RNA_property_array_check(prop) == false)) {
+ ret = BLI_sprintfN("%s", data_path);
+ }
+ else {
+ ret = BLI_sprintfN("%s[%d]", data_path, index);
+ }
- if (data_path) {
- MEM_freeN(data_path);
- }
+ if (data_path) {
+ MEM_freeN(data_path);
+ }
- return ret;
+ return ret;
}
/**
@@ -5658,483 +5825,482 @@ char *RNA_path_struct_property_py(PointerRNA *ptr, PropertyRNA *prop, int index)
*/
char *RNA_path_property_py(PointerRNA *UNUSED(ptr), PropertyRNA *prop, int index)
{
- char *ret;
+ char *ret;
- if ((index == -1) || (RNA_property_array_check(prop) == false)) {
- ret = BLI_sprintfN("%s",
- RNA_property_identifier(prop));
- }
- else {
- ret = BLI_sprintfN("%s[%d]",
- RNA_property_identifier(prop), index);
- }
+ if ((index == -1) || (RNA_property_array_check(prop) == false)) {
+ ret = BLI_sprintfN("%s", RNA_property_identifier(prop));
+ }
+ else {
+ ret = BLI_sprintfN("%s[%d]", RNA_property_identifier(prop), index);
+ }
- return ret;
+ return ret;
}
/* Quick name based property access */
bool RNA_boolean_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_boolean_get(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return 0;
- }
+ if (prop) {
+ return RNA_property_boolean_get(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return 0;
+ }
}
void RNA_boolean_set(PointerRNA *ptr, const char *name, bool value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_boolean_set(ptr, prop, value);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_boolean_set(ptr, prop, value);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_boolean_get_array(PointerRNA *ptr, const char *name, bool *values)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_boolean_get_array(ptr, prop, values);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_boolean_get_array(ptr, prop, values);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_boolean_set_array(PointerRNA *ptr, const char *name, const bool *values)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_boolean_set_array(ptr, prop, values);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_boolean_set_array(ptr, prop, values);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
int RNA_int_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_int_get(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return 0;
- }
+ if (prop) {
+ return RNA_property_int_get(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return 0;
+ }
}
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_int_set(ptr, prop, value);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_int_set(ptr, prop, value);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_int_get_array(PointerRNA *ptr, const char *name, int *values)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_int_get_array(ptr, prop, values);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_int_get_array(ptr, prop, values);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_int_set_array(PointerRNA *ptr, const char *name, const int *values)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_int_set_array(ptr, prop, values);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_int_set_array(ptr, prop, values);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
float RNA_float_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_float_get(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return 0;
- }
+ if (prop) {
+ return RNA_property_float_get(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return 0;
+ }
}
void RNA_float_set(PointerRNA *ptr, const char *name, float value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_float_set(ptr, prop, value);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_float_set(ptr, prop, value);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_float_get_array(PointerRNA *ptr, const char *name, float *values)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_float_get_array(ptr, prop, values);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_float_get_array(ptr, prop, values);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_float_set_array(PointerRNA *ptr, const char *name, const float *values)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_float_set_array(ptr, prop, values);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_float_set_array(ptr, prop, values);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
int RNA_enum_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_enum_get(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return 0;
- }
+ if (prop) {
+ return RNA_property_enum_get(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return 0;
+ }
}
void RNA_enum_set(PointerRNA *ptr, const char *name, int value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_enum_set(ptr, prop, value);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_enum_set(ptr, prop, value);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_enum_set_identifier(bContext *C, PointerRNA *ptr, const char *name, const char *id)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- int value;
- if (RNA_property_enum_value(C, ptr, prop, id, &value))
- RNA_property_enum_set(ptr, prop, value);
- else
- printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- }
+ if (prop) {
+ int value;
+ if (RNA_property_enum_value(C, ptr, prop, id, &value))
+ RNA_property_enum_set(ptr, prop, value);
+ else
+ printf("%s: %s.%s has no enum id '%s'.\n", __func__, ptr->type->identifier, name, id);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ }
}
bool RNA_enum_is_equal(bContext *C, PointerRNA *ptr, const char *name, const char *enumname)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- const EnumPropertyItem *item;
- bool free;
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ const EnumPropertyItem *item;
+ bool free;
- if (prop) {
- int i;
- bool cmp = false;
+ if (prop) {
+ int i;
+ bool cmp = false;
- RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
- i = RNA_enum_from_identifier(item, enumname);
- if (i != -1) {
- cmp = (item[i].value == RNA_property_enum_get(ptr, prop));
- }
+ RNA_property_enum_items(C, ptr, prop, &item, NULL, &free);
+ i = RNA_enum_from_identifier(item, enumname);
+ if (i != -1) {
+ cmp = (item[i].value == RNA_property_enum_get(ptr, prop));
+ }
- if (free) {
- MEM_freeN((void *)item);
- }
+ if (free) {
+ MEM_freeN((void *)item);
+ }
- if (i != -1) {
- return cmp;
- }
+ if (i != -1) {
+ return cmp;
+ }
- printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname);
- return false;
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return false;
- }
+ printf("%s: %s.%s item %s not found.\n", __func__, ptr->type->identifier, name, enumname);
+ return false;
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return false;
+ }
}
bool RNA_enum_value_from_id(const EnumPropertyItem *item, const char *identifier, int *r_value)
{
- const int i = RNA_enum_from_identifier(item, identifier);
- if (i != -1) {
- *r_value = item[i].value;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_identifier(item, identifier);
+ if (i != -1) {
+ *r_value = item[i].value;
+ return true;
+ }
+ else {
+ return false;
+ }
}
bool RNA_enum_id_from_value(const EnumPropertyItem *item, int value, const char **r_identifier)
{
- const int i = RNA_enum_from_value(item, value);
- if (i != -1) {
- *r_identifier = item[i].identifier;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_value(item, value);
+ if (i != -1) {
+ *r_identifier = item[i].identifier;
+ return true;
+ }
+ else {
+ return false;
+ }
}
bool RNA_enum_icon_from_value(const EnumPropertyItem *item, int value, int *r_icon)
{
- const int i = RNA_enum_from_value(item, value);
- if (i != -1) {
- *r_icon = item[i].icon;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_value(item, value);
+ if (i != -1) {
+ *r_icon = item[i].icon;
+ return true;
+ }
+ else {
+ return false;
+ }
}
bool RNA_enum_name_from_value(const EnumPropertyItem *item, int value, const char **r_name)
{
- const int i = RNA_enum_from_value(item, value);
- if (i != -1) {
- *r_name = item[i].name;
- return true;
- }
- else {
- return false;
- }
+ const int i = RNA_enum_from_value(item, value);
+ if (i != -1) {
+ *r_name = item[i].name;
+ return true;
+ }
+ else {
+ return false;
+ }
}
void RNA_string_get(PointerRNA *ptr, const char *name, char *value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- RNA_property_string_get(ptr, prop, value);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- value[0] = '\0';
- }
+ if (prop) {
+ RNA_property_string_get(ptr, prop, value);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ value[0] = '\0';
+ }
}
char *RNA_string_get_alloc(PointerRNA *ptr, const char *name, char *fixedbuf, int fixedlen)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_string_get_alloc(ptr, prop, fixedbuf, fixedlen, NULL); /* TODO, pass length */
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return NULL;
- }
+ if (prop) {
+ return RNA_property_string_get_alloc(
+ ptr, prop, fixedbuf, fixedlen, NULL); /* TODO, pass length */
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return NULL;
+ }
}
int RNA_string_length(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_string_length(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return 0;
- }
+ if (prop) {
+ return RNA_property_string_length(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return 0;
+ }
}
void RNA_string_set(PointerRNA *ptr, const char *name, const char *value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_string_set(ptr, prop, value);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_string_set(ptr, prop, value);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
PointerRNA RNA_pointer_get(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_pointer_get(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop) {
+ return RNA_property_pointer_get(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return PointerRNA_NULL;
- }
+ return PointerRNA_NULL;
+ }
}
void RNA_pointer_set(PointerRNA *ptr, const char *name, PointerRNA ptr_value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- RNA_property_pointer_set(ptr, prop, ptr_value);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- }
+ if (prop) {
+ RNA_property_pointer_set(ptr, prop, ptr_value);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ }
}
void RNA_pointer_add(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_pointer_add(ptr, prop);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_pointer_add(ptr, prop);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_collection_begin(PointerRNA *ptr, const char *name, CollectionPropertyIterator *iter)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_collection_begin(ptr, prop, iter);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_collection_begin(ptr, prop, iter);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_collection_add(PointerRNA *ptr, const char *name, PointerRNA *r_value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_collection_add(ptr, prop, r_value);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_collection_add(ptr, prop, r_value);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
void RNA_collection_clear(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop)
- RNA_property_collection_clear(ptr, prop);
- else
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ if (prop)
+ RNA_property_collection_clear(ptr, prop);
+ else
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
}
int RNA_collection_length(PointerRNA *ptr, const char *name)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, name);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, name);
- if (prop) {
- return RNA_property_collection_length(ptr, prop);
- }
- else {
- printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
- return 0;
- }
+ if (prop) {
+ return RNA_property_collection_length(ptr, prop);
+ }
+ else {
+ printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name);
+ return 0;
+ }
}
bool RNA_property_is_set_ex(PointerRNA *ptr, PropertyRNA *prop, bool use_ghost)
{
- prop = rna_ensure_property(prop);
- if (prop->flag & PROP_IDPROPERTY) {
- IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
- return ((idprop != NULL) && (use_ghost == false || !(idprop->flag & IDP_FLAG_GHOST)));
- }
- else {
- return true;
- }
+ prop = rna_ensure_property(prop);
+ if (prop->flag & PROP_IDPROPERTY) {
+ IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
+ return ((idprop != NULL) && (use_ghost == false || !(idprop->flag & IDP_FLAG_GHOST)));
+ }
+ else {
+ return true;
+ }
}
bool RNA_property_is_set(PointerRNA *ptr, PropertyRNA *prop)
{
- prop = rna_ensure_property(prop);
- if (prop->flag & PROP_IDPROPERTY) {
- IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
- return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST));
- }
- else {
- return true;
- }
+ prop = rna_ensure_property(prop);
+ if (prop->flag & PROP_IDPROPERTY) {
+ IDProperty *idprop = rna_idproperty_find(ptr, prop->identifier);
+ return ((idprop != NULL) && !(idprop->flag & IDP_FLAG_GHOST));
+ }
+ else {
+ return true;
+ }
}
void RNA_property_unset(PointerRNA *ptr, PropertyRNA *prop)
{
- prop = rna_ensure_property(prop);
- if (prop->flag & PROP_IDPROPERTY) {
- rna_idproperty_free(ptr, prop->identifier);
- }
+ prop = rna_ensure_property(prop);
+ if (prop->flag & PROP_IDPROPERTY) {
+ rna_idproperty_free(ptr, prop->identifier);
+ }
}
bool RNA_struct_property_is_set_ex(PointerRNA *ptr, const char *identifier, bool use_ghost)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
- if (prop) {
- return RNA_property_is_set_ex(ptr, prop, use_ghost);
- }
- else {
- /* python raises an error */
- /* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */
- return 0;
- }
+ if (prop) {
+ return RNA_property_is_set_ex(ptr, prop, use_ghost);
+ }
+ else {
+ /* python raises an error */
+ /* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */
+ return 0;
+ }
}
bool RNA_struct_property_is_set(PointerRNA *ptr, const char *identifier)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
- if (prop) {
- return RNA_property_is_set(ptr, prop);
- }
- else {
- /* python raises an error */
- /* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */
- return 0;
- }
+ if (prop) {
+ return RNA_property_is_set(ptr, prop);
+ }
+ else {
+ /* python raises an error */
+ /* printf("%s: %s.%s not found.\n", __func__, ptr->type->identifier, name); */
+ return 0;
+ }
}
void RNA_struct_property_unset(PointerRNA *ptr, const char *identifier)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, identifier);
- if (prop) {
- RNA_property_unset(ptr, prop);
- }
+ if (prop) {
+ RNA_property_unset(ptr, prop);
+ }
}
bool RNA_property_is_idprop(const PropertyRNA *prop)
{
- return (prop->magic != RNA_MAGIC);
+ return (prop->magic != RNA_MAGIC);
}
/* mainly for the UI */
bool RNA_property_is_unlink(PropertyRNA *prop)
{
- const int flag = RNA_property_flag(prop);
- if (RNA_property_type(prop) == PROP_STRING) {
- return (flag & PROP_NEVER_UNLINK) == 0;
- }
- else {
- return (flag & (PROP_NEVER_UNLINK | PROP_NEVER_NULL)) == 0;
- }
+ const int flag = RNA_property_flag(prop);
+ if (RNA_property_type(prop) == PROP_STRING) {
+ return (flag & PROP_NEVER_UNLINK) == 0;
+ }
+ else {
+ return (flag & (PROP_NEVER_UNLINK | PROP_NEVER_NULL)) == 0;
+ }
}
/* string representation of a property, python
@@ -6142,1443 +6308,1505 @@ bool RNA_property_is_unlink(PropertyRNA *prop)
* context may be NULL */
char *RNA_pointer_as_string_id(bContext *C, PointerRNA *ptr)
{
- DynStr *dynstr = BLI_dynstr_new();
- char *cstring;
-
- const char *propname;
- int first_time = 1;
+ DynStr *dynstr = BLI_dynstr_new();
+ char *cstring;
- BLI_dynstr_append(dynstr, "{");
+ const char *propname;
+ int first_time = 1;
- RNA_STRUCT_BEGIN (ptr, prop)
- {
- propname = RNA_property_identifier(prop);
+ BLI_dynstr_append(dynstr, "{");
- if (STREQ(propname, "rna_type"))
- continue;
+ RNA_STRUCT_BEGIN (ptr, prop) {
+ propname = RNA_property_identifier(prop);
- if (first_time == 0)
- BLI_dynstr_append(dynstr, ", ");
- first_time = 0;
+ if (STREQ(propname, "rna_type"))
+ continue;
- cstring = RNA_property_as_string(C, ptr, prop, -1, INT_MAX);
- BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring);
- MEM_freeN(cstring);
- }
- RNA_STRUCT_END;
+ if (first_time == 0)
+ BLI_dynstr_append(dynstr, ", ");
+ first_time = 0;
- BLI_dynstr_append(dynstr, "}");
+ cstring = RNA_property_as_string(C, ptr, prop, -1, INT_MAX);
+ BLI_dynstr_appendf(dynstr, "\"%s\":%s", propname, cstring);
+ MEM_freeN(cstring);
+ }
+ RNA_STRUCT_END;
+ BLI_dynstr_append(dynstr, "}");
- cstring = BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
- return cstring;
+ cstring = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ return cstring;
}
static char *rna_pointer_as_string__bldata(PointerRNA *ptr)
{
- if (ptr->type == NULL || ptr->id.data == NULL) {
- return BLI_strdup("None");
- }
- else if (RNA_struct_is_ID(ptr->type)) {
- return RNA_path_full_ID_py(ptr->id.data);
- }
- else {
- return RNA_path_full_struct_py(ptr);
- }
-}
-
-char *RNA_pointer_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop_ptr, PointerRNA *ptr_prop)
-{
- IDProperty *prop;
- if (ptr_prop->data == NULL) {
- return BLI_strdup("None");
- }
- else if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) {
- return RNA_pointer_as_string_id(C, ptr_prop);
- }
- else {
- return rna_pointer_as_string__bldata(ptr_prop);
- }
+ if (ptr->type == NULL || ptr->id.data == NULL) {
+ return BLI_strdup("None");
+ }
+ else if (RNA_struct_is_ID(ptr->type)) {
+ return RNA_path_full_ID_py(ptr->id.data);
+ }
+ else {
+ return RNA_path_full_struct_py(ptr);
+ }
+}
+
+char *RNA_pointer_as_string(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop_ptr,
+ PointerRNA *ptr_prop)
+{
+ IDProperty *prop;
+ if (ptr_prop->data == NULL) {
+ return BLI_strdup("None");
+ }
+ else if ((prop = rna_idproperty_check(&prop_ptr, ptr)) && prop->type != IDP_ID) {
+ return RNA_pointer_as_string_id(C, ptr_prop);
+ }
+ else {
+ return rna_pointer_as_string__bldata(ptr_prop);
+ }
}
/* context can be NULL */
-char *RNA_pointer_as_string_keywords_ex(bContext *C, PointerRNA *ptr,
- const bool as_function, const bool all_args, const bool nested_args,
+char *RNA_pointer_as_string_keywords_ex(bContext *C,
+ PointerRNA *ptr,
+ const bool as_function,
+ const bool all_args,
+ const bool nested_args,
const int max_prop_length,
PropertyRNA *iterprop)
{
- const char *arg_name = NULL;
-
- PropertyRNA *prop;
-
- DynStr *dynstr = BLI_dynstr_new();
- char *cstring, *buf;
- bool first_iter = true;
- int flag, flag_parameter;
-
- RNA_PROP_BEGIN (ptr, propptr, iterprop)
- {
- prop = propptr.data;
-
- flag = RNA_property_flag(prop);
- flag_parameter = RNA_parameter_flag(prop);
-
- if (as_function && (flag_parameter & PARM_OUTPUT)) {
- continue;
- }
-
- arg_name = RNA_property_identifier(prop);
-
- if (STREQ(arg_name, "rna_type")) {
- continue;
- }
-
- if ((nested_args == false) && (RNA_property_type(prop) == PROP_POINTER)) {
- continue;
- }
-
- if (as_function && (prop->flag_parameter & PARM_REQUIRED)) {
- /* required args don't have useful defaults */
- BLI_dynstr_appendf(dynstr, first_iter ? "%s" : ", %s", arg_name);
- first_iter = false;
- }
- else {
- bool ok = true;
-
- if (all_args == true) {
- /* pass */
- }
- else if (RNA_struct_idprops_check(ptr->type)) {
- ok = RNA_property_is_set(ptr, prop);
- }
-
- if (ok) {
- if (as_function && RNA_property_type(prop) == PROP_POINTER) {
- /* don't expand pointers for functions */
- if (flag & PROP_NEVER_NULL) {
- /* we cant really do the right thing here. arg=arg?, hrmf! */
- buf = BLI_strdup(arg_name);
- }
- else {
- buf = BLI_strdup("None");
- }
- }
- else {
- buf = RNA_property_as_string(C, ptr, prop, -1, max_prop_length);
- }
-
- BLI_dynstr_appendf(dynstr, first_iter ? "%s=%s" : ", %s=%s", arg_name, buf);
- first_iter = false;
- MEM_freeN(buf);
- }
- }
- }
- RNA_PROP_END;
-
- cstring = BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
- return cstring;
-}
-
-char *RNA_pointer_as_string_keywords(bContext *C, PointerRNA *ptr,
- const bool as_function, const bool all_args, const bool nested_args,
+ const char *arg_name = NULL;
+
+ PropertyRNA *prop;
+
+ DynStr *dynstr = BLI_dynstr_new();
+ char *cstring, *buf;
+ bool first_iter = true;
+ int flag, flag_parameter;
+
+ RNA_PROP_BEGIN (ptr, propptr, iterprop) {
+ prop = propptr.data;
+
+ flag = RNA_property_flag(prop);
+ flag_parameter = RNA_parameter_flag(prop);
+
+ if (as_function && (flag_parameter & PARM_OUTPUT)) {
+ continue;
+ }
+
+ arg_name = RNA_property_identifier(prop);
+
+ if (STREQ(arg_name, "rna_type")) {
+ continue;
+ }
+
+ if ((nested_args == false) && (RNA_property_type(prop) == PROP_POINTER)) {
+ continue;
+ }
+
+ if (as_function && (prop->flag_parameter & PARM_REQUIRED)) {
+ /* required args don't have useful defaults */
+ BLI_dynstr_appendf(dynstr, first_iter ? "%s" : ", %s", arg_name);
+ first_iter = false;
+ }
+ else {
+ bool ok = true;
+
+ if (all_args == true) {
+ /* pass */
+ }
+ else if (RNA_struct_idprops_check(ptr->type)) {
+ ok = RNA_property_is_set(ptr, prop);
+ }
+
+ if (ok) {
+ if (as_function && RNA_property_type(prop) == PROP_POINTER) {
+ /* don't expand pointers for functions */
+ if (flag & PROP_NEVER_NULL) {
+ /* we cant really do the right thing here. arg=arg?, hrmf! */
+ buf = BLI_strdup(arg_name);
+ }
+ else {
+ buf = BLI_strdup("None");
+ }
+ }
+ else {
+ buf = RNA_property_as_string(C, ptr, prop, -1, max_prop_length);
+ }
+
+ BLI_dynstr_appendf(dynstr, first_iter ? "%s=%s" : ", %s=%s", arg_name, buf);
+ first_iter = false;
+ MEM_freeN(buf);
+ }
+ }
+ }
+ RNA_PROP_END;
+
+ cstring = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ return cstring;
+}
+
+char *RNA_pointer_as_string_keywords(bContext *C,
+ PointerRNA *ptr,
+ const bool as_function,
+ const bool all_args,
+ const bool nested_args,
const int max_prop_length)
{
- PropertyRNA *iterprop;
+ PropertyRNA *iterprop;
- iterprop = RNA_struct_iterator_property(ptr->type);
+ iterprop = RNA_struct_iterator_property(ptr->type);
- return RNA_pointer_as_string_keywords_ex(C, ptr, as_function, all_args, nested_args,
- max_prop_length, iterprop);
+ return RNA_pointer_as_string_keywords_ex(
+ C, ptr, as_function, all_args, nested_args, max_prop_length, iterprop);
}
-char *RNA_function_as_string_keywords(bContext *C, FunctionRNA *func,
- const bool as_function, const bool all_args,
+char *RNA_function_as_string_keywords(bContext *C,
+ FunctionRNA *func,
+ const bool as_function,
+ const bool all_args,
const int max_prop_length)
{
- PointerRNA funcptr;
- PropertyRNA *iterprop;
+ PointerRNA funcptr;
+ PropertyRNA *iterprop;
- RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
+ RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
- iterprop = RNA_struct_find_property(&funcptr, "parameters");
+ iterprop = RNA_struct_find_property(&funcptr, "parameters");
- RNA_struct_iterator_property(funcptr.type);
+ RNA_struct_iterator_property(funcptr.type);
- return RNA_pointer_as_string_keywords_ex(C, &funcptr, as_function, all_args, true,
- max_prop_length, iterprop);
+ return RNA_pointer_as_string_keywords_ex(
+ C, &funcptr, as_function, all_args, true, max_prop_length, iterprop);
}
static const char *bool_as_py_string(const int var)
{
- return var ? "True" : "False";
+ return var ? "True" : "False";
}
static void *rna_array_as_string_alloc(
- int type, int len, PointerRNA *ptr, PropertyRNA *prop, void **r_buf_end)
-{
- void *buf_ret = NULL;
- if (type == PROP_BOOLEAN) {
- bool *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
- RNA_property_boolean_get_array(ptr, prop, buf);
- *r_buf_end = buf + len;
- }
- else if (type == PROP_INT) {
- int *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
- RNA_property_int_get_array(ptr, prop, buf);
- *r_buf_end = buf + len;
- }
- else if (type == PROP_FLOAT) {
- float *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
- RNA_property_float_get_array(ptr, prop, buf);
- *r_buf_end = buf + len;
- }
- else {
- BLI_assert(0);
- }
- return buf_ret;
-}
-
-static void rna_array_as_string_elem(
- int type, void **buf_p, int len, DynStr *dynstr)
-{
- /* This will print a comma seperated string of the array elements from
- * buf start to len. We will add a comma if len == 1 to preserve tuples. */
- const int end = len - 1;
- if (type == PROP_BOOLEAN) {
- bool *buf = *buf_p;
- for (int i = 0; i < len; i++, buf++) {
- BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%s, " : "%s", bool_as_py_string(*buf));
- }
- *buf_p = buf;
- }
- else if (type == PROP_INT) {
- int *buf = *buf_p;
- for (int i = 0; i < len; i++, buf++) {
- BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%d, " : "%d", *buf);
- }
- *buf_p = buf;
- }
- else if (type == PROP_FLOAT) {
- float *buf = *buf_p;
- for (int i = 0; i < len; i++, buf++) {
- BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%g, " : "%g", *buf);
- }
- *buf_p = buf;
- }
- else {
- BLI_assert(0);
- }
+ int type, int len, PointerRNA *ptr, PropertyRNA *prop, void **r_buf_end)
+{
+ void *buf_ret = NULL;
+ if (type == PROP_BOOLEAN) {
+ bool *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
+ RNA_property_boolean_get_array(ptr, prop, buf);
+ *r_buf_end = buf + len;
+ }
+ else if (type == PROP_INT) {
+ int *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
+ RNA_property_int_get_array(ptr, prop, buf);
+ *r_buf_end = buf + len;
+ }
+ else if (type == PROP_FLOAT) {
+ float *buf = buf_ret = MEM_mallocN(sizeof(*buf) * len, __func__);
+ RNA_property_float_get_array(ptr, prop, buf);
+ *r_buf_end = buf + len;
+ }
+ else {
+ BLI_assert(0);
+ }
+ return buf_ret;
+}
+
+static void rna_array_as_string_elem(int type, void **buf_p, int len, DynStr *dynstr)
+{
+ /* This will print a comma seperated string of the array elements from
+ * buf start to len. We will add a comma if len == 1 to preserve tuples. */
+ const int end = len - 1;
+ if (type == PROP_BOOLEAN) {
+ bool *buf = *buf_p;
+ for (int i = 0; i < len; i++, buf++) {
+ BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%s, " : "%s", bool_as_py_string(*buf));
+ }
+ *buf_p = buf;
+ }
+ else if (type == PROP_INT) {
+ int *buf = *buf_p;
+ for (int i = 0; i < len; i++, buf++) {
+ BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%d, " : "%d", *buf);
+ }
+ *buf_p = buf;
+ }
+ else if (type == PROP_FLOAT) {
+ float *buf = *buf_p;
+ for (int i = 0; i < len; i++, buf++) {
+ BLI_dynstr_appendf(dynstr, (i < end || !end) ? "%g, " : "%g", *buf);
+ }
+ *buf_p = buf;
+ }
+ else {
+ BLI_assert(0);
+ }
}
static void rna_array_as_string_recursive(
- int type, void **buf_p, int totdim, const int *dim_size, DynStr *dynstr)
-{
- BLI_dynstr_append(dynstr, "(");
- if (totdim > 1) {
- totdim--;
- const int end = dim_size[totdim] - 1;
- for (int i = 0; i <= end; i++) {
- rna_array_as_string_recursive(type, buf_p, totdim, dim_size, dynstr);
- if (i < end || !end) {
- BLI_dynstr_append(dynstr, ", ");
- }
- }
- }
- else {
- rna_array_as_string_elem(type, buf_p, dim_size[0], dynstr);
- }
- BLI_dynstr_append(dynstr, ")");
-}
-
-static void rna_array_as_string(int type, int len, PointerRNA *ptr, PropertyRNA *prop, DynStr *dynstr)
-{
- void *buf_end;
- void *buf = rna_array_as_string_alloc(type, len, ptr, prop, &buf_end);
- void *buf_step = buf;
- int totdim, dim_size[RNA_MAX_ARRAY_DIMENSION];
-
- totdim = RNA_property_array_dimension(ptr, prop, dim_size);
-
- rna_array_as_string_recursive(type, &buf_step, totdim, dim_size, dynstr);
- BLI_assert(buf_step == buf_end);
- MEM_freeN(buf);
-}
-
-char *RNA_property_as_string(bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index, int max_prop_length)
-{
- int type = RNA_property_type(prop);
- int len = RNA_property_array_length(ptr, prop);
-
- DynStr *dynstr = BLI_dynstr_new();
- char *cstring;
-
- /* see if we can coerce into a python type - PropertyType */
- switch (type) {
- case PROP_BOOLEAN:
- if (len == 0) {
- BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get(ptr, prop)));
- }
- else {
- if (index != -1) {
- BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index)));
- }
- else {
- rna_array_as_string(type, len, ptr, prop, dynstr);
- }
- }
- break;
- case PROP_INT:
- if (len == 0) {
- BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get(ptr, prop));
- }
- else {
- if (index != -1) {
- BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get_index(ptr, prop, index));
- }
- else {
- rna_array_as_string(type, len, ptr, prop, dynstr);
- }
- }
- break;
- case PROP_FLOAT:
- if (len == 0) {
- BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
- }
- else {
- if (index != -1) {
- BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get_index(ptr, prop, index));
- }
- else {
- rna_array_as_string(type, len, ptr, prop, dynstr);
- }
- }
- break;
- case PROP_STRING:
- {
- char *buf_esc;
- char *buf;
- int length;
-
- length = RNA_property_string_length(ptr, prop);
- buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_property_as_string");
- buf_esc = MEM_mallocN(sizeof(char) * (length * 2 + 1), "RNA_property_as_string esc");
- RNA_property_string_get(ptr, prop, buf);
- BLI_strescape(buf_esc, buf, length * 2 + 1);
- MEM_freeN(buf);
- BLI_dynstr_appendf(dynstr, "\"%s\"", buf_esc);
- MEM_freeN(buf_esc);
- break;
- }
- case PROP_ENUM:
- {
- /* string arrays don't exist */
- const char *identifier;
- int val = RNA_property_enum_get(ptr, prop);
-
- if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
- /* represent as a python set */
- if (val) {
- const EnumPropertyItem *item_array;
- bool free;
-
- BLI_dynstr_append(dynstr, "{");
-
- RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
- if (item_array) {
- const EnumPropertyItem *item = item_array;
- bool is_first = true;
- for (; item->identifier; item++) {
- if (item->identifier[0] && item->value & val) {
- BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
- is_first = false;
- }
- }
-
- if (free) {
- MEM_freeN((void *)item_array);
- }
- }
-
- BLI_dynstr_append(dynstr, "}");
- }
- else {
- /* annoying exception, don't confuse with dictionary syntax above: {} */
- BLI_dynstr_append(dynstr, "set()");
- }
- }
- else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
- BLI_dynstr_appendf(dynstr, "'%s'", identifier);
- }
- else {
- BLI_dynstr_append(dynstr, "'<UNKNOWN ENUM>'");
- }
- break;
- }
- case PROP_POINTER:
- {
- PointerRNA tptr = RNA_property_pointer_get(ptr, prop);
- cstring = RNA_pointer_as_string(C, ptr, prop, &tptr);
- BLI_dynstr_append(dynstr, cstring);
- MEM_freeN(cstring);
- break;
- }
- case PROP_COLLECTION:
- {
- int i = 0;
- CollectionPropertyIterator collect_iter;
- BLI_dynstr_append(dynstr, "[");
-
- for (RNA_property_collection_begin(ptr, prop, &collect_iter);
- (i < max_prop_length) && collect_iter.valid;
- RNA_property_collection_next(&collect_iter), i++)
- {
- PointerRNA itemptr = collect_iter.ptr;
-
- if (i != 0)
- BLI_dynstr_append(dynstr, ", ");
-
- /* now get every prop of the collection */
- cstring = RNA_pointer_as_string(C, ptr, prop, &itemptr);
- BLI_dynstr_append(dynstr, cstring);
- MEM_freeN(cstring);
- }
-
- RNA_property_collection_end(&collect_iter);
- BLI_dynstr_append(dynstr, "]");
- break;
- }
- default:
- BLI_dynstr_append(dynstr, "'<UNKNOWN TYPE>'"); /* TODO */
- break;
- }
-
- cstring = BLI_dynstr_get_cstring(dynstr);
- BLI_dynstr_free(dynstr);
- return cstring;
+ int type, void **buf_p, int totdim, const int *dim_size, DynStr *dynstr)
+{
+ BLI_dynstr_append(dynstr, "(");
+ if (totdim > 1) {
+ totdim--;
+ const int end = dim_size[totdim] - 1;
+ for (int i = 0; i <= end; i++) {
+ rna_array_as_string_recursive(type, buf_p, totdim, dim_size, dynstr);
+ if (i < end || !end) {
+ BLI_dynstr_append(dynstr, ", ");
+ }
+ }
+ }
+ else {
+ rna_array_as_string_elem(type, buf_p, dim_size[0], dynstr);
+ }
+ BLI_dynstr_append(dynstr, ")");
+}
+
+static void rna_array_as_string(
+ int type, int len, PointerRNA *ptr, PropertyRNA *prop, DynStr *dynstr)
+{
+ void *buf_end;
+ void *buf = rna_array_as_string_alloc(type, len, ptr, prop, &buf_end);
+ void *buf_step = buf;
+ int totdim, dim_size[RNA_MAX_ARRAY_DIMENSION];
+
+ totdim = RNA_property_array_dimension(ptr, prop, dim_size);
+
+ rna_array_as_string_recursive(type, &buf_step, totdim, dim_size, dynstr);
+ BLI_assert(buf_step == buf_end);
+ MEM_freeN(buf);
+}
+
+char *RNA_property_as_string(
+ bContext *C, PointerRNA *ptr, PropertyRNA *prop, int index, int max_prop_length)
+{
+ int type = RNA_property_type(prop);
+ int len = RNA_property_array_length(ptr, prop);
+
+ DynStr *dynstr = BLI_dynstr_new();
+ char *cstring;
+
+ /* see if we can coerce into a python type - PropertyType */
+ switch (type) {
+ case PROP_BOOLEAN:
+ if (len == 0) {
+ BLI_dynstr_append(dynstr, bool_as_py_string(RNA_property_boolean_get(ptr, prop)));
+ }
+ else {
+ if (index != -1) {
+ BLI_dynstr_append(dynstr,
+ bool_as_py_string(RNA_property_boolean_get_index(ptr, prop, index)));
+ }
+ else {
+ rna_array_as_string(type, len, ptr, prop, dynstr);
+ }
+ }
+ break;
+ case PROP_INT:
+ if (len == 0) {
+ BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get(ptr, prop));
+ }
+ else {
+ if (index != -1) {
+ BLI_dynstr_appendf(dynstr, "%d", RNA_property_int_get_index(ptr, prop, index));
+ }
+ else {
+ rna_array_as_string(type, len, ptr, prop, dynstr);
+ }
+ }
+ break;
+ case PROP_FLOAT:
+ if (len == 0) {
+ BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get(ptr, prop));
+ }
+ else {
+ if (index != -1) {
+ BLI_dynstr_appendf(dynstr, "%g", RNA_property_float_get_index(ptr, prop, index));
+ }
+ else {
+ rna_array_as_string(type, len, ptr, prop, dynstr);
+ }
+ }
+ break;
+ case PROP_STRING: {
+ char *buf_esc;
+ char *buf;
+ int length;
+
+ length = RNA_property_string_length(ptr, prop);
+ buf = MEM_mallocN(sizeof(char) * (length + 1), "RNA_property_as_string");
+ buf_esc = MEM_mallocN(sizeof(char) * (length * 2 + 1), "RNA_property_as_string esc");
+ RNA_property_string_get(ptr, prop, buf);
+ BLI_strescape(buf_esc, buf, length * 2 + 1);
+ MEM_freeN(buf);
+ BLI_dynstr_appendf(dynstr, "\"%s\"", buf_esc);
+ MEM_freeN(buf_esc);
+ break;
+ }
+ case PROP_ENUM: {
+ /* string arrays don't exist */
+ const char *identifier;
+ int val = RNA_property_enum_get(ptr, prop);
+
+ if (RNA_property_flag(prop) & PROP_ENUM_FLAG) {
+ /* represent as a python set */
+ if (val) {
+ const EnumPropertyItem *item_array;
+ bool free;
+
+ BLI_dynstr_append(dynstr, "{");
+
+ RNA_property_enum_items(C, ptr, prop, &item_array, NULL, &free);
+ if (item_array) {
+ const EnumPropertyItem *item = item_array;
+ bool is_first = true;
+ for (; item->identifier; item++) {
+ if (item->identifier[0] && item->value & val) {
+ BLI_dynstr_appendf(dynstr, is_first ? "'%s'" : ", '%s'", item->identifier);
+ is_first = false;
+ }
+ }
+
+ if (free) {
+ MEM_freeN((void *)item_array);
+ }
+ }
+
+ BLI_dynstr_append(dynstr, "}");
+ }
+ else {
+ /* annoying exception, don't confuse with dictionary syntax above: {} */
+ BLI_dynstr_append(dynstr, "set()");
+ }
+ }
+ else if (RNA_property_enum_identifier(C, ptr, prop, val, &identifier)) {
+ BLI_dynstr_appendf(dynstr, "'%s'", identifier);
+ }
+ else {
+ BLI_dynstr_append(dynstr, "'<UNKNOWN ENUM>'");
+ }
+ break;
+ }
+ case PROP_POINTER: {
+ PointerRNA tptr = RNA_property_pointer_get(ptr, prop);
+ cstring = RNA_pointer_as_string(C, ptr, prop, &tptr);
+ BLI_dynstr_append(dynstr, cstring);
+ MEM_freeN(cstring);
+ break;
+ }
+ case PROP_COLLECTION: {
+ int i = 0;
+ CollectionPropertyIterator collect_iter;
+ BLI_dynstr_append(dynstr, "[");
+
+ for (RNA_property_collection_begin(ptr, prop, &collect_iter);
+ (i < max_prop_length) && collect_iter.valid;
+ RNA_property_collection_next(&collect_iter), i++) {
+ PointerRNA itemptr = collect_iter.ptr;
+
+ if (i != 0)
+ BLI_dynstr_append(dynstr, ", ");
+
+ /* now get every prop of the collection */
+ cstring = RNA_pointer_as_string(C, ptr, prop, &itemptr);
+ BLI_dynstr_append(dynstr, cstring);
+ MEM_freeN(cstring);
+ }
+
+ RNA_property_collection_end(&collect_iter);
+ BLI_dynstr_append(dynstr, "]");
+ break;
+ }
+ default:
+ BLI_dynstr_append(dynstr, "'<UNKNOWN TYPE>'"); /* TODO */
+ break;
+ }
+
+ cstring = BLI_dynstr_get_cstring(dynstr);
+ BLI_dynstr_free(dynstr);
+ return cstring;
}
/* Function */
const char *RNA_function_identifier(FunctionRNA *func)
{
- return func->identifier;
+ return func->identifier;
}
const char *RNA_function_ui_description(FunctionRNA *func)
{
- return TIP_(func->description);
+ return TIP_(func->description);
}
const char *RNA_function_ui_description_raw(FunctionRNA *func)
{
- return func->description;
+ return func->description;
}
int RNA_function_flag(FunctionRNA *func)
{
- return func->flag;
+ return func->flag;
}
int RNA_function_defined(FunctionRNA *func)
{
- return func->call != NULL;
+ return func->call != NULL;
}
PropertyRNA *RNA_function_get_parameter(PointerRNA *UNUSED(ptr), FunctionRNA *func, int index)
{
- return BLI_findlink(&func->cont.properties, index);
+ return BLI_findlink(&func->cont.properties, index);
}
-PropertyRNA *RNA_function_find_parameter(PointerRNA *UNUSED(ptr), FunctionRNA *func, const char *identifier)
+PropertyRNA *RNA_function_find_parameter(PointerRNA *UNUSED(ptr),
+ FunctionRNA *func,
+ const char *identifier)
{
- PropertyRNA *parm;
+ PropertyRNA *parm;
- parm = func->cont.properties.first;
- for (; parm; parm = parm->next)
- if (STREQ(RNA_property_identifier(parm), identifier))
- break;
+ parm = func->cont.properties.first;
+ for (; parm; parm = parm->next)
+ if (STREQ(RNA_property_identifier(parm), identifier))
+ break;
- return parm;
+ return parm;
}
const ListBase *RNA_function_defined_parameters(FunctionRNA *func)
{
- return &func->cont.properties;
+ return &func->cont.properties;
}
/* Utility */
int RNA_parameter_flag(PropertyRNA *prop)
{
- return (int)rna_ensure_property(prop)->flag_parameter;
-}
-
-ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *UNUSED(ptr), FunctionRNA *func)
-{
- PropertyRNA *parm;
- void *data;
- int alloc_size = 0, size;
-
- parms->arg_count = 0;
- parms->ret_count = 0;
-
- /* allocate data */
- for (parm = func->cont.properties.first; parm; parm = parm->next) {
- alloc_size += rna_parameter_size(parm);
-
- if (parm->flag_parameter & PARM_OUTPUT)
- parms->ret_count++;
- else
- parms->arg_count++;
- }
-
- parms->data = MEM_callocN(alloc_size, "RNA_parameter_list_create");
- parms->func = func;
- parms->alloc_size = alloc_size;
-
- /* set default values */
- data = parms->data;
-
- for (parm = func->cont.properties.first; parm; parm = parm->next) {
- size = rna_parameter_size(parm);
-
- /* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
- if (parm->flag & PROP_DYNAMIC) {
- ParameterDynAlloc *data_alloc = data;
- data_alloc->array_tot = 0;
- data_alloc->array = NULL;
- }
-
- if (!(parm->flag_parameter & PARM_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
- switch (parm->type) {
- case PROP_BOOLEAN:
- if (parm->arraydimension) rna_property_boolean_get_default_array_values((BoolPropertyRNA *)parm, data);
- else memcpy(data, &((BoolPropertyRNA *)parm)->defaultvalue, size);
- break;
- case PROP_INT:
- if (parm->arraydimension) rna_property_int_get_default_array_values((IntPropertyRNA *)parm, data);
- else memcpy(data, &((IntPropertyRNA *)parm)->defaultvalue, size);
- break;
- case PROP_FLOAT:
- if (parm->arraydimension) rna_property_float_get_default_array_values((FloatPropertyRNA *)parm, data);
- else memcpy(data, &((FloatPropertyRNA *)parm)->defaultvalue, size);
- break;
- case PROP_ENUM:
- memcpy(data, &((EnumPropertyRNA *)parm)->defaultvalue, size);
- break;
- case PROP_STRING:
- {
- const char *defvalue = ((StringPropertyRNA *)parm)->defaultvalue;
- if (defvalue && defvalue[0]) {
- /* causes bug [#29988], possibly this is only correct for thick wrapped
- * need to look further into it - campbell */
+ return (int)rna_ensure_property(prop)->flag_parameter;
+}
+
+ParameterList *RNA_parameter_list_create(ParameterList *parms,
+ PointerRNA *UNUSED(ptr),
+ FunctionRNA *func)
+{
+ PropertyRNA *parm;
+ void *data;
+ int alloc_size = 0, size;
+
+ parms->arg_count = 0;
+ parms->ret_count = 0;
+
+ /* allocate data */
+ for (parm = func->cont.properties.first; parm; parm = parm->next) {
+ alloc_size += rna_parameter_size(parm);
+
+ if (parm->flag_parameter & PARM_OUTPUT)
+ parms->ret_count++;
+ else
+ parms->arg_count++;
+ }
+
+ parms->data = MEM_callocN(alloc_size, "RNA_parameter_list_create");
+ parms->func = func;
+ parms->alloc_size = alloc_size;
+
+ /* set default values */
+ data = parms->data;
+
+ for (parm = func->cont.properties.first; parm; parm = parm->next) {
+ size = rna_parameter_size(parm);
+
+ /* set length to 0, these need to be set later, see bpy_array.c's py_to_array */
+ if (parm->flag & PROP_DYNAMIC) {
+ ParameterDynAlloc *data_alloc = data;
+ data_alloc->array_tot = 0;
+ data_alloc->array = NULL;
+ }
+
+ if (!(parm->flag_parameter & PARM_REQUIRED) && !(parm->flag & PROP_DYNAMIC)) {
+ switch (parm->type) {
+ case PROP_BOOLEAN:
+ if (parm->arraydimension)
+ rna_property_boolean_get_default_array_values((BoolPropertyRNA *)parm, data);
+ else
+ memcpy(data, &((BoolPropertyRNA *)parm)->defaultvalue, size);
+ break;
+ case PROP_INT:
+ if (parm->arraydimension)
+ rna_property_int_get_default_array_values((IntPropertyRNA *)parm, data);
+ else
+ memcpy(data, &((IntPropertyRNA *)parm)->defaultvalue, size);
+ break;
+ case PROP_FLOAT:
+ if (parm->arraydimension)
+ rna_property_float_get_default_array_values((FloatPropertyRNA *)parm, data);
+ else
+ memcpy(data, &((FloatPropertyRNA *)parm)->defaultvalue, size);
+ break;
+ case PROP_ENUM:
+ memcpy(data, &((EnumPropertyRNA *)parm)->defaultvalue, size);
+ break;
+ case PROP_STRING: {
+ const char *defvalue = ((StringPropertyRNA *)parm)->defaultvalue;
+ if (defvalue && defvalue[0]) {
+ /* causes bug [#29988], possibly this is only correct for thick wrapped
+ * need to look further into it - campbell */
#if 0
- BLI_strncpy(data, defvalue, size);
+ BLI_strncpy(data, defvalue, size);
#else
- memcpy(data, &defvalue, size);
+ memcpy(data, &defvalue, size);
#endif
- }
- break;
- }
- case PROP_POINTER:
- case PROP_COLLECTION:
- break;
- }
- }
+ }
+ break;
+ }
+ case PROP_POINTER:
+ case PROP_COLLECTION:
+ break;
+ }
+ }
- data = ((char *)data) + rna_parameter_size(parm);
- }
+ data = ((char *)data) + rna_parameter_size(parm);
+ }
- return parms;
+ return parms;
}
void RNA_parameter_list_free(ParameterList *parms)
{
- PropertyRNA *parm;
- int tot;
+ PropertyRNA *parm;
+ int tot;
- parm = parms->func->cont.properties.first;
- for (tot = 0; parm; parm = parm->next) {
- if (parm->type == PROP_COLLECTION)
- BLI_freelistN((ListBase *)((char *)parms->data + tot));
- else if (parm->flag & PROP_DYNAMIC) {
- /* for dynamic arrays and strings, data is a pointer to an array */
- ParameterDynAlloc *data_alloc = (void *)(((char *)parms->data) + tot);
- if (data_alloc->array)
- MEM_freeN(data_alloc->array);
- }
+ parm = parms->func->cont.properties.first;
+ for (tot = 0; parm; parm = parm->next) {
+ if (parm->type == PROP_COLLECTION)
+ BLI_freelistN((ListBase *)((char *)parms->data + tot));
+ else if (parm->flag & PROP_DYNAMIC) {
+ /* for dynamic arrays and strings, data is a pointer to an array */
+ ParameterDynAlloc *data_alloc = (void *)(((char *)parms->data) + tot);
+ if (data_alloc->array)
+ MEM_freeN(data_alloc->array);
+ }
- tot += rna_parameter_size(parm);
- }
+ tot += rna_parameter_size(parm);
+ }
- MEM_freeN(parms->data);
- parms->data = NULL;
+ MEM_freeN(parms->data);
+ parms->data = NULL;
- parms->func = NULL;
+ parms->func = NULL;
}
-int RNA_parameter_list_size(ParameterList *parms)
+int RNA_parameter_list_size(ParameterList *parms)
{
- return parms->alloc_size;
+ return parms->alloc_size;
}
-int RNA_parameter_list_arg_count(ParameterList *parms)
+int RNA_parameter_list_arg_count(ParameterList *parms)
{
- return parms->arg_count;
+ return parms->arg_count;
}
-int RNA_parameter_list_ret_count(ParameterList *parms)
+int RNA_parameter_list_ret_count(ParameterList *parms)
{
- return parms->ret_count;
+ return parms->ret_count;
}
void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter)
{
- /* may be useful but unused now */
- /* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/
+ /* may be useful but unused now */
+ /* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/
- iter->parms = parms;
- iter->parm = parms->func->cont.properties.first;
- iter->valid = iter->parm != NULL;
- iter->offset = 0;
+ iter->parms = parms;
+ iter->parm = parms->func->cont.properties.first;
+ iter->valid = iter->parm != NULL;
+ iter->offset = 0;
- if (iter->valid) {
- iter->size = rna_parameter_size(iter->parm);
- iter->data = (((char *)iter->parms->data)); /* +iter->offset, always 0 */
- }
+ if (iter->valid) {
+ iter->size = rna_parameter_size(iter->parm);
+ iter->data = (((char *)iter->parms->data)); /* +iter->offset, always 0 */
+ }
}
void RNA_parameter_list_next(ParameterIterator *iter)
{
- iter->offset += iter->size;
- iter->parm = iter->parm->next;
- iter->valid = iter->parm != NULL;
+ iter->offset += iter->size;
+ iter->parm = iter->parm->next;
+ iter->valid = iter->parm != NULL;
- if (iter->valid) {
- iter->size = rna_parameter_size(iter->parm);
- iter->data = (((char *)iter->parms->data) + iter->offset);
- }
+ if (iter->valid) {
+ iter->size = rna_parameter_size(iter->parm);
+ iter->data = (((char *)iter->parms->data) + iter->offset);
+ }
}
void RNA_parameter_list_end(ParameterIterator *UNUSED(iter))
{
- /* nothing to do */
+ /* nothing to do */
}
void RNA_parameter_get(ParameterList *parms, PropertyRNA *parm, void **value)
{
- ParameterIterator iter;
+ ParameterIterator iter;
- RNA_parameter_list_begin(parms, &iter);
+ RNA_parameter_list_begin(parms, &iter);
- for (; iter.valid; RNA_parameter_list_next(&iter))
- if (iter.parm == parm)
- break;
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
+ break;
- if (iter.valid) {
- if (parm->flag & PROP_DYNAMIC) {
- /* for dynamic arrays and strings, data is a pointer to an array */
- ParameterDynAlloc *data_alloc = iter.data;
- *value = data_alloc->array;
- }
- else {
- *value = iter.data;
- }
- }
- else {
- *value = NULL;
- }
+ if (iter.valid) {
+ if (parm->flag & PROP_DYNAMIC) {
+ /* for dynamic arrays and strings, data is a pointer to an array */
+ ParameterDynAlloc *data_alloc = iter.data;
+ *value = data_alloc->array;
+ }
+ else {
+ *value = iter.data;
+ }
+ }
+ else {
+ *value = NULL;
+ }
- RNA_parameter_list_end(&iter);
+ RNA_parameter_list_end(&iter);
}
void RNA_parameter_get_lookup(ParameterList *parms, const char *identifier, void **value)
{
- PropertyRNA *parm;
+ PropertyRNA *parm;
- parm = parms->func->cont.properties.first;
- for (; parm; parm = parm->next)
- if (STREQ(RNA_property_identifier(parm), identifier))
- break;
+ parm = parms->func->cont.properties.first;
+ for (; parm; parm = parm->next)
+ if (STREQ(RNA_property_identifier(parm), identifier))
+ break;
- if (parm)
- RNA_parameter_get(parms, parm, value);
+ if (parm)
+ RNA_parameter_get(parms, parm, value);
}
void RNA_parameter_set(ParameterList *parms, PropertyRNA *parm, const void *value)
{
- ParameterIterator iter;
-
- RNA_parameter_list_begin(parms, &iter);
-
- for (; iter.valid; RNA_parameter_list_next(&iter))
- if (iter.parm == parm)
- break;
-
- if (iter.valid) {
- if (parm->flag & PROP_DYNAMIC) {
- /* for dynamic arrays and strings, data is a pointer to an array */
- ParameterDynAlloc *data_alloc = iter.data;
- size_t size = 0;
- switch (parm->type) {
- case PROP_STRING:
- size = sizeof(char);
- break;
- case PROP_INT:
- case PROP_BOOLEAN:
- size = sizeof(int);
- break;
- case PROP_FLOAT:
- size = sizeof(float);
- break;
- default:
- break;
- }
- size *= data_alloc->array_tot;
- if (data_alloc->array)
- MEM_freeN(data_alloc->array);
- data_alloc->array = MEM_mallocN(size, __func__);
- memcpy(data_alloc->array, value, size);
- }
- else {
- memcpy(iter.data, value, iter.size);
- }
- }
-
- RNA_parameter_list_end(&iter);
+ ParameterIterator iter;
+
+ RNA_parameter_list_begin(parms, &iter);
+
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
+ break;
+
+ if (iter.valid) {
+ if (parm->flag & PROP_DYNAMIC) {
+ /* for dynamic arrays and strings, data is a pointer to an array */
+ ParameterDynAlloc *data_alloc = iter.data;
+ size_t size = 0;
+ switch (parm->type) {
+ case PROP_STRING:
+ size = sizeof(char);
+ break;
+ case PROP_INT:
+ case PROP_BOOLEAN:
+ size = sizeof(int);
+ break;
+ case PROP_FLOAT:
+ size = sizeof(float);
+ break;
+ default:
+ break;
+ }
+ size *= data_alloc->array_tot;
+ if (data_alloc->array)
+ MEM_freeN(data_alloc->array);
+ data_alloc->array = MEM_mallocN(size, __func__);
+ memcpy(data_alloc->array, value, size);
+ }
+ else {
+ memcpy(iter.data, value, iter.size);
+ }
+ }
+
+ RNA_parameter_list_end(&iter);
}
void RNA_parameter_set_lookup(ParameterList *parms, const char *identifier, const void *value)
{
- PropertyRNA *parm;
+ PropertyRNA *parm;
- parm = parms->func->cont.properties.first;
- for (; parm; parm = parm->next)
- if (STREQ(RNA_property_identifier(parm), identifier))
- break;
+ parm = parms->func->cont.properties.first;
+ for (; parm; parm = parm->next)
+ if (STREQ(RNA_property_identifier(parm), identifier))
+ break;
- if (parm)
- RNA_parameter_set(parms, parm, value);
+ if (parm)
+ RNA_parameter_set(parms, parm, value);
}
int RNA_parameter_dynamic_length_get(ParameterList *parms, PropertyRNA *parm)
{
- ParameterIterator iter;
- int len = 0;
+ ParameterIterator iter;
+ int len = 0;
- RNA_parameter_list_begin(parms, &iter);
+ RNA_parameter_list_begin(parms, &iter);
- for (; iter.valid; RNA_parameter_list_next(&iter))
- if (iter.parm == parm)
- break;
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
+ break;
- if (iter.valid)
- len = RNA_parameter_dynamic_length_get_data(parms, parm, iter.data);
+ if (iter.valid)
+ len = RNA_parameter_dynamic_length_get_data(parms, parm, iter.data);
- RNA_parameter_list_end(&iter);
+ RNA_parameter_list_end(&iter);
- return len;
+ return len;
}
void RNA_parameter_dynamic_length_set(ParameterList *parms, PropertyRNA *parm, int length)
{
- ParameterIterator iter;
+ ParameterIterator iter;
- RNA_parameter_list_begin(parms, &iter);
+ RNA_parameter_list_begin(parms, &iter);
- for (; iter.valid; RNA_parameter_list_next(&iter))
- if (iter.parm == parm)
- break;
+ for (; iter.valid; RNA_parameter_list_next(&iter))
+ if (iter.parm == parm)
+ break;
- if (iter.valid)
- RNA_parameter_dynamic_length_set_data(parms, parm, iter.data, length);
+ if (iter.valid)
+ RNA_parameter_dynamic_length_set_data(parms, parm, iter.data, length);
- RNA_parameter_list_end(&iter);
+ RNA_parameter_list_end(&iter);
}
-int RNA_parameter_dynamic_length_get_data(ParameterList *UNUSED(parms), PropertyRNA *parm, void *data)
+int RNA_parameter_dynamic_length_get_data(ParameterList *UNUSED(parms),
+ PropertyRNA *parm,
+ void *data)
{
- if (parm->flag & PROP_DYNAMIC) {
- return (int)((ParameterDynAlloc *)data)->array_tot;
- }
- return 0;
+ if (parm->flag & PROP_DYNAMIC) {
+ return (int)((ParameterDynAlloc *)data)->array_tot;
+ }
+ return 0;
}
-void RNA_parameter_dynamic_length_set_data(ParameterList *UNUSED(parms), PropertyRNA *parm, void *data, int length)
+void RNA_parameter_dynamic_length_set_data(ParameterList *UNUSED(parms),
+ PropertyRNA *parm,
+ void *data,
+ int length)
{
- if (parm->flag & PROP_DYNAMIC) {
- ((ParameterDynAlloc *)data)->array_tot = (intptr_t)length;
- }
+ if (parm->flag & PROP_DYNAMIC) {
+ ((ParameterDynAlloc *)data)->array_tot = (intptr_t)length;
+ }
}
-int RNA_function_call(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
+int RNA_function_call(
+ bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, ParameterList *parms)
{
- if (func->call) {
- func->call(C, reports, ptr, parms);
+ if (func->call) {
+ func->call(C, reports, ptr, parms);
- return 0;
- }
+ return 0;
+ }
- return -1;
+ return -1;
}
-int RNA_function_call_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier,
+int RNA_function_call_lookup(bContext *C,
+ ReportList *reports,
+ PointerRNA *ptr,
+ const char *identifier,
ParameterList *parms)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = RNA_struct_find_function(ptr->type, identifier);
+ func = RNA_struct_find_function(ptr->type, identifier);
- if (func)
- return RNA_function_call(C, reports, ptr, func, parms);
+ if (func)
+ return RNA_function_call(C, reports, ptr, func, parms);
- return -1;
+ return -1;
}
-int RNA_function_call_direct(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func,
- const char *format, ...)
+int RNA_function_call_direct(
+ bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func, const char *format, ...)
{
- va_list args;
- int ret;
+ va_list args;
+ int ret;
- va_start(args, format);
+ va_start(args, format);
- ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+ ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
- va_end(args);
+ va_end(args);
- return ret;
+ return ret;
}
-int RNA_function_call_direct_lookup(bContext *C, ReportList *reports, PointerRNA *ptr, const char *identifier,
- const char *format, ...)
+int RNA_function_call_direct_lookup(bContext *C,
+ ReportList *reports,
+ PointerRNA *ptr,
+ const char *identifier,
+ const char *format,
+ ...)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = RNA_struct_find_function(ptr->type, identifier);
+ func = RNA_struct_find_function(ptr->type, identifier);
- if (func) {
- va_list args;
- int ret;
+ if (func) {
+ va_list args;
+ int ret;
- va_start(args, format);
+ va_start(args, format);
- ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+ ret = RNA_function_call_direct_va(C, reports, ptr, func, format, args);
- va_end(args);
+ va_end(args);
- return ret;
- }
+ return ret;
+ }
- return -1;
+ return -1;
}
static int rna_function_format_array_length(const char *format, int ofs, int flen)
{
- char lenbuf[16];
- int idx = 0;
-
- if (format[ofs++] == '[')
- for (; ofs < flen && format[ofs] != ']' && idx < sizeof(lenbuf) - 1; idx++, ofs++)
- lenbuf[idx] = format[ofs];
-
- if (ofs < flen && format[ofs + 1] == ']') {
- /* XXX put better error reporting for (ofs >= flen) or idx over lenbuf capacity */
- lenbuf[idx] = '\0';
- return atoi(lenbuf);
- }
-
- return 0;
-}
-
-static int rna_function_parameter_parse(PointerRNA *ptr, PropertyRNA *prop, PropertyType type,
- char ftype, int len, void *dest, const void *src, StructRNA *srna,
- const char *tid, const char *fid, const char *pid)
-{
- /* ptr is always a function pointer, prop always a parameter */
-
- switch (type) {
- case PROP_BOOLEAN:
- {
- if (ftype != 'b') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, a boolean was expected\n", tid, fid, pid);
- return -1;
- }
-
- if (len == 0)
- *((bool *)dest) = *((bool *)src);
- else
- memcpy(dest, src, len * sizeof(bool));
-
- break;
- }
- case PROP_INT:
- {
- if (ftype != 'i') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, an integer was expected\n", tid, fid, pid);
- return -1;
- }
-
- if (len == 0)
- *((int *)dest) = *((int *)src);
- else
- memcpy(dest, src, len * sizeof(int));
-
- break;
- }
- case PROP_FLOAT:
- {
- if (ftype != 'f') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, a float was expected\n", tid, fid, pid);
- return -1;
- }
-
- if (len == 0)
- *((float *)dest) = *((float *)src);
- else
- memcpy(dest, src, len * sizeof(float));
-
- break;
- }
- case PROP_STRING:
- {
- if (ftype != 's') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, a string was expected\n", tid, fid, pid);
- return -1;
- }
-
- *((char **)dest) = *((char **)src);
-
- break;
- }
- case PROP_ENUM:
- {
- if (ftype != 'e') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, an enum was expected\n", tid, fid, pid);
- return -1;
- }
-
- *((int *)dest) = *((int *)src);
-
- break;
- }
- case PROP_POINTER:
- {
- StructRNA *ptype;
-
- if (ftype != 'O') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, an object was expected\n", tid, fid, pid);
- return -1;
- }
-
- ptype = RNA_property_pointer_type(ptr, prop);
-
- if (prop->flag_parameter & PARM_RNAPTR) {
- *((PointerRNA *)dest) = *((PointerRNA *)src);
- break;
- }
-
- if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, "
- "an object of type %s was expected, passed an object of type %s\n",
- tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
- return -1;
- }
-
- *((void **)dest) = *((void **)src);
-
- break;
- }
- case PROP_COLLECTION:
- {
- StructRNA *ptype;
- ListBase *lb, *clb;
- Link *link;
- CollectionPointerLink *clink;
-
- if (ftype != 'C') {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, a collection was expected\n", tid, fid, pid);
- return -1;
- }
-
- lb = (ListBase *)src;
- clb = (ListBase *)dest;
- ptype = RNA_property_pointer_type(ptr, prop);
-
- if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
- fprintf(stderr, "%s.%s: wrong type for parameter %s, "
- "a collection of objects of type %s was expected, "
- "passed a collection of objects of type %s\n",
- tid, fid, pid, RNA_struct_identifier(ptype), RNA_struct_identifier(srna));
- return -1;
- }
-
- for (link = lb->first; link; link = link->next) {
- clink = MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
- RNA_pointer_create(NULL, srna, link, &clink->ptr);
- BLI_addtail(clb, clink);
- }
-
- break;
- }
- default:
- {
- if (len == 0)
- fprintf(stderr, "%s.%s: unknown type for parameter %s\n", tid, fid, pid);
- else
- fprintf(stderr, "%s.%s: unknown array type for parameter %s\n", tid, fid, pid);
-
- return -1;
- }
- }
-
- return 0;
-}
-
-int RNA_function_call_direct_va(bContext *C, ReportList *reports, PointerRNA *ptr, FunctionRNA *func,
- const char *format, va_list args)
-{
- PointerRNA funcptr;
- ParameterList parms;
- ParameterIterator iter;
- PropertyRNA *pret, *parm;
- PropertyType type;
- int i, ofs, flen, flag_parameter, len, alen, err = 0;
- const char *tid, *fid, *pid = NULL;
- char ftype;
- void **retdata = NULL;
-
- RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
-
- tid = RNA_struct_identifier(ptr->type);
- fid = RNA_function_identifier(func);
- pret = func->c_ret;
- flen = strlen(format);
-
- RNA_parameter_list_create(&parms, ptr, func);
- RNA_parameter_list_begin(&parms, &iter);
-
- for (i = 0, ofs = 0; iter.valid; RNA_parameter_list_next(&iter), i++) {
- parm = iter.parm;
- flag_parameter = RNA_parameter_flag(parm);
-
- if (parm == pret) {
- retdata = iter.data;
- continue;
- }
- else if (flag_parameter & PARM_OUTPUT) {
- continue;
- }
-
- pid = RNA_property_identifier(parm);
-
- if (ofs >= flen || format[ofs] == 'N') {
- if (parm->flag_parameter & PARM_REQUIRED) {
- err = -1;
- fprintf(stderr, "%s.%s: missing required parameter %s\n", tid, fid, pid);
- break;
- }
- ofs++;
- continue;
- }
-
- type = RNA_property_type(parm);
- ftype = format[ofs++];
- len = RNA_property_array_length(&funcptr, parm);
- alen = rna_function_format_array_length(format, ofs, flen);
-
- if (len != alen) {
- err = -1;
- fprintf(stderr, "%s.%s: for parameter %s, "
- "was expecting an array of %i elements, "
- "passed %i elements instead\n",
- tid, fid, pid, len, alen);
- break;
- }
-
- switch (type) {
- case PROP_BOOLEAN:
- case PROP_INT:
- case PROP_ENUM:
- {
- int arg = va_arg(args, int);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
- NULL, tid, fid, pid);
- break;
- }
- case PROP_FLOAT:
- {
- double arg = va_arg(args, double);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
- NULL, tid, fid, pid);
- break;
- }
- case PROP_STRING:
- {
- const char *arg = va_arg(args, char *);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
- NULL, tid, fid, pid);
- break;
- }
- case PROP_POINTER:
- {
- StructRNA *srna = va_arg(args, StructRNA *);
- void *arg = va_arg(args, void *);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
- srna, tid, fid, pid);
- break;
- }
- case PROP_COLLECTION:
- {
- StructRNA *srna = va_arg(args, StructRNA *);
- ListBase *arg = va_arg(args, ListBase *);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, &arg,
- srna, tid, fid, pid);
- break;
- }
- default:
- {
- /* handle errors */
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, iter.data, NULL,
- NULL, tid, fid, pid);
- break;
- }
- }
-
- if (err != 0)
- break;
- }
-
- if (err == 0)
- err = RNA_function_call(C, reports, ptr, func, &parms);
-
- /* XXX throw error when more parameters than those needed are passed or leave silent? */
- if (err == 0 && pret && ofs < flen && format[ofs++] == 'R') {
- parm = pret;
-
- type = RNA_property_type(parm);
- ftype = format[ofs++];
- len = RNA_property_array_length(&funcptr, parm);
- alen = rna_function_format_array_length(format, ofs, flen);
-
- if (len != alen) {
- err = -1;
- fprintf(stderr, "%s.%s: for return parameter %s, "
- "was expecting an array of %i elements, passed %i elements instead\n",
- tid, fid, pid, len, alen);
- }
- else {
- switch (type) {
- case PROP_BOOLEAN:
- case PROP_INT:
- case PROP_ENUM:
- {
- int *arg = va_arg(args, int *);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
- NULL, tid, fid, pid);
- break;
- }
- case PROP_FLOAT:
- {
- float *arg = va_arg(args, float *);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
- NULL, tid, fid, pid);
- break;
- }
- case PROP_STRING:
- {
- char **arg = va_arg(args, char **);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
- NULL, tid, fid, pid);
- break;
- }
- case PROP_POINTER:
- {
- StructRNA *srna = va_arg(args, StructRNA *);
- void **arg = va_arg(args, void **);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
- srna, tid, fid, pid);
- break;
- }
- case PROP_COLLECTION:
- {
- StructRNA *srna = va_arg(args, StructRNA *);
- ListBase **arg = va_arg(args, ListBase **);
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, arg, retdata,
- srna, tid, fid, pid);
- break;
- }
- default:
- {
- /* handle errors */
- err = rna_function_parameter_parse(&funcptr, parm, type, ftype, len, NULL, NULL,
- NULL, tid, fid, pid);
- break;
- }
- }
- }
- }
-
- RNA_parameter_list_end(&iter);
- RNA_parameter_list_free(&parms);
-
- return err;
-}
-
-int RNA_function_call_direct_va_lookup(bContext *C, ReportList *reports, PointerRNA *ptr,
- const char *identifier, const char *format, va_list args)
-{
- FunctionRNA *func;
-
- func = RNA_struct_find_function(ptr->type, identifier);
-
- if (func)
- return RNA_function_call_direct_va(C, reports, ptr, func, format, args);
-
- return 0;
+ char lenbuf[16];
+ int idx = 0;
+
+ if (format[ofs++] == '[')
+ for (; ofs < flen && format[ofs] != ']' && idx < sizeof(lenbuf) - 1; idx++, ofs++)
+ lenbuf[idx] = format[ofs];
+
+ if (ofs < flen && format[ofs + 1] == ']') {
+ /* XXX put better error reporting for (ofs >= flen) or idx over lenbuf capacity */
+ lenbuf[idx] = '\0';
+ return atoi(lenbuf);
+ }
+
+ return 0;
+}
+
+static int rna_function_parameter_parse(PointerRNA *ptr,
+ PropertyRNA *prop,
+ PropertyType type,
+ char ftype,
+ int len,
+ void *dest,
+ const void *src,
+ StructRNA *srna,
+ const char *tid,
+ const char *fid,
+ const char *pid)
+{
+ /* ptr is always a function pointer, prop always a parameter */
+
+ switch (type) {
+ case PROP_BOOLEAN: {
+ if (ftype != 'b') {
+ fprintf(
+ stderr, "%s.%s: wrong type for parameter %s, a boolean was expected\n", tid, fid, pid);
+ return -1;
+ }
+
+ if (len == 0)
+ *((bool *)dest) = *((bool *)src);
+ else
+ memcpy(dest, src, len * sizeof(bool));
+
+ break;
+ }
+ case PROP_INT: {
+ if (ftype != 'i') {
+ fprintf(stderr,
+ "%s.%s: wrong type for parameter %s, an integer was expected\n",
+ tid,
+ fid,
+ pid);
+ return -1;
+ }
+
+ if (len == 0)
+ *((int *)dest) = *((int *)src);
+ else
+ memcpy(dest, src, len * sizeof(int));
+
+ break;
+ }
+ case PROP_FLOAT: {
+ if (ftype != 'f') {
+ fprintf(
+ stderr, "%s.%s: wrong type for parameter %s, a float was expected\n", tid, fid, pid);
+ return -1;
+ }
+
+ if (len == 0)
+ *((float *)dest) = *((float *)src);
+ else
+ memcpy(dest, src, len * sizeof(float));
+
+ break;
+ }
+ case PROP_STRING: {
+ if (ftype != 's') {
+ fprintf(
+ stderr, "%s.%s: wrong type for parameter %s, a string was expected\n", tid, fid, pid);
+ return -1;
+ }
+
+ *((char **)dest) = *((char **)src);
+
+ break;
+ }
+ case PROP_ENUM: {
+ if (ftype != 'e') {
+ fprintf(
+ stderr, "%s.%s: wrong type for parameter %s, an enum was expected\n", tid, fid, pid);
+ return -1;
+ }
+
+ *((int *)dest) = *((int *)src);
+
+ break;
+ }
+ case PROP_POINTER: {
+ StructRNA *ptype;
+
+ if (ftype != 'O') {
+ fprintf(
+ stderr, "%s.%s: wrong type for parameter %s, an object was expected\n", tid, fid, pid);
+ return -1;
+ }
+
+ ptype = RNA_property_pointer_type(ptr, prop);
+
+ if (prop->flag_parameter & PARM_RNAPTR) {
+ *((PointerRNA *)dest) = *((PointerRNA *)src);
+ break;
+ }
+
+ if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
+ fprintf(stderr,
+ "%s.%s: wrong type for parameter %s, "
+ "an object of type %s was expected, passed an object of type %s\n",
+ tid,
+ fid,
+ pid,
+ RNA_struct_identifier(ptype),
+ RNA_struct_identifier(srna));
+ return -1;
+ }
+
+ *((void **)dest) = *((void **)src);
+
+ break;
+ }
+ case PROP_COLLECTION: {
+ StructRNA *ptype;
+ ListBase *lb, *clb;
+ Link *link;
+ CollectionPointerLink *clink;
+
+ if (ftype != 'C') {
+ fprintf(stderr,
+ "%s.%s: wrong type for parameter %s, a collection was expected\n",
+ tid,
+ fid,
+ pid);
+ return -1;
+ }
+
+ lb = (ListBase *)src;
+ clb = (ListBase *)dest;
+ ptype = RNA_property_pointer_type(ptr, prop);
+
+ if (ptype != srna && !RNA_struct_is_a(srna, ptype)) {
+ fprintf(stderr,
+ "%s.%s: wrong type for parameter %s, "
+ "a collection of objects of type %s was expected, "
+ "passed a collection of objects of type %s\n",
+ tid,
+ fid,
+ pid,
+ RNA_struct_identifier(ptype),
+ RNA_struct_identifier(srna));
+ return -1;
+ }
+
+ for (link = lb->first; link; link = link->next) {
+ clink = MEM_callocN(sizeof(CollectionPointerLink), "CCollectionPointerLink");
+ RNA_pointer_create(NULL, srna, link, &clink->ptr);
+ BLI_addtail(clb, clink);
+ }
+
+ break;
+ }
+ default: {
+ if (len == 0)
+ fprintf(stderr, "%s.%s: unknown type for parameter %s\n", tid, fid, pid);
+ else
+ fprintf(stderr, "%s.%s: unknown array type for parameter %s\n", tid, fid, pid);
+
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+int RNA_function_call_direct_va(bContext *C,
+ ReportList *reports,
+ PointerRNA *ptr,
+ FunctionRNA *func,
+ const char *format,
+ va_list args)
+{
+ PointerRNA funcptr;
+ ParameterList parms;
+ ParameterIterator iter;
+ PropertyRNA *pret, *parm;
+ PropertyType type;
+ int i, ofs, flen, flag_parameter, len, alen, err = 0;
+ const char *tid, *fid, *pid = NULL;
+ char ftype;
+ void **retdata = NULL;
+
+ RNA_pointer_create(NULL, &RNA_Function, func, &funcptr);
+
+ tid = RNA_struct_identifier(ptr->type);
+ fid = RNA_function_identifier(func);
+ pret = func->c_ret;
+ flen = strlen(format);
+
+ RNA_parameter_list_create(&parms, ptr, func);
+ RNA_parameter_list_begin(&parms, &iter);
+
+ for (i = 0, ofs = 0; iter.valid; RNA_parameter_list_next(&iter), i++) {
+ parm = iter.parm;
+ flag_parameter = RNA_parameter_flag(parm);
+
+ if (parm == pret) {
+ retdata = iter.data;
+ continue;
+ }
+ else if (flag_parameter & PARM_OUTPUT) {
+ continue;
+ }
+
+ pid = RNA_property_identifier(parm);
+
+ if (ofs >= flen || format[ofs] == 'N') {
+ if (parm->flag_parameter & PARM_REQUIRED) {
+ err = -1;
+ fprintf(stderr, "%s.%s: missing required parameter %s\n", tid, fid, pid);
+ break;
+ }
+ ofs++;
+ continue;
+ }
+
+ type = RNA_property_type(parm);
+ ftype = format[ofs++];
+ len = RNA_property_array_length(&funcptr, parm);
+ alen = rna_function_format_array_length(format, ofs, flen);
+
+ if (len != alen) {
+ err = -1;
+ fprintf(stderr,
+ "%s.%s: for parameter %s, "
+ "was expecting an array of %i elements, "
+ "passed %i elements instead\n",
+ tid,
+ fid,
+ pid,
+ len,
+ alen);
+ break;
+ }
+
+ switch (type) {
+ case PROP_BOOLEAN:
+ case PROP_INT:
+ case PROP_ENUM: {
+ int arg = va_arg(args, int);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ break;
+ }
+ case PROP_FLOAT: {
+ double arg = va_arg(args, double);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ break;
+ }
+ case PROP_STRING: {
+ const char *arg = va_arg(args, char *);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, iter.data, &arg, NULL, tid, fid, pid);
+ break;
+ }
+ case PROP_POINTER: {
+ StructRNA *srna = va_arg(args, StructRNA *);
+ void *arg = va_arg(args, void *);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+ break;
+ }
+ case PROP_COLLECTION: {
+ StructRNA *srna = va_arg(args, StructRNA *);
+ ListBase *arg = va_arg(args, ListBase *);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, iter.data, &arg, srna, tid, fid, pid);
+ break;
+ }
+ default: {
+ /* handle errors */
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, iter.data, NULL, NULL, tid, fid, pid);
+ break;
+ }
+ }
+
+ if (err != 0)
+ break;
+ }
+
+ if (err == 0)
+ err = RNA_function_call(C, reports, ptr, func, &parms);
+
+ /* XXX throw error when more parameters than those needed are passed or leave silent? */
+ if (err == 0 && pret && ofs < flen && format[ofs++] == 'R') {
+ parm = pret;
+
+ type = RNA_property_type(parm);
+ ftype = format[ofs++];
+ len = RNA_property_array_length(&funcptr, parm);
+ alen = rna_function_format_array_length(format, ofs, flen);
+
+ if (len != alen) {
+ err = -1;
+ fprintf(stderr,
+ "%s.%s: for return parameter %s, "
+ "was expecting an array of %i elements, passed %i elements instead\n",
+ tid,
+ fid,
+ pid,
+ len,
+ alen);
+ }
+ else {
+ switch (type) {
+ case PROP_BOOLEAN:
+ case PROP_INT:
+ case PROP_ENUM: {
+ int *arg = va_arg(args, int *);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ break;
+ }
+ case PROP_FLOAT: {
+ float *arg = va_arg(args, float *);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ break;
+ }
+ case PROP_STRING: {
+ char **arg = va_arg(args, char **);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, arg, retdata, NULL, tid, fid, pid);
+ break;
+ }
+ case PROP_POINTER: {
+ StructRNA *srna = va_arg(args, StructRNA *);
+ void **arg = va_arg(args, void **);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+ break;
+ }
+ case PROP_COLLECTION: {
+ StructRNA *srna = va_arg(args, StructRNA *);
+ ListBase **arg = va_arg(args, ListBase **);
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, arg, retdata, srna, tid, fid, pid);
+ break;
+ }
+ default: {
+ /* handle errors */
+ err = rna_function_parameter_parse(
+ &funcptr, parm, type, ftype, len, NULL, NULL, NULL, tid, fid, pid);
+ break;
+ }
+ }
+ }
+ }
+
+ RNA_parameter_list_end(&iter);
+ RNA_parameter_list_free(&parms);
+
+ return err;
+}
+
+int RNA_function_call_direct_va_lookup(bContext *C,
+ ReportList *reports,
+ PointerRNA *ptr,
+ const char *identifier,
+ const char *format,
+ va_list args)
+{
+ FunctionRNA *func;
+
+ func = RNA_struct_find_function(ptr->type, identifier);
+
+ if (func)
+ return RNA_function_call_direct_va(C, reports, ptr, func, format, args);
+
+ return 0;
}
const char *RNA_translate_ui_text(
- const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate)
+ const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, int translate)
{
- return rna_translate_ui_text(text, text_ctxt, type, prop, translate);
+ return rna_translate_ui_text(text, text_ctxt, type, prop, translate);
}
bool RNA_property_reset(PointerRNA *ptr, PropertyRNA *prop, int index)
{
- int len;
-
- /* get the length of the array to work with */
- len = RNA_property_array_length(ptr, prop);
-
- /* get and set the default values as appropriate for the various types */
- switch (RNA_property_type(prop)) {
- case PROP_BOOLEAN:
- if (len) {
- if (index == -1) {
- bool *tmparray = MEM_callocN(sizeof(bool) * len, "reset_defaults - boolean");
-
- RNA_property_boolean_get_default_array(ptr, prop, tmparray);
- RNA_property_boolean_set_array(ptr, prop, tmparray);
-
- MEM_freeN(tmparray);
- }
- else {
- int value = RNA_property_boolean_get_default_index(ptr, prop, index);
- RNA_property_boolean_set_index(ptr, prop, index, value);
- }
- }
- else {
- int value = RNA_property_boolean_get_default(ptr, prop);
- RNA_property_boolean_set(ptr, prop, value);
- }
- return true;
- case PROP_INT:
- if (len) {
- if (index == -1) {
- int *tmparray = MEM_callocN(sizeof(int) * len, "reset_defaults - int");
-
- RNA_property_int_get_default_array(ptr, prop, tmparray);
- RNA_property_int_set_array(ptr, prop, tmparray);
-
- MEM_freeN(tmparray);
- }
- else {
- int value = RNA_property_int_get_default_index(ptr, prop, index);
- RNA_property_int_set_index(ptr, prop, index, value);
- }
- }
- else {
- int value = RNA_property_int_get_default(ptr, prop);
- RNA_property_int_set(ptr, prop, value);
- }
- return true;
- case PROP_FLOAT:
- if (len) {
- if (index == -1) {
- float *tmparray = MEM_callocN(sizeof(float) * len, "reset_defaults - float");
-
- RNA_property_float_get_default_array(ptr, prop, tmparray);
- RNA_property_float_set_array(ptr, prop, tmparray);
-
- MEM_freeN(tmparray);
- }
- else {
- float value = RNA_property_float_get_default_index(ptr, prop, index);
- RNA_property_float_set_index(ptr, prop, index, value);
- }
- }
- else {
- float value = RNA_property_float_get_default(ptr, prop);
- RNA_property_float_set(ptr, prop, value);
- }
- return true;
- case PROP_ENUM:
- {
- int value = RNA_property_enum_get_default(ptr, prop);
- RNA_property_enum_set(ptr, prop, value);
- return true;
- }
-
- case PROP_STRING:
- {
- char *value = RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
- RNA_property_string_set(ptr, prop, value);
- MEM_freeN(value);
- return true;
- }
-
- case PROP_POINTER:
- {
- PointerRNA value = RNA_property_pointer_get_default(ptr, prop);
- RNA_property_pointer_set(ptr, prop, value);
- return true;
- }
-
- default:
- /* FIXME: are there still any cases that haven't been handled? comment out "default" block to check :) */
- return false;
- }
+ int len;
+
+ /* get the length of the array to work with */
+ len = RNA_property_array_length(ptr, prop);
+
+ /* get and set the default values as appropriate for the various types */
+ switch (RNA_property_type(prop)) {
+ case PROP_BOOLEAN:
+ if (len) {
+ if (index == -1) {
+ bool *tmparray = MEM_callocN(sizeof(bool) * len, "reset_defaults - boolean");
+
+ RNA_property_boolean_get_default_array(ptr, prop, tmparray);
+ RNA_property_boolean_set_array(ptr, prop, tmparray);
+
+ MEM_freeN(tmparray);
+ }
+ else {
+ int value = RNA_property_boolean_get_default_index(ptr, prop, index);
+ RNA_property_boolean_set_index(ptr, prop, index, value);
+ }
+ }
+ else {
+ int value = RNA_property_boolean_get_default(ptr, prop);
+ RNA_property_boolean_set(ptr, prop, value);
+ }
+ return true;
+ case PROP_INT:
+ if (len) {
+ if (index == -1) {
+ int *tmparray = MEM_callocN(sizeof(int) * len, "reset_defaults - int");
+
+ RNA_property_int_get_default_array(ptr, prop, tmparray);
+ RNA_property_int_set_array(ptr, prop, tmparray);
+
+ MEM_freeN(tmparray);
+ }
+ else {
+ int value = RNA_property_int_get_default_index(ptr, prop, index);
+ RNA_property_int_set_index(ptr, prop, index, value);
+ }
+ }
+ else {
+ int value = RNA_property_int_get_default(ptr, prop);
+ RNA_property_int_set(ptr, prop, value);
+ }
+ return true;
+ case PROP_FLOAT:
+ if (len) {
+ if (index == -1) {
+ float *tmparray = MEM_callocN(sizeof(float) * len, "reset_defaults - float");
+
+ RNA_property_float_get_default_array(ptr, prop, tmparray);
+ RNA_property_float_set_array(ptr, prop, tmparray);
+
+ MEM_freeN(tmparray);
+ }
+ else {
+ float value = RNA_property_float_get_default_index(ptr, prop, index);
+ RNA_property_float_set_index(ptr, prop, index, value);
+ }
+ }
+ else {
+ float value = RNA_property_float_get_default(ptr, prop);
+ RNA_property_float_set(ptr, prop, value);
+ }
+ return true;
+ case PROP_ENUM: {
+ int value = RNA_property_enum_get_default(ptr, prop);
+ RNA_property_enum_set(ptr, prop, value);
+ return true;
+ }
+
+ case PROP_STRING: {
+ char *value = RNA_property_string_get_default_alloc(ptr, prop, NULL, 0);
+ RNA_property_string_set(ptr, prop, value);
+ MEM_freeN(value);
+ return true;
+ }
+
+ case PROP_POINTER: {
+ PointerRNA value = RNA_property_pointer_get_default(ptr, prop);
+ RNA_property_pointer_set(ptr, prop, value);
+ return true;
+ }
+
+ default:
+ /* FIXME: are there still any cases that haven't been handled? comment out "default" block to check :) */
+ return false;
+ }
}
bool RNA_property_assign_default(PointerRNA *ptr, PropertyRNA *prop)
{
- if (!RNA_property_is_idprop(prop) || RNA_property_array_check(prop)) {
- return false;
- }
-
- /* get and set the default values as appropriate for the various types */
- switch (RNA_property_type(prop)) {
- case PROP_INT:
- {
- int value = RNA_property_int_get(ptr, prop);
- return RNA_property_int_set_default(ptr, prop, value);
- }
-
- case PROP_FLOAT:
- {
- float value = RNA_property_float_get(ptr, prop);
- return RNA_property_float_set_default(ptr, prop, value);
- }
-
- default:
- return false;
- }
-}
-
-static bool rna_property_override_operation_apply(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
- PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
- PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
- IDOverrideStaticPropertyOperation *opop);
-
-bool RNA_property_copy(Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
-{
- if (!RNA_property_editable(ptr, prop)) {
- return false;
- }
-
- PropertyRNA *prop_dst = prop;
- PropertyRNA *prop_src = prop;
-
- /* Ensure we get real property data, be it an actual RNA property, or an IDProperty in disguise. */
- prop_dst = rna_ensure_property_realdata(&prop_dst, ptr);
- prop_src = rna_ensure_property_realdata(&prop_src, fromptr);
-
- /* IDprops: destination may not exist, if source does and is set, try to create it. */
- /* Note: this is sort of quick hack/bandage to fix the issue, we need to rethink how IDProps are handled
- * in 'diff' RNA code completely, imho... */
- if (prop_src != NULL && prop_dst == NULL && RNA_property_is_set(fromptr, prop)) {
- BLI_assert(prop_src->magic != RNA_MAGIC);
- IDProperty *idp_dst = RNA_struct_idprops(ptr, true);
- IDProperty *prop_idp_dst = IDP_CopyProperty((IDProperty *)prop_src);
- IDP_AddToGroup(idp_dst, prop_idp_dst);
- rna_idproperty_touch(prop_idp_dst);
- /* Nothing else to do here... */
- return true;
- }
-
- if (ELEM(NULL, prop_dst, prop_src)) {
- return false;
- }
-
- IDOverrideStaticPropertyOperation opop = {
- .operation = IDOVERRIDESTATIC_OP_REPLACE,
- .subitem_reference_index = index,
- .subitem_local_index = index,
- };
- return rna_property_override_operation_apply(
- bmain,
- ptr, fromptr, NULL,
- prop_dst, prop_src, NULL,
- NULL, NULL, NULL,
- &opop);
+ if (!RNA_property_is_idprop(prop) || RNA_property_array_check(prop)) {
+ return false;
+ }
+
+ /* get and set the default values as appropriate for the various types */
+ switch (RNA_property_type(prop)) {
+ case PROP_INT: {
+ int value = RNA_property_int_get(ptr, prop);
+ return RNA_property_int_set_default(ptr, prop, value);
+ }
+
+ case PROP_FLOAT: {
+ float value = RNA_property_float_get(ptr, prop);
+ return RNA_property_float_set_default(ptr, prop, value);
+ }
+
+ default:
+ return false;
+ }
+}
+
+static bool rna_property_override_operation_apply(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_override,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_local,
+ PropertyRNA *prop_override,
+ PropertyRNA *prop_storage,
+ PointerRNA *ptr_item_local,
+ PointerRNA *ptr_item_override,
+ PointerRNA *ptr_item_storage,
+ IDOverrideStaticPropertyOperation *opop);
+
+bool RNA_property_copy(
+ Main *bmain, PointerRNA *ptr, PointerRNA *fromptr, PropertyRNA *prop, int index)
+{
+ if (!RNA_property_editable(ptr, prop)) {
+ return false;
+ }
+
+ PropertyRNA *prop_dst = prop;
+ PropertyRNA *prop_src = prop;
+
+ /* Ensure we get real property data, be it an actual RNA property, or an IDProperty in disguise. */
+ prop_dst = rna_ensure_property_realdata(&prop_dst, ptr);
+ prop_src = rna_ensure_property_realdata(&prop_src, fromptr);
+
+ /* IDprops: destination may not exist, if source does and is set, try to create it. */
+ /* Note: this is sort of quick hack/bandage to fix the issue, we need to rethink how IDProps are handled
+ * in 'diff' RNA code completely, imho... */
+ if (prop_src != NULL && prop_dst == NULL && RNA_property_is_set(fromptr, prop)) {
+ BLI_assert(prop_src->magic != RNA_MAGIC);
+ IDProperty *idp_dst = RNA_struct_idprops(ptr, true);
+ IDProperty *prop_idp_dst = IDP_CopyProperty((IDProperty *)prop_src);
+ IDP_AddToGroup(idp_dst, prop_idp_dst);
+ rna_idproperty_touch(prop_idp_dst);
+ /* Nothing else to do here... */
+ return true;
+ }
+
+ if (ELEM(NULL, prop_dst, prop_src)) {
+ return false;
+ }
+
+ IDOverrideStaticPropertyOperation opop = {
+ .operation = IDOVERRIDESTATIC_OP_REPLACE,
+ .subitem_reference_index = index,
+ .subitem_local_index = index,
+ };
+ return rna_property_override_operation_apply(
+ bmain, ptr, fromptr, NULL, prop_dst, prop_src, NULL, NULL, NULL, NULL, &opop);
}
/* use RNA_warning macro which includes __func__ suffix */
void _RNA_warning(const char *format, ...)
{
- va_list args;
+ va_list args;
- va_start(args, format);
- vprintf(format, args);
- va_end(args);
+ va_start(args, format);
+ vprintf(format, args);
+ va_end(args);
- /* gcc macro adds '\n', but cant use for other compilers */
+ /* gcc macro adds '\n', but cant use for other compilers */
#ifndef __GNUC__
- fputc('\n', stdout);
+ fputc('\n', stdout);
#endif
#ifdef WITH_PYTHON
- {
- extern void PyC_LineSpit(void);
- PyC_LineSpit();
- }
+ {
+ extern void PyC_LineSpit(void);
+ PyC_LineSpit();
+ }
#endif
}
-static int rna_property_override_diff(
- Main *bmain,
- PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, PropertyRNA *prop_a, PropertyRNA *prop_b, const char *rna_path,
- eRNACompareMode mode, IDOverrideStatic *override, const int flags, eRNAOverrideMatchResult *r_report_flags);
+static int rna_property_override_diff(Main *bmain,
+ PointerRNA *ptr_a,
+ PointerRNA *ptr_b,
+ PropertyRNA *prop,
+ PropertyRNA *prop_a,
+ PropertyRNA *prop_b,
+ const char *rna_path,
+ eRNACompareMode mode,
+ IDOverrideStatic *override,
+ const int flags,
+ eRNAOverrideMatchResult *r_report_flags);
-bool RNA_property_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
+bool RNA_property_equals(
+ Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, eRNACompareMode mode)
{
- BLI_assert(ELEM(mode, RNA_EQ_STRICT, RNA_EQ_UNSET_MATCH_ANY, RNA_EQ_UNSET_MATCH_NONE));
+ BLI_assert(ELEM(mode, RNA_EQ_STRICT, RNA_EQ_UNSET_MATCH_ANY, RNA_EQ_UNSET_MATCH_NONE));
- return (rna_property_override_diff(bmain, ptr_a, ptr_b, prop, NULL, NULL, NULL, mode, NULL, 0, NULL) == 0);
+ return (rna_property_override_diff(
+ bmain, ptr_a, ptr_b, prop, NULL, NULL, NULL, mode, NULL, 0, NULL) == 0);
}
bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACompareMode mode)
{
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop;
- bool equals = true;
+ CollectionPropertyIterator iter;
+ PropertyRNA *iterprop;
+ bool equals = true;
- if (ptr_a == NULL && ptr_b == NULL)
- return true;
- else if (ptr_a == NULL || ptr_b == NULL)
- return false;
- else if (ptr_a->type != ptr_b->type)
- return false;
+ if (ptr_a == NULL && ptr_b == NULL)
+ return true;
+ else if (ptr_a == NULL || ptr_b == NULL)
+ return false;
+ else if (ptr_a->type != ptr_b->type)
+ return false;
- iterprop = RNA_struct_iterator_property(ptr_a->type);
+ iterprop = RNA_struct_iterator_property(ptr_a->type);
- RNA_property_collection_begin(ptr_a, iterprop, &iter);
- for (; iter.valid; RNA_property_collection_next(&iter)) {
- PropertyRNA *prop = iter.ptr.data;
+ RNA_property_collection_begin(ptr_a, iterprop, &iter);
+ for (; iter.valid; RNA_property_collection_next(&iter)) {
+ PropertyRNA *prop = iter.ptr.data;
- if (!RNA_property_equals(bmain, ptr_a, ptr_b, prop, mode)) {
- equals = false;
- break;
- }
- }
- RNA_property_collection_end(&iter);
+ if (!RNA_property_equals(bmain, ptr_a, ptr_b, prop, mode)) {
+ equals = false;
+ break;
+ }
+ }
+ RNA_property_collection_end(&iter);
- return equals;
+ return equals;
}
/* Low-level functions, also used by non-override RNA API like copy or equality check. */
@@ -7593,247 +7821,297 @@ bool RNA_struct_equals(Main *bmain, PointerRNA *ptr_a, PointerRNA *ptr_b, eRNACo
*
* \note When there is no equality, but we cannot determine an order (greater than/lesser than), we return 1.
*/
-static int rna_property_override_diff(
- Main *bmain,
- PointerRNA *ptr_a, PointerRNA *ptr_b, PropertyRNA *prop, PropertyRNA *prop_a, PropertyRNA *prop_b,
- const char *rna_path, eRNACompareMode mode,
- IDOverrideStatic *override, const int flags, eRNAOverrideMatchResult *r_report_flags)
-{
- if (prop != NULL) {
- BLI_assert(prop_a == NULL && prop_b == NULL);
- prop_a = prop;
- prop_b = prop;
- }
-
- if (ELEM(NULL, prop_a, prop_b)) {
- return (prop_a == prop_b) ? 0 : 1;
- }
-
- if (!RNA_property_comparable(ptr_a, prop_a) || !RNA_property_comparable(ptr_b, prop_b)) {
- return 0;
- }
-
- if (mode == RNA_EQ_UNSET_MATCH_ANY) {
- /* uninitialized properties are assumed to match anything */
- if (!RNA_property_is_set(ptr_a, prop_a) || !RNA_property_is_set(ptr_b, prop_b)) {
- return 0;
- }
- }
- else if (mode == RNA_EQ_UNSET_MATCH_NONE) {
- /* unset properties never match set properties */
- if (RNA_property_is_set(ptr_a, prop_a) != RNA_property_is_set(ptr_b, prop_b)) {
- return 1;
- }
- }
-
- if (prop != NULL) {
- /* Ensure we get real property data, be it an actual RNA property, or an IDProperty in disguise. */
- prop_a = rna_ensure_property_realdata(&prop_a, ptr_a);
- prop_b = rna_ensure_property_realdata(&prop_b, ptr_b);
-
- if (ELEM(NULL, prop_a, prop_b)) {
- return (prop_a == prop_b) ? 0 : 1;
- }
- }
-
- /* Check if we are working with arrays. */
- const bool is_array_a = RNA_property_array_check(prop_a);
- const bool is_array_b = RNA_property_array_check(prop_b);
-
- if (is_array_a != is_array_b) {
- /* Should probably never happen actually... */
- BLI_assert(0);
- return is_array_a ? 1 : -1;
- }
-
- /* Get the length of the array to work with. */
- const int len_a = RNA_property_array_length(ptr_a, prop_a);
- const int len_b = RNA_property_array_length(ptr_b, prop_b);
-
- if (len_a != len_b) {
- /* Do not handle override in that case, we do not support insertion/deletion from arrays for now. */
- return len_a > len_b ? 1 : -1;
- }
-
- if (is_array_a && len_a == 0) {
- /* Empty arrays, will happen in some case with dynamic ones. */
- return 0;
- }
-
- RNAPropOverrideDiff override_diff = NULL;
- /* Special case for IDProps, we use default callback then. */
- if (prop_a->magic != RNA_MAGIC) {
- override_diff = rna_property_override_diff_default;
- if (prop_b->magic == RNA_MAGIC && prop_b->override_diff != override_diff) {
- override_diff = NULL;
- }
- }
- else if (prop_b->magic != RNA_MAGIC) {
- override_diff = rna_property_override_diff_default;
- if (prop_a->override_diff != override_diff) {
- override_diff = NULL;
- }
- }
- else if (prop_a->override_diff == prop_b->override_diff) {
- override_diff = prop_a->override_diff;
- }
-
- if (override_diff == NULL) {
+static int rna_property_override_diff(Main *bmain,
+ PointerRNA *ptr_a,
+ PointerRNA *ptr_b,
+ PropertyRNA *prop,
+ PropertyRNA *prop_a,
+ PropertyRNA *prop_b,
+ const char *rna_path,
+ eRNACompareMode mode,
+ IDOverrideStatic *override,
+ const int flags,
+ eRNAOverrideMatchResult *r_report_flags)
+{
+ if (prop != NULL) {
+ BLI_assert(prop_a == NULL && prop_b == NULL);
+ prop_a = prop;
+ prop_b = prop;
+ }
+
+ if (ELEM(NULL, prop_a, prop_b)) {
+ return (prop_a == prop_b) ? 0 : 1;
+ }
+
+ if (!RNA_property_comparable(ptr_a, prop_a) || !RNA_property_comparable(ptr_b, prop_b)) {
+ return 0;
+ }
+
+ if (mode == RNA_EQ_UNSET_MATCH_ANY) {
+ /* uninitialized properties are assumed to match anything */
+ if (!RNA_property_is_set(ptr_a, prop_a) || !RNA_property_is_set(ptr_b, prop_b)) {
+ return 0;
+ }
+ }
+ else if (mode == RNA_EQ_UNSET_MATCH_NONE) {
+ /* unset properties never match set properties */
+ if (RNA_property_is_set(ptr_a, prop_a) != RNA_property_is_set(ptr_b, prop_b)) {
+ return 1;
+ }
+ }
+
+ if (prop != NULL) {
+ /* Ensure we get real property data, be it an actual RNA property, or an IDProperty in disguise. */
+ prop_a = rna_ensure_property_realdata(&prop_a, ptr_a);
+ prop_b = rna_ensure_property_realdata(&prop_b, ptr_b);
+
+ if (ELEM(NULL, prop_a, prop_b)) {
+ return (prop_a == prop_b) ? 0 : 1;
+ }
+ }
+
+ /* Check if we are working with arrays. */
+ const bool is_array_a = RNA_property_array_check(prop_a);
+ const bool is_array_b = RNA_property_array_check(prop_b);
+
+ if (is_array_a != is_array_b) {
+ /* Should probably never happen actually... */
+ BLI_assert(0);
+ return is_array_a ? 1 : -1;
+ }
+
+ /* Get the length of the array to work with. */
+ const int len_a = RNA_property_array_length(ptr_a, prop_a);
+ const int len_b = RNA_property_array_length(ptr_b, prop_b);
+
+ if (len_a != len_b) {
+ /* Do not handle override in that case, we do not support insertion/deletion from arrays for now. */
+ return len_a > len_b ? 1 : -1;
+ }
+
+ if (is_array_a && len_a == 0) {
+ /* Empty arrays, will happen in some case with dynamic ones. */
+ return 0;
+ }
+
+ RNAPropOverrideDiff override_diff = NULL;
+ /* Special case for IDProps, we use default callback then. */
+ if (prop_a->magic != RNA_MAGIC) {
+ override_diff = rna_property_override_diff_default;
+ if (prop_b->magic == RNA_MAGIC && prop_b->override_diff != override_diff) {
+ override_diff = NULL;
+ }
+ }
+ else if (prop_b->magic != RNA_MAGIC) {
+ override_diff = rna_property_override_diff_default;
+ if (prop_a->override_diff != override_diff) {
+ override_diff = NULL;
+ }
+ }
+ else if (prop_a->override_diff == prop_b->override_diff) {
+ override_diff = prop_a->override_diff;
+ }
+
+ if (override_diff == NULL) {
#ifndef NDEBUG
- printf("'%s' gives unmatching or NULL RNA diff callbacks, should not happen (%d vs. %d).\n",
- rna_path ? rna_path : (prop_a->magic != RNA_MAGIC ? ((IDProperty *)prop_a)->name : prop_a->identifier),
- prop_a->magic == RNA_MAGIC, prop_b->magic == RNA_MAGIC);
+ printf("'%s' gives unmatching or NULL RNA diff callbacks, should not happen (%d vs. %d).\n",
+ rna_path ?
+ rna_path :
+ (prop_a->magic != RNA_MAGIC ? ((IDProperty *)prop_a)->name : prop_a->identifier),
+ prop_a->magic == RNA_MAGIC,
+ prop_b->magic == RNA_MAGIC);
#endif
- BLI_assert(0);
- return 1;
- }
-
- bool override_changed = false;
- int diff_flags = flags;
- if (!RNA_property_overridable_get(ptr_a, prop_a)) {
- diff_flags &= ~RNA_OVERRIDE_COMPARE_CREATE;
- }
- const int diff = override_diff(
- bmain,
- ptr_a, ptr_b, prop_a, prop_b, len_a, len_b,
- mode, override, rna_path, diff_flags, &override_changed);
- if (override_changed && r_report_flags) {
- *r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
- }
-
- return diff;
+ BLI_assert(0);
+ return 1;
+ }
+
+ bool override_changed = false;
+ int diff_flags = flags;
+ if (!RNA_property_overridable_get(ptr_a, prop_a)) {
+ diff_flags &= ~RNA_OVERRIDE_COMPARE_CREATE;
+ }
+ const int diff = override_diff(bmain,
+ ptr_a,
+ ptr_b,
+ prop_a,
+ prop_b,
+ len_a,
+ len_b,
+ mode,
+ override,
+ rna_path,
+ diff_flags,
+ &override_changed);
+ if (override_changed && r_report_flags) {
+ *r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_CREATED;
+ }
+
+ return diff;
}
/* Modify local data-block to make it ready for override application (only needed for diff operations, where we use
* the local data-block's data as second operand). */
-static bool rna_property_override_operation_store(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
- PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
- IDOverrideStaticProperty *op)
-{
- int len_local, len_reference, len_storage = 0;
- bool changed = false;
-
- if (ptr_storage == NULL) {
- return changed;
- }
-
- /* get the length of the array to work with */
- len_local = RNA_property_array_length(ptr_local, prop_local);
- len_reference = RNA_property_array_length(ptr_reference, prop_reference);
- if (prop_storage) {
- len_storage = RNA_property_array_length(ptr_storage, prop_storage);
- }
-
- if (len_local != len_reference || len_local != len_storage) {
- /* Do not handle override in that case, we do not support insertion/deletion from arrays for now. */
- return changed;
- }
-
- BLI_assert(prop_local->override_store == prop_reference->override_store &&
- (!ptr_storage || prop_local->override_store == prop_storage->override_store) &&
- prop_local->override_store != NULL);
-
- for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
- /* Only needed for diff operations. */
- if (!ELEM(opop->operation, IDOVERRIDESTATIC_OP_ADD, IDOVERRIDESTATIC_OP_SUBTRACT, IDOVERRIDESTATIC_OP_MULTIPLY)) {
- continue;
- }
-
- if (prop_local->override_store(
- bmain,
- ptr_local, ptr_reference, ptr_storage,
- prop_local, prop_reference, prop_storage,
- len_local, len_reference, len_storage,
- opop))
- {
- changed = true;
- }
- }
-
- return changed;
-}
-
-static bool rna_property_override_operation_apply(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
- PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
- PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
- IDOverrideStaticPropertyOperation *opop)
-{
- int len_local, len_reference, len_storage = 0;
-
- const short override_op = opop->operation;
-
- if (override_op == IDOVERRIDESTATIC_OP_NOOP) {
- return true;
- }
-
- if (ELEM(override_op, IDOVERRIDESTATIC_OP_ADD, IDOVERRIDESTATIC_OP_SUBTRACT, IDOVERRIDESTATIC_OP_MULTIPLY) && !ptr_storage) {
- /* We cannot apply 'diff' override operations without some reference storage.
- * This should typically only happen at read time of .blend file... */
- return false;
- }
-
- if (ELEM(override_op, IDOVERRIDESTATIC_OP_ADD, IDOVERRIDESTATIC_OP_SUBTRACT, IDOVERRIDESTATIC_OP_MULTIPLY) && !prop_storage) {
- /* We cannot apply 'diff' override operations without some reference storage.
- * This should typically only happen at read time of .blend file... */
- return false;
- }
-
- RNAPropOverrideApply override_apply = NULL;
- /* Special case for IDProps, we use default callback then. */
- if (prop_local->magic != RNA_MAGIC) {
- override_apply = rna_property_override_apply_default;
- if (prop_override->magic == RNA_MAGIC && prop_override->override_apply != override_apply) {
- override_apply = NULL;
- }
- }
- else if (prop_override->magic != RNA_MAGIC) {
- override_apply = rna_property_override_apply_default;
- if (prop_local->override_apply != override_apply) {
- override_apply = NULL;
- }
- }
- else if (prop_local->override_apply == prop_override->override_apply) {
- override_apply = prop_local->override_apply;
- }
-
- if (ptr_storage && prop_storage->magic == RNA_MAGIC && prop_storage->override_apply != override_apply) {
- override_apply = NULL;
- }
-
- if (override_apply == NULL) {
+static bool rna_property_override_operation_store(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_reference,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_local,
+ PropertyRNA *prop_reference,
+ PropertyRNA *prop_storage,
+ IDOverrideStaticProperty *op)
+{
+ int len_local, len_reference, len_storage = 0;
+ bool changed = false;
+
+ if (ptr_storage == NULL) {
+ return changed;
+ }
+
+ /* get the length of the array to work with */
+ len_local = RNA_property_array_length(ptr_local, prop_local);
+ len_reference = RNA_property_array_length(ptr_reference, prop_reference);
+ if (prop_storage) {
+ len_storage = RNA_property_array_length(ptr_storage, prop_storage);
+ }
+
+ if (len_local != len_reference || len_local != len_storage) {
+ /* Do not handle override in that case, we do not support insertion/deletion from arrays for now. */
+ return changed;
+ }
+
+ BLI_assert(prop_local->override_store == prop_reference->override_store &&
+ (!ptr_storage || prop_local->override_store == prop_storage->override_store) &&
+ prop_local->override_store != NULL);
+
+ for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
+ /* Only needed for diff operations. */
+ if (!ELEM(opop->operation,
+ IDOVERRIDESTATIC_OP_ADD,
+ IDOVERRIDESTATIC_OP_SUBTRACT,
+ IDOVERRIDESTATIC_OP_MULTIPLY)) {
+ continue;
+ }
+
+ if (prop_local->override_store(bmain,
+ ptr_local,
+ ptr_reference,
+ ptr_storage,
+ prop_local,
+ prop_reference,
+ prop_storage,
+ len_local,
+ len_reference,
+ len_storage,
+ opop)) {
+ changed = true;
+ }
+ }
+
+ return changed;
+}
+
+static bool rna_property_override_operation_apply(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_override,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_local,
+ PropertyRNA *prop_override,
+ PropertyRNA *prop_storage,
+ PointerRNA *ptr_item_local,
+ PointerRNA *ptr_item_override,
+ PointerRNA *ptr_item_storage,
+ IDOverrideStaticPropertyOperation *opop)
+{
+ int len_local, len_reference, len_storage = 0;
+
+ const short override_op = opop->operation;
+
+ if (override_op == IDOVERRIDESTATIC_OP_NOOP) {
+ return true;
+ }
+
+ if (ELEM(override_op,
+ IDOVERRIDESTATIC_OP_ADD,
+ IDOVERRIDESTATIC_OP_SUBTRACT,
+ IDOVERRIDESTATIC_OP_MULTIPLY) &&
+ !ptr_storage) {
+ /* We cannot apply 'diff' override operations without some reference storage.
+ * This should typically only happen at read time of .blend file... */
+ return false;
+ }
+
+ if (ELEM(override_op,
+ IDOVERRIDESTATIC_OP_ADD,
+ IDOVERRIDESTATIC_OP_SUBTRACT,
+ IDOVERRIDESTATIC_OP_MULTIPLY) &&
+ !prop_storage) {
+ /* We cannot apply 'diff' override operations without some reference storage.
+ * This should typically only happen at read time of .blend file... */
+ return false;
+ }
+
+ RNAPropOverrideApply override_apply = NULL;
+ /* Special case for IDProps, we use default callback then. */
+ if (prop_local->magic != RNA_MAGIC) {
+ override_apply = rna_property_override_apply_default;
+ if (prop_override->magic == RNA_MAGIC && prop_override->override_apply != override_apply) {
+ override_apply = NULL;
+ }
+ }
+ else if (prop_override->magic != RNA_MAGIC) {
+ override_apply = rna_property_override_apply_default;
+ if (prop_local->override_apply != override_apply) {
+ override_apply = NULL;
+ }
+ }
+ else if (prop_local->override_apply == prop_override->override_apply) {
+ override_apply = prop_local->override_apply;
+ }
+
+ if (ptr_storage && prop_storage->magic == RNA_MAGIC &&
+ prop_storage->override_apply != override_apply) {
+ override_apply = NULL;
+ }
+
+ if (override_apply == NULL) {
#ifndef NDEBUG
- printf("'%s' gives unmatching or NULL RNA copy callbacks, should not happen (%d vs. %d).\n",
- prop_local->magic != RNA_MAGIC ? ((IDProperty *)prop_local)->name : prop_local->identifier,
- prop_local->magic == RNA_MAGIC, prop_override->magic == RNA_MAGIC);
+ printf("'%s' gives unmatching or NULL RNA copy callbacks, should not happen (%d vs. %d).\n",
+ prop_local->magic != RNA_MAGIC ? ((IDProperty *)prop_local)->name :
+ prop_local->identifier,
+ prop_local->magic == RNA_MAGIC,
+ prop_override->magic == RNA_MAGIC);
#endif
- BLI_assert(0);
- return false;
- }
-
- /* get the length of the array to work with */
- len_local = RNA_property_array_length(ptr_local, prop_local);
- len_reference = RNA_property_array_length(ptr_override, prop_override);
- if (ptr_storage) {
- len_storage = RNA_property_array_length(ptr_storage, prop_storage);
- }
-
- if (len_local != len_reference || (ptr_storage && len_local != len_storage)) {
- /* Do not handle override in that case, we do not support insertion/deletion from arrays for now. */
- return false;
- }
-
- /* get and set the default values as appropriate for the various types */
- return override_apply(
- bmain,
- ptr_local, ptr_override, ptr_storage,
- prop_local, prop_override, prop_storage,
- len_local, len_reference, len_storage,
- ptr_item_local, ptr_item_override, ptr_item_storage,
- opop);
+ BLI_assert(0);
+ return false;
+ }
+
+ /* get the length of the array to work with */
+ len_local = RNA_property_array_length(ptr_local, prop_local);
+ len_reference = RNA_property_array_length(ptr_override, prop_override);
+ if (ptr_storage) {
+ len_storage = RNA_property_array_length(ptr_storage, prop_storage);
+ }
+
+ if (len_local != len_reference || (ptr_storage && len_local != len_storage)) {
+ /* Do not handle override in that case, we do not support insertion/deletion from arrays for now. */
+ return false;
+ }
+
+ /* get and set the default values as appropriate for the various types */
+ return override_apply(bmain,
+ ptr_local,
+ ptr_override,
+ ptr_storage,
+ prop_local,
+ prop_override,
+ prop_storage,
+ len_local,
+ len_reference,
+ len_storage,
+ ptr_item_local,
+ ptr_item_override,
+ ptr_item_storage,
+ opop);
}
/**
@@ -7845,454 +8123,515 @@ static bool rna_property_override_operation_apply(
*
* \return True if _resulting_ \a ptr_local does match \a ptr_reference.
*/
-bool RNA_struct_override_matches(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_reference, const char *root_path,
- IDOverrideStatic *override, const eRNAOverrideMatch flags,
- eRNAOverrideMatchResult *r_report_flags)
-{
- CollectionPropertyIterator iter;
- PropertyRNA *iterprop;
- bool matching = true;
-
- BLI_assert(ptr_local->type == ptr_reference->type);
- BLI_assert(ptr_local->id.data && ptr_reference->id.data);
-
- const bool ignore_non_overridable = (flags & RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE) != 0;
- const bool ignore_overridden = (flags & RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN) != 0;
- const bool do_create = (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0;
- const bool do_restore = (flags & RNA_OVERRIDE_COMPARE_RESTORE) != 0;
+bool RNA_struct_override_matches(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_reference,
+ const char *root_path,
+ IDOverrideStatic *override,
+ const eRNAOverrideMatch flags,
+ eRNAOverrideMatchResult *r_report_flags)
+{
+ CollectionPropertyIterator iter;
+ PropertyRNA *iterprop;
+ bool matching = true;
+
+ BLI_assert(ptr_local->type == ptr_reference->type);
+ BLI_assert(ptr_local->id.data && ptr_reference->id.data);
+
+ const bool ignore_non_overridable = (flags & RNA_OVERRIDE_COMPARE_IGNORE_NON_OVERRIDABLE) != 0;
+ const bool ignore_overridden = (flags & RNA_OVERRIDE_COMPARE_IGNORE_OVERRIDDEN) != 0;
+ const bool do_create = (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0;
+ const bool do_restore = (flags & RNA_OVERRIDE_COMPARE_RESTORE) != 0;
//#define DEBUG_OVERRIDE_TIMEIT
#ifdef DEBUG_OVERRIDE_TIMEIT
- static float _sum_time_global = 0.0f;
- static float _num_time_global = 0.0f;
- double _timeit_time_global;
- static float _sum_time_diffing = 0.0f;
- static float _delta_time_diffing = 0.0f;
- static int _num_delta_time_diffing = 0.0f;
- static float _num_time_diffing = 0.0f;
- double _timeit_time_diffing;
-
- if (!root_path) {
- _delta_time_diffing = 0.0f;
- _num_delta_time_diffing = 0;
- _timeit_time_global = PIL_check_seconds_timer();
- }
+ static float _sum_time_global = 0.0f;
+ static float _num_time_global = 0.0f;
+ double _timeit_time_global;
+ static float _sum_time_diffing = 0.0f;
+ static float _delta_time_diffing = 0.0f;
+ static int _num_delta_time_diffing = 0.0f;
+ static float _num_time_diffing = 0.0f;
+ double _timeit_time_diffing;
+
+ if (!root_path) {
+ _delta_time_diffing = 0.0f;
+ _num_delta_time_diffing = 0;
+ _timeit_time_global = PIL_check_seconds_timer();
+ }
#endif
- iterprop = RNA_struct_iterator_property(ptr_local->type);
+ iterprop = RNA_struct_iterator_property(ptr_local->type);
- for (RNA_property_collection_begin(ptr_local, iterprop, &iter); iter.valid; RNA_property_collection_next(&iter)) {
- PropertyRNA *prop_local = iter.ptr.data;
- PropertyRNA *prop_reference = iter.ptr.data;
+ for (RNA_property_collection_begin(ptr_local, iterprop, &iter); iter.valid;
+ RNA_property_collection_next(&iter)) {
+ PropertyRNA *prop_local = iter.ptr.data;
+ PropertyRNA *prop_reference = iter.ptr.data;
- /* Ensure we get real property data, be it an actual RNA property, or an IDProperty in disguise. */
- prop_local = rna_ensure_property_realdata(&prop_local, ptr_local);
- prop_reference = rna_ensure_property_realdata(&prop_reference, ptr_reference);
+ /* Ensure we get real property data, be it an actual RNA property, or an IDProperty in disguise. */
+ prop_local = rna_ensure_property_realdata(&prop_local, ptr_local);
+ prop_reference = rna_ensure_property_realdata(&prop_reference, ptr_reference);
- if (ELEM(NULL, prop_local, prop_reference)) {
- continue;
- }
+ if (ELEM(NULL, prop_local, prop_reference)) {
+ continue;
+ }
- if (ignore_non_overridable && !RNA_property_overridable_get(ptr_local, prop_local)) {
- continue;
- }
+ if (ignore_non_overridable && !RNA_property_overridable_get(ptr_local, prop_local)) {
+ continue;
+ }
-#if 0 /* This actually makes things slower, since it has to check for animation paths etc! */
- if (RNA_property_animated(ptr_local, prop_local)) {
- /* We cannot do anything here really, animation is some kind of dynamic overrides that has
- * precedence over static one... */
- continue;
- }
+#if 0 /* This actually makes things slower, since it has to check for animation paths etc! */
+ if (RNA_property_animated(ptr_local, prop_local)) {
+ /* We cannot do anything here really, animation is some kind of dynamic overrides that has
+ * precedence over static one... */
+ continue;
+ }
#endif
#define RNA_PATH_BUFFSIZE 8192
#define RNA_PATH_PRINTF(_str, ...) \
- if (BLI_snprintf(rna_path, RNA_PATH_BUFFSIZE, \
- (_str), __VA_ARGS__) >= RNA_PATH_BUFFSIZE) \
- { rna_path = BLI_sprintfN((_str), __VA_ARGS__); }(void)0
+ if (BLI_snprintf(rna_path, RNA_PATH_BUFFSIZE, (_str), __VA_ARGS__) >= RNA_PATH_BUFFSIZE) { \
+ rna_path = BLI_sprintfN((_str), __VA_ARGS__); \
+ } \
+ (void)0
#define RNA_PATH_FREE \
- if (rna_path != rna_path_buffer) MEM_freeN(rna_path)
-
- char rna_path_buffer[RNA_PATH_BUFFSIZE];
- char *rna_path = rna_path_buffer;
-
- /* XXX TODO this will have to be refined to handle collections insertions, and array items */
- if (root_path) {
- /* Inlined building, much much more efficient. */
- if (prop_local->magic == RNA_MAGIC) {
- RNA_PATH_PRINTF("%s.%s", root_path, RNA_property_identifier(prop_local));
- }
- else {
- RNA_PATH_PRINTF("%s[\"%s\"]", root_path, RNA_property_identifier(prop_local));
- }
- }
- else {
- /* This is rather slow, but is not much called, so not really worth optimizing. */
- rna_path = RNA_path_from_ID_to_property(ptr_local, prop_local);
- }
- if (rna_path == NULL) {
- continue;
- }
-
-// printf("Override Checking %s\n", rna_path);
-
- if (ignore_overridden && BKE_override_static_property_find(override, rna_path) != NULL) {
- RNA_PATH_FREE;
- continue;
- }
+ if (rna_path != rna_path_buffer) \
+ MEM_freeN(rna_path)
+
+ char rna_path_buffer[RNA_PATH_BUFFSIZE];
+ char *rna_path = rna_path_buffer;
+
+ /* XXX TODO this will have to be refined to handle collections insertions, and array items */
+ if (root_path) {
+ /* Inlined building, much much more efficient. */
+ if (prop_local->magic == RNA_MAGIC) {
+ RNA_PATH_PRINTF("%s.%s", root_path, RNA_property_identifier(prop_local));
+ }
+ else {
+ RNA_PATH_PRINTF("%s[\"%s\"]", root_path, RNA_property_identifier(prop_local));
+ }
+ }
+ else {
+ /* This is rather slow, but is not much called, so not really worth optimizing. */
+ rna_path = RNA_path_from_ID_to_property(ptr_local, prop_local);
+ }
+ if (rna_path == NULL) {
+ continue;
+ }
+
+ // printf("Override Checking %s\n", rna_path);
+
+ if (ignore_overridden && BKE_override_static_property_find(override, rna_path) != NULL) {
+ RNA_PATH_FREE;
+ continue;
+ }
#ifdef DEBUG_OVERRIDE_TIMEIT
- if (!root_path) {
- _timeit_time_diffing = PIL_check_seconds_timer();
- }
+ if (!root_path) {
+ _timeit_time_diffing = PIL_check_seconds_timer();
+ }
#endif
- eRNAOverrideMatchResult report_flags = 0;
- const int diff = rna_property_override_diff(
- bmain,
- ptr_local, ptr_reference, NULL, prop_local, prop_reference, rna_path,
- RNA_EQ_STRICT, override, flags, &report_flags);
+ eRNAOverrideMatchResult report_flags = 0;
+ const int diff = rna_property_override_diff(bmain,
+ ptr_local,
+ ptr_reference,
+ NULL,
+ prop_local,
+ prop_reference,
+ rna_path,
+ RNA_EQ_STRICT,
+ override,
+ flags,
+ &report_flags);
#ifdef DEBUG_OVERRIDE_TIMEIT
- if (!root_path) {
- const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time_diffing);
- _delta_time_diffing += _delta_time;
- _num_delta_time_diffing++;
- }
+ if (!root_path) {
+ const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time_diffing);
+ _delta_time_diffing += _delta_time;
+ _num_delta_time_diffing++;
+ }
#endif
- matching = matching && diff == 0;
- if (r_report_flags) {
- *r_report_flags |= report_flags;
- }
-
- if (diff != 0) {
- /* XXX TODO: refine this for per-item overriding of arrays... */
- IDOverrideStaticProperty *op = BKE_override_static_property_find(override, rna_path);
- IDOverrideStaticPropertyOperation *opop = op ? op->operations.first : NULL;
-
- if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) {
- /* We are allowed to restore to reference's values. */
- if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDESTATIC_OP_NOOP) {
- /* We should restore that property to its reference value */
- if (RNA_property_editable(ptr_local, prop_local)) {
- IDOverrideStaticPropertyOperation opop_tmp = {
- .operation = IDOVERRIDESTATIC_OP_REPLACE,
- .subitem_reference_index = -1,
- .subitem_local_index = -1,
- };
- rna_property_override_operation_apply(
- bmain,
- ptr_local, ptr_reference, NULL,
- prop_local, prop_reference, NULL,
- NULL, NULL, NULL,
- &opop_tmp);
- if (r_report_flags) {
- *r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_RESTORED;
- }
- }
- else {
- /* Too noisy for now, this triggers on runtime props like transform matrices etc. */
- /* BLI_assert(!"We have differences between reference and overriding data on non-editable property."); */
- matching = false;
- }
- }
- }
- else if ((report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0 && ELEM(NULL, op, opop)) {
- /* This property is not overridden, and differs from reference, so we have no match. */
- matching = false;
- if (!(do_create || do_restore)) {
- /* Since we have no 'changing' action allowed, we can break here. */
- MEM_SAFE_FREE(rna_path);
- break;
- }
- }
- }
-
- RNA_PATH_FREE;
+ matching = matching && diff == 0;
+ if (r_report_flags) {
+ *r_report_flags |= report_flags;
+ }
+
+ if (diff != 0) {
+ /* XXX TODO: refine this for per-item overriding of arrays... */
+ IDOverrideStaticProperty *op = BKE_override_static_property_find(override, rna_path);
+ IDOverrideStaticPropertyOperation *opop = op ? op->operations.first : NULL;
+
+ if (do_restore && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0) {
+ /* We are allowed to restore to reference's values. */
+ if (ELEM(NULL, op, opop) || opop->operation == IDOVERRIDESTATIC_OP_NOOP) {
+ /* We should restore that property to its reference value */
+ if (RNA_property_editable(ptr_local, prop_local)) {
+ IDOverrideStaticPropertyOperation opop_tmp = {
+ .operation = IDOVERRIDESTATIC_OP_REPLACE,
+ .subitem_reference_index = -1,
+ .subitem_local_index = -1,
+ };
+ rna_property_override_operation_apply(bmain,
+ ptr_local,
+ ptr_reference,
+ NULL,
+ prop_local,
+ prop_reference,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ &opop_tmp);
+ if (r_report_flags) {
+ *r_report_flags |= RNA_OVERRIDE_MATCH_RESULT_RESTORED;
+ }
+ }
+ else {
+ /* Too noisy for now, this triggers on runtime props like transform matrices etc. */
+ /* BLI_assert(!"We have differences between reference and overriding data on non-editable property."); */
+ matching = false;
+ }
+ }
+ }
+ else if ((report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) == 0 && ELEM(NULL, op, opop)) {
+ /* This property is not overridden, and differs from reference, so we have no match. */
+ matching = false;
+ if (!(do_create || do_restore)) {
+ /* Since we have no 'changing' action allowed, we can break here. */
+ MEM_SAFE_FREE(rna_path);
+ break;
+ }
+ }
+ }
+
+ RNA_PATH_FREE;
#undef RNA_PATH_BUFFSIZE
#undef RNA_PATH_PRINTF
#undef RNA_PATH_FREE
- }
- RNA_property_collection_end(&iter);
+ }
+ RNA_property_collection_end(&iter);
#ifdef DEBUG_OVERRIDE_TIMEIT
- if (!root_path) {
- const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time_global);
- _sum_time_global += _delta_time;
- _num_time_global++;
- _sum_time_diffing += _delta_time_diffing;
- _num_time_diffing++;
- printf("ID: %s\n", ((ID *)ptr_local->id.data)->name);
- printf("time end (%s): %.6f\n", __func__, _delta_time);
- printf("time averaged (%s): %.6f (total: %.6f, in %d runs)\n", __func__,
- (_sum_time_global / _num_time_global), _sum_time_global, (int)_num_time_global);
- printf("diffing time end (%s): %.6f (in %d runs)\n", __func__, _delta_time_diffing, _num_delta_time_diffing);
- printf("diffing time averaged (%s): %.6f (total: %.6f, in %d runs)\n", __func__,
- (_sum_time_diffing / _num_time_diffing), _sum_time_diffing, (int)_num_time_diffing);
- }
+ if (!root_path) {
+ const float _delta_time = (float)(PIL_check_seconds_timer() - _timeit_time_global);
+ _sum_time_global += _delta_time;
+ _num_time_global++;
+ _sum_time_diffing += _delta_time_diffing;
+ _num_time_diffing++;
+ printf("ID: %s\n", ((ID *)ptr_local->id.data)->name);
+ printf("time end (%s): %.6f\n", __func__, _delta_time);
+ printf("time averaged (%s): %.6f (total: %.6f, in %d runs)\n",
+ __func__,
+ (_sum_time_global / _num_time_global),
+ _sum_time_global,
+ (int)_num_time_global);
+ printf("diffing time end (%s): %.6f (in %d runs)\n",
+ __func__,
+ _delta_time_diffing,
+ _num_delta_time_diffing);
+ printf("diffing time averaged (%s): %.6f (total: %.6f, in %d runs)\n",
+ __func__,
+ (_sum_time_diffing / _num_time_diffing),
+ _sum_time_diffing,
+ (int)_num_time_diffing);
+ }
#endif
- return matching;
+ return matching;
}
-
/** Store needed second operands into \a storage data-block for differential override operations. */
-bool RNA_struct_override_store(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage, IDOverrideStatic *override)
+bool RNA_struct_override_store(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_reference,
+ PointerRNA *ptr_storage,
+ IDOverrideStatic *override)
{
- bool changed = false;
+ bool changed = false;
#ifdef DEBUG_OVERRIDE_TIMEIT
- TIMEIT_START_AVERAGED(RNA_struct_override_store);
+ TIMEIT_START_AVERAGED(RNA_struct_override_store);
#endif
- for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) {
- /* Simplified for now! */
- PointerRNA data_reference, data_local;
- PropertyRNA *prop_reference, *prop_local;
-
- if (RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local) &&
- RNA_path_resolve_property(ptr_reference, op->rna_path, &data_reference, &prop_reference))
- {
- PointerRNA data_storage;
- PropertyRNA *prop_storage = NULL;
-
- /* It is totally OK if this does not success, only a subset of override operations actually need storage. */
- if (ptr_storage && (ptr_storage->id.data != NULL)) {
- RNA_path_resolve_property(ptr_storage, op->rna_path, &data_storage, &prop_storage);
- }
-
- if (rna_property_override_operation_store(
- bmain,
- &data_local, &data_reference, &data_storage,
- prop_reference, prop_local, prop_storage,
- op))
- {
- changed = true;
- }
- }
- }
+ for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) {
+ /* Simplified for now! */
+ PointerRNA data_reference, data_local;
+ PropertyRNA *prop_reference, *prop_local;
+
+ if (RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local) &&
+ RNA_path_resolve_property(ptr_reference, op->rna_path, &data_reference, &prop_reference)) {
+ PointerRNA data_storage;
+ PropertyRNA *prop_storage = NULL;
+
+ /* It is totally OK if this does not success, only a subset of override operations actually need storage. */
+ if (ptr_storage && (ptr_storage->id.data != NULL)) {
+ RNA_path_resolve_property(ptr_storage, op->rna_path, &data_storage, &prop_storage);
+ }
+
+ if (rna_property_override_operation_store(bmain,
+ &data_local,
+ &data_reference,
+ &data_storage,
+ prop_reference,
+ prop_local,
+ prop_storage,
+ op)) {
+ changed = true;
+ }
+ }
+ }
#ifdef DEBUG_OVERRIDE_TIMEIT
- TIMEIT_END_AVERAGED(RNA_struct_override_store);
+ TIMEIT_END_AVERAGED(RNA_struct_override_store);
#endif
- return changed;
-}
-
-static void rna_property_override_apply_ex(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage,
- PropertyRNA *prop_local, PropertyRNA *prop_override, PropertyRNA *prop_storage,
- PointerRNA *ptr_item_local, PointerRNA *ptr_item_override, PointerRNA *ptr_item_storage,
- IDOverrideStaticProperty *op, const bool do_insert)
-{
- for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
- if (!do_insert != !ELEM(opop->operation, IDOVERRIDESTATIC_OP_INSERT_AFTER, IDOVERRIDESTATIC_OP_INSERT_BEFORE)) {
- if (!do_insert) {
- printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path);
- }
- continue;
- }
- if (!rna_property_override_operation_apply(
- bmain,
- ptr_local, ptr_override, ptr_storage,
- prop_local, prop_override, prop_storage,
- ptr_item_local, ptr_item_override, ptr_item_storage,
- opop))
- {
- /* TODO No assert here, would be much much better to just report as warning,
- * failing override applications will probably be fairly common! */
- BLI_assert(0);
- }
- }
+ return changed;
+}
+
+static void rna_property_override_apply_ex(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_override,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_local,
+ PropertyRNA *prop_override,
+ PropertyRNA *prop_storage,
+ PointerRNA *ptr_item_local,
+ PointerRNA *ptr_item_override,
+ PointerRNA *ptr_item_storage,
+ IDOverrideStaticProperty *op,
+ const bool do_insert)
+{
+ for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop; opop = opop->next) {
+ if (!do_insert != !ELEM(opop->operation,
+ IDOVERRIDESTATIC_OP_INSERT_AFTER,
+ IDOVERRIDESTATIC_OP_INSERT_BEFORE)) {
+ if (!do_insert) {
+ printf("Skipping insert override operations in first pass (%s)!\n", op->rna_path);
+ }
+ continue;
+ }
+ if (!rna_property_override_operation_apply(bmain,
+ ptr_local,
+ ptr_override,
+ ptr_storage,
+ prop_local,
+ prop_override,
+ prop_storage,
+ ptr_item_local,
+ ptr_item_override,
+ ptr_item_storage,
+ opop)) {
+ /* TODO No assert here, would be much much better to just report as warning,
+ * failing override applications will probably be fairly common! */
+ BLI_assert(0);
+ }
+ }
}
/** Apply given \a override operations on \a ptr_local, using \a ptr_override
* (and \a ptr_storage form differential ops) as source. */
-void RNA_struct_override_apply(
- Main *bmain,
- PointerRNA *ptr_local, PointerRNA *ptr_override, PointerRNA *ptr_storage, IDOverrideStatic *override)
+void RNA_struct_override_apply(Main *bmain,
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_override,
+ PointerRNA *ptr_storage,
+ IDOverrideStatic *override)
{
#ifdef DEBUG_OVERRIDE_TIMEIT
- TIMEIT_START_AVERAGED(RNA_struct_override_apply);
+ TIMEIT_START_AVERAGED(RNA_struct_override_apply);
#endif
- /* Note: Applying insert operations in a separate pass is mandatory.
- * We could optimize this later, but for now, as inneficient as it is, don't think this is a critical point.
- */
- bool do_insert = false;
- for (int i = 0; i < 2; i++, do_insert = true) {
- for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) {
- /* Simplified for now! */
- PointerRNA data_override, data_local;
- PointerRNA data_item_override, data_item_local;
- PropertyRNA *prop_override, *prop_local;
-
- if (RNA_path_resolve_property_and_item_pointer(
- ptr_local, op->rna_path, &data_local, &prop_local, &data_item_local) &&
- RNA_path_resolve_property_and_item_pointer(
- ptr_override, op->rna_path, &data_override, &prop_override, &data_item_override))
- {
- PointerRNA data_storage, data_item_storage;
- PropertyRNA *prop_storage = NULL;
-
- /* It is totally OK if this does not success, only a subset of override operations actually need storage. */
- if (ptr_storage && (ptr_storage->id.data != NULL)) {
- RNA_path_resolve_property_and_item_pointer(
- ptr_storage, op->rna_path, &data_storage, &prop_storage, &data_item_storage);
- }
-
- rna_property_override_apply_ex(
- bmain,
- &data_local, &data_override, prop_storage ? &data_storage : NULL,
- prop_local, prop_override, prop_storage,
- &data_item_local, &data_item_override, prop_storage ? &data_item_storage : NULL,
- op, do_insert);
- }
+ /* Note: Applying insert operations in a separate pass is mandatory.
+ * We could optimize this later, but for now, as inneficient as it is, don't think this is a critical point.
+ */
+ bool do_insert = false;
+ for (int i = 0; i < 2; i++, do_insert = true) {
+ for (IDOverrideStaticProperty *op = override->properties.first; op; op = op->next) {
+ /* Simplified for now! */
+ PointerRNA data_override, data_local;
+ PointerRNA data_item_override, data_item_local;
+ PropertyRNA *prop_override, *prop_local;
+
+ if (RNA_path_resolve_property_and_item_pointer(
+ ptr_local, op->rna_path, &data_local, &prop_local, &data_item_local) &&
+ RNA_path_resolve_property_and_item_pointer(
+ ptr_override, op->rna_path, &data_override, &prop_override, &data_item_override)) {
+ PointerRNA data_storage, data_item_storage;
+ PropertyRNA *prop_storage = NULL;
+
+ /* It is totally OK if this does not success, only a subset of override operations actually need storage. */
+ if (ptr_storage && (ptr_storage->id.data != NULL)) {
+ RNA_path_resolve_property_and_item_pointer(
+ ptr_storage, op->rna_path, &data_storage, &prop_storage, &data_item_storage);
+ }
+
+ rna_property_override_apply_ex(bmain,
+ &data_local,
+ &data_override,
+ prop_storage ? &data_storage : NULL,
+ prop_local,
+ prop_override,
+ prop_storage,
+ &data_item_local,
+ &data_item_override,
+ prop_storage ? &data_item_storage : NULL,
+ op,
+ do_insert);
+ }
#ifndef NDEBUG
- else {
- printf("Failed to apply static override operation to '%s.%s' "
- "(could not resolve some properties, local: %d, override: %d)\n",
- ((ID *)ptr_override->id.data)->name, op->rna_path,
- RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local),
- RNA_path_resolve_property(ptr_override, op->rna_path, &data_override, &prop_override));
- }
+ else {
+ printf(
+ "Failed to apply static override operation to '%s.%s' "
+ "(could not resolve some properties, local: %d, override: %d)\n",
+ ((ID *)ptr_override->id.data)->name,
+ op->rna_path,
+ RNA_path_resolve_property(ptr_local, op->rna_path, &data_local, &prop_local),
+ RNA_path_resolve_property(ptr_override, op->rna_path, &data_override, &prop_override));
+ }
#endif
- }
- }
+ }
+ }
#ifdef DEBUG_OVERRIDE_TIMEIT
- TIMEIT_END_AVERAGED(RNA_struct_override_apply);
+ TIMEIT_END_AVERAGED(RNA_struct_override_apply);
#endif
}
IDOverrideStaticProperty *RNA_property_override_property_find(PointerRNA *ptr, PropertyRNA *prop)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- if (!id || !id->override_static) {
- return NULL;
- }
+ if (!id || !id->override_static) {
+ return NULL;
+ }
- char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
- if (rna_path) {
- IDOverrideStaticProperty *op = BKE_override_static_property_find(id->override_static, rna_path);
- MEM_freeN(rna_path);
- return op;
- }
- return NULL;
+ char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
+ if (rna_path) {
+ IDOverrideStaticProperty *op = BKE_override_static_property_find(id->override_static,
+ rna_path);
+ MEM_freeN(rna_path);
+ return op;
+ }
+ return NULL;
}
-IDOverrideStaticProperty *RNA_property_override_property_get(PointerRNA *ptr, PropertyRNA *prop, bool *r_created)
+IDOverrideStaticProperty *RNA_property_override_property_get(PointerRNA *ptr,
+ PropertyRNA *prop,
+ bool *r_created)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- if (!id || !id->override_static) {
- return NULL;
- }
+ if (!id || !id->override_static) {
+ return NULL;
+ }
- char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
- if (rna_path) {
- IDOverrideStaticProperty *op = BKE_override_static_property_get(id->override_static, rna_path, r_created);
- MEM_freeN(rna_path);
- return op;
- }
- return NULL;
+ char *rna_path = RNA_path_from_ID_to_property(ptr, prop);
+ if (rna_path) {
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ id->override_static, rna_path, r_created);
+ MEM_freeN(rna_path);
+ return op;
+ }
+ return NULL;
}
IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_find(
- PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict)
+ PointerRNA *ptr, PropertyRNA *prop, const int index, const bool strict, bool *r_strict)
{
- IDOverrideStaticProperty *op = RNA_property_override_property_find(ptr, prop);
+ IDOverrideStaticProperty *op = RNA_property_override_property_find(ptr, prop);
- if (!op) {
- return NULL;
- }
+ if (!op) {
+ return NULL;
+ }
- return BKE_override_static_property_operation_find(op, NULL, NULL, index, index, strict, r_strict);
+ return BKE_override_static_property_operation_find(
+ op, NULL, NULL, index, index, strict, r_strict);
}
IDOverrideStaticPropertyOperation *RNA_property_override_property_operation_get(
- PointerRNA *ptr, PropertyRNA *prop, const short operation, const int index,
- const bool strict, bool *r_strict, bool *r_created)
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ const short operation,
+ const int index,
+ const bool strict,
+ bool *r_strict,
+ bool *r_created)
{
- IDOverrideStaticProperty *op = RNA_property_override_property_get(ptr, prop, NULL);
+ IDOverrideStaticProperty *op = RNA_property_override_property_get(ptr, prop, NULL);
- if (!op) {
- return NULL;
- }
+ if (!op) {
+ return NULL;
+ }
- return BKE_override_static_property_operation_get(op, operation, NULL, NULL, index, index, strict, r_strict, r_created);
+ return BKE_override_static_property_operation_get(
+ op, operation, NULL, NULL, index, index, strict, r_strict, r_created);
}
-eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr, PropertyRNA *prop, const int index)
+eRNAOverrideStatus RNA_property_static_override_status(PointerRNA *ptr,
+ PropertyRNA *prop,
+ const int index)
{
- int override_status = 0;
+ int override_status = 0;
- if (!BKE_override_static_is_enabled()) {
- return override_status;
- }
+ if (!BKE_override_static_is_enabled()) {
+ return override_status;
+ }
- if (!ptr || !prop || !ptr->id.data || !((ID *)ptr->id.data)->override_static) {
- return override_status;
- }
+ if (!ptr || !prop || !ptr->id.data || !((ID *)ptr->id.data)->override_static) {
+ return override_status;
+ }
- if (RNA_property_overridable_get(ptr, prop) && RNA_property_editable_flag(ptr, prop)) {
- override_status |= RNA_OVERRIDE_STATUS_OVERRIDABLE;
- }
+ if (RNA_property_overridable_get(ptr, prop) && RNA_property_editable_flag(ptr, prop)) {
+ override_status |= RNA_OVERRIDE_STATUS_OVERRIDABLE;
+ }
- IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_find(ptr, prop, index, false, NULL);
- if (opop != NULL) {
- override_status |= RNA_OVERRIDE_STATUS_OVERRIDDEN;
- if (opop->flag & IDOVERRIDESTATIC_FLAG_MANDATORY) {
- override_status |= RNA_OVERRIDE_STATUS_MANDATORY;
- }
- if (opop->flag & IDOVERRIDESTATIC_FLAG_LOCKED) {
- override_status |= RNA_OVERRIDE_STATUS_LOCKED;
- }
- }
+ IDOverrideStaticPropertyOperation *opop = RNA_property_override_property_operation_find(
+ ptr, prop, index, false, NULL);
+ if (opop != NULL) {
+ override_status |= RNA_OVERRIDE_STATUS_OVERRIDDEN;
+ if (opop->flag & IDOVERRIDESTATIC_FLAG_MANDATORY) {
+ override_status |= RNA_OVERRIDE_STATUS_MANDATORY;
+ }
+ if (opop->flag & IDOVERRIDESTATIC_FLAG_LOCKED) {
+ override_status |= RNA_OVERRIDE_STATUS_LOCKED;
+ }
+ }
- return override_status;
+ return override_status;
}
-
-
-bool RNA_path_resolved_create(
- PointerRNA *ptr, struct PropertyRNA *prop,
- const int prop_index,
- PathResolvedRNA *r_anim_rna)
+bool RNA_path_resolved_create(PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ const int prop_index,
+ PathResolvedRNA *r_anim_rna)
{
- int array_len = RNA_property_array_length(ptr, prop);
+ int array_len = RNA_property_array_length(ptr, prop);
- if ((array_len == 0) || (prop_index < array_len)) {
- r_anim_rna->ptr = *ptr;
- r_anim_rna->prop = prop;
- r_anim_rna->prop_index = array_len ? prop_index : -1;
+ if ((array_len == 0) || (prop_index < array_len)) {
+ r_anim_rna->ptr = *ptr;
+ r_anim_rna->prop = prop;
+ r_anim_rna->prop_index = array_len ? prop_index : -1;
- return true;
- }
- else {
- return false;
- }
+ return true;
+ }
+ else {
+ return false;
+ }
}
static char rna_struct_state_owner[64];
void RNA_struct_state_owner_set(const char *name)
{
- if (name) {
- BLI_strncpy(rna_struct_state_owner, name, sizeof(rna_struct_state_owner));
- }
- else {
- rna_struct_state_owner[0] = '\0';
- }
+ if (name) {
+ BLI_strncpy(rna_struct_state_owner, name, sizeof(rna_struct_state_owner));
+ }
+ else {
+ rna_struct_state_owner[0] = '\0';
+ }
}
const char *RNA_struct_state_owner_get(void)
{
- if (rna_struct_state_owner[0]) {
- return rna_struct_state_owner;
- }
- return NULL;
+ if (rna_struct_state_owner[0]) {
+ return rna_struct_state_owner;
+ }
+ return NULL;
}
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index 7d86c42c561..36e9fde9a7a 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -40,704 +40,777 @@
#include "WM_types.h"
-
#ifdef RNA_RUNTIME
-#include "BLI_math_base.h"
+# include "BLI_math_base.h"
-#include "BKE_fcurve.h"
+# include "BKE_fcurve.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_keyframing.h"
+# include "ED_keyframing.h"
-#include "WM_api.h"
+# include "WM_api.h"
static void rna_ActionGroup_channels_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- FCurve *fcu = (FCurve *)internal->link;
- bActionGroup *grp = fcu->grp;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ FCurve *fcu = (FCurve *)internal->link;
+ bActionGroup *grp = fcu->grp;
- /* only continue if the next F-Curve (if existent) belongs in the same group */
- if ((fcu->next) && (fcu->next->grp == grp))
- internal->link = (Link *)fcu->next;
- else
- internal->link = NULL;
+ /* only continue if the next F-Curve (if existent) belongs in the same group */
+ if ((fcu->next) && (fcu->next->grp == grp))
+ internal->link = (Link *)fcu->next;
+ else
+ internal->link = NULL;
- iter->valid = (internal->link != NULL);
+ iter->valid = (internal->link != NULL);
}
static bActionGroup *rna_Action_groups_new(bAction *act, const char name[])
{
- return action_groups_add_new(act, name);
+ return action_groups_add_new(act, name);
}
static void rna_Action_groups_remove(bAction *act, ReportList *reports, PointerRNA *agrp_ptr)
{
- bActionGroup *agrp = agrp_ptr->data;
- FCurve *fcu, *fcn;
-
- /* try to remove the F-Curve from the action */
- if (BLI_remlink_safe(&act->groups, agrp) == false) {
- BKE_reportf(reports, RPT_ERROR, "Action group '%s' not found in action '%s'", agrp->name, act->id.name + 2);
- return;
- }
-
- /* move every one one of the group's F-Curves out into the Action again */
- for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcn) {
- fcn = fcu->next;
-
- /* remove from group */
- action_groups_remove_channel(act, fcu);
-
- /* tack onto the end */
- BLI_addtail(&act->curves, fcu);
- }
-
- MEM_freeN(agrp);
- RNA_POINTER_INVALIDATE(agrp_ptr);
-
- DEG_id_tag_update(&act->id, ID_RECALC_ANIMATION_NO_FLUSH);
- WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ bActionGroup *agrp = agrp_ptr->data;
+ FCurve *fcu, *fcn;
+
+ /* try to remove the F-Curve from the action */
+ if (BLI_remlink_safe(&act->groups, agrp) == false) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Action group '%s' not found in action '%s'",
+ agrp->name,
+ act->id.name + 2);
+ return;
+ }
+
+ /* move every one one of the group's F-Curves out into the Action again */
+ for (fcu = agrp->channels.first; (fcu) && (fcu->grp == agrp); fcu = fcn) {
+ fcn = fcu->next;
+
+ /* remove from group */
+ action_groups_remove_channel(act, fcu);
+
+ /* tack onto the end */
+ BLI_addtail(&act->curves, fcu);
+ }
+
+ MEM_freeN(agrp);
+ RNA_POINTER_INVALIDATE(agrp_ptr);
+
+ DEG_id_tag_update(&act->id, ID_RECALC_ANIMATION_NO_FLUSH);
+ WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
-static FCurve *rna_Action_fcurve_new(bAction *act, Main *bmain, ReportList *reports, const char *data_path,
- int index, const char *group)
+static FCurve *rna_Action_fcurve_new(bAction *act,
+ Main *bmain,
+ ReportList *reports,
+ const char *data_path,
+ int index,
+ const char *group)
{
- if (group && group[0] == '\0') group = NULL;
-
- if (data_path[0] == '\0') {
- BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
- return NULL;
- }
-
- /* annoying, check if this exists */
- if (verify_fcurve(bmain, act, group, NULL, data_path, index, 0)) {
- BKE_reportf(reports, RPT_ERROR, "F-Curve '%s[%d]' already exists in action '%s'", data_path,
- index, act->id.name + 2);
- return NULL;
- }
- return verify_fcurve(bmain, act, group, NULL, data_path, index, 1);
+ if (group && group[0] == '\0')
+ group = NULL;
+
+ if (data_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
+
+ /* annoying, check if this exists */
+ if (verify_fcurve(bmain, act, group, NULL, data_path, index, 0)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "F-Curve '%s[%d]' already exists in action '%s'",
+ data_path,
+ index,
+ act->id.name + 2);
+ return NULL;
+ }
+ return verify_fcurve(bmain, act, group, NULL, data_path, index, 1);
}
-static FCurve *rna_Action_fcurve_find(bAction *act, ReportList *reports, const char *data_path, int index)
+static FCurve *rna_Action_fcurve_find(bAction *act,
+ ReportList *reports,
+ const char *data_path,
+ int index)
{
- if (data_path[0] == '\0') {
- BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
- return NULL;
- }
+ if (data_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
- /* Returns NULL if not found. */
- return list_find_fcurve(&act->curves, data_path, index);
+ /* Returns NULL if not found. */
+ return list_find_fcurve(&act->curves, data_path, index);
}
static void rna_Action_fcurve_remove(bAction *act, ReportList *reports, PointerRNA *fcu_ptr)
{
- FCurve *fcu = fcu_ptr->data;
- if (fcu->grp) {
- if (BLI_findindex(&act->groups, fcu->grp) == -1) {
- BKE_reportf(reports, RPT_ERROR, "F-Curve's action group '%s' not found in action '%s'",
- fcu->grp->name, act->id.name + 2);
- return;
- }
-
- action_groups_remove_channel(act, fcu);
- free_fcurve(fcu);
- RNA_POINTER_INVALIDATE(fcu_ptr);
- }
- else {
- if (BLI_findindex(&act->curves, fcu) == -1) {
- BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name + 2);
- return;
- }
-
- BLI_remlink(&act->curves, fcu);
- free_fcurve(fcu);
- RNA_POINTER_INVALIDATE(fcu_ptr);
- }
-
- DEG_id_tag_update(&act->id, ID_RECALC_ANIMATION_NO_FLUSH);
- WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ FCurve *fcu = fcu_ptr->data;
+ if (fcu->grp) {
+ if (BLI_findindex(&act->groups, fcu->grp) == -1) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "F-Curve's action group '%s' not found in action '%s'",
+ fcu->grp->name,
+ act->id.name + 2);
+ return;
+ }
+
+ action_groups_remove_channel(act, fcu);
+ free_fcurve(fcu);
+ RNA_POINTER_INVALIDATE(fcu_ptr);
+ }
+ else {
+ if (BLI_findindex(&act->curves, fcu) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "F-Curve not found in action '%s'", act->id.name + 2);
+ return;
+ }
+
+ BLI_remlink(&act->curves, fcu);
+ free_fcurve(fcu);
+ RNA_POINTER_INVALIDATE(fcu_ptr);
+ }
+
+ DEG_id_tag_update(&act->id, ID_RECALC_ANIMATION_NO_FLUSH);
+ WM_main_add_notifier(NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
static TimeMarker *rna_Action_pose_markers_new(bAction *act, const char name[])
{
- TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
- marker->flag = 1;
- marker->frame = 1;
- BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
- BLI_addtail(&act->markers, marker);
- return marker;
+ TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
+ marker->flag = 1;
+ marker->frame = 1;
+ BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
+ BLI_addtail(&act->markers, marker);
+ return marker;
}
-static void rna_Action_pose_markers_remove(bAction *act, ReportList *reports, PointerRNA *marker_ptr)
+static void rna_Action_pose_markers_remove(bAction *act,
+ ReportList *reports,
+ PointerRNA *marker_ptr)
{
- TimeMarker *marker = marker_ptr->data;
- if (!BLI_remlink_safe(&act->markers, marker)) {
- BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in action '%s'", marker->name, act->id.name + 2);
- return;
- }
-
- MEM_freeN(marker);
- RNA_POINTER_INVALIDATE(marker_ptr);
+ TimeMarker *marker = marker_ptr->data;
+ if (!BLI_remlink_safe(&act->markers, marker)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Timeline marker '%s' not found in action '%s'",
+ marker->name,
+ act->id.name + 2);
+ return;
+ }
+
+ MEM_freeN(marker);
+ RNA_POINTER_INVALIDATE(marker_ptr);
}
static PointerRNA rna_Action_active_pose_marker_get(PointerRNA *ptr)
{
- bAction *act = (bAction *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_TimelineMarker, BLI_findlink(&act->markers, act->active_marker - 1));
+ bAction *act = (bAction *)ptr->data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_TimelineMarker, BLI_findlink(&act->markers, act->active_marker - 1));
}
static void rna_Action_active_pose_marker_set(PointerRNA *ptr, PointerRNA value)
{
- bAction *act = (bAction *)ptr->data;
- act->active_marker = BLI_findindex(&act->markers, value.data) + 1;
+ bAction *act = (bAction *)ptr->data;
+ act->active_marker = BLI_findindex(&act->markers, value.data) + 1;
}
static int rna_Action_active_pose_marker_index_get(PointerRNA *ptr)
{
- bAction *act = (bAction *)ptr->data;
- return MAX2(act->active_marker - 1, 0);
+ bAction *act = (bAction *)ptr->data;
+ return MAX2(act->active_marker - 1, 0);
}
static void rna_Action_active_pose_marker_index_set(PointerRNA *ptr, int value)
{
- bAction *act = (bAction *)ptr->data;
- act->active_marker = value + 1;
+ bAction *act = (bAction *)ptr->data;
+ act->active_marker = value + 1;
}
-static void rna_Action_active_pose_marker_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Action_active_pose_marker_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- bAction *act = (bAction *)ptr->data;
+ bAction *act = (bAction *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&act->markers) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&act->markers) - 1);
}
-
-
static void rna_Action_frame_range_get(PointerRNA *ptr, float *values)
-{ /* don't include modifiers because they too easily can have very large
- * ranges: MINAFRAMEF to MAXFRAMEF. */
- calc_action_range(ptr->id.data, values, values + 1, false);
+{ /* don't include modifiers because they too easily can have very large
+ * ranges: MINAFRAMEF to MAXFRAMEF. */
+ calc_action_range(ptr->id.data, values, values + 1, false);
}
-
/* used to check if an action (value pointer) is suitable to be assigned to the ID-block that is ptr */
bool rna_Action_id_poll(PointerRNA *ptr, PointerRNA value)
{
- ID *srcId = (ID *)ptr->id.data;
- bAction *act = (bAction *)value.id.data;
-
- if (act) {
- /* there can still be actions that will have undefined id-root
- * (i.e. floating "action-library" members) which we will not
- * be able to resolve an idroot for automatically, so let these through
- */
- if (act->idroot == 0)
- return 1;
- else if (srcId)
- return GS(srcId->name) == act->idroot;
- }
-
- return 0;
+ ID *srcId = (ID *)ptr->id.data;
+ bAction *act = (bAction *)value.id.data;
+
+ if (act) {
+ /* there can still be actions that will have undefined id-root
+ * (i.e. floating "action-library" members) which we will not
+ * be able to resolve an idroot for automatically, so let these through
+ */
+ if (act->idroot == 0)
+ return 1;
+ else if (srcId)
+ return GS(srcId->name) == act->idroot;
+ }
+
+ return 0;
}
/* used to check if an action (value pointer) can be assigned to Action Editor given current mode */
bool rna_Action_actedit_assign_poll(PointerRNA *ptr, PointerRNA value)
{
- SpaceAction *saction = (SpaceAction *)ptr->data;
- bAction *act = (bAction *)value.id.data;
-
- if (act) {
- /* there can still be actions that will have undefined id-root
- * (i.e. floating "action-library" members) which we will not
- * be able to resolve an idroot for automatically, so let these through
- */
- if (act->idroot == 0)
- return 1;
-
- if (saction) {
- if (saction->mode == SACTCONT_ACTION) {
- /* this is only Object-level for now... */
- return act->idroot == ID_OB;
- }
- else if (saction->mode == SACTCONT_SHAPEKEY) {
- /* obviously shapekeys only */
- return act->idroot == ID_KE;
- }
- }
- }
-
- return 0;
+ SpaceAction *saction = (SpaceAction *)ptr->data;
+ bAction *act = (bAction *)value.id.data;
+
+ if (act) {
+ /* there can still be actions that will have undefined id-root
+ * (i.e. floating "action-library" members) which we will not
+ * be able to resolve an idroot for automatically, so let these through
+ */
+ if (act->idroot == 0)
+ return 1;
+
+ if (saction) {
+ if (saction->mode == SACTCONT_ACTION) {
+ /* this is only Object-level for now... */
+ return act->idroot == ID_OB;
+ }
+ else if (saction->mode == SACTCONT_SHAPEKEY) {
+ /* obviously shapekeys only */
+ return act->idroot == ID_KE;
+ }
+ }
+ }
+
+ return 0;
}
#else
static void rna_def_dopesheet(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "DopeSheet", NULL);
- RNA_def_struct_sdna(srna, "bDopeSheet");
- RNA_def_struct_ui_text(srna, "Dope Sheet", "Settings for filtering the channels shown in animation editors");
-
- /* Source of DopeSheet data */
- /* XXX: make this obsolete? */
- prop = RNA_def_property(srna, "source", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_ui_text(prop, "Source",
- "ID-Block representing source data, usually ID_SCE (i.e. Scene)");
-
- /* Show data-block filters */
- prop = RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SHOW_DBFILTERS);
- RNA_def_property_ui_text(prop, "Show Datablock Filters",
- "Show options for whether channels related to certain types of data are included");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN, NULL);
-
- /* General Filtering Settings */
- prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYSEL);
- RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_INCL_HIDDEN);
- RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that are not visible");
- RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "use_datablock_sort", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_NO_DB_SORT);
- RNA_def_property_ui_text(prop, "Sort Data-Blocks",
- "Alphabetically sorts data-blocks - mainly objects in the scene "
- "(disable to increase viewport speed)");
- RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* Debug Filtering Settings */
- prop = RNA_def_property(srna, "show_only_errors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLY_ERRORS);
- RNA_def_property_ui_text(prop, "Show Errors", "Only include F-Curves and drivers that are disabled or have errors");
- RNA_def_property_ui_icon(prop, ICON_ERROR, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* Object Collection Filtering Settings */
- prop = RNA_def_property(srna, "filter_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "filter_grp");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Filtering Collection", "Collection that included object should be a member of");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* FCurve Display Name Search Settings */
- prop = RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "searchstr");
- RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string");
- RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
- RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* NLA Name Search Settings (Shared with FCurve setting, but with different labels) */
- prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "searchstr");
- RNA_def_property_ui_text(prop, "Name Filter", "Live filtering string");
- RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
- RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* Multi-word fuzzy search option for name/text filters */
- prop = RNA_def_property(srna, "use_multi_word_filter", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_FUZZY_NAMES);
- RNA_def_property_ui_text(prop, "Multi-Word Fuzzy Filter",
- "Perform fuzzy/multi-word matching (WARNING: May be slow)");
- RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* NLA Specific Settings */
- prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);
- RNA_def_property_ui_text(prop, "Include Missing NLA",
- "Include animation data-blocks with no NLA data (NLA editor only)");
- RNA_def_property_ui_icon(prop, ICON_ACTION, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* Summary Settings (DopeSheet editors only) */
- prop = RNA_def_property(srna, "show_summary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SUMMARY);
- RNA_def_property_ui_text(prop, "Display Summary", "Display an additional 'summary' line (Dope Sheet editors only)");
- RNA_def_property_ui_icon(prop, ICON_BORDERMOVE, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_expanded_summary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED);
- RNA_def_property_ui_text(prop, "Collapse Summary",
- "Collapse summary when shown, so all other channels get hidden (Dope Sheet editors only)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
-
- /* General DataType Filtering Settings */
- prop = RNA_def_property(srna, "show_transforms", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOOBJ);
- RNA_def_property_ui_text(prop, "Display Transforms",
- "Include visualization of object-level animation data (mostly transforms)");
- RNA_def_property_ui_icon(prop, ICON_ORIENTATION_GLOBAL, 0); /* XXX? */
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_shapekeys", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSHAPEKEYS);
- RNA_def_property_ui_text(prop, "Display Shapekeys", "Include visualization of shape key related animation data");
- RNA_def_property_ui_icon(prop, ICON_SHAPEKEY_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_modifiers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMODIFIERS);
- RNA_def_property_ui_text(prop, "Display Modifier Data",
- "Include visualization of animation data related to data-blocks linked to modifiers");
- RNA_def_property_ui_icon(prop, ICON_MODIFIER_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_meshes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMESH);
- RNA_def_property_ui_text(prop, "Display Meshes", "Include visualization of mesh related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_MESH, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_lattices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAT);
- RNA_def_property_ui_text(prop, "Display Lattices", "Include visualization of lattice related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LATTICE, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCAM);
- RNA_def_property_ui_text(prop, "Display Camera", "Include visualization of camera related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_CAMERA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_materials", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMAT);
- RNA_def_property_ui_text(prop, "Display Material", "Include visualization of material related animation data");
- RNA_def_property_ui_icon(prop, ICON_MATERIAL_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_lights", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAM);
- RNA_def_property_ui_text(prop, "Display Light", "Include visualization of light related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LIGHT, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_linestyles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLINESTYLE);
- RNA_def_property_ui_text(prop, "Display Line Style", "Include visualization of Line Style related Animation data");
- RNA_def_property_ui_icon(prop, ICON_LINE_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_textures", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX);
- RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of texture related animation data");
- RNA_def_property_ui_icon(prop, ICON_TEXTURE_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_curves", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCUR);
- RNA_def_property_ui_text(prop, "Display Curve", "Include visualization of curve related animation data");
- RNA_def_property_ui_icon(prop, ICON_CURVE_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_worlds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOWOR);
- RNA_def_property_ui_text(prop, "Display World", "Include visualization of world related animation data");
- RNA_def_property_ui_icon(prop, ICON_WORLD_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_scenes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSCE);
- RNA_def_property_ui_text(prop, "Display Scene", "Include visualization of scene related animation data");
- RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOPART);
- RNA_def_property_ui_text(prop, "Display Particle", "Include visualization of particle related animation data");
- RNA_def_property_ui_icon(prop, ICON_PARTICLE_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_metaballs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMBA);
- RNA_def_property_ui_text(prop, "Display Metaball", "Include visualization of metaball related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_META, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOARM);
- RNA_def_property_ui_text(prop, "Display Armature", "Include visualization of armature related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_ARMATURE, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NONTREE);
- RNA_def_property_ui_text(prop, "Display Node", "Include visualization of node related animation data");
- RNA_def_property_ui_icon(prop, ICON_NODETREE, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_speakers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSPK);
- RNA_def_property_ui_text(prop, "Display Speaker", "Include visualization of speaker related animation data");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_SPEAKER, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_cache_files", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOCACHEFILES);
- RNA_def_property_ui_text(prop, "Display Cache Files", "Include visualization of cache file related animation data");
- RNA_def_property_ui_icon(prop, ICON_FILE, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_gpencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOGPENCIL);
- RNA_def_property_ui_text(prop, "Display Grease Pencil", "Include visualization of Grease Pencil related animation data and frames");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_GREASEPENCIL, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* GPencil Mode Settings */
- prop = RNA_def_property(srna, "show_gpencil_3d_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_GP_3DONLY);
- RNA_def_property_ui_text(prop, "Active Scene Only",
- "Only show Grease Pencil data-blocks used as part of the active scene");
- RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "DopeSheet", NULL);
+ RNA_def_struct_sdna(srna, "bDopeSheet");
+ RNA_def_struct_ui_text(
+ srna, "Dope Sheet", "Settings for filtering the channels shown in animation editors");
+
+ /* Source of DopeSheet data */
+ /* XXX: make this obsolete? */
+ prop = RNA_def_property(srna, "source", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_ui_text(
+ prop, "Source", "ID-Block representing source data, usually ID_SCE (i.e. Scene)");
+
+ /* Show data-block filters */
+ prop = RNA_def_property(srna, "show_datablock_filters", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_SHOW_DBFILTERS);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Datablock Filters",
+ "Show options for whether channels related to certain types of data are included");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN, NULL);
+
+ /* General Filtering Settings */
+ prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYSEL);
+ RNA_def_property_ui_text(
+ prop, "Only Selected", "Only include channels relating to selected objects and data");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_INCL_HIDDEN);
+ RNA_def_property_ui_text(
+ prop, "Display Hidden", "Include channels from objects/bone that are not visible");
+ RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "use_datablock_sort", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_NO_DB_SORT);
+ RNA_def_property_ui_text(prop,
+ "Sort Data-Blocks",
+ "Alphabetically sorts data-blocks - mainly objects in the scene "
+ "(disable to increase viewport speed)");
+ RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* Debug Filtering Settings */
+ prop = RNA_def_property(srna, "show_only_errors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLY_ERRORS);
+ RNA_def_property_ui_text(
+ prop, "Show Errors", "Only include F-Curves and drivers that are disabled or have errors");
+ RNA_def_property_ui_icon(prop, ICON_ERROR, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* Object Collection Filtering Settings */
+ prop = RNA_def_property(srna, "filter_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "filter_grp");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Filtering Collection", "Collection that included object should be a member of");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* FCurve Display Name Search Settings */
+ prop = RNA_def_property(srna, "filter_fcurve_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "searchstr");
+ RNA_def_property_ui_text(prop, "F-Curve Name Filter", "F-Curve live filtering string");
+ RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* NLA Name Search Settings (Shared with FCurve setting, but with different labels) */
+ prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "searchstr");
+ RNA_def_property_ui_text(prop, "Name Filter", "Live filtering string");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* Multi-word fuzzy search option for name/text filters */
+ prop = RNA_def_property(srna, "use_multi_word_filter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ADS_FLAG_FUZZY_NAMES);
+ RNA_def_property_ui_text(
+ prop, "Multi-Word Fuzzy Filter", "Perform fuzzy/multi-word matching (WARNING: May be slow)");
+ RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* NLA Specific Settings */
+ prop = RNA_def_property(srna, "show_missing_nla", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NLA_NOACT);
+ RNA_def_property_ui_text(prop,
+ "Include Missing NLA",
+ "Include animation data-blocks with no NLA data (NLA editor only)");
+ RNA_def_property_ui_icon(prop, ICON_ACTION, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* Summary Settings (DopeSheet editors only) */
+ prop = RNA_def_property(srna, "show_summary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_SUMMARY);
+ RNA_def_property_ui_text(
+ prop, "Display Summary", "Display an additional 'summary' line (Dope Sheet editors only)");
+ RNA_def_property_ui_icon(prop, ICON_BORDERMOVE, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_expanded_summary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADS_FLAG_SUMMARY_COLLAPSED);
+ RNA_def_property_ui_text(
+ prop,
+ "Collapse Summary",
+ "Collapse summary when shown, so all other channels get hidden (Dope Sheet editors only)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* General DataType Filtering Settings */
+ prop = RNA_def_property(srna, "show_transforms", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOOBJ);
+ RNA_def_property_ui_text(
+ prop,
+ "Display Transforms",
+ "Include visualization of object-level animation data (mostly transforms)");
+ RNA_def_property_ui_icon(prop, ICON_ORIENTATION_GLOBAL, 0); /* XXX? */
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_shapekeys", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSHAPEKEYS);
+ RNA_def_property_ui_text(
+ prop, "Display Shapekeys", "Include visualization of shape key related animation data");
+ RNA_def_property_ui_icon(prop, ICON_SHAPEKEY_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_modifiers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMODIFIERS);
+ RNA_def_property_ui_text(
+ prop,
+ "Display Modifier Data",
+ "Include visualization of animation data related to data-blocks linked to modifiers");
+ RNA_def_property_ui_icon(prop, ICON_MODIFIER_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_meshes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMESH);
+ RNA_def_property_ui_text(
+ prop, "Display Meshes", "Include visualization of mesh related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_MESH, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_lattices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAT);
+ RNA_def_property_ui_text(
+ prop, "Display Lattices", "Include visualization of lattice related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LATTICE, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_cameras", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCAM);
+ RNA_def_property_ui_text(
+ prop, "Display Camera", "Include visualization of camera related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_CAMERA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_materials", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMAT);
+ RNA_def_property_ui_text(
+ prop, "Display Material", "Include visualization of material related animation data");
+ RNA_def_property_ui_icon(prop, ICON_MATERIAL_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_lights", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLAM);
+ RNA_def_property_ui_text(
+ prop, "Display Light", "Include visualization of light related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_LIGHT, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_linestyles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOLINESTYLE);
+ RNA_def_property_ui_text(
+ prop, "Display Line Style", "Include visualization of Line Style related Animation data");
+ RNA_def_property_ui_icon(prop, ICON_LINE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_textures", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX);
+ RNA_def_property_ui_text(
+ prop, "Display Texture", "Include visualization of texture related animation data");
+ RNA_def_property_ui_icon(prop, ICON_TEXTURE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_curves", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCUR);
+ RNA_def_property_ui_text(
+ prop, "Display Curve", "Include visualization of curve related animation data");
+ RNA_def_property_ui_icon(prop, ICON_CURVE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_worlds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOWOR);
+ RNA_def_property_ui_text(
+ prop, "Display World", "Include visualization of world related animation data");
+ RNA_def_property_ui_icon(prop, ICON_WORLD_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_scenes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSCE);
+ RNA_def_property_ui_text(
+ prop, "Display Scene", "Include visualization of scene related animation data");
+ RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOPART);
+ RNA_def_property_ui_text(
+ prop, "Display Particle", "Include visualization of particle related animation data");
+ RNA_def_property_ui_icon(prop, ICON_PARTICLE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_metaballs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOMBA);
+ RNA_def_property_ui_text(
+ prop, "Display Metaball", "Include visualization of metaball related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_META, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_armatures", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOARM);
+ RNA_def_property_ui_text(
+ prop, "Display Armature", "Include visualization of armature related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_ARMATURE, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NONTREE);
+ RNA_def_property_ui_text(
+ prop, "Display Node", "Include visualization of node related animation data");
+ RNA_def_property_ui_icon(prop, ICON_NODETREE, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_speakers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOSPK);
+ RNA_def_property_ui_text(
+ prop, "Display Speaker", "Include visualization of speaker related animation data");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_SPEAKER, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_cache_files", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag2", ADS_FILTER_NOCACHEFILES);
+ RNA_def_property_ui_text(
+ prop, "Display Cache Files", "Include visualization of cache file related animation data");
+ RNA_def_property_ui_icon(prop, ICON_FILE, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_gpencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOGPENCIL);
+ RNA_def_property_ui_text(
+ prop,
+ "Display Grease Pencil",
+ "Include visualization of Grease Pencil related animation data and frames");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_OB_GREASEPENCIL, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* GPencil Mode Settings */
+ prop = RNA_def_property(srna, "show_gpencil_3d_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_GP_3DONLY);
+ RNA_def_property_ui_text(prop,
+ "Active Scene Only",
+ "Only show Grease Pencil data-blocks used as part of the active scene");
+ RNA_def_property_ui_icon(prop, ICON_SCENE_DATA, 0);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
static void rna_def_action_group(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ActionGroup", NULL);
- RNA_def_struct_sdna(srna, "bActionGroup");
- RNA_def_struct_ui_text(srna, "Action Group", "Groups of F-Curves");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* WARNING: be very careful when working with this list, since the endpoint is not
- * defined like a standard ListBase. Adding/removing channels from this list needs
- * extreme care, otherwise the F-Curve list running through adjacent groups does
- * not match up with the one stored in the Action, resulting in curves which do not
- * show up in animation editors. In extreme cases, animation may also selectively
- * fail to play back correctly.
- *
- * If such changes are required, these MUST go through the API functions for manipulating
- * these F-Curve groupings. Also, note that groups only apply in actions ONLY.
- */
- prop = RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "channels", NULL);
- RNA_def_property_struct_type(prop, "FCurve");
- RNA_def_property_collection_funcs(prop, NULL, "rna_ActionGroup_channels_next", NULL, NULL, NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_SELECTED);
- RNA_def_property_ui_text(prop, "Select", "Action group is selected");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_PROTECTED);
- RNA_def_property_ui_text(prop, "Lock", "Action group is locked");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_EXPANDED);
- RNA_def_property_ui_text(prop, "Expanded", "Action group is expanded");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- /* color set */
- rna_def_actionbone_group_common(srna, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ActionGroup", NULL);
+ RNA_def_struct_sdna(srna, "bActionGroup");
+ RNA_def_struct_ui_text(srna, "Action Group", "Groups of F-Curves");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* WARNING: be very careful when working with this list, since the endpoint is not
+ * defined like a standard ListBase. Adding/removing channels from this list needs
+ * extreme care, otherwise the F-Curve list running through adjacent groups does
+ * not match up with the one stored in the Action, resulting in curves which do not
+ * show up in animation editors. In extreme cases, animation may also selectively
+ * fail to play back correctly.
+ *
+ * If such changes are required, these MUST go through the API functions for manipulating
+ * these F-Curve groupings. Also, note that groups only apply in actions ONLY.
+ */
+ prop = RNA_def_property(srna, "channels", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "channels", NULL);
+ RNA_def_property_struct_type(prop, "FCurve");
+ RNA_def_property_collection_funcs(
+ prop, NULL, "rna_ActionGroup_channels_next", NULL, NULL, NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Channels", "F-Curves in this group");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_SELECTED);
+ RNA_def_property_ui_text(prop, "Select", "Action group is selected");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_PROTECTED);
+ RNA_def_property_ui_text(prop, "Lock", "Action group is locked");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", AGRP_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "Action group is expanded");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ /* color set */
+ rna_def_actionbone_group_common(srna, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
}
/* fcurve.keyframe_points */
static void rna_def_action_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ActionGroups");
- srna = RNA_def_struct(brna, "ActionGroups", NULL);
- RNA_def_struct_sdna(srna, "bAction");
- RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups");
-
- func = RNA_def_function(srna, "new", "rna_Action_groups_new");
- RNA_def_function_ui_description(func, "Create a new action group and add it to the action");
- parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the action group");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
- RNA_def_function_return(func, parm);
-
-
- func = RNA_def_function(srna, "remove", "rna_Action_groups_remove");
- RNA_def_function_ui_description(func, "Remove action group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ActionGroups");
+ srna = RNA_def_struct(brna, "ActionGroups", NULL);
+ RNA_def_struct_sdna(srna, "bAction");
+ RNA_def_struct_ui_text(srna, "Action Groups", "Collection of action groups");
+
+ func = RNA_def_function(srna, "new", "rna_Action_groups_new");
+ RNA_def_function_ui_description(func, "Create a new action group and add it to the action");
+ parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the action group");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Newly created action group");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Action_groups_remove");
+ RNA_def_function_ui_description(func, "Remove action group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "action_group", "ActionGroup", "", "Action group to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_action_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ActionFCurves");
- srna = RNA_def_struct(brna, "ActionFCurves", NULL);
- RNA_def_struct_sdna(srna, "bAction");
- RNA_def_struct_ui_text(srna, "Action F-Curves", "Collection of action F-Curves");
-
- /* Action.fcurves.new(...) */
- func = RNA_def_function(srna, "new", "rna_Action_fcurve_new");
- RNA_def_function_ui_description(func, "Add an F-Curve to the action");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path to use");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
- RNA_def_string(func, "action_group", NULL, 0, "Action Group", "Acton group to add this F-Curve into");
-
- parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created F-Curve");
- RNA_def_function_return(func, parm);
-
- /* Action.fcurves.find(...) */
- func = RNA_def_function(srna, "find", "rna_Action_fcurve_find");
- RNA_def_function_ui_description(func, "Find an F-Curve. Note that this function performs a linear scan "
- "of all F-Curves in the action.");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
- parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
- RNA_def_function_return(func, parm);
-
- /* Action.fcurves.remove(...) */
- func = RNA_def_function(srna, "remove", "rna_Action_fcurve_remove");
- RNA_def_function_ui_description(func, "Remove action group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ActionFCurves");
+ srna = RNA_def_struct(brna, "ActionFCurves", NULL);
+ RNA_def_struct_sdna(srna, "bAction");
+ RNA_def_struct_ui_text(srna, "Action F-Curves", "Collection of action F-Curves");
+
+ /* Action.fcurves.new(...) */
+ func = RNA_def_function(srna, "new", "rna_Action_fcurve_new");
+ RNA_def_function_ui_description(func, "Add an F-Curve to the action");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path to use");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+ RNA_def_string(
+ func, "action_group", NULL, 0, "Action Group", "Acton group to add this F-Curve into");
+
+ parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "Newly created F-Curve");
+ RNA_def_function_return(func, parm);
+
+ /* Action.fcurves.find(...) */
+ func = RNA_def_function(srna, "find", "rna_Action_fcurve_find");
+ RNA_def_function_ui_description(
+ func,
+ "Find an F-Curve. Note that this function performs a linear scan "
+ "of all F-Curves in the action.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+ parm = RNA_def_pointer(
+ func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
+ RNA_def_function_return(func, parm);
+
+ /* Action.fcurves.remove(...) */
+ func = RNA_def_function(srna, "remove", "rna_Action_fcurve_remove");
+ RNA_def_function_ui_description(func, "Remove action group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "F-Curve to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_action_pose_markers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ActionPoseMarkers");
- srna = RNA_def_struct(brna, "ActionPoseMarkers", NULL);
- RNA_def_struct_sdna(srna, "bAction");
- RNA_def_struct_ui_text(srna, "Action Pose Markers", "Collection of timeline markers");
-
- func = RNA_def_function(srna, "new", "rna_Action_pose_markers_new");
- RNA_def_function_ui_description(func, "Add a pose marker to the action");
- parm = RNA_def_string(func, "name", "Marker", 0, NULL, "New name for the marker (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove");
- RNA_def_function_ui_description(func, "Remove a timeline marker");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "TimelineMarker");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_LIB_EXCEPTION);
- RNA_def_property_pointer_funcs(prop, "rna_Action_active_pose_marker_get",
- "rna_Action_active_pose_marker_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this action");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "active_marker");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
- RNA_def_property_int_funcs(prop, "rna_Action_active_pose_marker_index_get",
- "rna_Action_active_pose_marker_index_set", "rna_Action_active_pose_marker_index_range");
- RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ActionPoseMarkers");
+ srna = RNA_def_struct(brna, "ActionPoseMarkers", NULL);
+ RNA_def_struct_sdna(srna, "bAction");
+ RNA_def_struct_ui_text(srna, "Action Pose Markers", "Collection of timeline markers");
+
+ func = RNA_def_function(srna, "new", "rna_Action_pose_markers_new");
+ RNA_def_function_ui_description(func, "Add a pose marker to the action");
+ parm = RNA_def_string(func, "name", "Marker", 0, NULL, "New name for the marker (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created marker");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Action_pose_markers_remove");
+ RNA_def_function_ui_description(func, "Remove a timeline marker");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "TimelineMarker");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_LIB_EXCEPTION);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Action_active_pose_marker_get", "rna_Action_active_pose_marker_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Pose Marker", "Active pose marker for this action");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "active_marker");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ RNA_def_property_int_funcs(prop,
+ "rna_Action_active_pose_marker_index_get",
+ "rna_Action_active_pose_marker_index_set",
+ "rna_Action_active_pose_marker_index_range");
+ RNA_def_property_ui_text(prop, "Active Pose Marker Index", "Index of active pose marker");
}
static void rna_def_action(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Action", "ID");
- RNA_def_struct_sdna(srna, "bAction");
- RNA_def_struct_ui_text(srna, "Action", "A collection of F-Curves for animation");
- RNA_def_struct_ui_icon(srna, ICON_ACTION);
-
- /* collections */
- prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "curves", NULL);
- RNA_def_property_struct_type(prop, "FCurve");
- RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that make up the action");
- rna_def_action_fcurves(brna, prop);
-
- prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "groups", NULL);
- RNA_def_property_struct_type(prop, "ActionGroup");
- RNA_def_property_ui_text(prop, "Groups", "Convenient groupings of F-Curves");
- rna_def_action_groups(brna, prop);
-
- prop = RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
- RNA_def_property_struct_type(prop, "TimelineMarker");
- /* Use lib exception so the list isn't grayed out; adding/removing is still banned though, see T45689 */
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
- RNA_def_property_ui_text(prop, "Pose Markers", "Markers specific to this action, for labeling poses");
- rna_def_action_pose_markers(brna, prop);
-
- /* properties */
- prop = RNA_def_float_vector(srna, "frame_range", 2, NULL, 0, 0, "Frame Range",
- "The final frame range of all F-Curves within this action", 0, 0);
- RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* special "type" limiter - should not really be edited in general,
- * but is still available/editable in 'emergencies' */
- prop = RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "idroot");
- RNA_def_property_enum_items(prop, rna_enum_id_type_items);
- RNA_def_property_ui_text(prop, "ID Root Type",
- "Type of ID block that action can be used on - "
- "DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
-
- /* API calls */
- RNA_api_action(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Action", "ID");
+ RNA_def_struct_sdna(srna, "bAction");
+ RNA_def_struct_ui_text(srna, "Action", "A collection of F-Curves for animation");
+ RNA_def_struct_ui_icon(srna, ICON_ACTION);
+
+ /* collections */
+ prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "curves", NULL);
+ RNA_def_property_struct_type(prop, "FCurve");
+ RNA_def_property_ui_text(prop, "F-Curves", "The individual F-Curves that make up the action");
+ rna_def_action_fcurves(brna, prop);
+
+ prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "groups", NULL);
+ RNA_def_property_struct_type(prop, "ActionGroup");
+ RNA_def_property_ui_text(prop, "Groups", "Convenient groupings of F-Curves");
+ rna_def_action_groups(brna, prop);
+
+ prop = RNA_def_property(srna, "pose_markers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
+ RNA_def_property_struct_type(prop, "TimelineMarker");
+ /* Use lib exception so the list isn't grayed out; adding/removing is still banned though, see T45689 */
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ RNA_def_property_ui_text(
+ prop, "Pose Markers", "Markers specific to this action, for labeling poses");
+ rna_def_action_pose_markers(brna, prop);
+
+ /* properties */
+ prop = RNA_def_float_vector(srna,
+ "frame_range",
+ 2,
+ NULL,
+ 0,
+ 0,
+ "Frame Range",
+ "The final frame range of all F-Curves within this action",
+ 0,
+ 0);
+ RNA_def_property_float_funcs(prop, "rna_Action_frame_range_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* special "type" limiter - should not really be edited in general,
+ * but is still available/editable in 'emergencies' */
+ prop = RNA_def_property(srna, "id_root", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "idroot");
+ RNA_def_property_enum_items(prop, rna_enum_id_type_items);
+ RNA_def_property_ui_text(prop,
+ "ID Root Type",
+ "Type of ID block that action can be used on - "
+ "DO NOT CHANGE UNLESS YOU KNOW WHAT YOU ARE DOING");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
+
+ /* API calls */
+ RNA_api_action(srna);
}
/* --------- */
void RNA_def_action(BlenderRNA *brna)
{
- rna_def_action(brna);
- rna_def_action_group(brna);
- rna_def_dopesheet(brna);
+ rna_def_action(brna);
+ rna_def_action_group(brna);
+ rna_def_dopesheet(brna);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_action_api.c b/source/blender/makesrna/intern/rna_action_api.c
index 9543042248e..76a9a255d62 100644
--- a/source/blender/makesrna/intern/rna_action_api.c
+++ b/source/blender/makesrna/intern/rna_action_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -33,20 +32,19 @@
#include "DNA_action_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "BKE_action.h"
+# include "BKE_action.h"
-#include "DNA_anim_types.h"
-#include "DNA_curve_types.h"
+# include "DNA_anim_types.h"
+# include "DNA_curve_types.h"
#else
void RNA_api_action(StructRNA *UNUSED(srna))
{
-
}
#endif
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 6194a34ac75..3f92d6f1210 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -42,91 +42,100 @@
/* exported for use in API */
const EnumPropertyItem rna_enum_keyingset_path_grouping_items[] = {
- {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
- {KSP_GROUP_NONE, "NONE", 0, "None", ""},
- {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
- {0, NULL, 0, NULL, NULL},
+ {KSP_GROUP_NAMED, "NAMED", 0, "Named Group", ""},
+ {KSP_GROUP_NONE, "NONE", 0, "None", ""},
+ {KSP_GROUP_KSNAME, "KEYINGSET", 0, "Keying Set Name", ""},
+ {0, NULL, 0, NULL, NULL},
};
/* It would be cool to get rid of this 'INSERTKEY_' prefix in 'py strings' values, but it would break existing
* exported keyingset... :/
*/
const EnumPropertyItem rna_enum_keying_flag_items[] = {
- {INSERTKEY_NEEDED, "INSERTKEY_NEEDED", 0, "Only Needed",
- "Only insert keyframes where they're needed in the relevant F-Curves"},
- {INSERTKEY_MATRIX, "INSERTKEY_VISUAL", 0, "Visual Keying",
- "Insert keyframes based on 'visual transforms'"},
- {INSERTKEY_XYZ2RGB, "INSERTKEY_XYZ_TO_RGB", 0, "XYZ=RGB Colors",
- "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
- "and also Color is based on the transform axis"},
- {0, NULL, 0, NULL, NULL},
+ {INSERTKEY_NEEDED,
+ "INSERTKEY_NEEDED",
+ 0,
+ "Only Needed",
+ "Only insert keyframes where they're needed in the relevant F-Curves"},
+ {INSERTKEY_MATRIX,
+ "INSERTKEY_VISUAL",
+ 0,
+ "Visual Keying",
+ "Insert keyframes based on 'visual transforms'"},
+ {INSERTKEY_XYZ2RGB,
+ "INSERTKEY_XYZ_TO_RGB",
+ 0,
+ "XYZ=RGB Colors",
+ "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
+ "and also Color is based on the transform axis"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_math_base.h"
+# include "BLI_math_base.h"
-#include "BKE_animsys.h"
-#include "BKE_fcurve.h"
-#include "BKE_nla.h"
+# include "BKE_animsys.h"
+# include "BKE_fcurve.h"
+# include "BKE_nla.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "DNA_object_types.h"
+# include "DNA_object_types.h"
-#include "ED_anim_api.h"
+# include "ED_anim_api.h"
-#include "WM_api.h"
+# include "WM_api.h"
static void rna_AnimData_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- ANIM_id_update(bmain, id);
+ ANIM_id_update(bmain, id);
}
static void rna_AnimData_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
- rna_AnimData_update(bmain, scene, ptr);
+ rna_AnimData_update(bmain, scene, ptr);
}
static int rna_AnimData_action_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- AnimData *adt = (AnimData *)ptr->data;
+ AnimData *adt = (AnimData *)ptr->data;
- /* active action is only editable when it is not a tweaking strip */
- if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
- return 0;
- else
- return PROP_EDITABLE;
+ /* active action is only editable when it is not a tweaking strip */
+ if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static void rna_AnimData_action_set(PointerRNA *ptr, PointerRNA value)
{
- ID *ownerId = (ID *)ptr->id.data;
+ ID *ownerId = (ID *)ptr->id.data;
- /* set action */
- BKE_animdata_set_action(NULL, ownerId, value.data);
+ /* set action */
+ BKE_animdata_set_action(NULL, ownerId, value.data);
}
static void rna_AnimData_tweakmode_set(PointerRNA *ptr, const bool value)
{
- AnimData *adt = (AnimData *)ptr->data;
-
- /* NOTE: technically we should also set/unset SCE_NLA_EDIT_ON flag on the
- * scene which is used to make polling tests faster, but this flag is weak
- * and can easily break e.g. by changing layer visibility. This needs to be
- * dealt with at some point. */
-
- if (value) {
- BKE_nla_tweakmode_enter(adt);
- }
- else {
- BKE_nla_tweakmode_exit(adt);
- }
+ AnimData *adt = (AnimData *)ptr->data;
+
+ /* NOTE: technically we should also set/unset SCE_NLA_EDIT_ON flag on the
+ * scene which is used to make polling tests faster, but this flag is weak
+ * and can easily break e.g. by changing layer visibility. This needs to be
+ * dealt with at some point. */
+
+ if (value) {
+ BKE_nla_tweakmode_enter(adt);
+ }
+ else {
+ BKE_nla_tweakmode_exit(adt);
+ }
}
/* ****************************** */
@@ -134,84 +143,84 @@ static void rna_AnimData_tweakmode_set(PointerRNA *ptr, const bool value)
/* wrapper for poll callback */
static bool RKS_POLL_rna_internal(KeyingSetInfo *ksi, bContext *C)
{
- extern FunctionRNA rna_KeyingSetInfo_poll_func;
+ extern FunctionRNA rna_KeyingSetInfo_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- int ok;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ int ok;
- RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
- func = &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
+ func = &rna_KeyingSetInfo_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- {
- /* hook up arguments */
- RNA_parameter_set_lookup(&list, "ksi", &ksi);
- RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_list_create(&list, &ptr, func);
+ {
+ /* hook up arguments */
+ RNA_parameter_set_lookup(&list, "ksi", &ksi);
+ RNA_parameter_set_lookup(&list, "context", &C);
- /* execute the function */
- ksi->ext.call(C, &ptr, func, &list);
+ /* execute the function */
+ ksi->ext.call(C, &ptr, func, &list);
- /* read the result */
- RNA_parameter_get_lookup(&list, "ok", &ret);
- ok = *(bool *)ret;
- }
- RNA_parameter_list_free(&list);
+ /* read the result */
+ RNA_parameter_get_lookup(&list, "ok", &ret);
+ ok = *(bool *)ret;
+ }
+ RNA_parameter_list_free(&list);
- return ok;
+ return ok;
}
/* wrapper for iterator callback */
static void RKS_ITER_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks)
{
- extern FunctionRNA rna_KeyingSetInfo_iterator_func;
-
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
-
- RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
- func = &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */
-
- RNA_parameter_list_create(&list, &ptr, func);
- {
- /* hook up arguments */
- RNA_parameter_set_lookup(&list, "ksi", &ksi);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "ks", &ks);
-
- /* execute the function */
- ksi->ext.call(C, &ptr, func, &list);
- }
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_KeyingSetInfo_iterator_func;
+
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+
+ RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
+ func = &rna_KeyingSetInfo_iterator_func; /* RNA_struct_find_function(&ptr, "poll"); */
+
+ RNA_parameter_list_create(&list, &ptr, func);
+ {
+ /* hook up arguments */
+ RNA_parameter_set_lookup(&list, "ksi", &ksi);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "ks", &ks);
+
+ /* execute the function */
+ ksi->ext.call(C, &ptr, func, &list);
+ }
+ RNA_parameter_list_free(&list);
}
/* wrapper for generator callback */
static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks, PointerRNA *data)
{
- extern FunctionRNA rna_KeyingSetInfo_generate_func;
-
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
-
- RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
- func = &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */
-
- RNA_parameter_list_create(&list, &ptr, func);
- {
- /* hook up arguments */
- RNA_parameter_set_lookup(&list, "ksi", &ksi);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "ks", &ks);
- RNA_parameter_set_lookup(&list, "data", data);
-
- /* execute the function */
- ksi->ext.call(C, &ptr, func, &list);
- }
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_KeyingSetInfo_generate_func;
+
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+
+ RNA_pointer_create(NULL, ksi->ext.srna, ksi, &ptr);
+ func = &rna_KeyingSetInfo_generate_func; /* RNA_struct_find_generate(&ptr, "poll"); */
+
+ RNA_parameter_list_create(&list, &ptr, func);
+ {
+ /* hook up arguments */
+ RNA_parameter_set_lookup(&list, "ksi", &ksi);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "ks", &ks);
+ RNA_parameter_set_lookup(&list, "data", data);
+
+ /* execute the function */
+ ksi->ext.call(C, &ptr, func, &list);
+ }
+ RNA_parameter_list_free(&list);
}
/* ------ */
@@ -219,426 +228,450 @@ static void RKS_GEN_rna_internal(KeyingSetInfo *ksi, bContext *C, KeyingSet *ks,
/* XXX: the exact purpose of this is not too clear... maybe we want to revise this at some point? */
static StructRNA *rna_KeyingSetInfo_refine(PointerRNA *ptr)
{
- KeyingSetInfo *ksi = (KeyingSetInfo *)ptr->data;
- return (ksi->ext.srna) ? ksi->ext.srna : &RNA_KeyingSetInfo;
+ KeyingSetInfo *ksi = (KeyingSetInfo *)ptr->data;
+ return (ksi->ext.srna) ? ksi->ext.srna : &RNA_KeyingSetInfo;
}
static void rna_KeyingSetInfo_unregister(Main *bmain, StructRNA *type)
{
- KeyingSetInfo *ksi = RNA_struct_blender_type_get(type);
+ KeyingSetInfo *ksi = RNA_struct_blender_type_get(type);
- if (ksi == NULL)
- return;
+ if (ksi == NULL)
+ return;
- /* free RNA data referencing this */
- RNA_struct_free_extension(type, &ksi->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ /* free RNA data referencing this */
+ RNA_struct_free_extension(type, &ksi->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- WM_main_add_notifier(NC_WINDOW, NULL);
+ WM_main_add_notifier(NC_WINDOW, NULL);
- /* unlink Blender-side data */
- ANIM_keyingset_info_unregister(bmain, ksi);
+ /* unlink Blender-side data */
+ ANIM_keyingset_info_unregister(bmain, ksi);
}
-static StructRNA *rna_KeyingSetInfo_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_KeyingSetInfo_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- KeyingSetInfo dummyksi = {NULL};
- KeyingSetInfo *ksi;
- PointerRNA dummyptr = {{NULL}};
- int have_function[3];
-
- /* setup dummy type info to store static properties in */
- /* TODO: perhaps we want to get users to register as if they're using 'KeyingSet' directly instead? */
- RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummyksi, &dummyptr);
-
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummyksi.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering keying set info class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyksi.idname));
- return NULL;
- }
-
- /* check if we have registered this info before, and remove it */
- ksi = ANIM_keyingset_info_find_name(dummyksi.idname);
- if (ksi && ksi->ext.srna) {
- rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
- }
-
- /* create a new KeyingSetInfo type */
- ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
- memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo));
-
- /* set RNA-extensions info */
- ksi->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ksi->idname, &RNA_KeyingSetInfo);
- ksi->ext.data = data;
- ksi->ext.call = call;
- ksi->ext.free = free;
- RNA_struct_blender_type_set(ksi->ext.srna, ksi);
-
- /* set callbacks */
- /* NOTE: we really should have all of these... */
- ksi->poll = (have_function[0]) ? RKS_POLL_rna_internal : NULL;
- ksi->iter = (have_function[1]) ? RKS_ITER_rna_internal : NULL;
- ksi->generate = (have_function[2]) ? RKS_GEN_rna_internal : NULL;
-
- /* add and register with other info as needed */
- ANIM_keyingset_info_register(ksi);
-
- WM_main_add_notifier(NC_WINDOW, NULL);
-
- /* return the struct-rna added */
- return ksi->ext.srna;
+ KeyingSetInfo dummyksi = {NULL};
+ KeyingSetInfo *ksi;
+ PointerRNA dummyptr = {{NULL}};
+ int have_function[3];
+
+ /* setup dummy type info to store static properties in */
+ /* TODO: perhaps we want to get users to register as if they're using 'KeyingSet' directly instead? */
+ RNA_pointer_create(NULL, &RNA_KeyingSetInfo, &dummyksi, &dummyptr);
+
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummyksi.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering keying set info class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummyksi.idname));
+ return NULL;
+ }
+
+ /* check if we have registered this info before, and remove it */
+ ksi = ANIM_keyingset_info_find_name(dummyksi.idname);
+ if (ksi && ksi->ext.srna) {
+ rna_KeyingSetInfo_unregister(bmain, ksi->ext.srna);
+ }
+
+ /* create a new KeyingSetInfo type */
+ ksi = MEM_callocN(sizeof(KeyingSetInfo), "python keying set info");
+ memcpy(ksi, &dummyksi, sizeof(KeyingSetInfo));
+
+ /* set RNA-extensions info */
+ ksi->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ksi->idname, &RNA_KeyingSetInfo);
+ ksi->ext.data = data;
+ ksi->ext.call = call;
+ ksi->ext.free = free;
+ RNA_struct_blender_type_set(ksi->ext.srna, ksi);
+
+ /* set callbacks */
+ /* NOTE: we really should have all of these... */
+ ksi->poll = (have_function[0]) ? RKS_POLL_rna_internal : NULL;
+ ksi->iter = (have_function[1]) ? RKS_ITER_rna_internal : NULL;
+ ksi->generate = (have_function[2]) ? RKS_GEN_rna_internal : NULL;
+
+ /* add and register with other info as needed */
+ ANIM_keyingset_info_register(ksi);
+
+ WM_main_add_notifier(NC_WINDOW, NULL);
+
+ /* return the struct-rna added */
+ return ksi->ext.srna;
}
/* ****************************** */
static StructRNA *rna_ksPath_id_typef(PointerRNA *ptr)
{
- KS_Path *ksp = (KS_Path *)ptr->data;
- return ID_code_to_RNA_type(ksp->idtype);
+ KS_Path *ksp = (KS_Path *)ptr->data;
+ return ID_code_to_RNA_type(ksp->idtype);
}
static int rna_ksPath_id_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- KS_Path *ksp = (KS_Path *)ptr->data;
- return (ksp->idtype) ? PROP_EDITABLE : 0;
+ KS_Path *ksp = (KS_Path *)ptr->data;
+ return (ksp->idtype) ? PROP_EDITABLE : 0;
}
static void rna_ksPath_id_type_set(PointerRNA *ptr, int value)
{
- KS_Path *data = (KS_Path *)(ptr->data);
+ KS_Path *data = (KS_Path *)(ptr->data);
- /* set the driver type, then clear the id-block if the type is invalid */
- data->idtype = value;
- if ((data->id) && (GS(data->id->name) != data->idtype))
- data->id = NULL;
+ /* set the driver type, then clear the id-block if the type is invalid */
+ data->idtype = value;
+ if ((data->id) && (GS(data->id->name) != data->idtype))
+ data->id = NULL;
}
static void rna_ksPath_RnaPath_get(PointerRNA *ptr, char *value)
{
- KS_Path *ksp = (KS_Path *)ptr->data;
+ KS_Path *ksp = (KS_Path *)ptr->data;
- if (ksp->rna_path)
- strcpy(value, ksp->rna_path);
- else
- value[0] = '\0';
+ if (ksp->rna_path)
+ strcpy(value, ksp->rna_path);
+ else
+ value[0] = '\0';
}
static int rna_ksPath_RnaPath_length(PointerRNA *ptr)
{
- KS_Path *ksp = (KS_Path *)ptr->data;
+ KS_Path *ksp = (KS_Path *)ptr->data;
- if (ksp->rna_path)
- return strlen(ksp->rna_path);
- else
- return 0;
+ if (ksp->rna_path)
+ return strlen(ksp->rna_path);
+ else
+ return 0;
}
static void rna_ksPath_RnaPath_set(PointerRNA *ptr, const char *value)
{
- KS_Path *ksp = (KS_Path *)ptr->data;
+ KS_Path *ksp = (KS_Path *)ptr->data;
- if (ksp->rna_path)
- MEM_freeN(ksp->rna_path);
+ if (ksp->rna_path)
+ MEM_freeN(ksp->rna_path);
- if (value[0])
- ksp->rna_path = BLI_strdup(value);
- else
- ksp->rna_path = NULL;
+ if (value[0])
+ ksp->rna_path = BLI_strdup(value);
+ else
+ ksp->rna_path = NULL;
}
/* ****************************** */
static void rna_KeyingSet_name_set(PointerRNA *ptr, const char *value)
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
-
- /* update names of corresponding groups if name changes */
- if (!STREQ(ks->name, value)) {
- KS_Path *ksp;
-
- for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
- if ((ksp->groupmode == KSP_GROUP_KSNAME) && (ksp->id)) {
- AnimData *adt = BKE_animdata_from_id(ksp->id);
-
- /* TODO: NLA strips? */
- if (adt && adt->action) {
- bActionGroup *agrp;
-
- /* lazy check - should really find the F-Curve for the affected path and check its group
- * but this way should be faster and work well for most cases, as long as there are no
- * conflicts
- */
- for (agrp = adt->action->groups.first; agrp; agrp = agrp->next) {
- if (STREQ(ks->name, agrp->name)) {
- /* there should only be one of these in the action, so can stop... */
- BLI_strncpy(agrp->name, value, sizeof(agrp->name));
- break;
- }
- }
- }
- }
- }
- }
-
- /* finally, update name to new value */
- BLI_strncpy(ks->name, value, sizeof(ks->name));
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+
+ /* update names of corresponding groups if name changes */
+ if (!STREQ(ks->name, value)) {
+ KS_Path *ksp;
+
+ for (ksp = ks->paths.first; ksp; ksp = ksp->next) {
+ if ((ksp->groupmode == KSP_GROUP_KSNAME) && (ksp->id)) {
+ AnimData *adt = BKE_animdata_from_id(ksp->id);
+
+ /* TODO: NLA strips? */
+ if (adt && adt->action) {
+ bActionGroup *agrp;
+
+ /* lazy check - should really find the F-Curve for the affected path and check its group
+ * but this way should be faster and work well for most cases, as long as there are no
+ * conflicts
+ */
+ for (agrp = adt->action->groups.first; agrp; agrp = agrp->next) {
+ if (STREQ(ks->name, agrp->name)) {
+ /* there should only be one of these in the action, so can stop... */
+ BLI_strncpy(agrp->name, value, sizeof(agrp->name));
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /* finally, update name to new value */
+ BLI_strncpy(ks->name, value, sizeof(ks->name));
}
-
static int rna_KeyingSet_active_ksPath_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
+ KeyingSet *ks = (KeyingSet *)ptr->data;
- /* only editable if there are some paths to change to */
- return (BLI_listbase_is_empty(&ks->paths) == false) ? PROP_EDITABLE : 0;
+ /* only editable if there are some paths to change to */
+ return (BLI_listbase_is_empty(&ks->paths) == false) ? PROP_EDITABLE : 0;
}
static PointerRNA rna_KeyingSet_active_ksPath_get(PointerRNA *ptr)
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetPath, BLI_findlink(&ks->paths, ks->active_path - 1));
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_KeyingSetPath, BLI_findlink(&ks->paths, ks->active_path - 1));
}
static void rna_KeyingSet_active_ksPath_set(PointerRNA *ptr, PointerRNA value)
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
- KS_Path *ksp = (KS_Path *)value.data;
- ks->active_path = BLI_findindex(&ks->paths, ksp) + 1;
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+ KS_Path *ksp = (KS_Path *)value.data;
+ ks->active_path = BLI_findindex(&ks->paths, ksp) + 1;
}
static int rna_KeyingSet_active_ksPath_index_get(PointerRNA *ptr)
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
- return MAX2(ks->active_path - 1, 0);
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+ return MAX2(ks->active_path - 1, 0);
}
static void rna_KeyingSet_active_ksPath_index_set(PointerRNA *ptr, int value)
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
- ks->active_path = value + 1;
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+ ks->active_path = value + 1;
}
-static void rna_KeyingSet_active_ksPath_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_KeyingSet_active_ksPath_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
+ KeyingSet *ks = (KeyingSet *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&ks->paths) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&ks->paths) - 1);
}
static PointerRNA rna_KeyingSet_typeinfo_get(PointerRNA *ptr)
{
- KeyingSet *ks = (KeyingSet *)ptr->data;
- KeyingSetInfo *ksi = NULL;
+ KeyingSet *ks = (KeyingSet *)ptr->data;
+ KeyingSetInfo *ksi = NULL;
- /* keying set info is only for builtin Keying Sets */
- if ((ks->flag & KEYINGSET_ABSOLUTE) == 0)
- ksi = ANIM_keyingset_info_find_name(ks->typeinfo);
- return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetInfo, ksi);
+ /* keying set info is only for builtin Keying Sets */
+ if ((ks->flag & KEYINGSET_ABSOLUTE) == 0)
+ ksi = ANIM_keyingset_info_find_name(ks->typeinfo);
+ return rna_pointer_inherit_refine(ptr, &RNA_KeyingSetInfo, ksi);
}
-
-
-static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset, ReportList *reports,
- ID *id, const char rna_path[], int index, int group_method, const char group_name[])
+static KS_Path *rna_KeyingSet_paths_add(KeyingSet *keyingset,
+ ReportList *reports,
+ ID *id,
+ const char rna_path[],
+ int index,
+ int group_method,
+ const char group_name[])
{
- KS_Path *ksp = NULL;
- short flag = 0;
-
- /* special case when index = -1, we key the whole array (as with other places where index is used) */
- if (index == -1) {
- flag |= KSP_FLAG_WHOLE_ARRAY;
- index = 0;
- }
-
- /* if data is valid, call the API function for this */
- if (keyingset) {
- ksp = BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method);
- keyingset->active_path = BLI_listbase_count(&keyingset->paths);
- }
- else {
- BKE_report(reports, RPT_ERROR, "Keying set path could not be added");
- }
-
- /* return added path */
- return ksp;
+ KS_Path *ksp = NULL;
+ short flag = 0;
+
+ /* special case when index = -1, we key the whole array (as with other places where index is used) */
+ if (index == -1) {
+ flag |= KSP_FLAG_WHOLE_ARRAY;
+ index = 0;
+ }
+
+ /* if data is valid, call the API function for this */
+ if (keyingset) {
+ ksp = BKE_keyingset_add_path(keyingset, id, group_name, rna_path, index, flag, group_method);
+ keyingset->active_path = BLI_listbase_count(&keyingset->paths);
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Keying set path could not be added");
+ }
+
+ /* return added path */
+ return ksp;
}
-static void rna_KeyingSet_paths_remove(KeyingSet *keyingset, ReportList *reports, PointerRNA *ksp_ptr)
+static void rna_KeyingSet_paths_remove(KeyingSet *keyingset,
+ ReportList *reports,
+ PointerRNA *ksp_ptr)
{
- KS_Path *ksp = ksp_ptr->data;
+ KS_Path *ksp = ksp_ptr->data;
- /* if data is valid, call the API function for this */
- if ((keyingset && ksp) == false) {
- BKE_report(reports, RPT_ERROR, "Keying set path could not be removed");
- return;
- }
+ /* if data is valid, call the API function for this */
+ if ((keyingset && ksp) == false) {
+ BKE_report(reports, RPT_ERROR, "Keying set path could not be removed");
+ return;
+ }
- /* remove the active path from the KeyingSet */
- BKE_keyingset_free_path(keyingset, ksp);
- RNA_POINTER_INVALIDATE(ksp_ptr);
+ /* remove the active path from the KeyingSet */
+ BKE_keyingset_free_path(keyingset, ksp);
+ RNA_POINTER_INVALIDATE(ksp_ptr);
- /* the active path number will most likely have changed */
- /* TODO: we should get more fancy and actually check if it was removed, but this will do for now */
- keyingset->active_path = 0;
+ /* the active path number will most likely have changed */
+ /* TODO: we should get more fancy and actually check if it was removed, but this will do for now */
+ keyingset->active_path = 0;
}
static void rna_KeyingSet_paths_clear(KeyingSet *keyingset, ReportList *reports)
{
- /* if data is valid, call the API function for this */
- if (keyingset) {
- KS_Path *ksp, *kspn;
-
- /* free each path as we go to avoid looping twice */
- for (ksp = keyingset->paths.first; ksp; ksp = kspn) {
- kspn = ksp->next;
- BKE_keyingset_free_path(keyingset, ksp);
- }
-
- /* reset the active path, since there aren't any left */
- keyingset->active_path = 0;
- }
- else {
- BKE_report(reports, RPT_ERROR, "Keying set paths could not be removed");
- }
+ /* if data is valid, call the API function for this */
+ if (keyingset) {
+ KS_Path *ksp, *kspn;
+
+ /* free each path as we go to avoid looping twice */
+ for (ksp = keyingset->paths.first; ksp; ksp = kspn) {
+ kspn = ksp->next;
+ BKE_keyingset_free_path(keyingset, ksp);
+ }
+
+ /* reset the active path, since there aren't any left */
+ keyingset->active_path = 0;
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Keying set paths could not be removed");
+ }
}
/* needs wrapper function to push notifier */
static NlaTrack *rna_NlaTrack_new(ID *id, AnimData *adt, Main *bmain, bContext *C, NlaTrack *track)
{
- NlaTrack *new_track = BKE_nlatrack_add(adt, track);
+ NlaTrack *new_track = BKE_nlatrack_add(adt, track);
- WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
- return new_track;
+ return new_track;
}
-static void rna_NlaTrack_remove(ID *id, AnimData *adt, Main *bmain, bContext *C, ReportList *reports, PointerRNA *track_ptr)
+static void rna_NlaTrack_remove(
+ ID *id, AnimData *adt, Main *bmain, bContext *C, ReportList *reports, PointerRNA *track_ptr)
{
- NlaTrack *track = track_ptr->data;
+ NlaTrack *track = track_ptr->data;
- if (BLI_findindex(&adt->nla_tracks, track) == -1) {
- BKE_reportf(reports, RPT_ERROR, "NlaTrack '%s' cannot be removed", track->name);
- return;
- }
+ if (BLI_findindex(&adt->nla_tracks, track) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "NlaTrack '%s' cannot be removed", track->name);
+ return;
+ }
- BKE_nlatrack_free(&adt->nla_tracks, track, true);
- RNA_POINTER_INVALIDATE(track_ptr);
+ BKE_nlatrack_free(&adt->nla_tracks, track, true);
+ RNA_POINTER_INVALIDATE(track_ptr);
- WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
}
static PointerRNA rna_NlaTrack_active_get(PointerRNA *ptr)
{
- AnimData *adt = (AnimData *)ptr->data;
- NlaTrack *track = BKE_nlatrack_find_active(&adt->nla_tracks);
- return rna_pointer_inherit_refine(ptr, &RNA_NlaTrack, track);
+ AnimData *adt = (AnimData *)ptr->data;
+ NlaTrack *track = BKE_nlatrack_find_active(&adt->nla_tracks);
+ return rna_pointer_inherit_refine(ptr, &RNA_NlaTrack, track);
}
static void rna_NlaTrack_active_set(PointerRNA *ptr, PointerRNA value)
{
- AnimData *adt = (AnimData *)ptr->data;
- NlaTrack *track = (NlaTrack *)value.data;
- BKE_nlatrack_set_active(&adt->nla_tracks, track);
+ AnimData *adt = (AnimData *)ptr->data;
+ NlaTrack *track = (NlaTrack *)value.data;
+ BKE_nlatrack_set_active(&adt->nla_tracks, track);
}
-
static FCurve *rna_Driver_from_existing(AnimData *adt, bContext *C, FCurve *src_driver)
{
- /* verify that we've got a driver to duplicate */
- if (ELEM(NULL, src_driver, src_driver->driver)) {
- BKE_report(CTX_wm_reports(C), RPT_ERROR, "No valid driver data to create copy of");
- return NULL;
- }
- else {
- /* just make a copy of the existing one and add to self */
- FCurve *new_fcu = copy_fcurve(src_driver);
-
- /* XXX: if we impose any ordering on these someday, this will be problematic */
- BLI_addtail(&adt->drivers, new_fcu);
- return new_fcu;
- }
+ /* verify that we've got a driver to duplicate */
+ if (ELEM(NULL, src_driver, src_driver->driver)) {
+ BKE_report(CTX_wm_reports(C), RPT_ERROR, "No valid driver data to create copy of");
+ return NULL;
+ }
+ else {
+ /* just make a copy of the existing one and add to self */
+ FCurve *new_fcu = copy_fcurve(src_driver);
+
+ /* XXX: if we impose any ordering on these someday, this will be problematic */
+ BLI_addtail(&adt->drivers, new_fcu);
+ return new_fcu;
+ }
}
-static FCurve *rna_Driver_new(ID *id, AnimData *adt, ReportList *reports, const char *rna_path, int array_index)
+static FCurve *rna_Driver_new(
+ ID *id, AnimData *adt, ReportList *reports, const char *rna_path, int array_index)
{
- if (rna_path[0] == '\0') {
- BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
- return NULL;
- }
-
- if (list_find_fcurve(&adt->drivers, rna_path, array_index)) {
- BKE_reportf(reports, RPT_ERROR, "Driver '%s[%d]' already exists", rna_path, array_index);
- return NULL;
- }
-
- short add_mode = 1;
- FCurve *fcu = verify_driver_fcurve(id, rna_path, array_index, add_mode);
- BLI_assert(fcu != NULL);
- return fcu;
+ if (rna_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
+
+ if (list_find_fcurve(&adt->drivers, rna_path, array_index)) {
+ BKE_reportf(reports, RPT_ERROR, "Driver '%s[%d]' already exists", rna_path, array_index);
+ return NULL;
+ }
+
+ short add_mode = 1;
+ FCurve *fcu = verify_driver_fcurve(id, rna_path, array_index, add_mode);
+ BLI_assert(fcu != NULL);
+ return fcu;
}
static void rna_Driver_remove(AnimData *adt, ReportList *reports, FCurve *fcu)
{
- if (!BLI_remlink_safe(&adt->drivers, fcu)) {
- BKE_report(reports, RPT_ERROR, "Driver not found in this animation data");
- return;
- }
- free_fcurve(fcu);
+ if (!BLI_remlink_safe(&adt->drivers, fcu)) {
+ BKE_report(reports, RPT_ERROR, "Driver not found in this animation data");
+ return;
+ }
+ free_fcurve(fcu);
}
-static FCurve *rna_Driver_find(AnimData *adt, ReportList *reports, const char *data_path, int index)
+static FCurve *rna_Driver_find(AnimData *adt,
+ ReportList *reports,
+ const char *data_path,
+ int index)
{
- if (data_path[0] == '\0') {
- BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
- return NULL;
- }
+ if (data_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
- /* Returns NULL if not found. */
- return list_find_fcurve(&adt->drivers, data_path, index);
+ /* Returns NULL if not found. */
+ return list_find_fcurve(&adt->drivers, data_path, index);
}
-bool rna_AnimaData_override_apply(
- Main *UNUSED(bmain),
- PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
- PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *UNUSED(prop_storage),
- const int len_dst, const int len_src, const int len_storage,
- PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
+bool rna_AnimaData_override_apply(Main *UNUSED(bmain),
+ PointerRNA *ptr_dst,
+ PointerRNA *ptr_src,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_dst,
+ PropertyRNA *prop_src,
+ PropertyRNA *UNUSED(prop_storage),
+ const int len_dst,
+ const int len_src,
+ const int len_storage,
+ PointerRNA *UNUSED(ptr_item_dst),
+ PointerRNA *UNUSED(ptr_item_src),
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
{
- BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
- BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE && "Unsupported RNA override operation on animdata pointer");
- UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
-
- /* AnimData is a special case, since you cannot edit/replace it, it's either existent or not. */
- AnimData *adt_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data;
- AnimData *adt_src = RNA_property_pointer_get(ptr_src, prop_src).data;
-
- if (adt_dst == NULL && adt_src != NULL) {
- /* Copy anim data from reference into final local ID. */
- BKE_animdata_copy_id(NULL, ptr_dst->id.data, ptr_src->id.data, 0);
- return true;
- }
- else if (adt_dst != NULL && adt_src == NULL) {
- /* Override has cleared/removed anim data from its reference. */
- BKE_animdata_free(ptr_dst->id.data, true);
- return true;
- }
-
- return false;
+ BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage) && len_dst == 0);
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
+ "Unsupported RNA override operation on animdata pointer");
+ UNUSED_VARS_NDEBUG(ptr_storage, len_dst, len_src, len_storage, opop);
+
+ /* AnimData is a special case, since you cannot edit/replace it, it's either existent or not. */
+ AnimData *adt_dst = RNA_property_pointer_get(ptr_dst, prop_dst).data;
+ AnimData *adt_src = RNA_property_pointer_get(ptr_src, prop_src).data;
+
+ if (adt_dst == NULL && adt_src != NULL) {
+ /* Copy anim data from reference into final local ID. */
+ BKE_animdata_copy_id(NULL, ptr_dst->id.data, ptr_src->id.data, 0);
+ return true;
+ }
+ else if (adt_dst != NULL && adt_src == NULL) {
+ /* Override has cleared/removed anim data from its reference. */
+ BKE_animdata_free(ptr_dst->id.data, true);
+ return true;
+ }
+
+ return false;
}
#else
@@ -646,518 +679,586 @@ bool rna_AnimaData_override_apply(
/* helper function for Keying Set -> keying settings */
static void rna_def_common_keying_flags(StructRNA *srna, short reg)
{
- PropertyRNA *prop;
-
- /* override scene/userpref defaults? */
- prop = RNA_def_property(srna, "use_insertkey_override_needed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_NEEDED);
- RNA_def_property_ui_text(prop, "Override Insert Keyframes Default- Only Needed",
- "Override default setting to only insert keyframes where they're needed in the relevant F-Curves");
- if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "use_insertkey_override_visual", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_MATRIX);
- RNA_def_property_ui_text(prop, "Override Insert Keyframes Default - Visual",
- "Override default setting to insert keyframes based on 'visual transforms'");
- if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "use_insertkey_override_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_XYZ2RGB);
- RNA_def_property_ui_text(prop, "Override F-Curve Colors - XYZ to RGB",
- "Override default setting to set color for newly added transformation F-Curves "
- "(Location, Rotation, Scale) to be based on the transform axis");
- if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
-
- /* value to override defaults with */
- prop = RNA_def_property(srna, "use_insertkey_needed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_NEEDED);
- RNA_def_property_ui_text(prop, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves");
- if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "use_insertkey_visual", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX);
- RNA_def_property_ui_text(prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'");
- if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB);
- RNA_def_property_ui_text(prop, "F-Curve Colors - XYZ to RGB", "Color for newly added transformation F-Curves (Location, Rotation, Scale) is based on the transform axis");
- if (reg) RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ PropertyRNA *prop;
+
+ /* override scene/userpref defaults? */
+ prop = RNA_def_property(srna, "use_insertkey_override_needed", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_NEEDED);
+ RNA_def_property_ui_text(prop,
+ "Override Insert Keyframes Default- Only Needed",
+ "Override default setting to only insert keyframes where they're "
+ "needed in the relevant F-Curves");
+ if (reg)
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "use_insertkey_override_visual", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_MATRIX);
+ RNA_def_property_ui_text(
+ prop,
+ "Override Insert Keyframes Default - Visual",
+ "Override default setting to insert keyframes based on 'visual transforms'");
+ if (reg)
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "use_insertkey_override_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "keyingoverride", INSERTKEY_XYZ2RGB);
+ RNA_def_property_ui_text(
+ prop,
+ "Override F-Curve Colors - XYZ to RGB",
+ "Override default setting to set color for newly added transformation F-Curves "
+ "(Location, Rotation, Scale) to be based on the transform axis");
+ if (reg)
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ /* value to override defaults with */
+ prop = RNA_def_property(srna, "use_insertkey_needed", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_NEEDED);
+ RNA_def_property_ui_text(prop,
+ "Insert Keyframes - Only Needed",
+ "Only insert keyframes where they're needed in the relevant F-Curves");
+ if (reg)
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "use_insertkey_visual", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_MATRIX);
+ RNA_def_property_ui_text(
+ prop, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'");
+ if (reg)
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "keyingflag", INSERTKEY_XYZ2RGB);
+ RNA_def_property_ui_text(prop,
+ "F-Curve Colors - XYZ to RGB",
+ "Color for newly added transformation F-Curves (Location, Rotation, "
+ "Scale) is based on the transform axis");
+ if (reg)
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
}
/* --- */
/* To avoid repeating it twice! */
-#define KEYINGSET_IDNAME_DOC \
+# define KEYINGSET_IDNAME_DOC \
"If this is set, the Keying Set gets a custom ID, otherwise it takes " \
- "the name of the class used to define the Keying Set (for example, " \
+ "the name of the class used to define the Keying Set (for example, " \
"if the class name is \"BUILTIN_KSI_location\", and bl_idname is not " \
"set by the script, then bl_idname = \"BUILTIN_KSI_location\")"
-
static void rna_def_keyingset_info(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "KeyingSetInfo", NULL);
- RNA_def_struct_sdna(srna, "KeyingSetInfo");
- RNA_def_struct_ui_text(srna, "Keying Set Info", "Callback function defines for builtin Keying Sets");
- RNA_def_struct_refine_func(srna, "rna_KeyingSetInfo_refine");
- RNA_def_struct_register_funcs(srna, "rna_KeyingSetInfo_register", "rna_KeyingSetInfo_unregister", NULL);
-
- /* Properties --------------------- */
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "UI Name", "");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "description");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
-
- /* Regarding why we don't use rna_def_common_keying_flags() here:
- * - Using it would keep this case in sync with the other places
- * where these options are exposed (which are optimized for being
- * used in the UI).
- * - Unlike all the other places, this case is used for defining
- * new "built in" Keying Sets via the Python API. In that case,
- * it makes more sense to expose these in a way more similar to
- * other places featuring bl_idname/label/description (i.e. operators)
- */
- prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "keyingflag");
- RNA_def_property_enum_items(prop, rna_enum_keying_flag_items);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Options", "Keying Set options to use when inserting keyframes");
-
- RNA_define_verify_sdna(1);
-
- /* Function Callbacks ------------- */
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "Test if Keying Set can be used or not");
- RNA_def_function_flag(func, FUNC_REGISTER);
- RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", ""));
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* iterator */
- func = RNA_def_function(srna, "iterator", NULL);
- RNA_def_function_ui_description(func, "Call generate() on the structs which have properties to be keyframed");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* generate */
- func = RNA_def_function(srna, "generate", NULL);
- RNA_def_function_ui_description(func, "Add Paths to the Keying Set to keyframe the properties of the given data");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "KeyingSetInfo", NULL);
+ RNA_def_struct_sdna(srna, "KeyingSetInfo");
+ RNA_def_struct_ui_text(
+ srna, "Keying Set Info", "Callback function defines for builtin Keying Sets");
+ RNA_def_struct_refine_func(srna, "rna_KeyingSetInfo_refine");
+ RNA_def_struct_register_funcs(
+ srna, "rna_KeyingSetInfo_register", "rna_KeyingSetInfo_unregister", NULL);
+
+ /* Properties --------------------- */
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "UI Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "description");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
+
+ /* Regarding why we don't use rna_def_common_keying_flags() here:
+ * - Using it would keep this case in sync with the other places
+ * where these options are exposed (which are optimized for being
+ * used in the UI).
+ * - Unlike all the other places, this case is used for defining
+ * new "built in" Keying Sets via the Python API. In that case,
+ * it makes more sense to expose these in a way more similar to
+ * other places featuring bl_idname/label/description (i.e. operators)
+ */
+ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "keyingflag");
+ RNA_def_property_enum_items(prop, rna_enum_keying_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Keying Set options to use when inserting keyframes");
+
+ RNA_define_verify_sdna(1);
+
+ /* Function Callbacks ------------- */
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(func, "Test if Keying Set can be used or not");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", ""));
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* iterator */
+ func = RNA_def_function(srna, "iterator", NULL);
+ RNA_def_function_ui_description(
+ func, "Call generate() on the structs which have properties to be keyframed");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* generate */
+ func = RNA_def_function(srna, "generate", NULL);
+ RNA_def_function_ui_description(
+ func, "Add Paths to the Keying Set to keyframe the properties of the given data");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "ks", "KeyingSet", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
}
static void rna_def_keyingset_path(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "KeyingSetPath", NULL);
- RNA_def_struct_sdna(srna, "KS_Path");
- RNA_def_struct_ui_text(srna, "Keying Set Path", "Path to a setting for use in a Keying Set");
-
- /* ID */
- prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_editable_func(prop, "rna_ksPath_id_editable");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_ksPath_id_typef", NULL);
- RNA_def_property_ui_text(prop, "ID-Block",
- "ID-Block that keyframes for Keying Set should be added to "
- "(for Absolute Keying Sets only)");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
-
- prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "idtype");
- RNA_def_property_enum_items(prop, rna_enum_id_type_items);
- RNA_def_property_enum_default(prop, ID_OB);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL);
- RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
-
- /* Group */
- prop = RNA_def_property(srna, "group", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Group Name", "Name of Action Group to assign setting(s) for this path to");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
-
- /* Grouping */
- prop = RNA_def_property(srna, "group_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "groupmode");
- RNA_def_property_enum_items(prop, rna_enum_keyingset_path_grouping_items);
- RNA_def_property_ui_text(prop, "Grouping Method", "Method used to define which Group-name to use");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
-
- /* Path + Array Index */
- prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length",
- "rna_ksPath_RnaPath_set");
- RNA_def_property_ui_text(prop, "Data Path", "Path to property setting");
- RNA_def_struct_name_property(srna, prop); /* XXX this is the best indicator for now... */
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL);
-
- /* called 'index' when given as function arg */
- prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific setting if applicable");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
-
- /* Flags */
- prop = RNA_def_property(srna, "use_entire_array", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KSP_FLAG_WHOLE_ARRAY);
- RNA_def_property_ui_text(prop, "Entire Array",
- "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), "
- "entire array is to be used");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
-
- /* Keyframing Settings */
- rna_def_common_keying_flags(srna, 0);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "KeyingSetPath", NULL);
+ RNA_def_struct_sdna(srna, "KS_Path");
+ RNA_def_struct_ui_text(srna, "Keying Set Path", "Path to a setting for use in a Keying Set");
+
+ /* ID */
+ prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_editable_func(prop, "rna_ksPath_id_editable");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_ksPath_id_typef", NULL);
+ RNA_def_property_ui_text(prop,
+ "ID-Block",
+ "ID-Block that keyframes for Keying Set should be added to "
+ "(for Absolute Keying Sets only)");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
+
+ prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "idtype");
+ RNA_def_property_enum_items(prop, rna_enum_id_type_items);
+ RNA_def_property_enum_default(prop, ID_OB);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ksPath_id_type_set", NULL);
+ RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
+
+ /* Group */
+ prop = RNA_def_property(srna, "group", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Group Name", "Name of Action Group to assign setting(s) for this path to");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
+
+ /* Grouping */
+ prop = RNA_def_property(srna, "group_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "groupmode");
+ RNA_def_property_enum_items(prop, rna_enum_keyingset_path_grouping_items);
+ RNA_def_property_ui_text(
+ prop, "Grouping Method", "Method used to define which Group-name to use");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
+
+ /* Path + Array Index */
+ prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_ksPath_RnaPath_get", "rna_ksPath_RnaPath_length", "rna_ksPath_RnaPath_set");
+ RNA_def_property_ui_text(prop, "Data Path", "Path to property setting");
+ RNA_def_struct_name_property(srna, prop); /* XXX this is the best indicator for now... */
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL);
+
+ /* called 'index' when given as function arg */
+ prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific setting if applicable");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
+
+ /* Flags */
+ prop = RNA_def_property(srna, "use_entire_array", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KSP_FLAG_WHOLE_ARRAY);
+ RNA_def_property_ui_text(
+ prop,
+ "Entire Array",
+ "When an 'array/vector' type is chosen (Location, Rotation, Color, etc.), "
+ "entire array is to be used");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_KEYINGSET | NA_EDITED, NULL); /* XXX: maybe a bit too noisy */
+
+ /* Keyframing Settings */
+ rna_def_common_keying_flags(srna, 0);
}
-
/* keyingset.paths */
static void rna_def_keyingset_paths(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "KeyingSetPaths");
- srna = RNA_def_struct(brna, "KeyingSetPaths", NULL);
- RNA_def_struct_sdna(srna, "KeyingSet");
- RNA_def_struct_ui_text(srna, "Keying set paths", "Collection of keying set paths");
-
-
- /* Add Path */
- func = RNA_def_function(srna, "add", "rna_KeyingSet_paths_add");
- RNA_def_function_ui_description(func, "Add a new path for the Keying Set");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* return arg */
- parm = RNA_def_pointer(func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set");
- RNA_def_function_return(func, parm);
- /* ID-block for target */
- parm = RNA_def_pointer(func, "target_id", "ID", "Target ID", "ID data-block for the destination");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* rna-path */
- /* XXX hopefully this is long enough */
- parm = RNA_def_string(func, "data_path", NULL, 256, "Data-Path", "RNA-Path to destination property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* index (defaults to -1 for entire array) */
- RNA_def_int(func, "index", -1, -1, INT_MAX, "Index",
- "The index of the destination property (i.e. axis of Location/Rotation/etc.), "
- "or -1 for the entire array", 0, INT_MAX);
- /* grouping */
- RNA_def_enum(func, "group_method", rna_enum_keyingset_path_grouping_items, KSP_GROUP_KSNAME,
- "Grouping Method", "Method used to define which Group-name to use");
- RNA_def_string(func, "group_name", NULL, 64, "Group Name",
- "Name of Action Group to assign destination to (only if grouping mode is to use this name)");
-
-
- /* Remove Path */
- func = RNA_def_function(srna, "remove", "rna_KeyingSet_paths_remove");
- RNA_def_function_ui_description(func, "Remove the given path from the Keying Set");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* path to remove */
- parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
-
- /* Remove All Paths */
- func = RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
- RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSetPath");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
- RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_active_ksPath_get",
- "rna_KeyingSet_active_ksPath_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_path");
- RNA_def_property_int_funcs(prop, "rna_KeyingSet_active_ksPath_index_get", "rna_KeyingSet_active_ksPath_index_set",
- "rna_KeyingSet_active_ksPath_index_range");
- RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "KeyingSetPaths");
+ srna = RNA_def_struct(brna, "KeyingSetPaths", NULL);
+ RNA_def_struct_sdna(srna, "KeyingSet");
+ RNA_def_struct_ui_text(srna, "Keying set paths", "Collection of keying set paths");
+
+ /* Add Path */
+ func = RNA_def_function(srna, "add", "rna_KeyingSet_paths_add");
+ RNA_def_function_ui_description(func, "Add a new path for the Keying Set");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* return arg */
+ parm = RNA_def_pointer(
+ func, "ksp", "KeyingSetPath", "New Path", "Path created and added to the Keying Set");
+ RNA_def_function_return(func, parm);
+ /* ID-block for target */
+ parm = RNA_def_pointer(
+ func, "target_id", "ID", "Target ID", "ID data-block for the destination");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* rna-path */
+ /* XXX hopefully this is long enough */
+ parm = RNA_def_string(
+ func, "data_path", NULL, 256, "Data-Path", "RNA-Path to destination property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* index (defaults to -1 for entire array) */
+ RNA_def_int(func,
+ "index",
+ -1,
+ -1,
+ INT_MAX,
+ "Index",
+ "The index of the destination property (i.e. axis of Location/Rotation/etc.), "
+ "or -1 for the entire array",
+ 0,
+ INT_MAX);
+ /* grouping */
+ RNA_def_enum(func,
+ "group_method",
+ rna_enum_keyingset_path_grouping_items,
+ KSP_GROUP_KSNAME,
+ "Grouping Method",
+ "Method used to define which Group-name to use");
+ RNA_def_string(
+ func,
+ "group_name",
+ NULL,
+ 64,
+ "Group Name",
+ "Name of Action Group to assign destination to (only if grouping mode is to use this name)");
+
+ /* Remove Path */
+ func = RNA_def_function(srna, "remove", "rna_KeyingSet_paths_remove");
+ RNA_def_function_ui_description(func, "Remove the given path from the Keying Set");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* path to remove */
+ parm = RNA_def_pointer(func, "path", "KeyingSetPath", "Path", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* Remove All Paths */
+ func = RNA_def_function(srna, "clear", "rna_KeyingSet_paths_clear");
+ RNA_def_function_ui_description(func, "Remove all the paths from the Keying Set");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSetPath");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_editable_func(prop, "rna_KeyingSet_active_ksPath_editable");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_KeyingSet_active_ksPath_get", "rna_KeyingSet_active_ksPath_set", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_path");
+ RNA_def_property_int_funcs(prop,
+ "rna_KeyingSet_active_ksPath_index_get",
+ "rna_KeyingSet_active_ksPath_index_set",
+ "rna_KeyingSet_active_ksPath_index_range");
+ RNA_def_property_ui_text(prop, "Active Path Index", "Current Keying Set index");
}
static void rna_def_keyingset(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "KeyingSet", NULL);
- RNA_def_struct_ui_text(srna, "Keying Set", "Settings that should be keyframed together");
-
- /* Id/Label */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
-/* RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL); */ /* NOTE: disabled, as ID name shouldn't be editable */
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_KeyingSet_name_set");
- RNA_def_property_ui_text(prop, "UI Name", "");
- RNA_def_struct_ui_icon(srna, ICON_KEYINGSET);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL);
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "description");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
-
- /* KeyingSetInfo (Type Info) for Builtin Sets only */
- prop = RNA_def_property(srna, "type_info", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSetInfo");
- RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_typeinfo_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Type Info", "Callback function defines for built-in Keying Sets");
-
- /* Paths */
- prop = RNA_def_property(srna, "paths", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "paths", NULL);
- RNA_def_property_struct_type(prop, "KeyingSetPath");
- RNA_def_property_ui_text(prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
- rna_def_keyingset_paths(brna, prop);
-
- /* Flags */
- prop = RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYINGSET_ABSOLUTE);
- RNA_def_property_ui_text(prop, "Absolute",
- "Keying Set defines specific paths/settings to be keyframed "
- "(i.e. is not reliant on context info)");
-
- /* Keyframing Flags */
- rna_def_common_keying_flags(srna, 0);
-
-
- /* Keying Set API */
- RNA_api_keyingset(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "KeyingSet", NULL);
+ RNA_def_struct_ui_text(srna, "Keying Set", "Settings that should be keyframed together");
+
+ /* Id/Label */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "ID Name", KEYINGSET_IDNAME_DOC);
+ /* RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL); */ /* NOTE: disabled, as ID name shouldn't be editable */
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_KeyingSet_name_set");
+ RNA_def_property_ui_text(prop, "UI Name", "");
+ RNA_def_struct_ui_icon(srna, ICON_KEYINGSET);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET | NA_RENAME, NULL);
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "description");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_ui_text(prop, "Description", "A short description of the keying set");
+
+ /* KeyingSetInfo (Type Info) for Builtin Sets only */
+ prop = RNA_def_property(srna, "type_info", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSetInfo");
+ RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_typeinfo_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Type Info", "Callback function defines for built-in Keying Sets");
+
+ /* Paths */
+ prop = RNA_def_property(srna, "paths", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "paths", NULL);
+ RNA_def_property_struct_type(prop, "KeyingSetPath");
+ RNA_def_property_ui_text(
+ prop, "Paths", "Keying Set Paths to define settings that get keyframed together");
+ rna_def_keyingset_paths(brna, prop);
+
+ /* Flags */
+ prop = RNA_def_property(srna, "is_path_absolute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYINGSET_ABSOLUTE);
+ RNA_def_property_ui_text(prop,
+ "Absolute",
+ "Keying Set defines specific paths/settings to be keyframed "
+ "(i.e. is not reliant on context info)");
+
+ /* Keyframing Flags */
+ rna_def_common_keying_flags(srna, 0);
+
+ /* Keying Set API */
+ RNA_api_keyingset(srna);
}
-#undef KEYINGSET_IDNAME_DOC
+# undef KEYINGSET_IDNAME_DOC
/* --- */
static void rna_api_animdata_nla_tracks(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "NlaTracks");
- srna = RNA_def_struct(brna, "NlaTracks", NULL);
- RNA_def_struct_sdna(srna, "AnimData");
- RNA_def_struct_ui_text(srna, "NLA Tracks", "Collection of NLA Tracks");
-
- func = RNA_def_function(srna, "new", "rna_NlaTrack_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a new NLA Track");
- RNA_def_pointer(func, "prev", "NlaTrack", "", "NLA Track to add the new one after");
- /* return type */
- parm = RNA_def_pointer(func, "track", "NlaTrack", "", "New NLA Track");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_NlaTrack_remove");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_MAIN | FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Remove a NLA Track");
- parm = RNA_def_pointer(func, "track", "NlaTrack", "", "NLA Track to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "NlaTrack");
- RNA_def_property_pointer_funcs(prop, "rna_NlaTrack_active_get", "rna_NlaTrack_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
- /* XXX: should (but doesn't) update the active track in the NLA window */
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "NlaTracks");
+ srna = RNA_def_struct(brna, "NlaTracks", NULL);
+ RNA_def_struct_sdna(srna, "AnimData");
+ RNA_def_struct_ui_text(srna, "NLA Tracks", "Collection of NLA Tracks");
+
+ func = RNA_def_function(srna, "new", "rna_NlaTrack_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Add a new NLA Track");
+ RNA_def_pointer(func, "prev", "NlaTrack", "", "NLA Track to add the new one after");
+ /* return type */
+ parm = RNA_def_pointer(func, "track", "NlaTrack", "", "New NLA Track");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_NlaTrack_remove");
+ RNA_def_function_flag(func,
+ FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_MAIN | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Remove a NLA Track");
+ parm = RNA_def_pointer(func, "track", "NlaTrack", "", "NLA Track to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "NlaTrack");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_NlaTrack_active_get", "rna_NlaTrack_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
+ /* XXX: should (but doesn't) update the active track in the NLA window */
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_SELECTED, NULL);
}
static void rna_api_animdata_drivers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- /* PropertyRNA *prop; */
-
- RNA_def_property_srna(cprop, "AnimDataDrivers");
- srna = RNA_def_struct(brna, "AnimDataDrivers", NULL);
- RNA_def_struct_sdna(srna, "AnimData");
- RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
-
- /* Match: ActionFCurves.new/remove */
-
- /* AnimData.drivers.new(...) */
- func = RNA_def_function(srna, "new", "rna_Driver_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path to use");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
- /* return type */
- parm = RNA_def_pointer(func, "driver", "FCurve", "", "Newly Driver F-Curve");
- RNA_def_function_return(func, parm);
-
- /* AnimData.drivers.remove(...) */
- func = RNA_def_function(srna, "remove", "rna_Driver_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "driver", "FCurve", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* AnimData.drivers.from_existing(...) */
- func = RNA_def_function(srna, "from_existing", "rna_Driver_from_existing");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Add a new driver given an existing one");
- RNA_def_pointer(func, "src_driver", "FCurve", "", "Existing Driver F-Curve to use as template for a new one");
- /* return type */
- parm = RNA_def_pointer(func, "driver", "FCurve", "", "New Driver F-Curve");
- RNA_def_function_return(func, parm);
-
- /* AnimData.drivers.find(...) */
- func = RNA_def_function(srna, "find", "rna_Driver_find");
- RNA_def_function_ui_description(func, "Find a driver F-Curve. Note that this function performs a linear scan "
- "of all driver F-Curves.");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
- /* return type */
- parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ /* PropertyRNA *prop; */
+
+ RNA_def_property_srna(cprop, "AnimDataDrivers");
+ srna = RNA_def_struct(brna, "AnimDataDrivers", NULL);
+ RNA_def_struct_sdna(srna, "AnimData");
+ RNA_def_struct_ui_text(srna, "Drivers", "Collection of Driver F-Curves");
+
+ /* Match: ActionFCurves.new/remove */
+
+ /* AnimData.drivers.new(...) */
+ func = RNA_def_function(srna, "new", "rna_Driver_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path to use");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+ /* return type */
+ parm = RNA_def_pointer(func, "driver", "FCurve", "", "Newly Driver F-Curve");
+ RNA_def_function_return(func, parm);
+
+ /* AnimData.drivers.remove(...) */
+ func = RNA_def_function(srna, "remove", "rna_Driver_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "driver", "FCurve", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* AnimData.drivers.from_existing(...) */
+ func = RNA_def_function(srna, "from_existing", "rna_Driver_from_existing");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Add a new driver given an existing one");
+ RNA_def_pointer(func,
+ "src_driver",
+ "FCurve",
+ "",
+ "Existing Driver F-Curve to use as template for a new one");
+ /* return type */
+ parm = RNA_def_pointer(func, "driver", "FCurve", "", "New Driver F-Curve");
+ RNA_def_function_return(func, parm);
+
+ /* AnimData.drivers.find(...) */
+ func = RNA_def_function(srna, "find", "rna_Driver_find");
+ RNA_def_function_ui_description(
+ func,
+ "Find a driver F-Curve. Note that this function performs a linear scan "
+ "of all driver F-Curves.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+ /* return type */
+ parm = RNA_def_pointer(
+ func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
+ RNA_def_function_return(func, parm);
}
void rna_def_animdata_common(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "adt");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_override_funcs(prop, NULL, NULL, "rna_AnimaData_override_apply");
- RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "animation_data", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "adt");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_AnimaData_override_apply");
+ RNA_def_property_ui_text(prop, "Animation Data", "Animation data for this data-block");
}
static void rna_def_animdata(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "AnimData", NULL);
- RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for data-block");
- RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
-
- /* NLA */
- prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "nla_tracks", NULL);
- RNA_def_property_struct_type(prop, "NlaTrack");
- RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)");
-
- rna_api_animdata_nla_tracks(brna, prop);
-
- /* Active Action */
- prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
- /* this flag as well as the dynamic test must be defined for this to be editable... */
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
- RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
- RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_dependency_update");
-
- /* Active Action Settings */
- prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "act_extendmode");
- RNA_def_property_enum_items(prop, rna_enum_nla_mode_extend_items);
- RNA_def_property_ui_text(prop, "Action Extrapolation",
- "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update");
-
- prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");
- RNA_def_property_enum_items(prop, rna_enum_nla_mode_blend_items);
- RNA_def_property_ui_text(prop, "Action Blending",
- "Method used for combining Active Action's result with result of NLA stack");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */
-
- prop = RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "act_influence");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Action Influence",
- "Amount the Active Action contributes to the result of the NLA stack");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */
-
- /* Drivers */
- prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL);
- RNA_def_property_struct_type(prop, "FCurve");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this data-block");
-
- rna_api_animdata_drivers(brna, prop);
-
- /* General Settings */
- prop = RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF);
- RNA_def_property_ui_text(prop, "NLA Evaluation Enabled", "NLA stack is evaluated when evaluating this block");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */
-
- prop = RNA_def_property(srna, "use_tweak_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ADT_NLA_EDIT_ON);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_AnimData_tweakmode_set");
- RNA_def_property_ui_text(prop, "Use NLA Tweak Mode", "Whether to enable or disable tweak mode in NLA");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "AnimData", NULL);
+ RNA_def_struct_ui_text(srna, "Animation Data", "Animation data for data-block");
+ RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
+
+ /* NLA */
+ prop = RNA_def_property(srna, "nla_tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "nla_tracks", NULL);
+ RNA_def_property_struct_type(prop, "NlaTrack");
+ RNA_def_property_ui_text(prop, "NLA Tracks", "NLA Tracks (i.e. Animation Layers)");
+
+ rna_api_animdata_nla_tracks(brna, prop);
+
+ /* Active Action */
+ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+ /* this flag as well as the dynamic test must be defined for this to be editable... */
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_AnimData_action_set", NULL, "rna_Action_id_poll");
+ RNA_def_property_editable_func(prop, "rna_AnimData_action_editable");
+ RNA_def_property_ui_text(prop, "Action", "Active Action for this data-block");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA_ACTCHANGE, "rna_AnimData_dependency_update");
+
+ /* Active Action Settings */
+ prop = RNA_def_property(srna, "action_extrapolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "act_extendmode");
+ RNA_def_property_enum_items(prop, rna_enum_nla_mode_extend_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Action Extrapolation",
+ "Action to take for gaps past the Active Action's range (when evaluating with NLA)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update");
+
+ prop = RNA_def_property(srna, "action_blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "act_blendmode");
+ RNA_def_property_enum_items(prop, rna_enum_nla_mode_blend_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Action Blending",
+ "Method used for combining Active Action's result with result of NLA stack");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */
+
+ prop = RNA_def_property(srna, "action_influence", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "act_influence");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Action Influence",
+ "Amount the Active Action contributes to the result of the NLA stack");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */
+
+ /* Drivers */
+ prop = RNA_def_property(srna, "drivers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "drivers", NULL);
+ RNA_def_property_struct_type(prop, "FCurve");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Drivers", "The Drivers/Expressions for this data-block");
+
+ rna_api_animdata_drivers(brna, prop);
+
+ /* General Settings */
+ prop = RNA_def_property(srna, "use_nla", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ADT_NLA_EVAL_OFF);
+ RNA_def_property_ui_text(
+ prop, "NLA Evaluation Enabled", "NLA stack is evaluated when evaluating this block");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update"); /* this will do? */
+
+ prop = RNA_def_property(srna, "use_tweak_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ADT_NLA_EDIT_ON);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_AnimData_tweakmode_set");
+ RNA_def_property_ui_text(
+ prop, "Use NLA Tweak Mode", "Whether to enable or disable tweak mode in NLA");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, "rna_AnimData_update");
}
/* --- */
void RNA_def_animation(BlenderRNA *brna)
{
- rna_def_animdata(brna);
+ rna_def_animdata(brna);
- rna_def_keyingset(brna);
- rna_def_keyingset_path(brna);
- rna_def_keyingset_info(brna);
+ rna_def_keyingset(brna);
+ rna_def_keyingset_path(brna);
+ rna_def_keyingset_info(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c
index 6bc891259ad..f201b8e6e99 100644
--- a/source/blender/makesrna/intern/rna_animation_api.c
+++ b/source/blender/makesrna/intern/rna_animation_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -32,46 +31,48 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "BKE_context.h"
-#include "BKE_report.h"
+# include "BKE_context.h"
+# include "BKE_report.h"
-#include "ED_keyframing.h"
+# include "ED_keyframing.h"
static void rna_KeyingSet_context_refresh(KeyingSet *ks, bContext *C, ReportList *reports)
{
- /* TODO: enable access to providing a list of overrides (dsources)? */
- int success = ANIM_validate_keyingset(C, NULL, ks);
-
- if (success != 0) {
- switch (success) {
- case MODIFYKEY_INVALID_CONTEXT:
- BKE_report(reports, RPT_ERROR, "Invalid context for keying set");
- break;
-
- case MODIFYKEY_MISSING_TYPEINFO:
- BKE_report(reports, RPT_ERROR, "Incomplete built-in keying set, appears to be missing type info");
- break;
- }
- }
+ /* TODO: enable access to providing a list of overrides (dsources)? */
+ int success = ANIM_validate_keyingset(C, NULL, ks);
+
+ if (success != 0) {
+ switch (success) {
+ case MODIFYKEY_INVALID_CONTEXT:
+ BKE_report(reports, RPT_ERROR, "Invalid context for keying set");
+ break;
+
+ case MODIFYKEY_MISSING_TYPEINFO:
+ BKE_report(
+ reports, RPT_ERROR, "Incomplete built-in keying set, appears to be missing type info");
+ break;
+ }
+ }
}
#else
void RNA_api_keyingset(StructRNA *srna)
{
- FunctionRNA *func;
- /*PropertyRNA *parm; */
-
- /* validate relative Keying Set (used to ensure paths are ok for context) */
- func = RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh");
- RNA_def_function_ui_description(func,
- "Refresh Keying Set to ensure that it is valid for the current context "
- "(call before each use of one)");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ FunctionRNA *func;
+ /*PropertyRNA *parm; */
+
+ /* validate relative Keying Set (used to ensure paths are ok for context) */
+ func = RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh");
+ RNA_def_function_ui_description(
+ func,
+ "Refresh Keying Set to ensure that it is valid for the current context "
+ "(call before each use of one)");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_animviz.c b/source/blender/makesrna/intern/rna_animviz.c
index 605b10e5848..7d034068311 100644
--- a/source/blender/makesrna/intern/rna_animviz.c
+++ b/source/blender/makesrna/intern/rna_animviz.c
@@ -38,277 +38,310 @@
/* Which part of bone(s) get baked */
// TODO: icons?
const EnumPropertyItem rna_enum_motionpath_bake_location_items[] = {
- {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
- {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"},
- //{MOTIONPATH_BAKE_CENTERS, "CENTROID", 0, "Centers", "Calculate bone paths from center of mass"},
- {0, NULL, 0, NULL, NULL},
+ {MOTIONPATH_BAKE_HEADS, "HEADS", 0, "Heads", "Calculate bone paths from heads"},
+ {0, "TAILS", 0, "Tails", "Calculate bone paths from tails"},
+ //{MOTIONPATH_BAKE_CENTERS, "CENTROID", 0, "Centers", "Calculate bone paths from center of mass"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static PointerRNA rna_AnimViz_motion_paths_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_AnimVizMotionPaths, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_AnimVizMotionPaths, ptr->data);
}
static void rna_AnimViz_path_start_frame_set(PointerRNA *ptr, int value)
{
- bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
+ bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
- /* XXX: watchit! Path Start > MAXFRAME/2 could be a problem... */
- data->path_sf = value;
- CLAMP(data->path_ef, data->path_sf + 1, MAXFRAME / 2);
+ /* XXX: watchit! Path Start > MAXFRAME/2 could be a problem... */
+ data->path_sf = value;
+ CLAMP(data->path_ef, data->path_sf + 1, MAXFRAME / 2);
}
static void rna_AnimViz_path_end_frame_set(PointerRNA *ptr, int value)
{
- bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
+ bAnimVizSettings *data = (bAnimVizSettings *)ptr->data;
- data->path_ef = value;
- CLAMP(data->path_sf, 1, data->path_ef - 1);
+ data->path_ef = value;
+ CLAMP(data->path_sf, 1, data->path_ef - 1);
}
#else
void rna_def_motionpath_common(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mpath");
- RNA_def_property_ui_text(prop, "Motion Path", "Motion Path for this element");
+ prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mpath");
+ RNA_def_property_ui_text(prop, "Motion Path", "Motion Path for this element");
}
static void rna_def_animviz_motionpath_vert(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MotionPathVert", NULL);
- RNA_def_struct_sdna(srna, "bMotionPathVert");
- RNA_def_struct_ui_text(srna, "Motion Path Cache Point", "Cached location on path");
+ srna = RNA_def_struct(brna, "MotionPathVert", NULL);
+ RNA_def_struct_sdna(srna, "bMotionPathVert");
+ RNA_def_struct_ui_text(srna, "Motion Path Cache Point", "Cached location on path");
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Coordinates", "");
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Coordinates", "");
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_VERT_SEL);
- RNA_def_property_ui_text(prop, "Select", "Path point is selected for editing");
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_VERT_SEL);
+ RNA_def_property_ui_text(prop, "Select", "Path point is selected for editing");
}
static void rna_def_animviz_motion_path(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MotionPath", NULL);
- RNA_def_struct_sdna(srna, "bMotionPath");
- RNA_def_struct_ui_text(srna, "Motion Path", "Cache of the worldspace positions of an element over a frame range");
-
- /* Collections */
- prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "points", "length");
- RNA_def_property_struct_type(prop, "MotionPathVert");
- RNA_def_property_ui_text(prop, "Motion Path Points", "Cached positions per frame");
-
- /* Playback Ranges */
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "start_frame");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of the stored range");
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "end_frame");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "End Frame", "End frame of the stored range");
-
- prop = RNA_def_property(srna, "length", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Length", "Number of frames cached");
-
- /* Custom Color */
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Custom color for motion path");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Line width */
- prop = RNA_def_property(srna, "line_thickness", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "line_thickness");
- RNA_def_property_range(prop, 1, 6);
- RNA_def_property_ui_text(prop, "Line thickness", "Line thickness for drawing path");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Settings */
- prop = RNA_def_property(srna, "use_bone_head", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_BHEAD);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* xxx */
- RNA_def_property_ui_text(prop, "Use Bone Heads",
- "For PoseBone paths, use the bone head location when calculating this path");
-
- /* FIXME: Motion Paths are not currently editable... */
- prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_EDIT);
- RNA_def_property_ui_text(prop, "Edit Path", "Path is being edited");
-
- /* Use custom color */
- prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_CUSTOM);
- RNA_def_property_ui_text(prop, "Custom colors", "Use custom color for this motion path");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Draw lines between keyframes */
- prop = RNA_def_property(srna, "lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_LINES);
- RNA_def_property_ui_text(prop, "Lines", "Draw straight lines between keyframe points");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MotionPath", NULL);
+ RNA_def_struct_sdna(srna, "bMotionPath");
+ RNA_def_struct_ui_text(
+ srna, "Motion Path", "Cache of the worldspace positions of an element over a frame range");
+
+ /* Collections */
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "points", "length");
+ RNA_def_property_struct_type(prop, "MotionPathVert");
+ RNA_def_property_ui_text(prop, "Motion Path Points", "Cached positions per frame");
+
+ /* Playback Ranges */
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "start_frame");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Start Frame", "Starting frame of the stored range");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "end_frame");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "End Frame", "End frame of the stored range");
+
+ prop = RNA_def_property(srna, "length", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Length", "Number of frames cached");
+
+ /* Custom Color */
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Custom color for motion path");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Line width */
+ prop = RNA_def_property(srna, "line_thickness", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "line_thickness");
+ RNA_def_property_range(prop, 1, 6);
+ RNA_def_property_ui_text(prop, "Line thickness", "Line thickness for drawing path");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Settings */
+ prop = RNA_def_property(srna, "use_bone_head", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_BHEAD);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* xxx */
+ RNA_def_property_ui_text(
+ prop,
+ "Use Bone Heads",
+ "For PoseBone paths, use the bone head location when calculating this path");
+
+ /* FIXME: Motion Paths are not currently editable... */
+ prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_EDIT);
+ RNA_def_property_ui_text(prop, "Edit Path", "Path is being edited");
+
+ /* Use custom color */
+ prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_CUSTOM);
+ RNA_def_property_ui_text(prop, "Custom colors", "Use custom color for this motion path");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Draw lines between keyframes */
+ prop = RNA_def_property(srna, "lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOTIONPATH_FLAG_LINES);
+ RNA_def_property_ui_text(prop, "Lines", "Draw straight lines between keyframe points");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
/* --- */
static void rna_def_animviz_paths(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_type_items[] = {
- {MOTIONPATH_TYPE_ACFRA, "CURRENT_FRAME", 0, "Around Frame",
- "Display Paths of poses within a fixed number of frames around the current frame"},
- {MOTIONPATH_TYPE_RANGE, "RANGE", 0, "In Range", "Display Paths of poses within specified range"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
- RNA_def_struct_sdna(srna, "bAnimVizSettings");
- RNA_def_struct_nested(brna, srna, "AnimViz");
- RNA_def_struct_ui_text(srna, "Motion Path Settings", "Motion Path settings for animation visualization");
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "path_type");
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Paths Type", "Type of range to show for Motion Paths");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "path_bakeflag");
- RNA_def_property_enum_items(prop, rna_enum_motionpath_bake_location_items);
- RNA_def_property_ui_text(prop, "Bake Location", "When calculating Bone Paths, use Head or Tips");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- /* Settings */
- prop = RNA_def_property(srna, "show_frame_numbers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_FNUMS);
- RNA_def_property_ui_text(prop, "Show Frame Numbers", "Show frame numbers on Motion Paths");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "show_keyframe_highlight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFRAS);
- RNA_def_property_ui_text(prop, "Highlight Keyframes", "Emphasize position of keyframes on Motion Paths");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "show_keyframe_numbers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFNOS);
- RNA_def_property_ui_text(prop, "Show Keyframe Numbers", "Show frame numbers of Keyframes on Motion Paths");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "show_keyframe_action_all", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFACT);
- RNA_def_property_ui_text(prop, "All Action Keyframes",
- "For bone motion paths, search whole Action for keyframes instead of in group"
- " with matching name only (is slower)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "path_step");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Frame Step",
- "Number of frames between paths shown (not for 'On Keyframes' Onion-skinning method)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
-
- /* Playback Ranges */
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "path_sf");
- RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Start Frame",
- "Starting frame of range of paths to display/calculate "
- "(not for 'Around Current Frame' Onion-skinning method)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "path_ef");
- RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_end_frame_set", NULL);
- RNA_def_property_ui_text(prop, "End Frame",
- "End frame of range of paths to display/calculate "
- "(not for 'Around Current Frame' Onion-skinning method)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- /* Around Current Ranges */
- prop = RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "path_bc");
- RNA_def_property_range(prop, 1, MAXFRAMEF / 2);
- RNA_def_property_ui_text(prop, "Before Current",
- "Number of frames to show before the current frame "
- "(only for 'Around Current Frame' Onion-skinning method)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
- prop = RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "path_ac");
- RNA_def_property_range(prop, 1, MAXFRAMEF / 2);
- RNA_def_property_ui_text(prop, "After Current",
- "Number of frames to show after the current frame "
- "(only for 'Around Current Frame' Onion-skinning method)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
-
-
- /* Readonly Property - Do any motion paths exist/need updating? (Mainly for bone paths) */
- prop = RNA_def_property(srna, "has_motion_paths", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "path_bakeflag", MOTIONPATH_BAKE_HAS_PATHS);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* NOTE: This is really an internal state var for convenience, so don't allow edits! */
- RNA_def_property_ui_text(prop, "Has Motion Paths", "Are there any bone paths that will need updating (read-only)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_type_items[] = {
+ {MOTIONPATH_TYPE_ACFRA,
+ "CURRENT_FRAME",
+ 0,
+ "Around Frame",
+ "Display Paths of poses within a fixed number of frames around the current frame"},
+ {MOTIONPATH_TYPE_RANGE,
+ "RANGE",
+ 0,
+ "In Range",
+ "Display Paths of poses within specified range"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "AnimVizMotionPaths", NULL);
+ RNA_def_struct_sdna(srna, "bAnimVizSettings");
+ RNA_def_struct_nested(brna, srna, "AnimViz");
+ RNA_def_struct_ui_text(
+ srna, "Motion Path Settings", "Motion Path settings for animation visualization");
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "path_type");
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "Paths Type", "Type of range to show for Motion Paths");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "bake_location", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "path_bakeflag");
+ RNA_def_property_enum_items(prop, rna_enum_motionpath_bake_location_items);
+ RNA_def_property_ui_text(prop, "Bake Location", "When calculating Bone Paths, use Head or Tips");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ /* Settings */
+ prop = RNA_def_property(srna, "show_frame_numbers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_FNUMS);
+ RNA_def_property_ui_text(prop, "Show Frame Numbers", "Show frame numbers on Motion Paths");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "show_keyframe_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFRAS);
+ RNA_def_property_ui_text(
+ prop, "Highlight Keyframes", "Emphasize position of keyframes on Motion Paths");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "show_keyframe_numbers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFNOS);
+ RNA_def_property_ui_text(
+ prop, "Show Keyframe Numbers", "Show frame numbers of Keyframes on Motion Paths");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "show_keyframe_action_all", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_viewflag", MOTIONPATH_VIEW_KFACT);
+ RNA_def_property_ui_text(
+ prop,
+ "All Action Keyframes",
+ "For bone motion paths, search whole Action for keyframes instead of in group"
+ " with matching name only (is slower)");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "path_step");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(
+ prop,
+ "Frame Step",
+ "Number of frames between paths shown (not for 'On Keyframes' Onion-skinning method)");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ /* Playback Ranges */
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "path_sf");
+ RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_start_frame_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "Start Frame",
+ "Starting frame of range of paths to display/calculate "
+ "(not for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "path_ef");
+ RNA_def_property_int_funcs(prop, NULL, "rna_AnimViz_path_end_frame_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "End Frame",
+ "End frame of range of paths to display/calculate "
+ "(not for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ /* Around Current Ranges */
+ prop = RNA_def_property(srna, "frame_before", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "path_bc");
+ RNA_def_property_range(prop, 1, MAXFRAMEF / 2);
+ RNA_def_property_ui_text(prop,
+ "Before Current",
+ "Number of frames to show before the current frame "
+ "(only for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ prop = RNA_def_property(srna, "frame_after", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "path_ac");
+ RNA_def_property_range(prop, 1, MAXFRAMEF / 2);
+ RNA_def_property_ui_text(prop,
+ "After Current",
+ "Number of frames to show after the current frame "
+ "(only for 'Around Current Frame' Onion-skinning method)");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, NULL); /* XXX since this is only for 3d-view drawing */
+
+ /* Readonly Property - Do any motion paths exist/need updating? (Mainly for bone paths) */
+ prop = RNA_def_property(srna, "has_motion_paths", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "path_bakeflag", MOTIONPATH_BAKE_HAS_PATHS);
+ RNA_def_property_clear_flag(
+ prop,
+ PROP_EDITABLE); /* NOTE: This is really an internal state var for convenience, so don't allow edits! */
+ RNA_def_property_ui_text(
+ prop, "Has Motion Paths", "Are there any bone paths that will need updating (read-only)");
}
/* --- */
void rna_def_animviz_common(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "animation_visualization", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "avs");
- RNA_def_property_ui_text(prop, "Animation Visualization", "Animation data for this data-block");
+ prop = RNA_def_property(srna, "animation_visualization", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "avs");
+ RNA_def_property_ui_text(prop, "Animation Visualization", "Animation data for this data-block");
}
static void rna_def_animviz(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "AnimViz", NULL);
- RNA_def_struct_sdna(srna, "bAnimVizSettings");
- RNA_def_struct_ui_text(srna, "Animation Visualization", "Settings for the visualization of motion");
-
- /* motion path settings (nested struct) */
- prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "AnimVizMotionPaths");
- RNA_def_property_pointer_funcs(prop, "rna_AnimViz_motion_paths_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Motion Paths", "Motion Path settings for visualization");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "AnimViz", NULL);
+ RNA_def_struct_sdna(srna, "bAnimVizSettings");
+ RNA_def_struct_ui_text(
+ srna, "Animation Visualization", "Settings for the visualization of motion");
+
+ /* motion path settings (nested struct) */
+ prop = RNA_def_property(srna, "motion_path", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "AnimVizMotionPaths");
+ RNA_def_property_pointer_funcs(prop, "rna_AnimViz_motion_paths_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Motion Paths", "Motion Path settings for visualization");
}
/* --- */
void RNA_def_animviz(BlenderRNA *brna)
{
- rna_def_animviz(brna);
- rna_def_animviz_paths(brna);
+ rna_def_animviz(brna);
+ rna_def_animviz_paths(brna);
- rna_def_animviz_motion_path(brna);
- rna_def_animviz_motionpath_vert(brna);
+ rna_def_animviz_motion_path(brna);
+ rna_def_animviz_motionpath_vert(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c
index 4440cd2313c..0c8c887d882 100644
--- a/source/blender/makesrna/intern/rna_armature.c
+++ b/source/blender/makesrna/intern/rna_armature.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include "BLI_math.h"
@@ -37,219 +36,231 @@
#ifdef RNA_RUNTIME
-#include "BKE_action.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
-#include "BKE_main.h"
+# include "BKE_action.h"
+# include "BKE_context.h"
+# include "BKE_global.h"
+# include "BKE_idprop.h"
+# include "BKE_main.h"
-#include "ED_armature.h"
-#include "BKE_armature.h"
+# include "ED_armature.h"
+# include "BKE_armature.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static void rna_Armature_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
- /*WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL); */
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ /*WM_main_add_notifier(NC_OBJECT|ND_POSE, NULL); */
}
static void rna_Armature_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
static void rna_Armature_act_bone_set(PointerRNA *ptr, PointerRNA value)
{
- bArmature *arm = (bArmature *)ptr->data;
-
- if (value.id.data == NULL && value.data == NULL) {
- arm->act_bone = NULL;
- }
- else {
- if (value.id.data != arm) {
- Object *ob = (Object *)value.id.data;
-
- if (GS(ob->id.name) != ID_OB || (ob->data != arm)) {
- printf("ERROR: armature set active bone - new active doesn't come from this armature\n");
- return;
- }
- }
-
- arm->act_bone = value.data;
- arm->act_bone->flag |= BONE_SELECTED;
- }
+ bArmature *arm = (bArmature *)ptr->data;
+
+ if (value.id.data == NULL && value.data == NULL) {
+ arm->act_bone = NULL;
+ }
+ else {
+ if (value.id.data != arm) {
+ Object *ob = (Object *)value.id.data;
+
+ if (GS(ob->id.name) != ID_OB || (ob->data != arm)) {
+ printf("ERROR: armature set active bone - new active doesn't come from this armature\n");
+ return;
+ }
+ }
+
+ arm->act_bone = value.data;
+ arm->act_bone->flag |= BONE_SELECTED;
+ }
}
static void rna_Armature_act_edit_bone_set(PointerRNA *ptr, PointerRNA value)
{
- bArmature *arm = (bArmature *)ptr->data;
-
- if (value.id.data == NULL && value.data == NULL) {
- arm->act_edbone = NULL;
- }
- else {
- if (value.id.data != arm) {
- /* raise an error! */
- }
- else {
- arm->act_edbone = value.data;
- ((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
- }
- }
+ bArmature *arm = (bArmature *)ptr->data;
+
+ if (value.id.data == NULL && value.data == NULL) {
+ arm->act_edbone = NULL;
+ }
+ else {
+ if (value.id.data != arm) {
+ /* raise an error! */
+ }
+ else {
+ arm->act_edbone = value.data;
+ ((EditBone *)arm->act_edbone)->flag |= BONE_SELECTED;
+ }
+ }
}
static EditBone *rna_Armature_edit_bone_new(bArmature *arm, ReportList *reports, const char *name)
{
- if (arm->edbo == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in edit mode, cannot add an editbone", arm->id.name + 2);
- return NULL;
- }
- return ED_armature_ebone_add(arm, name);
+ if (arm->edbo == NULL) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Armature '%s' not in edit mode, cannot add an editbone",
+ arm->id.name + 2);
+ return NULL;
+ }
+ return ED_armature_ebone_add(arm, name);
}
-static void rna_Armature_edit_bone_remove(bArmature *arm, ReportList *reports, PointerRNA *ebone_ptr)
+static void rna_Armature_edit_bone_remove(bArmature *arm,
+ ReportList *reports,
+ PointerRNA *ebone_ptr)
{
- EditBone *ebone = ebone_ptr->data;
- if (arm->edbo == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Armature '%s' not in edit mode, cannot remove an editbone", arm->id.name + 2);
- return;
- }
-
- if (BLI_findindex(arm->edbo, ebone) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Armature '%s' does not contain bone '%s'", arm->id.name + 2, ebone->name);
- return;
- }
-
- ED_armature_ebone_remove(arm, ebone);
- RNA_POINTER_INVALIDATE(ebone_ptr);
+ EditBone *ebone = ebone_ptr->data;
+ if (arm->edbo == NULL) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Armature '%s' not in edit mode, cannot remove an editbone",
+ arm->id.name + 2);
+ return;
+ }
+
+ if (BLI_findindex(arm->edbo, ebone) == -1) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Armature '%s' does not contain bone '%s'",
+ arm->id.name + 2,
+ ebone->name);
+ return;
+ }
+
+ ED_armature_ebone_remove(arm, ebone);
+ RNA_POINTER_INVALIDATE(ebone_ptr);
}
static void rna_Armature_update_layers(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bArmature *arm = ptr->id.data;
- Object *ob;
-
- /* proxy lib exception, store it here so we can restore layers on file
- * load, since it would otherwise get lost due to being linked data */
- for (ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (ob->data == arm && ob->pose)
- ob->pose->proxy_layer = arm->layer;
- }
-
- DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
- WM_main_add_notifier(NC_GEOM | ND_DATA, arm);
+ bArmature *arm = ptr->id.data;
+ Object *ob;
+
+ /* proxy lib exception, store it here so we can restore layers on file
+ * load, since it would otherwise get lost due to being linked data */
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (ob->data == arm && ob->pose)
+ ob->pose->proxy_layer = arm->layer;
+ }
+
+ DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, arm);
}
static void rna_Armature_redraw_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
/* called whenever a bone is renamed */
static void rna_Bone_update_renamed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- /* redraw view */
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ /* redraw view */
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
- /* update animation channels */
- WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
+ /* update animation channels */
+ WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
}
static void rna_Bone_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
-
- /* 1) special updates for cases where rigs try to hook into armature drawing stuff
- * e.g. Mask Modifier - 'Armature' option
- * 2) tag armature for copy-on-write, so that selection status (set by addons)
- * will update properly, like standard tools do already
- */
- if (id) {
- if (GS(id->name) == ID_AR) {
- bArmature *arm = (bArmature *)id;
-
- if (arm->flag & ARM_HAS_VIZ_DEPS) {
- DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
- }
-
- DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);
- }
- else if (GS(id->name) == ID_OB) {
- Object *ob = (Object *)id;
- bArmature *arm = (bArmature *)ob->data;
-
- if (arm->flag & ARM_HAS_VIZ_DEPS) {
- DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
- }
-
- DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
- }
- }
-
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
-
- /* spaces that show animation data of the selected bone need updating */
- WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
+ ID *id = ptr->id.data;
+
+ /* 1) special updates for cases where rigs try to hook into armature drawing stuff
+ * e.g. Mask Modifier - 'Armature' option
+ * 2) tag armature for copy-on-write, so that selection status (set by addons)
+ * will update properly, like standard tools do already
+ */
+ if (id) {
+ if (GS(id->name) == ID_AR) {
+ bArmature *arm = (bArmature *)id;
+
+ if (arm->flag & ARM_HAS_VIZ_DEPS) {
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
+ }
+
+ DEG_id_tag_update(id, ID_RECALC_COPY_ON_WRITE);
+ }
+ else if (GS(id->name) == ID_OB) {
+ Object *ob = (Object *)id;
+ bArmature *arm = (bArmature *)ob->data;
+
+ if (arm->flag & ARM_HAS_VIZ_DEPS) {
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
+ }
+
+ DEG_id_tag_update(&arm->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+
+ /* spaces that show animation data of the selected bone need updating */
+ WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN, id);
}
static char *rna_Bone_path(PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- Bone *bone = (Bone *)ptr->data;
- char name_esc[sizeof(bone->name) * 2];
-
- BLI_strescape(name_esc, bone->name, sizeof(name_esc));
-
- /* special exception for trying to get the path where ID-block is Object
- * - this will be assumed to be from a Pose Bone...
- */
- if (id) {
- if (GS(id->name) == ID_OB) {
- return BLI_sprintfN("pose.bones[\"%s\"].bone", name_esc);
- }
- }
-
- /* from armature... */
- return BLI_sprintfN("bones[\"%s\"]", name_esc);
+ ID *id = ptr->id.data;
+ Bone *bone = (Bone *)ptr->data;
+ char name_esc[sizeof(bone->name) * 2];
+
+ BLI_strescape(name_esc, bone->name, sizeof(name_esc));
+
+ /* special exception for trying to get the path where ID-block is Object
+ * - this will be assumed to be from a Pose Bone...
+ */
+ if (id) {
+ if (GS(id->name) == ID_OB) {
+ return BLI_sprintfN("pose.bones[\"%s\"].bone", name_esc);
+ }
+ }
+
+ /* from armature... */
+ return BLI_sprintfN("bones[\"%s\"]", name_esc);
}
static IDProperty *rna_Bone_idprops(PointerRNA *ptr, bool create)
{
- Bone *bone = ptr->data;
+ Bone *bone = ptr->data;
- if (create && !bone->prop) {
- IDPropertyTemplate val = {0};
- bone->prop = IDP_New(IDP_GROUP, &val, "RNA_Bone ID properties");
- }
+ if (create && !bone->prop) {
+ IDPropertyTemplate val = {0};
+ bone->prop = IDP_New(IDP_GROUP, &val, "RNA_Bone ID properties");
+ }
- return bone->prop;
+ return bone->prop;
}
static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, bool create)
{
- EditBone *ebone = ptr->data;
+ EditBone *ebone = ptr->data;
- if (create && !ebone->prop) {
- IDPropertyTemplate val = {0};
- ebone->prop = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
- }
+ if (create && !ebone->prop) {
+ IDPropertyTemplate val = {0};
+ ebone->prop = IDP_New(IDP_GROUP, &val, "RNA_EditBone ID properties");
+ }
- return ebone->prop;
+ return ebone->prop;
}
/* Update the layers_used variable after bones are moved between layer
@@ -258,315 +269,321 @@ static IDProperty *rna_EditBone_idprops(PointerRNA *ptr, bool create)
*/
static void rna_Armature_layer_used_refresh(bArmature *arm, ListBase *bones)
{
- for (Bone *bone = bones->first; bone; bone = bone->next) {
- arm->layer_used |= bone->layer;
- rna_Armature_layer_used_refresh(arm, &bone->childbase);
- }
+ for (Bone *bone = bones->first; bone; bone = bone->next) {
+ arm->layer_used |= bone->layer;
+ rna_Armature_layer_used_refresh(arm, &bone->childbase);
+ }
}
static void rna_bone_layer_set(int *layer, const bool *values)
{
- int i, tot = 0;
-
- /* ensure we always have some layer selected */
- for (i = 0; i < 32; i++)
- if (values[i])
- tot++;
-
- if (tot == 0)
- return;
-
- for (i = 0; i < 32; i++) {
- if (values[i]) *layer |= (1u << i);
- else *layer &= ~(1u << i);
- }
+ int i, tot = 0;
+
+ /* ensure we always have some layer selected */
+ for (i = 0; i < 32; i++)
+ if (values[i])
+ tot++;
+
+ if (tot == 0)
+ return;
+
+ for (i = 0; i < 32; i++) {
+ if (values[i])
+ *layer |= (1u << i);
+ else
+ *layer &= ~(1u << i);
+ }
}
static void rna_Bone_layer_set(PointerRNA *ptr, const bool *values)
{
- bArmature *arm = (bArmature *)ptr->id.data;
- Bone *bone = (Bone *)ptr->data;
+ bArmature *arm = (bArmature *)ptr->id.data;
+ Bone *bone = (Bone *)ptr->data;
- rna_bone_layer_set(&bone->layer, values);
+ rna_bone_layer_set(&bone->layer, values);
- arm->layer_used = 0;
- rna_Armature_layer_used_refresh(arm, &arm->bonebase);
+ arm->layer_used = 0;
+ rna_Armature_layer_used_refresh(arm, &arm->bonebase);
}
static void rna_Armature_layer_set(PointerRNA *ptr, const bool *values)
{
- bArmature *arm = (bArmature *)ptr->data;
- int i, tot = 0;
-
- /* ensure we always have some layer selected */
- for (i = 0; i < 32; i++)
- if (values[i])
- tot++;
-
- if (tot == 0)
- return;
-
- for (i = 0; i < 32; i++) {
- if (values[i]) arm->layer |= (1u << i);
- else arm->layer &= ~(1u << i);
- }
+ bArmature *arm = (bArmature *)ptr->data;
+ int i, tot = 0;
+
+ /* ensure we always have some layer selected */
+ for (i = 0; i < 32; i++)
+ if (values[i])
+ tot++;
+
+ if (tot == 0)
+ return;
+
+ for (i = 0; i < 32; i++) {
+ if (values[i])
+ arm->layer |= (1u << i);
+ else
+ arm->layer &= ~(1u << i);
+ }
}
static void rna_EditBone_name_set(PointerRNA *ptr, const char *value)
{
- bArmature *arm = (bArmature *)ptr->id.data;
- EditBone *ebone = (EditBone *)ptr->data;
- char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
+ bArmature *arm = (bArmature *)ptr->id.data;
+ EditBone *ebone = (EditBone *)ptr->data;
+ char oldname[sizeof(ebone->name)], newname[sizeof(ebone->name)];
- /* need to be on the stack */
- BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
- BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
+ /* need to be on the stack */
+ BLI_strncpy_utf8(newname, value, sizeof(ebone->name));
+ BLI_strncpy(oldname, ebone->name, sizeof(ebone->name));
- BLI_assert(BKE_id_is_in_global_main(&arm->id));
- ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
+ BLI_assert(BKE_id_is_in_global_main(&arm->id));
+ ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
}
static void rna_Bone_name_set(PointerRNA *ptr, const char *value)
{
- bArmature *arm = (bArmature *)ptr->id.data;
- Bone *bone = (Bone *)ptr->data;
- char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
+ bArmature *arm = (bArmature *)ptr->id.data;
+ Bone *bone = (Bone *)ptr->data;
+ char oldname[sizeof(bone->name)], newname[sizeof(bone->name)];
- /* need to be on the stack */
- BLI_strncpy_utf8(newname, value, sizeof(bone->name));
- BLI_strncpy(oldname, bone->name, sizeof(bone->name));
+ /* need to be on the stack */
+ BLI_strncpy_utf8(newname, value, sizeof(bone->name));
+ BLI_strncpy(oldname, bone->name, sizeof(bone->name));
- BLI_assert(BKE_id_is_in_global_main(&arm->id));
- ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
+ BLI_assert(BKE_id_is_in_global_main(&arm->id));
+ ED_armature_bone_rename(G_MAIN, arm, oldname, newname);
}
static void rna_EditBone_layer_set(PointerRNA *ptr, const bool values[])
{
- EditBone *data = (EditBone *)(ptr->data);
- rna_bone_layer_set(&data->layer, values);
+ EditBone *data = (EditBone *)(ptr->data);
+ rna_bone_layer_set(&data->layer, values);
}
static void rna_EditBone_connected_check(EditBone *ebone)
{
- if (ebone->parent) {
- if (ebone->flag & BONE_CONNECTED) {
- /* Attach this bone to its parent */
- copy_v3_v3(ebone->head, ebone->parent->tail);
-
- if (ebone->flag & BONE_ROOTSEL)
- ebone->parent->flag |= BONE_TIPSEL;
- }
- else if (!(ebone->parent->flag & BONE_ROOTSEL)) {
- ebone->parent->flag &= ~BONE_TIPSEL;
- }
- }
+ if (ebone->parent) {
+ if (ebone->flag & BONE_CONNECTED) {
+ /* Attach this bone to its parent */
+ copy_v3_v3(ebone->head, ebone->parent->tail);
+
+ if (ebone->flag & BONE_ROOTSEL)
+ ebone->parent->flag |= BONE_TIPSEL;
+ }
+ else if (!(ebone->parent->flag & BONE_ROOTSEL)) {
+ ebone->parent->flag &= ~BONE_TIPSEL;
+ }
+ }
}
static void rna_EditBone_connected_set(PointerRNA *ptr, bool value)
{
- EditBone *ebone = (EditBone *)(ptr->data);
+ EditBone *ebone = (EditBone *)(ptr->data);
- if (value) ebone->flag |= BONE_CONNECTED;
- else ebone->flag &= ~BONE_CONNECTED;
+ if (value)
+ ebone->flag |= BONE_CONNECTED;
+ else
+ ebone->flag &= ~BONE_CONNECTED;
- rna_EditBone_connected_check(ebone);
+ rna_EditBone_connected_check(ebone);
}
static PointerRNA rna_EditBone_parent_get(PointerRNA *ptr)
{
- EditBone *data = (EditBone *)(ptr->data);
- return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->parent);
+ EditBone *data = (EditBone *)(ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->parent);
}
static void rna_EditBone_parent_set(PointerRNA *ptr, PointerRNA value)
{
- EditBone *ebone = (EditBone *)(ptr->data);
- EditBone *pbone, *parbone = (EditBone *)value.data;
-
- if (parbone == NULL) {
- if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
- ebone->parent->flag &= ~BONE_TIPSEL;
-
- ebone->parent = NULL;
- ebone->flag &= ~BONE_CONNECTED;
- }
- else {
- /* within same armature */
- if (value.id.data != ptr->id.data)
- return;
-
- /* make sure this is a valid child */
- if (parbone == ebone)
- return;
-
- for (pbone = parbone->parent; pbone; pbone = pbone->parent)
- if (pbone == ebone)
- return;
-
- ebone->parent = parbone;
- rna_EditBone_connected_check(ebone);
- }
+ EditBone *ebone = (EditBone *)(ptr->data);
+ EditBone *pbone, *parbone = (EditBone *)value.data;
+
+ if (parbone == NULL) {
+ if (ebone->parent && !(ebone->parent->flag & BONE_ROOTSEL))
+ ebone->parent->flag &= ~BONE_TIPSEL;
+
+ ebone->parent = NULL;
+ ebone->flag &= ~BONE_CONNECTED;
+ }
+ else {
+ /* within same armature */
+ if (value.id.data != ptr->id.data)
+ return;
+
+ /* make sure this is a valid child */
+ if (parbone == ebone)
+ return;
+
+ for (pbone = parbone->parent; pbone; pbone = pbone->parent)
+ if (pbone == ebone)
+ return;
+
+ ebone->parent = parbone;
+ rna_EditBone_connected_check(ebone);
+ }
}
static void rna_EditBone_matrix_get(PointerRNA *ptr, float *values)
{
- EditBone *ebone = (EditBone *)(ptr->data);
- ED_armature_ebone_to_mat4(ebone, (float(*)[4])values);
+ EditBone *ebone = (EditBone *)(ptr->data);
+ ED_armature_ebone_to_mat4(ebone, (float(*)[4])values);
}
static void rna_EditBone_matrix_set(PointerRNA *ptr, const float *values)
{
- EditBone *ebone = (EditBone *)(ptr->data);
- ED_armature_ebone_from_mat4(ebone, (float(*)[4])values);
+ EditBone *ebone = (EditBone *)(ptr->data);
+ ED_armature_ebone_from_mat4(ebone, (float(*)[4])values);
}
static void rna_Bone_bbone_handle_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bArmature *arm = (bArmature *)ptr->id.data;
- Bone *bone = (Bone *)ptr->data;
-
- /* Update all users of this armature after changing B-Bone handles. */
- for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) {
- if (obt->data == arm && obt->pose) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(obt->pose, bone->name);
-
- if (pchan && pchan->bone == bone) {
- BKE_pchan_rebuild_bbone_handles(obt->pose, pchan);
- DEG_id_tag_update(&obt->id, ID_RECALC_COPY_ON_WRITE);
- }
- }
- }
-
- rna_Armature_dependency_update(bmain, scene, ptr);
+ bArmature *arm = (bArmature *)ptr->id.data;
+ Bone *bone = (Bone *)ptr->data;
+
+ /* Update all users of this armature after changing B-Bone handles. */
+ for (Object *obt = bmain->objects.first; obt; obt = obt->id.next) {
+ if (obt->data == arm && obt->pose) {
+ bPoseChannel *pchan = BKE_pose_channel_find_name(obt->pose, bone->name);
+
+ if (pchan && pchan->bone == bone) {
+ BKE_pchan_rebuild_bbone_handles(obt->pose, pchan);
+ DEG_id_tag_update(&obt->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
+ }
+
+ rna_Armature_dependency_update(bmain, scene, ptr);
}
static PointerRNA rna_EditBone_bbone_prev_get(PointerRNA *ptr)
{
- EditBone *data = (EditBone *)(ptr->data);
- return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->bbone_prev);
+ EditBone *data = (EditBone *)(ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->bbone_prev);
}
static void rna_EditBone_bbone_prev_set(PointerRNA *ptr, PointerRNA value)
{
- EditBone *ebone = (EditBone *)(ptr->data);
- EditBone *hbone = (EditBone *)value.data;
+ EditBone *ebone = (EditBone *)(ptr->data);
+ EditBone *hbone = (EditBone *)value.data;
- /* Within the same armature? */
- if (hbone == NULL || value.id.data == ptr->id.data) {
- ebone->bbone_prev = hbone;
- }
+ /* Within the same armature? */
+ if (hbone == NULL || value.id.data == ptr->id.data) {
+ ebone->bbone_prev = hbone;
+ }
}
static void rna_Bone_bbone_prev_set(PointerRNA *ptr, PointerRNA value)
{
- Bone *bone = (Bone *)ptr->data;
- Bone *hbone = (Bone *)value.data;
+ Bone *bone = (Bone *)ptr->data;
+ Bone *hbone = (Bone *)value.data;
- /* Within the same armature? */
- if (hbone == NULL || value.id.data == ptr->id.data) {
- bone->bbone_prev = hbone;
- }
+ /* Within the same armature? */
+ if (hbone == NULL || value.id.data == ptr->id.data) {
+ bone->bbone_prev = hbone;
+ }
}
static PointerRNA rna_EditBone_bbone_next_get(PointerRNA *ptr)
{
- EditBone *data = (EditBone *)(ptr->data);
- return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->bbone_next);
+ EditBone *data = (EditBone *)(ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_EditBone, data->bbone_next);
}
static void rna_EditBone_bbone_next_set(PointerRNA *ptr, PointerRNA value)
{
- EditBone *ebone = (EditBone *)(ptr->data);
- EditBone *hbone = (EditBone *)value.data;
+ EditBone *ebone = (EditBone *)(ptr->data);
+ EditBone *hbone = (EditBone *)value.data;
- /* Within the same armature? */
- if (hbone == NULL || value.id.data == ptr->id.data) {
- ebone->bbone_next = hbone;
- }
+ /* Within the same armature? */
+ if (hbone == NULL || value.id.data == ptr->id.data) {
+ ebone->bbone_next = hbone;
+ }
}
static void rna_Bone_bbone_next_set(PointerRNA *ptr, PointerRNA value)
{
- Bone *bone = (Bone *)ptr->data;
- Bone *hbone = (Bone *)value.data;
+ Bone *bone = (Bone *)ptr->data;
+ Bone *hbone = (Bone *)value.data;
- /* Within the same armature? */
- if (hbone == NULL || value.id.data == ptr->id.data) {
- bone->bbone_next = hbone;
- }
+ /* Within the same armature? */
+ if (hbone == NULL || value.id.data == ptr->id.data) {
+ bone->bbone_next = hbone;
+ }
}
static void rna_Armature_editbone_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bArmature *arm = (bArmature *)ptr->id.data;
- EditBone *ebone = (EditBone *)ptr->data;
- EditBone *child, *eboflip;
+ bArmature *arm = (bArmature *)ptr->id.data;
+ EditBone *ebone = (EditBone *)ptr->data;
+ EditBone *child, *eboflip;
- /* update our parent */
- if (ebone->parent && ebone->flag & BONE_CONNECTED)
- copy_v3_v3(ebone->parent->tail, ebone->head);
+ /* update our parent */
+ if (ebone->parent && ebone->flag & BONE_CONNECTED)
+ copy_v3_v3(ebone->parent->tail, ebone->head);
- /* update our children if necessary */
- for (child = arm->edbo->first; child; child = child->next)
- if (child->parent == ebone && (child->flag & BONE_CONNECTED))
- copy_v3_v3(child->head, ebone->tail);
+ /* update our children if necessary */
+ for (child = arm->edbo->first; child; child = child->next)
+ if (child->parent == ebone && (child->flag & BONE_CONNECTED))
+ copy_v3_v3(child->head, ebone->tail);
- if (arm->flag & ARM_MIRROR_EDIT) {
- eboflip = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
+ if (arm->flag & ARM_MIRROR_EDIT) {
+ eboflip = ED_armature_ebone_get_mirrored(arm->edbo, ebone);
- if (eboflip) {
- eboflip->roll = -ebone->roll;
+ if (eboflip) {
+ eboflip->roll = -ebone->roll;
- eboflip->head[0] = -ebone->head[0];
- eboflip->tail[0] = -ebone->tail[0];
+ eboflip->head[0] = -ebone->head[0];
+ eboflip->tail[0] = -ebone->tail[0];
- /* update our parent */
- if (eboflip->parent && eboflip->flag & BONE_CONNECTED)
- copy_v3_v3(eboflip->parent->tail, eboflip->head);
+ /* update our parent */
+ if (eboflip->parent && eboflip->flag & BONE_CONNECTED)
+ copy_v3_v3(eboflip->parent->tail, eboflip->head);
- /* update our children if necessary */
- for (child = arm->edbo->first; child; child = child->next)
- if (child->parent == eboflip && (child->flag & BONE_CONNECTED))
- copy_v3_v3(child->head, eboflip->tail);
- }
- }
+ /* update our children if necessary */
+ for (child = arm->edbo->first; child; child = child->next)
+ if (child->parent == eboflip && (child->flag & BONE_CONNECTED))
+ copy_v3_v3(child->head, eboflip->tail);
+ }
+ }
- rna_Armature_update_data(bmain, scene, ptr);
+ rna_Armature_update_data(bmain, scene, ptr);
}
static void rna_Armature_bones_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- Bone *bone = (Bone *)internal->link;
-
- if (bone->childbase.first)
- internal->link = (Link *)bone->childbase.first;
- else if (bone->next)
- internal->link = (Link *)bone->next;
- else {
- internal->link = NULL;
-
- do {
- bone = bone->parent;
- if (bone && bone->next) {
- internal->link = (Link *)bone->next;
- break;
- }
- } while (bone);
- }
-
- iter->valid = (internal->link != NULL);
+ ListBaseIterator *internal = &iter->internal.listbase;
+ Bone *bone = (Bone *)internal->link;
+
+ if (bone->childbase.first)
+ internal->link = (Link *)bone->childbase.first;
+ else if (bone->next)
+ internal->link = (Link *)bone->next;
+ else {
+ internal->link = NULL;
+
+ do {
+ bone = bone->parent;
+ if (bone && bone->next) {
+ internal->link = (Link *)bone->next;
+ break;
+ }
+ } while (bone);
+ }
+
+ iter->valid = (internal->link != NULL);
}
static bool rna_Armature_is_editmode_get(PointerRNA *ptr)
{
- bArmature *arm = (bArmature *)ptr->id.data;
- return (arm->edbo != NULL);
+ bArmature *arm = (bArmature *)ptr->id.data;
+ return (arm->edbo != NULL);
}
static void rna_Armature_transform(struct bArmature *arm, Main *bmain, float *mat)
{
- ED_armature_transform(bmain, arm, (float (*)[4])mat, true);
+ ED_armature_transform(bmain, arm, (float(*)[4])mat, true);
}
#else
@@ -574,678 +591,768 @@ static void rna_Armature_transform(struct bArmature *arm, Main *bmain, float *ma
/* Settings for curved bbone settings - The posemode values get applied over the top of the editmode ones */
void rna_def_bone_curved_common(StructRNA *srna, bool is_posebone)
{
-#define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone) \
- { \
- if (is_posebone) \
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); \
- else \
- RNA_def_property_update(prop, 0, "rna_Armature_update_data"); \
- } ((void)0)
-
- PropertyRNA *prop;
-
- /* Roll In/Out */
- prop = RNA_def_property(srna, "bbone_rollin", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "roll1");
- RNA_def_property_range(prop, -M_PI * 2.0, M_PI * 2.0);
- RNA_def_property_ui_text(prop, "Roll In", "Roll offset for the start of the B-Bone, adjusts twist");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- prop = RNA_def_property(srna, "bbone_rollout", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "roll2");
- RNA_def_property_range(prop, -M_PI * 2.0, M_PI * 2.0);
- RNA_def_property_ui_text(prop, "Roll Out", "Roll offset for the end of the B-Bone, adjusts twist");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- if (is_posebone == false) {
- prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Inherit End Roll", "Use Roll Out of parent bone as Roll In of its children");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ADD_PARENT_END_ROLL);
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- }
-
- /* Curve X/Y Offsets */
- prop = RNA_def_property(srna, "bbone_curveinx", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "curveInX");
- RNA_def_property_range(prop, -5.0f, 5.0f);
- RNA_def_property_ui_text(prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- prop = RNA_def_property(srna, "bbone_curveiny", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "curveInY");
- RNA_def_property_range(prop, -5.0f, 5.0f);
- RNA_def_property_ui_text(prop, "In Y", "Y-axis handle offset for start of the B-Bone's curve, adjusts curvature");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "curveOutX");
- RNA_def_property_range(prop, -5.0f, 5.0f);
- RNA_def_property_ui_text(prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- prop = RNA_def_property(srna, "bbone_curveouty", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "curveOutY");
- RNA_def_property_range(prop, -5.0f, 5.0f);
- RNA_def_property_ui_text(prop, "Out Y", "Y-axis handle offset for end of the B-Bone's curve, adjusts curvature");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- /* Ease In/Out */
- prop = RNA_def_property(srna, "bbone_easein", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ease1");
- RNA_def_property_range(prop, -5.0f, 5.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Ease In", "Length of first Bezier Handle (for B-Bones only)");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ease2");
- RNA_def_property_range(prop, -5.0f, 5.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- /* Scale In/Out */
- prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scaleIn");
- RNA_def_property_range(prop, 0.0f, 5.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Scale In", "Scale factor for start of the B-Bone, adjusts thickness (for tapering effects)");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
- prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scaleOut");
- RNA_def_property_range(prop, 0.0f, 5.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Scale Out", "Scale factor for end of the B-Bone, adjusts thickness (for tapering effects)");
- RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
-
-#undef RNA_DEF_CURVEBONE_UPDATE
+# define RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone) \
+ { \
+ if (is_posebone) \
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update"); \
+ else \
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data"); \
+ } \
+ ((void)0)
+
+ PropertyRNA *prop;
+
+ /* Roll In/Out */
+ prop = RNA_def_property(srna, "bbone_rollin", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "roll1");
+ RNA_def_property_range(prop, -M_PI * 2.0, M_PI * 2.0);
+ RNA_def_property_ui_text(
+ prop, "Roll In", "Roll offset for the start of the B-Bone, adjusts twist");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ prop = RNA_def_property(srna, "bbone_rollout", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "roll2");
+ RNA_def_property_range(prop, -M_PI * 2.0, M_PI * 2.0);
+ RNA_def_property_ui_text(
+ prop, "Roll Out", "Roll offset for the end of the B-Bone, adjusts twist");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ if (is_posebone == false) {
+ prop = RNA_def_property(srna, "use_endroll_as_inroll", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Inherit End Roll", "Use Roll Out of parent bone as Roll In of its children");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ADD_PARENT_END_ROLL);
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+ }
+
+ /* Curve X/Y Offsets */
+ prop = RNA_def_property(srna, "bbone_curveinx", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "curveInX");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_ui_text(
+ prop, "In X", "X-axis handle offset for start of the B-Bone's curve, adjusts curvature");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ prop = RNA_def_property(srna, "bbone_curveiny", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "curveInY");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_ui_text(
+ prop, "In Y", "Y-axis handle offset for start of the B-Bone's curve, adjusts curvature");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ prop = RNA_def_property(srna, "bbone_curveoutx", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "curveOutX");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_ui_text(
+ prop, "Out X", "X-axis handle offset for end of the B-Bone's curve, adjusts curvature");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ prop = RNA_def_property(srna, "bbone_curveouty", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "curveOutY");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_ui_text(
+ prop, "Out Y", "Y-axis handle offset for end of the B-Bone's curve, adjusts curvature");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ /* Ease In/Out */
+ prop = RNA_def_property(srna, "bbone_easein", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ease1");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Ease In", "Length of first Bezier Handle (for B-Bones only)");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ prop = RNA_def_property(srna, "bbone_easeout", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ease2");
+ RNA_def_property_range(prop, -5.0f, 5.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Ease Out", "Length of second Bezier Handle (for B-Bones only)");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ /* Scale In/Out */
+ prop = RNA_def_property(srna, "bbone_scalein", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scaleIn");
+ RNA_def_property_range(prop, 0.0f, 5.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Scale In",
+ "Scale factor for start of the B-Bone, adjusts thickness (for tapering effects)");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+ prop = RNA_def_property(srna, "bbone_scaleout", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scaleOut");
+ RNA_def_property_range(prop, 0.0f, 5.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Scale Out",
+ "Scale factor for end of the B-Bone, adjusts thickness (for tapering effects)");
+ RNA_DEF_CURVEBONE_UPDATE(prop, is_posebone);
+
+# undef RNA_DEF_CURVEBONE_UPDATE
}
static void rna_def_bone_common(StructRNA *srna, int editbone)
{
- static const EnumPropertyItem prop_bbone_handle_type[] = {
- {BBONE_HANDLE_AUTO, "AUTO", 0, "Automatic", "Use connected parent and children to compute the handle"},
- {BBONE_HANDLE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Use the position of the specified bone to compute the handle"},
- {BBONE_HANDLE_RELATIVE, "RELATIVE", 0, "Relative", "Use the offset of the specified bone from rest pose to compute the handle"},
- {BBONE_HANDLE_TANGENT, "TANGENT", 0, "Tangent", "Use the orientation of the specified bone to compute the handle, ignoring the location"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- /* strings */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
- if (editbone) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
- else RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
- RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
-
- /* flags */
- prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
- RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
- RNA_def_property_array(prop, 32);
- if (editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
- else RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
- RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED);
- if (editbone) RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE);
- RNA_def_property_ui_text(prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV);
- RNA_def_property_ui_text(prop, "Multiply Vertex Group with Envelope",
- "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
- RNA_def_property_ui_text(prop, "Deform", "Enable Bone to deform geometry");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Inherit Scale", "Bone inherits scaling from parent bone");
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_SCALE);
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION);
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_relative_parent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Relative Parenting", "Object children will use relative transform, like deform");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_RELATIVE_PARENTING);
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE);
- RNA_def_property_ui_text(prop, "Display Wire",
- "Bone is always drawn as Wireframe regardless of viewport draw mode "
- "(useful for non-obstructive custom bone shapes)");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- /* XXX: use_cyclic_offset is deprecated in 2.5. May/may not return */
- prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
- RNA_def_property_ui_text(prop, "Cyclic Offset",
- "When bone doesn't have a parent, it receives cyclic offset effects (Deprecated)");
- // "When bone doesn't have a parent, it receives cyclic offset effects");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_UNSELECTABLE);
- RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- /* Number values */
- /* envelope deform settings */
- prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_DISTANCE);
- if (editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
- else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- RNA_def_property_float_sdna(prop, NULL, "rad_head");
- /* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */
- /*RNA_def_property_range(prop, 0, 1000); */
- RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
-
- prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_DISTANCE);
- if (editbone) RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
- else RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- RNA_def_property_float_sdna(prop, NULL, "rad_tail");
- /* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */
- /*RNA_def_property_range(prop, 0, 1000); */
- RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
-
- /* b-bones deform settings */
- prop = RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "segments");
- RNA_def_property_range(prop, 1, 32);
- RNA_def_property_ui_text(prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
- RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
-
- prop = RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xwidth");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zwidth");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "bbone_handle_type_start", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bbone_prev_type");
- RNA_def_property_enum_items(prop, prop_bbone_handle_type);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "B-Bone Start Handle Type", "Selects how the start handle of the B-Bone is computed");
- RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
-
- prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
- RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
- if (editbone) {
- RNA_def_property_pointer_funcs(prop, "rna_EditBone_bbone_prev_get", "rna_EditBone_bbone_prev_set", NULL, NULL);
- RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
- }
- else {
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_prev_set", NULL, NULL);
- RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
- }
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_ui_text(prop, "B-Bone Start Handle",
- "Bone that serves as the start handle for the B-Bone curve");
-
- prop = RNA_def_property(srna, "bbone_handle_type_end", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bbone_next_type");
- RNA_def_property_enum_items(prop, prop_bbone_handle_type);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "B-Bone End Handle Type", "Selects how the end handle of the B-Bone is computed");
- RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
-
- prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
- RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
- if (editbone) {
- RNA_def_property_pointer_funcs(prop, "rna_EditBone_bbone_next_get", "rna_EditBone_bbone_next_set", NULL, NULL);
- RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
- }
- else {
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_next_set", NULL, NULL);
- RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
- }
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_ui_text(prop, "B-Bone End Handle",
- "Bone that serves as the end handle for the B-Bone curve");
+ static const EnumPropertyItem prop_bbone_handle_type[] = {
+ {BBONE_HANDLE_AUTO,
+ "AUTO",
+ 0,
+ "Automatic",
+ "Use connected parent and children to compute the handle"},
+ {BBONE_HANDLE_ABSOLUTE,
+ "ABSOLUTE",
+ 0,
+ "Absolute",
+ "Use the position of the specified bone to compute the handle"},
+ {BBONE_HANDLE_RELATIVE,
+ "RELATIVE",
+ 0,
+ "Relative",
+ "Use the offset of the specified bone from rest pose to compute the handle"},
+ {BBONE_HANDLE_TANGENT,
+ "TANGENT",
+ 0,
+ "Tangent",
+ "Use the orientation of the specified bone to compute the handle, ignoring the location"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ if (editbone)
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_EditBone_name_set");
+ else
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Bone_name_set");
+ RNA_def_property_update(prop, 0, "rna_Bone_update_renamed");
+
+ /* flags */
+ prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
+ RNA_def_property_array(prop, 32);
+ if (editbone)
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_layer_set");
+ else
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Bone_layer_set");
+ RNA_def_property_ui_text(prop, "Layers", "Layers bone exists in");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "use_connect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_CONNECTED);
+ if (editbone)
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_EditBone_connected_set");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Connected", "When bone has a parent, bone's head is stuck to the parent's tail");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_inherit_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_HINGE);
+ RNA_def_property_ui_text(
+ prop, "Inherit Rotation", "Bone inherits rotation or scale from parent bone");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_envelope_multiply", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_MULT_VG_ENV);
+ RNA_def_property_ui_text(
+ prop,
+ "Multiply Vertex Group with Envelope",
+ "When deforming bone, multiply effects of Vertex Group weights with Envelope influence");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_DEFORM);
+ RNA_def_property_ui_text(prop, "Deform", "Enable Bone to deform geometry");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_inherit_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Inherit Scale", "Bone inherits scaling from parent bone");
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_SCALE);
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_local_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Local Location", "Bone location is set in local space");
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_LOCAL_LOCATION);
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_relative_parent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Relative Parenting", "Object children will use relative transform, like deform");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_RELATIVE_PARENTING);
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_DRAWWIRE);
+ RNA_def_property_ui_text(prop,
+ "Display Wire",
+ "Bone is always drawn as Wireframe regardless of viewport draw mode "
+ "(useful for non-obstructive custom bone shapes)");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ /* XXX: use_cyclic_offset is deprecated in 2.5. May/may not return */
+ prop = RNA_def_property(srna, "use_cyclic_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BONE_NO_CYCLICOFFSET);
+ RNA_def_property_ui_text(
+ prop,
+ "Cyclic Offset",
+ "When bone doesn't have a parent, it receives cyclic offset effects (Deprecated)");
+ // "When bone doesn't have a parent, it receives cyclic offset effects");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_UNSELECTABLE);
+ RNA_def_property_ui_text(prop, "Selectable", "Bone is able to be selected");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ /* Number values */
+ /* envelope deform settings */
+ prop = RNA_def_property(srna, "envelope_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop, "Envelope Deform Distance", "Bone deformation distance (for Envelope deform only)");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "envelope_weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop, "Envelope Deform Weight", "Bone deformation weight (for Envelope deform only)");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "head_radius", PROP_FLOAT, PROP_DISTANCE);
+ if (editbone)
+ RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+ else
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+ RNA_def_property_float_sdna(prop, NULL, "rad_head");
+ /* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */
+ /*RNA_def_property_range(prop, 0, 1000); */
+ RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Envelope Head Radius", "Radius of head of bone (for Envelope deform only)");
+
+ prop = RNA_def_property(srna, "tail_radius", PROP_FLOAT, PROP_DISTANCE);
+ if (editbone)
+ RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+ else
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+ RNA_def_property_float_sdna(prop, NULL, "rad_tail");
+ /* XXX range is 0 to lim, where lim = 10000.0f * MAX2(1.0, view3d->grid); */
+ /*RNA_def_property_range(prop, 0, 1000); */
+ RNA_def_property_ui_range(prop, 0.01, 100, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Envelope Tail Radius", "Radius of tail of bone (for Envelope deform only)");
+
+ /* b-bones deform settings */
+ prop = RNA_def_property(srna, "bbone_segments", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "segments");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_text(
+ prop, "B-Bone Segments", "Number of subdivisions of bone (for B-Bones only)");
+ RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
+
+ prop = RNA_def_property(srna, "bbone_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xwidth");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "B-Bone Display X Width", "B-Bone X size");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "bbone_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zwidth");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "B-Bone Display Z Width", "B-Bone Z size");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "bbone_handle_type_start", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bbone_prev_type");
+ RNA_def_property_enum_items(prop, prop_bbone_handle_type);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "B-Bone Start Handle Type", "Selects how the start handle of the B-Bone is computed");
+ RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
+
+ prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
+ RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
+ if (editbone) {
+ RNA_def_property_pointer_funcs(
+ prop, "rna_EditBone_bbone_prev_get", "rna_EditBone_bbone_prev_set", NULL, NULL);
+ RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
+ }
+ else {
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_prev_set", NULL, NULL);
+ RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
+ }
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_ui_text(
+ prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
+
+ prop = RNA_def_property(srna, "bbone_handle_type_end", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bbone_next_type");
+ RNA_def_property_enum_items(prop, prop_bbone_handle_type);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "B-Bone End Handle Type", "Selects how the end handle of the B-Bone is computed");
+ RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
+
+ prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
+ RNA_def_property_struct_type(prop, editbone ? "EditBone" : "Bone");
+ if (editbone) {
+ RNA_def_property_pointer_funcs(
+ prop, "rna_EditBone_bbone_next_get", "rna_EditBone_bbone_next_set", NULL, NULL);
+ RNA_def_property_update(prop, 0, "rna_Armature_dependency_update");
+ }
+ else {
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Bone_bbone_next_set", NULL, NULL);
+ RNA_def_property_update(prop, 0, "rna_Bone_bbone_handle_update");
+ }
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_ui_text(
+ prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
}
/* err... bones should not be directly edited (only editbones should be...) */
static void rna_def_bone(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Bone", NULL);
- RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature data-block");
- RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
- RNA_def_struct_path_func(srna, "rna_Bone_path");
- RNA_def_struct_idprops_func(srna, "rna_Bone_idprops");
-
- /* pointers/collections */
- /* parent (pointer) */
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Bone");
- RNA_def_property_pointer_sdna(prop, NULL, "parent");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- /* children (collection) */
- prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "childbase", NULL);
- RNA_def_property_struct_type(prop, "Bone");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
-
- rna_def_bone_common(srna, 0);
- rna_def_bone_curved_common(srna, 0);
-
- /* XXX should we define this in PoseChannel wrapping code instead?
- * But PoseChannels directly get some of their flags from here... */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_P);
- RNA_def_property_ui_text(prop, "Hide",
- "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
- RNA_def_property_ui_text(prop, "Select", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX: review whether this could be used for interesting effects... */
- RNA_def_property_update(prop, 0, "rna_Bone_select_update");
-
- prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
- RNA_def_property_ui_text(prop, "Select Head", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
- RNA_def_property_ui_text(prop, "Select Tail", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- /* XXX better matrix descriptions possible (Arystan) */
- prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "bone_mat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Bone Matrix", "3x3 bone matrix");
-
- prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "arm_mat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Bone Armature-Relative Matrix", "4x4 bone matrix relative to armature");
-
- prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "tail");
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- prop = RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "arm_tail");
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Armature-Relative Tail", "Location of tail end of the bone relative to armature");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "head");
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone relative to its parent");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- prop = RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "arm_head");
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Armature-Relative Head", "Location of head end of the bone relative to armature");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- RNA_api_bone(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Bone", NULL);
+ RNA_def_struct_ui_text(srna, "Bone", "Bone in an Armature data-block");
+ RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
+ RNA_def_struct_path_func(srna, "rna_Bone_path");
+ RNA_def_struct_idprops_func(srna, "rna_Bone_idprops");
+
+ /* pointers/collections */
+ /* parent (pointer) */
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Bone");
+ RNA_def_property_pointer_sdna(prop, NULL, "parent");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_ui_text(prop, "Parent", "Parent bone (in same Armature)");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ /* children (collection) */
+ prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "childbase", NULL);
+ RNA_def_property_struct_type(prop, "Bone");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_ui_text(prop, "Children", "Bones which are children of this bone");
+
+ rna_def_bone_common(srna, 0);
+ rna_def_bone_curved_common(srna, 0);
+
+ /* XXX should we define this in PoseChannel wrapping code instead?
+ * But PoseChannels directly get some of their flags from here... */
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_P);
+ RNA_def_property_ui_text(
+ prop,
+ "Hide",
+ "Bone is not visible when it is not in Edit Mode (i.e. in Object or Pose Modes)");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_clear_flag(
+ prop,
+ PROP_ANIMATABLE); /* XXX: review whether this could be used for interesting effects... */
+ RNA_def_property_update(prop, 0, "rna_Bone_select_update");
+
+ prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
+ RNA_def_property_ui_text(prop, "Select Head", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
+ RNA_def_property_ui_text(prop, "Select Tail", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ /* XXX better matrix descriptions possible (Arystan) */
+ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "bone_mat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Bone Matrix", "3x3 bone matrix");
+
+ prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "arm_mat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Bone Armature-Relative Matrix", "4x4 bone matrix relative to armature");
+
+ prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "tail");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ prop = RNA_def_property(srna, "tail_local", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "arm_tail");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Armature-Relative Tail", "Location of tail end of the bone relative to armature");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "head");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Head", "Location of head end of the bone relative to its parent");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ prop = RNA_def_property(srna, "head_local", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "arm_head");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Armature-Relative Head", "Location of head end of the bone relative to armature");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ RNA_api_bone(srna);
}
static void rna_def_edit_bone(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "EditBone", NULL);
- RNA_def_struct_sdna(srna, "EditBone");
- RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
- RNA_def_struct_ui_text(srna, "Edit Bone", "Editmode bone in an Armature data-block");
- RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EditBone");
- RNA_def_property_pointer_funcs(prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "roll");
- RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
- RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
-
- prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "head");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
-
- prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "tail");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
-
- rna_def_bone_common(srna, 1);
- rna_def_bone_curved_common(srna, 0);
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_A);
- RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_EDITMODE_LOCKED);
- RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
- RNA_def_property_ui_text(prop, "Select", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
- RNA_def_property_ui_text(prop, "Head Select", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
- RNA_def_property_ui_text(prop, "Tail Select", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- /* calculated and read only, not actual data access */
- prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
- /*RNA_def_property_float_sdna(prop, NULL, ""); *//* doesn't access any real data */
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- //RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
- RNA_def_property_ui_text(prop, "Editbone Matrix",
- "Matrix combining loc/rot of the bone (head position, direction and roll), "
- "in armature space (WARNING: does not include/support bone's length/size)");
- RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL);
-
- RNA_api_armature_edit_bone(srna);
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "EditBone", NULL);
+ RNA_def_struct_sdna(srna, "EditBone");
+ RNA_def_struct_idprops_func(srna, "rna_EditBone_idprops");
+ RNA_def_struct_ui_text(srna, "Edit Bone", "Editmode bone in an Armature data-block");
+ RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EditBone");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_EditBone_parent_get", "rna_EditBone_parent_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Parent", "Parent edit bone (in same Armature)");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "roll", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "roll");
+ RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Roll", "Bone rotation around head-tail axis");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+
+ prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "head");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Head", "Location of head end of the bone");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+
+ prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "tail");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Tail", "Location of tail end of the bone");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_editbone_transform_update");
+
+ rna_def_bone_common(srna, 1);
+ rna_def_bone_curved_common(srna, 0);
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_HIDDEN_A);
+ RNA_def_property_ui_text(prop, "Hide", "Bone is not visible when in Edit Mode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_EDITMODE_LOCKED);
+ RNA_def_property_ui_text(prop, "Lock", "Bone is not able to be transformed when in Edit Mode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_SELECTED);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "select_head", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_ROOTSEL);
+ RNA_def_property_ui_text(prop, "Head Select", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "select_tail", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BONE_TIPSEL);
+ RNA_def_property_ui_text(prop, "Tail Select", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ /* calculated and read only, not actual data access */
+ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ /*RNA_def_property_float_sdna(prop, NULL, ""); */ /* doesn't access any real data */
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ //RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */
+ RNA_def_property_ui_text(
+ prop,
+ "Editbone Matrix",
+ "Matrix combining loc/rot of the bone (head position, direction and roll), "
+ "in armature space (WARNING: does not include/support bone's length/size)");
+ RNA_def_property_float_funcs(prop, "rna_EditBone_matrix_get", "rna_EditBone_matrix_set", NULL);
+
+ RNA_api_armature_edit_bone(srna);
+
+ RNA_define_verify_sdna(1);
}
-
/* armature.bones.* */
static void rna_def_armature_bones(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
-/* FunctionRNA *func; */
-/* PropertyRNA *parm; */
-
- RNA_def_property_srna(cprop, "ArmatureBones");
- srna = RNA_def_struct(brna, "ArmatureBones", NULL);
- RNA_def_struct_sdna(srna, "bArmature");
- RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
-
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Bone");
- RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL);
-
- /* todo, redraw */
-/* RNA_def_property_collection_active(prop, prop_act); */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
+
+ RNA_def_property_srna(cprop, "ArmatureBones");
+ srna = RNA_def_struct(brna, "ArmatureBones", NULL);
+ RNA_def_struct_sdna(srna, "bArmature");
+ RNA_def_struct_ui_text(srna, "Armature Bones", "Collection of armature bones");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Bone");
+ RNA_def_property_pointer_sdna(prop, NULL, "act_bone");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Bone", "Armature's active bone");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_bone_set", NULL, NULL);
+
+ /* todo, redraw */
+ /* RNA_def_property_collection_active(prop, prop_act); */
}
/* armature.bones.* */
static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ArmatureEditBones");
- srna = RNA_def_struct(brna, "ArmatureEditBones", NULL);
- RNA_def_struct_sdna(srna, "bArmature");
- RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EditBone");
- RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
- /*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
-
- /* todo, redraw */
-/* RNA_def_property_collection_active(prop, prop_act); */
-
- /* add target */
- func = RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new bone");
- parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
- RNA_def_function_return(func, parm);
-
- /* remove target */
- func = RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
- /* target to remove*/
- parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ArmatureEditBones");
+ srna = RNA_def_struct(brna, "ArmatureEditBones", NULL);
+ RNA_def_struct_sdna(srna, "bArmature");
+ RNA_def_struct_ui_text(srna, "Armature EditBones", "Collection of armature edit bones");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EditBone");
+ RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
+ /*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
+
+ /* todo, redraw */
+ /* RNA_def_property_collection_active(prop, prop_act); */
+
+ /* add target */
+ func = RNA_def_function(srna, "new", "rna_Armature_edit_bone_new");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new bone");
+ parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the bone");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "bone", "EditBone", "", "Newly created edit bone");
+ RNA_def_function_return(func, parm);
+
+ /* remove target */
+ func = RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an existing bone from the armature");
+ /* target to remove*/
+ parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_armature(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem prop_drawtype_items[] = {
- {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
- {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
- {ARM_B_BONE, "BBONE", 0, "B-Bone", "Display bones as boxes, showing subdivision and B-Splines"},
- {ARM_ENVELOPE, "ENVELOPE", 0, "Envelope",
- "Display bones as extruded spheres, showing deformation influence volume"},
- {ARM_WIRE, "WIRE", 0, "Wire", "Display bones as thin wires, showing subdivision and B-Splines"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem prop_pose_position_items[] = {
- {0, "POSE", 0, "Pose Position", "Show armature in posed state"},
- {ARM_RESTPOS, "REST", 0, "Rest Position", "Show Armature in binding pose state (no posing possible)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Armature", "ID");
- RNA_def_struct_ui_text(srna, "Armature",
- "Armature data-block containing a hierarchy of bones, usually used for rigging characters");
- RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
- RNA_def_struct_sdna(srna, "bArmature");
-
- func = RNA_def_function(srna, "transform", "rna_Armature_transform");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* Animation Data */
- rna_def_animdata_common(srna);
-
- /* Collections */
- prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
- RNA_def_property_collection_funcs(prop, NULL, "rna_Armature_bones_next", NULL, NULL, NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "Bone");
- RNA_def_property_ui_text(prop, "Bones", "");
- rna_def_armature_bones(brna, prop);
-
- prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
- RNA_def_property_struct_type(prop, "EditBone");
- RNA_def_property_ui_text(prop, "Edit Bones", "");
- rna_def_armature_edit_bones(brna, prop);
-
- /* Enum values */
- prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_pose_position_items);
- RNA_def_property_ui_text(prop, "Pose Position", "Show armature in binding pose or final posed state");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "drawtype");
- RNA_def_property_enum_items(prop, prop_drawtype_items);
- RNA_def_property_ui_text(prop, "Display Type Type", "");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- /* Boolean values */
- /* layer */
- prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
- RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
- RNA_def_property_array(prop, 32);
- RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Armature_update_layers");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- /* layer protection */
- prop = RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
- RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
- RNA_def_property_array(prop, 32);
- RNA_def_property_ui_text(prop, "Layer Proxy Protection",
- "Protected layers in Proxy Instances are restored to Proxy settings "
- "on file reload and undo");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- /* flag */
- prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES);
- RNA_def_property_ui_text(prop, "Display Axes", "Display bone axes");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES);
- RNA_def_property_ui_text(prop, "Display Names", "Display bone names");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- prop = RNA_def_property(srna, "use_deform_delay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DELAYDEFORM);
- RNA_def_property_ui_text(prop, "Delay Deform", "Don't deform children when manipulating bones in Pose Mode");
- RNA_def_property_update(prop, 0, "rna_Armature_update_data");
-
- prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT);
- RNA_def_property_ui_text(prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_AUTO_IK);
- RNA_def_property_ui_text(prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
-
- prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
- RNA_def_property_ui_text(prop, "Display Custom Bone Shapes", "Display bones with their custom shapes");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_COL_CUSTOM);
- RNA_def_property_ui_text(prop, "Display Bone Group Colors", "Display bone group colors");
- RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
-
- prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem prop_drawtype_items[] = {
+ {ARM_OCTA, "OCTAHEDRAL", 0, "Octahedral", "Display bones as octahedral shape (default)"},
+ {ARM_LINE, "STICK", 0, "Stick", "Display bones as simple 2D lines with dots"},
+ {ARM_B_BONE,
+ "BBONE",
+ 0,
+ "B-Bone",
+ "Display bones as boxes, showing subdivision and B-Splines"},
+ {ARM_ENVELOPE,
+ "ENVELOPE",
+ 0,
+ "Envelope",
+ "Display bones as extruded spheres, showing deformation influence volume"},
+ {ARM_WIRE,
+ "WIRE",
+ 0,
+ "Wire",
+ "Display bones as thin wires, showing subdivision and B-Splines"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem prop_pose_position_items[] = {
+ {0, "POSE", 0, "Pose Position", "Show armature in posed state"},
+ {ARM_RESTPOS,
+ "REST",
+ 0,
+ "Rest Position",
+ "Show Armature in binding pose state (no posing possible)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Armature", "ID");
+ RNA_def_struct_ui_text(
+ srna,
+ "Armature",
+ "Armature data-block containing a hierarchy of bones, usually used for rigging characters");
+ RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
+ RNA_def_struct_sdna(srna, "bArmature");
+
+ func = RNA_def_function(srna, "transform", "rna_Armature_transform");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Transform armature bones by a matrix");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* Animation Data */
+ rna_def_animdata_common(srna);
+
+ /* Collections */
+ prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "bonebase", NULL);
+ RNA_def_property_collection_funcs(
+ prop, NULL, "rna_Armature_bones_next", NULL, NULL, NULL, NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "Bone");
+ RNA_def_property_ui_text(prop, "Bones", "");
+ rna_def_armature_bones(brna, prop);
+
+ prop = RNA_def_property(srna, "edit_bones", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "edbo", NULL);
+ RNA_def_property_struct_type(prop, "EditBone");
+ RNA_def_property_ui_text(prop, "Edit Bones", "");
+ rna_def_armature_edit_bones(brna, prop);
+
+ /* Enum values */
+ prop = RNA_def_property(srna, "pose_position", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_pose_position_items);
+ RNA_def_property_ui_text(
+ prop, "Pose Position", "Show armature in binding pose or final posed state");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "drawtype");
+ RNA_def_property_enum_items(prop, prop_drawtype_items);
+ RNA_def_property_ui_text(prop, "Display Type Type", "");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ /* Boolean values */
+ /* layer */
+ prop = RNA_def_property(srna, "layers", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "layer", 1);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_ui_text(prop, "Visible Layers", "Armature layer visibility");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Armature_layer_set");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Armature_update_layers");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ /* layer protection */
+ prop = RNA_def_property(srna, "layers_protected", PROP_BOOLEAN, PROP_LAYER);
+ RNA_def_property_boolean_sdna(prop, NULL, "layer_protected", 1);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_ui_text(prop,
+ "Layer Proxy Protection",
+ "Protected layers in Proxy Instances are restored to Proxy settings "
+ "on file reload and undo");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ /* flag */
+ prop = RNA_def_property(srna, "show_axes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWAXES);
+ RNA_def_property_ui_text(prop, "Display Axes", "Display bone axes");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DRAWNAMES);
+ RNA_def_property_ui_text(prop, "Display Names", "Display bone names");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ prop = RNA_def_property(srna, "use_deform_delay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_DELAYDEFORM);
+ RNA_def_property_ui_text(
+ prop, "Delay Deform", "Don't deform children when manipulating bones in Pose Mode");
+ RNA_def_property_update(prop, 0, "rna_Armature_update_data");
+
+ prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_MIRROR_EDIT);
+ RNA_def_property_ui_text(
+ prop, "X-Axis Mirror", "Apply changes to matching bone on opposite side of X-Axis");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ prop = RNA_def_property(srna, "use_auto_ik", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_AUTO_IK);
+ RNA_def_property_ui_text(
+ prop, "Auto IK", "Add temporary IK constraints while grabbing bones in Pose Mode");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+
+ prop = RNA_def_property(srna, "show_bone_custom_shapes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", ARM_NO_CUSTOM);
+ RNA_def_property_ui_text(
+ prop, "Display Custom Bone Shapes", "Display bones with their custom shapes");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ARM_COL_CUSTOM);
+ RNA_def_property_ui_text(prop, "Display Bone Group Colors", "Display bone group colors");
+ RNA_def_property_update(prop, 0, "rna_Armature_redraw_data");
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Armature_is_editmode_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
}
void RNA_def_armature(BlenderRNA *brna)
{
- rna_def_armature(brna);
- rna_def_bone(brna);
- rna_def_edit_bone(brna);
+ rna_def_armature(brna);
+ rna_def_bone(brna);
+ rna_def_edit_bone(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_armature_api.c b/source/blender/makesrna/intern/rna_armature_api.c
index 6174f58aa37..f3bdef75c9c 100644
--- a/source/blender/makesrna/intern/rna_armature_api.c
+++ b/source/blender/makesrna/intern/rna_armature_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -29,161 +28,190 @@
#include "RNA_define.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include <stddef.h>
+# include <stddef.h>
-#include "DNA_armature_types.h"
+# include "DNA_armature_types.h"
-#include "BLI_math_vector.h"
-#include "BKE_armature.h"
+# include "BLI_math_vector.h"
+# include "BKE_armature.h"
static void rna_EditBone_align_roll(EditBone *ebo, float no[3])
{
- ebo->roll = ED_armature_ebone_roll_to_vector(ebo, no, false);
+ ebo->roll = ED_armature_ebone_roll_to_vector(ebo, no, false);
}
static float rna_Bone_do_envelope(Bone *bone, float *vec)
{
- float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
- return distfactor_to_bone(vec, bone->arm_head, bone->arm_tail, bone->rad_head * scale,
- bone->rad_tail * scale, bone->dist * scale);
+ float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
+ return distfactor_to_bone(vec,
+ bone->arm_head,
+ bone->arm_tail,
+ bone->rad_head * scale,
+ bone->rad_tail * scale,
+ bone->dist * scale);
}
-static void rna_Bone_convert_local_to_pose(Bone *bone, float *r_matrix, float *matrix, float *matrix_local, float *parent_matrix, float *parent_matrix_local, bool invert)
+static void rna_Bone_convert_local_to_pose(Bone *bone,
+ float *r_matrix,
+ float *matrix,
+ float *matrix_local,
+ float *parent_matrix,
+ float *parent_matrix_local,
+ bool invert)
{
- BoneParentTransform bpt;
- float offs_bone[4][4];
- float (*bone_arm_mat)[4] = (float (*)[4])matrix_local;
- float (*parent_pose_mat)[4] = (float (*)[4])parent_matrix;
- float (*parent_arm_mat)[4] = (float (*)[4])parent_matrix_local;
-
- if (is_zero_m4(parent_pose_mat) || is_zero_m4(parent_arm_mat)) {
- /* No parent case. */
- BKE_bone_parent_transform_calc_from_matrices(bone->flag, bone_arm_mat, NULL, NULL, &bpt);
- }
- else {
- invert_m4_m4(offs_bone, parent_arm_mat);
- mul_m4_m4m4(offs_bone, offs_bone, bone_arm_mat);
-
- BKE_bone_parent_transform_calc_from_matrices(bone->flag, offs_bone, parent_arm_mat, parent_pose_mat, &bpt);
- }
-
- if (invert) {
- BKE_bone_parent_transform_invert(&bpt);
- }
-
- BKE_bone_parent_transform_apply(&bpt, (float (*)[4])matrix, (float (*)[4])r_matrix);
+ BoneParentTransform bpt;
+ float offs_bone[4][4];
+ float(*bone_arm_mat)[4] = (float(*)[4])matrix_local;
+ float(*parent_pose_mat)[4] = (float(*)[4])parent_matrix;
+ float(*parent_arm_mat)[4] = (float(*)[4])parent_matrix_local;
+
+ if (is_zero_m4(parent_pose_mat) || is_zero_m4(parent_arm_mat)) {
+ /* No parent case. */
+ BKE_bone_parent_transform_calc_from_matrices(bone->flag, bone_arm_mat, NULL, NULL, &bpt);
+ }
+ else {
+ invert_m4_m4(offs_bone, parent_arm_mat);
+ mul_m4_m4m4(offs_bone, offs_bone, bone_arm_mat);
+
+ BKE_bone_parent_transform_calc_from_matrices(
+ bone->flag, offs_bone, parent_arm_mat, parent_pose_mat, &bpt);
+ }
+
+ if (invert) {
+ BKE_bone_parent_transform_invert(&bpt);
+ }
+
+ BKE_bone_parent_transform_apply(&bpt, (float(*)[4])matrix, (float(*)[4])r_matrix);
}
static void rna_Bone_MatrixFromAxisRoll(float *axis, float roll, float *r_matrix)
{
- vec_roll_to_mat3(axis, roll, (float (*)[3])r_matrix);
+ vec_roll_to_mat3(axis, roll, (float(*)[3])r_matrix);
}
-static void rna_Bone_AxisRollFromMatrix(float *matrix, float *axis_override, float *r_axis, float *r_roll)
+static void rna_Bone_AxisRollFromMatrix(float *matrix,
+ float *axis_override,
+ float *r_axis,
+ float *r_roll)
{
- float mat[3][3];
+ float mat[3][3];
- normalize_m3_m3(mat, (float (*)[3])matrix);
+ normalize_m3_m3(mat, (float(*)[3])matrix);
- if (normalize_v3_v3(r_axis, axis_override) != 0.0f) {
- mat3_vec_to_roll(mat, r_axis, r_roll);
- }
- else {
- mat3_to_vec_roll(mat, r_axis, r_roll);
- }
+ if (normalize_v3_v3(r_axis, axis_override) != 0.0f) {
+ mat3_vec_to_roll(mat, r_axis, r_roll);
+ }
+ else {
+ mat3_to_vec_roll(mat, r_axis, r_roll);
+ }
}
#else
void RNA_api_armature_edit_bone(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "align_roll", "rna_EditBone_align_roll");
- RNA_def_function_ui_description(func, "Align the bone to a localspace roll so the Z axis "
- "points in the direction of the vector given");
- parm = RNA_def_float_vector(func, "vector", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "align_roll", "rna_EditBone_align_roll");
+ RNA_def_function_ui_description(func,
+ "Align the bone to a localspace roll so the Z axis "
+ "points in the direction of the vector given");
+ parm = RNA_def_float_vector(
+ func, "vector", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_api_bone(StructRNA *srna)
{
- PropertyRNA *parm;
- FunctionRNA *func;
-
- func = RNA_def_function(srna, "evaluate_envelope", "rna_Bone_do_envelope");
- RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
- parm = RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
- "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return value */
- parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "convert_local_to_pose", "rna_Bone_convert_local_to_pose");
- RNA_def_function_ui_description(func,
- "Transform a matrix from Local to Pose space (or back), taking "
- "into account options like Inherit Scale and Local Location. "
- "Unlike Object.convert_space, this uses custom rest and pose "
- "matrices provided by the caller. If the parent matrices are "
- "omitted, the bone is assumed to have no parent.");
- parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The transformed matrix");
- RNA_def_function_output(func, parm);
- parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The matrix to transform");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "matrix_local", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The custom rest matrix of this bone (Bone.matrix_local)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "parent_matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The custom pose matrix of the parent bone (PoseBone.matrix)");
- parm = RNA_def_property(func, "parent_matrix_local", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The custom rest matrix of the parent bone (Bone.matrix_local)");
- parm = RNA_def_boolean(func, "invert", false, "", "Convert from Pose to Local space");
-
- /* Conversions between Matrix and Axis + Roll representations. */
- func = RNA_def_function(srna, "MatrixFromAxisRoll", "rna_Bone_MatrixFromAxisRoll");
- RNA_def_function_ui_description(func, "Convert the axis + roll representation to a matrix");
- RNA_def_function_flag(func, FUNC_NO_SELF);
- parm = RNA_def_property(func, "axis", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(parm, 3);
- RNA_def_property_ui_text(parm, "", "The main axis of the bone (tail - head)");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "roll", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(parm, "", "The roll of the bone");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "result_matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_3x3);
- RNA_def_property_ui_text(parm, "", "The resulting orientation matrix");
- RNA_def_function_output(func, parm);
-
- func = RNA_def_function(srna, "AxisRollFromMatrix", "rna_Bone_AxisRollFromMatrix");
- RNA_def_function_ui_description(func, "Convert a rotational matrix to the axis + roll representation");
- RNA_def_function_flag(func, FUNC_NO_SELF);
- parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_3x3);
- RNA_def_property_ui_text(parm, "", "The orientation matrix of the bone");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "axis", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_array(parm, 3);
- RNA_def_property_ui_text(parm, "", "The optional override for the axis (finds closest approximation for the matrix)");
- parm = RNA_def_property(func, "result_axis", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(parm, 3);
- RNA_def_property_ui_text(parm, "", "The main axis of the bone");
- RNA_def_function_output(func, parm);
- parm = RNA_def_property(func, "result_roll", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(parm, "", "The roll of the bone");
- RNA_def_function_output(func, parm);
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ func = RNA_def_function(srna, "evaluate_envelope", "rna_Bone_do_envelope");
+ RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
+ parm = RNA_def_float_vector_xyz(func,
+ "point",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Point",
+ "Position in 3d space to evaluate",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return value */
+ parm = RNA_def_float(
+ func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "convert_local_to_pose", "rna_Bone_convert_local_to_pose");
+ RNA_def_function_ui_description(func,
+ "Transform a matrix from Local to Pose space (or back), taking "
+ "into account options like Inherit Scale and Local Location. "
+ "Unlike Object.convert_space, this uses custom rest and pose "
+ "matrices provided by the caller. If the parent matrices are "
+ "omitted, the bone is assumed to have no parent.");
+ parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The transformed matrix");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The matrix to transform");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "matrix_local", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The custom rest matrix of this bone (Bone.matrix_local)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "parent_matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ parm, "", "The custom pose matrix of the parent bone (PoseBone.matrix)");
+ parm = RNA_def_property(func, "parent_matrix_local", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ parm, "", "The custom rest matrix of the parent bone (Bone.matrix_local)");
+ parm = RNA_def_boolean(func, "invert", false, "", "Convert from Pose to Local space");
+
+ /* Conversions between Matrix and Axis + Roll representations. */
+ func = RNA_def_function(srna, "MatrixFromAxisRoll", "rna_Bone_MatrixFromAxisRoll");
+ RNA_def_function_ui_description(func, "Convert the axis + roll representation to a matrix");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_property(func, "axis", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(parm, 3);
+ RNA_def_property_ui_text(parm, "", "The main axis of the bone (tail - head)");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "roll", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(parm, "", "The roll of the bone");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "result_matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_ui_text(parm, "", "The resulting orientation matrix");
+ RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(srna, "AxisRollFromMatrix", "rna_Bone_AxisRollFromMatrix");
+ RNA_def_function_ui_description(func,
+ "Convert a rotational matrix to the axis + roll representation");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_ui_text(parm, "", "The orientation matrix of the bone");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "axis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_array(parm, 3);
+ RNA_def_property_ui_text(
+ parm, "", "The optional override for the axis (finds closest approximation for the matrix)");
+ parm = RNA_def_property(func, "result_axis", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(parm, 3);
+ RNA_def_property_ui_text(parm, "", "The main axis of the bone");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_property(func, "result_roll", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(parm, "", "The roll of the bone");
+ RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c
index 9ffc53d2ad9..f533a8017de 100644
--- a/source/blender/makesrna/intern/rna_boid.c
+++ b/source/blender/makesrna/intern/rna_boid.c
@@ -41,630 +41,664 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_boidrule_type_items[] = {
- {eBoidRuleType_Goal, "GOAL", 0, "Goal", "Go to assigned object or loudest assigned signal source"},
- {eBoidRuleType_Avoid, "AVOID", 0, "Avoid", "Get away from assigned object or loudest assigned signal source"},
- {eBoidRuleType_AvoidCollision, "AVOID_COLLISION", 0, "Avoid Collision",
- "Maneuver to avoid collisions with other boids and deflector objects in "
- "near future"},
- {eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"},
- {eBoidRuleType_Flock, "FLOCK", 0, "Flock", "Move to center of neighbors and match their velocity"},
- {eBoidRuleType_FollowLeader, "FOLLOW_LEADER", 0, "Follow Leader", "Follow a boid or assigned object"},
- {eBoidRuleType_AverageSpeed, "AVERAGE_SPEED", 0, "Average Speed", "Maintain speed, flight level or wander"},
- {eBoidRuleType_Fight, "FIGHT", 0, "Fight", "Go to closest enemy and attack when in range"},
+ {eBoidRuleType_Goal,
+ "GOAL",
+ 0,
+ "Goal",
+ "Go to assigned object or loudest assigned signal source"},
+ {eBoidRuleType_Avoid,
+ "AVOID",
+ 0,
+ "Avoid",
+ "Get away from assigned object or loudest assigned signal source"},
+ {eBoidRuleType_AvoidCollision,
+ "AVOID_COLLISION",
+ 0,
+ "Avoid Collision",
+ "Maneuver to avoid collisions with other boids and deflector objects in "
+ "near future"},
+ {eBoidRuleType_Separate, "SEPARATE", 0, "Separate", "Keep from going through other boids"},
+ {eBoidRuleType_Flock,
+ "FLOCK",
+ 0,
+ "Flock",
+ "Move to center of neighbors and match their velocity"},
+ {eBoidRuleType_FollowLeader,
+ "FOLLOW_LEADER",
+ 0,
+ "Follow Leader",
+ "Follow a boid or assigned object"},
+ {eBoidRuleType_AverageSpeed,
+ "AVERAGE_SPEED",
+ 0,
+ "Average Speed",
+ "Maintain speed, flight level or wander"},
+ {eBoidRuleType_Fight, "FIGHT", 0, "Fight", "Go to closest enemy and attack when in range"},
#if 0
- {eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"},
- {eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"},
- {eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path",
- "Move along a assigned curve or closest curve in a group"},
- {eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall",
- "Move next to a deflector object's in direction of it's tangent"},
+ {eBoidRuleType_Protect, "PROTECT", 0, "Protect", "Go to enemy closest to target and attack when in range"},
+ {eBoidRuleType_Hide, "HIDE", 0, "Hide", "Find a deflector move to it's other side from closest enemy"},
+ {eBoidRuleType_FollowPath, "FOLLOW_PATH", 0, "Follow Path",
+ "Move along a assigned curve or closest curve in a group"},
+ {eBoidRuleType_FollowWall, "FOLLOW_WALL", 0, "Follow Wall",
+ "Move next to a deflector object's in direction of it's tangent"},
#endif
- {0, NULL, 0, NULL, NULL},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem boidruleset_type_items[] = {
- {eBoidRulesetType_Fuzzy, "FUZZY", 0, "Fuzzy",
- "Rules are gone through top to bottom (only the first rule which effect is above "
- "fuzziness threshold is evaluated)"},
- {eBoidRulesetType_Random, "RANDOM", 0, "Random", "A random rule is selected for each boid"},
- {eBoidRulesetType_Average, "AVERAGE", 0, "Average", "All rules are averaged"},
- {0, NULL, 0, NULL, NULL},
+ {eBoidRulesetType_Fuzzy,
+ "FUZZY",
+ 0,
+ "Fuzzy",
+ "Rules are gone through top to bottom (only the first rule which effect is above "
+ "fuzziness threshold is evaluated)"},
+ {eBoidRulesetType_Random, "RANDOM", 0, "Random", "A random rule is selected for each boid"},
+ {eBoidRulesetType_Average, "AVERAGE", 0, "Average", "All rules are averaged"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
-
#ifdef RNA_RUNTIME
-#include "BLI_math_base.h"
+# include "BLI_math_base.h"
-#include "BKE_context.h"
-#include "BKE_particle.h"
+# include "BKE_context.h"
+# include "BKE_particle.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static void rna_Boids_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- if (ptr->type == &RNA_ParticleSystem) {
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ if (ptr->type == &RNA_ParticleSystem) {
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- psys->recalc = ID_RECALC_PSYS_RESET;
+ psys->recalc = ID_RECALC_PSYS_RESET;
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- }
- else
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ }
+ else
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
}
static void rna_Boids_reset_deps(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- if (ptr->type == &RNA_ParticleSystem) {
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ if (ptr->type == &RNA_ParticleSystem) {
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- psys->recalc = ID_RECALC_PSYS_RESET;
+ psys->recalc = ID_RECALC_PSYS_RESET;
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- }
- else
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ }
+ else
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
}
static StructRNA *rna_BoidRule_refine(struct PointerRNA *ptr)
{
- BoidRule *rule = (BoidRule *)ptr->data;
-
- switch (rule->type) {
- case eBoidRuleType_Goal:
- return &RNA_BoidRuleGoal;
- case eBoidRuleType_Avoid:
- return &RNA_BoidRuleAvoid;
- case eBoidRuleType_AvoidCollision:
- return &RNA_BoidRuleAvoidCollision;
- case eBoidRuleType_FollowLeader:
- return &RNA_BoidRuleFollowLeader;
- case eBoidRuleType_AverageSpeed:
- return &RNA_BoidRuleAverageSpeed;
- case eBoidRuleType_Fight:
- return &RNA_BoidRuleFight;
- default:
- return &RNA_BoidRule;
- }
+ BoidRule *rule = (BoidRule *)ptr->data;
+
+ switch (rule->type) {
+ case eBoidRuleType_Goal:
+ return &RNA_BoidRuleGoal;
+ case eBoidRuleType_Avoid:
+ return &RNA_BoidRuleAvoid;
+ case eBoidRuleType_AvoidCollision:
+ return &RNA_BoidRuleAvoidCollision;
+ case eBoidRuleType_FollowLeader:
+ return &RNA_BoidRuleFollowLeader;
+ case eBoidRuleType_AverageSpeed:
+ return &RNA_BoidRuleAverageSpeed;
+ case eBoidRuleType_Fight:
+ return &RNA_BoidRuleFight;
+ default:
+ return &RNA_BoidRule;
+ }
}
static char *rna_BoidRule_path(PointerRNA *ptr)
{
- BoidRule *rule = (BoidRule *)ptr->data;
- char name_esc[sizeof(rule->name) * 2];
+ BoidRule *rule = (BoidRule *)ptr->data;
+ char name_esc[sizeof(rule->name) * 2];
- BLI_strescape(name_esc, rule->name, sizeof(name_esc));
+ BLI_strescape(name_esc, rule->name, sizeof(name_esc));
- return BLI_sprintfN("rules[\"%s\"]", name_esc); /* XXX not unique */
+ return BLI_sprintfN("rules[\"%s\"]", name_esc); /* XXX not unique */
}
static PointerRNA rna_BoidState_active_boid_rule_get(PointerRNA *ptr)
{
- BoidState *state = (BoidState *)ptr->data;
- BoidRule *rule = (BoidRule *)state->rules.first;
-
- for (; rule; rule = rule->next) {
- if (rule->flag & BOIDRULE_CURRENT)
- return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, rule);
- }
- return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, NULL);
+ BoidState *state = (BoidState *)ptr->data;
+ BoidRule *rule = (BoidRule *)state->rules.first;
+
+ for (; rule; rule = rule->next) {
+ if (rule->flag & BOIDRULE_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, rule);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidRule, NULL);
}
-static void rna_BoidState_active_boid_rule_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_BoidState_active_boid_rule_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- BoidState *state = (BoidState *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&state->rules) - 1);
+ BoidState *state = (BoidState *)ptr->data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&state->rules) - 1);
}
static int rna_BoidState_active_boid_rule_index_get(PointerRNA *ptr)
{
- BoidState *state = (BoidState *)ptr->data;
- BoidRule *rule = (BoidRule *)state->rules.first;
- int i = 0;
-
- for (; rule; rule = rule->next, i++) {
- if (rule->flag & BOIDRULE_CURRENT)
- return i;
- }
- return 0;
+ BoidState *state = (BoidState *)ptr->data;
+ BoidRule *rule = (BoidRule *)state->rules.first;
+ int i = 0;
+
+ for (; rule; rule = rule->next, i++) {
+ if (rule->flag & BOIDRULE_CURRENT)
+ return i;
+ }
+ return 0;
}
static void rna_BoidState_active_boid_rule_index_set(struct PointerRNA *ptr, int value)
{
- BoidState *state = (BoidState *)ptr->data;
- BoidRule *rule = (BoidRule *)state->rules.first;
- int i = 0;
-
- for (; rule; rule = rule->next, i++) {
- if (i == value)
- rule->flag |= BOIDRULE_CURRENT;
- else
- rule->flag &= ~BOIDRULE_CURRENT;
- }
+ BoidState *state = (BoidState *)ptr->data;
+ BoidRule *rule = (BoidRule *)state->rules.first;
+ int i = 0;
+
+ for (; rule; rule = rule->next, i++) {
+ if (i == value)
+ rule->flag |= BOIDRULE_CURRENT;
+ else
+ rule->flag &= ~BOIDRULE_CURRENT;
+ }
}
static int particle_id_check(PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- return (GS(id->name) == ID_PA);
+ return (GS(id->name) == ID_PA);
}
static char *rna_BoidSettings_path(PointerRNA *ptr)
{
- BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidSettings *boids = (BoidSettings *)ptr->data;
- if (particle_id_check(ptr)) {
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ if (particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- if (part->boids == boids) {
- return BLI_strdup("boids");
- }
- }
- return NULL;
+ if (part->boids == boids) {
+ return BLI_strdup("boids");
+ }
+ }
+ return NULL;
}
static PointerRNA rna_BoidSettings_active_boid_state_get(PointerRNA *ptr)
{
- BoidSettings *boids = (BoidSettings *)ptr->data;
- BoidState *state = (BoidState *)boids->states.first;
-
- for (; state; state = state->next) {
- if (state->flag & BOIDSTATE_CURRENT)
- return rna_pointer_inherit_refine(ptr, &RNA_BoidState, state);
- }
- return rna_pointer_inherit_refine(ptr, &RNA_BoidState, NULL);
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidState *state = (BoidState *)boids->states.first;
+
+ for (; state; state = state->next) {
+ if (state->flag & BOIDSTATE_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidState, state);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_BoidState, NULL);
}
-static void rna_BoidSettings_active_boid_state_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_BoidSettings_active_boid_state_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- BoidSettings *boids = (BoidSettings *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&boids->states) - 1);
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&boids->states) - 1);
}
static int rna_BoidSettings_active_boid_state_index_get(PointerRNA *ptr)
{
- BoidSettings *boids = (BoidSettings *)ptr->data;
- BoidState *state = (BoidState *)boids->states.first;
- int i = 0;
-
- for (; state; state = state->next, i++) {
- if (state->flag & BOIDSTATE_CURRENT)
- return i;
- }
- return 0;
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidState *state = (BoidState *)boids->states.first;
+ int i = 0;
+
+ for (; state; state = state->next, i++) {
+ if (state->flag & BOIDSTATE_CURRENT)
+ return i;
+ }
+ return 0;
}
static void rna_BoidSettings_active_boid_state_index_set(struct PointerRNA *ptr, int value)
{
- BoidSettings *boids = (BoidSettings *)ptr->data;
- BoidState *state = (BoidState *)boids->states.first;
- int i = 0;
-
- for (; state; state = state->next, i++) {
- if (i == value)
- state->flag |= BOIDSTATE_CURRENT;
- else
- state->flag &= ~BOIDSTATE_CURRENT;
- }
+ BoidSettings *boids = (BoidSettings *)ptr->data;
+ BoidState *state = (BoidState *)boids->states.first;
+ int i = 0;
+
+ for (; state; state = state->next, i++) {
+ if (i == value)
+ state->flag |= BOIDSTATE_CURRENT;
+ else
+ state->flag &= ~BOIDSTATE_CURRENT;
+ }
}
#else
static void rna_def_boidrule_goal(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidRuleGoal", "BoidRule");
- RNA_def_struct_ui_text(srna, "Goal", "");
- RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object", "Goal object");
- RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
-
- prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
- RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleGoal", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Goal", "");
+ RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Goal object");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
+
+ prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
+ RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boidrule_avoid(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidRuleAvoid", "BoidRule");
- RNA_def_struct_ui_text(srna, "Avoid", "");
- RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object", "Object to avoid");
- RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
-
- prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
- RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "fear_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Fear factor", "Avoid object if danger from it is above this threshold");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleAvoid", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Avoid", "");
+ RNA_def_struct_sdna(srna, "BoidRuleGoalAvoid");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Object to avoid");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
+
+ prop = RNA_def_property(srna, "use_predict", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_GOAL_AVOID_PREDICT);
+ RNA_def_property_ui_text(prop, "Predict", "Predict target movement");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "fear_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop, "Fear factor", "Avoid object if danger from it is above this threshold");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boidrule_avoid_collision(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidRuleAvoidCollision", "BoidRule");
- RNA_def_struct_ui_text(srna, "Avoid Collision", "");
-
- prop = RNA_def_property(srna, "use_avoid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_BOIDS);
- RNA_def_property_ui_text(prop, "Boids", "Avoid collision with other boids");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "use_avoid_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_DEFLECTORS);
- RNA_def_property_ui_text(prop, "Deflectors", "Avoid collision with deflector objects");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "look_ahead", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Look ahead", "Time to look ahead in seconds");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleAvoidCollision", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Avoid Collision", "");
+
+ prop = RNA_def_property(srna, "use_avoid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_BOIDS);
+ RNA_def_property_ui_text(prop, "Boids", "Avoid collision with other boids");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_avoid_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_ACOLL_WITH_DEFLECTORS);
+ RNA_def_property_ui_text(prop, "Deflectors", "Avoid collision with deflector objects");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "look_ahead", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Look ahead", "Time to look ahead in seconds");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boidrule_follow_leader(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidRuleFollowLeader", "BoidRule");
- RNA_def_struct_ui_text(srna, "Follow Leader", "");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object", "Follow this object instead of a boid");
- RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
-
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Distance", "Distance behind leader to follow");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "queue_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "queue_size");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Queue Size", "How many boids in a line");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_LEADER_IN_LINE);
- RNA_def_property_ui_text(prop, "Line", "Follow leader in a line");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleFollowLeader", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Follow Leader", "");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "Follow this object instead of a boid");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset_deps");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Distance", "Distance behind leader to follow");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "queue_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "queue_size");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Queue Size", "How many boids in a line");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BRULE_LEADER_IN_LINE);
+ RNA_def_property_ui_text(prop, "Line", "Follow leader in a line");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boidrule_average_speed(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidRuleAverageSpeed", "BoidRule");
- RNA_def_struct_ui_text(srna, "Average Speed", "");
-
- prop = RNA_def_property(srna, "wander", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Wander", "How fast velocity's direction is randomized");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "level", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Level", "How much velocity's z-component is kept constant");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Speed", "Percentage of maximum speed");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidRuleAverageSpeed", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Average Speed", "");
+
+ prop = RNA_def_property(srna, "wander", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Wander", "How fast velocity's direction is randomized");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "level", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Level", "How much velocity's z-component is kept constant");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Speed", "Percentage of maximum speed");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boidrule_fight(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "BoidRuleFight", "BoidRule");
- RNA_def_struct_ui_text(srna, "Fight", "");
+ srna = RNA_def_struct(brna, "BoidRuleFight", "BoidRule");
+ RNA_def_struct_ui_text(srna, "Fight", "");
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Fight Distance", "Attack boids at max this distance");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Fight Distance", "Attack boids at max this distance");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
- prop = RNA_def_property(srna, "flee_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Flee Distance", "Flee to this distance");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ prop = RNA_def_property(srna, "flee_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Flee Distance", "Flee to this distance");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boidrule(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* data */
- srna = RNA_def_struct(brna, "BoidRule", NULL);
- RNA_def_struct_ui_text(srna, "Boid Rule", "");
- RNA_def_struct_refine_func(srna, "rna_BoidRule_refine");
- RNA_def_struct_path_func(srna, "rna_BoidRule_path");
-
- /* strings */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Boid rule name");
- RNA_def_struct_name_property(srna, prop);
-
- /* enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_boidrule_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
-
- /* flags */
- prop = RNA_def_property(srna, "use_in_air", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_IN_AIR);
- RNA_def_property_ui_text(prop, "In Air", "Use rule when boid is flying");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "use_on_land", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_ON_LAND);
- RNA_def_property_ui_text(prop, "On Land", "Use rule when boid is on land");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- /*prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); */
- /*RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);*/
- /*RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); */
- /*RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); */
-
- /* types */
- rna_def_boidrule_goal(brna);
- rna_def_boidrule_avoid(brna);
- rna_def_boidrule_avoid_collision(brna);
- rna_def_boidrule_follow_leader(brna);
- rna_def_boidrule_average_speed(brna);
- rna_def_boidrule_fight(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* data */
+ srna = RNA_def_struct(brna, "BoidRule", NULL);
+ RNA_def_struct_ui_text(srna, "Boid Rule", "");
+ RNA_def_struct_refine_func(srna, "rna_BoidRule_refine");
+ RNA_def_struct_path_func(srna, "rna_BoidRule_path");
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Boid rule name");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_boidrule_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_in_air", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_IN_AIR);
+ RNA_def_property_ui_text(prop, "In Air", "Use rule when boid is flying");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_on_land", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BOIDRULE_ON_LAND);
+ RNA_def_property_ui_text(prop, "On Land", "Use rule when boid is on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /*prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); */
+ /*RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);*/
+ /*RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); */
+ /*RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); */
+
+ /* types */
+ rna_def_boidrule_goal(brna);
+ rna_def_boidrule_avoid(brna);
+ rna_def_boidrule_avoid_collision(brna);
+ rna_def_boidrule_follow_leader(brna);
+ rna_def_boidrule_average_speed(brna);
+ rna_def_boidrule_fight(brna);
}
static void rna_def_boidstate(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidState", NULL);
- RNA_def_struct_ui_text(srna, "Boid State", "Boid state for boid physics");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Boid state name");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "ruleset_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, boidruleset_type_items);
- RNA_def_property_ui_text(prop, "Rule Evaluation", "How the rules in the list are evaluated");
-
- prop = RNA_def_property(srna, "rules", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoidRule");
- RNA_def_property_ui_text(prop, "Boid Rules", "");
-
- prop = RNA_def_property(srna, "active_boid_rule", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoidRule");
- RNA_def_property_pointer_funcs(prop, "rna_BoidState_active_boid_rule_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Boid Rule", "");
-
- prop = RNA_def_property(srna, "active_boid_rule_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_BoidState_active_boid_rule_index_get",
- "rna_BoidState_active_boid_rule_index_set",
- "rna_BoidState_active_boid_rule_index_range");
- RNA_def_property_ui_text(prop, "Active Boid Rule Index", "");
-
- prop = RNA_def_property(srna, "rule_fuzzy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rule_fuzziness");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Rule Fuzziness", "");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Volume", "");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Falloff", "");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidState", NULL);
+ RNA_def_struct_ui_text(srna, "Boid State", "Boid state for boid physics");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Boid state name");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "ruleset_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, boidruleset_type_items);
+ RNA_def_property_ui_text(prop, "Rule Evaluation", "How the rules in the list are evaluated");
+
+ prop = RNA_def_property(srna, "rules", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidRule");
+ RNA_def_property_ui_text(prop, "Boid Rules", "");
+
+ prop = RNA_def_property(srna, "active_boid_rule", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidRule");
+ RNA_def_property_pointer_funcs(prop, "rna_BoidState_active_boid_rule_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Boid Rule", "");
+
+ prop = RNA_def_property(srna, "active_boid_rule_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_BoidState_active_boid_rule_index_get",
+ "rna_BoidState_active_boid_rule_index_set",
+ "rna_BoidState_active_boid_rule_index_range");
+ RNA_def_property_ui_text(prop, "Active Boid Rule Index", "");
+
+ prop = RNA_def_property(srna, "rule_fuzzy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rule_fuzziness");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Rule Fuzziness", "");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Volume", "");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Falloff", "");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
static void rna_def_boid_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BoidSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_BoidSettings_path");
- RNA_def_struct_ui_text(srna, "Boid Settings", "Settings for boid physics");
-
- prop = RNA_def_property(srna, "land_smooth", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "landing_smoothness");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Landing Smoothness", "How smoothly the boids land");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "bank", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "banking");
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Banking", "Amount of rotation around velocity vector on turns");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pitch");
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Pitch", "Amount of rotation around side vector");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Height", "Boid height relative to particle size");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- /* states */
- prop = RNA_def_property(srna, "states", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoidState");
- RNA_def_property_ui_text(prop, "Boid States", "");
-
- prop = RNA_def_property(srna, "active_boid_state", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoidRule");
- RNA_def_property_pointer_funcs(prop, "rna_BoidSettings_active_boid_state_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Boid Rule", "");
-
- prop = RNA_def_property(srna, "active_boid_state_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_BoidSettings_active_boid_state_index_get",
- "rna_BoidSettings_active_boid_state_index_set",
- "rna_BoidSettings_active_boid_state_index_range");
- RNA_def_property_ui_text(prop, "Active Boid State Index", "");
-
- /* character properties */
- prop = RNA_def_property(srna, "health", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Health", "Initial boid health when born");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Strength", "Maximum caused damage on attack per second");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "aggression", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Aggression", "Boid will fight this times stronger enemy");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Accuracy", "Accuracy of attack");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Range", "Maximum distance from which a boid can attack");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- /* physical properties */
- prop = RNA_def_property(srna, "air_speed_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "air_min_speed");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Min Air Speed", "Minimum speed in air (relative to maximum speed)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "air_speed_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "air_max_speed");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Max Air Speed", "Maximum speed in air");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "air_acc_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "air_max_acc");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Air Acceleration", "Maximum acceleration in air (relative to maximum speed)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "air_ave_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "air_max_ave");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Air Angular Velocity",
- "Maximum angular velocity in air (relative to 180 degrees)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "air_personal_space", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Air Personal Space", "Radius of boids personal space in air (% of particle size)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "land_jump_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Jump Speed", "Maximum speed for jumping");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "land_speed_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "land_max_speed");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Max Land Speed", "Maximum speed on land");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "land_acc_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "land_max_acc");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Land Acceleration",
- "Maximum acceleration on land (relative to maximum speed)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "land_ave_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "land_max_ave");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Max Land Angular Velocity",
- "Maximum angular velocity on land (relative to 180 degrees)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "land_personal_space", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Land Personal Space",
- "Radius of boids personal space on land (% of particle size)");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "land_stick_force", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1000.0);
- RNA_def_property_ui_text(prop, "Land Stick Force", "How strong a force must be to start effecting a boid on land");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- /* options */
- prop = RNA_def_property(srna, "use_flight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_FLIGHT);
- RNA_def_property_ui_text(prop, "Allow Flight", "Allow boids to move in air");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "use_land", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_LAND);
- RNA_def_property_ui_text(prop, "Allow Land", "Allow boids to move on land");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
-
- prop = RNA_def_property(srna, "use_climb", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_CLIMB);
- RNA_def_property_ui_text(prop, "Allow Climbing", "Allow boids to climb goal objects");
- RNA_def_property_update(prop, 0, "rna_Boids_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BoidSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_BoidSettings_path");
+ RNA_def_struct_ui_text(srna, "Boid Settings", "Settings for boid physics");
+
+ prop = RNA_def_property(srna, "land_smooth", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "landing_smoothness");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Landing Smoothness", "How smoothly the boids land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "bank", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "banking");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Banking", "Amount of rotation around velocity vector on turns");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pitch");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Pitch", "Amount of rotation around side vector");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Height", "Boid height relative to particle size");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /* states */
+ prop = RNA_def_property(srna, "states", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidState");
+ RNA_def_property_ui_text(prop, "Boid States", "");
+
+ prop = RNA_def_property(srna, "active_boid_state", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidRule");
+ RNA_def_property_pointer_funcs(prop, "rna_BoidSettings_active_boid_state_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Boid Rule", "");
+
+ prop = RNA_def_property(srna, "active_boid_state_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_BoidSettings_active_boid_state_index_get",
+ "rna_BoidSettings_active_boid_state_index_set",
+ "rna_BoidSettings_active_boid_state_index_range");
+ RNA_def_property_ui_text(prop, "Active Boid State Index", "");
+
+ /* character properties */
+ prop = RNA_def_property(srna, "health", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Health", "Initial boid health when born");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Strength", "Maximum caused damage on attack per second");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "aggression", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Aggression", "Boid will fight this times stronger enemy");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Accuracy", "Accuracy of attack");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "range", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Range", "Maximum distance from which a boid can attack");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /* physical properties */
+ prop = RNA_def_property(srna, "air_speed_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_min_speed");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(
+ prop, "Min Air Speed", "Minimum speed in air (relative to maximum speed)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_speed_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_max_speed");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Max Air Speed", "Maximum speed in air");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_acc_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_max_acc");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(
+ prop, "Max Air Acceleration", "Maximum acceleration in air (relative to maximum speed)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_ave_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "air_max_ave");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop,
+ "Max Air Angular Velocity",
+ "Maximum angular velocity in air (relative to 180 degrees)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "air_personal_space", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(
+ prop, "Air Personal Space", "Radius of boids personal space in air (% of particle size)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_jump_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Jump Speed", "Maximum speed for jumping");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_speed_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "land_max_speed");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(prop, "Max Land Speed", "Maximum speed on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_acc_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "land_max_acc");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(
+ prop, "Max Land Acceleration", "Maximum acceleration on land (relative to maximum speed)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_ave_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "land_max_ave");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop,
+ "Max Land Angular Velocity",
+ "Maximum angular velocity on land (relative to 180 degrees)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_personal_space", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(
+ prop, "Land Personal Space", "Radius of boids personal space on land (% of particle size)");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "land_stick_force", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_text(
+ prop, "Land Stick Force", "How strong a force must be to start effecting a boid on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ /* options */
+ prop = RNA_def_property(srna, "use_flight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_FLIGHT);
+ RNA_def_property_ui_text(prop, "Allow Flight", "Allow boids to move in air");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_land", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_LAND);
+ RNA_def_property_ui_text(prop, "Allow Land", "Allow boids to move on land");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
+
+ prop = RNA_def_property(srna, "use_climb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "options", BOID_ALLOW_CLIMB);
+ RNA_def_property_ui_text(prop, "Allow Climbing", "Allow boids to climb goal objects");
+ RNA_def_property_update(prop, 0, "rna_Boids_reset");
}
void RNA_def_boid(BlenderRNA *brna)
{
- rna_def_boidrule(brna);
- rna_def_boidstate(brna);
- rna_def_boid_settings(brna);
+ rna_def_boidrule(brna);
+ rna_def_boidstate(brna);
+ rna_def_boid_settings(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 23ae314f885..e2ff6935e43 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -40,2070 +40,2206 @@
#include "WM_types.h"
static const EnumPropertyItem prop_direction_items[] = {
- {0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
- {BRUSH_DIR_IN, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL},
+ {0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
+ {BRUSH_DIR_IN, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sculpt_stroke_method_items[] = {
- {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
- {BRUSH_DRAG_DOT, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"},
- {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
- {BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
- {BRUSH_ANCHORED, "ANCHORED", 0, "Anchored", "Keep the brush anchored to the initial location"},
- {BRUSH_LINE, "LINE", 0, "Line", "Draw a line with dabs separated according to spacing"},
- {BRUSH_CURVE, "CURVE", 0, "Curve",
- "Define the stroke curve with a bezier curve (dabs are separated according to spacing)"},
- {0, NULL, 0, NULL, NULL},
+ {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
+ {BRUSH_DRAG_DOT, "DRAG_DOT", 0, "Drag Dot", "Allows a single dot to be carefully positioned"},
+ {BRUSH_SPACE,
+ "SPACE",
+ 0,
+ "Space",
+ "Limit brush application to the distance specified by spacing"},
+ {BRUSH_AIRBRUSH,
+ "AIRBRUSH",
+ 0,
+ "Airbrush",
+ "Keep applying paint effect while holding mouse (spray)"},
+ {BRUSH_ANCHORED, "ANCHORED", 0, "Anchored", "Keep the brush anchored to the initial location"},
+ {BRUSH_LINE, "LINE", 0, "Line", "Draw a line with dabs separated according to spacing"},
+ {BRUSH_CURVE,
+ "CURVE",
+ 0,
+ "Curve",
+ "Define the stroke curve with a bezier curve (dabs are separated according to spacing)"},
+ {0, NULL, 0, NULL, NULL},
};
-
const EnumPropertyItem rna_enum_brush_sculpt_tool_items[] = {
- {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
- {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
- {SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""},
- {SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
- {SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
- {SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
- {SCULPT_TOOL_CREASE, "CREASE", ICON_BRUSH_CREASE, "Crease", ""},
- {0, "", 0, NULL, NULL},
- {SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
- {SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
- {SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
- {SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""},
- {SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""},
- {0, "", 0, NULL, NULL},
- {SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
- {SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
- {SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
- {SCULPT_TOOL_NUDGE, "NUDGE", ICON_BRUSH_NUDGE, "Nudge", ""},
- {SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""},
- {0, "", 0, NULL, NULL},
- {SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_MASK, "Mask", ""},
- {SCULPT_TOOL_SIMPLIFY, "SIMPLIFY", ICON_BRUSH_DATA /* icon TODO */, "Simplify", ""},
- {0, NULL, 0, NULL, NULL},
+ {SCULPT_TOOL_DRAW, "DRAW", ICON_BRUSH_SCULPT_DRAW, "Draw", ""},
+ {SCULPT_TOOL_CLAY, "CLAY", ICON_BRUSH_CLAY, "Clay", ""},
+ {SCULPT_TOOL_CLAY_STRIPS, "CLAY_STRIPS", ICON_BRUSH_CLAY_STRIPS, "Clay Strips", ""},
+ {SCULPT_TOOL_LAYER, "LAYER", ICON_BRUSH_LAYER, "Layer", ""},
+ {SCULPT_TOOL_INFLATE, "INFLATE", ICON_BRUSH_INFLATE, "Inflate", ""},
+ {SCULPT_TOOL_BLOB, "BLOB", ICON_BRUSH_BLOB, "Blob", ""},
+ {SCULPT_TOOL_CREASE, "CREASE", ICON_BRUSH_CREASE, "Crease", ""},
+ {0, "", 0, NULL, NULL},
+ {SCULPT_TOOL_SMOOTH, "SMOOTH", ICON_BRUSH_SMOOTH, "Smooth", ""},
+ {SCULPT_TOOL_FLATTEN, "FLATTEN", ICON_BRUSH_FLATTEN, "Flatten", ""},
+ {SCULPT_TOOL_FILL, "FILL", ICON_BRUSH_FILL, "Fill", ""},
+ {SCULPT_TOOL_SCRAPE, "SCRAPE", ICON_BRUSH_SCRAPE, "Scrape", ""},
+ {SCULPT_TOOL_PINCH, "PINCH", ICON_BRUSH_PINCH, "Pinch", ""},
+ {0, "", 0, NULL, NULL},
+ {SCULPT_TOOL_GRAB, "GRAB", ICON_BRUSH_GRAB, "Grab", ""},
+ {SCULPT_TOOL_SNAKE_HOOK, "SNAKE_HOOK", ICON_BRUSH_SNAKE_HOOK, "Snake Hook", ""},
+ {SCULPT_TOOL_THUMB, "THUMB", ICON_BRUSH_THUMB, "Thumb", ""},
+ {SCULPT_TOOL_NUDGE, "NUDGE", ICON_BRUSH_NUDGE, "Nudge", ""},
+ {SCULPT_TOOL_ROTATE, "ROTATE", ICON_BRUSH_ROTATE, "Rotate", ""},
+ {0, "", 0, NULL, NULL},
+ {SCULPT_TOOL_MASK, "MASK", ICON_BRUSH_MASK, "Mask", ""},
+ {SCULPT_TOOL_SIMPLIFY, "SIMPLIFY", ICON_BRUSH_DATA /* icon TODO */, "Simplify", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_vertex_tool_items[] = {
- {VPAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_MIX, "Draw", ""},
- {VPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
- {VPAINT_TOOL_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
- {VPAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
- {0, NULL, 0, NULL, NULL},
+ {VPAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_MIX, "Draw", ""},
+ {VPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
+ {VPAINT_TOOL_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
+ {VPAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_weight_tool_items[] = {
- {WPAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_MIX, "Draw", ""},
- {WPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
- {WPAINT_TOOL_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
- {WPAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
- {0, NULL, 0, NULL, NULL},
+ {WPAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_MIX, "Draw", ""},
+ {WPAINT_TOOL_BLUR, "BLUR", ICON_BRUSH_BLUR, "Blur", ""},
+ {WPAINT_TOOL_AVERAGE, "AVERAGE", ICON_BRUSH_BLUR, "Average", ""},
+ {WPAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_BLUR, "Smear", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_image_tool_items[] = {
- {PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""},
- {PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""},
- {PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""},
- {PAINT_TOOL_CLONE, "CLONE", ICON_BRUSH_CLONE, "Clone", ""},
- {PAINT_TOOL_FILL, "FILL", ICON_BRUSH_TEXFILL, "Fill", ""},
- {PAINT_TOOL_MASK, "MASK", ICON_BRUSH_TEXMASK, "Mask", ""},
- {0, NULL, 0, NULL, NULL},
+ {PAINT_TOOL_DRAW, "DRAW", ICON_BRUSH_TEXDRAW, "Draw", ""},
+ {PAINT_TOOL_SOFTEN, "SOFTEN", ICON_BRUSH_SOFTEN, "Soften", ""},
+ {PAINT_TOOL_SMEAR, "SMEAR", ICON_BRUSH_SMEAR, "Smear", ""},
+ {PAINT_TOOL_CLONE, "CLONE", ICON_BRUSH_CLONE, "Clone", ""},
+ {PAINT_TOOL_FILL, "FILL", ICON_BRUSH_TEXFILL, "Fill", ""},
+ {PAINT_TOOL_MASK, "MASK", ICON_BRUSH_TEXMASK, "Mask", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_brush_gpencil_types_items[] = {
- {GPAINT_TOOL_DRAW, "DRAW", ICON_STROKE, "Draw", "The brush is of type used for drawing strokes"},
- {GPAINT_TOOL_FILL, "FILL", ICON_COLOR, "Fill", "The brush is of type used for filling areas"},
- {GPAINT_TOOL_ERASE, "ERASE", ICON_PANEL_CLOSE, "Erase", "The brush is used for erasing strokes"},
- {0, NULL, 0, NULL, NULL},
+ {GPAINT_TOOL_DRAW,
+ "DRAW",
+ ICON_STROKE,
+ "Draw",
+ "The brush is of type used for drawing strokes"},
+ {GPAINT_TOOL_FILL, "FILL", ICON_COLOR, "Fill", "The brush is of type used for filling areas"},
+ {GPAINT_TOOL_ERASE,
+ "ERASE",
+ ICON_PANEL_CLOSE,
+ "Erase",
+ "The brush is used for erasing strokes"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static EnumPropertyItem rna_enum_gpencil_brush_eraser_modes_items[] = {
- {GP_BRUSH_ERASER_SOFT, "SOFT", 0, "Soft", "Use soft eraser"},
- {GP_BRUSH_ERASER_HARD, "HARD", 0, "Hard", "Use hard eraser"},
- {GP_BRUSH_ERASER_STROKE, "STROKE", 0, "Stroke", "Use stroke eraser"},
- {0, NULL, 0, NULL, NULL},
+ {GP_BRUSH_ERASER_SOFT, "SOFT", 0, "Soft", "Use soft eraser"},
+ {GP_BRUSH_ERASER_HARD, "HARD", 0, "Hard", "Use hard eraser"},
+ {GP_BRUSH_ERASER_STROKE, "STROKE", 0, "Stroke", "Use stroke eraser"},
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
- {GP_FILL_DMODE_BOTH, "BOTH", 0, "Default", "Use both visible strokes and edit lines as fill boundary limits"},
- {GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits"},
- {GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Edit Lines", "Use edit lines as fill boundary limits"},
- {0, NULL, 0, NULL, NULL}
-};
+ {GP_FILL_DMODE_BOTH,
+ "BOTH",
+ 0,
+ "Default",
+ "Use both visible strokes and edit lines as fill boundary limits"},
+ {GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits"},
+ {GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Edit Lines", "Use edit lines as fill boundary limits"},
+ {0, NULL, 0, NULL, NULL}};
static EnumPropertyItem rna_enum_gpencil_brush_icons_items[] = {
- {GP_BRUSH_ICON_PENCIL, "PENCIL", ICON_GPBRUSH_PENCIL, "Pencil", ""},
- {GP_BRUSH_ICON_PEN, "PEN", ICON_GPBRUSH_PEN, "Pen", ""},
- {GP_BRUSH_ICON_INK, "INK", ICON_GPBRUSH_INK, "Ink", ""},
- {GP_BRUSH_ICON_INKNOISE, "INKNOISE", ICON_GPBRUSH_INKNOISE, "Ink Noise", ""},
- {GP_BRUSH_ICON_BLOCK, "BLOCK", ICON_GPBRUSH_BLOCK, "Block", ""},
- {GP_BRUSH_ICON_MARKER, "MARKER", ICON_GPBRUSH_MARKER, "Marker", ""},
- {GP_BRUSH_ICON_FILL, "FILL", ICON_GPBRUSH_FILL, "Fill", ""},
- {GP_BRUSH_ICON_ERASE_SOFT, "SOFT", ICON_GPBRUSH_ERASE_SOFT, "Eraser Soft", ""},
- {GP_BRUSH_ICON_ERASE_HARD, "HARD", ICON_GPBRUSH_ERASE_HARD, "Eraser Hard", ""},
- {GP_BRUSH_ICON_ERASE_STROKE, "STROKE", ICON_GPBRUSH_ERASE_STROKE, "Eraser Stroke", ""},
- {0, NULL, 0, NULL, NULL},
+ {GP_BRUSH_ICON_PENCIL, "PENCIL", ICON_GPBRUSH_PENCIL, "Pencil", ""},
+ {GP_BRUSH_ICON_PEN, "PEN", ICON_GPBRUSH_PEN, "Pen", ""},
+ {GP_BRUSH_ICON_INK, "INK", ICON_GPBRUSH_INK, "Ink", ""},
+ {GP_BRUSH_ICON_INKNOISE, "INKNOISE", ICON_GPBRUSH_INKNOISE, "Ink Noise", ""},
+ {GP_BRUSH_ICON_BLOCK, "BLOCK", ICON_GPBRUSH_BLOCK, "Block", ""},
+ {GP_BRUSH_ICON_MARKER, "MARKER", ICON_GPBRUSH_MARKER, "Marker", ""},
+ {GP_BRUSH_ICON_FILL, "FILL", ICON_GPBRUSH_FILL, "Fill", ""},
+ {GP_BRUSH_ICON_ERASE_SOFT, "SOFT", ICON_GPBRUSH_ERASE_SOFT, "Eraser Soft", ""},
+ {GP_BRUSH_ICON_ERASE_HARD, "HARD", ICON_GPBRUSH_ERASE_HARD, "Eraser Hard", ""},
+ {GP_BRUSH_ICON_ERASE_STROKE, "STROKE", ICON_GPBRUSH_ERASE_STROKE, "Eraser Stroke", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
-
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "BKE_colorband.h"
-#include "BKE_brush.h"
-#include "BKE_icons.h"
-#include "BKE_gpencil.h"
-#include "BKE_paint.h"
-#include "BKE_material.h"
+# include "BKE_colorband.h"
+# include "BKE_brush.h"
+# include "BKE_icons.h"
+# include "BKE_gpencil.h"
+# include "BKE_paint.h"
+# include "BKE_material.h"
-#include "WM_api.h"
+# include "WM_api.h"
static bool rna_BrushCapabilitiesSculpt_has_accumulate_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return SCULPT_TOOL_HAS_ACCUMULATE(br->sculpt_tool);
+ Brush *br = (Brush *)ptr->data;
+ return SCULPT_TOOL_HAS_ACCUMULATE(br->sculpt_tool);
}
static bool rna_BrushCapabilitiesSculpt_has_topology_rake_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return SCULPT_TOOL_HAS_TOPOLOGY_RAKE(br->sculpt_tool);
+ Brush *br = (Brush *)ptr->data;
+ return SCULPT_TOOL_HAS_TOPOLOGY_RAKE(br->sculpt_tool);
}
static bool rna_BrushCapabilitiesSculpt_has_auto_smooth_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
+ Brush *br = (Brush *)ptr->data;
+ return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
}
static bool rna_BrushCapabilitiesSculpt_has_height_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return br->sculpt_tool == SCULPT_TOOL_LAYER;
+ Brush *br = (Brush *)ptr->data;
+ return br->sculpt_tool == SCULPT_TOOL_LAYER;
}
static bool rna_BrushCapabilitiesSculpt_has_jitter_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return (!(br->flag & BRUSH_ANCHORED) &&
- !(br->flag & BRUSH_DRAG_DOT) &&
- !ELEM(br->sculpt_tool,
- SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+ Brush *br = (Brush *)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED) && !(br->flag & BRUSH_DRAG_DOT) &&
+ !ELEM(br->sculpt_tool,
+ SCULPT_TOOL_GRAB,
+ SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK,
+ SCULPT_TOOL_THUMB));
}
static bool rna_BrushCapabilitiesSculpt_has_normal_weight_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return SCULPT_TOOL_HAS_NORMAL_WEIGHT(br->sculpt_tool);
+ Brush *br = (Brush *)ptr->data;
+ return SCULPT_TOOL_HAS_NORMAL_WEIGHT(br->sculpt_tool);
}
static bool rna_BrushCapabilitiesSculpt_has_rake_factor_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return SCULPT_TOOL_HAS_RAKE(br->sculpt_tool);
+ Brush *br = (Brush *)ptr->data;
+ return SCULPT_TOOL_HAS_RAKE(br->sculpt_tool);
}
static bool rna_BrushCapabilities_has_overlay_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ELEM(br->mtex.brush_map_mode,
- MTEX_MAP_MODE_VIEW,
- MTEX_MAP_MODE_TILED,
- MTEX_MAP_MODE_STENCIL);
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(
+ br->mtex.brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL);
}
static bool rna_BrushCapabilitiesSculpt_has_persistence_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return br->sculpt_tool == SCULPT_TOOL_LAYER;
+ Brush *br = (Brush *)ptr->data;
+ return br->sculpt_tool == SCULPT_TOOL_LAYER;
}
static bool rna_BrushCapabilitiesSculpt_has_pinch_factor_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ELEM(br->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE, SCULPT_TOOL_SNAKE_HOOK);
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->sculpt_tool, SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE, SCULPT_TOOL_SNAKE_HOOK);
}
static bool rna_BrushCapabilitiesSculpt_has_plane_offset_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ELEM(br->sculpt_tool, SCULPT_TOOL_CLAY, SCULPT_TOOL_CLAY_STRIPS,
- SCULPT_TOOL_FILL, SCULPT_TOOL_FLATTEN, SCULPT_TOOL_SCRAPE);
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->sculpt_tool,
+ SCULPT_TOOL_CLAY,
+ SCULPT_TOOL_CLAY_STRIPS,
+ SCULPT_TOOL_FILL,
+ SCULPT_TOOL_FLATTEN,
+ SCULPT_TOOL_SCRAPE);
}
static bool rna_BrushCapabilitiesSculpt_has_random_texture_angle_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return (!ELEM(br->sculpt_tool,
- SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+ Brush *br = (Brush *)ptr->data;
+ return (!ELEM(br->sculpt_tool,
+ SCULPT_TOOL_GRAB,
+ SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK,
+ SCULPT_TOOL_THUMB));
}
static bool rna_TextureCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
{
- MTex *mtex = (MTex *)ptr->data;
- return ELEM(mtex->brush_map_mode,
- MTEX_MAP_MODE_VIEW,
- MTEX_MAP_MODE_AREA,
- MTEX_MAP_MODE_RANDOM);
+ MTex *mtex = (MTex *)ptr->data;
+ return ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_AREA, MTEX_MAP_MODE_RANDOM);
}
-
static bool rna_BrushCapabilities_has_random_texture_angle_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return !(br->flag & BRUSH_ANCHORED);
+ Brush *br = (Brush *)ptr->data;
+ return !(br->flag & BRUSH_ANCHORED);
}
static bool rna_BrushCapabilitiesSculpt_has_sculpt_plane_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return !ELEM(br->sculpt_tool, SCULPT_TOOL_INFLATE,
- SCULPT_TOOL_MASK, SCULPT_TOOL_PINCH,
- SCULPT_TOOL_SMOOTH);
+ Brush *br = (Brush *)ptr->data;
+ return !ELEM(br->sculpt_tool,
+ SCULPT_TOOL_INFLATE,
+ SCULPT_TOOL_MASK,
+ SCULPT_TOOL_PINCH,
+ SCULPT_TOOL_SMOOTH);
}
static bool rna_BrushCapabilitiesSculpt_has_secondary_color_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return BKE_brush_sculpt_has_secondary_color(br);
+ Brush *br = (Brush *)ptr->data;
+ return BKE_brush_sculpt_has_secondary_color(br);
}
static bool rna_BrushCapabilitiesSculpt_has_smooth_stroke_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return (!(br->flag & BRUSH_ANCHORED) &&
- !(br->flag & BRUSH_DRAG_DOT) &&
- !(br->flag & BRUSH_LINE) &&
- !(br->flag & BRUSH_CURVE) &&
- !ELEM(br->sculpt_tool,
- SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SNAKE_HOOK, SCULPT_TOOL_THUMB));
+ Brush *br = (Brush *)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED) && !(br->flag & BRUSH_DRAG_DOT) &&
+ !(br->flag & BRUSH_LINE) && !(br->flag & BRUSH_CURVE) &&
+ !ELEM(br->sculpt_tool,
+ SCULPT_TOOL_GRAB,
+ SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SNAKE_HOOK,
+ SCULPT_TOOL_THUMB));
}
static bool rna_BrushCapabilities_has_smooth_stroke_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return (!(br->flag & BRUSH_ANCHORED) &&
- !(br->flag & BRUSH_DRAG_DOT) &&
- !(br->flag & BRUSH_LINE) &&
- !(br->flag & BRUSH_CURVE));
+ Brush *br = (Brush *)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED) && !(br->flag & BRUSH_DRAG_DOT) &&
+ !(br->flag & BRUSH_LINE) && !(br->flag & BRUSH_CURVE));
}
static bool rna_BrushCapabilitiesSculpt_has_space_attenuation_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ((br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) &&
- !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_ROTATE,
- SCULPT_TOOL_SMOOTH, SCULPT_TOOL_SNAKE_HOOK));
+ Brush *br = (Brush *)ptr->data;
+ return ((br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) && !ELEM(br->sculpt_tool,
+ SCULPT_TOOL_GRAB,
+ SCULPT_TOOL_ROTATE,
+ SCULPT_TOOL_SMOOTH,
+ SCULPT_TOOL_SNAKE_HOOK));
}
static bool rna_BrushCapabilitiesImagePaint_has_space_attenuation_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return (br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) &&
- br->imagepaint_tool != PAINT_TOOL_FILL;
+ Brush *br = (Brush *)ptr->data;
+ return (br->flag & (BRUSH_SPACE | BRUSH_LINE | BRUSH_CURVE)) &&
+ br->imagepaint_tool != PAINT_TOOL_FILL;
}
static bool rna_BrushCapabilitiesImagePaint_has_color_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ELEM(br->imagepaint_tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL);
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->imagepaint_tool, PAINT_TOOL_DRAW, PAINT_TOOL_FILL);
}
static bool rna_BrushCapabilitiesVertexPaint_has_color_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ELEM(br->vertexpaint_tool, VPAINT_TOOL_DRAW);
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->vertexpaint_tool, VPAINT_TOOL_DRAW);
}
static bool rna_BrushCapabilitiesWeightPaint_has_weight_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return ELEM(br->weightpaint_tool, WPAINT_TOOL_DRAW);
+ Brush *br = (Brush *)ptr->data;
+ return ELEM(br->weightpaint_tool, WPAINT_TOOL_DRAW);
}
static bool rna_BrushCapabilities_has_spacing_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return (!(br->flag & BRUSH_ANCHORED));
+ Brush *br = (Brush *)ptr->data;
+ return (!(br->flag & BRUSH_ANCHORED));
}
static bool rna_BrushCapabilitiesSculpt_has_strength_pressure_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
+ Brush *br = (Brush *)ptr->data;
+ return !ELEM(br->sculpt_tool, SCULPT_TOOL_GRAB, SCULPT_TOOL_SNAKE_HOOK);
}
static bool rna_TextureCapabilities_has_texture_angle_get(PointerRNA *ptr)
{
- MTex *mtex = (MTex *)ptr->data;
- return mtex->brush_map_mode != MTEX_MAP_MODE_3D;
+ MTex *mtex = (MTex *)ptr->data;
+ return mtex->brush_map_mode != MTEX_MAP_MODE_3D;
}
static bool rna_BrushCapabilitiesSculpt_has_direction_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return !ELEM(br->sculpt_tool, SCULPT_TOOL_DRAW, SCULPT_TOOL_CLAY,
- SCULPT_TOOL_CLAY_STRIPS, SCULPT_TOOL_LAYER, SCULPT_TOOL_INFLATE,
- SCULPT_TOOL_BLOB, SCULPT_TOOL_CREASE, SCULPT_TOOL_FLATTEN,
- SCULPT_TOOL_FILL, SCULPT_TOOL_SCRAPE, SCULPT_TOOL_CLAY,
- SCULPT_TOOL_PINCH, SCULPT_TOOL_MASK);
+ Brush *br = (Brush *)ptr->data;
+ return !ELEM(br->sculpt_tool,
+ SCULPT_TOOL_DRAW,
+ SCULPT_TOOL_CLAY,
+ SCULPT_TOOL_CLAY_STRIPS,
+ SCULPT_TOOL_LAYER,
+ SCULPT_TOOL_INFLATE,
+ SCULPT_TOOL_BLOB,
+ SCULPT_TOOL_CREASE,
+ SCULPT_TOOL_FLATTEN,
+ SCULPT_TOOL_FILL,
+ SCULPT_TOOL_SCRAPE,
+ SCULPT_TOOL_CLAY,
+ SCULPT_TOOL_PINCH,
+ SCULPT_TOOL_MASK);
}
static bool rna_BrushCapabilitiesSculpt_has_gravity_get(PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
+ Brush *br = (Brush *)ptr->data;
+ return !ELEM(br->sculpt_tool, SCULPT_TOOL_MASK, SCULPT_TOOL_SMOOTH);
}
static bool rna_TextureCapabilities_has_texture_angle_source_get(PointerRNA *ptr)
{
- MTex *mtex = (MTex *)ptr->data;
- return ELEM(mtex->brush_map_mode,
- MTEX_MAP_MODE_VIEW,
- MTEX_MAP_MODE_AREA,
- MTEX_MAP_MODE_RANDOM);
+ MTex *mtex = (MTex *)ptr->data;
+ return ELEM(mtex->brush_map_mode, MTEX_MAP_MODE_VIEW, MTEX_MAP_MODE_AREA, MTEX_MAP_MODE_RANDOM);
}
static bool rna_BrushCapabilitiesImagePaint_has_accumulate_get(PointerRNA *ptr)
{
- /* only support for draw tool */
- Brush *br = (Brush *)ptr->data;
+ /* only support for draw tool */
+ Brush *br = (Brush *)ptr->data;
- return ((br->flag & BRUSH_AIRBRUSH) ||
- (br->flag & BRUSH_DRAG_DOT) ||
- (br->flag & BRUSH_ANCHORED) ||
- (br->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
- (br->imagepaint_tool == PAINT_TOOL_SMEAR) ||
- (br->imagepaint_tool == PAINT_TOOL_FILL) ||
- (br->mtex.tex && !ELEM(br->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D))
- ) ? false : true;
+ return ((br->flag & BRUSH_AIRBRUSH) || (br->flag & BRUSH_DRAG_DOT) ||
+ (br->flag & BRUSH_ANCHORED) || (br->imagepaint_tool == PAINT_TOOL_SOFTEN) ||
+ (br->imagepaint_tool == PAINT_TOOL_SMEAR) || (br->imagepaint_tool == PAINT_TOOL_FILL) ||
+ (br->mtex.tex && !ELEM(br->mtex.brush_map_mode,
+ MTEX_MAP_MODE_TILED,
+ MTEX_MAP_MODE_STENCIL,
+ MTEX_MAP_MODE_3D))) ?
+ false :
+ true;
}
static bool rna_BrushCapabilitiesImagePaint_has_radius_get(PointerRNA *ptr)
{
- /* only support for draw tool */
- Brush *br = (Brush *)ptr->data;
+ /* only support for draw tool */
+ Brush *br = (Brush *)ptr->data;
- return (br->imagepaint_tool != PAINT_TOOL_FILL);
+ return (br->imagepaint_tool != PAINT_TOOL_FILL);
}
-
static PointerRNA rna_Sculpt_tool_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesSculpt, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesSculpt, ptr->id.data);
}
static PointerRNA rna_Imapaint_tool_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesImagePaint, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesImagePaint, ptr->id.data);
}
static PointerRNA rna_Vertexpaint_tool_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesVertexPaint, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesVertexPaint, ptr->id.data);
}
static PointerRNA rna_Weightpaint_tool_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesWeightPaint, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilitiesWeightPaint, ptr->id.data);
}
static PointerRNA rna_Brush_capabilities_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilities, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_BrushCapabilities, ptr->id.data);
}
static void rna_Brush_reset_icon(Brush *br)
{
- ID *id = &br->id;
+ ID *id = &br->id;
- if (br->flag & BRUSH_CUSTOM_ICON)
- return;
+ if (br->flag & BRUSH_CUSTOM_ICON)
+ return;
- if (id->icon_id >= BIFICONID_LAST) {
- BKE_icon_id_delete(id);
- BKE_previewimg_id_free(id);
- }
+ if (id->icon_id >= BIFICONID_LAST) {
+ BKE_icon_id_delete(id);
+ BKE_previewimg_id_free(id);
+ }
- id->icon_id = 0;
+ id->icon_id = 0;
}
static void rna_Brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
- WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
- /*WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); */
+ Brush *br = (Brush *)ptr->data;
+ WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
+ /*WM_main_add_notifier(NC_SPACE|ND_SPACE_VIEW3D, NULL); */
}
static void rna_Brush_material_update(bContext *UNUSED(C), PointerRNA *UNUSED(ptr))
{
- /* number of material users changed */
- WM_main_add_notifier(NC_SPACE | ND_SPACE_PROPERTIES, NULL);
+ /* number of material users changed */
+ WM_main_add_notifier(NC_SPACE | ND_SPACE_PROPERTIES, NULL);
}
static void rna_Brush_main_tex_update(bContext *C, PointerRNA *ptr)
{
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Brush *br = (Brush *)ptr->data;
- BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mtex.tex);
- rna_Brush_update(bmain, scene, ptr);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Brush *br = (Brush *)ptr->data;
+ BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mtex.tex);
+ rna_Brush_update(bmain, scene, ptr);
}
static void rna_Brush_secondary_tex_update(bContext *C, PointerRNA *ptr)
{
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Brush *br = (Brush *)ptr->data;
- BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mask_mtex.tex);
- rna_Brush_update(bmain, scene, ptr);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Brush *br = (Brush *)ptr->data;
+ BKE_paint_invalidate_overlay_tex(scene, view_layer, br->mask_mtex.tex);
+ rna_Brush_update(bmain, scene, ptr);
}
static void rna_Brush_size_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- BKE_paint_invalidate_overlay_all();
- rna_Brush_update(bmain, scene, ptr);
+ BKE_paint_invalidate_overlay_all();
+ rna_Brush_update(bmain, scene, ptr);
}
static void rna_Brush_update_and_reset_icon(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Brush *br = ptr->data;
- rna_Brush_reset_icon(br);
- rna_Brush_update(bmain, scene, ptr);
+ Brush *br = ptr->data;
+ rna_Brush_reset_icon(br);
+ rna_Brush_update(bmain, scene, ptr);
}
static void rna_Brush_stroke_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, scene);
- rna_Brush_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, scene);
+ rna_Brush_update(bmain, scene, ptr);
}
static void rna_Brush_icon_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Brush *br = (Brush *)ptr->data;
+ Brush *br = (Brush *)ptr->data;
- if (br->icon_imbuf) {
- IMB_freeImBuf(br->icon_imbuf);
- br->icon_imbuf = NULL;
- }
+ if (br->icon_imbuf) {
+ IMB_freeImBuf(br->icon_imbuf);
+ br->icon_imbuf = NULL;
+ }
- br->id.icon_id = 0;
+ br->id.icon_id = 0;
- if (br->flag & BRUSH_CUSTOM_ICON) {
- BKE_icon_changed(BKE_icon_id_ensure(&br->id));
- }
+ if (br->flag & BRUSH_CUSTOM_ICON) {
+ BKE_icon_changed(BKE_icon_id_ensure(&br->id));
+ }
- WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
+ WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
}
static void rna_TextureSlot_brush_angle_update(bContext *C, PointerRNA *ptr)
{
- Scene *scene = CTX_data_scene(C);
- MTex *mtex = ptr->data;
- /* skip invalidation of overlay for stencil mode */
- if (mtex->mapping != MTEX_MAP_MODE_STENCIL) {
- ViewLayer *view_layer = CTX_data_view_layer(C);
- BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex);
- }
+ Scene *scene = CTX_data_scene(C);
+ MTex *mtex = ptr->data;
+ /* skip invalidation of overlay for stencil mode */
+ if (mtex->mapping != MTEX_MAP_MODE_STENCIL) {
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex);
+ }
- rna_TextureSlot_update(C, ptr);
+ rna_TextureSlot_update(C, ptr);
}
static void rna_Brush_set_size(PointerRNA *ptr, int value)
{
- Brush *brush = ptr->data;
+ Brush *brush = ptr->data;
- /* scale unprojected radius so it stays consistent with brush size */
- BKE_brush_scale_unprojected_radius(&brush->unprojected_radius,
- value, brush->size);
- brush->size = value;
+ /* scale unprojected radius so it stays consistent with brush size */
+ BKE_brush_scale_unprojected_radius(&brush->unprojected_radius, value, brush->size);
+ brush->size = value;
}
static void rna_Brush_use_gradient_set(PointerRNA *ptr, bool value)
{
- Brush *br = (Brush *)ptr->data;
+ Brush *br = (Brush *)ptr->data;
- if (value) br->flag |= BRUSH_USE_GRADIENT;
- else br->flag &= ~BRUSH_USE_GRADIENT;
+ if (value)
+ br->flag |= BRUSH_USE_GRADIENT;
+ else
+ br->flag &= ~BRUSH_USE_GRADIENT;
- if ((br->flag & BRUSH_USE_GRADIENT) && br->gradient == NULL)
- br->gradient = BKE_colorband_add(true);
+ if ((br->flag & BRUSH_USE_GRADIENT) && br->gradient == NULL)
+ br->gradient = BKE_colorband_add(true);
}
static void rna_Brush_set_unprojected_radius(PointerRNA *ptr, float value)
{
- Brush *brush = ptr->data;
-
- /* scale brush size so it stays consistent with unprojected_radius */
- BKE_brush_scale_size(&brush->size, value, brush->unprojected_radius);
- brush->unprojected_radius = value;
-}
-
-static const EnumPropertyItem *rna_Brush_direction_itemf(
- bContext *C, PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
-{
- ePaintMode mode = BKE_paintmode_get_active_from_context(C);
-
- static const EnumPropertyItem prop_default_items[] = {
- {0, NULL, 0, NULL, NULL},
- };
-
- /* sculpt mode */
- static const EnumPropertyItem prop_flatten_contrast_items[] = {
- {BRUSH_DIR_IN, "CONTRAST", ICON_ADD, "Contrast", "Subtract effect of brush"},
- {0, "FLATTEN", ICON_REMOVE, "Flatten", "Add effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_fill_deepen_items[] = {
- {0, "FILL", ICON_ADD, "Fill", "Add effect of brush"},
- {BRUSH_DIR_IN, "DEEPEN", ICON_REMOVE, "Deepen", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_scrape_peaks_items[] = {
- {0, "SCRAPE", ICON_ADD, "Scrape", "Add effect of brush"},
- {BRUSH_DIR_IN, "PEAKS", ICON_REMOVE, "Peaks", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_pinch_magnify_items[] = {
- {BRUSH_DIR_IN, "MAGNIFY", ICON_ADD, "Magnify", "Subtract effect of brush"},
- {0, "PINCH", ICON_REMOVE, "Pinch", "Add effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_inflate_deflate_items[] = {
- {0, "INFLATE", ICON_ADD, "Inflate", "Add effect of brush"},
- {BRUSH_DIR_IN, "DEFLATE", ICON_REMOVE, "Deflate", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* texture paint mode */
- static const EnumPropertyItem prop_soften_sharpen_items[] = {
- {BRUSH_DIR_IN, "SHARPEN", ICON_ADD, "Sharpen", "Sharpen effect of brush"},
- {0, "SOFTEN", ICON_REMOVE, "Soften", "Blur effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- Brush *me = (Brush *)(ptr->data);
-
- switch (mode) {
- case PAINT_MODE_SCULPT:
- switch (me->sculpt_tool) {
- case SCULPT_TOOL_DRAW:
- case SCULPT_TOOL_CREASE:
- case SCULPT_TOOL_BLOB:
- case SCULPT_TOOL_LAYER:
- case SCULPT_TOOL_CLAY:
- case SCULPT_TOOL_CLAY_STRIPS:
- return prop_direction_items;
-
- case SCULPT_TOOL_MASK:
- switch ((BrushMaskTool)me->mask_tool) {
- case BRUSH_MASK_DRAW:
- return prop_direction_items;
-
- case BRUSH_MASK_SMOOTH:
- return prop_default_items;
-
- default:
- return prop_default_items;
- }
-
- case SCULPT_TOOL_FLATTEN:
- return prop_flatten_contrast_items;
-
- case SCULPT_TOOL_FILL:
- return prop_fill_deepen_items;
-
- case SCULPT_TOOL_SCRAPE:
- return prop_scrape_peaks_items;
-
- case SCULPT_TOOL_PINCH:
- return prop_pinch_magnify_items;
-
- case SCULPT_TOOL_INFLATE:
- return prop_inflate_deflate_items;
-
- default:
- return prop_default_items;
- }
-
- case PAINT_MODE_TEXTURE_2D:
- case PAINT_MODE_TEXTURE_3D:
- switch (me->imagepaint_tool) {
- case PAINT_TOOL_SOFTEN:
- return prop_soften_sharpen_items;
-
- default:
- return prop_default_items;
- }
-
- default:
- return prop_default_items;
- }
-}
-
-static const EnumPropertyItem *rna_Brush_stroke_itemf(
- bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
-{
- ePaintMode mode = BKE_paintmode_get_active_from_context(C);
-
- static const EnumPropertyItem brush_stroke_method_items[] = {
- {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
- {BRUSH_SPACE, "SPACE", 0, "Space", "Limit brush application to the distance specified by spacing"},
- {BRUSH_AIRBRUSH, "AIRBRUSH", 0, "Airbrush", "Keep applying paint effect while holding mouse (spray)"},
- {BRUSH_LINE, "LINE", 0, "Line", "Drag a line with dabs separated according to spacing"},
- {BRUSH_CURVE, "CURVE", 0, "Curve", "Define the stroke curve with a bezier curve. Dabs are separated according to spacing"},
- {0, NULL, 0, NULL, NULL},
- };
-
- switch (mode) {
- case PAINT_MODE_SCULPT:
- case PAINT_MODE_TEXTURE_2D:
- case PAINT_MODE_TEXTURE_3D:
- return sculpt_stroke_method_items;
-
- default:
- return brush_stroke_method_items;
- }
+ Brush *brush = ptr->data;
+
+ /* scale brush size so it stays consistent with unprojected_radius */
+ BKE_brush_scale_size(&brush->size, value, brush->unprojected_radius);
+ brush->unprojected_radius = value;
+}
+
+static const EnumPropertyItem *rna_Brush_direction_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ ePaintMode mode = BKE_paintmode_get_active_from_context(C);
+
+ static const EnumPropertyItem prop_default_items[] = {
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* sculpt mode */
+ static const EnumPropertyItem prop_flatten_contrast_items[] = {
+ {BRUSH_DIR_IN, "CONTRAST", ICON_ADD, "Contrast", "Subtract effect of brush"},
+ {0, "FLATTEN", ICON_REMOVE, "Flatten", "Add effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_fill_deepen_items[] = {
+ {0, "FILL", ICON_ADD, "Fill", "Add effect of brush"},
+ {BRUSH_DIR_IN, "DEEPEN", ICON_REMOVE, "Deepen", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_scrape_peaks_items[] = {
+ {0, "SCRAPE", ICON_ADD, "Scrape", "Add effect of brush"},
+ {BRUSH_DIR_IN, "PEAKS", ICON_REMOVE, "Peaks", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_pinch_magnify_items[] = {
+ {BRUSH_DIR_IN, "MAGNIFY", ICON_ADD, "Magnify", "Subtract effect of brush"},
+ {0, "PINCH", ICON_REMOVE, "Pinch", "Add effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_inflate_deflate_items[] = {
+ {0, "INFLATE", ICON_ADD, "Inflate", "Add effect of brush"},
+ {BRUSH_DIR_IN, "DEFLATE", ICON_REMOVE, "Deflate", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* texture paint mode */
+ static const EnumPropertyItem prop_soften_sharpen_items[] = {
+ {BRUSH_DIR_IN, "SHARPEN", ICON_ADD, "Sharpen", "Sharpen effect of brush"},
+ {0, "SOFTEN", ICON_REMOVE, "Soften", "Blur effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ Brush *me = (Brush *)(ptr->data);
+
+ switch (mode) {
+ case PAINT_MODE_SCULPT:
+ switch (me->sculpt_tool) {
+ case SCULPT_TOOL_DRAW:
+ case SCULPT_TOOL_CREASE:
+ case SCULPT_TOOL_BLOB:
+ case SCULPT_TOOL_LAYER:
+ case SCULPT_TOOL_CLAY:
+ case SCULPT_TOOL_CLAY_STRIPS:
+ return prop_direction_items;
+
+ case SCULPT_TOOL_MASK:
+ switch ((BrushMaskTool)me->mask_tool) {
+ case BRUSH_MASK_DRAW:
+ return prop_direction_items;
+
+ case BRUSH_MASK_SMOOTH:
+ return prop_default_items;
+
+ default:
+ return prop_default_items;
+ }
+
+ case SCULPT_TOOL_FLATTEN:
+ return prop_flatten_contrast_items;
+
+ case SCULPT_TOOL_FILL:
+ return prop_fill_deepen_items;
+
+ case SCULPT_TOOL_SCRAPE:
+ return prop_scrape_peaks_items;
+
+ case SCULPT_TOOL_PINCH:
+ return prop_pinch_magnify_items;
+
+ case SCULPT_TOOL_INFLATE:
+ return prop_inflate_deflate_items;
+
+ default:
+ return prop_default_items;
+ }
+
+ case PAINT_MODE_TEXTURE_2D:
+ case PAINT_MODE_TEXTURE_3D:
+ switch (me->imagepaint_tool) {
+ case PAINT_TOOL_SOFTEN:
+ return prop_soften_sharpen_items;
+
+ default:
+ return prop_default_items;
+ }
+
+ default:
+ return prop_default_items;
+ }
+}
+
+static const EnumPropertyItem *rna_Brush_stroke_itemf(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ ePaintMode mode = BKE_paintmode_get_active_from_context(C);
+
+ static const EnumPropertyItem brush_stroke_method_items[] = {
+ {0, "DOTS", 0, "Dots", "Apply paint on each mouse move step"},
+ {BRUSH_SPACE,
+ "SPACE",
+ 0,
+ "Space",
+ "Limit brush application to the distance specified by spacing"},
+ {BRUSH_AIRBRUSH,
+ "AIRBRUSH",
+ 0,
+ "Airbrush",
+ "Keep applying paint effect while holding mouse (spray)"},
+ {BRUSH_LINE, "LINE", 0, "Line", "Drag a line with dabs separated according to spacing"},
+ {BRUSH_CURVE,
+ "CURVE",
+ 0,
+ "Curve",
+ "Define the stroke curve with a bezier curve. Dabs are separated according to spacing"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ switch (mode) {
+ case PAINT_MODE_SCULPT:
+ case PAINT_MODE_TEXTURE_2D:
+ case PAINT_MODE_TEXTURE_3D:
+ return sculpt_stroke_method_items;
+
+ default:
+ return brush_stroke_method_items;
+ }
}
/* Grease Pencil Drawing Brushes Settings */
static char *rna_BrushGpencilSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.gpencil_paint.brush.gpencil_settings");
+ return BLI_strdup("tool_settings.gpencil_paint.brush.gpencil_settings");
}
-static void rna_BrushGpencilSettings_default_eraser_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
+static void rna_BrushGpencilSettings_default_eraser_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *UNUSED(ptr))
{
- ToolSettings *ts = scene->toolsettings;
- Paint *paint = &ts->gp_paint->paint;
- Brush *brush_cur = paint->brush;
+ ToolSettings *ts = scene->toolsettings;
+ Paint *paint = &ts->gp_paint->paint;
+ Brush *brush_cur = paint->brush;
- /* disable default eraser in all brushes */
- for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
- if ((brush != brush_cur) &&
- (brush->ob_mode == OB_MODE_PAINT_GPENCIL) &&
- (brush->gpencil_tool == GPAINT_TOOL_ERASE))
- {
- brush->gpencil_settings->flag &= ~GP_BRUSH_DEFAULT_ERASER;
- }
- }
+ /* disable default eraser in all brushes */
+ for (Brush *brush = bmain->brushes.first; brush; brush = brush->id.next) {
+ if ((brush != brush_cur) && (brush->ob_mode == OB_MODE_PAINT_GPENCIL) &&
+ (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
+ brush->gpencil_settings->flag &= ~GP_BRUSH_DEFAULT_ERASER;
+ }
+ }
}
static void rna_BrushGpencilSettings_use_material_pin_update(bContext *C, PointerRNA *ptr)
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
- Brush *brush = ptr->id.data;
-
- if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
- Material *material = give_current_material(ob, ob->actcol);
- BKE_gpencil_brush_material_set(brush, material);
- }
- else {
- BKE_gpencil_brush_material_set(brush, NULL);
- }
-
- /* number of material users changed */
- WM_event_add_notifier(C, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
-}
-
-static void rna_BrushGpencilSettings_eraser_mode_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
-{
- ToolSettings *ts = scene->toolsettings;
- Paint *paint = &ts->gp_paint->paint;
- Brush *brush = paint->brush;
-
- /* set eraser icon */
- if ((brush) && (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
- switch (brush->gpencil_settings->eraser_mode) {
- case GP_BRUSH_ERASER_SOFT:
- brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_SOFT;
- break;
- case GP_BRUSH_ERASER_HARD:
- brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_HARD;
- break;
- case GP_BRUSH_ERASER_STROKE:
- brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_STROKE;
- break;
- default:
- brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_SOFT;
- break;
- }
- }
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+ Brush *brush = ptr->id.data;
+
+ if (brush->gpencil_settings->flag & GP_BRUSH_MATERIAL_PINNED) {
+ Material *material = give_current_material(ob, ob->actcol);
+ BKE_gpencil_brush_material_set(brush, material);
+ }
+ else {
+ BKE_gpencil_brush_material_set(brush, NULL);
+ }
+
+ /* number of material users changed */
+ WM_event_add_notifier(C, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
+}
+
+static void rna_BrushGpencilSettings_eraser_mode_update(Main *UNUSED(bmain),
+ Scene *scene,
+ PointerRNA *UNUSED(ptr))
+{
+ ToolSettings *ts = scene->toolsettings;
+ Paint *paint = &ts->gp_paint->paint;
+ Brush *brush = paint->brush;
+
+ /* set eraser icon */
+ if ((brush) && (brush->gpencil_tool == GPAINT_TOOL_ERASE)) {
+ switch (brush->gpencil_settings->eraser_mode) {
+ case GP_BRUSH_ERASER_SOFT:
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_SOFT;
+ break;
+ case GP_BRUSH_ERASER_HARD:
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_HARD;
+ break;
+ case GP_BRUSH_ERASER_STROKE:
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_STROKE;
+ break;
+ default:
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_ERASE_SOFT;
+ break;
+ }
+ }
}
static bool rna_BrushGpencilSettings_material_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- Material *ma = (Material *)value.data;
+ Material *ma = (Material *)value.data;
- /* GP materials only */
- return (ma->gp_style != NULL);
+ /* GP materials only */
+ return (ma->gp_style != NULL);
}
#else
static void rna_def_brush_texture_slot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_map_mode_items[] = {
- {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
- {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""},
- {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
- {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
- {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
- {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_tex_paint_map_mode_items[] = {
- {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
- {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
- {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
- {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
- {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_mask_paint_map_mode_items[] = {
- {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
- {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
- {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
- {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
-#define TEXTURE_CAPABILITY(prop_name_, ui_name_) \
- prop = RNA_def_property(srna, #prop_name_, \
- PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
- RNA_def_property_boolean_funcs(prop, "rna_TextureCapabilities_" \
- #prop_name_ "_get", NULL); \
- RNA_def_property_ui_text(prop, ui_name_, NULL)
-
-
- srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
- RNA_def_struct_sdna(srna, "MTex");
- RNA_def_struct_ui_text(srna, "Brush Texture Slot", "Texture slot for textures in a Brush data-block");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_range(prop, 0, M_PI * 2);
- RNA_def_property_ui_text(prop, "Angle", "Brush texture rotation");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_angle_update");
-
- prop = RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
- RNA_def_property_enum_items(prop, prop_map_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
- RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "mask_map_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
- RNA_def_property_enum_items(prop, prop_mask_paint_map_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RAKE);
- RNA_def_property_ui_text(prop, "Rake", "");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "use_random", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RANDOM);
- RNA_def_property_ui_text(prop, "Random", "");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "random_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, 0, M_PI * 2);
- RNA_def_property_ui_text(prop, "Random Angle", "Brush texture random angle");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- TEXTURE_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source");
- TEXTURE_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
- TEXTURE_CAPABILITY(has_texture_angle, "Has Texture Angle Source");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_map_mode_items[] = {
+ {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
+ {MTEX_MAP_MODE_AREA, "AREA_PLANE", 0, "Area Plane", ""},
+ {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
+ {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
+ {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
+ {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_tex_paint_map_mode_items[] = {
+ {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
+ {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
+ {MTEX_MAP_MODE_3D, "3D", 0, "3D", ""},
+ {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
+ {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_mask_paint_map_mode_items[] = {
+ {MTEX_MAP_MODE_VIEW, "VIEW_PLANE", 0, "View Plane", ""},
+ {MTEX_MAP_MODE_TILED, "TILED", 0, "Tiled", ""},
+ {MTEX_MAP_MODE_RANDOM, "RANDOM", 0, "Random", ""},
+ {MTEX_MAP_MODE_STENCIL, "STENCIL", 0, "Stencil", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+# define TEXTURE_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs(prop, "rna_TextureCapabilities_" #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ srna = RNA_def_struct(brna, "BrushTextureSlot", "TextureSlot");
+ RNA_def_struct_sdna(srna, "MTex");
+ RNA_def_struct_ui_text(
+ srna, "Brush Texture Slot", "Texture slot for textures in a Brush data-block");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_range(prop, 0, M_PI * 2);
+ RNA_def_property_ui_text(prop, "Angle", "Brush texture rotation");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_brush_angle_update");
+
+ prop = RNA_def_property(srna, "map_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
+ RNA_def_property_enum_items(prop, prop_map_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "tex_paint_map_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
+ RNA_def_property_enum_items(prop, prop_tex_paint_map_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "mask_map_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brush_map_mode");
+ RNA_def_property_enum_items(prop, prop_mask_paint_map_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "use_rake", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RAKE);
+ RNA_def_property_ui_text(prop, "Rake", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "use_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "brush_angle_mode", MTEX_ANGLE_RANDOM);
+ RNA_def_property_ui_text(prop, "Random", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "random_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0, M_PI * 2);
+ RNA_def_property_ui_text(prop, "Random Angle", "Brush texture random angle");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ TEXTURE_CAPABILITY(has_texture_angle_source, "Has Texture Angle Source");
+ TEXTURE_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
+ TEXTURE_CAPABILITY(has_texture_angle, "Has Texture Angle Source");
}
static void rna_def_sculpt_capabilities(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BrushCapabilitiesSculpt", NULL);
- RNA_def_struct_sdna(srna, "Brush");
- RNA_def_struct_nested(brna, srna, "Brush");
- RNA_def_struct_ui_text(srna, "Sculpt Capabilities",
- "Read-only indications of which brush operations "
- "are supported by the current sculpt tool");
-
-#define SCULPT_TOOL_CAPABILITY(prop_name_, ui_name_) \
- prop = RNA_def_property(srna, #prop_name_, \
- PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
- RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilitiesSculpt_" \
- #prop_name_ "_get", NULL); \
- RNA_def_property_ui_text(prop, ui_name_, NULL)
-
- SCULPT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
- SCULPT_TOOL_CAPABILITY(has_auto_smooth, "Has Auto Smooth");
- SCULPT_TOOL_CAPABILITY(has_topology_rake, "Has Topology Rake");
- SCULPT_TOOL_CAPABILITY(has_height, "Has Height");
- SCULPT_TOOL_CAPABILITY(has_jitter, "Has Jitter");
- SCULPT_TOOL_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor");
- SCULPT_TOOL_CAPABILITY(has_rake_factor, "Has Rake Factor");
- SCULPT_TOOL_CAPABILITY(has_persistence, "Has Persistence");
- SCULPT_TOOL_CAPABILITY(has_pinch_factor, "Has Pinch Factor");
- SCULPT_TOOL_CAPABILITY(has_plane_offset, "Has Plane Offset");
- SCULPT_TOOL_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
- SCULPT_TOOL_CAPABILITY(has_sculpt_plane, "Has Sculpt Plane");
- SCULPT_TOOL_CAPABILITY(has_secondary_color, "Has Secondary Color");
- SCULPT_TOOL_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
- SCULPT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
- SCULPT_TOOL_CAPABILITY(has_strength_pressure, "Has Strength Pressure");
- SCULPT_TOOL_CAPABILITY(has_direction, "Has Direction");
- SCULPT_TOOL_CAPABILITY(has_gravity, "Has Gravity");
-
-#undef SCULPT_CAPABILITY
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BrushCapabilitiesSculpt", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(srna,
+ "Sculpt Capabilities",
+ "Read-only indications of which brush operations "
+ "are supported by the current sculpt tool");
+
+# define SCULPT_TOOL_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs( \
+ prop, "rna_BrushCapabilitiesSculpt_" #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+
+ SCULPT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
+ SCULPT_TOOL_CAPABILITY(has_auto_smooth, "Has Auto Smooth");
+ SCULPT_TOOL_CAPABILITY(has_topology_rake, "Has Topology Rake");
+ SCULPT_TOOL_CAPABILITY(has_height, "Has Height");
+ SCULPT_TOOL_CAPABILITY(has_jitter, "Has Jitter");
+ SCULPT_TOOL_CAPABILITY(has_normal_weight, "Has Crease/Pinch Factor");
+ SCULPT_TOOL_CAPABILITY(has_rake_factor, "Has Rake Factor");
+ SCULPT_TOOL_CAPABILITY(has_persistence, "Has Persistence");
+ SCULPT_TOOL_CAPABILITY(has_pinch_factor, "Has Pinch Factor");
+ SCULPT_TOOL_CAPABILITY(has_plane_offset, "Has Plane Offset");
+ SCULPT_TOOL_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
+ SCULPT_TOOL_CAPABILITY(has_sculpt_plane, "Has Sculpt Plane");
+ SCULPT_TOOL_CAPABILITY(has_secondary_color, "Has Secondary Color");
+ SCULPT_TOOL_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
+ SCULPT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
+ SCULPT_TOOL_CAPABILITY(has_strength_pressure, "Has Strength Pressure");
+ SCULPT_TOOL_CAPABILITY(has_direction, "Has Direction");
+ SCULPT_TOOL_CAPABILITY(has_gravity, "Has Gravity");
+
+# undef SCULPT_CAPABILITY
}
static void rna_def_brush_capabilities(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BrushCapabilities", NULL);
- RNA_def_struct_sdna(srna, "Brush");
- RNA_def_struct_nested(brna, srna, "Brush");
- RNA_def_struct_ui_text(srna, "Brush Capabilities",
- "Read-only indications of supported operations");
+ StructRNA *srna;
+ PropertyRNA *prop;
-#define BRUSH_CAPABILITY(prop_name_, ui_name_) \
- prop = RNA_def_property(srna, #prop_name_, \
- PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
- RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilities_" \
- #prop_name_ "_get", NULL); \
- RNA_def_property_ui_text(prop, ui_name_, NULL)
+ srna = RNA_def_struct(brna, "BrushCapabilities", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(
+ srna, "Brush Capabilities", "Read-only indications of supported operations");
- BRUSH_CAPABILITY(has_overlay, "Has Overlay");
- BRUSH_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
- BRUSH_CAPABILITY(has_spacing, "Has Spacing");
- BRUSH_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
+# define BRUSH_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilities_" #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
+ BRUSH_CAPABILITY(has_overlay, "Has Overlay");
+ BRUSH_CAPABILITY(has_random_texture_angle, "Has Random Texture Angle");
+ BRUSH_CAPABILITY(has_spacing, "Has Spacing");
+ BRUSH_CAPABILITY(has_smooth_stroke, "Has Smooth Stroke");
-#undef BRUSH_CAPABILITY
+# undef BRUSH_CAPABILITY
}
static void rna_def_image_paint_capabilities(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "BrushCapabilitiesImagePaint", NULL);
- RNA_def_struct_sdna(srna, "Brush");
- RNA_def_struct_nested(brna, srna, "Brush");
- RNA_def_struct_ui_text(srna, "Image Paint Capabilities",
- "Read-only indications of supported operations");
+ srna = RNA_def_struct(brna, "BrushCapabilitiesImagePaint", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(
+ srna, "Image Paint Capabilities", "Read-only indications of supported operations");
-#define IMAPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
- prop = RNA_def_property(srna, #prop_name_, \
- PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
- RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilitiesImagePaint_" \
- #prop_name_ "_get", NULL); \
- RNA_def_property_ui_text(prop, ui_name_, NULL)
+# define IMAPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs( \
+ prop, "rna_BrushCapabilitiesImagePaint_" #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
- IMAPAINT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
- IMAPAINT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
- IMAPAINT_TOOL_CAPABILITY(has_radius, "Has Radius");
- IMAPAINT_TOOL_CAPABILITY(has_color, "Has Color");
+ IMAPAINT_TOOL_CAPABILITY(has_accumulate, "Has Accumulate");
+ IMAPAINT_TOOL_CAPABILITY(has_space_attenuation, "Has Space Attenuation");
+ IMAPAINT_TOOL_CAPABILITY(has_radius, "Has Radius");
+ IMAPAINT_TOOL_CAPABILITY(has_color, "Has Color");
-#undef IMAPAINT_TOOL_CAPABILITY
+# undef IMAPAINT_TOOL_CAPABILITY
}
static void rna_def_vertex_paint_capabilities(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "BrushCapabilitiesVertexPaint", NULL);
- RNA_def_struct_sdna(srna, "Brush");
- RNA_def_struct_nested(brna, srna, "Brush");
- RNA_def_struct_ui_text(srna, "Vertex Paint Capabilities",
- "Read-only indications of supported operations");
+ srna = RNA_def_struct(brna, "BrushCapabilitiesVertexPaint", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(
+ srna, "Vertex Paint Capabilities", "Read-only indications of supported operations");
-#define VPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
- prop = RNA_def_property(srna, #prop_name_, \
- PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
- RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilitiesVertexPaint_" \
- #prop_name_ "_get", NULL); \
- RNA_def_property_ui_text(prop, ui_name_, NULL)
+# define VPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs( \
+ prop, "rna_BrushCapabilitiesVertexPaint_" #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
- VPAINT_TOOL_CAPABILITY(has_color, "Has Color");
+ VPAINT_TOOL_CAPABILITY(has_color, "Has Color");
-#undef VPAINT_TOOL_CAPABILITY
+# undef VPAINT_TOOL_CAPABILITY
}
static void rna_def_weight_paint_capabilities(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "BrushCapabilitiesWeightPaint", NULL);
- RNA_def_struct_sdna(srna, "Brush");
- RNA_def_struct_nested(brna, srna, "Brush");
- RNA_def_struct_ui_text(srna, "Weight Paint Capabilities",
- "Read-only indications of supported operations");
+ srna = RNA_def_struct(brna, "BrushCapabilitiesWeightPaint", NULL);
+ RNA_def_struct_sdna(srna, "Brush");
+ RNA_def_struct_nested(brna, srna, "Brush");
+ RNA_def_struct_ui_text(
+ srna, "Weight Paint Capabilities", "Read-only indications of supported operations");
-#define WPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
- prop = RNA_def_property(srna, #prop_name_, \
- PROP_BOOLEAN, PROP_NONE); \
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
- RNA_def_property_boolean_funcs(prop, "rna_BrushCapabilitiesWeightPaint_" \
- #prop_name_ "_get", NULL); \
- RNA_def_property_ui_text(prop, ui_name_, NULL)
+# define WPAINT_TOOL_CAPABILITY(prop_name_, ui_name_) \
+ prop = RNA_def_property(srna, #prop_name_, PROP_BOOLEAN, PROP_NONE); \
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); \
+ RNA_def_property_boolean_funcs( \
+ prop, "rna_BrushCapabilitiesWeightPaint_" #prop_name_ "_get", NULL); \
+ RNA_def_property_ui_text(prop, ui_name_, NULL)
- WPAINT_TOOL_CAPABILITY(has_weight, "Has Weight");
+ WPAINT_TOOL_CAPABILITY(has_weight, "Has Weight");
-#undef WPAINT_TOOL_CAPABILITY
+# undef WPAINT_TOOL_CAPABILITY
}
static void rna_def_gpencil_options(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BrushGpencilSettings", NULL);
- RNA_def_struct_sdna(srna, "BrushGpencilSettings");
- RNA_def_struct_path_func(srna, "rna_BrushGpencilSettings_path");
- RNA_def_struct_ui_text(srna, "Grease Pencil Brush Settings", "Settings for grease pencil brush");
-
- /* Sensitivity factor for new strokes */
- prop = RNA_def_property(srna, "pen_sensitivity_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "draw_sensitivity");
- RNA_def_property_range(prop, 0.1f, 3.0f);
- RNA_def_property_ui_text(prop, "Sensitivity", "Pressure sensitivity factor for new strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Strength factor for new strokes */
- prop = RNA_def_property(srna, "pen_strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "draw_strength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Strength", "Color strength for new strokes (affect alpha factor of color)");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Jitter factor for new strokes */
- prop = RNA_def_property(srna, "pen_jitter", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "draw_jitter");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Jitter", "Jitter factor for new strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Randomnes factor for pressure */
- prop = RNA_def_property(srna, "random_pressure", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "draw_random_press");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Pressure Randomness", "Randomness factor for pressure in new strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Randomnes factor for strength */
- prop = RNA_def_property(srna, "random_strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "draw_random_strength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Strength Randomness", "Randomness factor strength in new strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Randomnes factor for subdivision */
- prop = RNA_def_property(srna, "random_subdiv", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "draw_random_sub");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Subdivision", "Randomness factor for new strokes after subdivision");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Angle when brush is full size */
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "draw_angle");
- RNA_def_property_range(prop, -M_PI_2, M_PI_2);
- RNA_def_property_ui_text(
- prop, "Angle",
- "Direction of the stroke at which brush gives maximal thickness "
- "(0° for horizontal)");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Factor to change brush size depending of angle */
- prop = RNA_def_property(srna, "angle_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "draw_angle_factor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(
- prop, "Angle Factor",
- "Reduce brush thickness by this factor when stroke is perpendicular to 'Angle' direction");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Smoothing factor for new strokes */
- prop = RNA_def_property(srna, "pen_smooth_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "draw_smoothfac");
- RNA_def_property_range(prop, 0.0, 2.0f);
- RNA_def_property_ui_text(
- prop, "Smooth",
- "Amount of smoothing to apply after finish newly created strokes, to reduce jitter/noise");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Iterations of the Smoothing factor */
- prop = RNA_def_property(srna, "pen_smooth_steps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "draw_smoothlvl");
- RNA_def_property_range(prop, 1, 3);
- RNA_def_property_ui_text(
- prop, "Iterations",
- "Number of times to smooth newly created strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Thickness smoothing factor for new strokes */
- prop = RNA_def_property(srna, "pen_thick_smooth_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "thick_smoothfac");
- RNA_def_property_range(prop, 0.0, 2.0f);
- RNA_def_property_ui_text(
- prop, "Smooth Thickness",
- "Amount of thickness smoothing to apply after finish newly created strokes, to reduce jitter/noise");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Thickness iterations of the Smoothing factor */
- prop = RNA_def_property(srna, "pen_thick_smooth_steps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "thick_smoothlvl");
- RNA_def_property_range(prop, 1, 3);
- RNA_def_property_ui_text(
- prop, "Iterations Thickness",
- "Number of times to smooth thickness for newly created strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Subdivision level for new strokes */
- prop = RNA_def_property(srna, "pen_subdivision_steps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "draw_subdivide");
- RNA_def_property_range(prop, 0, 3);
- RNA_def_property_ui_text(
- prop, "Subdivision Steps",
- "Number of times to subdivide newly created strokes, for less jagged strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Curves for pressure */
- prop = RNA_def_property(srna, "curve_sensitivity", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_sensitivity");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve Sensitivity", "Curve used for the sensitivity");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "curve_strength", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_strength");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve Strength", "Curve used for the strength");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "curve_jitter", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_jitter");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve Jitter", "Curve used for the jitter effect");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* fill threshold for transparence */
- prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "fill_threshold");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(
- prop, "Threshold",
- "Threshold to consider color transparent for filling");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* fill leak size */
- prop = RNA_def_property(srna, "fill_leak", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "fill_leak");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(
- prop, "Leak Size",
- "Size in pixels to consider the leak closed");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* fill factor size */
- prop = RNA_def_property(srna, "fill_factor", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "fill_factor");
- RNA_def_property_range(prop, 1, 8);
- RNA_def_property_ui_text(prop, "Resolution",
- "Multiplier for fill resolution, higher resolution is more accurate but slower");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* fill simplify steps */
- prop = RNA_def_property(srna, "fill_simplify_level", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "fill_simplylvl");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(
- prop, "Simplify",
- "Number of simplify steps (large values reduce fill accuracy)");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "uv_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_random");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "UV Random", "Random factor for autogenerated UV rotation");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* gradient control */
- prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gradient_f");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(
- prop, "Border Opacity Factor",
- "Amount of gradient for Dot strokes (set to 1 for full solid)");
- RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
-
- /* gradient shape ratio */
- prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "gradient_s");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, 0.01f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Aspect Ratio", "");
- RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
-
- prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "input_samples");
- RNA_def_property_range(prop, 0, GP_MAX_INPUT_SAMPLES);
- RNA_def_property_ui_text(prop, "Input Samples", "Generate intermediate points for very fast mouse movements. Set to 0 to disable");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* active smooth factor while drawing */
- prop = RNA_def_property(srna, "active_smooth_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "active_smooth");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(
- prop, "Active Smooth",
- "Amount of smoothing while drawing ");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "eraser_strength_factor", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "era_strength_f");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
- RNA_def_property_ui_text(
- prop, "Affect Stroke Strength",
- "Amount of erasing for strength ");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "eraser_thickness_factor", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "era_thickness_f");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
- RNA_def_property_ui_text(
- prop, "Affect Stroke Thickness",
- "Amount of erasing for thickness ");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* brush standard icon */
- prop = RNA_def_property(srna, "gp_icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "icon_id");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_icons_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
-
- /* Flags */
- prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Use Pressure", "Use tablet pressure");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "use_strength_pressure", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_STENGTH_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Use Pressure Strength", "Use tablet pressure for color strength");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "use_jitter_pressure", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_JITTER_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Use Pressure Jitter", "Use tablet pressure for jitter");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "use_settings_stabilizer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_STABILIZE_MOUSE);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(
- prop, "Use Stabilizer",
- "Draw lines with a delay to allow smooth strokes. Press Shift key to override while drawing");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_ENABLE_CURSOR);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "eraser_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "eraser_mode");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_eraser_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Eraser Mode");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_BrushGpencilSettings_eraser_mode_update");
-
- prop = RNA_def_property(srna, "fill_draw_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "fill_draw_mode");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_fill_draw_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Mode to draw boundary limits");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "trim", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_TRIM_STROKE);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Trim Stroke Ends", "Trim intersecting stroke ends");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- /* Material */
- prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_BrushGpencilSettings_material_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Material", "Material used for strokes drawn using this brush");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_Brush_material_update");
-
- prop = RNA_def_property(srna, "show_fill_boundary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_SHOW_HELPLINES);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Show Lines", "Show help lines for filling to see boundaries");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Show Fill", "Show transparent lines to use as boundary for filling");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_default_eraser", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_DEFAULT_ERASER);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
- RNA_def_property_ui_text(prop, "Default Eraser", "Use this brush when enable eraser with fast switch key");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_BrushGpencilSettings_default_eraser_update");
-
- prop = RNA_def_property(srna, "use_settings_postprocess", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_GROUP_SETTINGS);
- RNA_def_property_ui_text(prop, "Use Post-Process Settings", "Additional post processing options for new strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_settings_random", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_GROUP_RANDOM);
- RNA_def_property_ui_text(prop, "Random Settings", "Random brush settings");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_material_pin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_MATERIAL_PINNED);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
- RNA_def_property_ui_text(prop, "Pin Material", "Keep material assigned to brush");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_BrushGpencilSettings_use_material_pin_update");
-
- prop = RNA_def_property(srna, "show_lasso", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_DISSABLE_LASSO);
- RNA_def_property_ui_text(prop, "Show Lasso", "Do not draw fill color while drawing the stroke");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_occlude_eraser", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_OCCLUDE_ERASER);
- RNA_def_property_ui_text(
- prop, "Occlude Eraser",
- "Erase only strokes visible and not occluded");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BrushGpencilSettings", NULL);
+ RNA_def_struct_sdna(srna, "BrushGpencilSettings");
+ RNA_def_struct_path_func(srna, "rna_BrushGpencilSettings_path");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Brush Settings", "Settings for grease pencil brush");
+
+ /* Sensitivity factor for new strokes */
+ prop = RNA_def_property(srna, "pen_sensitivity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "draw_sensitivity");
+ RNA_def_property_range(prop, 0.1f, 3.0f);
+ RNA_def_property_ui_text(prop, "Sensitivity", "Pressure sensitivity factor for new strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Strength factor for new strokes */
+ prop = RNA_def_property(srna, "pen_strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "draw_strength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(
+ prop, "Strength", "Color strength for new strokes (affect alpha factor of color)");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Jitter factor for new strokes */
+ prop = RNA_def_property(srna, "pen_jitter", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "draw_jitter");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Jitter", "Jitter factor for new strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Randomnes factor for pressure */
+ prop = RNA_def_property(srna, "random_pressure", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "draw_random_press");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Pressure Randomness", "Randomness factor for pressure in new strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Randomnes factor for strength */
+ prop = RNA_def_property(srna, "random_strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "draw_random_strength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Strength Randomness", "Randomness factor strength in new strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Randomnes factor for subdivision */
+ prop = RNA_def_property(srna, "random_subdiv", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "draw_random_sub");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Random Subdivision", "Randomness factor for new strokes after subdivision");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Angle when brush is full size */
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "draw_angle");
+ RNA_def_property_range(prop, -M_PI_2, M_PI_2);
+ RNA_def_property_ui_text(prop,
+ "Angle",
+ "Direction of the stroke at which brush gives maximal thickness "
+ "(0° for horizontal)");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Factor to change brush size depending of angle */
+ prop = RNA_def_property(srna, "angle_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "draw_angle_factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Angle Factor",
+ "Reduce brush thickness by this factor when stroke is perpendicular to 'Angle' direction");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Smoothing factor for new strokes */
+ prop = RNA_def_property(srna, "pen_smooth_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "draw_smoothfac");
+ RNA_def_property_range(prop, 0.0, 2.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Smooth",
+ "Amount of smoothing to apply after finish newly created strokes, to reduce jitter/noise");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Iterations of the Smoothing factor */
+ prop = RNA_def_property(srna, "pen_smooth_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "draw_smoothlvl");
+ RNA_def_property_range(prop, 1, 3);
+ RNA_def_property_ui_text(prop, "Iterations", "Number of times to smooth newly created strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Thickness smoothing factor for new strokes */
+ prop = RNA_def_property(srna, "pen_thick_smooth_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "thick_smoothfac");
+ RNA_def_property_range(prop, 0.0, 2.0f);
+ RNA_def_property_ui_text(prop,
+ "Smooth Thickness",
+ "Amount of thickness smoothing to apply after finish newly created "
+ "strokes, to reduce jitter/noise");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Thickness iterations of the Smoothing factor */
+ prop = RNA_def_property(srna, "pen_thick_smooth_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "thick_smoothlvl");
+ RNA_def_property_range(prop, 1, 3);
+ RNA_def_property_ui_text(prop,
+ "Iterations Thickness",
+ "Number of times to smooth thickness for newly created strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Subdivision level for new strokes */
+ prop = RNA_def_property(srna, "pen_subdivision_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "draw_subdivide");
+ RNA_def_property_range(prop, 0, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Subdivision Steps",
+ "Number of times to subdivide newly created strokes, for less jagged strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Curves for pressure */
+ prop = RNA_def_property(srna, "curve_sensitivity", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_sensitivity");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Sensitivity", "Curve used for the sensitivity");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "curve_strength", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_strength");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Strength", "Curve used for the strength");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "curve_jitter", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_jitter");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Jitter", "Curve used for the jitter effect");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* fill threshold for transparence */
+ prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fill_threshold");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Threshold", "Threshold to consider color transparent for filling");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* fill leak size */
+ prop = RNA_def_property(srna, "fill_leak", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "fill_leak");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Leak Size", "Size in pixels to consider the leak closed");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* fill factor size */
+ prop = RNA_def_property(srna, "fill_factor", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "fill_factor");
+ RNA_def_property_range(prop, 1, 8);
+ RNA_def_property_ui_text(
+ prop,
+ "Resolution",
+ "Multiplier for fill resolution, higher resolution is more accurate but slower");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* fill simplify steps */
+ prop = RNA_def_property(srna, "fill_simplify_level", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "fill_simplylvl");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(
+ prop, "Simplify", "Number of simplify steps (large values reduce fill accuracy)");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "uv_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_random");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "UV Random", "Random factor for autogenerated UV rotation");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* gradient control */
+ prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_f");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Border Opacity Factor",
+ "Amount of gradient for Dot strokes (set to 1 for full solid)");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+
+ /* gradient shape ratio */
+ prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_s");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.01f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Aspect Ratio", "");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+
+ prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "input_samples");
+ RNA_def_property_range(prop, 0, GP_MAX_INPUT_SAMPLES);
+ RNA_def_property_ui_text(
+ prop,
+ "Input Samples",
+ "Generate intermediate points for very fast mouse movements. Set to 0 to disable");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* active smooth factor while drawing */
+ prop = RNA_def_property(srna, "active_smooth_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "active_smooth");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Active Smooth", "Amount of smoothing while drawing ");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "eraser_strength_factor", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "era_strength_f");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
+ RNA_def_property_ui_text(prop, "Affect Stroke Strength", "Amount of erasing for strength ");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "eraser_thickness_factor", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "era_thickness_f");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
+ RNA_def_property_ui_text(prop, "Affect Stroke Thickness", "Amount of erasing for thickness ");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* brush standard icon */
+ prop = RNA_def_property(srna, "gp_icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "icon_id");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_icons_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Grease Pencil Icon", "");
+
+ /* Flags */
+ prop = RNA_def_property(srna, "use_pressure", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(prop, "Use Pressure", "Use tablet pressure");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "use_strength_pressure", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_STENGTH_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Use Pressure Strength", "Use tablet pressure for color strength");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "use_jitter_pressure", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_USE_JITTER_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(prop, "Use Pressure Jitter", "Use tablet pressure for jitter");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "use_settings_stabilizer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_STABILIZE_MOUSE);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop,
+ "Use Stabilizer",
+ "Draw lines with a delay to allow smooth strokes. Press Shift key to "
+ "override while drawing");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_ENABLE_CURSOR);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "eraser_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "eraser_mode");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_brush_eraser_modes_items);
+ RNA_def_property_ui_text(prop, "Mode", "Eraser Mode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA, "rna_BrushGpencilSettings_eraser_mode_update");
+
+ prop = RNA_def_property(srna, "fill_draw_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "fill_draw_mode");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_fill_draw_modes_items);
+ RNA_def_property_ui_text(prop, "Mode", "Mode to draw boundary limits");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "trim", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_TRIM_STROKE);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Trim Stroke Ends", "Trim intersecting stroke ends");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ /* Material */
+ prop = RNA_def_property(srna, "material", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_BrushGpencilSettings_material_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Material", "Material used for strokes drawn using this brush");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_Brush_material_update");
+
+ prop = RNA_def_property(srna, "show_fill_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_FILL_SHOW_HELPLINES);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Show Lines", "Show help lines for filling to see boundaries");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_FILL_HIDE);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(
+ prop, "Show Fill", "Show transparent lines to use as boundary for filling");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_default_eraser", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_DEFAULT_ERASER);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_ui_text(
+ prop, "Default Eraser", "Use this brush when enable eraser with fast switch key");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA, "rna_BrushGpencilSettings_default_eraser_update");
+
+ prop = RNA_def_property(srna, "use_settings_postprocess", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_GROUP_SETTINGS);
+ RNA_def_property_ui_text(
+ prop, "Use Post-Process Settings", "Additional post processing options for new strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_settings_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_GROUP_RANDOM);
+ RNA_def_property_ui_text(prop, "Random Settings", "Random brush settings");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_material_pin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BRUSH_MATERIAL_PINNED);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_ui_text(prop, "Pin Material", "Keep material assigned to brush");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA, "rna_BrushGpencilSettings_use_material_pin_update");
+
+ prop = RNA_def_property(srna, "show_lasso", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_DISSABLE_LASSO);
+ RNA_def_property_ui_text(prop, "Show Lasso", "Do not draw fill color while drawing the stroke");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_occlude_eraser", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_BRUSH_OCCLUDE_ERASER);
+ RNA_def_property_ui_text(prop, "Occlude Eraser", "Erase only strokes visible and not occluded");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
}
static void rna_def_brush(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_blend_items[] = {
- {IMB_BLEND_MIX, "MIX", 0, "Mix", "Use mix blending mode while painting"},
- {0, "", ICON_NONE, NULL, NULL},
- {IMB_BLEND_DARKEN, "DARKEN", 0, "Darken", "Use darken blending mode while painting"},
- {IMB_BLEND_MUL, "MUL", 0, "Multiply", "Use multiply blending mode while painting"},
- {IMB_BLEND_COLORBURN, "COLORBURN", 0, "Color burn", "Use color burn blending mode while painting"},
- {IMB_BLEND_LINEARBURN, "LINEARBURN", 0, "Linear burn", "Use linear burn blending mode while painting"},
- {0, "", ICON_NONE, NULL, NULL},
- {IMB_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting"},
- {IMB_BLEND_SCREEN, "SCREEN", 0, "Screen", "Use screen blending mode while painting"},
- {IMB_BLEND_COLORDODGE, "COLORDODGE", 0, "Color dodge", "Use color dodge blending mode while painting"},
- {IMB_BLEND_ADD, "ADD", 0, "Add", "Use add blending mode while painting"},
- {0, "", ICON_NONE, NULL, NULL},
- {IMB_BLEND_OVERLAY, "OVERLAY", 0, "Overlay", "Use overlay blending mode while painting"},
- {IMB_BLEND_SOFTLIGHT, "SOFTLIGHT", 0, "Soft light", "Use softlight blending mode while painting"},
- {IMB_BLEND_HARDLIGHT, "HARDLIGHT", 0, "Hard light", "Use hard light blending mode while painting"},
- {IMB_BLEND_VIVIDLIGHT, "VIVIDLIGHT", 0, "Vivid light", "Use vividlight blending mode while painting"},
- {IMB_BLEND_LINEARLIGHT, "LINEARLIGHT", 0, "Linear light", "Use linearlight blending mode while painting"},
- {IMB_BLEND_PINLIGHT, "PINLIGHT", 0, "Pin light", "Use pinlight blending mode while painting"},
- {0, "", ICON_NONE, NULL, NULL},
- {IMB_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", "Use difference blending mode while painting"},
- {IMB_BLEND_EXCLUSION, "EXCLUSION", 0, "Exclusion", "Use exclusion blending mode while painting"},
- {IMB_BLEND_SUB, "SUB", 0, "Subtract", "Use subtract blending mode while painting"},
- {0, "", ICON_NONE, NULL, NULL},
- {IMB_BLEND_HUE, "HUE", 0, "Hue", "Use hue blending mode while painting"},
- {IMB_BLEND_SATURATION, "SATURATION", 0, "Saturation", "Use saturation blending mode while painting"},
- {IMB_BLEND_COLOR, "COLOR", 0, "Color", "Use color blending mode while painting"},
- {IMB_BLEND_LUMINOSITY, "LUMINOSITY", 0, "Luminosity", "Use luminosity blending mode while painting"},
- {0, "", ICON_NONE, NULL, NULL},
- {IMB_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Erase alpha while painting"},
- {IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_sculpt_plane_items[] = {
- {SCULPT_DISP_DIR_AREA, "AREA", 0, "Area Plane", ""},
- {SCULPT_DISP_DIR_VIEW, "VIEW", 0, "View Plane", ""},
- {SCULPT_DISP_DIR_X, "X", 0, "X Plane", ""},
- {SCULPT_DISP_DIR_Y, "Y", 0, "Y Plane", ""},
- {SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_mask_tool_items[] = {
- {BRUSH_MASK_DRAW, "DRAW", 0, "Draw", ""},
- {BRUSH_MASK_SMOOTH, "SMOOTH", 0, "Smooth", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_blur_mode_items[] = {
- {KERNEL_BOX, "BOX", 0, "Box", ""},
- {KERNEL_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_gradient_items[] = {
- {BRUSH_GRADIENT_PRESSURE, "PRESSURE", 0, "Pressure", ""},
- {BRUSH_GRADIENT_SPACING_REPEAT, "SPACING_REPEAT", 0, "Repeat", ""},
- {BRUSH_GRADIENT_SPACING_CLAMP, "SPACING_CLAMP", 0, "Clamp", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_gradient_fill_items[] = {
- {BRUSH_GRADIENT_LINEAR, "LINEAR", 0, "Linear", ""},
- {BRUSH_GRADIENT_RADIAL, "RADIAL", 0, "Radial", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_mask_pressure_items[] = {
- {0, "NONE", 0, "Off", ""},
- {BRUSH_MASK_PRESSURE_RAMP, "RAMP", ICON_STYLUS_PRESSURE, "Ramp", ""},
- {BRUSH_MASK_PRESSURE_CUTOFF, "CUTOFF", ICON_STYLUS_PRESSURE, "Cutoff", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem brush_size_unit_items[] = {
- {0, "VIEW", 0, "View", "Measure brush size relateve to the view"},
- {BRUSH_LOCK_SIZE, "SCENE", 0, "Scene", "Measure brush size relateve to the scene"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Brush", "ID");
- RNA_def_struct_ui_text(srna, "Brush", "Brush data-block for storing brush settings for painting and sculpting");
- RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
-
- /* enums */
- prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_blend_items);
- RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
-
- /**
- * Begin per-mode tool properties.
- *
- * keep in sync with #BKE_paint_get_tool_prop_id_from_paintmode
- */
- prop = RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_brush_sculpt_tool_items);
- RNA_def_property_ui_text(prop, "Sculpt Tool", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
-
- prop = RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool");
- RNA_def_property_enum_items(prop, rna_enum_brush_vertex_tool_items);
- RNA_def_property_ui_text(prop, "Vertex Paint Tool", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
-
- prop = RNA_def_property(srna, "weight_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "weightpaint_tool");
- RNA_def_property_enum_items(prop, rna_enum_brush_weight_tool_items);
- RNA_def_property_ui_text(prop, "Weight Paint Tool", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
-
- prop = RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "imagepaint_tool");
- RNA_def_property_enum_items(prop, rna_enum_brush_image_tool_items);
- RNA_def_property_ui_text(prop, "Image Paint Tool", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update_and_reset_icon");
-
- prop = RNA_def_property(srna, "gpencil_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gpencil_tool");
- RNA_def_property_enum_items(prop, rna_enum_brush_gpencil_types_items);
- RNA_def_property_ui_text(prop, "Type", "Category of the brush");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- /** End per mode tool properties. */
-
-
- prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_direction_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_direction_itemf");
- RNA_def_property_ui_text(prop, "Direction", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, sculpt_stroke_method_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_stroke_itemf");
- RNA_def_property_ui_text(prop, "Stroke Method", "");
- RNA_def_property_update(prop, 0, "rna_Brush_stroke_update");
-
- prop = RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, brush_sculpt_plane_items);
- RNA_def_property_ui_text(prop, "Sculpt Plane", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "mask_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, brush_mask_tool_items);
- RNA_def_property_ui_text(prop, "Mask Tool", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* number values */
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_funcs(prop, NULL, "rna_Brush_set_size", NULL);
- RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
- RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
- RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
- RNA_def_property_update(prop, 0, "rna_Brush_size_update");
-
- prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_funcs(prop, NULL, "rna_Brush_set_unprojected_radius", NULL);
- RNA_def_property_range(prop, 0.001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001, 1, 0, -1);
- RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
- RNA_def_property_update(prop, 0, "rna_Brush_size_update");
-
- prop = RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "jitter");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 4);
- RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "jitter_absolute", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "jitter_absolute");
- RNA_def_property_range(prop, 0, 1000000);
- RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush in pixels while painting");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "spacing");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_range(prop, 1, 500, 5, -1);
- RNA_def_property_ui_text(prop, "Spacing", "Spacing between brush daubs as a percentage of brush diameter");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "grad_spacing", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "gradient_spacing");
- RNA_def_property_range(prop, 1, 10000);
- RNA_def_property_ui_range(prop, 1, 10000, 5, -1);
- RNA_def_property_ui_text(prop, "Gradient Spacing", "Spacing before brush gradient goes full circle");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 10, 200);
- RNA_def_property_ui_text(prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "smooth_stroke_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.5, 0.99);
- RNA_def_property_ui_text(prop, "Smooth Stroke Factor", "Higher values give a smoother stroke");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rate");
- RNA_def_property_range(prop, 0.0001f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Rate", "Interval between paints for Airbrush");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "rgb");
- RNA_def_property_ui_text(prop, "Color", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
- RNA_def_property_ui_text(prop, "Secondary Color", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Weight", "Vertex weight when brush is applied");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "plane_offset", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "plane_offset");
- RNA_def_property_float_default(prop, 0);
- RNA_def_property_range(prop, -2.0f, 2.0f);
- RNA_def_property_ui_range(prop, -0.5f, 0.5f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Plane Offset",
- "Adjust plane on which the brush acts towards or away from the object surface");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "plane_trim", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "plane_trim");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0, 1.0f);
- RNA_def_property_ui_text(prop, "Plane Trim",
- "If a vertex is further away from offset plane than this, then it is not affected");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "height");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0, 1.0f);
- RNA_def_property_ui_text(prop, "Brush Height", "Affectable height of brush (layer height for layer tool, i.e.)");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "texture_sample_bias", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "texture_sample_bias");
- RNA_def_property_float_default(prop, 0);
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_text(prop, "Texture Sample Bias", "Value added to texture samples");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "normal_weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "normal_weight");
- RNA_def_property_float_default(prop, 0);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Normal Weight", "How much grab will pull vertexes out of surface during a grab");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "rake_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "rake_factor");
- RNA_def_property_float_default(prop, 0);
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Rake", "How much grab will follow cursor rotation");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "crease_pinch_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "crease_pinch_factor");
- RNA_def_property_float_default(prop, 2.0f / 3.0f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Crease Brush Pinch Factor", "How much the crease brush pinches");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "autosmooth_factor");
- RNA_def_property_float_default(prop, 0);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Autosmooth", "Amount of smoothing to automatically apply to each stroke");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "topology_rake_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "topology_rake_factor");
- RNA_def_property_float_default(prop, 0);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Topology Rake", "Automatically align edges to the brush direction to "
- "to generate cleaner topology and define sharp features "
- "dynamic topology. Best used on low-poly meshes as it has "
- "a performance impact");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "stencil_pos", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "stencil_pos");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Stencil Position", "Position of stencil in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "stencil_dimension", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "stencil_dimension");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Stencil Dimensions", "Dimensions of stencil in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "mask_stencil_pos", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "mask_stencil_pos");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Mask Stencil Position", "Position of mask stencil in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "mask_stencil_dimension", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "mask_stencil_dimension");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Mask Stencil Dimensions", "Dimensions of mask stencil in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "sharp_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
- RNA_def_property_float_sdna(prop, NULL, "sharp_threshold");
- RNA_def_property_ui_text(prop, "Sharp Threshold", "Threshold below which, no sharpening is done");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
- RNA_def_property_float_sdna(prop, NULL, "fill_threshold");
- RNA_def_property_ui_text(prop, "Fill Threshold", "Threshold above which filling is not propagated");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "blur_kernel_radius", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "blur_kernel_radius");
- RNA_def_property_range(prop, 1, 10000);
- RNA_def_property_ui_range(prop, 1, 50, 1, -1);
- RNA_def_property_ui_text(prop, "Kernel Radius", "Radius of kernel used for soften and sharpen in pixels");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "blur_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, brush_blur_mode_items);
- RNA_def_property_ui_text(prop, "Blur Mode", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "falloff_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "falloff_angle");
- RNA_def_property_range(prop, 0, M_PI / 2);
- RNA_def_property_ui_text(prop, "Falloff Angle",
- "Paint most on faces pointing towards the view according to this angle");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* flag */
- /* This is an enum but its unlikely we add other shapes, so expose as a boolean. */
- prop = RNA_def_property(srna, "use_projected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "falloff_shape", BRUSH_AIRBRUSH);
- RNA_def_property_ui_text(prop, "2D Falloff", "Apply brush influence in 2D circle instead of a sphere");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
- RNA_def_property_ui_text(prop, "Airbrush", "Keep applying paint effect while holding mouse (spray)");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_NORMAL);
- RNA_def_property_ui_text(prop, "Original Normal",
- "When locked keep using normal of surface where stroke was initiated");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_offset_pressure", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_OFFSET_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_gradient", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_USE_GRADIENT);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Brush_use_gradient_set");
- RNA_def_property_ui_text(prop, "Use Gradient", "Use Gradient by utilizing a sampling method");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Jitter Pressure", "Enable tablet pressure sensitivity for jitter");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_pressure_spacing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_pressure_masking", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mask_pressure");
- RNA_def_property_enum_items(prop, brush_mask_pressure_items);
- RNA_def_property_ui_text(prop, "Mask Pressure Mode", "Pen pressure makes texture influence smaller");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_inverse_smooth_pressure", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERSE_SMOOTH_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Inverse Smooth Pressure", "Lighter pressure causes more smoothing to be applied");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_relative_jitter", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_ABSOLUTE_JITTER);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
- RNA_def_property_ui_text(prop, "Absolute Jitter", "Jittering happens in screen space, not relative to brush size");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_plane_trim", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PLANE_TRIM);
- RNA_def_property_ui_text(prop, "Use Plane Trim", "Enable Plane Trim");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_frontface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FRONTFACE);
- RNA_def_property_ui_text(prop, "Use Front-Face", "Brush only affects vertexes that face the viewer");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_frontface_falloff", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FRONTFACE_FALLOFF);
- RNA_def_property_ui_text(prop, "Use Front-Face Falloff", "Blend brush influence by how much they face the front");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ANCHORED);
- RNA_def_property_ui_text(prop, "Anchored", "Keep the brush anchored to the initial location");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_space", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE);
- RNA_def_property_ui_text(prop, "Space", "Limit brush application to the distance specified by spacing");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LINE);
- RNA_def_property_ui_text(prop, "Line", "Draw a line with dabs separated according to spacing");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CURVE);
- RNA_def_property_ui_text(prop, "Curve", "Define the stroke curve with a bezier curve. Dabs are separated according to spacing");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SMOOTH_STROKE);
- RNA_def_property_ui_text(prop, "Smooth Stroke", "Brush lags behind mouse and follows a smoother path");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PERSISTENT);
- RNA_def_property_ui_text(prop, "Persistent", "Sculpt on a persistent layer of the mesh");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_accumulate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ACCUMULATE);
- RNA_def_property_ui_text(prop, "Accumulate", "Accumulate stroke daubs on top of each other");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_space_attenuation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);
- RNA_def_property_ui_text(prop, "Adjust Strength for Spacing",
- "Automatically adjust strength to give consistent results for different spacings");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* adaptive space is not implemented yet */
- prop = RNA_def_property(srna, "use_adaptive_space", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ADAPTIVE_SPACE);
- RNA_def_property_ui_text(prop, "Adaptive Spacing",
- "Space daubs according to surface orientation instead of screen space");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_locked_size", PROP_ENUM, PROP_NONE); /* as an enum */
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, brush_size_unit_items);
- RNA_def_property_ui_text(prop, "Radius Unit", "Measure brush size relative to the view or the scene");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
- RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_DRAG_DOT);
- RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* only for projection paint & vertex paint, TODO, other paint modes */
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_LOCK_ALPHA);
- RNA_def_property_ui_text(prop, "Affect Alpha", "When this is disabled, lock alpha while painting");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "paint_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Paint Curve", "Active Paint Curve");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "gradient", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "gradient");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Gradient", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* gradient source */
- prop = RNA_def_property(srna, "gradient_stroke_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, brush_gradient_items);
- RNA_def_property_ui_text(prop, "Gradient Stroke Mode", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "gradient_fill_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, brush_gradient_fill_items);
- RNA_def_property_ui_text(prop, "Gradient Fill Mode", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* overlay flags */
- prop = RNA_def_property(srna, "use_primary_overlay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_PRIMARY);
- RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_secondary_overlay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_SECONDARY);
- RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_cursor_overlay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_CURSOR);
- RNA_def_property_ui_text(prop, "Use Cursor Overlay", "Show cursor in viewport");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_cursor_overlay_override", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE);
- RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_primary_overlay_override", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE);
- RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_secondary_overlay_override", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE);
- RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- /* paint mode flags */
- prop = RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
- RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
-
- prop = RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
- RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
-
- prop = RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
- RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");
-
- prop = RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
- RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");
-
- prop = RNA_def_property(srna, "use_paint_grease_pencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_PAINT_GPENCIL);
- RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in grease pencil drawing mode");
-
- /* texture */
- prop = RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BrushTextureSlot");
- RNA_def_property_pointer_sdna(prop, NULL, "mtex");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Texture Slot", "");
-
- prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mtex.tex");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Texture", "");
- RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_main_tex_update");
-
- prop = RNA_def_property(srna, "mask_texture_slot", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BrushTextureSlot");
- RNA_def_property_pointer_sdna(prop, NULL, "mask_mtex");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask Texture Slot", "");
-
- prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mask_mtex.tex");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Mask Texture", "");
- RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_secondary_tex_update");
-
- prop = RNA_def_property(srna, "texture_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "texture_overlay_alpha");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Texture Overlay Alpha", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "mask_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "mask_overlay_alpha");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Mask Texture Overlay Alpha", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "cursor_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "cursor_overlay_alpha");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Mask Texture Overlay Alpha", "");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "add_col");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Add Color", "Color of cursor when adding");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "sub_col");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Subtract Color", "Color of cursor when subtracting");
- RNA_def_property_update(prop, 0, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CUSTOM_ICON);
- RNA_def_property_ui_text(prop, "Custom Icon", "Set the brush icon from an image file");
- RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
-
- prop = RNA_def_property(srna, "icon_filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "icon_filepath");
- RNA_def_property_ui_text(prop, "Brush Icon Filepath", "File path to brush icon");
- RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
-
- /* clone tool */
- prop = RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clone.image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "clone.alpha");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Clone Alpha", "Opacity of clone image display");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "clone.offset");
- RNA_def_property_ui_text(prop, "Clone Offset", "");
- RNA_def_property_ui_range(prop, -1.0f, 1.0f, 10.0f, 3);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
-
- prop = RNA_def_property(srna, "brush_capabilities", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "BrushCapabilities");
- RNA_def_property_pointer_funcs(prop, "rna_Brush_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Brush Capabilities", "Brush's capabilities");
-
- /* brush capabilities (mode-dependent) */
- prop = RNA_def_property(srna, "sculpt_capabilities", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "BrushCapabilitiesSculpt");
- RNA_def_property_pointer_funcs(prop, "rna_Sculpt_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Sculpt Capabilities", "");
-
- prop = RNA_def_property(srna, "image_paint_capabilities", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "BrushCapabilitiesImagePaint");
- RNA_def_property_pointer_funcs(prop, "rna_Imapaint_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Image Paint Capabilities", "");
-
- prop = RNA_def_property(srna, "vertex_paint_capabilities", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "BrushCapabilitiesVertexPaint");
- RNA_def_property_pointer_funcs(prop, "rna_Vertexpaint_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Vertex Paint Capabilities", "");
-
- prop = RNA_def_property(srna, "weight_paint_capabilities", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "BrushCapabilitiesWeightPaint");
- RNA_def_property_pointer_funcs(prop, "rna_Weightpaint_tool_capabilities_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Weight Paint Capabilities", "");
-
- prop = RNA_def_property(srna, "gpencil_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BrushGpencilSettings");
- RNA_def_property_pointer_sdna(prop, NULL, "gpencil_settings");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Gpencil Settings", "");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_blend_items[] = {
+ {IMB_BLEND_MIX, "MIX", 0, "Mix", "Use mix blending mode while painting"},
+ {0, "", ICON_NONE, NULL, NULL},
+ {IMB_BLEND_DARKEN, "DARKEN", 0, "Darken", "Use darken blending mode while painting"},
+ {IMB_BLEND_MUL, "MUL", 0, "Multiply", "Use multiply blending mode while painting"},
+ {IMB_BLEND_COLORBURN,
+ "COLORBURN",
+ 0,
+ "Color burn",
+ "Use color burn blending mode while painting"},
+ {IMB_BLEND_LINEARBURN,
+ "LINEARBURN",
+ 0,
+ "Linear burn",
+ "Use linear burn blending mode while painting"},
+ {0, "", ICON_NONE, NULL, NULL},
+ {IMB_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", "Use lighten blending mode while painting"},
+ {IMB_BLEND_SCREEN, "SCREEN", 0, "Screen", "Use screen blending mode while painting"},
+ {IMB_BLEND_COLORDODGE,
+ "COLORDODGE",
+ 0,
+ "Color dodge",
+ "Use color dodge blending mode while painting"},
+ {IMB_BLEND_ADD, "ADD", 0, "Add", "Use add blending mode while painting"},
+ {0, "", ICON_NONE, NULL, NULL},
+ {IMB_BLEND_OVERLAY, "OVERLAY", 0, "Overlay", "Use overlay blending mode while painting"},
+ {IMB_BLEND_SOFTLIGHT,
+ "SOFTLIGHT",
+ 0,
+ "Soft light",
+ "Use softlight blending mode while painting"},
+ {IMB_BLEND_HARDLIGHT,
+ "HARDLIGHT",
+ 0,
+ "Hard light",
+ "Use hard light blending mode while painting"},
+ {IMB_BLEND_VIVIDLIGHT,
+ "VIVIDLIGHT",
+ 0,
+ "Vivid light",
+ "Use vividlight blending mode while painting"},
+ {IMB_BLEND_LINEARLIGHT,
+ "LINEARLIGHT",
+ 0,
+ "Linear light",
+ "Use linearlight blending mode while painting"},
+ {IMB_BLEND_PINLIGHT,
+ "PINLIGHT",
+ 0,
+ "Pin light",
+ "Use pinlight blending mode while painting"},
+ {0, "", ICON_NONE, NULL, NULL},
+ {IMB_BLEND_DIFFERENCE,
+ "DIFFERENCE",
+ 0,
+ "Difference",
+ "Use difference blending mode while painting"},
+ {IMB_BLEND_EXCLUSION,
+ "EXCLUSION",
+ 0,
+ "Exclusion",
+ "Use exclusion blending mode while painting"},
+ {IMB_BLEND_SUB, "SUB", 0, "Subtract", "Use subtract blending mode while painting"},
+ {0, "", ICON_NONE, NULL, NULL},
+ {IMB_BLEND_HUE, "HUE", 0, "Hue", "Use hue blending mode while painting"},
+ {IMB_BLEND_SATURATION,
+ "SATURATION",
+ 0,
+ "Saturation",
+ "Use saturation blending mode while painting"},
+ {IMB_BLEND_COLOR, "COLOR", 0, "Color", "Use color blending mode while painting"},
+ {IMB_BLEND_LUMINOSITY,
+ "LUMINOSITY",
+ 0,
+ "Luminosity",
+ "Use luminosity blending mode while painting"},
+ {0, "", ICON_NONE, NULL, NULL},
+ {IMB_BLEND_ERASE_ALPHA, "ERASE_ALPHA", 0, "Erase Alpha", "Erase alpha while painting"},
+ {IMB_BLEND_ADD_ALPHA, "ADD_ALPHA", 0, "Add Alpha", "Add alpha while painting"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_sculpt_plane_items[] = {
+ {SCULPT_DISP_DIR_AREA, "AREA", 0, "Area Plane", ""},
+ {SCULPT_DISP_DIR_VIEW, "VIEW", 0, "View Plane", ""},
+ {SCULPT_DISP_DIR_X, "X", 0, "X Plane", ""},
+ {SCULPT_DISP_DIR_Y, "Y", 0, "Y Plane", ""},
+ {SCULPT_DISP_DIR_Z, "Z", 0, "Z Plane", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_mask_tool_items[] = {
+ {BRUSH_MASK_DRAW, "DRAW", 0, "Draw", ""},
+ {BRUSH_MASK_SMOOTH, "SMOOTH", 0, "Smooth", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_blur_mode_items[] = {
+ {KERNEL_BOX, "BOX", 0, "Box", ""},
+ {KERNEL_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_gradient_items[] = {
+ {BRUSH_GRADIENT_PRESSURE, "PRESSURE", 0, "Pressure", ""},
+ {BRUSH_GRADIENT_SPACING_REPEAT, "SPACING_REPEAT", 0, "Repeat", ""},
+ {BRUSH_GRADIENT_SPACING_CLAMP, "SPACING_CLAMP", 0, "Clamp", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_gradient_fill_items[] = {
+ {BRUSH_GRADIENT_LINEAR, "LINEAR", 0, "Linear", ""},
+ {BRUSH_GRADIENT_RADIAL, "RADIAL", 0, "Radial", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_mask_pressure_items[] = {
+ {0, "NONE", 0, "Off", ""},
+ {BRUSH_MASK_PRESSURE_RAMP, "RAMP", ICON_STYLUS_PRESSURE, "Ramp", ""},
+ {BRUSH_MASK_PRESSURE_CUTOFF, "CUTOFF", ICON_STYLUS_PRESSURE, "Cutoff", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem brush_size_unit_items[] = {
+ {0, "VIEW", 0, "View", "Measure brush size relateve to the view"},
+ {BRUSH_LOCK_SIZE, "SCENE", 0, "Scene", "Measure brush size relateve to the scene"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Brush", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Brush", "Brush data-block for storing brush settings for painting and sculpting");
+ RNA_def_struct_ui_icon(srna, ICON_BRUSH_DATA);
+
+ /* enums */
+ prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_blend_items);
+ RNA_def_property_ui_text(prop, "Blending mode", "Brush blending mode");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /**
+ * Begin per-mode tool properties.
+ *
+ * keep in sync with #BKE_paint_get_tool_prop_id_from_paintmode
+ */
+ prop = RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_brush_sculpt_tool_items);
+ RNA_def_property_ui_text(prop, "Sculpt Tool", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
+
+ prop = RNA_def_property(srna, "vertex_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "vertexpaint_tool");
+ RNA_def_property_enum_items(prop, rna_enum_brush_vertex_tool_items);
+ RNA_def_property_ui_text(prop, "Vertex Paint Tool", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
+
+ prop = RNA_def_property(srna, "weight_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "weightpaint_tool");
+ RNA_def_property_enum_items(prop, rna_enum_brush_weight_tool_items);
+ RNA_def_property_ui_text(prop, "Weight Paint Tool", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update_and_reset_icon");
+
+ prop = RNA_def_property(srna, "image_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "imagepaint_tool");
+ RNA_def_property_enum_items(prop, rna_enum_brush_image_tool_items);
+ RNA_def_property_ui_text(prop, "Image Paint Tool", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update_and_reset_icon");
+
+ prop = RNA_def_property(srna, "gpencil_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gpencil_tool");
+ RNA_def_property_enum_items(prop, rna_enum_brush_gpencil_types_items);
+ RNA_def_property_ui_text(prop, "Type", "Category of the brush");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ /** End per mode tool properties. */
+
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_direction_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_direction_itemf");
+ RNA_def_property_ui_text(prop, "Direction", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "stroke_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, sculpt_stroke_method_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Brush_stroke_itemf");
+ RNA_def_property_ui_text(prop, "Stroke Method", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_stroke_update");
+
+ prop = RNA_def_property(srna, "sculpt_plane", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, brush_sculpt_plane_items);
+ RNA_def_property_ui_text(prop, "Sculpt Plane", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "mask_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, brush_mask_tool_items);
+ RNA_def_property_ui_text(prop, "Mask Tool", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* number values */
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_funcs(prop, NULL, "rna_Brush_set_size", NULL);
+ RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
+ RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
+ RNA_def_property_update(prop, 0, "rna_Brush_size_update");
+
+ prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_Brush_set_unprojected_radius", NULL);
+ RNA_def_property_range(prop, 0.001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001, 1, 0, -1);
+ RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
+ RNA_def_property_update(prop, 0, "rna_Brush_size_update");
+
+ prop = RNA_def_property(srna, "jitter", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "jitter");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Jitter", "Jitter the position of the brush while painting");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "jitter_absolute", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "jitter_absolute");
+ RNA_def_property_range(prop, 0, 1000000);
+ RNA_def_property_ui_text(
+ prop, "Jitter", "Jitter the position of the brush in pixels while painting");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "spacing", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "spacing");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 500, 5, -1);
+ RNA_def_property_ui_text(
+ prop, "Spacing", "Spacing between brush daubs as a percentage of brush diameter");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "grad_spacing", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "gradient_spacing");
+ RNA_def_property_range(prop, 1, 10000);
+ RNA_def_property_ui_range(prop, 1, 10000, 5, -1);
+ RNA_def_property_ui_text(
+ prop, "Gradient Spacing", "Spacing before brush gradient goes full circle");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "smooth_stroke_radius", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 10, 200);
+ RNA_def_property_ui_text(
+ prop, "Smooth Stroke Radius", "Minimum distance from last point before stroke continues");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "smooth_stroke_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.5, 0.99);
+ RNA_def_property_ui_text(prop, "Smooth Stroke Factor", "Higher values give a smoother stroke");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "rate", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rate");
+ RNA_def_property_range(prop, 0.0001f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Rate", "Interval between paints for Airbrush");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "rgb");
+ RNA_def_property_ui_text(prop, "Color", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
+ RNA_def_property_ui_text(prop, "Secondary Color", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Weight", "Vertex weight when brush is applied");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(
+ prop, "Strength", "How powerful the effect of the brush is when applied");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "plane_offset", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "plane_offset");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, -2.0f, 2.0f);
+ RNA_def_property_ui_range(prop, -0.5f, 0.5f, 0.001, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Plane Offset",
+ "Adjust plane on which the brush acts towards or away from the object surface");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "plane_trim", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "plane_trim");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Plane Trim",
+ "If a vertex is further away from offset plane than this, then it is not affected");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "height");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Brush Height", "Affectable height of brush (layer height for layer tool, i.e.)");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "texture_sample_bias", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "texture_sample_bias");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_text(prop, "Texture Sample Bias", "Value added to texture samples");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "normal_weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "normal_weight");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Normal Weight", "How much grab will pull vertexes out of surface during a grab");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "rake_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "rake_factor");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Rake", "How much grab will follow cursor rotation");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "crease_pinch_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "crease_pinch_factor");
+ RNA_def_property_float_default(prop, 2.0f / 3.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Crease Brush Pinch Factor", "How much the crease brush pinches");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "auto_smooth_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "autosmooth_factor");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(
+ prop, "Autosmooth", "Amount of smoothing to automatically apply to each stroke");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "topology_rake_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "topology_rake_factor");
+ RNA_def_property_float_default(prop, 0);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop,
+ "Topology Rake",
+ "Automatically align edges to the brush direction to "
+ "to generate cleaner topology and define sharp features "
+ "dynamic topology. Best used on low-poly meshes as it has "
+ "a performance impact");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "stencil_pos", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "stencil_pos");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Stencil Position", "Position of stencil in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "stencil_dimension", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "stencil_dimension");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Stencil Dimensions", "Dimensions of stencil in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "mask_stencil_pos", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "mask_stencil_pos");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Mask Stencil Position", "Position of mask stencil in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "mask_stencil_dimension", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "mask_stencil_dimension");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(
+ prop, "Mask Stencil Dimensions", "Dimensions of mask stencil in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "sharp_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "sharp_threshold");
+ RNA_def_property_ui_text(
+ prop, "Sharp Threshold", "Threshold below which, no sharpening is done");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "fill_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "fill_threshold");
+ RNA_def_property_ui_text(
+ prop, "Fill Threshold", "Threshold above which filling is not propagated");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "blur_kernel_radius", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "blur_kernel_radius");
+ RNA_def_property_range(prop, 1, 10000);
+ RNA_def_property_ui_range(prop, 1, 50, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Kernel Radius", "Radius of kernel used for soften and sharpen in pixels");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "blur_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, brush_blur_mode_items);
+ RNA_def_property_ui_text(prop, "Blur Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "falloff_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "falloff_angle");
+ RNA_def_property_range(prop, 0, M_PI / 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Falloff Angle",
+ "Paint most on faces pointing towards the view according to this angle");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* flag */
+ /* This is an enum but its unlikely we add other shapes, so expose as a boolean. */
+ prop = RNA_def_property(srna, "use_projected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "falloff_shape", BRUSH_AIRBRUSH);
+ RNA_def_property_ui_text(
+ prop, "2D Falloff", "Apply brush influence in 2D circle instead of a sphere");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_airbrush", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_AIRBRUSH);
+ RNA_def_property_ui_text(
+ prop, "Airbrush", "Keep applying paint effect while holding mouse (spray)");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_original_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ORIGINAL_NORMAL);
+ RNA_def_property_ui_text(prop,
+ "Original Normal",
+ "When locked keep using normal of surface where stroke was initiated");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ALPHA_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_offset_pressure", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_OFFSET_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Plane Offset Pressure", "Enable tablet pressure sensitivity for offset");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SIZE_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_gradient", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_USE_GRADIENT);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Brush_use_gradient_set");
+ RNA_def_property_ui_text(prop, "Use Gradient", "Use Gradient by utilizing a sampling method");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_pressure_jitter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_JITTER_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Jitter Pressure", "Enable tablet pressure sensitivity for jitter");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_pressure_spacing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACING_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Spacing Pressure", "Enable tablet pressure sensitivity for spacing");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_pressure_masking", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_pressure");
+ RNA_def_property_enum_items(prop, brush_mask_pressure_items);
+ RNA_def_property_ui_text(
+ prop, "Mask Pressure Mode", "Pen pressure makes texture influence smaller");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_inverse_smooth_pressure", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_INVERSE_SMOOTH_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Inverse Smooth Pressure", "Lighter pressure causes more smoothing to be applied");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_relative_jitter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_ABSOLUTE_JITTER);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
+ RNA_def_property_ui_text(
+ prop, "Absolute Jitter", "Jittering happens in screen space, not relative to brush size");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_plane_trim", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PLANE_TRIM);
+ RNA_def_property_ui_text(prop, "Use Plane Trim", "Enable Plane Trim");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_frontface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FRONTFACE);
+ RNA_def_property_ui_text(
+ prop, "Use Front-Face", "Brush only affects vertexes that face the viewer");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_frontface_falloff", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_FRONTFACE_FALLOFF);
+ RNA_def_property_ui_text(
+ prop, "Use Front-Face Falloff", "Blend brush influence by how much they face the front");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_anchor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ANCHORED);
+ RNA_def_property_ui_text(prop, "Anchored", "Keep the brush anchored to the initial location");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_space", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE);
+ RNA_def_property_ui_text(
+ prop, "Space", "Limit brush application to the distance specified by spacing");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_LINE);
+ RNA_def_property_ui_text(prop, "Line", "Draw a line with dabs separated according to spacing");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CURVE);
+ RNA_def_property_ui_text(
+ prop,
+ "Curve",
+ "Define the stroke curve with a bezier curve. Dabs are separated according to spacing");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SMOOTH_STROKE);
+ RNA_def_property_ui_text(
+ prop, "Smooth Stroke", "Brush lags behind mouse and follows a smoother path");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_persistent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_PERSISTENT);
+ RNA_def_property_ui_text(prop, "Persistent", "Sculpt on a persistent layer of the mesh");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_accumulate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ACCUMULATE);
+ RNA_def_property_ui_text(prop, "Accumulate", "Accumulate stroke daubs on top of each other");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_space_attenuation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_SPACE_ATTEN);
+ RNA_def_property_ui_text(
+ prop,
+ "Adjust Strength for Spacing",
+ "Automatically adjust strength to give consistent results for different spacings");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* adaptive space is not implemented yet */
+ prop = RNA_def_property(srna, "use_adaptive_space", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_ADAPTIVE_SPACE);
+ RNA_def_property_ui_text(prop,
+ "Adaptive Spacing",
+ "Space daubs according to surface orientation instead of screen space");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_locked_size", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, brush_size_unit_items);
+ RNA_def_property_ui_text(
+ prop, "Radius Unit", "Measure brush size relative to the view or the scene");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_edge_to_edge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_EDGE_TO_EDGE);
+ RNA_def_property_ui_text(prop, "Edge-to-edge", "Drag anchor brush from edge-to-edge");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_restore_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_DRAG_DOT);
+ RNA_def_property_ui_text(prop, "Restore Mesh", "Allow a single dot to be carefully positioned");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* only for projection paint & vertex paint, TODO, other paint modes */
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", BRUSH_LOCK_ALPHA);
+ RNA_def_property_ui_text(
+ prop, "Affect Alpha", "When this is disabled, lock alpha while painting");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Curve", "Editable falloff curve");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "paint_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Paint Curve", "Active Paint Curve");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "gradient", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "gradient");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Gradient", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* gradient source */
+ prop = RNA_def_property(srna, "gradient_stroke_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, brush_gradient_items);
+ RNA_def_property_ui_text(prop, "Gradient Stroke Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "gradient_fill_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, brush_gradient_fill_items);
+ RNA_def_property_ui_text(prop, "Gradient Fill Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* overlay flags */
+ prop = RNA_def_property(srna, "use_primary_overlay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_PRIMARY);
+ RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_secondary_overlay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_SECONDARY);
+ RNA_def_property_ui_text(prop, "Use Texture Overlay", "Show texture in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_cursor_overlay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay_flags", BRUSH_OVERLAY_CURSOR);
+ RNA_def_property_ui_text(prop, "Use Cursor Overlay", "Show cursor in viewport");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_cursor_overlay_override", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "overlay_flags", BRUSH_OVERLAY_CURSOR_OVERRIDE_ON_STROKE);
+ RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_primary_overlay_override", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "overlay_flags", BRUSH_OVERLAY_PRIMARY_OVERRIDE_ON_STROKE);
+ RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_secondary_overlay_override", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "overlay_flags", BRUSH_OVERLAY_SECONDARY_OVERRIDE_ON_STROKE);
+ RNA_def_property_ui_text(prop, "Override Overlay", "Don't show overlay during a stroke");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ /* paint mode flags */
+ prop = RNA_def_property(srna, "use_paint_sculpt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_SCULPT);
+ RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in sculpt mode");
+
+ prop = RNA_def_property(srna, "use_paint_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_VERTEX_PAINT);
+ RNA_def_property_ui_text(prop, "Use Vertex", "Use this brush in vertex paint mode");
+
+ prop = RNA_def_property(srna, "use_paint_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_WEIGHT_PAINT);
+ RNA_def_property_ui_text(prop, "Use Weight", "Use this brush in weight paint mode");
+
+ prop = RNA_def_property(srna, "use_paint_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_TEXTURE_PAINT);
+ RNA_def_property_ui_text(prop, "Use Texture", "Use this brush in texture paint mode");
+
+ prop = RNA_def_property(srna, "use_paint_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_mode", OB_MODE_PAINT_GPENCIL);
+ RNA_def_property_ui_text(prop, "Use Sculpt", "Use this brush in grease pencil drawing mode");
+
+ /* texture */
+ prop = RNA_def_property(srna, "texture_slot", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BrushTextureSlot");
+ RNA_def_property_pointer_sdna(prop, NULL, "mtex");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Texture Slot", "");
+
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mtex.tex");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Texture", "");
+ RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_main_tex_update");
+
+ prop = RNA_def_property(srna, "mask_texture_slot", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BrushTextureSlot");
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_mtex");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask Texture Slot", "");
+
+ prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_mtex.tex");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Mask Texture", "");
+ RNA_def_property_update(prop, NC_TEXTURE, "rna_Brush_secondary_tex_update");
+
+ prop = RNA_def_property(srna, "texture_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "texture_overlay_alpha");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Texture Overlay Alpha", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "mask_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "mask_overlay_alpha");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Mask Texture Overlay Alpha", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "cursor_overlay_alpha", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "cursor_overlay_alpha");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Mask Texture Overlay Alpha", "");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "add_col");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Add Color", "Color of cursor when adding");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "cursor_color_subtract", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "sub_col");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Subtract Color", "Color of cursor when subtracting");
+ RNA_def_property_update(prop, 0, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "use_custom_icon", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BRUSH_CUSTOM_ICON);
+ RNA_def_property_ui_text(prop, "Custom Icon", "Set the brush icon from an image file");
+ RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
+
+ prop = RNA_def_property(srna, "icon_filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "icon_filepath");
+ RNA_def_property_ui_text(prop, "Brush Icon Filepath", "File path to brush icon");
+ RNA_def_property_update(prop, 0, "rna_Brush_icon_update");
+
+ /* clone tool */
+ prop = RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clone.image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Clone Image", "Image for clone tool");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "clone_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "clone.alpha");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Clone Alpha", "Opacity of clone image display");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "clone_offset", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "clone.offset");
+ RNA_def_property_ui_text(prop, "Clone Offset", "");
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 10.0f, 3);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_Brush_update");
+
+ prop = RNA_def_property(srna, "brush_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilities");
+ RNA_def_property_pointer_funcs(prop, "rna_Brush_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Brush Capabilities", "Brush's capabilities");
+
+ /* brush capabilities (mode-dependent) */
+ prop = RNA_def_property(srna, "sculpt_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesSculpt");
+ RNA_def_property_pointer_funcs(prop, "rna_Sculpt_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Sculpt Capabilities", "");
+
+ prop = RNA_def_property(srna, "image_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesImagePaint");
+ RNA_def_property_pointer_funcs(prop, "rna_Imapaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Image Paint Capabilities", "");
+
+ prop = RNA_def_property(srna, "vertex_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesVertexPaint");
+ RNA_def_property_pointer_funcs(prop, "rna_Vertexpaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Vertex Paint Capabilities", "");
+
+ prop = RNA_def_property(srna, "weight_paint_capabilities", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "BrushCapabilitiesWeightPaint");
+ RNA_def_property_pointer_funcs(prop, "rna_Weightpaint_tool_capabilities_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Weight Paint Capabilities", "");
+
+ prop = RNA_def_property(srna, "gpencil_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BrushGpencilSettings");
+ RNA_def_property_pointer_sdna(prop, NULL, "gpencil_settings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Gpencil Settings", "");
}
/**
@@ -2119,64 +2255,64 @@ static void rna_def_brush(BlenderRNA *brna)
*/
static void rna_def_operator_stroke_element(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "OperatorStrokeElement", "PropertyGroup");
- RNA_def_struct_ui_text(srna, "Operator Stroke Element", "");
+ srna = RNA_def_struct(brna, "OperatorStrokeElement", "PropertyGroup");
+ RNA_def_struct_ui_text(srna, "Operator Stroke Element", "");
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Location", "");
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Location", "");
- prop = RNA_def_property(srna, "mouse", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Mouse", "");
+ prop = RNA_def_property(srna, "mouse", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Mouse", "");
- prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Pressure", "Tablet pressure");
+ prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Pressure", "Tablet pressure");
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Brush Size", "Brush Size in screen space");
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Brush Size", "Brush Size in screen space");
- prop = RNA_def_property(srna, "pen_flip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Flip", "");
+ prop = RNA_def_property(srna, "pen_flip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Flip", "");
- /* used in uv painting */
- prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Time", "");
+ /* used in uv painting */
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Time", "");
- /* used for Grease Pencil sketching sessions */
- prop = RNA_def_property(srna, "is_start", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Is Stroke Start", "");
+ /* used for Grease Pencil sketching sessions */
+ prop = RNA_def_property(srna, "is_start", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Is Stroke Start", "");
- /* XXX: Tool (this will be for pressing a modifier key for a different brush,
- * e.g. switching to a Smooth brush in the middle of the stroke */
+ /* XXX: Tool (this will be for pressing a modifier key for a different brush,
+ * e.g. switching to a Smooth brush in the middle of the stroke */
- /* XXX: i don't think blender currently supports the ability to properly do a remappable modifier
- * in the middle of a stroke */
+ /* XXX: i don't think blender currently supports the ability to properly do a remappable modifier
+ * in the middle of a stroke */
}
void RNA_def_brush(BlenderRNA *brna)
{
- rna_def_brush(brna);
- rna_def_brush_capabilities(brna);
- rna_def_sculpt_capabilities(brna);
- rna_def_image_paint_capabilities(brna);
- rna_def_vertex_paint_capabilities(brna);
- rna_def_weight_paint_capabilities(brna);
- rna_def_gpencil_options(brna);
- rna_def_brush_texture_slot(brna);
- rna_def_operator_stroke_element(brna);
+ rna_def_brush(brna);
+ rna_def_brush_capabilities(brna);
+ rna_def_sculpt_capabilities(brna);
+ rna_def_image_paint_capabilities(brna);
+ rna_def_vertex_paint_capabilities(brna);
+ rna_def_weight_paint_capabilities(brna);
+ rna_def_gpencil_options(brna);
+ rna_def_brush_texture_slot(brna);
+ rna_def_operator_stroke_element(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_cachefile.c b/source/blender/makesrna/intern/rna_cachefile.c
index a0464372cbd..fb61be69ee6 100644
--- a/source/blender/makesrna/intern/rna_cachefile.c
+++ b/source/blender/makesrna/intern/rna_cachefile.c
@@ -32,62 +32,62 @@
#ifdef RNA_RUNTIME
-#include "BLI_string.h"
+# include "BLI_string.h"
-#include "BKE_cachefile.h"
+# include "BKE_cachefile.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "WM_api.h"
-#include "WM_types.h"
+# include "WM_api.h"
+# include "WM_types.h"
-#ifdef WITH_ALEMBIC
-# include "../../../alembic/ABC_alembic.h"
-#endif
+# ifdef WITH_ALEMBIC
+# include "../../../alembic/ABC_alembic.h"
+# endif
static void rna_CacheFile_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- CacheFile *cache_file = (CacheFile *)ptr->data;
+ CacheFile *cache_file = (CacheFile *)ptr->data;
- DEG_id_tag_update(&cache_file->id, 0);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ DEG_id_tag_update(&cache_file->id, 0);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- UNUSED_VARS(bmain, scene);
+ UNUSED_VARS(bmain, scene);
}
static void rna_CacheFile_update_handle(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- CacheFile *cache_file = ptr->data;
+ CacheFile *cache_file = ptr->data;
- if ((cache_file->flag & CACHEFILE_DIRTY) != 0) {
- BKE_cachefile_clean(bmain, cache_file);
- BLI_freelistN(&cache_file->object_paths);
- cache_file->flag &= ~CACHEFILE_DIRTY;
- }
+ if ((cache_file->flag & CACHEFILE_DIRTY) != 0) {
+ BKE_cachefile_clean(bmain, cache_file);
+ BLI_freelistN(&cache_file->object_paths);
+ cache_file->flag &= ~CACHEFILE_DIRTY;
+ }
- BKE_cachefile_reload(bmain, cache_file);
+ BKE_cachefile_reload(bmain, cache_file);
- rna_CacheFile_update(bmain, scene, ptr);
+ rna_CacheFile_update(bmain, scene, ptr);
}
static void rna_CacheFile_object_paths_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CacheFile *cache_file = (CacheFile *)ptr->data;
- rna_iterator_listbase_begin(iter, &cache_file->object_paths, NULL);
+ CacheFile *cache_file = (CacheFile *)ptr->data;
+ rna_iterator_listbase_begin(iter, &cache_file->object_paths, NULL);
}
static void rna_CacheFile_filename_set(PointerRNA *ptr, const char *value)
{
- CacheFile *cache_file = ptr->data;
+ CacheFile *cache_file = ptr->data;
- if (STREQ(cache_file->filepath, value)) {
- return;
- }
+ if (STREQ(cache_file->filepath, value)) {
+ return;
+ }
- /* Different file is opened, close all readers. */
- cache_file->flag |= CACHEFILE_DIRTY;
+ /* Different file is opened, close all readers. */
+ cache_file->flag |= CACHEFILE_DIRTY;
- BLI_strncpy(cache_file->filepath, value, sizeof(cache_file->filepath));
+ BLI_strncpy(cache_file->filepath, value, sizeof(cache_file->filepath));
}
#else
@@ -95,104 +95,119 @@ static void rna_CacheFile_filename_set(PointerRNA *ptr, const char *value)
/* cachefile.object_paths */
static void rna_def_alembic_object_path(BlenderRNA *brna)
{
- StructRNA *srna = RNA_def_struct(brna, "AlembicObjectPath", NULL);
- RNA_def_struct_sdna(srna, "AlembicObjectPath");
- RNA_def_struct_ui_text(srna, "Object Path", "Path of an object inside of an Alembic archive");
- RNA_def_struct_ui_icon(srna, ICON_NONE);
-
- PropertyRNA *prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Path", "Object path");
- RNA_def_struct_name_property(srna, prop);
+ StructRNA *srna = RNA_def_struct(brna, "AlembicObjectPath", NULL);
+ RNA_def_struct_sdna(srna, "AlembicObjectPath");
+ RNA_def_struct_ui_text(srna, "Object Path", "Path of an object inside of an Alembic archive");
+ RNA_def_struct_ui_icon(srna, ICON_NONE);
+
+ PropertyRNA *prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Path", "Object path");
+ RNA_def_struct_name_property(srna, prop);
}
/* cachefile.object_paths */
static void rna_def_cachefile_object_paths(BlenderRNA *brna, PropertyRNA *cprop)
{
- RNA_def_property_srna(cprop, "AlembicObjectPaths");
- StructRNA *srna = RNA_def_struct(brna, "AlembicObjectPaths", NULL);
- RNA_def_struct_sdna(srna, "CacheFile");
- RNA_def_struct_ui_text(srna, "Object Paths", "Collection of object paths");
+ RNA_def_property_srna(cprop, "AlembicObjectPaths");
+ StructRNA *srna = RNA_def_struct(brna, "AlembicObjectPaths", NULL);
+ RNA_def_struct_sdna(srna, "CacheFile");
+ RNA_def_struct_ui_text(srna, "Object Paths", "Collection of object paths");
}
static void rna_def_cachefile(BlenderRNA *brna)
{
- StructRNA *srna = RNA_def_struct(brna, "CacheFile", "ID");
- RNA_def_struct_sdna(srna, "CacheFile");
- RNA_def_struct_ui_text(srna, "CacheFile", "");
- RNA_def_struct_ui_icon(srna, ICON_FILE);
-
- PropertyRNA *prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CacheFile_filename_set");
- RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update_handle");
-
- prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Sequence", "Whether the cache is separated in a series of files");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- /* ----------------- For Scene time ------------------- */
-
- prop = RNA_def_property(srna, "override_frame", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Override Frame",
- "Whether to use a custom frame for looking up data in the cache file,"
- " instead of using the current scene frame");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frame");
- RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Frame", "The time to use for looking up the data in the cache file,"
- " or to determine which file to use in a file sequence");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frame_offset");
- RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Frame Offset",
- "Subtracted from the current frame to use for "
- "looking up the data in the cache file, or to "
- "determine which file to use in a file sequence");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- /* ----------------- Axis Conversion ----------------- */
-
- prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
- RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Forward", "");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "up_axis");
- RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Up", "");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_range(prop, 0.0001f, 1000.0f);
- RNA_def_property_ui_text(prop, "Scale", "Value by which to enlarge or shrink the object with respect to the world's origin"
- " (only applicable through a Transform Cache constraint)");
- RNA_def_property_update(prop, 0, "rna_CacheFile_update");
-
- /* object paths */
- prop = RNA_def_property(srna, "object_paths", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "object_paths", NULL);
- RNA_def_property_collection_funcs(prop, "rna_CacheFile_object_paths_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "AlembicObjectPath");
- RNA_def_property_srna(prop, "AlembicObjectPaths");
- RNA_def_property_ui_text(prop, "Object Paths", "Paths of the objects inside the Alembic archive");
- rna_def_cachefile_object_paths(brna, prop);
-
- rna_def_animdata_common(srna);
+ StructRNA *srna = RNA_def_struct(brna, "CacheFile", "ID");
+ RNA_def_struct_sdna(srna, "CacheFile");
+ RNA_def_struct_ui_text(srna, "CacheFile", "");
+ RNA_def_struct_ui_icon(srna, ICON_FILE);
+
+ PropertyRNA *prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CacheFile_filename_set");
+ RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update_handle");
+
+ prop = RNA_def_property(srna, "is_sequence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Sequence", "Whether the cache is separated in a series of files");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ /* ----------------- For Scene time ------------------- */
+
+ prop = RNA_def_property(srna, "override_frame", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop,
+ "Override Frame",
+ "Whether to use a custom frame for looking up data in the cache file,"
+ " instead of using the current scene frame");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame");
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop,
+ "Frame",
+ "The time to use for looking up the data in the cache file,"
+ " or to determine which file to use in a file sequence");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame_offset");
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop,
+ "Frame Offset",
+ "Subtracted from the current frame to use for "
+ "looking up the data in the cache file, or to "
+ "determine which file to use in a file sequence");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ /* ----------------- Axis Conversion ----------------- */
+
+ prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
+ RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(prop, "Forward", "");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "up_axis");
+ RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(prop, "Up", "");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_range(prop, 0.0001f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Scale",
+ "Value by which to enlarge or shrink the object with respect to the world's origin"
+ " (only applicable through a Transform Cache constraint)");
+ RNA_def_property_update(prop, 0, "rna_CacheFile_update");
+
+ /* object paths */
+ prop = RNA_def_property(srna, "object_paths", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "object_paths", NULL);
+ RNA_def_property_collection_funcs(prop,
+ "rna_CacheFile_object_paths_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "AlembicObjectPath");
+ RNA_def_property_srna(prop, "AlembicObjectPaths");
+ RNA_def_property_ui_text(
+ prop, "Object Paths", "Paths of the objects inside the Alembic archive");
+ rna_def_cachefile_object_paths(brna, prop);
+
+ rna_def_animdata_common(srna);
}
void RNA_def_cachefile(BlenderRNA *brna)
{
- rna_def_cachefile(brna);
- rna_def_alembic_object_path(brna);
+ rna_def_cachefile(brna);
+ rna_def_alembic_object_path(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c
index 5f930c178a2..ddea98a135a 100644
--- a/source/blender/makesrna/intern/rna_camera.c
+++ b/source/blender/makesrna/intern/rna_camera.c
@@ -34,606 +34,650 @@
#ifdef RNA_RUNTIME
-#include "BKE_camera.h"
-#include "BKE_object.h"
-#include "BKE_sequencer.h"
+# include "BKE_camera.h"
+# include "BKE_object.h"
+# include "BKE_sequencer.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static float rna_Camera_angle_get(PointerRNA *ptr)
{
- Camera *cam = ptr->id.data;
- float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
- return focallength_to_fov(cam->lens, sensor);
+ Camera *cam = ptr->id.data;
+ float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+ return focallength_to_fov(cam->lens, sensor);
}
static void rna_Camera_angle_set(PointerRNA *ptr, float value)
{
- Camera *cam = ptr->id.data;
- float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
- cam->lens = fov_to_focallength(value, sensor);
+ Camera *cam = ptr->id.data;
+ float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y);
+ cam->lens = fov_to_focallength(value, sensor);
}
static float rna_Camera_angle_x_get(PointerRNA *ptr)
{
- Camera *cam = ptr->id.data;
- return focallength_to_fov(cam->lens, cam->sensor_x);
+ Camera *cam = ptr->id.data;
+ return focallength_to_fov(cam->lens, cam->sensor_x);
}
static void rna_Camera_angle_x_set(PointerRNA *ptr, float value)
{
- Camera *cam = ptr->id.data;
- cam->lens = fov_to_focallength(value, cam->sensor_x);
+ Camera *cam = ptr->id.data;
+ cam->lens = fov_to_focallength(value, cam->sensor_x);
}
static float rna_Camera_angle_y_get(PointerRNA *ptr)
{
- Camera *cam = ptr->id.data;
- return focallength_to_fov(cam->lens, cam->sensor_y);
+ Camera *cam = ptr->id.data;
+ return focallength_to_fov(cam->lens, cam->sensor_y);
}
static void rna_Camera_angle_y_set(PointerRNA *ptr, float value)
{
- Camera *cam = ptr->id.data;
- cam->lens = fov_to_focallength(value, cam->sensor_y);
+ Camera *cam = ptr->id.data;
+ cam->lens = fov_to_focallength(value, cam->sensor_y);
}
static void rna_Camera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Camera *camera = (Camera *)ptr->id.data;
+ Camera *camera = (Camera *)ptr->id.data;
- DEG_id_tag_update(&camera->id, 0);
+ DEG_id_tag_update(&camera->id, 0);
}
static void rna_Camera_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Camera *camera = (Camera *)ptr->id.data;
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update(&camera->id, 0);
+ Camera *camera = (Camera *)ptr->id.data;
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update(&camera->id, 0);
}
static CameraBGImage *rna_Camera_background_images_new(Camera *cam)
{
- CameraBGImage *bgpic = BKE_camera_background_image_new(cam);
+ CameraBGImage *bgpic = BKE_camera_background_image_new(cam);
- WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
+ WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
- return bgpic;
+ return bgpic;
}
-static void rna_Camera_background_images_remove(Camera *cam, ReportList *reports, PointerRNA *bgpic_ptr)
+static void rna_Camera_background_images_remove(Camera *cam,
+ ReportList *reports,
+ PointerRNA *bgpic_ptr)
{
- CameraBGImage *bgpic = bgpic_ptr->data;
- if (BLI_findindex(&cam->bg_images, bgpic) == -1) {
- BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
- }
+ CameraBGImage *bgpic = bgpic_ptr->data;
+ if (BLI_findindex(&cam->bg_images, bgpic) == -1) {
+ BKE_report(reports, RPT_ERROR, "Background image cannot be removed");
+ }
- BKE_camera_background_image_remove(cam, bgpic);
- RNA_POINTER_INVALIDATE(bgpic_ptr);
+ BKE_camera_background_image_remove(cam, bgpic);
+ RNA_POINTER_INVALIDATE(bgpic_ptr);
- WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
+ WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
}
static void rna_Camera_background_images_clear(Camera *cam)
{
- BKE_camera_background_image_clear(cam);
+ BKE_camera_background_image_clear(cam);
- WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
+ WM_main_add_notifier(NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, cam);
}
static void rna_Camera_dof_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- /* TODO(sergey): Can be more selective here. */
- BKE_sequencer_cache_cleanup();
- BKE_sequencer_preprocessed_cache_cleanup();
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ /* TODO(sergey): Can be more selective here. */
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
}
#else
static void rna_def_camera_background_image(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem bgpic_source_items[] = {
- {CAM_BGIMG_SOURCE_IMAGE, "IMAGE", 0, "Image", ""},
- {CAM_BGIMG_SOURCE_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem bgpic_camera_frame_items[] = {
- {0, "STRETCH", 0, "Stretch", ""},
- {CAM_BGIMG_FLAG_CAMERA_ASPECT, "FIT", 0, "Fit", ""},
- {CAM_BGIMG_FLAG_CAMERA_ASPECT | CAM_BGIMG_FLAG_CAMERA_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem bgpic_display_depth_items[] = {
- {0, "BACK", 0, "Back", ""},
- {CAM_BGIMG_FLAG_FOREGROUND, "FRONT", 0, "Front", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CameraBackgroundImage", NULL);
- RNA_def_struct_sdna(srna, "CameraBGImage");
- RNA_def_struct_ui_text(srna, "Background Image", "Image and settings for display in the 3D View background");
-
- prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "source");
- RNA_def_property_enum_items(prop, bgpic_source_items);
- RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ima");
- RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clip");
- RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "MovieClipUser");
- RNA_def_property_pointer_sdna(prop, NULL, "cuser");
- RNA_def_property_ui_text(prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_ui_text(prop, "Scale", "Scale the background image");
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_ui_text(prop, "Rotation", "Rotation for the background image (ortho view only)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FLIP_X);
- RNA_def_property_ui_text(prop, "Flip Horizontally", "Flip the background image horizontally");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FLIP_Y);
- RNA_def_property_ui_text(prop, "Flip Vertically", "Flip the background image vertically");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_ui_text(prop, "Alpha", "Image opacity to blend the image against the background color");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_EXPANDED);
- RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- prop = RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_CAMERACLIP);
- RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_DISABLED);
- RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FOREGROUND);
- RNA_def_property_ui_text(prop, "Show On Foreground", "Show this image in front of objects in viewport");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* expose 1 flag as a enum of 2 items */
- prop = RNA_def_property(srna, "display_depth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, bgpic_display_depth_items);
- RNA_def_property_ui_text(prop, "Depth", "Display under or over everything");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* expose 2 flags as a enum of 3 items */
- prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, bgpic_camera_frame_items);
- RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem bgpic_source_items[] = {
+ {CAM_BGIMG_SOURCE_IMAGE, "IMAGE", 0, "Image", ""},
+ {CAM_BGIMG_SOURCE_MOVIE, "MOVIE_CLIP", 0, "Movie Clip", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem bgpic_camera_frame_items[] = {
+ {0, "STRETCH", 0, "Stretch", ""},
+ {CAM_BGIMG_FLAG_CAMERA_ASPECT, "FIT", 0, "Fit", ""},
+ {CAM_BGIMG_FLAG_CAMERA_ASPECT | CAM_BGIMG_FLAG_CAMERA_CROP, "CROP", 0, "Crop", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem bgpic_display_depth_items[] = {
+ {0, "BACK", 0, "Back", ""},
+ {CAM_BGIMG_FLAG_FOREGROUND, "FRONT", 0, "Front", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CameraBackgroundImage", NULL);
+ RNA_def_struct_sdna(srna, "CameraBGImage");
+ RNA_def_struct_ui_text(
+ srna, "Background Image", "Image and settings for display in the 3D View background");
+
+ prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "source");
+ RNA_def_property_enum_items(prop, bgpic_source_items);
+ RNA_def_property_ui_text(prop, "Background Source", "Data source used for background");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ima");
+ RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "MovieClip", "Movie clip displayed and edited in this space");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+ RNA_def_property_ui_text(
+ prop,
+ "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "MovieClipUser");
+ RNA_def_property_pointer_sdna(prop, NULL, "cuser");
+ RNA_def_property_ui_text(
+ prop, "Clip User", "Parameters defining which frame of the movie clip is displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(prop, "Scale", "Scale the background image");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_ui_text(
+ prop, "Rotation", "Rotation for the background image (ortho view only)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FLIP_X);
+ RNA_def_property_ui_text(prop, "Flip Horizontally", "Flip the background image horizontally");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FLIP_Y);
+ RNA_def_property_ui_text(prop, "Flip Vertically", "Flip the background image vertically");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_ui_text(
+ prop, "Alpha", "Image opacity to blend the image against the background color");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_EXPANDED);
+ RNA_def_property_ui_text(prop, "Show Expanded", "Show the expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ prop = RNA_def_property(srna, "use_camera_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_CAMERACLIP);
+ RNA_def_property_ui_text(prop, "Camera Clip", "Use movie clip from active scene camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_background_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_DISABLED);
+ RNA_def_property_ui_text(prop, "Show Background Image", "Show this image as background");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_on_foreground", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_BGIMG_FLAG_FOREGROUND);
+ RNA_def_property_ui_text(
+ prop, "Show On Foreground", "Show this image in front of objects in viewport");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* expose 1 flag as a enum of 2 items */
+ prop = RNA_def_property(srna, "display_depth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, bgpic_display_depth_items);
+ RNA_def_property_ui_text(prop, "Depth", "Display under or over everything");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* expose 2 flags as a enum of 3 items */
+ prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, bgpic_camera_frame_items);
+ RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
-
static void rna_def_camera_background_images(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "CameraBackgroundImages");
- srna = RNA_def_struct(brna, "CameraBackgroundImages", NULL);
- RNA_def_struct_sdna(srna, "Camera");
- RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
-
- func = RNA_def_function(srna, "new", "rna_Camera_background_images_new");
- RNA_def_function_ui_description(func, "Add new background image");
- parm = RNA_def_pointer(func, "image", "CameraBackgroundImage", "", "Image displayed as viewport background");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Camera_background_images_remove");
- RNA_def_function_ui_description(func, "Remove background image");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "image", "CameraBackgroundImage", "", "Image displayed as viewport background");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_Camera_background_images_clear");
- RNA_def_function_ui_description(func, "Remove all background images");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "CameraBackgroundImages");
+ srna = RNA_def_struct(brna, "CameraBackgroundImages", NULL);
+ RNA_def_struct_sdna(srna, "Camera");
+ RNA_def_struct_ui_text(srna, "Background Images", "Collection of background images");
+
+ func = RNA_def_function(srna, "new", "rna_Camera_background_images_new");
+ RNA_def_function_ui_description(func, "Add new background image");
+ parm = RNA_def_pointer(
+ func, "image", "CameraBackgroundImage", "", "Image displayed as viewport background");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Camera_background_images_remove");
+ RNA_def_function_ui_description(func, "Remove background image");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "image", "CameraBackgroundImage", "", "Image displayed as viewport background");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_Camera_background_images_clear");
+ RNA_def_function_ui_description(func, "Remove all background images");
}
static void rna_def_camera_stereo_data(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem convergence_mode_items[] = {
- {CAM_S3D_OFFAXIS, "OFFAXIS", 0, "Off-Axis", "Off-axis frustums converging in a plane"},
- {CAM_S3D_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel cameras with no convergence"},
- {CAM_S3D_TOE, "TOE", 0, "Toe-in", "Rotated cameras, looking at the convergence distance"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem pivot_items[] = {
- {CAM_S3D_PIVOT_LEFT, "LEFT", 0, "Left", ""},
- {CAM_S3D_PIVOT_RIGHT, "RIGHT", 0, "Right", ""},
- {CAM_S3D_PIVOT_CENTER, "CENTER", 0, "Center", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CameraStereoData", NULL);
- RNA_def_struct_sdna(srna, "CameraStereoSettings");
- RNA_def_struct_nested(brna, srna, "Camera");
- RNA_def_struct_ui_text(srna, "Stereo", "Stereoscopy settings for a Camera data-block");
-
- prop = RNA_def_property(srna, "convergence_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, convergence_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, pivot_items);
- RNA_def_property_ui_text(prop, "Pivot", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "interocular_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1e4f, 1, 3);
- RNA_def_property_ui_text(prop, "Interocular Distance",
- "Set the distance between the eyes - the stereo plane distance / 30 should be fine");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "convergence_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.00001f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.00001f, 15.f, 1, 3);
- RNA_def_property_ui_text(prop, "Convergence Plane Distance",
- "The converge point for the stereo cameras "
- "(often the distance between a projector and the projection screen)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_S3D_SPHERICAL);
- RNA_def_property_ui_text(prop, "Spherical Stereo",
- "Render every pixel rotating the camera around the "
- "middle of the interocular distance");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "use_pole_merge", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_S3D_POLE_MERGE);
- RNA_def_property_ui_text(prop, "Use Pole Merge",
- "Fade interocular distance to 0 after the given cutoff angle");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "pole_merge_angle_from", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, 0.0f, M_PI / 2.0);
- RNA_def_property_ui_text(prop, "Pole Merge Start Angle",
- "Angle at which interocular distance starts to fade to 0");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "pole_merge_angle_to", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, 0.0f, M_PI / 2.0);
- RNA_def_property_ui_text(prop, "Pole Merge End Angle",
- "Angle at which interocular distance is 0");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem convergence_mode_items[] = {
+ {CAM_S3D_OFFAXIS, "OFFAXIS", 0, "Off-Axis", "Off-axis frustums converging in a plane"},
+ {CAM_S3D_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel cameras with no convergence"},
+ {CAM_S3D_TOE, "TOE", 0, "Toe-in", "Rotated cameras, looking at the convergence distance"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pivot_items[] = {
+ {CAM_S3D_PIVOT_LEFT, "LEFT", 0, "Left", ""},
+ {CAM_S3D_PIVOT_RIGHT, "RIGHT", 0, "Right", ""},
+ {CAM_S3D_PIVOT_CENTER, "CENTER", 0, "Center", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CameraStereoData", NULL);
+ RNA_def_struct_sdna(srna, "CameraStereoSettings");
+ RNA_def_struct_nested(brna, srna, "Camera");
+ RNA_def_struct_ui_text(srna, "Stereo", "Stereoscopy settings for a Camera data-block");
+
+ prop = RNA_def_property(srna, "convergence_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, convergence_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, pivot_items);
+ RNA_def_property_ui_text(prop, "Pivot", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "interocular_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1e4f, 1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Interocular Distance",
+ "Set the distance between the eyes - the stereo plane distance / 30 should be fine");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "convergence_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.00001f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.00001f, 15.f, 1, 3);
+ RNA_def_property_ui_text(prop,
+ "Convergence Plane Distance",
+ "The converge point for the stereo cameras "
+ "(often the distance between a projector and the projection screen)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_S3D_SPHERICAL);
+ RNA_def_property_ui_text(prop,
+ "Spherical Stereo",
+ "Render every pixel rotating the camera around the "
+ "middle of the interocular distance");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "use_pole_merge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_S3D_POLE_MERGE);
+ RNA_def_property_ui_text(
+ prop, "Use Pole Merge", "Fade interocular distance to 0 after the given cutoff angle");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "pole_merge_angle_from", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0.0f, M_PI / 2.0);
+ RNA_def_property_ui_text(
+ prop, "Pole Merge Start Angle", "Angle at which interocular distance starts to fade to 0");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "pole_merge_angle_to", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0.0f, M_PI / 2.0);
+ RNA_def_property_ui_text(
+ prop, "Pole Merge End Angle", "Angle at which interocular distance is 0");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
}
void RNA_def_camera(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static const EnumPropertyItem prop_type_items[] = {
- {CAM_PERSP, "PERSP", 0, "Perspective", ""},
- {CAM_ORTHO, "ORTHO", 0, "Orthographic", ""},
- {CAM_PANO, "PANO", 0, "Panoramic", ""},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem prop_lens_unit_items[] = {
- {0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"},
- {CAM_ANGLETOGGLE, "FOV", 0, "Field of View", "Specify the lens as the field of view's angle"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem sensor_fit_items[] = {
- {CAMERA_SENSOR_FIT_AUTO, "AUTO", 0, "Auto", "Fit to the sensor width or height depending on image resolution"},
- {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"},
- {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Camera", "ID");
- RNA_def_struct_ui_text(srna, "Camera", "Camera data-block for storing camera settings");
- RNA_def_struct_ui_icon(srna, ICON_CAMERA_DATA);
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Type", "Camera types");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
- RNA_def_property_enum_items(prop, sensor_fit_items);
- RNA_def_property_ui_text(prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- /* Number values */
-
- prop = RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "passepartalpha");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view");
- RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view");
- RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view");
- RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_default(prop, 1000.0f);
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_DISTANCE_CAMERA);
- RNA_def_property_float_sdna(prop, NULL, "lens");
- RNA_def_property_float_default(prop, 50.0f);
- RNA_def_property_range(prop, 1.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 100, 4);
- RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_DISTANCE_CAMERA);
- RNA_def_property_float_sdna(prop, NULL, "sensor_x");
- RNA_def_property_float_default(prop, 36.0f);
- RNA_def_property_range(prop, 1.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 1.0f, 100.f, 100, 4);
- RNA_def_property_ui_text(prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_DISTANCE_CAMERA);
- RNA_def_property_float_sdna(prop, NULL, "sensor_y");
- RNA_def_property_float_default(prop, 34.0f);
- RNA_def_property_range(prop, 1.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 1.0f, 100.f, 100, 4);
- RNA_def_property_ui_text(prop, "Sensor Height", "Vertical size of the image sensor area in millimeters");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ortho_scale");
- RNA_def_property_float_default(prop, 6.0f);
- RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, 10000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "drawsize");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.01f, 1000.0f);
- RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
- RNA_def_property_ui_text(prop, "Display Size", "Apparent size of the Camera object in the 3D View");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shiftx");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
- RNA_def_property_ui_text(prop, "Shift X", "Camera horizontal shift");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shifty");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
- RNA_def_property_ui_text(prop, "Shift Y", "Camera vertical shift");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
-
- prop = RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2);
- RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dof_update");
-
- /* Stereo Settings */
- prop = RNA_def_property(srna, "stereo", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "stereo");
- RNA_def_property_struct_type(prop, "CameraStereoData");
- RNA_def_property_ui_text(prop, "Stereo", "");
-
- /* flag */
- prop = RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS);
- RNA_def_property_ui_text(prop, "Show Limits", "Display the clipping range and focus point on the camera");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWMIST);
- RNA_def_property_ui_text(prop, "Show Mist", "Display a line from the Camera to indicate the mist area");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Show Passepartout",
- "Show a darkened overlay outside the image area in Camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_MARGINS);
- RNA_def_property_ui_text(prop, "Show Safe Areas", "Show TV title safe and action safe areas in Camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_CENTER);
- RNA_def_property_ui_text(prop, "Show Center-cut safe areas",
- "Show safe areas to fit content in a different aspect ratio");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME);
- RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR);
- RNA_def_property_ui_text(prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_BG_IMAGE);
- RNA_def_property_ui_text(prop, "Display Background Images",
- "Display reference images behind objects in the 3D View");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_lens_unit_items);
- RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface");
-
- /* dtx */
- prop = RNA_def_property(srna, "show_composition_center", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER);
- RNA_def_property_ui_text(prop, "Center", "Display center composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_center_diagonal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER_DIAG);
- RNA_def_property_ui_text(prop, "Center Diagonal", "Display diagonal center composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_thirds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_THIRDS);
- RNA_def_property_ui_text(prop, "Thirds", "Display rule of thirds composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_golden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN);
- RNA_def_property_ui_text(prop, "Golden Ratio", "Display golden ratio composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_golden_tria_a", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_A);
- RNA_def_property_ui_text(prop, "Golden Triangle A", "Display golden triangle A composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_golden_tria_b", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_B);
- RNA_def_property_ui_text(prop, "Golden Triangle B", "Display golden triangle B composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_harmony_tri_a", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_A);
- RNA_def_property_ui_text(prop, "Harmonious Triangle A", "Display harmony A composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "show_composition_harmony_tri_b", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_B);
- RNA_def_property_ui_text(prop, "Harmonious Triangle B", "Display harmony B composition guide inside the camera view");
- RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- /* pointers */
- prop = RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_pointer_sdna(prop, NULL, "dof_ob");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "DOF Object", "Use this object to define the depth of field focal point");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dependency_update");
-
- prop = RNA_def_property(srna, "gpu_dof", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "GPUDOFSettings");
- RNA_def_property_ui_text(prop, "GPU Depth Of Field", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "bg_images", NULL);
- RNA_def_property_struct_type(prop, "CameraBackgroundImage");
- RNA_def_property_ui_text(prop, "Background Images", "List of background images");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- rna_def_animdata_common(srna);
-
- rna_def_camera_background_image(brna);
- rna_def_camera_background_images(brna, prop);
-
- /* Nested Data */
- RNA_define_animate_sdna(true);
-
- /* *** Animated *** */
- rna_def_camera_stereo_data(brna);
-
- /* Camera API */
- RNA_api_camera(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static const EnumPropertyItem prop_type_items[] = {
+ {CAM_PERSP, "PERSP", 0, "Perspective", ""},
+ {CAM_ORTHO, "ORTHO", 0, "Orthographic", ""},
+ {CAM_PANO, "PANO", 0, "Panoramic", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem prop_lens_unit_items[] = {
+ {0, "MILLIMETERS", 0, "Millimeters", "Specify the lens in millimeters"},
+ {CAM_ANGLETOGGLE,
+ "FOV",
+ 0,
+ "Field of View",
+ "Specify the lens as the field of view's angle"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem sensor_fit_items[] = {
+ {CAMERA_SENSOR_FIT_AUTO,
+ "AUTO",
+ 0,
+ "Auto",
+ "Fit to the sensor width or height depending on image resolution"},
+ {CAMERA_SENSOR_FIT_HOR, "HORIZONTAL", 0, "Horizontal", "Fit to the sensor width"},
+ {CAMERA_SENSOR_FIT_VERT, "VERTICAL", 0, "Vertical", "Fit to the sensor height"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Camera", "ID");
+ RNA_def_struct_ui_text(srna, "Camera", "Camera data-block for storing camera settings");
+ RNA_def_struct_ui_icon(srna, ICON_CAMERA_DATA);
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Camera types");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "sensor_fit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sensor_fit");
+ RNA_def_property_enum_items(prop, sensor_fit_items);
+ RNA_def_property_ui_text(
+ prop, "Sensor Fit", "Method to fit image and field of view angle inside the sensor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ /* Number values */
+
+ prop = RNA_def_property(srna, "passepartout_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "passepartalpha");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(
+ prop, "Passepartout Alpha", "Opacity (alpha) of the darkened overlay in Camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "angle_x", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Horizontal FOV", "Camera lens horizontal field of view");
+ RNA_def_property_float_funcs(prop, "rna_Camera_angle_x_get", "rna_Camera_angle_x_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "angle_y", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Vertical FOV", "Camera lens vertical field of view");
+ RNA_def_property_float_funcs(prop, "rna_Camera_angle_y_get", "rna_Camera_angle_y_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, DEG2RAD(0.367), DEG2RAD(172.847));
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Field of View", "Camera lens field of view");
+ RNA_def_property_float_funcs(prop, "rna_Camera_angle_get", "rna_Camera_angle_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_ui_text(prop, "Clip Start", "Camera near clipping distance");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_default(prop, 1000.0f);
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_ui_text(prop, "Clip End", "Camera far clipping distance");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_DISTANCE_CAMERA);
+ RNA_def_property_float_sdna(prop, NULL, "lens");
+ RNA_def_property_float_default(prop, 50.0f);
+ RNA_def_property_range(prop, 1.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 100, 4);
+ RNA_def_property_ui_text(prop, "Focal Length", "Perspective Camera lens value in millimeters");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_DISTANCE_CAMERA);
+ RNA_def_property_float_sdna(prop, NULL, "sensor_x");
+ RNA_def_property_float_default(prop, 36.0f);
+ RNA_def_property_range(prop, 1.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1.0f, 100.f, 100, 4);
+ RNA_def_property_ui_text(
+ prop, "Sensor Width", "Horizontal size of the image sensor area in millimeters");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "sensor_height", PROP_FLOAT, PROP_DISTANCE_CAMERA);
+ RNA_def_property_float_sdna(prop, NULL, "sensor_y");
+ RNA_def_property_float_default(prop, 34.0f);
+ RNA_def_property_range(prop, 1.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1.0f, 100.f, 100, 4);
+ RNA_def_property_ui_text(
+ prop, "Sensor Height", "Vertical size of the image sensor area in millimeters");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "ortho_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ortho_scale");
+ RNA_def_property_float_default(prop, 6.0f);
+ RNA_def_property_range(prop, FLT_MIN, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, 10000.0f, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Orthographic Scale", "Orthographic Camera scale (similar to zoom)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "drawsize");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.01f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Display Size", "Apparent size of the Camera object in the 3D View");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "shift_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shiftx");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
+ RNA_def_property_ui_text(prop, "Shift X", "Camera horizontal shift");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "shift_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shifty");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_range(prop, -2.0, 2.0, 1, 3);
+ RNA_def_property_ui_text(prop, "Shift Y", "Camera vertical shift");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_update");
+
+ prop = RNA_def_property(srna, "dof_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2);
+ RNA_def_property_ui_text(prop, "DOF Distance", "Distance to the focus point for depth of field");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dof_update");
+
+ /* Stereo Settings */
+ prop = RNA_def_property(srna, "stereo", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "stereo");
+ RNA_def_property_struct_type(prop, "CameraStereoData");
+ RNA_def_property_ui_text(prop, "Stereo", "");
+
+ /* flag */
+ prop = RNA_def_property(srna, "show_limits", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWLIMITS);
+ RNA_def_property_ui_text(
+ prop, "Show Limits", "Display the clipping range and focus point on the camera");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_mist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWMIST);
+ RNA_def_property_ui_text(
+ prop, "Show Mist", "Display a line from the Camera to indicate the mist area");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_passepartout", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWPASSEPARTOUT);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(
+ prop, "Show Passepartout", "Show a darkened overlay outside the image area in Camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_MARGINS);
+ RNA_def_property_ui_text(
+ prop, "Show Safe Areas", "Show TV title safe and action safe areas in Camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_SAFE_CENTER);
+ RNA_def_property_ui_text(prop,
+ "Show Center-cut safe areas",
+ "Show safe areas to fit content in a different aspect ratio");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWNAME);
+ RNA_def_property_ui_text(prop, "Show Name", "Show the active Camera's name in Camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_sensor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOWSENSOR);
+ RNA_def_property_ui_text(
+ prop, "Show Sensor Size", "Show sensor size (film gate) in Camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_background_images", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAM_SHOW_BG_IMAGE);
+ RNA_def_property_ui_text(
+ prop, "Display Background Images", "Display reference images behind objects in the 3D View");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "lens_unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_lens_unit_items);
+ RNA_def_property_ui_text(prop, "Lens Unit", "Unit to edit lens in for the user interface");
+
+ /* dtx */
+ prop = RNA_def_property(srna, "show_composition_center", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER);
+ RNA_def_property_ui_text(
+ prop, "Center", "Display center composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_center_diagonal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_CENTER_DIAG);
+ RNA_def_property_ui_text(
+ prop, "Center Diagonal", "Display diagonal center composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_thirds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_THIRDS);
+ RNA_def_property_ui_text(
+ prop, "Thirds", "Display rule of thirds composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_golden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN);
+ RNA_def_property_ui_text(
+ prop, "Golden Ratio", "Display golden ratio composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_golden_tria_a", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_A);
+ RNA_def_property_ui_text(prop,
+ "Golden Triangle A",
+ "Display golden triangle A composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_golden_tria_b", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_GOLDEN_TRI_B);
+ RNA_def_property_ui_text(prop,
+ "Golden Triangle B",
+ "Display golden triangle B composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_harmony_tri_a", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_A);
+ RNA_def_property_ui_text(
+ prop, "Harmonious Triangle A", "Display harmony A composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "show_composition_harmony_tri_b", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", CAM_DTX_HARMONY_TRI_B);
+ RNA_def_property_ui_text(
+ prop, "Harmonious Triangle B", "Display harmony B composition guide inside the camera view");
+ RNA_def_property_update(prop, NC_CAMERA | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ /* pointers */
+ prop = RNA_def_property(srna, "dof_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_pointer_sdna(prop, NULL, "dof_ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "DOF Object", "Use this object to define the depth of field focal point");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Camera_dependency_update");
+
+ prop = RNA_def_property(srna, "gpu_dof", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "GPUDOFSettings");
+ RNA_def_property_ui_text(prop, "GPU Depth Of Field", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "background_images", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "bg_images", NULL);
+ RNA_def_property_struct_type(prop, "CameraBackgroundImage");
+ RNA_def_property_ui_text(prop, "Background Images", "List of background images");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ rna_def_animdata_common(srna);
+
+ rna_def_camera_background_image(brna);
+ rna_def_camera_background_images(brna, prop);
+
+ /* Nested Data */
+ RNA_define_animate_sdna(true);
+
+ /* *** Animated *** */
+ rna_def_camera_stereo_data(brna);
+
+ /* Camera API */
+ RNA_api_camera(srna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_camera_api.c b/source/blender/makesrna/intern/rna_camera_api.c
index 8e181fe3c68..cbbd8377c7f 100644
--- a/source/blender/makesrna/intern/rna_camera_api.c
+++ b/source/blender/makesrna/intern/rna_camera_api.c
@@ -18,64 +18,76 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "RNA_define.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "DNA_scene_types.h"
+# include "DNA_scene_types.h"
-#include "BKE_camera.h"
-#include "BKE_context.h"
-#include "BKE_object.h"
+# include "BKE_camera.h"
+# include "BKE_context.h"
+# include "BKE_object.h"
-static void rna_camera_view_frame(struct Camera *camera, struct Scene *scene,
- float r_vec1[3], float r_vec2[3], float r_vec3[3], float r_vec4[3])
+static void rna_camera_view_frame(struct Camera *camera,
+ struct Scene *scene,
+ float r_vec1[3],
+ float r_vec2[3],
+ float r_vec3[3],
+ float r_vec4[3])
{
- float vec[4][3];
+ float vec[4][3];
- BKE_camera_view_frame(scene, camera, vec);
+ BKE_camera_view_frame(scene, camera, vec);
- copy_v3_v3(r_vec1, vec[0]);
- copy_v3_v3(r_vec2, vec[1]);
- copy_v3_v3(r_vec3, vec[2]);
- copy_v3_v3(r_vec4, vec[3]);
+ copy_v3_v3(r_vec1, vec[0]);
+ copy_v3_v3(r_vec2, vec[1]);
+ copy_v3_v3(r_vec3, vec[2]);
+ copy_v3_v3(r_vec4, vec[3]);
}
#else
void RNA_api_camera(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
- RNA_def_function_ui_description(func, "Return 4 points for the cameras frame (before object transformation)");
-
- RNA_def_pointer(func, "scene", "Scene", "", "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
-
- /* return location and normal */
- parm = RNA_def_float_vector(func, "result_1", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
- RNA_def_property_flag(parm, PROP_THICK_WRAP);
- RNA_def_function_output(func, parm);
-
- parm = RNA_def_float_vector(func, "result_2", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
- RNA_def_property_flag(parm, PROP_THICK_WRAP);
- RNA_def_function_output(func, parm);
-
- parm = RNA_def_float_vector(func, "result_3", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
- RNA_def_property_flag(parm, PROP_THICK_WRAP);
- RNA_def_function_output(func, parm);
-
- parm = RNA_def_float_vector(func, "result_4", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
- RNA_def_property_flag(parm, PROP_THICK_WRAP);
- RNA_def_function_output(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "view_frame", "rna_camera_view_frame");
+ RNA_def_function_ui_description(
+ func, "Return 4 points for the cameras frame (before object transformation)");
+
+ RNA_def_pointer(func,
+ "scene",
+ "Scene",
+ "",
+ "Scene to use for aspect calculation, when omitted 1:1 aspect is used");
+
+ /* return location and normal */
+ parm = RNA_def_float_vector(
+ func, "result_1", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+ RNA_def_property_flag(parm, PROP_THICK_WRAP);
+ RNA_def_function_output(func, parm);
+
+ parm = RNA_def_float_vector(
+ func, "result_2", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+ RNA_def_property_flag(parm, PROP_THICK_WRAP);
+ RNA_def_function_output(func, parm);
+
+ parm = RNA_def_float_vector(
+ func, "result_3", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+ RNA_def_property_flag(parm, PROP_THICK_WRAP);
+ RNA_def_function_output(func, parm);
+
+ parm = RNA_def_float_vector(
+ func, "result_4", 3, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+ RNA_def_property_flag(parm, PROP_THICK_WRAP);
+ RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 279ed3910c2..b1a2ec32a88 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -39,809 +39,873 @@
#ifdef RNA_RUNTIME
-#include "BKE_context.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "BKE_context.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static void rna_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
static void rna_cloth_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
- rna_cloth_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ rna_cloth_update(bmain, scene, ptr);
}
static void rna_cloth_pinning_changed(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
-/* ClothSimSettings *settings = (ClothSimSettings *)ptr->data; */
- ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
+ Object *ob = (Object *)ptr->id.data;
+ /* ClothSimSettings *settings = (ClothSimSettings *)ptr->data; */
+ ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
- cloth_free_modifier(clmd);
+ cloth_free_modifier(clmd);
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
static void rna_ClothSettings_bending_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- settings->bending = value;
+ settings->bending = value;
- /* check for max clipping */
- if (value > settings->max_bend)
- settings->max_bend = value;
+ /* check for max clipping */
+ if (value > settings->max_bend)
+ settings->max_bend = value;
}
static void rna_ClothSettings_max_bend_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- /* check for clipping */
- if (value < settings->bending)
- value = settings->bending;
+ /* check for clipping */
+ if (value < settings->bending)
+ value = settings->bending;
- settings->max_bend = value;
+ settings->max_bend = value;
}
static void rna_ClothSettings_tension_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- settings->tension = value;
+ settings->tension = value;
- /* check for max clipping */
- if (value > settings->max_tension)
- settings->max_tension = value;
+ /* check for max clipping */
+ if (value > settings->max_tension)
+ settings->max_tension = value;
}
static void rna_ClothSettings_max_tension_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- /* check for clipping */
- if (value < settings->tension)
- value = settings->tension;
+ /* check for clipping */
+ if (value < settings->tension)
+ value = settings->tension;
- settings->max_tension = value;
+ settings->max_tension = value;
}
static void rna_ClothSettings_compression_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- settings->compression = value;
+ settings->compression = value;
- /* check for max clipping */
- if (value > settings->max_compression)
- settings->max_compression = value;
+ /* check for max clipping */
+ if (value > settings->max_compression)
+ settings->max_compression = value;
}
static void rna_ClothSettings_max_compression_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- /* check for clipping */
- if (value < settings->compression)
- value = settings->compression;
+ /* check for clipping */
+ if (value < settings->compression)
+ value = settings->compression;
- settings->max_compression = value;
+ settings->max_compression = value;
}
static void rna_ClothSettings_shear_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- settings->shear = value;
+ settings->shear = value;
- /* check for max clipping */
- if (value > settings->max_shear)
- settings->max_shear = value;
+ /* check for max clipping */
+ if (value > settings->max_shear)
+ settings->max_shear = value;
}
static void rna_ClothSettings_max_shear_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- /* check for clipping */
- if (value < settings->shear)
- value = settings->shear;
+ /* check for clipping */
+ if (value < settings->shear)
+ value = settings->shear;
- settings->max_shear = value;
+ settings->max_shear = value;
}
static void rna_ClothSettings_max_sewing_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- /* check for clipping */
- if (value < 0.0f)
- value = 0.0f;
+ /* check for clipping */
+ if (value < 0.0f)
+ value = 0.0f;
- settings->max_sewing = value;
+ settings->max_sewing = value;
}
static void rna_ClothSettings_shrink_min_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- settings->shrink_min = value;
+ settings->shrink_min = value;
- /* check for max clipping */
- if (value > settings->shrink_max)
- settings->shrink_max = value;
+ /* check for max clipping */
+ if (value > settings->shrink_max)
+ settings->shrink_max = value;
}
static void rna_ClothSettings_shrink_max_set(struct PointerRNA *ptr, float value)
{
- ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *settings = (ClothSimSettings *)ptr->data;
- /* check for clipping */
- if (value < settings->shrink_min)
- value = settings->shrink_min;
+ /* check for clipping */
+ if (value < settings->shrink_min)
+ value = settings->shrink_min;
- settings->shrink_max = value;
+ settings->shrink_max = value;
}
static void rna_ClothSettings_mass_vgroup_get(PointerRNA *ptr, char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_mass);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_mass);
}
static int rna_ClothSettings_mass_vgroup_length(PointerRNA *ptr)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, sim->vgroup_mass);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, sim->vgroup_mass);
}
static void rna_ClothSettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_mass);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_mass);
}
static void rna_ClothSettings_shrink_vgroup_get(PointerRNA *ptr, char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_shrink);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_shrink);
}
static int rna_ClothSettings_shrink_vgroup_length(PointerRNA *ptr)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, sim->vgroup_shrink);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, sim->vgroup_shrink);
}
static void rna_ClothSettings_shrink_vgroup_set(PointerRNA *ptr, const char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_shrink);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_shrink);
}
static void rna_ClothSettings_struct_vgroup_get(PointerRNA *ptr, char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_struct);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_struct);
}
static int rna_ClothSettings_struct_vgroup_length(PointerRNA *ptr)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, sim->vgroup_struct);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, sim->vgroup_struct);
}
static void rna_ClothSettings_struct_vgroup_set(PointerRNA *ptr, const char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_struct);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_struct);
}
static void rna_ClothSettings_shear_vgroup_get(PointerRNA *ptr, char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_shear);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_shear);
}
static int rna_ClothSettings_shear_vgroup_length(PointerRNA *ptr)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, sim->vgroup_shear);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, sim->vgroup_shear);
}
static void rna_ClothSettings_shear_vgroup_set(PointerRNA *ptr, const char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_shear);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_shear);
}
static void rna_ClothSettings_bend_vgroup_get(PointerRNA *ptr, char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_bend);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, sim->vgroup_bend);
}
static int rna_ClothSettings_bend_vgroup_length(PointerRNA *ptr)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, sim->vgroup_bend);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, sim->vgroup_bend);
}
static void rna_ClothSettings_bend_vgroup_set(PointerRNA *ptr, const char *value)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend);
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &sim->vgroup_bend);
}
-
static void rna_CollSettings_selfcol_vgroup_get(PointerRNA *ptr, char *value)
{
- ClothCollSettings *coll = (ClothCollSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, coll->vgroup_selfcol);
+ ClothCollSettings *coll = (ClothCollSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, coll->vgroup_selfcol);
}
static int rna_CollSettings_selfcol_vgroup_length(PointerRNA *ptr)
{
- ClothCollSettings *coll = (ClothCollSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, coll->vgroup_selfcol);
+ ClothCollSettings *coll = (ClothCollSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, coll->vgroup_selfcol);
}
static void rna_CollSettings_selfcol_vgroup_set(PointerRNA *ptr, const char *value)
{
- ClothCollSettings *coll = (ClothCollSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &coll->vgroup_selfcol);
+ ClothCollSettings *coll = (ClothCollSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &coll->vgroup_selfcol);
}
static PointerRNA rna_ClothSettings_rest_shape_key_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- return rna_object_shapekey_index_get(ob->data, sim->shapekey_rest);
+ return rna_object_shapekey_index_get(ob->data, sim->shapekey_rest);
}
static void rna_ClothSettings_rest_shape_key_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->id.data;
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- sim->shapekey_rest = rna_object_shapekey_index_set(ob->data, value, sim->shapekey_rest);
+ sim->shapekey_rest = rna_object_shapekey_index_set(ob->data, value, sim->shapekey_rest);
}
static void rna_ClothSettings_gravity_get(PointerRNA *ptr, float *values)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- values[0] = sim->gravity[0];
- values[1] = sim->gravity[1];
- values[2] = sim->gravity[2];
+ values[0] = sim->gravity[0];
+ values[1] = sim->gravity[1];
+ values[2] = sim->gravity[2];
}
static void rna_ClothSettings_gravity_set(PointerRNA *ptr, const float *values)
{
- ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
+ ClothSimSettings *sim = (ClothSimSettings *)ptr->data;
- sim->gravity[0] = values[0];
- sim->gravity[1] = values[1];
- sim->gravity[2] = values[2];
+ sim->gravity[0] = values[0];
+ sim->gravity[1] = values[1];
+ sim->gravity[2] = values[2];
}
static char *rna_ClothSettings_path(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
- if (md) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
- }
- else {
- return NULL;
- }
+ if (md) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
+ }
+ else {
+ return NULL;
+ }
}
static char *rna_ClothCollisionSettings_path(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md = modifiers_findByType(ob, eModifierType_Cloth);
- if (md) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].collision_settings", name_esc);
- }
- else {
- return NULL;
- }
+ if (md) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].collision_settings", name_esc);
+ }
+ else {
+ return NULL;
+ }
}
#else
static void rna_def_cloth_solver_result(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem status_items[] = {
- {BPH_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"},
- {BPH_SOLVER_NUMERICAL_ISSUE, "NUMERICAL_ISSUE", 0, "Numerical Issue", "The provided data did not satisfy the prerequisites"},
- {BPH_SOLVER_NO_CONVERGENCE, "NO_CONVERGENCE", 0, "No Convergence", "Iterative procedure did not converge"},
- {BPH_SOLVER_INVALID_INPUT, "INVALID_INPUT", 0, "Invalid Input", "The inputs are invalid, or the algorithm has been improperly called"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ClothSolverResult", NULL);
- RNA_def_struct_ui_text(srna, "Solver Result", "Result of cloth solver iteration");
-
- RNA_define_verify_sdna(0);
-
- prop = RNA_def_property(srna, "status", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, status_items);
- RNA_def_property_enum_sdna(prop, NULL, "status");
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Status", "Status of the solver iteration");
-
- prop = RNA_def_property(srna, "max_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Maximum Error", "Maximum error during substeps");
-
- prop = RNA_def_property(srna, "min_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Minimum Error", "Minimum error during substeps");
-
- prop = RNA_def_property(srna, "avg_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "avg_error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Average Error", "Average error during substeps");
-
- prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "max_iterations");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Maximum Iterations", "Maximum iterations during substeps");
-
- prop = RNA_def_property(srna, "min_iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "min_iterations");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Minimum Iterations", "Minimum iterations during substeps");
-
- prop = RNA_def_property(srna, "avg_iterations", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "avg_iterations");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Average Iterations", "Average iterations during substeps");
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem status_items[] = {
+ {BPH_SOLVER_SUCCESS, "SUCCESS", 0, "Success", "Computation was successful"},
+ {BPH_SOLVER_NUMERICAL_ISSUE,
+ "NUMERICAL_ISSUE",
+ 0,
+ "Numerical Issue",
+ "The provided data did not satisfy the prerequisites"},
+ {BPH_SOLVER_NO_CONVERGENCE,
+ "NO_CONVERGENCE",
+ 0,
+ "No Convergence",
+ "Iterative procedure did not converge"},
+ {BPH_SOLVER_INVALID_INPUT,
+ "INVALID_INPUT",
+ 0,
+ "Invalid Input",
+ "The inputs are invalid, or the algorithm has been improperly called"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ClothSolverResult", NULL);
+ RNA_def_struct_ui_text(srna, "Solver Result", "Result of cloth solver iteration");
+
+ RNA_define_verify_sdna(0);
+
+ prop = RNA_def_property(srna, "status", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, status_items);
+ RNA_def_property_enum_sdna(prop, NULL, "status");
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Status", "Status of the solver iteration");
+
+ prop = RNA_def_property(srna, "max_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Maximum Error", "Maximum error during substeps");
+
+ prop = RNA_def_property(srna, "min_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Minimum Error", "Minimum error during substeps");
+
+ prop = RNA_def_property(srna, "avg_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "avg_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error during substeps");
+
+ prop = RNA_def_property(srna, "max_iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "max_iterations");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Maximum Iterations", "Maximum iterations during substeps");
+
+ prop = RNA_def_property(srna, "min_iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "min_iterations");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Minimum Iterations", "Minimum iterations during substeps");
+
+ prop = RNA_def_property(srna, "avg_iterations", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "avg_iterations");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Iterations", "Average iterations during substeps");
+
+ RNA_define_verify_sdna(1);
}
static void rna_def_cloth_sim_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_bending_model_items[] = {
- {CLOTH_BENDING_ANGULAR, "ANGULAR", 0, "Angular", "Cloth model with angular bending springs"},
- {CLOTH_BENDING_LINEAR, "LINEAR", 0, "Linear", "Cloth model with linear bending springs (legacy)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ClothSettings", NULL);
- RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object");
- RNA_def_struct_sdna(srna, "ClothSimSettings");
- RNA_def_struct_path_func(srna, "rna_ClothSettings_path");
-
- /* goal */
-
- prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "mingoal");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Minimum",
- "Goal minimum, vertex group weights are scaled to match this range");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "maxgoal");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Maximum",
- "Goal maximum, vertex group weights are scaled to match this range");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "defgoal");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Default",
- "Default Goal (vertex target position) value, when no Vertex Group used");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "goalspring");
- RNA_def_property_range(prop, 0.0f, 0.999f);
- RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "goalfrict");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "velocity_smooth");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Internal Friction", "");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "collider_friction");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Collider Friction", "");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "density_target", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "density_target");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Target Density", "Maximum density of hair");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "density_strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "density_strength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Target Density Strength", "Influence of target density on the simulation");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- /* mass */
-
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ClothSettings_mass_vgroup_get", "rna_ClothSettings_mass_vgroup_length",
- "rna_ClothSettings_mass_vgroup_set");
- RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
- RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
-
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -100.0, 100.0);
- RNA_def_property_float_funcs(prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", NULL);
- RNA_def_property_ui_text(prop, "Gravity", "Gravity or external force vector");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- /* various */
-
- prop = RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "Cvi");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Air Damping", "Air has normally some thickness which slows falling things down");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "goalspring");
- RNA_def_property_range(prop, 0.0f, 50.0);
- RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame");
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_ui_range(prop, 1, 80, 1, -1);
- RNA_def_property_ui_text(prop, "Quality",
- "Quality of the simulation in steps per frame (higher is better quality but slower)");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "time_scale");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Speed", "Cloth speed is multiplied by this value");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "vertex_group_shrink", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ClothSettings_shrink_vgroup_get", "rna_ClothSettings_shrink_vgroup_length",
- "rna_ClothSettings_shrink_vgroup_set");
- RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "shrink_min");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_min_set", NULL);
- RNA_def_property_ui_text(prop, "Shrink Factor", "Factor by which to shrink cloth");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "shrink_max");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_max_set", NULL);
- RNA_def_property_ui_text(prop, "Shrink Factor Max", "Max amount to shrink cloth by");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "voxel_cell_size", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "voxel_cell_size");
- RNA_def_property_range(prop, 0.0001f, 10000.0f);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_ui_text(prop, "Voxel Grid Cell Size", "Size of the voxel grid cells for interaction effects");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- /* springs */
- prop = RNA_def_property(srna, "tension_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tension_damp");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Tension Spring Damping", "Amount of damping in stretching behavior");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "compression_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "compression_damp");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Compression Spring Damping", "Amount of damping in compression behavior");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "shear_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shear_damp");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Shear Spring Damping", "Amount of damping in shearing behavior");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "tension_stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tension");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_tension_set", NULL);
- RNA_def_property_ui_text(prop, "Tension Stiffness", "How much the material resists stretching");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "tension_stiffness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_tension");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_tension_set", NULL);
- RNA_def_property_ui_text(prop, "Tension Stiffness Maximum", "Maximum tension stiffness value");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "compression_stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "compression");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_compression_set", NULL);
- RNA_def_property_ui_text(prop, "Compression Stiffness", "How much the material resists compression");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "compression_stiffness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_compression");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_compression_set", NULL);
- RNA_def_property_ui_text(prop, "Compression Stiffness Maximum", "Maximum compression stiffness value");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shear");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shear_set", NULL);
- RNA_def_property_ui_text(prop, "Shear Stiffness", "How much the material resists shearing");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_shear");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_shear_set", NULL);
- RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "sewing_force_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_sewing");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_sewing_set", NULL);
- RNA_def_property_ui_text(prop, "Sewing Force Max", "Maximum sewing force");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ClothSettings_struct_vgroup_get",
- "rna_ClothSettings_struct_vgroup_length",
- "rna_ClothSettings_struct_vgroup_set");
- RNA_def_property_ui_text(prop, "Structural Stiffness Vertex Group",
- "Vertex group for fine control over structural stiffness");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "vertex_group_shear_stiffness", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ClothSettings_shear_vgroup_get",
- "rna_ClothSettings_shear_vgroup_length",
- "rna_ClothSettings_shear_vgroup_set");
- RNA_def_property_ui_text(prop, "Shear Stiffness Vertex Group",
- "Vertex group for fine control over shear stiffness");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bending");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_bending_set", NULL);
- RNA_def_property_ui_text(prop, "Bending Stiffness", "How much the material resists bending");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_bend");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_bend_set", NULL);
- RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "bending_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bending_damping");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Bending Spring Damping", "Amount of damping in bending behavior");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "use_sewing_springs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SEW);
- RNA_def_property_ui_text(prop, "Sew Cloth", "Pulls loose edges together");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ClothSettings_bend_vgroup_get", "rna_ClothSettings_bend_vgroup_length",
- "rna_ClothSettings_bend_vgroup_set");
- RNA_def_property_ui_text(prop, "Bending Stiffness Vertex Group",
- "Vertex group for fine control over bending stiffness");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EffectorWeights");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Weights", "");
-
- prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "ShapeKey");
- RNA_def_property_pointer_funcs(prop, "rna_ClothSettings_rest_shape_key_get",
- "rna_ClothSettings_rest_shape_key_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Rest Shape Key", "Shape key to use the rest spring lengths from");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "use_dynamic_mesh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH);
- RNA_def_property_ui_text(prop, "Dynamic Base Mesh", "Make simulation respect deformations in the base mesh");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "bending_model", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bending_model");
- RNA_def_property_enum_items(prop, prop_bending_model_items);
- RNA_def_property_ui_text(prop, "Bending Model", "Physical model for simulating bending forces");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- /* unused */
-
- /* unused still */
-#if 0
- prop = RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "eff_force_scale");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Effector Force Scale", "");
-#endif
- /* unused still */
-#if 0
- prop = RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "eff_wind_scale");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Effector Wind Scale", "");
-#endif
- /* unused still */
-#if 0
- prop = RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_TEARING);
- RNA_def_property_ui_text(prop, "Tearing", "");
-#endif
- /* unused still */
-#if 0
- prop = RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "maxspringlen");
- RNA_def_property_range(prop, 1.0, 1000.0);
- RNA_def_property_ui_text(prop, "Maximum Spring Extension", "Maximum extension before spring gets cut");
-#endif
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_bending_model_items[] = {
+ {CLOTH_BENDING_ANGULAR, "ANGULAR", 0, "Angular", "Cloth model with angular bending springs"},
+ {CLOTH_BENDING_LINEAR,
+ "LINEAR",
+ 0,
+ "Linear",
+ "Cloth model with linear bending springs (legacy)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ClothSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Cloth Settings", "Cloth simulation settings for an object");
+ RNA_def_struct_sdna(srna, "ClothSimSettings");
+ RNA_def_struct_path_func(srna, "rna_ClothSettings_path");
+
+ /* goal */
+
+ prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "mingoal");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Goal Minimum", "Goal minimum, vertex group weights are scaled to match this range");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "maxgoal");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Goal Maximum", "Goal maximum, vertex group weights are scaled to match this range");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "defgoal");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Goal Default",
+ "Default Goal (vertex target position) value, when no Vertex Group used");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "goalspring");
+ RNA_def_property_range(prop, 0.0f, 0.999f);
+ RNA_def_property_ui_text(
+ prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "goalfrict");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "internal_friction", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "velocity_smooth");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Internal Friction", "");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "collider_friction", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "collider_friction");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Collider Friction", "");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "density_target", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "density_target");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Target Density", "Maximum density of hair");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "density_strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "density_strength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Target Density Strength", "Influence of target density on the simulation");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ /* mass */
+
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Mass", "Mass of cloth material");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ClothSettings_mass_vgroup_get",
+ "rna_ClothSettings_mass_vgroup_length",
+ "rna_ClothSettings_mass_vgroup_set");
+ RNA_def_property_ui_text(prop, "Mass Vertex Group", "Vertex Group for pinning of vertices");
+ RNA_def_property_update(prop, 0, "rna_cloth_pinning_changed");
+
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -100.0, 100.0);
+ RNA_def_property_float_funcs(
+ prop, "rna_ClothSettings_gravity_get", "rna_ClothSettings_gravity_set", NULL);
+ RNA_def_property_ui_text(prop, "Gravity", "Gravity or external force vector");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ /* various */
+
+ prop = RNA_def_property(srna, "air_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "Cvi");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(
+ prop, "Air Damping", "Air has normally some thickness which slows falling things down");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "pin_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "goalspring");
+ RNA_def_property_range(prop, 0.0f, 50.0);
+ RNA_def_property_ui_text(prop, "Pin Stiffness", "Pin (vertex target position) spring stiffness");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "stepsPerFrame");
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_range(prop, 1, 80, 1, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Quality",
+ "Quality of the simulation in steps per frame (higher is better quality but slower)");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "time_scale");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Speed", "Cloth speed is multiplied by this value");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "vertex_group_shrink", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ClothSettings_shrink_vgroup_get",
+ "rna_ClothSettings_shrink_vgroup_length",
+ "rna_ClothSettings_shrink_vgroup_set");
+ RNA_def_property_ui_text(prop, "Shrink Vertex Group", "Vertex Group for shrinking cloth");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "shrink_min", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "shrink_min");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_min_set", NULL);
+ RNA_def_property_ui_text(prop, "Shrink Factor", "Factor by which to shrink cloth");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "shrink_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "shrink_max");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shrink_max_set", NULL);
+ RNA_def_property_ui_text(prop, "Shrink Factor Max", "Max amount to shrink cloth by");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "voxel_cell_size", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "voxel_cell_size");
+ RNA_def_property_range(prop, 0.0001f, 10000.0f);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(
+ prop, "Voxel Grid Cell Size", "Size of the voxel grid cells for interaction effects");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ /* springs */
+ prop = RNA_def_property(srna, "tension_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tension_damp");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(
+ prop, "Tension Spring Damping", "Amount of damping in stretching behavior");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "compression_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "compression_damp");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(
+ prop, "Compression Spring Damping", "Amount of damping in compression behavior");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "shear_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shear_damp");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(prop, "Shear Spring Damping", "Amount of damping in shearing behavior");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "tension_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tension");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_tension_set", NULL);
+ RNA_def_property_ui_text(prop, "Tension Stiffness", "How much the material resists stretching");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "tension_stiffness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_tension");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_tension_set", NULL);
+ RNA_def_property_ui_text(prop, "Tension Stiffness Maximum", "Maximum tension stiffness value");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "compression_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "compression");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_compression_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Compression Stiffness", "How much the material resists compression");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "compression_stiffness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_compression");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_compression_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Compression Stiffness Maximum", "Maximum compression stiffness value");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "shear_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shear");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_shear_set", NULL);
+ RNA_def_property_ui_text(prop, "Shear Stiffness", "How much the material resists shearing");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "shear_stiffness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_shear");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_shear_set", NULL);
+ RNA_def_property_ui_text(prop, "Shear Stiffness Maximum", "Maximum shear scaling value");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "sewing_force_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_sewing");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_sewing_set", NULL);
+ RNA_def_property_ui_text(prop, "Sewing Force Max", "Maximum sewing force");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "vertex_group_structural_stiffness", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ClothSettings_struct_vgroup_get",
+ "rna_ClothSettings_struct_vgroup_length",
+ "rna_ClothSettings_struct_vgroup_set");
+ RNA_def_property_ui_text(prop,
+ "Structural Stiffness Vertex Group",
+ "Vertex group for fine control over structural stiffness");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "vertex_group_shear_stiffness", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ClothSettings_shear_vgroup_get",
+ "rna_ClothSettings_shear_vgroup_length",
+ "rna_ClothSettings_shear_vgroup_set");
+ RNA_def_property_ui_text(
+ prop, "Shear Stiffness Vertex Group", "Vertex group for fine control over shear stiffness");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "bending_stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bending");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_bending_set", NULL);
+ RNA_def_property_ui_text(prop, "Bending Stiffness", "How much the material resists bending");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "bending_stiffness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_bend");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_ClothSettings_max_bend_set", NULL);
+ RNA_def_property_ui_text(prop, "Bending Stiffness Maximum", "Maximum bending stiffness value");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "bending_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bending_damping");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop, "Bending Spring Damping", "Amount of damping in bending behavior");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "use_sewing_springs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_SEW);
+ RNA_def_property_ui_text(prop, "Sew Cloth", "Pulls loose edges together");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "vertex_group_bending", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ClothSettings_bend_vgroup_get",
+ "rna_ClothSettings_bend_vgroup_length",
+ "rna_ClothSettings_bend_vgroup_set");
+ RNA_def_property_ui_text(prop,
+ "Bending Stiffness Vertex Group",
+ "Vertex group for fine control over bending stiffness");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ prop = RNA_def_property(srna, "rest_shape_key", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "ShapeKey");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_ClothSettings_rest_shape_key_get",
+ "rna_ClothSettings_rest_shape_key_set",
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Rest Shape Key", "Shape key to use the rest spring lengths from");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "use_dynamic_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH);
+ RNA_def_property_ui_text(
+ prop, "Dynamic Base Mesh", "Make simulation respect deformations in the base mesh");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "bending_model", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bending_model");
+ RNA_def_property_enum_items(prop, prop_bending_model_items);
+ RNA_def_property_ui_text(prop, "Bending Model", "Physical model for simulating bending forces");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ /* unused */
+
+ /* unused still */
+# if 0
+ prop = RNA_def_property(srna, "effector_force_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eff_force_scale");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Effector Force Scale", "");
+# endif
+ /* unused still */
+# if 0
+ prop = RNA_def_property(srna, "effector_wind_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eff_wind_scale");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Effector Wind Scale", "");
+# endif
+ /* unused still */
+# if 0
+ prop = RNA_def_property(srna, "tearing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_TEARING);
+ RNA_def_property_ui_text(prop, "Tearing", "");
+# endif
+ /* unused still */
+# if 0
+ prop = RNA_def_property(srna, "max_spring_extensions", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "maxspringlen");
+ RNA_def_property_range(prop, 1.0, 1000.0);
+ RNA_def_property_ui_text(prop, "Maximum Spring Extension", "Maximum extension before spring gets cut");
+# endif
}
static void rna_def_cloth_collision_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL);
- RNA_def_struct_ui_text(srna, "Cloth Collision Settings",
- "Cloth simulation settings for self collision and collision with other objects");
- RNA_def_struct_sdna(srna, "ClothCollSettings");
- RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path");
-
- /* general collision */
-
- prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_ENABLED);
- RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "epsilon");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_ui_text(prop, "Minimum Distance",
- "Minimum distance between collision objects before collision response takes effect");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 80.0f);
- RNA_def_property_ui_text(prop, "Friction", "Friction force if a collision happened (higher = less movement)");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "damping");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Restitution", "Amount of velocity lost on collision");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "loop_count");
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_range(prop, 1, 20, 1, -1);
- RNA_def_property_ui_text(prop, "Collision Quality",
- "How many collision iterations should be done. (higher is better quality but slower)");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "impulse_clamp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clamp");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Impulse Clamping", "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- /* self collision */
-
- prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_SELF);
- RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "selfepsilon");
- RNA_def_property_range(prop, 0.001f, 0.1f);
- RNA_def_property_ui_text(prop, "Self Minimum Distance", "Minimum distance between cloth faces before collision response takes effect");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 80.0f);
- RNA_def_property_ui_text(prop, "Self Friction", "Friction with self contact");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "group");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this Collection");
- RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group_self_collisions", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_CollSettings_selfcol_vgroup_get", "rna_CollSettings_selfcol_vgroup_length",
- "rna_CollSettings_selfcol_vgroup_set");
- RNA_def_property_ui_text(prop, "Selfcollision Vertex Group",
- "Vertex group to define vertices which are not used during self collisions");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
-
- prop = RNA_def_property(srna, "self_impulse_clamp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "self_clamp");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Impulse Clamping", "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
- RNA_def_property_update(prop, 0, "rna_cloth_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ClothCollisionSettings", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "Cloth Collision Settings",
+ "Cloth simulation settings for self collision and collision with other objects");
+ RNA_def_struct_sdna(srna, "ClothCollSettings");
+ RNA_def_struct_path_func(srna, "rna_ClothCollisionSettings_path");
+
+ /* general collision */
+
+ prop = RNA_def_property(srna, "use_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_ENABLED);
+ RNA_def_property_ui_text(prop, "Enable Collision", "Enable collisions with other objects");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "epsilon");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Minimum Distance",
+ "Minimum distance between collision objects before collision response takes effect");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 80.0f);
+ RNA_def_property_ui_text(
+ prop, "Friction", "Friction force if a collision happened (higher = less movement)");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "damping");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Restitution", "Amount of velocity lost on collision");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "collision_quality", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "loop_count");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, 20, 1, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Collision Quality",
+ "How many collision iterations should be done. (higher is better quality but slower)");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "impulse_clamp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clamp");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Impulse Clamping",
+ "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ /* self collision */
+
+ prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_COLLSETTINGS_FLAG_SELF);
+ RNA_def_property_ui_text(prop, "Enable Self Collision", "Enable self collisions");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "self_distance_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "selfepsilon");
+ RNA_def_property_range(prop, 0.001f, 0.1f);
+ RNA_def_property_ui_text(
+ prop,
+ "Self Minimum Distance",
+ "Minimum distance between cloth faces before collision response takes effect");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "self_friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 80.0f);
+ RNA_def_property_ui_text(prop, "Self Friction", "Friction with self contact");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this Collection");
+ RNA_def_property_update(prop, 0, "rna_cloth_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group_self_collisions", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_CollSettings_selfcol_vgroup_get",
+ "rna_CollSettings_selfcol_vgroup_length",
+ "rna_CollSettings_selfcol_vgroup_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Selfcollision Vertex Group",
+ "Vertex group to define vertices which are not used during self collisions");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
+ prop = RNA_def_property(srna, "self_impulse_clamp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "self_clamp");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Impulse Clamping",
+ "Clamp collision impulses to avoid instability (0.0 to disable clamping)");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
}
void RNA_def_cloth(BlenderRNA *brna)
{
- rna_def_cloth_solver_result(brna);
- rna_def_cloth_sim_settings(brna);
- rna_def_cloth_collision_settings(brna);
+ rna_def_cloth_solver_result(brna);
+ rna_def_cloth_sim_settings(brna);
+ rna_def_cloth_collision_settings(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_collection.c b/source/blender/makesrna/intern/rna_collection.c
index f98bbc90a9d..0a1dc503cac 100644
--- a/source/blender/makesrna/intern/rna_collection.c
+++ b/source/blender/makesrna/intern/rna_collection.c
@@ -32,212 +32,250 @@
#ifdef RNA_RUNTIME
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
+# include "DNA_scene_types.h"
+# include "DNA_object_types.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "BKE_collection.h"
-#include "BKE_global.h"
-#include "BKE_layer.h"
+# include "BKE_collection.h"
+# include "BKE_global.h"
+# include "BKE_layer.h"
-#include "WM_api.h"
+# include "WM_api.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
static void rna_Collection_all_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Collection *collection = (Collection *)ptr->data;
- ListBase collection_objects = BKE_collection_object_cache_get(collection);
- rna_iterator_listbase_begin(iter, &collection_objects, NULL);
+ Collection *collection = (Collection *)ptr->data;
+ ListBase collection_objects = BKE_collection_object_cache_get(collection);
+ rna_iterator_listbase_begin(iter, &collection_objects, NULL);
}
static PointerRNA rna_Collection_all_objects_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- /* we are actually iterating a ObjectBase list, so override get */
- Base *base = (Base *)internal->link;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
+ /* we are actually iterating a ObjectBase list, so override get */
+ Base *base = (Base *)internal->link;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
}
static void rna_Collection_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Collection *collection = (Collection *)ptr->data;
- rna_iterator_listbase_begin(iter, &collection->gobject, NULL);
+ Collection *collection = (Collection *)ptr->data;
+ rna_iterator_listbase_begin(iter, &collection->gobject, NULL);
}
static PointerRNA rna_Collection_objects_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- /* we are actually iterating a ObjectBase list, so override get */
- CollectionObject *cob = (CollectionObject *)internal->link;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, cob->ob);
+ /* we are actually iterating a ObjectBase list, so override get */
+ CollectionObject *cob = (CollectionObject *)internal->link;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, cob->ob);
}
-static void rna_Collection_objects_link(Collection *collection, Main *bmain, ReportList *reports, Object *object)
+static void rna_Collection_objects_link(Collection *collection,
+ Main *bmain,
+ ReportList *reports,
+ Object *object)
{
- if (!BKE_collection_object_add(bmain, collection, object)) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' already in collection '%s'", object->id.name + 2, collection->id.name + 2);
- return;
- }
-
- DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
+ if (!BKE_collection_object_add(bmain, collection, object)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' already in collection '%s'",
+ object->id.name + 2,
+ collection->id.name + 2);
+ return;
+ }
+
+ DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
}
-static void rna_Collection_objects_unlink(Collection *collection, Main *bmain, ReportList *reports, Object *object)
+static void rna_Collection_objects_unlink(Collection *collection,
+ Main *bmain,
+ ReportList *reports,
+ Object *object)
{
- if (!BKE_collection_object_remove(bmain, collection, object, false)) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in collection '%s'", object->id.name + 2, collection->id.name + 2);
- return;
- }
-
- DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
+ if (!BKE_collection_object_remove(bmain, collection, object, false)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in collection '%s'",
+ object->id.name + 2,
+ collection->id.name + 2);
+ return;
+ }
+
+ DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
}
-static bool rna_Collection_objects_override_apply(
- Main *bmain,
- PointerRNA *ptr_dst, PointerRNA *UNUSED(ptr_src), PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
- const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
- PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
+static bool rna_Collection_objects_override_apply(Main *bmain,
+ PointerRNA *ptr_dst,
+ PointerRNA *UNUSED(ptr_src),
+ PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *UNUSED(prop_src),
+ PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst),
+ const int UNUSED(len_src),
+ const int UNUSED(len_storage),
+ PointerRNA *ptr_item_dst,
+ PointerRNA *ptr_item_src,
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
{
- (void)opop;
- BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
- "Unsupported RNA override operation on collections' objects");
+ (void)opop;
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
+ "Unsupported RNA override operation on collections' objects");
- Collection *coll_dst = ptr_dst->id.data;
+ Collection *coll_dst = ptr_dst->id.data;
- if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
- BLI_assert(0 && "invalid source or destination object.");
- return false;
- }
+ if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
+ BLI_assert(0 && "invalid source or destination object.");
+ return false;
+ }
- Object *ob_dst = ptr_item_dst->data;
- Object *ob_src = ptr_item_src->data;
+ Object *ob_dst = ptr_item_dst->data;
+ Object *ob_src = ptr_item_src->data;
- CollectionObject *cob_dst = BLI_findptr(&coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob));
+ CollectionObject *cob_dst = BLI_findptr(
+ &coll_dst->gobject, ob_dst, offsetof(CollectionObject, ob));
- if (cob_dst == NULL) {
- BLI_assert(0 && "Could not find destination object in destination collection!");
- return false;
- }
+ if (cob_dst == NULL) {
+ BLI_assert(0 && "Could not find destination object in destination collection!");
+ return false;
+ }
- /* XXX TODO We most certainly rather want to have a 'swap object pointer in collection' util in BKE_collection...
- * This is only temp auick dirty test! */
- id_us_min(&cob_dst->ob->id);
- cob_dst->ob = ob_src;
- id_us_plus(&cob_dst->ob->id);
+ /* XXX TODO We most certainly rather want to have a 'swap object pointer in collection' util in BKE_collection...
+ * This is only temp auick dirty test! */
+ id_us_min(&cob_dst->ob->id);
+ cob_dst->ob = ob_src;
+ id_us_plus(&cob_dst->ob->id);
- if (BKE_collection_is_in_scene(coll_dst)) {
- BKE_main_collection_sync(bmain);
- }
+ if (BKE_collection_is_in_scene(coll_dst)) {
+ BKE_main_collection_sync(bmain);
+ }
- return true;
+ return true;
}
-
-
-
static void rna_Collection_children_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Collection *collection = (Collection *)ptr->data;
- rna_iterator_listbase_begin(iter, &collection->children, NULL);
+ Collection *collection = (Collection *)ptr->data;
+ rna_iterator_listbase_begin(iter, &collection->children, NULL);
}
static PointerRNA rna_Collection_children_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- /* we are actually iterating a CollectionChild list, so override get */
- CollectionChild *child = (CollectionChild *)internal->link;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Collection, child->collection);
+ /* we are actually iterating a CollectionChild list, so override get */
+ CollectionChild *child = (CollectionChild *)internal->link;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Collection, child->collection);
}
-static void rna_Collection_children_link(Collection *collection, Main *bmain, ReportList *reports, Collection *child)
+static void rna_Collection_children_link(Collection *collection,
+ Main *bmain,
+ ReportList *reports,
+ Collection *child)
{
- if (!BKE_collection_child_add(bmain, collection, child)) {
- BKE_reportf(reports, RPT_ERROR, "Collection '%s' already in collection '%s'", child->id.name + 2, collection->id.name + 2);
- return;
- }
-
- DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
+ if (!BKE_collection_child_add(bmain, collection, child)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Collection '%s' already in collection '%s'",
+ child->id.name + 2,
+ collection->id.name + 2);
+ return;
+ }
+
+ DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
}
-static void rna_Collection_children_unlink(Collection *collection, Main *bmain, ReportList *reports, Collection *child)
+static void rna_Collection_children_unlink(Collection *collection,
+ Main *bmain,
+ ReportList *reports,
+ Collection *child)
{
- if (!BKE_collection_child_remove(bmain, collection, child)) {
- BKE_reportf(reports, RPT_ERROR, "Collection '%s' not in collection '%s'", child->id.name + 2, collection->id.name + 2);
- return;
- }
-
- DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
+ if (!BKE_collection_child_remove(bmain, collection, child)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Collection '%s' not in collection '%s'",
+ child->id.name + 2,
+ collection->id.name + 2);
+ return;
+ }
+
+ DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
}
-static bool rna_Collection_children_override_apply(
- Main *bmain,
- PointerRNA *ptr_dst, PointerRNA *UNUSED(ptr_src), PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
- const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
- PointerRNA *ptr_item_dst, PointerRNA *ptr_item_src, PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
+static bool rna_Collection_children_override_apply(Main *bmain,
+ PointerRNA *ptr_dst,
+ PointerRNA *UNUSED(ptr_src),
+ PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *UNUSED(prop_src),
+ PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst),
+ const int UNUSED(len_src),
+ const int UNUSED(len_storage),
+ PointerRNA *ptr_item_dst,
+ PointerRNA *ptr_item_src,
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
{
- (void)opop;
- BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
- "Unsupported RNA override operation on collections' objects");
+ (void)opop;
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_REPLACE &&
+ "Unsupported RNA override operation on collections' objects");
- Collection *coll_dst = ptr_dst->id.data;
+ Collection *coll_dst = ptr_dst->id.data;
- if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
- BLI_assert(0 && "invalid source or destination sub-collection.");
- return false;
- }
+ if (ptr_item_dst->type == NULL || ptr_item_src->type == NULL) {
+ BLI_assert(0 && "invalid source or destination sub-collection.");
+ return false;
+ }
- Collection *subcoll_dst = ptr_item_dst->data;
- Collection *subcoll_src = ptr_item_src->data;
+ Collection *subcoll_dst = ptr_item_dst->data;
+ Collection *subcoll_src = ptr_item_src->data;
- CollectionChild *collchild_dst = BLI_findptr(&coll_dst->children, subcoll_dst, offsetof(CollectionChild, collection));
+ CollectionChild *collchild_dst = BLI_findptr(
+ &coll_dst->children, subcoll_dst, offsetof(CollectionChild, collection));
- if (collchild_dst == NULL) {
- BLI_assert(0 && "Could not find destination sub-collection in destination collection!");
- return false;
- }
+ if (collchild_dst == NULL) {
+ BLI_assert(0 && "Could not find destination sub-collection in destination collection!");
+ return false;
+ }
- /* XXX TODO We most certainly rather want to have a 'swap object pointer in collection' util in BKE_collection...
- * This is only temp auick dirty test! */
- id_us_min(&collchild_dst->collection->id);
- collchild_dst->collection = subcoll_src;
- id_us_plus(&collchild_dst->collection->id);
+ /* XXX TODO We most certainly rather want to have a 'swap object pointer in collection' util in BKE_collection...
+ * This is only temp auick dirty test! */
+ id_us_min(&collchild_dst->collection->id);
+ collchild_dst->collection = subcoll_src;
+ id_us_plus(&collchild_dst->collection->id);
- BKE_collection_object_cache_free(coll_dst);
- BKE_main_collection_sync(bmain);
+ BKE_collection_object_cache_free(coll_dst);
+ BKE_main_collection_sync(bmain);
- return true;
+ return true;
}
-
-
-
static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Collection *collection = (Collection *)ptr->data;
- BKE_collection_object_cache_free(collection);
- BKE_main_collection_sync(bmain);
+ Collection *collection = (Collection *)ptr->data;
+ BKE_collection_object_cache_free(collection);
+ BKE_main_collection_sync(bmain);
- DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
+ DEG_id_tag_update(&collection->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
}
#else
@@ -245,131 +283,145 @@ static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *pt
/* collection.objects */
static void rna_def_collection_objects(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "CollectionObjects");
- srna = RNA_def_struct(brna, "CollectionObjects", NULL);
- RNA_def_struct_sdna(srna, "Collection");
- RNA_def_struct_ui_text(srna, "Collection Objects", "Collection of collection objects");
-
- /* add object */
- func = RNA_def_function(srna, "link", "rna_Collection_objects_link");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Add this object to a collection");
- parm = RNA_def_pointer(func, "object", "Object", "", "Object to add");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* remove object */
- func = RNA_def_function(srna, "unlink", "rna_Collection_objects_unlink");
- RNA_def_function_ui_description(func, "Remove this object from a collection");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "CollectionObjects");
+ srna = RNA_def_struct(brna, "CollectionObjects", NULL);
+ RNA_def_struct_sdna(srna, "Collection");
+ RNA_def_struct_ui_text(srna, "Collection Objects", "Collection of collection objects");
+
+ /* add object */
+ func = RNA_def_function(srna, "link", "rna_Collection_objects_link");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add this object to a collection");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object to add");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* remove object */
+ func = RNA_def_function(srna, "unlink", "rna_Collection_objects_unlink");
+ RNA_def_function_ui_description(func, "Remove this object from a collection");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
/* collection.children */
static void rna_def_collection_children(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "CollectionChildren");
- srna = RNA_def_struct(brna, "CollectionChildren", NULL);
- RNA_def_struct_sdna(srna, "Collection");
- RNA_def_struct_ui_text(srna, "Collection Children", "Collection of child collections");
-
- /* add child */
- func = RNA_def_function(srna, "link", "rna_Collection_children_link");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Add this collection as child of this collection");
- parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to add");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* remove child */
- func = RNA_def_function(srna, "unlink", "rna_Collection_children_unlink");
- RNA_def_function_ui_description(func, "Remove this child collection from a collection");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to remove");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "CollectionChildren");
+ srna = RNA_def_struct(brna, "CollectionChildren", NULL);
+ RNA_def_struct_sdna(srna, "Collection");
+ RNA_def_struct_ui_text(srna, "Collection Children", "Collection of child collections");
+
+ /* add child */
+ func = RNA_def_function(srna, "link", "rna_Collection_children_link");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add this collection as child of this collection");
+ parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to add");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* remove child */
+ func = RNA_def_function(srna, "unlink", "rna_Collection_children_unlink");
+ RNA_def_function_ui_description(func, "Remove this child collection from a collection");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to remove");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
-
void RNA_def_collections(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Collection", "ID");
- RNA_def_struct_ui_text(srna, "Collection", "Collection of Object data-blocks");
- RNA_def_struct_ui_icon(srna, ICON_GROUP);
- /* this is done on save/load in readfile.c, removed if no objects are in the collection and not in a scene */
- RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
-
- prop = RNA_def_property(srna, "instance_offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_ui_text(prop, "Instance Offset", "Offset from the origin to use when instancing");
- RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_objects_override_apply");
- RNA_def_property_ui_text(prop, "Objects", "Objects that are directly in this collection");
- RNA_def_property_collection_funcs(prop, "rna_Collection_objects_begin",
- "rna_iterator_listbase_next",
- "rna_iterator_listbase_end",
- "rna_Collection_objects_get",
- NULL, NULL, NULL, NULL);
- rna_def_collection_objects(brna, prop);
-
- prop = RNA_def_property(srna, "all_objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "All Objects", "Objects that are in this collection and its child collections");
- RNA_def_property_collection_funcs(prop, "rna_Collection_all_objects_begin",
- "rna_iterator_listbase_next",
- "rna_iterator_listbase_end",
- "rna_Collection_all_objects_get",
- NULL, NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_children_override_apply");
- RNA_def_property_ui_text(prop, "Children", "Collections that are immediate children of this collection");
- RNA_def_property_collection_funcs(prop, "rna_Collection_children_begin",
- "rna_iterator_listbase_next",
- "rna_iterator_listbase_end",
- "rna_Collection_children_get",
- NULL, NULL, NULL, NULL);
- rna_def_collection_children(brna, prop);
-
- /* Flags */
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
- RNA_def_property_ui_text(prop, "Disable Select", "Disable collection for viewport selection");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
-
- prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEW);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
- RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
-
- prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
- RNA_def_property_ui_text(prop, "Disable Render", "Disable collection in renders");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Collection", "ID");
+ RNA_def_struct_ui_text(srna, "Collection", "Collection of Object data-blocks");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP);
+ /* this is done on save/load in readfile.c, removed if no objects are in the collection and not in a scene */
+ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+
+ prop = RNA_def_property(srna, "instance_offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_ui_text(
+ prop, "Instance Offset", "Offset from the origin to use when instancing");
+ RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_objects_override_apply");
+ RNA_def_property_ui_text(prop, "Objects", "Objects that are directly in this collection");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Collection_objects_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_Collection_objects_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ rna_def_collection_objects(brna, prop);
+
+ prop = RNA_def_property(srna, "all_objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_ui_text(
+ prop, "All Objects", "Objects that are in this collection and its child collections");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Collection_all_objects_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_Collection_all_objects_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Collection_children_override_apply");
+ RNA_def_property_ui_text(
+ prop, "Children", "Collections that are immediate children of this collection");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Collection_children_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_Collection_children_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ rna_def_collection_children(brna, prop);
+
+ /* Flags */
+ prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
+ RNA_def_property_ui_text(prop, "Disable Select", "Disable collection for viewport selection");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
+
+ prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEW);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
+ RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
+
+ prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
+ RNA_def_property_ui_text(prop, "Disable Render", "Disable collection in renders");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c
index faf9a99ace1..2e540e8b105 100644
--- a/source/blender/makesrna/intern/rna_color.c
+++ b/source/blender/makesrna/intern/rna_color.c
@@ -34,1155 +34,1244 @@
#ifdef RNA_RUNTIME
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "DNA_image_types.h"
-#include "DNA_material_types.h"
-#include "DNA_movieclip_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_sequence_types.h"
+# include "DNA_image_types.h"
+# include "DNA_material_types.h"
+# include "DNA_movieclip_types.h"
+# include "DNA_node_types.h"
+# include "DNA_object_types.h"
+# include "DNA_particle_types.h"
+# include "DNA_sequence_types.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "BKE_colorband.h"
-#include "BKE_colortools.h"
-#include "BKE_image.h"
-#include "BKE_movieclip.h"
-#include "BKE_node.h"
-#include "BKE_sequencer.h"
-#include "BKE_linestyle.h"
+# include "BKE_colorband.h"
+# include "BKE_colortools.h"
+# include "BKE_image.h"
+# include "BKE_movieclip.h"
+# include "BKE_node.h"
+# include "BKE_sequencer.h"
+# include "BKE_linestyle.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_node.h"
+# include "ED_node.h"
-#include "IMB_colormanagement.h"
-#include "IMB_imbuf.h"
+# include "IMB_colormanagement.h"
+# include "IMB_imbuf.h"
static int rna_CurveMapping_curves_length(PointerRNA *ptr)
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
- int len;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
+ int len;
- for (len = 0; len < CM_TOT; len++)
- if (!cumap->cm[len].curve)
- break;
+ for (len = 0; len < CM_TOT; len++)
+ if (!cumap->cm[len].curve)
+ break;
- return len;
+ return len;
}
static void rna_CurveMapping_curves_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
- rna_iterator_array_begin(iter, cumap->cm, sizeof(CurveMap), rna_CurveMapping_curves_length(ptr), 0, NULL);
+ rna_iterator_array_begin(
+ iter, cumap->cm, sizeof(CurveMap), rna_CurveMapping_curves_length(ptr), 0, NULL);
}
static void rna_CurveMapping_clip_set(PointerRNA *ptr, bool value)
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
- if (value) cumap->flag |= CUMA_DO_CLIP;
- else cumap->flag &= ~CUMA_DO_CLIP;
+ if (value)
+ cumap->flag |= CUMA_DO_CLIP;
+ else
+ cumap->flag &= ~CUMA_DO_CLIP;
- curvemapping_changed(cumap, false);
+ curvemapping_changed(cumap, false);
}
static void rna_CurveMapping_black_level_set(PointerRNA *ptr, const float *values)
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
- cumap->black[0] = values[0];
- cumap->black[1] = values[1];
- cumap->black[2] = values[2];
- curvemapping_set_black_white(cumap, NULL, NULL);
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
+ cumap->black[0] = values[0];
+ cumap->black[1] = values[1];
+ cumap->black[2] = values[2];
+ curvemapping_set_black_white(cumap, NULL, NULL);
}
static void rna_CurveMapping_white_level_set(PointerRNA *ptr, const float *values)
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
- cumap->white[0] = values[0];
- cumap->white[1] = values[1];
- cumap->white[2] = values[2];
- curvemapping_set_black_white(cumap, NULL, NULL);
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
+ cumap->white[0] = values[0];
+ cumap->white[1] = values[1];
+ cumap->white[2] = values[2];
+ curvemapping_set_black_white(cumap, NULL, NULL);
}
-static void rna_CurveMapping_tone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_CurveMapping_tone_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
}
-static void rna_CurveMapping_clipminx_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_CurveMapping_clipminx_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
- *min = -100.0f;
- *max = cumap->clipr.xmax;
+ *min = -100.0f;
+ *max = cumap->clipr.xmax;
}
-static void rna_CurveMapping_clipminy_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_CurveMapping_clipminy_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
- *min = -100.0f;
- *max = cumap->clipr.ymax;
+ *min = -100.0f;
+ *max = cumap->clipr.ymax;
}
-static void rna_CurveMapping_clipmaxx_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_CurveMapping_clipmaxx_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
- *min = cumap->clipr.xmin;
- *max = 100.0f;
+ *min = cumap->clipr.xmin;
+ *max = 100.0f;
}
-static void rna_CurveMapping_clipmaxy_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_CurveMapping_clipmaxy_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- CurveMapping *cumap = (CurveMapping *)ptr->data;
+ CurveMapping *cumap = (CurveMapping *)ptr->data;
- *min = cumap->clipr.ymin;
- *max = 100.0f;
+ *min = cumap->clipr.ymin;
+ *max = 100.0f;
}
-
static char *rna_ColorRamp_path(PointerRNA *ptr)
{
- char *path = NULL;
-
- /* handle the cases where a single data-block may have 2 ramp types */
- if (ptr->id.data) {
- ID *id = ptr->id.data;
-
- switch (GS(id->name)) {
- case ID_NT:
- {
- bNodeTree *ntree = (bNodeTree *)id;
- bNode *node;
- PointerRNA node_ptr;
- char *node_path;
-
- for (node = ntree->nodes.first; node; node = node->next) {
- if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
- if (node->storage == ptr->data) {
- /* all node color ramp properties called 'color_ramp'
- * prepend path from ID to the node
- */
- RNA_pointer_create(id, &RNA_Node, node, &node_ptr);
- node_path = RNA_path_from_ID_to_struct(&node_ptr);
- path = BLI_sprintfN("%s.color_ramp", node_path);
- MEM_freeN(node_path);
- }
- }
- }
- break;
- }
-
- case ID_LS:
- {
- /* may be NULL */
- path = BKE_linestyle_path_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data);
- break;
- }
-
- default:
- /* everything else just uses 'color_ramp' */
- path = BLI_strdup("color_ramp");
- break;
- }
- }
- else {
- /* everything else just uses 'color_ramp' */
- path = BLI_strdup("color_ramp");
- }
-
- return path;
+ char *path = NULL;
+
+ /* handle the cases where a single data-block may have 2 ramp types */
+ if (ptr->id.data) {
+ ID *id = ptr->id.data;
+
+ switch (GS(id->name)) {
+ case ID_NT: {
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNode *node;
+ PointerRNA node_ptr;
+ char *node_path;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
+ if (node->storage == ptr->data) {
+ /* all node color ramp properties called 'color_ramp'
+ * prepend path from ID to the node
+ */
+ RNA_pointer_create(id, &RNA_Node, node, &node_ptr);
+ node_path = RNA_path_from_ID_to_struct(&node_ptr);
+ path = BLI_sprintfN("%s.color_ramp", node_path);
+ MEM_freeN(node_path);
+ }
+ }
+ }
+ break;
+ }
+
+ case ID_LS: {
+ /* may be NULL */
+ path = BKE_linestyle_path_to_color_ramp((FreestyleLineStyle *)id, (ColorBand *)ptr->data);
+ break;
+ }
+
+ default:
+ /* everything else just uses 'color_ramp' */
+ path = BLI_strdup("color_ramp");
+ break;
+ }
+ }
+ else {
+ /* everything else just uses 'color_ramp' */
+ path = BLI_strdup("color_ramp");
+ }
+
+ return path;
}
static char *rna_ColorRampElement_path(PointerRNA *ptr)
{
- PointerRNA ramp_ptr;
- PropertyRNA *prop;
- char *path = NULL;
- int index;
-
- /* helper macro for use here to try and get the path
- * - this calls the standard code for getting a path to a texture...
- */
-
-#define COLRAMP_GETPATH \
-{ \
- prop = RNA_struct_find_property(&ramp_ptr, "elements"); \
- if (prop) { \
- index = RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \
- if (index != -1) { \
- char *texture_path = rna_ColorRamp_path(&ramp_ptr); \
- path = BLI_sprintfN("%s.elements[%d]", texture_path, index); \
- MEM_freeN(texture_path); \
- } \
- } \
-} (void)0
-
- /* determine the path from the ID-block to the ramp */
- /* FIXME: this is a very slow way to do it, but it will have to suffice... */
- if (ptr->id.data) {
- ID *id = ptr->id.data;
-
- switch (GS(id->name)) {
- case ID_NT:
- {
- bNodeTree *ntree = (bNodeTree *)id;
- bNode *node;
-
- for (node = ntree->nodes.first; node; node = node->next) {
- if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
- RNA_pointer_create(id, &RNA_ColorRamp, node->storage, &ramp_ptr);
- COLRAMP_GETPATH;
- }
- }
- break;
- }
- case ID_LS:
- {
- ListBase listbase;
- LinkData *link;
-
- BKE_linestyle_modifier_list_color_ramps((FreestyleLineStyle *)id, &listbase);
- for (link = (LinkData *)listbase.first; link; link = link->next) {
- RNA_pointer_create(id, &RNA_ColorRamp, link->data, &ramp_ptr);
- COLRAMP_GETPATH;
- }
- BLI_freelistN(&listbase);
- break;
- }
-
- default: /* everything else should have a "color_ramp" property */
- {
- /* create pointer to the ID block, and try to resolve "color_ramp" pointer */
- RNA_id_pointer_create(id, &ramp_ptr);
- if (RNA_path_resolve(&ramp_ptr, "color_ramp", &ramp_ptr, &prop)) {
- COLRAMP_GETPATH;
- }
- break;
- }
- }
- }
-
- /* cleanup the macro we defined */
-#undef COLRAMP_GETPATH
-
- return path;
+ PointerRNA ramp_ptr;
+ PropertyRNA *prop;
+ char *path = NULL;
+ int index;
+
+ /* helper macro for use here to try and get the path
+ * - this calls the standard code for getting a path to a texture...
+ */
+
+# define COLRAMP_GETPATH \
+ { \
+ prop = RNA_struct_find_property(&ramp_ptr, "elements"); \
+ if (prop) { \
+ index = RNA_property_collection_lookup_index(&ramp_ptr, prop, ptr); \
+ if (index != -1) { \
+ char *texture_path = rna_ColorRamp_path(&ramp_ptr); \
+ path = BLI_sprintfN("%s.elements[%d]", texture_path, index); \
+ MEM_freeN(texture_path); \
+ } \
+ } \
+ } \
+ (void)0
+
+ /* determine the path from the ID-block to the ramp */
+ /* FIXME: this is a very slow way to do it, but it will have to suffice... */
+ if (ptr->id.data) {
+ ID *id = ptr->id.data;
+
+ switch (GS(id->name)) {
+ case ID_NT: {
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
+ RNA_pointer_create(id, &RNA_ColorRamp, node->storage, &ramp_ptr);
+ COLRAMP_GETPATH;
+ }
+ }
+ break;
+ }
+ case ID_LS: {
+ ListBase listbase;
+ LinkData *link;
+
+ BKE_linestyle_modifier_list_color_ramps((FreestyleLineStyle *)id, &listbase);
+ for (link = (LinkData *)listbase.first; link; link = link->next) {
+ RNA_pointer_create(id, &RNA_ColorRamp, link->data, &ramp_ptr);
+ COLRAMP_GETPATH;
+ }
+ BLI_freelistN(&listbase);
+ break;
+ }
+
+ default: /* everything else should have a "color_ramp" property */
+ {
+ /* create pointer to the ID block, and try to resolve "color_ramp" pointer */
+ RNA_id_pointer_create(id, &ramp_ptr);
+ if (RNA_path_resolve(&ramp_ptr, "color_ramp", &ramp_ptr, &prop)) {
+ COLRAMP_GETPATH;
+ }
+ break;
+ }
+ }
+ }
+
+ /* cleanup the macro we defined */
+# undef COLRAMP_GETPATH
+
+ return path;
}
static void rna_ColorRamp_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- if (ptr->id.data) {
- ID *id = ptr->id.data;
-
- switch (GS(id->name)) {
- case ID_MA:
- {
- Material *ma = ptr->id.data;
-
- DEG_id_tag_update(&ma->id, 0);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
- break;
- }
- case ID_NT:
- {
- bNodeTree *ntree = (bNodeTree *)id;
- bNode *node;
-
- for (node = ntree->nodes.first; node; node = node->next) {
- if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
- ED_node_tag_update_nodetree(bmain, ntree, node);
- }
- }
- break;
- }
- case ID_TE:
- {
- Tex *tex = ptr->id.data;
-
- DEG_id_tag_update(&tex->id, 0);
- WM_main_add_notifier(NC_TEXTURE, tex);
- break;
- }
- case ID_LS:
- {
- FreestyleLineStyle *linestyle = ptr->id.data;
-
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
- break;
- }
- case ID_PA:
- {
- ParticleSettings *part = ptr->id.data;
-
- DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, part);
- }
- default:
- break;
- }
- }
+ if (ptr->id.data) {
+ ID *id = ptr->id.data;
+
+ switch (GS(id->name)) {
+ case ID_MA: {
+ Material *ma = ptr->id.data;
+
+ DEG_id_tag_update(&ma->id, 0);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
+ break;
+ }
+ case ID_NT: {
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (ELEM(node->type, SH_NODE_VALTORGB, CMP_NODE_VALTORGB, TEX_NODE_VALTORGB)) {
+ ED_node_tag_update_nodetree(bmain, ntree, node);
+ }
+ }
+ break;
+ }
+ case ID_TE: {
+ Tex *tex = ptr->id.data;
+
+ DEG_id_tag_update(&tex->id, 0);
+ WM_main_add_notifier(NC_TEXTURE, tex);
+ break;
+ }
+ case ID_LS: {
+ FreestyleLineStyle *linestyle = ptr->id.data;
+
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ break;
+ }
+ case ID_PA: {
+ ParticleSettings *part = ptr->id.data;
+
+ DEG_id_tag_update(&part->id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_REDO);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, part);
+ }
+ default:
+ break;
+ }
+ }
}
static void rna_ColorRamp_eval(struct ColorBand *coba, float position, float color[4])
{
- BKE_colorband_evaluate(coba, position, color);
+ BKE_colorband_evaluate(coba, position, color);
}
-static CBData *rna_ColorRampElement_new(struct ColorBand *coba, ReportList *reports, float position)
+static CBData *rna_ColorRampElement_new(struct ColorBand *coba,
+ ReportList *reports,
+ float position)
{
- CBData *element = BKE_colorband_element_add(coba, position);
+ CBData *element = BKE_colorband_element_add(coba, position);
- if (element == NULL)
- BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND);
+ if (element == NULL)
+ BKE_reportf(reports, RPT_ERROR, "Unable to add element to colorband (limit %d)", MAXCOLORBAND);
- return element;
+ return element;
}
-static void rna_ColorRampElement_remove(struct ColorBand *coba, ReportList *reports, PointerRNA *element_ptr)
+static void rna_ColorRampElement_remove(struct ColorBand *coba,
+ ReportList *reports,
+ PointerRNA *element_ptr)
{
- CBData *element = element_ptr->data;
- int index = (int)(element - coba->data);
- if (BKE_colorband_element_remove(coba, index) == false) {
- BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element");
- return;
- }
-
- RNA_POINTER_INVALIDATE(element_ptr);
+ CBData *element = element_ptr->data;
+ int index = (int)(element - coba->data);
+ if (BKE_colorband_element_remove(coba, index) == false) {
+ BKE_report(reports, RPT_ERROR, "Element not found in element collection or last element");
+ return;
+ }
+
+ RNA_POINTER_INVALIDATE(element_ptr);
}
static void rna_CurveMap_remove_point(CurveMap *cuma, ReportList *reports, PointerRNA *point_ptr)
{
- CurveMapPoint *point = point_ptr->data;
- if (curvemap_remove_point(cuma, point) == false) {
- BKE_report(reports, RPT_ERROR, "Unable to remove curve point");
- return;
- }
+ CurveMapPoint *point = point_ptr->data;
+ if (curvemap_remove_point(cuma, point) == false) {
+ BKE_report(reports, RPT_ERROR, "Unable to remove curve point");
+ return;
+ }
- RNA_POINTER_INVALIDATE(point_ptr);
+ RNA_POINTER_INVALIDATE(point_ptr);
}
static void rna_Scopes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scopes *s = (Scopes *)ptr->data;
- s->ok = 0;
+ Scopes *s = (Scopes *)ptr->data;
+ s->ok = 0;
}
static int rna_ColorManagedDisplaySettings_display_device_get(struct PointerRNA *ptr)
{
- ColorManagedDisplaySettings *display = (ColorManagedDisplaySettings *) ptr->data;
+ ColorManagedDisplaySettings *display = (ColorManagedDisplaySettings *)ptr->data;
- return IMB_colormanagement_display_get_named_index(display->display_device);
+ return IMB_colormanagement_display_get_named_index(display->display_device);
}
static void rna_ColorManagedDisplaySettings_display_device_set(struct PointerRNA *ptr, int value)
{
- ColorManagedDisplaySettings *display = (ColorManagedDisplaySettings *) ptr->data;
- const char *name = IMB_colormanagement_display_get_indexed_name(value);
+ ColorManagedDisplaySettings *display = (ColorManagedDisplaySettings *)ptr->data;
+ const char *name = IMB_colormanagement_display_get_indexed_name(value);
- if (name) {
- BLI_strncpy(display->display_device, name, sizeof(display->display_device));
- }
+ if (name) {
+ BLI_strncpy(display->display_device, name, sizeof(display->display_device));
+ }
}
static const EnumPropertyItem *rna_ColorManagedDisplaySettings_display_device_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
- EnumPropertyItem *items = NULL;
- int totitem = 0;
+ EnumPropertyItem *items = NULL;
+ int totitem = 0;
- IMB_colormanagement_display_items_add(&items, &totitem);
- RNA_enum_item_end(&items, &totitem);
+ IMB_colormanagement_display_items_add(&items, &totitem);
+ RNA_enum_item_end(&items, &totitem);
- *r_free = true;
+ *r_free = true;
- return items;
+ return items;
}
-static void rna_ColorManagedDisplaySettings_display_device_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_ColorManagedDisplaySettings_display_device_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- if (!id)
- return;
+ if (!id)
+ return;
- if (GS(id->name) == ID_SCE) {
- Scene *scene = (Scene *) id;
+ if (GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *)id;
- IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings);
+ IMB_colormanagement_validate_settings(&scene->display_settings, &scene->view_settings);
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
- /* Color management can be baked into shaders, need to refresh. */
- for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
- }
- }
+ /* Color management can be baked into shaders, need to refresh. */
+ for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ }
+ }
}
static char *rna_ColorManagedDisplaySettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("display_settings");
+ return BLI_strdup("display_settings");
}
static int rna_ColorManagedViewSettings_view_transform_get(PointerRNA *ptr)
{
- ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *)ptr->data;
- return IMB_colormanagement_view_get_named_index(view->view_transform);
+ return IMB_colormanagement_view_get_named_index(view->view_transform);
}
static void rna_ColorManagedViewSettings_view_transform_set(PointerRNA *ptr, int value)
{
- ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *)ptr->data;
- const char *name = IMB_colormanagement_view_get_indexed_name(value);
+ const char *name = IMB_colormanagement_view_get_indexed_name(value);
- if (name) {
- BLI_strncpy(view->view_transform, name, sizeof(view->view_transform));
- }
+ if (name) {
+ BLI_strncpy(view->view_transform, name, sizeof(view->view_transform));
+ }
}
static const EnumPropertyItem *rna_ColorManagedViewSettings_view_transform_itemf(
- bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
- Scene *scene = CTX_data_scene(C);
- EnumPropertyItem *items = NULL;
- ColorManagedDisplaySettings *display_settings = &scene->display_settings;
- int totitem = 0;
+ Scene *scene = CTX_data_scene(C);
+ EnumPropertyItem *items = NULL;
+ ColorManagedDisplaySettings *display_settings = &scene->display_settings;
+ int totitem = 0;
- IMB_colormanagement_view_items_add(&items, &totitem, display_settings->display_device);
- RNA_enum_item_end(&items, &totitem);
+ IMB_colormanagement_view_items_add(&items, &totitem, display_settings->display_device);
+ RNA_enum_item_end(&items, &totitem);
- *r_free = true;
- return items;
+ *r_free = true;
+ return items;
}
static int rna_ColorManagedViewSettings_look_get(PointerRNA *ptr)
{
- ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *)ptr->data;
- return IMB_colormanagement_look_get_named_index(view->look);
+ return IMB_colormanagement_look_get_named_index(view->look);
}
static void rna_ColorManagedViewSettings_look_set(PointerRNA *ptr, int value)
{
- ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *)ptr->data;
- const char *name = IMB_colormanagement_look_get_indexed_name(value);
+ const char *name = IMB_colormanagement_look_get_indexed_name(value);
- if (name) {
- BLI_strncpy(view->look, name, sizeof(view->look));
- }
+ if (name) {
+ BLI_strncpy(view->look, name, sizeof(view->look));
+ }
}
-static const EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_ColorManagedViewSettings_look_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- ColorManagedViewSettings *view = (ColorManagedViewSettings *) ptr->data;
- EnumPropertyItem *items = NULL;
- int totitem = 0;
+ ColorManagedViewSettings *view = (ColorManagedViewSettings *)ptr->data;
+ EnumPropertyItem *items = NULL;
+ int totitem = 0;
- IMB_colormanagement_look_items_add(&items, &totitem, view->view_transform);
- RNA_enum_item_end(&items, &totitem);
+ IMB_colormanagement_look_items_add(&items, &totitem, view->view_transform);
+ RNA_enum_item_end(&items, &totitem);
- *r_free = true;
- return items;
+ *r_free = true;
+ return items;
}
static void rna_ColorManagedViewSettings_use_curves_set(PointerRNA *ptr, bool value)
{
- ColorManagedViewSettings *view_settings = (ColorManagedViewSettings *) ptr->data;
-
- if (value) {
- view_settings->flag |= COLORMANAGE_VIEW_USE_CURVES;
-
- if (view_settings->curve_mapping == NULL) {
- view_settings->curve_mapping = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
- }
- }
- else {
- view_settings->flag &= ~COLORMANAGE_VIEW_USE_CURVES;
- }
+ ColorManagedViewSettings *view_settings = (ColorManagedViewSettings *)ptr->data;
+
+ if (value) {
+ view_settings->flag |= COLORMANAGE_VIEW_USE_CURVES;
+
+ if (view_settings->curve_mapping == NULL) {
+ view_settings->curve_mapping = curvemapping_add(4, 0.0f, 0.0f, 1.0f, 1.0f);
+ }
+ }
+ else {
+ view_settings->flag &= ~COLORMANAGE_VIEW_USE_CURVES;
+ }
}
static char *rna_ColorManagedViewSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("view_settings");
+ return BLI_strdup("view_settings");
}
-
static int rna_ColorManagedColorspaceSettings_colorspace_get(struct PointerRNA *ptr)
{
- ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *) ptr->data;
+ ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *)ptr->data;
- return IMB_colormanagement_colorspace_get_named_index(colorspace->name);
+ return IMB_colormanagement_colorspace_get_named_index(colorspace->name);
}
static void rna_ColorManagedColorspaceSettings_colorspace_set(struct PointerRNA *ptr, int value)
{
- ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *) ptr->data;
- const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
+ ColorManagedColorspaceSettings *colorspace = (ColorManagedColorspaceSettings *)ptr->data;
+ const char *name = IMB_colormanagement_colorspace_get_indexed_name(value);
- if (name && name[0]) {
- BLI_strncpy(colorspace->name, name, sizeof(colorspace->name));
- }
+ if (name && name[0]) {
+ BLI_strncpy(colorspace->name, name, sizeof(colorspace->name));
+ }
}
static const EnumPropertyItem *rna_ColorManagedColorspaceSettings_colorspace_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
{
- EnumPropertyItem *items = NULL;
- int totitem = 0;
+ EnumPropertyItem *items = NULL;
+ int totitem = 0;
- IMB_colormanagement_colorspace_items_add(&items, &totitem);
- RNA_enum_item_end(&items, &totitem);
+ IMB_colormanagement_colorspace_items_add(&items, &totitem);
+ RNA_enum_item_end(&items, &totitem);
- *r_free = true;
+ *r_free = true;
- return items;
+ return items;
}
-static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_ColorManagedColorspaceSettings_reload_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ID *id = ptr->id.data;
-
- if (GS(id->name) == ID_IM) {
- Image *ima = (Image *) id;
-
- DEG_id_tag_update(&ima->id, 0);
-
- BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE);
-
- WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
- WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
- }
- else if (GS(id->name) == ID_MC) {
- MovieClip *clip = (MovieClip *) id;
-
- BKE_movieclip_reload(bmain, clip);
-
- /* all sequencers for now, we don't know which scenes are using this clip as a strip */
- BKE_sequencer_cache_cleanup();
- BKE_sequencer_preprocessed_cache_cleanup();
-
- WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, &clip->id);
- }
- else if (GS(id->name) == ID_SCE) {
- Scene *scene = (Scene *) id;
-
- if (scene->ed) {
- ColorManagedColorspaceSettings *colorspace_settings = (ColorManagedColorspaceSettings *) ptr->data;
- Sequence *seq;
- bool seq_found = false;
-
- if (&scene->sequencer_colorspace_settings != colorspace_settings) {
- SEQ_BEGIN(scene->ed, seq);
- {
- if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
- seq_found = true;
- break;
- }
- }
- SEQ_END;
- }
-
- if (seq_found) {
- BKE_sequence_free_anim(seq);
-
- if (seq->strip->proxy && seq->strip->proxy->anim) {
- IMB_free_anim(seq->strip->proxy->anim);
- seq->strip->proxy->anim = NULL;
- }
-
- BKE_sequence_invalidate_cache(scene, seq);
- BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
- }
- else {
- SEQ_BEGIN(scene->ed, seq);
- {
- BKE_sequence_free_anim(seq);
- }
- SEQ_END;
-
- BKE_sequencer_cache_cleanup();
- BKE_sequencer_preprocessed_cache_cleanup();
- }
-
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
- }
- }
+ ID *id = ptr->id.data;
+
+ if (GS(id->name) == ID_IM) {
+ Image *ima = (Image *)id;
+
+ DEG_id_tag_update(&ima->id, 0);
+
+ BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE);
+
+ WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
+ WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
+ }
+ else if (GS(id->name) == ID_MC) {
+ MovieClip *clip = (MovieClip *)id;
+
+ BKE_movieclip_reload(bmain, clip);
+
+ /* all sequencers for now, we don't know which scenes are using this clip as a strip */
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
+
+ WM_main_add_notifier(NC_MOVIECLIP | ND_DISPLAY, &clip->id);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, &clip->id);
+ }
+ else if (GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *)id;
+
+ if (scene->ed) {
+ ColorManagedColorspaceSettings *colorspace_settings = (ColorManagedColorspaceSettings *)
+ ptr->data;
+ Sequence *seq;
+ bool seq_found = false;
+
+ if (&scene->sequencer_colorspace_settings != colorspace_settings) {
+ SEQ_BEGIN (scene->ed, seq)
+ ;
+ {
+ if (seq->strip && &seq->strip->colorspace_settings == colorspace_settings) {
+ seq_found = true;
+ break;
+ }
+ }
+ SEQ_END;
+ }
+
+ if (seq_found) {
+ BKE_sequence_free_anim(seq);
+
+ if (seq->strip->proxy && seq->strip->proxy->anim) {
+ IMB_free_anim(seq->strip->proxy->anim);
+ seq->strip->proxy->anim = NULL;
+ }
+
+ BKE_sequence_invalidate_cache(scene, seq);
+ BKE_sequencer_preprocessed_cache_cleanup_sequence(seq);
+ }
+ else {
+ SEQ_BEGIN (scene->ed, seq)
+ ;
+ {
+ BKE_sequence_free_anim(seq);
+ }
+ SEQ_END;
+
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
+ }
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
+ }
}
static char *rna_ColorManagedSequencerColorspaceSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("sequencer_colorspace_settings");
+ return BLI_strdup("sequencer_colorspace_settings");
}
static char *rna_ColorManagedInputColorspaceSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("colorspace_settings");
+ return BLI_strdup("colorspace_settings");
}
static void rna_ColorManagement_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- if (!id)
- return;
+ if (!id)
+ return;
- if (GS(id->name) == ID_SCE) {
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
- }
+ if (GS(id->name) == ID_SCE) {
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ }
}
/* this function only exists because #curvemap_evaluateF uses a 'const' qualifier */
static float rna_CurveMap_evaluateF(struct CurveMap *cuma, ReportList *reports, float value)
{
- if (!cuma->table) {
- BKE_report(reports, RPT_ERROR, "CurveMap table not initialized, call initialize() on CurveMapping owner of the CurveMap");
- return 0.0f;
- }
- return curvemap_evaluateF(cuma, value);
+ if (!cuma->table) {
+ BKE_report(
+ reports,
+ RPT_ERROR,
+ "CurveMap table not initialized, call initialize() on CurveMapping owner of the CurveMap");
+ return 0.0f;
+ }
+ return curvemap_evaluateF(cuma, value);
}
static void rna_CurveMap_initialize(struct CurveMapping *cumap)
{
- curvemapping_initialize(cumap);
+ curvemapping_initialize(cumap);
}
#else
static void rna_def_curvemappoint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static const EnumPropertyItem prop_handle_type_items[] = {
- {0, "AUTO", 0, "Auto Handle", ""},
- {CUMA_HANDLE_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped Handle", ""},
- {CUMA_HANDLE_VECTOR, "VECTOR", 0, "Vector Handle", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CurveMapPoint", NULL);
- RNA_def_struct_ui_text(srna, "CurveMapPoint", "Point of a curve used for a curve mapping");
-
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Location", "X/Y coordinates of the curve point");
-
- prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_handle_type_items);
- RNA_def_property_ui_text(prop, "Handle Type", "Curve interpolation at this point: Bezier or vector");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_SELECT);
- RNA_def_property_ui_text(prop, "Select", "Selection state of the curve point");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static const EnumPropertyItem prop_handle_type_items[] = {
+ {0, "AUTO", 0, "Auto Handle", ""},
+ {CUMA_HANDLE_AUTO_ANIM, "AUTO_CLAMPED", 0, "Auto Clamped Handle", ""},
+ {CUMA_HANDLE_VECTOR, "VECTOR", 0, "Vector Handle", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CurveMapPoint", NULL);
+ RNA_def_struct_ui_text(srna, "CurveMapPoint", "Point of a curve used for a curve mapping");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Location", "X/Y coordinates of the curve point");
+
+ prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_handle_type_items);
+ RNA_def_property_ui_text(
+ prop, "Handle Type", "Curve interpolation at this point: Bezier or vector");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Selection state of the curve point");
}
static void rna_def_curvemap_points_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "CurveMapPoints");
- srna = RNA_def_struct(brna, "CurveMapPoints", NULL);
- RNA_def_struct_sdna(srna, "CurveMap");
- RNA_def_struct_ui_text(srna, "Curve Map Point", "Collection of Curve Map Points");
-
- func = RNA_def_function(srna, "new", "curvemap_insert");
- RNA_def_function_ui_description(func, "Add point to CurveMap");
- parm = RNA_def_float(func, "position", 0.0f, -FLT_MAX, FLT_MAX, "Position", "Position to add point", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "Value", "Value of point", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "New point");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_CurveMap_remove_point");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Delete point from CurveMap");
- parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "PointElement to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "CurveMapPoints");
+ srna = RNA_def_struct(brna, "CurveMapPoints", NULL);
+ RNA_def_struct_sdna(srna, "CurveMap");
+ RNA_def_struct_ui_text(srna, "Curve Map Point", "Collection of Curve Map Points");
+
+ func = RNA_def_function(srna, "new", "curvemap_insert");
+ RNA_def_function_ui_description(func, "Add point to CurveMap");
+ parm = RNA_def_float(func,
+ "position",
+ 0.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "Position",
+ "Position to add point",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(
+ func, "value", 0.0f, -FLT_MAX, FLT_MAX, "Value", "Value of point", -FLT_MAX, FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "New point");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_CurveMap_remove_point");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Delete point from CurveMap");
+ parm = RNA_def_pointer(func, "point", "CurveMapPoint", "", "PointElement to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_curvemap(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop, *parm;
- FunctionRNA *func;
-
- static const EnumPropertyItem prop_extend_items[] = {
- {0, "HORIZONTAL", 0, "Horizontal", ""},
- {CUMA_EXTEND_EXTRAPOLATE, "EXTRAPOLATED", 0, "Extrapolated", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CurveMap", NULL);
- RNA_def_struct_ui_text(srna, "CurveMap", "Curve in a curve mapping");
-
- prop = RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_extend_items);
- RNA_def_property_ui_text(prop, "Extend", "Extrapolate the curve or extend it horizontally");
-
- prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "curve", "totpoint");
- RNA_def_property_struct_type(prop, "CurveMapPoint");
- RNA_def_property_ui_text(prop, "Points", "");
- rna_def_curvemap_points_api(brna, prop);
-
- func = RNA_def_function(srna, "evaluate", "rna_CurveMap_evaluateF");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Evaluate curve at given location");
- parm = RNA_def_float(func, "position", 0.0f, -FLT_MAX, FLT_MAX, "Position", "Position to evaluate curve at", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "Value", "Value of curve at given location", -FLT_MAX, FLT_MAX);
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop, *parm;
+ FunctionRNA *func;
+
+ static const EnumPropertyItem prop_extend_items[] = {
+ {0, "HORIZONTAL", 0, "Horizontal", ""},
+ {CUMA_EXTEND_EXTRAPOLATE, "EXTRAPOLATED", 0, "Extrapolated", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CurveMap", NULL);
+ RNA_def_struct_ui_text(srna, "CurveMap", "Curve in a curve mapping");
+
+ prop = RNA_def_property(srna, "extend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_extend_items);
+ RNA_def_property_ui_text(prop, "Extend", "Extrapolate the curve or extend it horizontally");
+
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "curve", "totpoint");
+ RNA_def_property_struct_type(prop, "CurveMapPoint");
+ RNA_def_property_ui_text(prop, "Points", "");
+ rna_def_curvemap_points_api(brna, prop);
+
+ func = RNA_def_function(srna, "evaluate", "rna_CurveMap_evaluateF");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Evaluate curve at given location");
+ parm = RNA_def_float(func,
+ "position",
+ 0.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "Position",
+ "Position to evaluate curve at",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(func,
+ "value",
+ 0.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "Value",
+ "Value of curve at given location",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_function_return(func, parm);
}
static void rna_def_curvemapping(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
-
- static const EnumPropertyItem tone_items[] = {
- {CURVE_TONE_STANDARD, "STANDARD", 0, "Standard", ""},
- {CURVE_TONE_FILMLIKE, "FILMLIKE", 0, "Film like", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CurveMapping", NULL);
- RNA_def_struct_ui_text(srna, "CurveMapping",
- "Curve mapping to map color, vector and scalar values to other values using "
- "a user defined curve");
-
- prop = RNA_def_property(srna, "tone", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tone");
- RNA_def_property_enum_items(prop, tone_items);
- RNA_def_property_ui_text(prop, "Tone", "Tone of the curve");
- RNA_def_property_update(prop, 0, "rna_CurveMapping_tone_update");
-
-
- prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP);
- RNA_def_property_ui_text(prop, "Clip", "Force the curve view to fit a defined boundary");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_CurveMapping_clip_set");
-
- prop = RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clipr.xmin");
- RNA_def_property_range(prop, -100.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Clip Min X", "");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminx_range");
-
- prop = RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clipr.ymin");
- RNA_def_property_range(prop, -100.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Clip Min Y", "");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminy_range");
-
- prop = RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clipr.xmax");
- RNA_def_property_range(prop, -100.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Clip Max X", "");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxx_range");
-
- prop = RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clipr.ymax");
- RNA_def_property_range(prop, -100.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Clip Max Y", "");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
-
- prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_CurveMapping_curves_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_CurveMapping_curves_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "CurveMap");
- RNA_def_property_ui_text(prop, "Curves", "");
-
- prop = RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "black");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Black Level", "For RGB curves, the color that black is mapped to");
- RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_black_level_set", NULL);
-
- prop = RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "white");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
- RNA_def_property_ui_text(prop, "White Level", "For RGB curves, the color that white is mapped to");
- RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_white_level_set", NULL);
-
- func = RNA_def_function(srna, "update", "curvemapping_changed_all");
- RNA_def_function_ui_description(func, "Update curve mapping after making changes");
-
- func = RNA_def_function(srna, "initialize", "rna_CurveMap_initialize");
- RNA_def_function_ui_description(func, "Initialize curve");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+
+ static const EnumPropertyItem tone_items[] = {
+ {CURVE_TONE_STANDARD, "STANDARD", 0, "Standard", ""},
+ {CURVE_TONE_FILMLIKE, "FILMLIKE", 0, "Film like", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CurveMapping", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "CurveMapping",
+ "Curve mapping to map color, vector and scalar values to other values using "
+ "a user defined curve");
+
+ prop = RNA_def_property(srna, "tone", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tone");
+ RNA_def_property_enum_items(prop, tone_items);
+ RNA_def_property_ui_text(prop, "Tone", "Tone of the curve");
+ RNA_def_property_update(prop, 0, "rna_CurveMapping_tone_update");
+
+ prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CUMA_DO_CLIP);
+ RNA_def_property_ui_text(prop, "Clip", "Force the curve view to fit a defined boundary");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_CurveMapping_clip_set");
+
+ prop = RNA_def_property(srna, "clip_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.xmin");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Min X", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminx_range");
+
+ prop = RNA_def_property(srna, "clip_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.ymin");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Min Y", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipminy_range");
+
+ prop = RNA_def_property(srna, "clip_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.xmax");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Max X", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxx_range");
+
+ prop = RNA_def_property(srna, "clip_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipr.ymax");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Clip Max Y", "");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_CurveMapping_clipmaxy_range");
+
+ prop = RNA_def_property(srna, "curves", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_CurveMapping_curves_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_CurveMapping_curves_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "CurveMap");
+ RNA_def_property_ui_text(prop, "Curves", "");
+
+ prop = RNA_def_property(srna, "black_level", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "black");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
+ RNA_def_property_ui_text(
+ prop, "Black Level", "For RGB curves, the color that black is mapped to");
+ RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_black_level_set", NULL);
+
+ prop = RNA_def_property(srna, "white_level", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "white");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 1, 3);
+ RNA_def_property_ui_text(
+ prop, "White Level", "For RGB curves, the color that white is mapped to");
+ RNA_def_property_float_funcs(prop, NULL, "rna_CurveMapping_white_level_set", NULL);
+
+ func = RNA_def_function(srna, "update", "curvemapping_changed_all");
+ RNA_def_function_ui_description(func, "Update curve mapping after making changes");
+
+ func = RNA_def_function(srna, "initialize", "rna_CurveMap_initialize");
+ RNA_def_function_ui_description(func, "Initialize curve");
}
static void rna_def_color_ramp_element(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ColorRampElement", NULL);
- RNA_def_struct_sdna(srna, "CBData");
- RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
- RNA_def_struct_ui_text(srna, "Color Ramp Element", "Element defining a color at a position in the color ramp");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Color", "Set color of selected color stop");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
-
- prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "a");
- RNA_def_property_ui_text(prop, "Alpha", "Set alpha of selected color stop");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
-
- prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pos");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Position", "Set position of selected color stop");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ColorRampElement", NULL);
+ RNA_def_struct_sdna(srna, "CBData");
+ RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
+ RNA_def_struct_ui_text(
+ srna, "Color Ramp Element", "Element defining a color at a position in the color ramp");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Color", "Set color of selected color stop");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "a");
+ RNA_def_property_ui_text(prop, "Alpha", "Set alpha of selected color stop");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+
+ prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pos");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Position", "Set position of selected color stop");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
}
static void rna_def_color_ramp_element_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "ColorRampElements");
- srna = RNA_def_struct(brna, "ColorRampElements", NULL);
- RNA_def_struct_sdna(srna, "ColorBand");
- RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
- RNA_def_struct_ui_text(srna, "Color Ramp Elements", "Collection of Color Ramp Elements");
-
- /* TODO, make these functions generic in texture.c */
- func = RNA_def_function(srna, "new", "rna_ColorRampElement_new");
- RNA_def_function_ui_description(func, "Add element to ColorRamp");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_float(func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "New element");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove");
- RNA_def_function_ui_description(func, "Delete element from ColorRamp");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "ColorRampElements");
+ srna = RNA_def_struct(brna, "ColorRampElements", NULL);
+ RNA_def_struct_sdna(srna, "ColorBand");
+ RNA_def_struct_path_func(srna, "rna_ColorRampElement_path");
+ RNA_def_struct_ui_text(srna, "Color Ramp Elements", "Collection of Color Ramp Elements");
+
+ /* TODO, make these functions generic in texture.c */
+ func = RNA_def_function(srna, "new", "rna_ColorRampElement_new");
+ RNA_def_function_ui_description(func, "Add element to ColorRamp");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_float(
+ func, "position", 0.0f, 0.0f, 1.0f, "Position", "Position to add element", 0.0f, 1.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "New element");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_ColorRampElement_remove");
+ RNA_def_function_ui_description(func, "Delete element from ColorRamp");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "element", "ColorRampElement", "", "Element to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_color_ramp(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem prop_interpolation_items[] = {
- {COLBAND_INTERP_EASE, "EASE", 0, "Ease", ""},
- {COLBAND_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
- {COLBAND_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
- {COLBAND_INTERP_B_SPLINE, "B_SPLINE", 0, "B-Spline", ""},
- {COLBAND_INTERP_CONSTANT, "CONSTANT", 0, "Constant", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_mode_items[] = {
- {COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""},
- {COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""},
- {COLBAND_BLEND_HSL, "HSL", 0, "HSL", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_hsv_items[] = {
- {COLBAND_HUE_NEAR, "NEAR", 0, "Near", ""},
- {COLBAND_HUE_FAR, "FAR", 0, "Far", ""},
- {COLBAND_HUE_CW, "CW", 0, "Clockwise", ""},
- {COLBAND_HUE_CCW, "CCW", 0, "Counter-Clockwise", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ColorRamp", NULL);
- RNA_def_struct_sdna(srna, "ColorBand");
- RNA_def_struct_path_func(srna, "rna_ColorRamp_path");
- RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color");
-
- prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR);
- RNA_def_property_collection_sdna(prop, NULL, "data", "tot");
- RNA_def_property_struct_type(prop, "ColorRampElement");
- RNA_def_property_ui_text(prop, "Elements", "");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
- rna_def_color_ramp_element_api(brna, prop);
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ipotype");
- RNA_def_property_enum_items(prop, prop_interpolation_items);
- RNA_def_property_ui_text(prop, "Interpolation", "Set interpolation between color stops");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
-
- prop = RNA_def_property(srna, "hue_interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ipotype_hue");
- RNA_def_property_enum_items(prop, prop_hsv_items);
- RNA_def_property_ui_text(prop, "Color Interpolation", "Set color interpolation");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
-
- prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "color_mode");
- RNA_def_property_enum_items(prop, prop_mode_items);
- RNA_def_property_ui_text(prop, "Color Mode", "Set color mode to use for interpolation");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
-
-#if 0 /* use len(elements) */
- prop = RNA_def_property(srna, "total", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "tot");
- /* needs a function to do the right thing when adding elements like colorband_add_cb() */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_range(prop, 0, 31); /* MAXCOLORBAND = 32 */
- RNA_def_property_ui_text(prop, "Total", "Total number of elements");
- RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
-#endif
-
- func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval");
- RNA_def_function_ui_description(func, "Evaluate ColorRamp");
- parm = RNA_def_float(func, "position", 1.0f, 0.0f, 1.0f, "Position", "Evaluate ColorRamp at position", 0.0f, 1.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return */
- parm = RNA_def_float_color(func, "color", 4, NULL, -FLT_MAX, FLT_MAX, "Color", "Color at given position",
- -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem prop_interpolation_items[] = {
+ {COLBAND_INTERP_EASE, "EASE", 0, "Ease", ""},
+ {COLBAND_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
+ {COLBAND_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
+ {COLBAND_INTERP_B_SPLINE, "B_SPLINE", 0, "B-Spline", ""},
+ {COLBAND_INTERP_CONSTANT, "CONSTANT", 0, "Constant", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_mode_items[] = {
+ {COLBAND_BLEND_RGB, "RGB", 0, "RGB", ""},
+ {COLBAND_BLEND_HSV, "HSV", 0, "HSV", ""},
+ {COLBAND_BLEND_HSL, "HSL", 0, "HSL", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_hsv_items[] = {
+ {COLBAND_HUE_NEAR, "NEAR", 0, "Near", ""},
+ {COLBAND_HUE_FAR, "FAR", 0, "Far", ""},
+ {COLBAND_HUE_CW, "CW", 0, "Clockwise", ""},
+ {COLBAND_HUE_CCW, "CCW", 0, "Counter-Clockwise", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ColorRamp", NULL);
+ RNA_def_struct_sdna(srna, "ColorBand");
+ RNA_def_struct_path_func(srna, "rna_ColorRamp_path");
+ RNA_def_struct_ui_text(srna, "Color Ramp", "Color ramp mapping a scalar value to a color");
+
+ prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_COLOR);
+ RNA_def_property_collection_sdna(prop, NULL, "data", "tot");
+ RNA_def_property_struct_type(prop, "ColorRampElement");
+ RNA_def_property_ui_text(prop, "Elements", "");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+ rna_def_color_ramp_element_api(brna, prop);
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ipotype");
+ RNA_def_property_enum_items(prop, prop_interpolation_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Set interpolation between color stops");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+
+ prop = RNA_def_property(srna, "hue_interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ipotype_hue");
+ RNA_def_property_enum_items(prop, prop_hsv_items);
+ RNA_def_property_ui_text(prop, "Color Interpolation", "Set color interpolation");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+
+ prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "color_mode");
+ RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_ui_text(prop, "Color Mode", "Set color mode to use for interpolation");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+
+# if 0 /* use len(elements) */
+ prop = RNA_def_property(srna, "total", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tot");
+ /* needs a function to do the right thing when adding elements like colorband_add_cb() */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_range(prop, 0, 31); /* MAXCOLORBAND = 32 */
+ RNA_def_property_ui_text(prop, "Total", "Total number of elements");
+ RNA_def_property_update(prop, 0, "rna_ColorRamp_update");
+# endif
+
+ func = RNA_def_function(srna, "evaluate", "rna_ColorRamp_eval");
+ RNA_def_function_ui_description(func, "Evaluate ColorRamp");
+ parm = RNA_def_float(func,
+ "position",
+ 1.0f,
+ 0.0f,
+ 1.0f,
+ "Position",
+ "Evaluate ColorRamp at position",
+ 0.0f,
+ 1.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_float_color(func,
+ "color",
+ 4,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Color",
+ "Color at given position",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
static void rna_def_histogram(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_mode_items[] = {
- {HISTO_MODE_LUMA, "LUMA", 0, "Luma", "Luma"},
- {HISTO_MODE_RGB, "RGB", 0, "RGB", "Red Green Blue"},
- {HISTO_MODE_R, "R", 0, "R", "Red"},
- {HISTO_MODE_G, "G", 0, "G", "Green"},
- {HISTO_MODE_B, "B", 0, "B", "Blue"},
- {HISTO_MODE_ALPHA, "A", 0, "A", "Alpha"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Histogram", NULL);
- RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, prop_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Channels to display when drawing the histogram");
-
- prop = RNA_def_property(srna, "show_line", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", HISTO_FLAG_LINE);
- RNA_def_property_ui_text(prop, "Show Line", "Display lines rather than filled shapes");
- RNA_def_property_ui_icon(prop, ICON_GRAPH, 0);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_mode_items[] = {
+ {HISTO_MODE_LUMA, "LUMA", 0, "Luma", "Luma"},
+ {HISTO_MODE_RGB, "RGB", 0, "RGB", "Red Green Blue"},
+ {HISTO_MODE_R, "R", 0, "R", "Red"},
+ {HISTO_MODE_G, "G", 0, "G", "Green"},
+ {HISTO_MODE_B, "B", 0, "B", "Blue"},
+ {HISTO_MODE_ALPHA, "A", 0, "A", "Alpha"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Histogram", NULL);
+ RNA_def_struct_ui_text(srna, "Histogram", "Statistical view of the levels of color in an image");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Channels to display when drawing the histogram");
+
+ prop = RNA_def_property(srna, "show_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", HISTO_FLAG_LINE);
+ RNA_def_property_ui_text(prop, "Show Line", "Display lines rather than filled shapes");
+ RNA_def_property_ui_icon(prop, ICON_GRAPH, 0);
}
static void rna_def_scopes(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_wavefrm_mode_items[] = {
- {SCOPES_WAVEFRM_LUMA, "LUMA", ICON_COLOR, "Luma", ""},
- {SCOPES_WAVEFRM_RGB_PARADE, "PARADE", ICON_COLOR, "Parade", ""},
- {SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""},
- {SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""},
- {SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (Jpeg)", ""},
- {SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Scopes", NULL);
- RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image");
-
- prop = RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, "Scopes", "sample_full", 1);
- RNA_def_property_ui_text(prop, "Full Sample", "Sample every pixel of the image");
- RNA_def_property_update(prop, 0, "rna_Scopes_update");
-
- prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, "Scopes", "accuracy");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
- RNA_def_property_ui_text(prop, "Accuracy", "Proportion of original image source pixel lines to sample");
- RNA_def_property_update(prop, 0, "rna_Scopes_update");
-
- prop = RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, "Scopes", "hist");
- RNA_def_property_struct_type(prop, "Histogram");
- RNA_def_property_ui_text(prop, "Histogram", "Histogram for viewing image statistics");
-
- prop = RNA_def_property(srna, "waveform_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, "Scopes", "wavefrm_mode");
- RNA_def_property_enum_items(prop, prop_wavefrm_mode_items);
- RNA_def_property_ui_text(prop, "Waveform Mode", "");
- RNA_def_property_update(prop, 0, "rna_Scopes_update");
-
- prop = RNA_def_property(srna, "waveform_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, "Scopes", "wavefrm_alpha");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Waveform Opacity", "Opacity of the points");
-
- prop = RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, "Scopes", "vecscope_alpha");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Vectorscope Opacity", "Opacity of the points");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_wavefrm_mode_items[] = {
+ {SCOPES_WAVEFRM_LUMA, "LUMA", ICON_COLOR, "Luma", ""},
+ {SCOPES_WAVEFRM_RGB_PARADE, "PARADE", ICON_COLOR, "Parade", ""},
+ {SCOPES_WAVEFRM_YCC_601, "YCBCR601", ICON_COLOR, "YCbCr (ITU 601)", ""},
+ {SCOPES_WAVEFRM_YCC_709, "YCBCR709", ICON_COLOR, "YCbCr (ITU 709)", ""},
+ {SCOPES_WAVEFRM_YCC_JPEG, "YCBCRJPG", ICON_COLOR, "YCbCr (Jpeg)", ""},
+ {SCOPES_WAVEFRM_RGB, "RGB", ICON_COLOR, "Red Green Blue", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Scopes", NULL);
+ RNA_def_struct_ui_text(srna, "Scopes", "Scopes for statistical view of an image");
+
+ prop = RNA_def_property(srna, "use_full_resolution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, "Scopes", "sample_full", 1);
+ RNA_def_property_ui_text(prop, "Full Sample", "Sample every pixel of the image");
+ RNA_def_property_update(prop, 0, "rna_Scopes_update");
+
+ prop = RNA_def_property(srna, "accuracy", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, "Scopes", "accuracy");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 100.0, 10, 1);
+ RNA_def_property_ui_text(
+ prop, "Accuracy", "Proportion of original image source pixel lines to sample");
+ RNA_def_property_update(prop, 0, "rna_Scopes_update");
+
+ prop = RNA_def_property(srna, "histogram", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, "Scopes", "hist");
+ RNA_def_property_struct_type(prop, "Histogram");
+ RNA_def_property_ui_text(prop, "Histogram", "Histogram for viewing image statistics");
+
+ prop = RNA_def_property(srna, "waveform_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, "Scopes", "wavefrm_mode");
+ RNA_def_property_enum_items(prop, prop_wavefrm_mode_items);
+ RNA_def_property_ui_text(prop, "Waveform Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Scopes_update");
+
+ prop = RNA_def_property(srna, "waveform_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, "Scopes", "wavefrm_alpha");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Waveform Opacity", "Opacity of the points");
+
+ prop = RNA_def_property(srna, "vectorscope_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, "Scopes", "vecscope_alpha");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Vectorscope Opacity", "Opacity of the points");
}
static void rna_def_colormanage(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem display_device_items[] = {
- {0, "DEFAULT", 0, "Default", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem look_items[] = {
- {0, "NONE", 0, "None", "Do not modify image in an artistic manner"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem view_transform_items[] = {
- {0, "NONE", 0, "None", "Do not perform any color transform on display, use old non-color managed technique for display"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem color_space_items[] = {
- {0, "NONE", 0, "None", "Do not perform any color transform on load, treat colors as in scene linear space already"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* ** Display Settings ** */
- srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL);
- RNA_def_struct_path_func(srna, "rna_ColorManagedDisplaySettings_path");
- RNA_def_struct_ui_text(srna, "ColorManagedDisplaySettings", "Color management specific to display device");
-
- prop = RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, display_device_items);
- RNA_def_property_enum_funcs(prop, "rna_ColorManagedDisplaySettings_display_device_get",
- "rna_ColorManagedDisplaySettings_display_device_set",
- "rna_ColorManagedDisplaySettings_display_device_itemf");
- RNA_def_property_ui_text(prop, "Display Device", "Display device name");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update");
-
- /* ** View Settings ** */
- srna = RNA_def_struct(brna, "ColorManagedViewSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_ColorManagedViewSettings_path");
- RNA_def_struct_ui_text(srna, "ColorManagedViewSettings", "Color management settings used for displaying images on the display");
-
- prop = RNA_def_property(srna, "look", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, look_items);
- RNA_def_property_enum_funcs(prop, "rna_ColorManagedViewSettings_look_get",
- "rna_ColorManagedViewSettings_look_set",
- "rna_ColorManagedViewSettings_look_itemf");
- RNA_def_property_ui_text(prop, "Look", "Additional transform applied before view transform for an artistic needs");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
-
- prop = RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, view_transform_items);
- RNA_def_property_enum_funcs(prop, "rna_ColorManagedViewSettings_view_transform_get",
- "rna_ColorManagedViewSettings_view_transform_set",
- "rna_ColorManagedViewSettings_view_transform_itemf");
- RNA_def_property_ui_text(prop, "View Transform", "View used when converting image to a display space");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
-
- prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "exposure");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -32.0f, 32.0f);
- RNA_def_property_ui_range(prop, -10.0f, 10.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Exposure", "Exposure (stops) applied before display transform");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
-
- prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gamma");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, 5.0f);
- RNA_def_property_ui_text(prop, "Gamma", "Amount of gamma modification applied after display transform");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
-
- prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
- RNA_def_property_ui_text(prop, "Curve", "Color curve mapping applied before display transform");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
-
- prop = RNA_def_property(srna, "use_curve_mapping", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMANAGE_VIEW_USE_CURVES);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_ColorManagedViewSettings_use_curves_set");
- RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
-
- /* ** Colorspace ** */
- srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path");
- RNA_def_struct_ui_text(srna, "ColorManagedInputColorspaceSettings", "Input color space settings");
-
- prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- RNA_def_property_enum_items(prop, color_space_items);
- RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get",
- "rna_ColorManagedColorspaceSettings_colorspace_set",
- "rna_ColorManagedColorspaceSettings_colorspace_itemf");
- RNA_def_property_ui_text(prop, "Input Color Space", "Color space of the image or movie on disk");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
-
- //
- srna = RNA_def_struct(brna, "ColorManagedSequencerColorspaceSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_ColorManagedSequencerColorspaceSettings_path");
- RNA_def_struct_ui_text(srna, "ColorManagedSequencerColorspaceSettings", "Input color space settings");
-
- prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- RNA_def_property_enum_items(prop, color_space_items);
- RNA_def_property_enum_funcs(prop, "rna_ColorManagedColorspaceSettings_colorspace_get",
- "rna_ColorManagedColorspaceSettings_colorspace_set",
- "rna_ColorManagedColorspaceSettings_colorspace_itemf");
- RNA_def_property_ui_text(prop, "Color Space", "Color space that the sequencer operates in");
- RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem display_device_items[] = {
+ {0, "DEFAULT", 0, "Default", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem look_items[] = {
+ {0, "NONE", 0, "None", "Do not modify image in an artistic manner"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem view_transform_items[] = {
+ {0,
+ "NONE",
+ 0,
+ "None",
+ "Do not perform any color transform on display, use old non-color managed technique for "
+ "display"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem color_space_items[] = {
+ {0,
+ "NONE",
+ 0,
+ "None",
+ "Do not perform any color transform on load, treat colors as in scene linear space "
+ "already"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* ** Display Settings ** */
+ srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_ColorManagedDisplaySettings_path");
+ RNA_def_struct_ui_text(
+ srna, "ColorManagedDisplaySettings", "Color management specific to display device");
+
+ prop = RNA_def_property(srna, "display_device", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, display_device_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_ColorManagedDisplaySettings_display_device_get",
+ "rna_ColorManagedDisplaySettings_display_device_set",
+ "rna_ColorManagedDisplaySettings_display_device_itemf");
+ RNA_def_property_ui_text(prop, "Display Device", "Display device name");
+ RNA_def_property_update(
+ prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update");
+
+ /* ** View Settings ** */
+ srna = RNA_def_struct(brna, "ColorManagedViewSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_ColorManagedViewSettings_path");
+ RNA_def_struct_ui_text(srna,
+ "ColorManagedViewSettings",
+ "Color management settings used for displaying images on the display");
+
+ prop = RNA_def_property(srna, "look", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, look_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_ColorManagedViewSettings_look_get",
+ "rna_ColorManagedViewSettings_look_set",
+ "rna_ColorManagedViewSettings_look_itemf");
+ RNA_def_property_ui_text(
+ prop, "Look", "Additional transform applied before view transform for an artistic needs");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "view_transform", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, view_transform_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_ColorManagedViewSettings_view_transform_get",
+ "rna_ColorManagedViewSettings_view_transform_set",
+ "rna_ColorManagedViewSettings_view_transform_itemf");
+ RNA_def_property_ui_text(
+ prop, "View Transform", "View used when converting image to a display space");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "exposure");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -32.0f, 32.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Exposure", "Exposure (stops) applied before display transform");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 5.0f);
+ RNA_def_property_ui_text(
+ prop, "Gamma", "Amount of gamma modification applied after display transform");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
+ RNA_def_property_ui_text(prop, "Curve", "Color curve mapping applied before display transform");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ prop = RNA_def_property(srna, "use_curve_mapping", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMANAGE_VIEW_USE_CURVES);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ColorManagedViewSettings_use_curves_set");
+ RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update");
+
+ /* ** Colorspace ** */
+ srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path");
+ RNA_def_struct_ui_text(
+ srna, "ColorManagedInputColorspaceSettings", "Input color space settings");
+
+ prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_ColorManagedColorspaceSettings_colorspace_get",
+ "rna_ColorManagedColorspaceSettings_colorspace_set",
+ "rna_ColorManagedColorspaceSettings_colorspace_itemf");
+ RNA_def_property_ui_text(prop, "Input Color Space", "Color space of the image or movie on disk");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
+
+ //
+ srna = RNA_def_struct(brna, "ColorManagedSequencerColorspaceSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_ColorManagedSequencerColorspaceSettings_path");
+ RNA_def_struct_ui_text(
+ srna, "ColorManagedSequencerColorspaceSettings", "Input color space settings");
+
+ prop = RNA_def_property(srna, "name", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_ColorManagedColorspaceSettings_colorspace_get",
+ "rna_ColorManagedColorspaceSettings_colorspace_set",
+ "rna_ColorManagedColorspaceSettings_colorspace_itemf");
+ RNA_def_property_ui_text(prop, "Color Space", "Color space that the sequencer operates in");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagedColorspaceSettings_reload_update");
}
void RNA_def_color(BlenderRNA *brna)
{
- rna_def_curvemappoint(brna);
- rna_def_curvemap(brna);
- rna_def_curvemapping(brna);
- rna_def_color_ramp_element(brna);
- rna_def_color_ramp(brna);
- rna_def_histogram(brna);
- rna_def_scopes(brna);
- rna_def_colormanage(brna);
+ rna_def_curvemappoint(brna);
+ rna_def_curvemap(brna);
+ rna_def_curvemapping(brna);
+ rna_def_color_ramp_element(brna);
+ rna_def_color_ramp(brna);
+ rna_def_histogram(brna);
+ rna_def_scopes(brna);
+ rna_def_colormanage(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c
index 731e25b7e9a..743ad6bfa68 100644
--- a/source/blender/makesrna/intern/rna_constraint.c
+++ b/source/blender/makesrna/intern/rna_constraint.c
@@ -43,2693 +43,2993 @@
/* please keep the names in sync with constraint.c */
const EnumPropertyItem rna_enum_constraint_type_items[] = {
- {0, "", 0, N_("Motion Tracking"), ""},
- {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT, "Camera Solver", ""},
- {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT, "Follow Track", ""},
- {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT, "Object Solver", ""},
- {0, "", 0, N_("Transform"), ""},
- {CONSTRAINT_TYPE_LOCLIKE, "COPY_LOCATION", ICON_CONSTRAINT, "Copy Location",
- "Copy the location of a target (with an optional offset), so that they move together"},
- {CONSTRAINT_TYPE_ROTLIKE, "COPY_ROTATION", ICON_CONSTRAINT, "Copy Rotation",
- "Copy the rotation of a target (with an optional offset), so that they rotate together"},
- {CONSTRAINT_TYPE_SIZELIKE, "COPY_SCALE", ICON_CONSTRAINT, "Copy Scale",
- "Copy the scale factors of a target (with an optional offset), so that they are scaled by the same amount"},
- {CONSTRAINT_TYPE_TRANSLIKE, "COPY_TRANSFORMS", ICON_CONSTRAINT, "Copy Transforms",
- "Copy all the transformations of a target, so that they move together"},
- {CONSTRAINT_TYPE_DISTLIMIT, "LIMIT_DISTANCE", ICON_CONSTRAINT, "Limit Distance",
- "Restrict movements to within a certain distance of a target (at the time of constraint evaluation only)"},
- {CONSTRAINT_TYPE_LOCLIMIT, "LIMIT_LOCATION", ICON_CONSTRAINT, "Limit Location",
- "Restrict movement along each axis within given ranges"},
- {CONSTRAINT_TYPE_ROTLIMIT, "LIMIT_ROTATION", ICON_CONSTRAINT, "Limit Rotation",
- "Restrict rotation along each axis within given ranges"},
- {CONSTRAINT_TYPE_SIZELIMIT, "LIMIT_SCALE", ICON_CONSTRAINT, "Limit Scale",
- "Restrict scaling along each axis with given ranges"},
- {CONSTRAINT_TYPE_SAMEVOL, "MAINTAIN_VOLUME", ICON_CONSTRAINT, "Maintain Volume",
- "Compensate for scaling one axis by applying suitable scaling to the other two axes"},
- {CONSTRAINT_TYPE_TRANSFORM, "TRANSFORM", ICON_CONSTRAINT, "Transformation",
- "Use one transform property from target to control another (or same) property on owner"},
- {CONSTRAINT_TYPE_TRANSFORM_CACHE, "TRANSFORM_CACHE", ICON_CONSTRAINT, "Transform Cache",
- "Look up the transformation matrix from an external file"},
- {0, "", 0, N_("Tracking"), ""},
- {CONSTRAINT_TYPE_CLAMPTO, "CLAMP_TO", ICON_CONSTRAINT, "Clamp To",
- "Restrict movements to lie along a curve by remapping location along curve's longest axis"},
- {CONSTRAINT_TYPE_DAMPTRACK, "DAMPED_TRACK", ICON_CONSTRAINT, "Damped Track",
- "Point towards a target by performing the smallest rotation necessary"},
- {CONSTRAINT_TYPE_KINEMATIC, "IK", ICON_CONSTRAINT, "Inverse Kinematics",
- "Control a chain of bones by specifying the endpoint target (Bones only)"},
- {CONSTRAINT_TYPE_LOCKTRACK, "LOCKED_TRACK", ICON_CONSTRAINT, "Locked Track",
- "Rotate around the specified ('locked') axis to point towards a target"},
- {CONSTRAINT_TYPE_SPLINEIK, "SPLINE_IK", ICON_CONSTRAINT, "Spline IK",
- "Align chain of bones along a curve (Bones only)"},
- {CONSTRAINT_TYPE_STRETCHTO, "STRETCH_TO", ICON_CONSTRAINT, "Stretch To",
- "Stretch along Y-Axis to point towards a target"},
- {CONSTRAINT_TYPE_TRACKTO, "TRACK_TO", ICON_CONSTRAINT, "Track To",
- "Legacy tracking constraint prone to twisting artifacts"},
- {0, "", 0, N_("Relationship"), ""},
- {CONSTRAINT_TYPE_ACTION, "ACTION", ICON_CONSTRAINT, "Action",
- "Use transform property of target to look up pose for owner from an Action"},
- {CONSTRAINT_TYPE_ARMATURE, "ARMATURE", ICON_CONSTRAINT, "Armature",
- "Apply weight-blended transformation from multiple bones like the Armature modifier"},
- {CONSTRAINT_TYPE_CHILDOF, "CHILD_OF", ICON_CONSTRAINT, "Child Of",
- "Make target the 'detachable' parent of owner"},
- {CONSTRAINT_TYPE_MINMAX, "FLOOR", ICON_CONSTRAINT, "Floor",
- "Use position (and optionally rotation) of target to define a 'wall' or 'floor' that the owner can not cross"},
- {CONSTRAINT_TYPE_FOLLOWPATH, "FOLLOW_PATH", ICON_CONSTRAINT, "Follow Path",
- "Use to animate an object/bone following a path"},
- {CONSTRAINT_TYPE_PIVOT, "PIVOT", ICON_CONSTRAINT, "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_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script",
- "Custom constraint(s) written in Python (Not yet implemented)"}, */
- {CONSTRAINT_TYPE_SHRINKWRAP, "SHRINKWRAP", ICON_CONSTRAINT, "Shrinkwrap",
- "Restrict movements to surface of target mesh"},
- {0, NULL, 0, NULL, NULL},
+ {0, "", 0, N_("Motion Tracking"), ""},
+ {CONSTRAINT_TYPE_CAMERASOLVER, "CAMERA_SOLVER", ICON_CONSTRAINT, "Camera Solver", ""},
+ {CONSTRAINT_TYPE_FOLLOWTRACK, "FOLLOW_TRACK", ICON_CONSTRAINT, "Follow Track", ""},
+ {CONSTRAINT_TYPE_OBJECTSOLVER, "OBJECT_SOLVER", ICON_CONSTRAINT, "Object Solver", ""},
+ {0, "", 0, N_("Transform"), ""},
+ {CONSTRAINT_TYPE_LOCLIKE,
+ "COPY_LOCATION",
+ ICON_CONSTRAINT,
+ "Copy Location",
+ "Copy the location of a target (with an optional offset), so that they move together"},
+ {CONSTRAINT_TYPE_ROTLIKE,
+ "COPY_ROTATION",
+ ICON_CONSTRAINT,
+ "Copy Rotation",
+ "Copy the rotation of a target (with an optional offset), so that they rotate together"},
+ {CONSTRAINT_TYPE_SIZELIKE,
+ "COPY_SCALE",
+ ICON_CONSTRAINT,
+ "Copy Scale",
+ "Copy the scale factors of a target (with an optional offset), so that they are scaled by "
+ "the same amount"},
+ {CONSTRAINT_TYPE_TRANSLIKE,
+ "COPY_TRANSFORMS",
+ ICON_CONSTRAINT,
+ "Copy Transforms",
+ "Copy all the transformations of a target, so that they move together"},
+ {CONSTRAINT_TYPE_DISTLIMIT,
+ "LIMIT_DISTANCE",
+ ICON_CONSTRAINT,
+ "Limit Distance",
+ "Restrict movements to within a certain distance of a target (at the time of constraint "
+ "evaluation only)"},
+ {CONSTRAINT_TYPE_LOCLIMIT,
+ "LIMIT_LOCATION",
+ ICON_CONSTRAINT,
+ "Limit Location",
+ "Restrict movement along each axis within given ranges"},
+ {CONSTRAINT_TYPE_ROTLIMIT,
+ "LIMIT_ROTATION",
+ ICON_CONSTRAINT,
+ "Limit Rotation",
+ "Restrict rotation along each axis within given ranges"},
+ {CONSTRAINT_TYPE_SIZELIMIT,
+ "LIMIT_SCALE",
+ ICON_CONSTRAINT,
+ "Limit Scale",
+ "Restrict scaling along each axis with given ranges"},
+ {CONSTRAINT_TYPE_SAMEVOL,
+ "MAINTAIN_VOLUME",
+ ICON_CONSTRAINT,
+ "Maintain Volume",
+ "Compensate for scaling one axis by applying suitable scaling to the other two axes"},
+ {CONSTRAINT_TYPE_TRANSFORM,
+ "TRANSFORM",
+ ICON_CONSTRAINT,
+ "Transformation",
+ "Use one transform property from target to control another (or same) property on owner"},
+ {CONSTRAINT_TYPE_TRANSFORM_CACHE,
+ "TRANSFORM_CACHE",
+ ICON_CONSTRAINT,
+ "Transform Cache",
+ "Look up the transformation matrix from an external file"},
+ {0, "", 0, N_("Tracking"), ""},
+ {CONSTRAINT_TYPE_CLAMPTO,
+ "CLAMP_TO",
+ ICON_CONSTRAINT,
+ "Clamp To",
+ "Restrict movements to lie along a curve by remapping location along curve's longest axis"},
+ {CONSTRAINT_TYPE_DAMPTRACK,
+ "DAMPED_TRACK",
+ ICON_CONSTRAINT,
+ "Damped Track",
+ "Point towards a target by performing the smallest rotation necessary"},
+ {CONSTRAINT_TYPE_KINEMATIC,
+ "IK",
+ ICON_CONSTRAINT,
+ "Inverse Kinematics",
+ "Control a chain of bones by specifying the endpoint target (Bones only)"},
+ {CONSTRAINT_TYPE_LOCKTRACK,
+ "LOCKED_TRACK",
+ ICON_CONSTRAINT,
+ "Locked Track",
+ "Rotate around the specified ('locked') axis to point towards a target"},
+ {CONSTRAINT_TYPE_SPLINEIK,
+ "SPLINE_IK",
+ ICON_CONSTRAINT,
+ "Spline IK",
+ "Align chain of bones along a curve (Bones only)"},
+ {CONSTRAINT_TYPE_STRETCHTO,
+ "STRETCH_TO",
+ ICON_CONSTRAINT,
+ "Stretch To",
+ "Stretch along Y-Axis to point towards a target"},
+ {CONSTRAINT_TYPE_TRACKTO,
+ "TRACK_TO",
+ ICON_CONSTRAINT,
+ "Track To",
+ "Legacy tracking constraint prone to twisting artifacts"},
+ {0, "", 0, N_("Relationship"), ""},
+ {CONSTRAINT_TYPE_ACTION,
+ "ACTION",
+ ICON_CONSTRAINT,
+ "Action",
+ "Use transform property of target to look up pose for owner from an Action"},
+ {CONSTRAINT_TYPE_ARMATURE,
+ "ARMATURE",
+ ICON_CONSTRAINT,
+ "Armature",
+ "Apply weight-blended transformation from multiple bones like the Armature modifier"},
+ {CONSTRAINT_TYPE_CHILDOF,
+ "CHILD_OF",
+ ICON_CONSTRAINT,
+ "Child Of",
+ "Make target the 'detachable' parent of owner"},
+ {CONSTRAINT_TYPE_MINMAX,
+ "FLOOR",
+ ICON_CONSTRAINT,
+ "Floor",
+ "Use position (and optionally rotation) of target to define a 'wall' or 'floor' that the "
+ "owner can not cross"},
+ {CONSTRAINT_TYPE_FOLLOWPATH,
+ "FOLLOW_PATH",
+ ICON_CONSTRAINT,
+ "Follow Path",
+ "Use to animate an object/bone following a path"},
+ {CONSTRAINT_TYPE_PIVOT,
+ "PIVOT",
+ ICON_CONSTRAINT,
+ "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_PYTHON, "SCRIPT", ICON_CONSTRAINT_DATA, "Script",
+ "Custom constraint(s) written in Python (Not yet implemented)"}, */
+ {CONSTRAINT_TYPE_SHRINKWRAP,
+ "SHRINKWRAP",
+ ICON_CONSTRAINT,
+ "Shrinkwrap",
+ "Restrict movements to surface of target mesh"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem target_space_pchan_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
- "The transformation of the target is evaluated relative to the world "
- "coordinate system"},
- {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
- "The transformation of the target is only evaluated in the Pose Space, "
- "the target armature object transformation is ignored"},
- {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
- "The transformation of the target bone is evaluated relative to its rest pose "
- "local coordinate system, thus including the parent-induced transformation"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
- "The transformation of the target is evaluated relative to its local "
- "coordinate system"},
- {0, NULL, 0, NULL, NULL},
+ {CONSTRAINT_SPACE_WORLD,
+ "WORLD",
+ 0,
+ "World Space",
+ "The transformation of the target is evaluated relative to the world "
+ "coordinate system"},
+ {CONSTRAINT_SPACE_POSE,
+ "POSE",
+ 0,
+ "Pose Space",
+ "The transformation of the target is only evaluated in the Pose Space, "
+ "the target armature object transformation is ignored"},
+ {CONSTRAINT_SPACE_PARLOCAL,
+ "LOCAL_WITH_PARENT",
+ 0,
+ "Local With Parent",
+ "The transformation of the target bone is evaluated relative to its rest pose "
+ "local coordinate system, thus including the parent-induced transformation"},
+ {CONSTRAINT_SPACE_LOCAL,
+ "LOCAL",
+ 0,
+ "Local Space",
+ "The transformation of the target is evaluated relative to its local "
+ "coordinate system"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem owner_space_pchan_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
- "The constraint is applied relative to the world coordinate system"},
- {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
- "The constraint is applied in Pose Space, the object transformation is ignored"},
- {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
- "The constraint is applied relative to the rest pose local coordinate system "
- "of the bone, thus including the parent-induced transformation"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
- "The constraint is applied relative to the local coordinate system of the object"},
- {0, NULL, 0, NULL, NULL},
+ {CONSTRAINT_SPACE_WORLD,
+ "WORLD",
+ 0,
+ "World Space",
+ "The constraint is applied relative to the world coordinate system"},
+ {CONSTRAINT_SPACE_POSE,
+ "POSE",
+ 0,
+ "Pose Space",
+ "The constraint is applied in Pose Space, the object transformation is ignored"},
+ {CONSTRAINT_SPACE_PARLOCAL,
+ "LOCAL_WITH_PARENT",
+ 0,
+ "Local With Parent",
+ "The constraint is applied relative to the rest pose local coordinate system "
+ "of the bone, thus including the parent-induced transformation"},
+ {CONSTRAINT_SPACE_LOCAL,
+ "LOCAL",
+ 0,
+ "Local Space",
+ "The constraint is applied relative to the local coordinate system of the object"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem track_axis_items[] = {
- {TRACK_X, "TRACK_X", 0, "X", ""},
- {TRACK_Y, "TRACK_Y", 0, "Y", ""},
- {TRACK_Z, "TRACK_Z", 0, "Z", ""},
- {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
- {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
- {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
+ {TRACK_X, "TRACK_X", 0, "X", ""},
+ {TRACK_Y, "TRACK_Y", 0, "Y", ""},
+ {TRACK_Z, "TRACK_Z", 0, "Z", ""},
+ {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
+ {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
+ {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem space_object_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
- "The transformation of the target is evaluated relative to the world coordinate system"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
- "The transformation of the target is evaluated relative to its local coordinate system"},
- {0, NULL, 0, NULL, NULL},
+ {CONSTRAINT_SPACE_WORLD,
+ "WORLD",
+ 0,
+ "World Space",
+ "The transformation of the target is evaluated relative to the world coordinate system"},
+ {CONSTRAINT_SPACE_LOCAL,
+ "LOCAL",
+ 0,
+ "Local Space",
+ "The transformation of the target is evaluated relative to its local coordinate system"},
+ {0, NULL, 0, NULL, NULL},
};
-#include "DNA_cachefile_types.h"
+# include "DNA_cachefile_types.h"
-#include "BKE_animsys.h"
-#include "BKE_action.h"
-#include "BKE_constraint.h"
-#include "BKE_context.h"
+# include "BKE_animsys.h"
+# include "BKE_action.h"
+# include "BKE_constraint.h"
+# include "BKE_context.h"
-#ifdef WITH_ALEMBIC
-# include "ABC_alembic.h"
-#endif
+# ifdef WITH_ALEMBIC
+# include "ABC_alembic.h"
+# endif
static StructRNA *rna_ConstraintType_refine(struct PointerRNA *ptr)
{
- bConstraint *con = (bConstraint *)ptr->data;
-
- switch (con->type) {
- case CONSTRAINT_TYPE_CHILDOF:
- return &RNA_ChildOfConstraint;
- case CONSTRAINT_TYPE_TRACKTO:
- return &RNA_TrackToConstraint;
- case CONSTRAINT_TYPE_KINEMATIC:
- return &RNA_KinematicConstraint;
- case CONSTRAINT_TYPE_FOLLOWPATH:
- return &RNA_FollowPathConstraint;
- case CONSTRAINT_TYPE_ROTLIKE:
- return &RNA_CopyRotationConstraint;
- case CONSTRAINT_TYPE_LOCLIKE:
- return &RNA_CopyLocationConstraint;
- case CONSTRAINT_TYPE_SIZELIKE:
- return &RNA_CopyScaleConstraint;
- case CONSTRAINT_TYPE_SAMEVOL:
- return &RNA_MaintainVolumeConstraint;
- case CONSTRAINT_TYPE_PYTHON:
- return &RNA_PythonConstraint;
- case CONSTRAINT_TYPE_ARMATURE:
- return &RNA_ArmatureConstraint;
- case CONSTRAINT_TYPE_ACTION:
- return &RNA_ActionConstraint;
- case CONSTRAINT_TYPE_LOCKTRACK:
- return &RNA_LockedTrackConstraint;
- case CONSTRAINT_TYPE_STRETCHTO:
- return &RNA_StretchToConstraint;
- case CONSTRAINT_TYPE_MINMAX:
- return &RNA_FloorConstraint;
- case CONSTRAINT_TYPE_CLAMPTO:
- return &RNA_ClampToConstraint;
- case CONSTRAINT_TYPE_TRANSFORM:
- return &RNA_TransformConstraint;
- case CONSTRAINT_TYPE_ROTLIMIT:
- return &RNA_LimitRotationConstraint;
- case CONSTRAINT_TYPE_LOCLIMIT:
- return &RNA_LimitLocationConstraint;
- case CONSTRAINT_TYPE_SIZELIMIT:
- return &RNA_LimitScaleConstraint;
- case CONSTRAINT_TYPE_DISTLIMIT:
- return &RNA_LimitDistanceConstraint;
- case CONSTRAINT_TYPE_SHRINKWRAP:
- return &RNA_ShrinkwrapConstraint;
- case CONSTRAINT_TYPE_DAMPTRACK:
- return &RNA_DampedTrackConstraint;
- case CONSTRAINT_TYPE_SPLINEIK:
- return &RNA_SplineIKConstraint;
- case CONSTRAINT_TYPE_TRANSLIKE:
- return &RNA_CopyTransformsConstraint;
- case CONSTRAINT_TYPE_PIVOT:
- return &RNA_PivotConstraint;
- case CONSTRAINT_TYPE_FOLLOWTRACK:
- return &RNA_FollowTrackConstraint;
- case CONSTRAINT_TYPE_CAMERASOLVER:
- return &RNA_CameraSolverConstraint;
- case CONSTRAINT_TYPE_OBJECTSOLVER:
- return &RNA_ObjectSolverConstraint;
- case CONSTRAINT_TYPE_TRANSFORM_CACHE:
- return &RNA_TransformCacheConstraint;
- default:
- return &RNA_UnknownType;
- }
+ bConstraint *con = (bConstraint *)ptr->data;
+
+ switch (con->type) {
+ case CONSTRAINT_TYPE_CHILDOF:
+ return &RNA_ChildOfConstraint;
+ case CONSTRAINT_TYPE_TRACKTO:
+ return &RNA_TrackToConstraint;
+ case CONSTRAINT_TYPE_KINEMATIC:
+ return &RNA_KinematicConstraint;
+ case CONSTRAINT_TYPE_FOLLOWPATH:
+ return &RNA_FollowPathConstraint;
+ case CONSTRAINT_TYPE_ROTLIKE:
+ return &RNA_CopyRotationConstraint;
+ case CONSTRAINT_TYPE_LOCLIKE:
+ return &RNA_CopyLocationConstraint;
+ case CONSTRAINT_TYPE_SIZELIKE:
+ return &RNA_CopyScaleConstraint;
+ case CONSTRAINT_TYPE_SAMEVOL:
+ return &RNA_MaintainVolumeConstraint;
+ case CONSTRAINT_TYPE_PYTHON:
+ return &RNA_PythonConstraint;
+ case CONSTRAINT_TYPE_ARMATURE:
+ return &RNA_ArmatureConstraint;
+ case CONSTRAINT_TYPE_ACTION:
+ return &RNA_ActionConstraint;
+ case CONSTRAINT_TYPE_LOCKTRACK:
+ return &RNA_LockedTrackConstraint;
+ case CONSTRAINT_TYPE_STRETCHTO:
+ return &RNA_StretchToConstraint;
+ case CONSTRAINT_TYPE_MINMAX:
+ return &RNA_FloorConstraint;
+ case CONSTRAINT_TYPE_CLAMPTO:
+ return &RNA_ClampToConstraint;
+ case CONSTRAINT_TYPE_TRANSFORM:
+ return &RNA_TransformConstraint;
+ case CONSTRAINT_TYPE_ROTLIMIT:
+ return &RNA_LimitRotationConstraint;
+ case CONSTRAINT_TYPE_LOCLIMIT:
+ return &RNA_LimitLocationConstraint;
+ case CONSTRAINT_TYPE_SIZELIMIT:
+ return &RNA_LimitScaleConstraint;
+ case CONSTRAINT_TYPE_DISTLIMIT:
+ return &RNA_LimitDistanceConstraint;
+ case CONSTRAINT_TYPE_SHRINKWRAP:
+ return &RNA_ShrinkwrapConstraint;
+ case CONSTRAINT_TYPE_DAMPTRACK:
+ return &RNA_DampedTrackConstraint;
+ case CONSTRAINT_TYPE_SPLINEIK:
+ return &RNA_SplineIKConstraint;
+ case CONSTRAINT_TYPE_TRANSLIKE:
+ return &RNA_CopyTransformsConstraint;
+ case CONSTRAINT_TYPE_PIVOT:
+ return &RNA_PivotConstraint;
+ case CONSTRAINT_TYPE_FOLLOWTRACK:
+ return &RNA_FollowTrackConstraint;
+ case CONSTRAINT_TYPE_CAMERASOLVER:
+ return &RNA_CameraSolverConstraint;
+ case CONSTRAINT_TYPE_OBJECTSOLVER:
+ return &RNA_ObjectSolverConstraint;
+ case CONSTRAINT_TYPE_TRANSFORM_CACHE:
+ return &RNA_TransformCacheConstraint;
+ default:
+ return &RNA_UnknownType;
+ }
}
static void rna_ConstraintTargetBone_target_set(PointerRNA *ptr, PointerRNA value)
{
- bConstraintTarget *tgt = (bConstraintTarget *)ptr->data;
- Object *ob = value.data;
+ bConstraintTarget *tgt = (bConstraintTarget *)ptr->data;
+ Object *ob = value.data;
- if (!ob || ob->type == OB_ARMATURE) {
- id_lib_extern((ID *)ob);
- tgt->tar = ob;
- }
+ if (!ob || ob->type == OB_ARMATURE) {
+ id_lib_extern((ID *)ob);
+ tgt->tar = ob;
+ }
}
static void rna_Constraint_name_set(PointerRNA *ptr, const char *value)
{
- bConstraint *con = ptr->data;
- char oldname[sizeof(con->name)];
+ bConstraint *con = ptr->data;
+ char oldname[sizeof(con->name)];
- /* make a copy of the old name first */
- BLI_strncpy(oldname, con->name, sizeof(con->name));
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, con->name, sizeof(con->name));
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(con->name, value, sizeof(con->name));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(con->name, value, sizeof(con->name));
- /* make sure name is unique */
- if (ptr->id.data) {
- Object *ob = ptr->id.data;
- ListBase *list = get_constraint_lb(ob, con, NULL);
+ /* make sure name is unique */
+ if (ptr->id.data) {
+ Object *ob = ptr->id.data;
+ ListBase *list = get_constraint_lb(ob, con, NULL);
- /* if we have the list, check for unique name, otherwise give up */
- if (list)
- BKE_constraint_unique_name(con, list);
- }
+ /* if we have the list, check for unique name, otherwise give up */
+ if (list)
+ BKE_constraint_unique_name(con, list);
+ }
- /* fix all the animation data which may link to this */
- BKE_animdata_fix_paths_rename_all(NULL, "constraints", oldname, con->name);
+ /* fix all the animation data which may link to this */
+ BKE_animdata_fix_paths_rename_all(NULL, "constraints", oldname, con->name);
}
static char *rna_Constraint_do_compute_path(Object *ob, bConstraint *con)
{
- bPoseChannel *pchan;
- ListBase *lb = get_constraint_lb(ob, con, &pchan);
-
- if (lb == NULL)
- printf("%s: internal error, constraint '%s' not found in object '%s'\n",
- __func__, con->name, ob->id.name);
-
- if (pchan) {
- char name_esc_pchan[sizeof(pchan->name) * 2];
- char name_esc_const[sizeof(con->name) * 2];
- BLI_strescape(name_esc_pchan, pchan->name, sizeof(name_esc_pchan));
- BLI_strescape(name_esc_const, con->name, sizeof(name_esc_const));
- return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", name_esc_pchan, name_esc_const);
- }
- else {
- char name_esc_const[sizeof(con->name) * 2];
- BLI_strescape(name_esc_const, con->name, sizeof(name_esc_const));
- return BLI_sprintfN("constraints[\"%s\"]", name_esc_const);
- }
+ bPoseChannel *pchan;
+ ListBase *lb = get_constraint_lb(ob, con, &pchan);
+
+ if (lb == NULL)
+ printf("%s: internal error, constraint '%s' not found in object '%s'\n",
+ __func__,
+ con->name,
+ ob->id.name);
+
+ if (pchan) {
+ char name_esc_pchan[sizeof(pchan->name) * 2];
+ char name_esc_const[sizeof(con->name) * 2];
+ BLI_strescape(name_esc_pchan, pchan->name, sizeof(name_esc_pchan));
+ BLI_strescape(name_esc_const, con->name, sizeof(name_esc_const));
+ return BLI_sprintfN("pose.bones[\"%s\"].constraints[\"%s\"]", name_esc_pchan, name_esc_const);
+ }
+ else {
+ char name_esc_const[sizeof(con->name) * 2];
+ BLI_strescape(name_esc_const, con->name, sizeof(name_esc_const));
+ return BLI_sprintfN("constraints[\"%s\"]", name_esc_const);
+ }
}
static char *rna_Constraint_path(PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- bConstraint *con = ptr->data;
+ Object *ob = ptr->id.data;
+ bConstraint *con = ptr->data;
- return rna_Constraint_do_compute_path(ob, con);
+ return rna_Constraint_do_compute_path(ob, con);
}
static bConstraint *rna_constraint_from_target(PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- bConstraintTarget *tgt = ptr->data;
+ Object *ob = ptr->id.data;
+ bConstraintTarget *tgt = ptr->data;
- return BKE_constraint_find_from_target(ob, tgt, NULL);
+ return BKE_constraint_find_from_target(ob, tgt, NULL);
}
static char *rna_ConstraintTarget_path(PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- bConstraintTarget *tgt = ptr->data;
- bConstraint *con = rna_constraint_from_target(ptr);
- int index = -1;
-
- if (con != NULL) {
- if (con->type == CONSTRAINT_TYPE_ARMATURE) {
- bArmatureConstraint *acon = con->data;
- index = BLI_findindex(&acon->targets, tgt);
- }
- else if (con->type == CONSTRAINT_TYPE_PYTHON) {
- bPythonConstraint *pcon = con->data;
- index = BLI_findindex(&pcon->targets, tgt);
- }
- }
-
- if (index >= 0) {
- char *con_path = rna_Constraint_do_compute_path(ob, con);
- char *result = BLI_sprintfN("%s.targets[%d]", con_path, index);
-
- MEM_freeN(con_path);
- return result;
- }
- else {
- printf("%s: internal error, constraint '%s' of object '%s' does not contain the target\n",
- __func__, con->name, ob->id.name);
- }
-
- return NULL;
+ Object *ob = ptr->id.data;
+ bConstraintTarget *tgt = ptr->data;
+ bConstraint *con = rna_constraint_from_target(ptr);
+ int index = -1;
+
+ if (con != NULL) {
+ if (con->type == CONSTRAINT_TYPE_ARMATURE) {
+ bArmatureConstraint *acon = con->data;
+ index = BLI_findindex(&acon->targets, tgt);
+ }
+ else if (con->type == CONSTRAINT_TYPE_PYTHON) {
+ bPythonConstraint *pcon = con->data;
+ index = BLI_findindex(&pcon->targets, tgt);
+ }
+ }
+
+ if (index >= 0) {
+ char *con_path = rna_Constraint_do_compute_path(ob, con);
+ char *result = BLI_sprintfN("%s.targets[%d]", con_path, index);
+
+ MEM_freeN(con_path);
+ return result;
+ }
+ else {
+ printf("%s: internal error, constraint '%s' of object '%s' does not contain the target\n",
+ __func__,
+ con->name,
+ ob->id.name);
+ }
+
+ return NULL;
}
static void rna_Constraint_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ED_object_constraint_tag_update(bmain, ptr->id.data, ptr->data);
+ ED_object_constraint_tag_update(bmain, ptr->id.data, ptr->data);
}
static void rna_Constraint_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ED_object_constraint_dependency_tag_update(bmain, ptr->id.data, ptr->data);
+ ED_object_constraint_dependency_tag_update(bmain, ptr->id.data, ptr->data);
}
static void rna_ConstraintTarget_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ED_object_constraint_tag_update(bmain, ptr->id.data, rna_constraint_from_target(ptr));
+ ED_object_constraint_tag_update(bmain, ptr->id.data, rna_constraint_from_target(ptr));
}
-static void rna_ConstraintTarget_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_ConstraintTarget_dependency_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ED_object_constraint_dependency_tag_update(bmain, ptr->id.data, rna_constraint_from_target(ptr));
+ ED_object_constraint_dependency_tag_update(bmain, ptr->id.data, rna_constraint_from_target(ptr));
}
static void rna_Constraint_influence_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
+ Object *ob = ptr->id.data;
- if (ob->pose)
- ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK);
+ if (ob->pose)
+ ob->pose->flag |= (POSE_LOCKED | POSE_DO_UNLOCK);
- rna_Constraint_update(bmain, scene, ptr);
+ rna_Constraint_update(bmain, scene, ptr);
}
static void rna_Constraint_ik_type_set(struct PointerRNA *ptr, int value)
{
- bConstraint *con = ptr->data;
- bKinematicConstraint *ikdata = con->data;
+ bConstraint *con = ptr->data;
+ bKinematicConstraint *ikdata = con->data;
- if (ikdata->type != value) {
- /* the type of IK constraint has changed, set suitable default values */
- /* in case constraints reuse same fields incompatible */
- switch (value) {
- case CONSTRAINT_IK_COPYPOSE:
- break;
- case CONSTRAINT_IK_DISTANCE:
- break;
- }
- ikdata->type = value;
- }
+ if (ikdata->type != value) {
+ /* the type of IK constraint has changed, set suitable default values */
+ /* in case constraints reuse same fields incompatible */
+ switch (value) {
+ case CONSTRAINT_IK_COPYPOSE:
+ break;
+ case CONSTRAINT_IK_DISTANCE:
+ break;
+ }
+ ikdata->type = value;
+ }
}
-static const EnumPropertyItem *rna_Constraint_owner_space_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Constraint_owner_space_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- Object *ob = (Object *)ptr->id.data;
- bConstraint *con = (bConstraint *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ bConstraint *con = (bConstraint *)ptr->data;
- if (BLI_findindex(&ob->constraints, con) == -1)
- return owner_space_pchan_items;
- else /* object */
- return space_object_items;
+ if (BLI_findindex(&ob->constraints, con) == -1)
+ return owner_space_pchan_items;
+ else /* object */
+ return space_object_items;
}
-static const EnumPropertyItem *rna_Constraint_target_space_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Constraint_target_space_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- bConstraint *con = (bConstraint *)ptr->data;
- const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
- ListBase targets = {NULL, NULL};
- bConstraintTarget *ct;
+ bConstraint *con = (bConstraint *)ptr->data;
+ const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_get(con);
+ ListBase targets = {NULL, NULL};
+ bConstraintTarget *ct;
- if (cti && cti->get_constraint_targets) {
- cti->get_constraint_targets(con, &targets);
+ if (cti && cti->get_constraint_targets) {
+ cti->get_constraint_targets(con, &targets);
- for (ct = targets.first; ct; ct = ct->next)
- if (ct->tar && ct->tar->type == OB_ARMATURE)
- break;
+ for (ct = targets.first; ct; ct = ct->next)
+ if (ct->tar && ct->tar->type == OB_ARMATURE)
+ break;
- if (cti->flush_constraint_targets)
- cti->flush_constraint_targets(con, &targets, 1);
+ if (cti->flush_constraint_targets)
+ cti->flush_constraint_targets(con, &targets, 1);
- if (ct)
- return target_space_pchan_items;
- }
+ if (ct)
+ return target_space_pchan_items;
+ }
- return space_object_items;
+ return space_object_items;
}
static bConstraintTarget *rna_ArmatureConstraint_target_new(ID *id, bConstraint *con, Main *bmain)
{
- bArmatureConstraint *acon = con->data;
- bConstraintTarget *tgt = MEM_callocN(sizeof(bConstraintTarget), "Constraint Target");
+ bArmatureConstraint *acon = con->data;
+ bConstraintTarget *tgt = MEM_callocN(sizeof(bConstraintTarget), "Constraint Target");
- tgt->weight = 1.0f;
- BLI_addtail(&acon->targets, tgt);
+ tgt->weight = 1.0f;
+ BLI_addtail(&acon->targets, tgt);
- ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
- return tgt;
+ ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
+ return tgt;
}
static void rna_ArmatureConstraint_target_remove(
- ID *id, bConstraint *con, Main *bmain, ReportList *reports, PointerRNA *target_ptr)
+ ID *id, bConstraint *con, Main *bmain, ReportList *reports, PointerRNA *target_ptr)
{
- bArmatureConstraint *acon = con->data;
- bConstraintTarget *tgt = target_ptr->data;
+ bArmatureConstraint *acon = con->data;
+ bConstraintTarget *tgt = target_ptr->data;
- if (BLI_findindex(&acon->targets, tgt) < 0) {
- BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
- return;
- }
+ if (BLI_findindex(&acon->targets, tgt) < 0) {
+ BKE_report(reports, RPT_ERROR, "Target is not in the constraint target list");
+ return;
+ }
- BLI_freelinkN(&acon->targets, tgt);
+ BLI_freelinkN(&acon->targets, tgt);
- ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
+ ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
}
static void rna_ArmatureConstraint_target_clear(ID *id, bConstraint *con, Main *bmain)
{
- bArmatureConstraint *acon = con->data;
+ bArmatureConstraint *acon = con->data;
- BLI_freelistN(&acon->targets);
+ BLI_freelistN(&acon->targets);
- ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
+ ED_object_constraint_dependency_tag_update(bmain, (Object *)id, con);
}
-static void rna_ActionConstraint_minmax_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_ActionConstraint_minmax_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- bConstraint *con = (bConstraint *)ptr->data;
- bActionConstraint *acon = (bActionConstraint *)con->data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bActionConstraint *acon = (bActionConstraint *)con->data;
- /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
- if (ELEM(acon->type, 0, 1, 2)) {
- *min = -180.0f;
- *max = 180.0f;
- }
- else {
- *min = -1000.f;
- *max = 1000.f;
- }
+ /* 0, 1, 2 = magic numbers for rotX, rotY, rotZ */
+ if (ELEM(acon->type, 0, 1, 2)) {
+ *min = -180.0f;
+ *max = 180.0f;
+ }
+ else {
+ *min = -1000.f;
+ *max = 1000.f;
+ }
}
-static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_SplineIKConstraint_joint_bindings_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- bConstraint *con = (bConstraint *)ptr->data;
- bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
- if (ikData)
- length[0] = ikData->numpoints;
- else
- length[0] = 256; /* for raw_access, untested */
+ if (ikData)
+ length[0] = ikData->numpoints;
+ else
+ length[0] = 256; /* for raw_access, untested */
- return length[0];
+ return length[0];
}
static void rna_SplineIKConstraint_joint_bindings_get(PointerRNA *ptr, float *values)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
- memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
+ memcpy(values, ikData->points, ikData->numpoints * sizeof(float));
}
static void rna_SplineIKConstraint_joint_bindings_set(PointerRNA *ptr, const float *values)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bSplineIKConstraint *ikData = (bSplineIKConstraint *)con->data;
- memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
+ memcpy(ikData->points, values, ikData->numpoints * sizeof(float));
}
static int rna_ShrinkwrapConstraint_face_cull_get(PointerRNA *ptr)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bShrinkwrapConstraint *swc = (bShrinkwrapConstraint *)con->data;
- return swc->flag & CON_SHRINKWRAP_PROJECT_CULL_MASK;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bShrinkwrapConstraint *swc = (bShrinkwrapConstraint *)con->data;
+ return swc->flag & CON_SHRINKWRAP_PROJECT_CULL_MASK;
}
static void rna_ShrinkwrapConstraint_face_cull_set(struct PointerRNA *ptr, int value)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bShrinkwrapConstraint *swc = (bShrinkwrapConstraint *)con->data;
- swc->flag = (swc->flag & ~CON_SHRINKWRAP_PROJECT_CULL_MASK) | value;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bShrinkwrapConstraint *swc = (bShrinkwrapConstraint *)con->data;
+ swc->flag = (swc->flag & ~CON_SHRINKWRAP_PROJECT_CULL_MASK) | value;
}
static bool rna_Constraint_cameraObject_poll(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)value.data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) {
- return 1;
- }
- }
+ if (ob) {
+ if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) {
+ return 1;
+ }
+ }
- return 0;
+ return 0;
}
static void rna_Constraint_followTrack_camera_set(PointerRNA *ptr, PointerRNA value)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data;
- Object *ob = (Object *)value.data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) {
- data->camera = ob;
- id_lib_extern((ID *)ob);
- }
- }
- else {
- data->camera = NULL;
- }
+ if (ob) {
+ if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) {
+ data->camera = ob;
+ id_lib_extern((ID *)ob);
+ }
+ }
+ else {
+ data->camera = NULL;
+ }
}
static void rna_Constraint_followTrack_depthObject_set(PointerRNA *ptr, PointerRNA value)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data;
- Object *ob = (Object *)value.data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bFollowTrackConstraint *data = (bFollowTrackConstraint *)con->data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- if (ob->type == OB_MESH && ob != (Object *)ptr->id.data) {
- data->depth_ob = ob;
- id_lib_extern((ID *)ob);
- }
- }
- else {
- data->depth_ob = NULL;
- }
+ if (ob) {
+ if (ob->type == OB_MESH && ob != (Object *)ptr->id.data) {
+ data->depth_ob = ob;
+ id_lib_extern((ID *)ob);
+ }
+ }
+ else {
+ data->depth_ob = NULL;
+ }
}
static bool rna_Constraint_followTrack_depthObject_poll(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)value.data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- if (ob->type == OB_MESH && ob != (Object *)ptr->id.data) {
- return 1;
- }
- }
+ if (ob) {
+ if (ob->type == OB_MESH && ob != (Object *)ptr->id.data) {
+ return 1;
+ }
+ }
- return 0;
+ return 0;
}
static void rna_Constraint_objectSolver_camera_set(PointerRNA *ptr, PointerRNA value)
{
- bConstraint *con = (bConstraint *)ptr->data;
- bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
- Object *ob = (Object *)value.data;
+ bConstraint *con = (bConstraint *)ptr->data;
+ bObjectSolverConstraint *data = (bObjectSolverConstraint *)con->data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) {
- data->camera = ob;
- id_lib_extern((ID *)ob);
- }
- }
- else {
- data->camera = NULL;
- }
+ if (ob) {
+ if (ob->type == OB_CAMERA && ob != (Object *)ptr->id.data) {
+ data->camera = ob;
+ id_lib_extern((ID *)ob);
+ }
+ }
+ else {
+ data->camera = NULL;
+ }
}
-static void rna_Constraint_transformCache_object_path_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_Constraint_transformCache_object_path_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *ptr)
{
-#ifdef WITH_ALEMBIC
- bConstraint *con = (bConstraint *)ptr->data;
- bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data;
- Object *ob = (Object *)ptr->id.data;
+# ifdef WITH_ALEMBIC
+ bConstraint *con = (bConstraint *)ptr->data;
+ bTransformCacheConstraint *data = (bTransformCacheConstraint *)con->data;
+ Object *ob = (Object *)ptr->id.data;
- data->reader = CacheReader_open_alembic_object(data->cache_file->handle,
- data->reader,
- ob,
- data->object_path);
-#endif
+ data->reader = CacheReader_open_alembic_object(
+ data->cache_file->handle, data->reader, ob, data->object_path);
+# endif
- rna_Constraint_update(bmain, scene, ptr);
+ rna_Constraint_update(bmain, scene, ptr);
}
#else
static const EnumPropertyItem constraint_distance_items[] = {
- {LIMITDIST_INSIDE, "LIMITDIST_INSIDE", 0, "Inside",
- "The object is constrained inside a virtual sphere around the target object, "
- "with a radius defined by the limit distance"},
- {LIMITDIST_OUTSIDE, "LIMITDIST_OUTSIDE", 0, "Outside",
- "The object is constrained outside a virtual sphere around the target object, "
- "with a radius defined by the limit distance"},
- {LIMITDIST_ONSURFACE, "LIMITDIST_ONSURFACE", 0, "On Surface",
- "The object is constrained on the surface of a virtual sphere around the target object, "
- "with a radius defined by the limit distance"},
- {0, NULL, 0, NULL, NULL},
+ {LIMITDIST_INSIDE,
+ "LIMITDIST_INSIDE",
+ 0,
+ "Inside",
+ "The object is constrained inside a virtual sphere around the target object, "
+ "with a radius defined by the limit distance"},
+ {LIMITDIST_OUTSIDE,
+ "LIMITDIST_OUTSIDE",
+ 0,
+ "Outside",
+ "The object is constrained outside a virtual sphere around the target object, "
+ "with a radius defined by the limit distance"},
+ {LIMITDIST_ONSURFACE,
+ "LIMITDIST_ONSURFACE",
+ 0,
+ "On Surface",
+ "The object is constrained on the surface of a virtual sphere around the target object, "
+ "with a radius defined by the limit distance"},
+ {0, NULL, 0, NULL, NULL},
};
-
static void rna_def_constraint_headtail_common(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
- RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "head_tail", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, "bConstraint", "headtail");
+ RNA_def_property_ui_text(prop, "Head/Tail", "Target along length of bone: Head=0, Tail=1");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_bbone_shape", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, "bConstraint", "flag", CONSTRAINT_BBONE_SHAPE);
- RNA_def_property_ui_text(prop, "Follow B-Bone", "Follow shape of B-Bone segments when calculating Head/Tail position");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ prop = RNA_def_property(srna, "use_bbone_shape", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, "bConstraint", "flag", CONSTRAINT_BBONE_SHAPE);
+ RNA_def_property_ui_text(prop,
+ "Follow B-Bone",
+ "Follow shape of B-Bone segments when calculating Head/Tail position");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
}
static void rna_def_constraint_target_common(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- 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_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ 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_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
}
static void rna_def_constrainttarget(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ConstraintTarget", NULL);
- RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
- RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
- RNA_def_struct_sdna(srna, "bConstraintTarget");
+ srna = RNA_def_struct(brna, "ConstraintTarget", NULL);
+ RNA_def_struct_ui_text(srna, "Constraint Target", "Target object for multi-target constraints");
+ RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
+ RNA_def_struct_sdna(srna, "bConstraintTarget");
- 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_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
+ 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_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(
+ prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
- prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
+ prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(prop, "Sub-Target", "Armature bone, mesh or lattice vertex group, ...");
+ RNA_def_property_update(
+ prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
- /* space, flag and type still to do */
+ /* space, flag and type still to do */
}
static void rna_def_constrainttarget_bone(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ConstraintTargetBone", NULL);
- RNA_def_struct_ui_text(srna, "Constraint Target Bone", "Target bone for multi-target constraints");
- RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
- RNA_def_struct_sdna(srna, "bConstraintTarget");
-
- 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 armature");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ConstraintTargetBone_target_set", NULL, "rna_Armature_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
-
- prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ConstraintTargetBone", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Constraint Target Bone", "Target bone for multi-target constraints");
+ RNA_def_struct_path_func(srna, "rna_ConstraintTarget_path");
+ RNA_def_struct_sdna(srna, "bConstraintTarget");
+
+ 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 armature");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ConstraintTargetBone_target_set", NULL, "rna_Armature_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(
+ prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
+
+ prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(prop, "Sub-Target", "Target armature bone");
+ RNA_def_property_update(
+ prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Blend Weight", "Blending weight of this bone");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_update");
}
static void rna_def_constraint_childof(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
- RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
+ srna = RNA_def_struct(brna, "ChildOfConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Child Of Constraint", "Create constraint-based parent-child relationship");
+ RNA_def_struct_sdna_from(srna, "bChildOfConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX);
- RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_location_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCX);
+ RNA_def_property_ui_text(prop, "Location X", "Use X Location of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY);
- RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_location_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCY);
+ RNA_def_property_ui_text(prop, "Location Y", "Use Y Location of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ);
- RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_location_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_LOCZ);
+ RNA_def_property_ui_text(prop, "Location Z", "Use Z Location of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX);
- RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_rotation_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTX);
+ RNA_def_property_ui_text(prop, "Rotation X", "Use X Rotation of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY);
- RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_rotation_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTY);
+ RNA_def_property_ui_text(prop, "Rotation Y", "Use Y Rotation of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ);
- RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_rotation_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_ROTZ);
+ RNA_def_property_ui_text(prop, "Rotation Z", "Use Z Rotation of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX);
- RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_scale_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEX);
+ RNA_def_property_ui_text(prop, "Scale X", "Use X Scale of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY);
- RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_scale_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEY);
+ RNA_def_property_ui_text(prop, "Scale Y", "Use Y Scale of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ);
- RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "invmat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
+ prop = RNA_def_property(srna, "use_scale_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CHILDOF_SIZEZ);
+ RNA_def_property_ui_text(prop, "Scale Z", "Use Z Scale of Parent");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "inverse_matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "invmat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Inverse Matrix", "Transformation matrix to apply before");
}
static void rna_def_constraint_python(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "PythonConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
- RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
+ srna = RNA_def_struct(brna, "PythonConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Python Constraint", "Use Python script for constraint evaluation");
+ RNA_def_struct_sdna_from(srna, "bPythonConstraint", "data");
- prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
- RNA_def_property_struct_type(prop, "ConstraintTarget");
- RNA_def_property_ui_text(prop, "Targets", "Target Objects");
+ prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
+ RNA_def_property_struct_type(prop, "ConstraintTarget");
+ RNA_def_property_ui_text(prop, "Targets", "Target Objects");
- prop = RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "tarnum");
- RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1-3 are needed");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ prop = RNA_def_property(srna, "target_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tarnum");
+ RNA_def_property_ui_text(prop, "Number of Targets", "Usually only 1-3 are needed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Script", "The text object that contains the Python script");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS);
- RNA_def_property_ui_text(prop, "Use Targets", "Use the targets indicated in the constraint panel");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ prop = RNA_def_property(srna, "use_targets", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_USETARGETS);
+ RNA_def_property_ui_text(
+ prop, "Use Targets", "Use the targets indicated in the constraint panel");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- prop = RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error");
+ prop = RNA_def_property(srna, "has_script_error", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PYCON_SCRIPTERROR);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Script Error", "The linked Python script has thrown an error");
}
-
static void rna_def_constraint_armature_deform_targets(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "ArmatureConstraintTargets");
- srna = RNA_def_struct(brna, "ArmatureConstraintTargets", NULL);
- RNA_def_struct_sdna(srna, "bConstraint");
- RNA_def_struct_ui_text(srna, "Armature Deform Constraint Targets", "Collection of target bones and weights");
+ RNA_def_property_srna(cprop, "ArmatureConstraintTargets");
+ srna = RNA_def_struct(brna, "ArmatureConstraintTargets", NULL);
+ RNA_def_struct_sdna(srna, "bConstraint");
+ RNA_def_struct_ui_text(
+ srna, "Armature Deform Constraint Targets", "Collection of target bones and weights");
- func = RNA_def_function(srna, "new", "rna_ArmatureConstraint_target_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Add a new target to the constraint");
- parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "New target bone");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_ArmatureConstraint_target_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add a new target to the constraint");
+ parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "New target bone");
+ RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "remove", "rna_ArmatureConstraint_target_remove");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Delete target from the constraint");
- parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "Target to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ func = RNA_def_function(srna, "remove", "rna_ArmatureConstraint_target_remove");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Delete target from the constraint");
+ parm = RNA_def_pointer(func, "target", "ConstraintTargetBone", "", "Target to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- func = RNA_def_function(srna, "clear", "rna_ArmatureConstraint_target_clear");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Delete all targets from object");
+ func = RNA_def_function(srna, "clear", "rna_ArmatureConstraint_target_clear");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Delete all targets from object");
}
static void rna_def_constraint_armature_deform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ArmatureConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Armature Constraint", "Applies transformations done by the Armature modifier");
- RNA_def_struct_sdna_from(srna, "bArmatureConstraint", "data");
-
- prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
- RNA_def_property_struct_type(prop, "ConstraintTargetBone");
- RNA_def_property_ui_text(prop, "Targets", "Target Bones");
- rna_def_constraint_armature_deform_targets(brna, prop);
-
- prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_QUATERNION);
- RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_ENVELOPE);
- RNA_def_property_ui_text(prop, "Use Envelopes",
- "Multiply weights by envelope for all bones, instead of acting like Vertex Group based blending. "
- "The specified weights are still used, and only the listed bones are considered");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_current_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_CUR_LOCATION);
- RNA_def_property_ui_text(prop, "Use Current Location",
- "Use the current bone location for envelopes and choosing B-Bone segments instead of rest position");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ArmatureConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Armature Constraint", "Applies transformations done by the Armature modifier");
+ RNA_def_struct_sdna_from(srna, "bArmatureConstraint", "data");
+
+ prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "targets", NULL);
+ RNA_def_property_struct_type(prop, "ConstraintTargetBone");
+ RNA_def_property_ui_text(prop, "Targets", "Target Bones");
+ rna_def_constraint_armature_deform_targets(brna, prop);
+
+ prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_QUATERNION);
+ RNA_def_property_ui_text(
+ prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_ENVELOPE);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Envelopes",
+ "Multiply weights by envelope for all bones, instead of acting like Vertex Group based "
+ "blending. "
+ "The specified weights are still used, and only the listed bones are considered");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_current_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ARMATURE_CUR_LOCATION);
+ RNA_def_property_ui_text(prop,
+ "Use Current Location",
+ "Use the current bone location for envelopes and choosing B-Bone "
+ "segments instead of rest position");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_kinematic(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem constraint_ik_axisref_items[] = {
- {0, "BONE", 0, "Bone", ""},
- {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem constraint_ik_type_items[] = {
- {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
- {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
- RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
-
- rna_def_constraint_target_common(srna);
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 10000);
- RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "poletar");
- RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "polesubtarget");
- RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "poleangle");
- RNA_def_property_range(prop, -M_PI, M_PI);
- RNA_def_property_ui_range(prop, -M_PI, M_PI, 10, 4);
- RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 1.f);
- RNA_def_property_ui_text(prop, "Weight", "For Tree-IK: Weight of position control for this target");
-
- prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "orientweight");
- RNA_def_property_range(prop, 0.01, 1.f);
- RNA_def_property_ui_text(prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rootbone");
- RNA_def_property_range(prop, 0, 255);
- RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
- RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
- RNA_def_property_ui_text(prop, "Axis Reference",
- "Constraint axis Lock options relative to Bone or Target reference");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_POS);
- RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_X);
- RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Y);
- RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Z);
- RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
- RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
- RNA_def_property_ui_text(prop, "Lock X Rot", "Constraint rotation along X axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
- RNA_def_property_ui_text(prop, "Lock Y Rot", "Constraint rotation along Y axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
- RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
- RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
- RNA_def_property_enum_items(prop, constraint_ik_type_items);
- RNA_def_property_ui_text(prop, "IK Type", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, constraint_distance_items);
- RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- 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, 100.f);
- RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem constraint_ik_axisref_items[] = {
+ {0, "BONE", 0, "Bone", ""},
+ {CONSTRAINT_IK_TARGETAXIS, "TARGET", 0, "Target", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem constraint_ik_type_items[] = {
+ {CONSTRAINT_IK_COPYPOSE, "COPY_POSE", 0, "Copy Pose", ""},
+ {CONSTRAINT_IK_DISTANCE, "DISTANCE", 0, "Distance", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "KinematicConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Kinematic Constraint", "Inverse Kinematics");
+ RNA_def_struct_sdna_from(srna, "bKinematicConstraint", "data");
+
+ rna_def_constraint_target_common(srna);
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_ui_text(prop, "Iterations", "Maximum number of solving iterations");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "pole_target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "poletar");
+ RNA_def_property_ui_text(prop, "Pole Target", "Object for pole rotation");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "pole_subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "polesubtarget");
+ RNA_def_property_ui_text(prop, "Pole Sub-Target", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "pole_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "poleangle");
+ RNA_def_property_range(prop, -M_PI, M_PI);
+ RNA_def_property_ui_range(prop, -M_PI, M_PI, 10, 4);
+ RNA_def_property_ui_text(prop, "Pole Angle", "Pole rotation offset");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 1.f);
+ RNA_def_property_ui_text(
+ prop, "Weight", "For Tree-IK: Weight of position control for this target");
+
+ prop = RNA_def_property(srna, "orient_weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "orientweight");
+ RNA_def_property_range(prop, 0.01, 1.f);
+ RNA_def_property_ui_text(
+ prop, "Orientation Weight", "For Tree-IK: Weight of orientation control for this target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rootbone");
+ RNA_def_property_range(prop, 0, 255);
+ RNA_def_property_ui_text(
+ prop, "Chain Length", "How many bones are included in the IK effect - 0 uses all bones");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "use_tail", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_TIP);
+ RNA_def_property_ui_text(prop, "Use Tail", "Include bone's tail as last element in chain");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "reference_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, constraint_ik_axisref_items);
+ RNA_def_property_ui_text(
+ prop, "Axis Reference", "Constraint axis Lock options relative to Bone or Target reference");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "use_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_POS);
+ RNA_def_property_ui_text(prop, "Position", "Chain follows position of target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "lock_location_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_X);
+ RNA_def_property_ui_text(prop, "Lock X Pos", "Constraint position along X axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "lock_location_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Y);
+ RNA_def_property_ui_text(prop, "Lock Y Pos", "Constraint position along Y axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "lock_location_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_POS_Z);
+ RNA_def_property_ui_text(prop, "Lock Z Pos", "Constraint position along Z axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_ROT);
+ RNA_def_property_ui_text(prop, "Rotation", "Chain follows rotation of target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "lock_rotation_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_X);
+ RNA_def_property_ui_text(prop, "Lock X Rot", "Constraint rotation along X axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "lock_rotation_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Y);
+ RNA_def_property_ui_text(prop, "Lock Y Rot", "Constraint rotation along Y axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "lock_rotation_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_IK_NO_ROT_Z);
+ RNA_def_property_ui_text(prop, "Lock Z Rot", "Constraint rotation along Z axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_IK_STRETCH);
+ RNA_def_property_ui_text(prop, "Stretch", "Enable IK Stretching");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "ik_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Constraint_ik_type_set", NULL);
+ RNA_def_property_enum_items(prop, constraint_ik_type_items);
+ RNA_def_property_ui_text(prop, "IK Type", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, constraint_distance_items);
+ RNA_def_property_ui_text(
+ prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ 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, 100.f);
+ RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_track_to(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- static const EnumPropertyItem up_items[] = {
- {TRACK_X, "UP_X", 0, "X", ""},
- {TRACK_Y, "UP_Y", 0, "Y", ""},
- {TRACK_Z, "UP_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem up_items[] = {
+ {TRACK_X, "UP_X", 0, "X", ""},
+ {TRACK_Y, "UP_Y", 0, "Y", ""},
+ {TRACK_Z, "UP_Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
- srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Track To Constraint", "Aim the constrained object toward the target");
+ srna = RNA_def_struct(brna, "TrackToConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Track To Constraint", "Aim the constrained object toward the target");
- rna_def_constraint_headtail_common(srna);
+ rna_def_constraint_headtail_common(srna);
- RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
+ RNA_def_struct_sdna_from(srna, "bTrackToConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "reserved1");
- RNA_def_property_enum_items(prop, track_axis_items);
- RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reserved1");
+ RNA_def_property_enum_items(prop, track_axis_items);
+ RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "reserved2");
- RNA_def_property_enum_items(prop, up_items);
- RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reserved2");
+ RNA_def_property_enum_items(prop, up_items);
+ RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP);
- RNA_def_property_ui_text(prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_target_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", TARGET_Z_UP);
+ RNA_def_property_ui_text(
+ prop, "Target Z", "Target's Z axis, not World Z axis, will constraint the Up direction");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_locate_like(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
+ srna = RNA_def_struct(brna, "CopyLocationConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Copy Location Constraint", "Copy the location of the target");
- rna_def_constraint_headtail_common(srna);
+ rna_def_constraint_headtail_common(srna);
- RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
+ RNA_def_struct_sdna_from(srna, "bLocateLikeConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
- RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X);
+ RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
- RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y);
+ RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
- RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z);
+ RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
- RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_X_INVERT);
+ RNA_def_property_ui_text(prop, "Invert X", "Invert the X location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
- RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Y_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
- RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_Z_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
- RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LOCLIKE_OFFSET);
+ RNA_def_property_ui_text(prop, "Offset", "Add original location into copied location");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_rotate_like(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
- RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
+ srna = RNA_def_struct(brna, "CopyRotationConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Copy Rotation Constraint", "Copy the rotation of the target");
+ RNA_def_struct_sdna_from(srna, "bRotateLikeConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X);
- RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X);
+ RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y);
- RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y);
+ RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z);
- RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z);
+ RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT);
- RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "invert_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_X_INVERT);
+ RNA_def_property_ui_text(prop, "Invert X", "Invert the X rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT);
- RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "invert_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Y_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Y", "Invert the Y rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT);
- RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "invert_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_Z_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Z", "Invert the Z rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_OFFSET);
- RNA_def_property_ui_text(prop, "Offset", "Add original rotation into copied rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ROTLIKE_OFFSET);
+ RNA_def_property_ui_text(prop, "Offset", "Add original rotation into copied rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_size_like(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
- RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
+ srna = RNA_def_struct(brna, "CopyScaleConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Copy Scale Constraint", "Copy the scale of the target");
+ RNA_def_struct_sdna_from(srna, "bSizeLikeConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
- RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_X);
+ RNA_def_property_ui_text(prop, "Copy X", "Copy the target's X scale");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
- RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Y);
+ RNA_def_property_ui_text(prop, "Copy Y", "Copy the target's Y scale");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
- RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_Z);
+ RNA_def_property_ui_text(prop, "Copy Z", "Copy the target's Z scale");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
- RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIZELIKE_OFFSET);
+ RNA_def_property_ui_text(prop, "Offset", "Combine original scale with copied scale");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIZELIKE_MULTIPLY);
- RNA_def_property_ui_text(prop, "Additive", "Use addition instead of multiplication to combine scale (2.7 compatibility)");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIZELIKE_MULTIPLY);
+ RNA_def_property_ui_text(
+ prop,
+ "Additive",
+ "Use addition instead of multiplication to combine scale (2.7 compatibility)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_same_volume(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem volume_items[] = {
- {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
- {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
- {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Maintain Volume Constraint",
- "Maintain a constant volume along a single scaling axis");
- RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
+ static const EnumPropertyItem volume_items[] = {
+ {SAMEVOL_X, "SAMEVOL_X", 0, "X", ""},
+ {SAMEVOL_Y, "SAMEVOL_Y", 0, "Y", ""},
+ {SAMEVOL_Z, "SAMEVOL_Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
- prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, volume_items);
- RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ srna = RNA_def_struct(brna, "MaintainVolumeConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna,
+ "Maintain Volume Constraint",
+ "Maintain a constant volume along a single scaling axis");
+ RNA_def_struct_sdna_from(srna, "bSameVolumeConstraint", "data");
- prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.001f, 100.0f);
- RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "free_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, volume_items);
+ RNA_def_property_ui_text(prop, "Free Axis", "The free scaling axis of the object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.001f, 100.0f);
+ RNA_def_property_ui_text(prop, "Volume", "Volume of the bone at rest");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_transform_like(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
+ srna = RNA_def_struct(brna, "CopyTransformsConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Copy Transforms Constraint", "Copy all the transforms of the target");
- rna_def_constraint_headtail_common(srna);
+ rna_def_constraint_headtail_common(srna);
- RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
+ RNA_def_struct_sdna_from(srna, "bTransLikeConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
}
static void rna_def_constraint_minmax(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem minmax_items[] = {
- {TRACK_X, "FLOOR_X", 0, "X", ""},
- {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
- {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
- {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
- {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
- {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Floor Constraint", "Use the target object for location limitation");
- RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
-
- rna_def_constraint_target_common(srna);
-
- prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "minmaxflag");
- RNA_def_property_enum_items(prop, minmax_items);
- RNA_def_property_ui_text(prop, "Floor Location", "Location of target that object will not pass through");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY);
- RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
- RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, -1);
- RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem minmax_items[] = {
+ {TRACK_X, "FLOOR_X", 0, "X", ""},
+ {TRACK_Y, "FLOOR_Y", 0, "Y", ""},
+ {TRACK_Z, "FLOOR_Z", 0, "Z", ""},
+ {TRACK_nX, "FLOOR_NEGATIVE_X", 0, "-X", ""},
+ {TRACK_nY, "FLOOR_NEGATIVE_Y", 0, "-Y", ""},
+ {TRACK_nZ, "FLOOR_NEGATIVE_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FloorConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Floor Constraint", "Use the target object for location limitation");
+ RNA_def_struct_sdna_from(srna, "bMinMaxConstraint", "data");
+
+ rna_def_constraint_target_common(srna);
+
+ prop = RNA_def_property(srna, "floor_location", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "minmaxflag");
+ RNA_def_property_enum_items(prop, minmax_items);
+ RNA_def_property_ui_text(
+ prop, "Floor Location", "Location of target that object will not pass through");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_sticky", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_STICKY);
+ RNA_def_property_ui_text(prop, "Sticky", "Immobilize object while constrained");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MINMAX_USEROT);
+ RNA_def_property_ui_text(prop, "Use Rotation", "Use the target's rotation to determine floor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, -1);
+ RNA_def_property_ui_text(prop, "Offset", "Offset of floor from object origin");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_action(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem transform_channel_items[] = {
- {20, "LOCATION_X", 0, "X Location", ""},
- {21, "LOCATION_Y", 0, "Y Location", ""},
- {22, "LOCATION_Z", 0, "Z Location", ""},
- {00, "ROTATION_X", 0, "X Rotation", ""},
- {01, "ROTATION_Y", 0, "Y Rotation", ""},
- {02, "ROTATION_Z", 0, "Z Rotation", ""},
- {10, "SCALE_X", 0, "X Scale", ""},
- {11, "SCALE_Y", 0, "Y Scale", ""},
- {12, "SCALE_Z", 0, "Z Scale", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Action Constraint", "Map an action to the transform axes of a bone");
- RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
-
- rna_def_constraint_target_common(srna);
-
- prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, transform_channel_items);
- RNA_def_property_ui_text(prop, "Transform Channel",
- "Transformation channel from the target that is used to key the Action");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "act");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
- RNA_def_property_ui_text(prop, "Action", "The constraining action");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ACTCON_BONE_USE_OBJECT_ACTION);
- RNA_def_property_ui_text(prop, "Object Action",
- "Bones only: apply the object's transformation channels of the action "
- "to the constrained bone, instead of bone's channels");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "start");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "end");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_range(prop, -1000.f, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
-
- prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_range(prop, -1000.f, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem transform_channel_items[] = {
+ {20, "LOCATION_X", 0, "X Location", ""},
+ {21, "LOCATION_Y", 0, "Y Location", ""},
+ {22, "LOCATION_Z", 0, "Z Location", ""},
+ {00, "ROTATION_X", 0, "X Rotation", ""},
+ {01, "ROTATION_Y", 0, "Y Rotation", ""},
+ {02, "ROTATION_Z", 0, "Z Rotation", ""},
+ {10, "SCALE_X", 0, "X Scale", ""},
+ {11, "SCALE_Y", 0, "Y Scale", ""},
+ {12, "SCALE_Z", 0, "Z Scale", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ActionConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Action Constraint", "Map an action to the transform axes of a bone");
+ RNA_def_struct_sdna_from(srna, "bActionConstraint", "data");
+
+ rna_def_constraint_target_common(srna);
+
+ prop = RNA_def_property(srna, "transform_channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, transform_channel_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Transform Channel",
+ "Transformation channel from the target that is used to key the Action");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "act");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
+ RNA_def_property_ui_text(prop, "Action", "The constraining action");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_bone_object_action", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ACTCON_BONE_USE_OBJECT_ACTION);
+ RNA_def_property_ui_text(prop,
+ "Object Action",
+ "Bones only: apply the object's transformation channels of the action "
+ "to the constrained bone, instead of bone's channels");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "start");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Start Frame", "First frame of the Action to use");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "end");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "End Frame", "Last frame of the Action to use");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_range(prop, -1000.f, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum", "Maximum value for target channel range");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
+
+ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_range(prop, -1000.f, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum", "Minimum value for target channel range");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_ActionConstraint_minmax_range");
}
static void rna_def_constraint_locked_track(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- static const EnumPropertyItem lock_items[] = {
- {TRACK_X, "LOCK_X", 0, "X", ""},
- {TRACK_Y, "LOCK_Y", 0, "Y", ""},
- {TRACK_Z, "LOCK_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem lock_items[] = {
+ {TRACK_X, "LOCK_X", 0, "X", ""},
+ {TRACK_Y, "LOCK_Y", 0, "Y", ""},
+ {TRACK_Z, "LOCK_Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
- srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Locked Track Constraint",
- "Point toward the target along the track axis, while locking the other axis");
+ srna = RNA_def_struct(brna, "LockedTrackConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna,
+ "Locked Track Constraint",
+ "Point toward the target along the track axis, while locking the other axis");
- rna_def_constraint_headtail_common(srna);
+ rna_def_constraint_headtail_common(srna);
- RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
+ RNA_def_struct_sdna_from(srna, "bLockTrackConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- 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, track_axis_items);
- RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ 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, track_axis_items);
+ RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "lockflag");
- RNA_def_property_enum_items(prop, lock_items);
- RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "lockflag");
+ RNA_def_property_enum_items(prop, lock_items);
+ RNA_def_property_ui_text(prop, "Locked Axis", "Axis that points upward");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_follow_path(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem forwardpath_items[] = {
- {TRACK_X, "FORWARD_X", 0, "X", ""},
- {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
- {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
- {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
- {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
- {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem pathup_items[] = {
- {TRACK_X, "UP_X", 0, "X", ""},
- {TRACK_Y, "UP_Y", 0, "Y", ""},
- {TRACK_Z, "UP_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
- RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tar");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
- RNA_def_property_ui_text(prop, "Target", "Target Curve object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Offset", "Offset from the position corresponding to the time frame");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "offset_fac");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Offset Factor", "Percentage value defining target position along length of curve");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "trackflag");
- RNA_def_property_enum_items(prop, forwardpath_items);
- RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- 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, pathup_items);
- RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
- RNA_def_property_ui_text(prop, "Follow Curve", "Object will follow the heading and banking of the curve");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
- RNA_def_property_ui_text(prop, "Fixed Position",
- "Object will stay locked to a single point somewhere along the length of the curve "
- "regardless of time");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
- RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem forwardpath_items[] = {
+ {TRACK_X, "FORWARD_X", 0, "X", ""},
+ {TRACK_Y, "FORWARD_Y", 0, "Y", ""},
+ {TRACK_Z, "FORWARD_Z", 0, "Z", ""},
+ {TRACK_nX, "TRACK_NEGATIVE_X", 0, "-X", ""},
+ {TRACK_nY, "TRACK_NEGATIVE_Y", 0, "-Y", ""},
+ {TRACK_nZ, "TRACK_NEGATIVE_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pathup_items[] = {
+ {TRACK_X, "UP_X", 0, "X", ""},
+ {TRACK_Y, "UP_Y", 0, "Y", ""},
+ {TRACK_Z, "UP_Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FollowPathConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Follow Path Constraint", "Lock motion to the target path");
+ RNA_def_struct_sdna_from(srna, "bFollowPathConstraint", "data");
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tar");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
+ RNA_def_property_ui_text(prop, "Target", "Target Curve object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(
+ prop, "Offset", "Offset from the position corresponding to the time frame");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "offset_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_fac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Offset Factor", "Percentage value defining target position along length of curve");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "trackflag");
+ RNA_def_property_enum_items(prop, forwardpath_items);
+ RNA_def_property_ui_text(prop, "Forward Axis", "Axis that points forward along the path");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ 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, pathup_items);
+ RNA_def_property_ui_text(prop, "Up Axis", "Axis that points upward");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_curve_follow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_FOLLOW);
+ RNA_def_property_ui_text(
+ prop, "Follow Curve", "Object will follow the heading and banking of the curve");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_fixed_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_STATIC);
+ RNA_def_property_ui_text(
+ prop,
+ "Fixed Position",
+ "Object will stay locked to a single point somewhere along the length of the curve "
+ "regardless of time");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "followflag", FOLLOWPATH_RADIUS);
+ RNA_def_property_ui_text(prop, "Curve Radius", "Object is scaled by the curve radius");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_stretch_to(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem volume_items[] = {
- {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
- {VOLUME_X, "VOLUME_X", 0, "X", ""},
- {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
- {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem plane_items[] = {
- {PLANE_X, "PLANE_X", 0, "X", "Keep X Axis"},
- {PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
-
- rna_def_constraint_headtail_common(srna);
-
- RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
-
- rna_def_constraint_target_common(srna);
-
- prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "volmode");
- RNA_def_property_enum_items(prop, volume_items);
- RNA_def_property_ui_text(prop, "Maintain Volume", "Maintain the object's volume as it stretches");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "plane");
- RNA_def_property_enum_items(prop, plane_items);
- RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "orglength");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_range(prop, 0, 100.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.f);
- RNA_def_property_ui_text(prop, "Volume Variation", "Factor between volume variation and stretching");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", STRETCHTOCON_USE_BULGE_MIN);
- RNA_def_property_ui_text(prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", STRETCHTOCON_USE_BULGE_MAX);
- RNA_def_property_ui_text(prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 1.0, 100.0f);
- RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem volume_items[] = {
+ {VOLUME_XZ, "VOLUME_XZX", 0, "XZ", ""},
+ {VOLUME_X, "VOLUME_X", 0, "X", ""},
+ {VOLUME_Z, "VOLUME_Z", 0, "Z", ""},
+ {NO_VOLUME, "NO_VOLUME", 0, "None", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem plane_items[] = {
+ {PLANE_X, "PLANE_X", 0, "X", "Keep X Axis"},
+ {PLANE_Z, "PLANE_Z", 0, "Z", "Keep Z Axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "StretchToConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Stretch To Constraint", "Stretch to meet the target object");
+
+ rna_def_constraint_headtail_common(srna);
+
+ RNA_def_struct_sdna_from(srna, "bStretchToConstraint", "data");
+
+ rna_def_constraint_target_common(srna);
+
+ prop = RNA_def_property(srna, "volume", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "volmode");
+ RNA_def_property_enum_items(prop, volume_items);
+ RNA_def_property_ui_text(
+ prop, "Maintain Volume", "Maintain the object's volume as it stretches");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "keep_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "plane");
+ RNA_def_property_enum_items(prop, plane_items);
+ RNA_def_property_ui_text(prop, "Keep Axis", "Axis to maintain during stretch");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "orglength");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0, 100.0f, 10, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_ui_text(prop, "Original Length", "Length at rest position");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.f);
+ RNA_def_property_ui_text(
+ prop, "Volume Variation", "Factor between volume variation and stretching");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", STRETCHTOCON_USE_BULGE_MIN);
+ RNA_def_property_ui_text(
+ prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", STRETCHTOCON_USE_BULGE_MAX);
+ RNA_def_property_ui_text(
+ prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0, 100.0f);
+ RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_clamp_to(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem clamp_items[] = {
- {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
- {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
- {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
- {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Clamp To Constraint",
- "Constrain an object's location to the nearest point along the target path");
- RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tar");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
- RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, clamp_items);
- RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem clamp_items[] = {
+ {CLAMPTO_AUTO, "CLAMPTO_AUTO", 0, "Auto", ""},
+ {CLAMPTO_X, "CLAMPTO_X", 0, "X", ""},
+ {CLAMPTO_Y, "CLAMPTO_Y", 0, "Y", ""},
+ {CLAMPTO_Z, "CLAMPTO_Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ClampToConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna,
+ "Clamp To Constraint",
+ "Constrain an object's location to the nearest point along the target path");
+ RNA_def_struct_sdna_from(srna, "bClampToConstraint", "data");
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tar");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
+ RNA_def_property_ui_text(prop, "Target", "Target Object (Curves only)");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "main_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, clamp_items);
+ RNA_def_property_ui_text(prop, "Main Axis", "Main axis of movement");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", CLAMPTO_CYCLIC);
+ RNA_def_property_ui_text(
+ prop, "Cyclic", "Treat curve as cyclic curve (no clamping to curve bounding box)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_transform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem transform_items[] = {
- {TRANS_LOCATION, "LOCATION", 0, "Loc", ""},
- {TRANS_ROTATION, "ROTATION", 0, "Rot", ""},
- {TRANS_SCALE, "SCALE", 0, "Scale", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Transformation Constraint", "Map transformations of the target to the object");
- RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
-
- rna_def_constraint_target_common(srna);
-
- prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "from");
- RNA_def_property_enum_items(prop, transform_items);
- RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "to");
- RNA_def_property_enum_items(prop, transform_items);
- RNA_def_property_ui_text(prop, "Map To", "The transformation type to affect of the constrained object");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "map[0]");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Map To X From", "The source axis constrained object's X axis uses");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "map[1]");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Map To Y From", "The source axis constrained object's Y axis uses");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "map[2]");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Map To Z From", "The source axis constrained object's Z axis uses");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC);
- RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* Loc */
- prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* Rot */
- prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "from_min_rot[0]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "from_min_rot[1]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "from_min_rot[2]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "from_max_rot[0]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "from_max_rot[1]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "from_max_rot[2]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "to_min_rot[0]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "to_min_rot[1]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "to_min_rot[2]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "to_max_rot[0]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "to_max_rot[1]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "to_max_rot[2]");
- RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* Scale */
- prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "from_min_scale[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "from_min_scale[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "from_min_scale[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "from_max_scale[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "from_max_scale[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "from_max_scale[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "to_min_scale[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "to_min_scale[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "to_min_scale[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "to_max_scale[0]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "to_max_scale[1]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "to_max_scale[2]");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem transform_items[] = {
+ {TRANS_LOCATION, "LOCATION", 0, "Loc", ""},
+ {TRANS_ROTATION, "ROTATION", 0, "Rot", ""},
+ {TRANS_SCALE, "SCALE", 0, "Scale", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "TransformConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Transformation Constraint", "Map transformations of the target to the object");
+ RNA_def_struct_sdna_from(srna, "bTransformConstraint", "data");
+
+ rna_def_constraint_target_common(srna);
+
+ prop = RNA_def_property(srna, "map_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "from");
+ RNA_def_property_enum_items(prop, transform_items);
+ RNA_def_property_ui_text(prop, "Map From", "The transformation type to use from the target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "map_to", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "to");
+ RNA_def_property_enum_items(prop, transform_items);
+ RNA_def_property_ui_text(
+ prop, "Map To", "The transformation type to affect of the constrained object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "map_to_x_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "map[0]");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(
+ prop, "Map To X From", "The source axis constrained object's X axis uses");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "map_to_y_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "map[1]");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(
+ prop, "Map To Y From", "The source axis constrained object's Y axis uses");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "map_to_z_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "map[2]");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(
+ prop, "Map To Z From", "The source axis constrained object's Z axis uses");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_motion_extrapolate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "expo", CLAMPTO_CYCLIC);
+ RNA_def_property_ui_text(prop, "Extrapolate Motion", "Extrapolate ranges");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* Loc */
+ prop = RNA_def_property(srna, "from_min_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* Rot */
+ prop = RNA_def_property(srna, "from_min_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min_rot[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min_rot[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min_rot[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max_rot[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max_rot[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max_rot[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min_rot[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min_rot[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min_rot[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_x_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max_rot[0]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_y_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max_rot[1]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_z_rot", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max_rot[2]");
+ RNA_def_property_ui_range(prop, DEG2RADF(-180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* Scale */
+ prop = RNA_def_property(srna, "from_min_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min_scale[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum X", "Bottom range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min_scale[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Y", "Bottom range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_min_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_min_scale[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Minimum Z", "Bottom range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max_scale[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum X", "Top range of X axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max_scale[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Y", "Top range of Y axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "from_max_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "from_max_scale[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "From Maximum Z", "Top range of Z axis source motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min_scale[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum X", "Bottom range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min_scale[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Y", "Bottom range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_min_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_min_scale[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Minimum Z", "Bottom range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_x_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max_scale[0]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum X", "Top range of X axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_y_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max_scale[1]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Y", "Top range of Y axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "to_max_z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "to_max_scale[2]");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "To Maximum Z", "Top range of Z axis destination motion");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_location_limit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Location Constraint", "Limit the location of the constrained object");
- RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
-
- prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
- RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
- RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
- RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
- RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
- RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
- RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "xmin");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "ymin");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "zmin");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "xmax");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "ymax");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "zmax");
- RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
- RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LimitLocationConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Limit Location Constraint", "Limit the location of the constrained object");
+ RNA_def_struct_sdna_from(srna, "bLocLimitConstraint", "data");
+
+ prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
+ RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
+ RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
+ RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
+ RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
+ RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
+ RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "xmin");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "ymin");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "zmin");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "xmax");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "ymax");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "zmax");
+ RNA_def_property_ui_range(prop, -1000.0f, 1000.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
+ RNA_def_property_ui_text(
+ prop, "For Transform", "Transforms are affected by this constraint as well");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_rotation_limit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
- RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
-
- prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT);
- RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
- 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", LIMIT_YROT);
- RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
- 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", LIMIT_ZROT);
- RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "xmin");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "ymin");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "zmin");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "xmax");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "ymax");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "zmax");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
- RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LimitRotationConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Limit Rotation Constraint", "Limit the rotation of the constrained object");
+ RNA_def_struct_sdna_from(srna, "bRotLimitConstraint", "data");
+
+ prop = RNA_def_property(srna, "use_limit_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XROT);
+ RNA_def_property_ui_text(prop, "Limit X", "Use the minimum X value");
+ 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", LIMIT_YROT);
+ RNA_def_property_ui_text(prop, "Limit Y", "Use the minimum Y value");
+ 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", LIMIT_ZROT);
+ RNA_def_property_ui_text(prop, "Limit Z", "Use the minimum Z value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "xmin");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "ymin");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "zmin");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "xmax");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "ymax");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "zmax");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
+ RNA_def_property_ui_text(
+ prop, "For Transform", "Transforms are affected by this constraint as well");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_size_limit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
- RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
-
- prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
- RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
- RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
- RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
- RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
- RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
- RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xmin");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ymin");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zmin");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xmax");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ymax");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zmax");
- RNA_def_property_range(prop, -1000.0, 1000.f);
- RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
- RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LimitScaleConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Limit Size Constraint", "Limit the scaling of the constrained object");
+ RNA_def_struct_sdna_from(srna, "bSizeLimitConstraint", "data");
+
+ prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMIN);
+ RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMIN);
+ RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_min_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMIN);
+ RNA_def_property_ui_text(prop, "Minimum Z", "Use the minimum Z value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_XMAX);
+ RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_YMAX);
+ RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_max_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMIT_ZMAX);
+ RNA_def_property_ui_text(prop, "Maximum Z", "Use the maximum Z value");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xmin");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ymin");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "min_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zmin");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Minimum Z", "Lowest Z value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xmax");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ymax");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "max_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zmax");
+ RNA_def_property_range(prop, -1000.0, 1000.f);
+ RNA_def_property_ui_text(prop, "Maximum Z", "Highest Z value to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", LIMIT_TRANSFORM);
+ RNA_def_property_ui_text(
+ prop, "For Transform", "Transforms are affected by this constraint as well");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_distance_limit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Limit Distance Constraint", "Limit the distance from target object");
+ srna = RNA_def_struct(brna, "LimitDistanceConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Limit Distance Constraint", "Limit the distance from target object");
- rna_def_constraint_headtail_common(srna);
+ rna_def_constraint_headtail_common(srna);
- RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
+ RNA_def_struct_sdna_from(srna, "bDistLimitConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Distance", "Radius of limiting sphere");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, constraint_distance_items);
- RNA_def_property_ui_text(prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "limit_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, constraint_distance_items);
+ RNA_def_property_ui_text(
+ prop, "Limit Mode", "Distances in relation to sphere of influence to allow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
- prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMITDIST_TRANSFORM);
- RNA_def_property_ui_text(prop, "For Transform", "Transforms are affected by this constraint as well");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ prop = RNA_def_property(srna, "use_transform_limit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIMITDIST_TRANSFORM);
+ RNA_def_property_ui_text(
+ prop, "For Transform", "Transforms are affected by this constraint as well");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_shrinkwrap(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem type_items[] = {
- {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACE", 0, "Nearest Surface Point",
- "Shrink the location to the nearest target surface"},
- {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
- "Shrink the location to the nearest target surface along a given axis"},
- {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
- "Shrink the location to the nearest target vertex"},
- {MOD_SHRINKWRAP_TARGET_PROJECT, "TARGET_PROJECT", 0, "Target Normal Project",
- "Shrink the location to the nearest target surface "
- "along the interpolated vertex normals of the target"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem shrink_face_cull_items[] = {
- {0, "OFF", 0, "Off", "No culling"},
- {CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
- {CON_SHRINKWRAP_PROJECT_CULL_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
- RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "target"); /* TODO, mesh type */
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
- RNA_def_property_ui_text(prop, "Target", "Target Mesh object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shrinkMode");
- RNA_def_property_enum_items(prop, rna_enum_modifier_shrinkwrap_mode_items);
- RNA_def_property_ui_text(prop, "Snap Mode", "Select how to constrain the object to the target surface");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "project_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projAxis");
- RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Project Axis", "Axis constrain to");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "project_axis_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projAxisSpace");
- RNA_def_property_enum_items(prop, owner_space_pchan_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
- RNA_def_property_ui_text(prop, "Axis Space", "Space for the projection axis");
-
- prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "projLimit");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Project Distance", "Limit the distance used for projection (zero disables)");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_project_opposite", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_PROJECT_OPPOSITE);
- RNA_def_property_ui_text(prop, "Project Opposite", "Project in both specified and opposite directions");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, shrink_face_cull_items);
- RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapConstraint_face_cull_get",
- "rna_ShrinkwrapConstraint_face_cull_set", NULL);
- RNA_def_property_ui_text(prop, "Face Cull",
- "Stop vertices from projecting to a face on the target when facing towards/away");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_PROJECT_INVERT_CULL);
- RNA_def_property_ui_text(prop, "Invert Cull", "When projecting in the opposite direction invert the face cull mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_track_normal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_TRACK_NORMAL);
- RNA_def_property_ui_text(prop, "Align Axis To Normal", "Align the specified axis to the surface normal");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "trackAxis");
- RNA_def_property_enum_items(prop, track_axis_items);
- RNA_def_property_ui_text(prop, "Track Axis", "Axis that is aligned to the normal");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem type_items[] = {
+ {MOD_SHRINKWRAP_NEAREST_SURFACE,
+ "NEAREST_SURFACE",
+ 0,
+ "Nearest Surface Point",
+ "Shrink the location to the nearest target surface"},
+ {MOD_SHRINKWRAP_PROJECT,
+ "PROJECT",
+ 0,
+ "Project",
+ "Shrink the location to the nearest target surface along a given axis"},
+ {MOD_SHRINKWRAP_NEAREST_VERTEX,
+ "NEAREST_VERTEX",
+ 0,
+ "Nearest Vertex",
+ "Shrink the location to the nearest target vertex"},
+ {MOD_SHRINKWRAP_TARGET_PROJECT,
+ "TARGET_PROJECT",
+ 0,
+ "Target Normal Project",
+ "Shrink the location to the nearest target surface "
+ "along the interpolated vertex normals of the target"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem shrink_face_cull_items[] = {
+ {0, "OFF", 0, "Off", "No culling"},
+ {CON_SHRINKWRAP_PROJECT_CULL_FRONTFACE,
+ "FRONT",
+ 0,
+ "Front",
+ "No projection when in front of the face"},
+ {CON_SHRINKWRAP_PROJECT_CULL_BACKFACE,
+ "BACK",
+ 0,
+ "Back",
+ "No projection when behind the face"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ShrinkwrapConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Shrinkwrap Constraint", "Create constraint-based shrinkwrap relationship");
+ RNA_def_struct_sdna_from(srna, "bShrinkwrapConstraint", "data");
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target"); /* TODO, mesh type */
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
+ RNA_def_property_ui_text(prop, "Target", "Target Mesh object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "shrinkwrap_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(
+ prop, "Shrinkwrap Type", "Select type of shrinkwrap algorithm for target position");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shrinkMode");
+ RNA_def_property_enum_items(prop, rna_enum_modifier_shrinkwrap_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Snap Mode", "Select how to constrain the object to the target surface");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Distance", "Distance to Target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "project_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projAxis");
+ RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(prop, "Project Axis", "Axis constrain to");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "project_axis_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projAxisSpace");
+ RNA_def_property_enum_items(prop, owner_space_pchan_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
+ RNA_def_property_ui_text(prop, "Axis Space", "Space for the projection axis");
+
+ prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "projLimit");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Project Distance", "Limit the distance used for projection (zero disables)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_project_opposite", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_PROJECT_OPPOSITE);
+ RNA_def_property_ui_text(
+ prop, "Project Opposite", "Project in both specified and opposite directions");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, shrink_face_cull_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_ShrinkwrapConstraint_face_cull_get",
+ "rna_ShrinkwrapConstraint_face_cull_set",
+ NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Face Cull",
+ "Stop vertices from projecting to a face on the target when facing towards/away");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_PROJECT_INVERT_CULL);
+ RNA_def_property_ui_text(
+ prop, "Invert Cull", "When projecting in the opposite direction invert the face cull mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_track_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CON_SHRINKWRAP_TRACK_NORMAL);
+ RNA_def_property_ui_text(
+ prop, "Align Axis To Normal", "Align the specified axis to the surface normal");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "track_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "trackAxis");
+ RNA_def_property_enum_items(prop, track_axis_items);
+ RNA_def_property_ui_text(prop, "Track Axis", "Axis that is aligned to the normal");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_damped_track(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Damped Track Constraint",
- "Point toward target by taking the shortest rotation path");
+ srna = RNA_def_struct(brna, "DampedTrackConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Damped Track Constraint", "Point toward target by taking the shortest rotation path");
-rna_def_constraint_headtail_common(srna);
+ rna_def_constraint_headtail_common(srna);
- RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
+ RNA_def_struct_sdna_from(srna, "bDampTrackConstraint", "data");
- rna_def_constraint_target_common(srna);
+ rna_def_constraint_target_common(srna);
- 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, track_axis_items);
- RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ 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, track_axis_items);
+ RNA_def_property_ui_text(prop, "Track Axis", "Axis that points to the target object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_spline_ik(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem splineik_xz_scale_mode[] = {
- {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
- {CONSTRAINT_SPLINEIK_XZS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original",
- "Use the original scaling of the bones"},
- {CONSTRAINT_SPLINEIK_XZS_INVERSE, "INVERSE_PRESERVE", 0, "Inverse Scale",
- "Scale of the X and Z axes is the inverse of the Y-Scale"},
- {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC, "VOLUME_PRESERVE", 0, "Volume Preservation",
- "Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem splineik_y_scale_mode[] = {
- {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"},
- {CONSTRAINT_SPLINEIK_YS_FIT_CURVE, "FIT_CURVE", 0, "Fit Curve",
- "Scale the bones to fit the entire length of the curve"},
- {CONSTRAINT_SPLINEIK_YS_ORIGINAL, "BONE_ORIGINAL", 0, "Bone Original",
- "Use the original Y scale of the bone"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
- RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
-
- /* target chain */
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tar");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
- RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "chainlen");
- /* TODO: this should really check the max length of the chain the constraint is attached to */
- RNA_def_property_range(prop, 1, 255);
- RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
- /* XXX: this update goes wrong... needs extra flush? */
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* direct access to bindings */
- /* NOTE: only to be used by experienced users */
- prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
- RNA_def_property_float_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get",
- "rna_SplineIKConstraint_joint_bindings_set", NULL);
- RNA_def_property_ui_text(prop, "Joint Bindings",
- "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
- "as percentages");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* settings */
- prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT);
- RNA_def_property_ui_text(prop, "Chain Offset", "Offset the entire chain relative to the root joint");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
- RNA_def_property_ui_text(prop, "Even Divisions",
- "Ignore the relative lengths of the bones when fitting to the curve");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
- RNA_def_property_ui_text(prop, "Use Curve Radius",
- "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
- "on top of XZ Scale mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* xz scaling mode */
- prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
- RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
- RNA_def_property_ui_text(prop, "XZ Scale Mode",
- "Method used for determining the scaling of the X and Z axes of the bones");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* y scaling mode */
- prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "yScaleMode");
- RNA_def_property_enum_items(prop, splineik_y_scale_mode);
- RNA_def_property_ui_text(prop, "Y Scale Mode",
- "Method used for determining the scaling of the Y axis of the bones, "
- "on top of the shape and scaling of the curve itself");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* volume presevation for "volumetric" scale mode */
- prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.f);
- RNA_def_property_ui_text(prop, "Volume Variation", "Factor between volume variation and stretching");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_BULGE_MIN);
- RNA_def_property_ui_text(prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_BULGE_MAX);
- RNA_def_property_ui_text(prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 1.0, 100.0f);
- RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem splineik_xz_scale_mode[] = {
+ {CONSTRAINT_SPLINEIK_XZS_NONE, "NONE", 0, "None", "Don't scale the X and Z axes (Default)"},
+ {CONSTRAINT_SPLINEIK_XZS_ORIGINAL,
+ "BONE_ORIGINAL",
+ 0,
+ "Bone Original",
+ "Use the original scaling of the bones"},
+ {CONSTRAINT_SPLINEIK_XZS_INVERSE,
+ "INVERSE_PRESERVE",
+ 0,
+ "Inverse Scale",
+ "Scale of the X and Z axes is the inverse of the Y-Scale"},
+ {CONSTRAINT_SPLINEIK_XZS_VOLUMETRIC,
+ "VOLUME_PRESERVE",
+ 0,
+ "Volume Preservation",
+ "Scale of the X and Z axes are adjusted to preserve the volume of the bones"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem splineik_y_scale_mode[] = {
+ {CONSTRAINT_SPLINEIK_YS_NONE, "NONE", 0, "None", "Don't scale in the Y axis"},
+ {CONSTRAINT_SPLINEIK_YS_FIT_CURVE,
+ "FIT_CURVE",
+ 0,
+ "Fit Curve",
+ "Scale the bones to fit the entire length of the curve"},
+ {CONSTRAINT_SPLINEIK_YS_ORIGINAL,
+ "BONE_ORIGINAL",
+ 0,
+ "Bone Original",
+ "Use the original Y scale of the bone"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SplineIKConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Spline IK Constraint", "Align 'n' bones along a curve");
+ RNA_def_struct_sdna_from(srna, "bSplineIKConstraint", "data");
+
+ /* target chain */
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tar");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_object_poll");
+ RNA_def_property_ui_text(prop, "Target", "Curve that controls this relationship");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "chainlen");
+ /* TODO: this should really check the max length of the chain the constraint is attached to */
+ RNA_def_property_range(prop, 1, 255);
+ RNA_def_property_ui_text(prop, "Chain Length", "How many bones are included in the chain");
+ /* XXX: this update goes wrong... needs extra flush? */
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* direct access to bindings */
+ /* NOTE: only to be used by experienced users */
+ prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length");
+ RNA_def_property_float_funcs(prop,
+ "rna_SplineIKConstraint_joint_bindings_get",
+ "rna_SplineIKConstraint_joint_bindings_set",
+ NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Joint Bindings",
+ "(EXPERIENCED USERS ONLY) The relative positions of the joints along the chain, "
+ "as percentages");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* settings */
+ prop = RNA_def_property(srna, "use_chain_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_ROOT);
+ RNA_def_property_ui_text(
+ prop, "Chain Offset", "Offset the entire chain relative to the root joint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_even_divisions", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_EVENSPLITS);
+ RNA_def_property_ui_text(prop,
+ "Even Divisions",
+ "Ignore the relative lengths of the bones when fitting to the curve");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_curve_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_NO_CURVERAD);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Curve Radius",
+ "Average radius of the endpoints is used to tweak the X and Z Scaling of the bones, "
+ "on top of XZ Scale mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* xz scaling mode */
+ prop = RNA_def_property(srna, "xz_scale_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "xzScaleMode");
+ RNA_def_property_enum_items(prop, splineik_xz_scale_mode);
+ RNA_def_property_ui_text(
+ prop,
+ "XZ Scale Mode",
+ "Method used for determining the scaling of the X and Z axes of the bones");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* y scaling mode */
+ prop = RNA_def_property(srna, "y_scale_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "yScaleMode");
+ RNA_def_property_enum_items(prop, splineik_y_scale_mode);
+ RNA_def_property_ui_text(prop,
+ "Y Scale Mode",
+ "Method used for determining the scaling of the Y axis of the bones, "
+ "on top of the shape and scaling of the curve itself");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* volume presevation for "volumetric" scale mode */
+ prop = RNA_def_property(srna, "bulge", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.f);
+ RNA_def_property_ui_text(
+ prop, "Volume Variation", "Factor between volume variation and stretching");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_bulge_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_BULGE_MIN);
+ RNA_def_property_ui_text(
+ prop, "Use Volume Variation Minimum", "Use lower limit for volume variation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "use_bulge_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_SPLINEIK_USE_BULGE_MAX);
+ RNA_def_property_ui_text(
+ prop, "Use Volume Variation Maximum", "Use upper limit for volume variation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Volume Variation Minimum", "Minimum volume stretching factor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0, 100.0f);
+ RNA_def_property_ui_text(prop, "Volume Variation Maximum", "Maximum volume stretching factor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "bulge_smooth", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Volume Variation Smoothness", "Strength of volume stretching clamping");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_pivot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem pivot_rotAxis_items[] = {
- {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
- {PIVOTCON_AXIS_X_NEG, "NX", 0, "-X Rot",
- "Use the pivot point in the negative rotation range around the X-axis"},
- {PIVOTCON_AXIS_Y_NEG, "NY", 0, "-Y Rot",
- "Use the pivot point in the negative rotation range around the Y-axis"},
- {PIVOTCON_AXIS_Z_NEG, "NZ", 0, "-Z Rot",
- "Use the pivot point in the negative rotation range around the Z-axis"},
- {PIVOTCON_AXIS_X, "X", 0, "X Rot", "Use the pivot point in the positive rotation range around the X-axis"},
- {PIVOTCON_AXIS_Y, "Y", 0, "Y Rot", "Use the pivot point in the positive rotation range around the Y-axis"},
- {PIVOTCON_AXIS_Z, "Z", 0, "Z Rot", "Use the pivot point in the positive rotation range around the Z-axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
-
- rna_def_constraint_headtail_common(srna);
-
- RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
-
- /* target-defined pivot */
- 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, defining the position of the pivot when defined");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(prop, "Sub-Target", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* pivot offset */
- prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
- RNA_def_property_ui_text(prop, "Use Relative Offset",
- "Offset will be an absolute point in space instead of relative to the target");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset",
- "Offset of pivot from target (when set), or from owner's location "
- "(when Fixed Position is off), or the absolute pivot point");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* rotation-based activation */
- prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "rotAxis");
- RNA_def_property_enum_items(prop, pivot_rotAxis_items);
- RNA_def_property_ui_text(prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem pivot_rotAxis_items[] = {
+ {PIVOTCON_AXIS_NONE, "ALWAYS_ACTIVE", 0, "Always", "Use the pivot point in every rotation"},
+ {PIVOTCON_AXIS_X_NEG,
+ "NX",
+ 0,
+ "-X Rot",
+ "Use the pivot point in the negative rotation range around the X-axis"},
+ {PIVOTCON_AXIS_Y_NEG,
+ "NY",
+ 0,
+ "-Y Rot",
+ "Use the pivot point in the negative rotation range around the Y-axis"},
+ {PIVOTCON_AXIS_Z_NEG,
+ "NZ",
+ 0,
+ "-Z Rot",
+ "Use the pivot point in the negative rotation range around the Z-axis"},
+ {PIVOTCON_AXIS_X,
+ "X",
+ 0,
+ "X Rot",
+ "Use the pivot point in the positive rotation range around the X-axis"},
+ {PIVOTCON_AXIS_Y,
+ "Y",
+ 0,
+ "Y Rot",
+ "Use the pivot point in the positive rotation range around the Y-axis"},
+ {PIVOTCON_AXIS_Z,
+ "Z",
+ 0,
+ "Z Rot",
+ "Use the pivot point in the positive rotation range around the Z-axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "PivotConstraint", "Constraint");
+ RNA_def_struct_ui_text(srna, "Pivot Constraint", "Rotate around a different point");
+
+ rna_def_constraint_headtail_common(srna);
+
+ RNA_def_struct_sdna_from(srna, "bPivotConstraint", "data");
+
+ /* target-defined pivot */
+ 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, defining the position of the pivot when defined");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(prop, "Sub-Target", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* pivot offset */
+ prop = RNA_def_property(srna, "use_relative_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PIVOTCON_FLAG_OFFSET_ABS);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Relative Offset",
+ "Offset will be an absolute point in space instead of relative to the target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop,
+ "Offset",
+ "Offset of pivot from target (when set), or from owner's location "
+ "(when Fixed Position is off), or the absolute pivot point");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* rotation-based activation */
+ prop = RNA_def_property(srna, "rotation_range", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotAxis");
+ RNA_def_property_enum_items(prop, pivot_rotAxis_items);
+ RNA_def_property_ui_text(
+ prop, "Enabled Rotation Range", "Rotation range on which pivoting should occur");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_follow_track(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem frame_method_items[] = {
- {FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
- {FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
- {FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Follow Track Constraint", "Lock motion to the target motion track");
- RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
-
- /* movie clip */
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clip");
- RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* track */
- prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "track");
- RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* use default clip */
- prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
- RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* use 3d position */
- prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION);
- RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* object */
- prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "object");
- RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* camera */
- prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "camera");
- RNA_def_property_ui_text(prop, "Camera",
- "Camera to which motion is parented (if empty active scene camera is used)");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_camera_set", NULL,
- "rna_Constraint_cameraObject_poll");
-
- /* depth object */
- prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "depth_ob");
- RNA_def_property_ui_text(prop, "Depth Object",
- "Object used to define depth in camera space by projecting onto surface of this object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_followTrack_depthObject_set", NULL,
- "rna_Constraint_followTrack_depthObject_poll");
-
- /* frame method */
- prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "frame_method");
- RNA_def_property_enum_items(prop, frame_method_items);
- RNA_def_property_ui_text(prop, "Frame Method", "How the footage fits in the camera frame");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* use undistortion */
- prop = RNA_def_property(srna, "use_undistorted_position", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_UNDISTORTION);
- RNA_def_property_ui_text(prop, "Undistort", "Parent to undistorted position of 2D track");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem frame_method_items[] = {
+ {FOLLOWTRACK_FRAME_STRETCH, "STRETCH", 0, "Stretch", ""},
+ {FOLLOWTRACK_FRAME_FIT, "FIT", 0, "Fit", ""},
+ {FOLLOWTRACK_FRAME_CROP, "CROP", 0, "Crop", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FollowTrackConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Follow Track Constraint", "Lock motion to the target motion track");
+ RNA_def_struct_sdna_from(srna, "bFollowTrackConstraint", "data");
+
+ /* movie clip */
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* track */
+ prop = RNA_def_property(srna, "track", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "track");
+ RNA_def_property_ui_text(prop, "Track", "Movie tracking track to follow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* use default clip */
+ prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_ACTIVECLIP);
+ RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* use 3d position */
+ prop = RNA_def_property(srna, "use_3d_position", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_3D_POSITION);
+ RNA_def_property_ui_text(prop, "3D Position", "Use 3D position of track to parent to");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* object */
+ prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "object");
+ RNA_def_property_ui_text(
+ prop, "Object", "Movie tracking object to follow (if empty, camera object is used)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* camera */
+ prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "camera");
+ RNA_def_property_ui_text(
+ prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ RNA_def_property_pointer_funcs(prop,
+ NULL,
+ "rna_Constraint_followTrack_camera_set",
+ NULL,
+ "rna_Constraint_cameraObject_poll");
+
+ /* depth object */
+ prop = RNA_def_property(srna, "depth_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "depth_ob");
+ RNA_def_property_ui_text(
+ prop,
+ "Depth Object",
+ "Object used to define depth in camera space by projecting onto surface of this object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ RNA_def_property_pointer_funcs(prop,
+ NULL,
+ "rna_Constraint_followTrack_depthObject_set",
+ NULL,
+ "rna_Constraint_followTrack_depthObject_poll");
+
+ /* frame method */
+ prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "frame_method");
+ RNA_def_property_enum_items(prop, frame_method_items);
+ RNA_def_property_ui_text(prop, "Frame Method", "How the footage fits in the camera frame");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* use undistortion */
+ prop = RNA_def_property(srna, "use_undistorted_position", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FOLLOWTRACK_USE_UNDISTORTION);
+ RNA_def_property_ui_text(prop, "Undistort", "Parent to undistorted position of 2D track");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_camera_solver(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
- RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
+ srna = RNA_def_struct(brna, "CameraSolverConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Camera Solver Constraint", "Lock motion to the reconstructed camera movement");
+ RNA_def_struct_sdna_from(srna, "bCameraSolverConstraint", "data");
- /* movie clip */
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clip");
- RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ /* movie clip */
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- /* use default clip */
- prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
- RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+ /* use default clip */
+ prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
+ RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
}
static void rna_def_constraint_object_solver(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
- RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
-
- /* movie clip */
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clip");
- RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* use default clip */
- prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
- RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* object */
- prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "object");
- RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
-
- /* camera */
- prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "camera");
- RNA_def_property_ui_text(prop, "Camera",
- "Camera to which motion is parented (if empty active scene camera is used)");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Constraint_objectSolver_camera_set", NULL,
- "rna_Constraint_cameraObject_poll");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ObjectSolverConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Object Solver Constraint", "Lock motion to the reconstructed object movement");
+ RNA_def_struct_sdna_from(srna, "bObjectSolverConstraint", "data");
+
+ /* movie clip */
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie Clip to get tracking data from");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* use default clip */
+ prop = RNA_def_property(srna, "use_active_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CAMERASOLVER_ACTIVECLIP);
+ RNA_def_property_ui_text(prop, "Active Clip", "Use active clip defined in scene");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* object */
+ prop = RNA_def_property(srna, "object", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "object");
+ RNA_def_property_ui_text(prop, "Object", "Movie tracking object to follow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+
+ /* camera */
+ prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "camera");
+ RNA_def_property_ui_text(
+ prop, "Camera", "Camera to which motion is parented (if empty active scene camera is used)");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_dependency_update");
+ RNA_def_property_pointer_funcs(prop,
+ NULL,
+ "rna_Constraint_objectSolver_camera_set",
+ NULL,
+ "rna_Constraint_cameraObject_poll");
}
static void rna_def_constraint_transform_cache(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "TransformCacheConstraint", "Constraint");
- RNA_def_struct_ui_text(srna, "Transform Cache Constraint", "Look up transformation from an external file");
- RNA_def_struct_sdna_from(srna, "bTransformCacheConstraint", "data");
+ srna = RNA_def_struct(brna, "TransformCacheConstraint", "Constraint");
+ RNA_def_struct_ui_text(
+ srna, "Transform Cache Constraint", "Look up transformation from an external file");
+ RNA_def_struct_sdna_from(srna, "bTransformCacheConstraint", "data");
- prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "cache_file");
- RNA_def_property_struct_type(prop, "CacheFile");
- RNA_def_property_ui_text(prop, "Cache File", "");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update");
+ prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "cache_file");
+ RNA_def_property_struct_type(prop, "CacheFile");
+ RNA_def_property_ui_text(prop, "Cache File", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, 0, "rna_Constraint_dependency_update");
- prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object Path", "Path to the object in the Alembic archive used to lookup the transform matrix");
- RNA_def_property_update(prop, 0, "rna_Constraint_transformCache_object_path_update");
+ prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Object Path",
+ "Path to the object in the Alembic archive used to lookup the transform matrix");
+ RNA_def_property_update(prop, 0, "rna_Constraint_transformCache_object_path_update");
}
/* base struct for constraints */
void RNA_def_constraint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* data */
- srna = RNA_def_struct(brna, "Constraint", NULL);
- RNA_def_struct_ui_text(srna, "Constraint", "Constraint modifying the transformation of objects and bones");
- RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
- RNA_def_struct_path_func(srna, "rna_Constraint_path");
- RNA_def_struct_sdna(srna, "bConstraint");
-
- /* strings */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set");
- RNA_def_property_ui_text(prop, "Name", "Constraint name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT | NA_RENAME, NULL);
-
- /* enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_constraint_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
-
- prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ownspace");
- RNA_def_property_enum_items(prop, owner_space_pchan_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
- RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tarspace");
- RNA_def_property_enum_items(prop, target_space_pchan_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
- RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- /* flags */
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- /* XXX this is really an internal flag, but it may be useful for some tools to be able to access this... */
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE);
- RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
-
- /* TODO: setting this to true must ensure that all others in stack are turned off too... */
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
- RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited");
-
- prop = RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
- RNA_def_property_ui_text(prop, "Proxy Local",
- "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
-
- /* values */
- prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "enforce");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Influence", "Amount of influence constraint will have on the final solution");
- RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_influence_update");
-
- /* readonly values */
- prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "lin_error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Lin error",
- "Amount of residual error in Blender space unit for constraints that work on position");
-
- prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rot_error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Rot error",
- "Amount of residual error in radians for constraints that work on orientation");
-
- /* pointers */
- rna_def_constrainttarget(brna);
- rna_def_constrainttarget_bone(brna);
-
- rna_def_constraint_childof(brna);
- rna_def_constraint_python(brna);
- rna_def_constraint_armature_deform(brna);
- rna_def_constraint_stretch_to(brna);
- rna_def_constraint_follow_path(brna);
- rna_def_constraint_locked_track(brna);
- rna_def_constraint_action(brna);
- rna_def_constraint_size_like(brna);
- rna_def_constraint_same_volume(brna);
- rna_def_constraint_locate_like(brna);
- rna_def_constraint_rotate_like(brna);
- rna_def_constraint_transform_like(brna);
- rna_def_constraint_minmax(brna);
- rna_def_constraint_track_to(brna);
- rna_def_constraint_kinematic(brna);
- rna_def_constraint_clamp_to(brna);
- rna_def_constraint_distance_limit(brna);
- rna_def_constraint_size_limit(brna);
- rna_def_constraint_rotation_limit(brna);
- rna_def_constraint_location_limit(brna);
- rna_def_constraint_transform(brna);
- rna_def_constraint_shrinkwrap(brna);
- rna_def_constraint_damped_track(brna);
- rna_def_constraint_spline_ik(brna);
- rna_def_constraint_pivot(brna);
- rna_def_constraint_follow_track(brna);
- rna_def_constraint_camera_solver(brna);
- rna_def_constraint_object_solver(brna);
- rna_def_constraint_transform_cache(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* data */
+ srna = RNA_def_struct(brna, "Constraint", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Constraint", "Constraint modifying the transformation of objects and bones");
+ RNA_def_struct_refine_func(srna, "rna_ConstraintType_refine");
+ RNA_def_struct_path_func(srna, "rna_Constraint_path");
+ RNA_def_struct_sdna(srna, "bConstraint");
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Constraint_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Constraint name");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT | NA_RENAME, NULL);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_constraint_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ prop = RNA_def_property(srna, "owner_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ownspace");
+ RNA_def_property_enum_items(prop, owner_space_pchan_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_owner_space_itemf");
+ RNA_def_property_ui_text(prop, "Owner Space", "Space that owner is evaluated in");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "target_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tarspace");
+ RNA_def_property_enum_items(prop, target_space_pchan_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Constraint_target_space_itemf");
+ RNA_def_property_ui_text(prop, "Target Space", "Space that target is evaluated in");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ /* flags */
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_OFF);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Disable", "Enable/Disable Constraint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_update");
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_EXPAND);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Expanded", "Constraint's panel is expanded in UI");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ /* XXX this is really an internal flag, but it may be useful for some tools to be able to access this... */
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CONSTRAINT_DISABLE);
+ RNA_def_property_ui_text(prop, "Valid", "Constraint has valid settings and can be evaluated");
+
+ /* TODO: setting this to true must ensure that all others in stack are turned off too... */
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_ACTIVE);
+ RNA_def_property_ui_text(prop, "Active", "Constraint is the one being edited");
+
+ prop = RNA_def_property(srna, "is_proxy_local", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CONSTRAINT_PROXY_LOCAL);
+ RNA_def_property_ui_text(
+ prop,
+ "Proxy Local",
+ "Constraint was added in this proxy instance (i.e. did not belong to source Armature)");
+
+ /* values */
+ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "enforce");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Influence", "Amount of influence constraint will have on the final solution");
+ RNA_def_property_update(prop, NC_OBJECT | ND_CONSTRAINT, "rna_Constraint_influence_update");
+
+ /* readonly values */
+ prop = RNA_def_property(srna, "error_location", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lin_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Lin error",
+ "Amount of residual error in Blender space unit for constraints that work on position");
+
+ prop = RNA_def_property(srna, "error_rotation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rot_error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Rot error",
+ "Amount of residual error in radians for constraints that work on orientation");
+
+ /* pointers */
+ rna_def_constrainttarget(brna);
+ rna_def_constrainttarget_bone(brna);
+
+ rna_def_constraint_childof(brna);
+ rna_def_constraint_python(brna);
+ rna_def_constraint_armature_deform(brna);
+ rna_def_constraint_stretch_to(brna);
+ rna_def_constraint_follow_path(brna);
+ rna_def_constraint_locked_track(brna);
+ rna_def_constraint_action(brna);
+ rna_def_constraint_size_like(brna);
+ rna_def_constraint_same_volume(brna);
+ rna_def_constraint_locate_like(brna);
+ rna_def_constraint_rotate_like(brna);
+ rna_def_constraint_transform_like(brna);
+ rna_def_constraint_minmax(brna);
+ rna_def_constraint_track_to(brna);
+ rna_def_constraint_kinematic(brna);
+ rna_def_constraint_clamp_to(brna);
+ rna_def_constraint_distance_limit(brna);
+ rna_def_constraint_size_limit(brna);
+ rna_def_constraint_rotation_limit(brna);
+ rna_def_constraint_location_limit(brna);
+ rna_def_constraint_transform(brna);
+ rna_def_constraint_shrinkwrap(brna);
+ rna_def_constraint_damped_track(brna);
+ rna_def_constraint_spline_ik(brna);
+ rna_def_constraint_pivot(brna);
+ rna_def_constraint_follow_track(brna);
+ rna_def_constraint_camera_solver(brna);
+ rna_def_constraint_object_solver(brna);
+ rna_def_constraint_transform_cache(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index d1fc18e17ab..40f2927077c 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -33,282 +33,286 @@
#include "rna_internal.h" /* own include */
const EnumPropertyItem rna_enum_context_mode_items[] = {
- {CTX_MODE_EDIT_MESH, "EDIT_MESH", 0, "Mesh Edit", ""},
- {CTX_MODE_EDIT_CURVE, "EDIT_CURVE", 0, "Curve Edit", ""},
- {CTX_MODE_EDIT_SURFACE, "EDIT_SURFACE", 0, "Surface Edit", ""},
- {CTX_MODE_EDIT_TEXT, "EDIT_TEXT", 0, "Edit Edit", ""},
- {CTX_MODE_EDIT_ARMATURE, "EDIT_ARMATURE", 0, "Armature Edit", ""}, /* PARSKEL reuse will give issues */
- {CTX_MODE_EDIT_METABALL, "EDIT_METABALL", 0, "Metaball Edit", ""},
- {CTX_MODE_EDIT_LATTICE, "EDIT_LATTICE", 0, "Lattice Edit", ""},
- {CTX_MODE_POSE, "POSE", 0, "Pose ", ""},
- {CTX_MODE_SCULPT, "SCULPT", 0, "Sculpt", ""},
- {CTX_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""},
- {CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""},
- {CTX_MODE_PAINT_TEXTURE, "PAINT_TEXTURE", 0, "Texture Paint", ""},
- {CTX_MODE_PARTICLE, "PARTICLE", 0, "Particle", ""},
- {CTX_MODE_OBJECT, "OBJECT", 0, "Object", ""},
- {CTX_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", 0, "Grease Pencil Paint", "" },
- {CTX_MODE_EDIT_GPENCIL, "EDIT_GPENCIL", 0, "Grease Pencil Edit", "" },
- {CTX_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", 0, "Grease Pencil Sculpt", "" },
- {CTX_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", 0, "Grease Pencil Weight Paint", "" },
- {0, NULL, 0, NULL, NULL},
+ {CTX_MODE_EDIT_MESH, "EDIT_MESH", 0, "Mesh Edit", ""},
+ {CTX_MODE_EDIT_CURVE, "EDIT_CURVE", 0, "Curve Edit", ""},
+ {CTX_MODE_EDIT_SURFACE, "EDIT_SURFACE", 0, "Surface Edit", ""},
+ {CTX_MODE_EDIT_TEXT, "EDIT_TEXT", 0, "Edit Edit", ""},
+ {CTX_MODE_EDIT_ARMATURE,
+ "EDIT_ARMATURE",
+ 0,
+ "Armature Edit",
+ ""}, /* PARSKEL reuse will give issues */
+ {CTX_MODE_EDIT_METABALL, "EDIT_METABALL", 0, "Metaball Edit", ""},
+ {CTX_MODE_EDIT_LATTICE, "EDIT_LATTICE", 0, "Lattice Edit", ""},
+ {CTX_MODE_POSE, "POSE", 0, "Pose ", ""},
+ {CTX_MODE_SCULPT, "SCULPT", 0, "Sculpt", ""},
+ {CTX_MODE_PAINT_WEIGHT, "PAINT_WEIGHT", 0, "Weight Paint", ""},
+ {CTX_MODE_PAINT_VERTEX, "PAINT_VERTEX", 0, "Vertex Paint", ""},
+ {CTX_MODE_PAINT_TEXTURE, "PAINT_TEXTURE", 0, "Texture Paint", ""},
+ {CTX_MODE_PARTICLE, "PARTICLE", 0, "Particle", ""},
+ {CTX_MODE_OBJECT, "OBJECT", 0, "Object", ""},
+ {CTX_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", 0, "Grease Pencil Paint", ""},
+ {CTX_MODE_EDIT_GPENCIL, "EDIT_GPENCIL", 0, "Grease Pencil Edit", ""},
+ {CTX_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", 0, "Grease Pencil Sculpt", ""},
+ {CTX_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", 0, "Grease Pencil Weight Paint", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "RE_engine.h"
+# include "RE_engine.h"
static PointerRNA rna_Context_manager_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_WindowManager, CTX_wm_manager(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_WindowManager, CTX_wm_manager(C));
}
static PointerRNA rna_Context_window_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Window, CTX_wm_window(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Window, CTX_wm_window(C));
}
static PointerRNA rna_Context_workspace_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_WorkSpace, CTX_wm_workspace(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_WorkSpace, CTX_wm_workspace(C));
}
static PointerRNA rna_Context_screen_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Screen, CTX_wm_screen(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Screen, CTX_wm_screen(C));
}
static PointerRNA rna_Context_area_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- PointerRNA newptr;
- RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Area, CTX_wm_area(C), &newptr);
- return newptr;
+ bContext *C = (bContext *)ptr->data;
+ PointerRNA newptr;
+ RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Area, CTX_wm_area(C), &newptr);
+ return newptr;
}
static PointerRNA rna_Context_space_data_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- PointerRNA newptr;
- RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &newptr);
- return newptr;
+ bContext *C = (bContext *)ptr->data;
+ PointerRNA newptr;
+ RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Space, CTX_wm_space_data(C), &newptr);
+ return newptr;
}
static PointerRNA rna_Context_region_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- PointerRNA newptr;
- RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Region, CTX_wm_region(C), &newptr);
- return newptr;
+ bContext *C = (bContext *)ptr->data;
+ PointerRNA newptr;
+ RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_Region, CTX_wm_region(C), &newptr);
+ return newptr;
}
static PointerRNA rna_Context_region_data_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
+ bContext *C = (bContext *)ptr->data;
- /* only exists for one space still, no generic system yet */
- if (CTX_wm_view3d(C)) {
- PointerRNA newptr;
- RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_RegionView3D, CTX_wm_region_data(C), &newptr);
- return newptr;
- }
+ /* only exists for one space still, no generic system yet */
+ if (CTX_wm_view3d(C)) {
+ PointerRNA newptr;
+ RNA_pointer_create((ID *)CTX_wm_screen(C), &RNA_RegionView3D, CTX_wm_region_data(C), &newptr);
+ return newptr;
+ }
- return PointerRNA_NULL;
+ return PointerRNA_NULL;
}
static PointerRNA rna_Context_gizmo_group_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- PointerRNA newptr;
- RNA_pointer_create(NULL, &RNA_GizmoGroup, CTX_wm_gizmo_group(C), &newptr);
- return newptr;
+ bContext *C = (bContext *)ptr->data;
+ PointerRNA newptr;
+ RNA_pointer_create(NULL, &RNA_GizmoGroup, CTX_wm_gizmo_group(C), &newptr);
+ return newptr;
}
static PointerRNA rna_Context_main_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_BlendData, CTX_data_main(C));
}
static PointerRNA rna_Context_depsgraph_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, CTX_data_depsgraph(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, CTX_data_depsgraph(C));
}
static PointerRNA rna_Context_scene_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Scene, CTX_data_scene(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Scene, CTX_data_scene(C));
}
static PointerRNA rna_Context_view_layer_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- Scene *scene = CTX_data_scene(C);
- PointerRNA scene_ptr;
+ bContext *C = (bContext *)ptr->data;
+ Scene *scene = CTX_data_scene(C);
+ PointerRNA scene_ptr;
- RNA_id_pointer_create(&scene->id, &scene_ptr);
- return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, CTX_data_view_layer(C));
+ RNA_id_pointer_create(&scene->id, &scene_ptr);
+ return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, CTX_data_view_layer(C));
}
static void rna_Context_engine_get(PointerRNA *ptr, char *value)
- {
- bContext *C = (bContext *)ptr->data;
- RenderEngineType *engine_type = CTX_data_engine_type(C);
- strcpy(value, engine_type->idname);
+{
+ bContext *C = (bContext *)ptr->data;
+ RenderEngineType *engine_type = CTX_data_engine_type(C);
+ strcpy(value, engine_type->idname);
}
static int rna_Context_engine_length(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- RenderEngineType *engine_type = CTX_data_engine_type(C);
- return strlen(engine_type->idname);
+ bContext *C = (bContext *)ptr->data;
+ RenderEngineType *engine_type = CTX_data_engine_type(C);
+ return strlen(engine_type->idname);
}
static PointerRNA rna_Context_collection_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Collection, CTX_data_collection(C));
+ bContext *C = (bContext *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Collection, CTX_data_collection(C));
}
static PointerRNA rna_Context_layer_collection_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- ptr->id.data = CTX_data_scene(C);
- return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, CTX_data_layer_collection(C));
+ bContext *C = (bContext *)ptr->data;
+ ptr->id.data = CTX_data_scene(C);
+ return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, CTX_data_layer_collection(C));
}
static PointerRNA rna_Context_tool_settings_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- ptr->id.data = CTX_data_scene(C);
- return rna_pointer_inherit_refine(ptr, &RNA_ToolSettings, CTX_data_tool_settings(C));
+ bContext *C = (bContext *)ptr->data;
+ ptr->id.data = CTX_data_scene(C);
+ return rna_pointer_inherit_refine(ptr, &RNA_ToolSettings, CTX_data_tool_settings(C));
}
static PointerRNA rna_Context_preferences_get(PointerRNA *UNUSED(ptr))
{
- PointerRNA newptr;
- RNA_pointer_create(NULL, &RNA_Preferences, &U, &newptr);
- return newptr;
+ PointerRNA newptr;
+ RNA_pointer_create(NULL, &RNA_Preferences, &U, &newptr);
+ return newptr;
}
static int rna_Context_mode_get(PointerRNA *ptr)
{
- bContext *C = (bContext *)ptr->data;
- return CTX_data_mode_enum(C);
+ bContext *C = (bContext *)ptr->data;
+ return CTX_data_mode_enum(C);
}
#else
void RNA_def_context(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Context", NULL);
- RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context");
- RNA_def_struct_sdna(srna, "bContext");
-
- /* WM */
- prop = RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "WindowManager");
- RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Window");
- RNA_def_property_pointer_funcs(prop, "rna_Context_window_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "workspace", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "WorkSpace");
- RNA_def_property_pointer_funcs(prop, "rna_Context_workspace_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Screen");
- RNA_def_property_pointer_funcs(prop, "rna_Context_screen_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "area", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Area");
- RNA_def_property_pointer_funcs(prop, "rna_Context_area_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "space_data", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Space");
- RNA_def_property_pointer_funcs(prop, "rna_Context_space_data_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "region", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Region");
- RNA_def_property_pointer_funcs(prop, "rna_Context_region_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "RegionView3D");
- RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "gizmo_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "GizmoGroup");
- RNA_def_property_pointer_funcs(prop, "rna_Context_gizmo_group_get", NULL, NULL, NULL);
-
- /* Data */
- prop = RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "BlendData");
- RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Depsgraph");
- RNA_def_property_pointer_funcs(prop, "rna_Context_depsgraph_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Scene");
- RNA_def_property_pointer_funcs(prop, "rna_Context_scene_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Context_view_layer_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "engine", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Context_engine_get", "rna_Context_engine_length", NULL);
-
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_funcs(prop, "rna_Context_collection_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "LayerCollection");
- RNA_def_property_pointer_funcs(prop, "rna_Context_layer_collection_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "ToolSettings");
- RNA_def_property_pointer_funcs(prop, "rna_Context_tool_settings_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Preferences");
- RNA_def_property_pointer_funcs(prop, "rna_Context_preferences_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_context_mode_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_funcs(prop, "rna_Context_mode_get", NULL, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Context", NULL);
+ RNA_def_struct_ui_text(srna, "Context", "Current windowmanager and data context");
+ RNA_def_struct_sdna(srna, "bContext");
+
+ /* WM */
+ prop = RNA_def_property(srna, "window_manager", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "WindowManager");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_manager_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "window", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Window");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_window_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "workspace", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "WorkSpace");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_workspace_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Screen");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_screen_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "area", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Area");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_area_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "space_data", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Space");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_space_data_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "region", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Region");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_region_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "region_data", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "RegionView3D");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_region_data_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "gizmo_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "GizmoGroup");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_gizmo_group_get", NULL, NULL, NULL);
+
+ /* Data */
+ prop = RNA_def_property(srna, "blend_data", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "BlendData");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_main_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Depsgraph");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_depsgraph_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_scene_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "ViewLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_view_layer_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "engine", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Context_engine_get", "rna_Context_engine_length", NULL);
+
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_collection_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "LayerCollection");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_layer_collection_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "ToolSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_tool_settings_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Preferences");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_preferences_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_context_mode_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_funcs(prop, "rna_Context_mode_get", NULL, NULL);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c
index 050ae632a4b..448ea1387f4 100644
--- a/source/blender/makesrna/intern/rna_curve.c
+++ b/source/blender/makesrna/intern/rna_curve.c
@@ -42,706 +42,770 @@
#ifndef RNA_RUNTIME
static const EnumPropertyItem beztriple_handle_type_items[] = {
- {HD_FREE, "FREE", 0, "Free", ""},
- {HD_VECT, "VECTOR", 0, "Vector", ""},
- {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
- {HD_AUTO, "AUTO", 0, "Auto", ""},
- {0, NULL, 0, NULL, NULL},
+ {HD_FREE, "FREE", 0, "Free", ""},
+ {HD_VECT, "VECTOR", 0, "Vector", ""},
+ {HD_ALIGN, "ALIGNED", 0, "Aligned", ""},
+ {HD_AUTO, "AUTO", 0, "Auto", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_keyframe_handle_type_items[] = {
- {HD_FREE, "FREE", ICON_HANDLETYPE_FREE_VEC, "Free", "Completely independent manually set handle"},
- {HD_ALIGN, "ALIGNED", ICON_HANDLETYPE_ALIGNED_VEC, "Aligned", "Manually set handle with rotation locked together with its pair"},
- {HD_VECT, "VECTOR", ICON_HANDLETYPE_VECTOR_VEC, "Vector", "Automatic handles that create straight lines"},
- {HD_AUTO, "AUTO", ICON_HANDLETYPE_AUTO_VEC, "Automatic", "Automatic handles that create smooth curves"},
- {HD_AUTO_ANIM, "AUTO_CLAMPED", ICON_HANDLETYPE_AUTO_CLAMP_VEC, "Auto Clamped", "Automatic handles that create smooth curves which only change direction at keyframes"},
- {0, NULL, 0, NULL, NULL},
+ {HD_FREE,
+ "FREE",
+ ICON_HANDLETYPE_FREE_VEC,
+ "Free",
+ "Completely independent manually set handle"},
+ {HD_ALIGN,
+ "ALIGNED",
+ ICON_HANDLETYPE_ALIGNED_VEC,
+ "Aligned",
+ "Manually set handle with rotation locked together with its pair"},
+ {HD_VECT,
+ "VECTOR",
+ ICON_HANDLETYPE_VECTOR_VEC,
+ "Vector",
+ "Automatic handles that create straight lines"},
+ {HD_AUTO,
+ "AUTO",
+ ICON_HANDLETYPE_AUTO_VEC,
+ "Automatic",
+ "Automatic handles that create smooth curves"},
+ {HD_AUTO_ANIM,
+ "AUTO_CLAMPED",
+ ICON_HANDLETYPE_AUTO_CLAMP_VEC,
+ "Auto Clamped",
+ "Automatic handles that create smooth curves which only change direction at keyframes"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[] = {
- /* interpolation */
- {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
- {BEZT_IPO_CONST, "CONSTANT", ICON_IPO_CONSTANT, "Constant", "No interpolation, value of A gets held until B is encountered"},
- {BEZT_IPO_LIN, "LINEAR", ICON_IPO_LINEAR, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"},
- {BEZT_IPO_BEZ, "BEZIER", ICON_IPO_BEZIER, "Bezier", "Smooth interpolation between A and B, with some control over curve shape"},
-
- /* easing */
- {0, "", 0, N_("Easing (by strength)"), "Predefined inertial transitions, useful for motion graphics (from least to most ''dramatic'')"},
- {BEZT_IPO_SINE, "SINE", ICON_IPO_SINE, "Sinusoidal", "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
- {BEZT_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
- {BEZT_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
- {BEZT_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
- {BEZT_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
- {BEZT_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
- {BEZT_IPO_CIRC, "CIRC", ICON_IPO_CIRC, "Circular", "Circular easing (strongest and most dynamic)"},
-
- {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
- {BEZT_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
- {BEZT_IPO_BOUNCE, "BOUNCE", ICON_IPO_BOUNCE, "Bounce", "Exponentially decaying parabolic bounce, like when objects collide"},
- {BEZT_IPO_ELASTIC, "ELASTIC", ICON_IPO_ELASTIC, "Elastic", "Exponentially decaying sine wave, like an elastic band"},
-
- {0, NULL, 0, NULL, NULL},
+ /* interpolation */
+ {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
+ {BEZT_IPO_CONST,
+ "CONSTANT",
+ ICON_IPO_CONSTANT,
+ "Constant",
+ "No interpolation, value of A gets held until B is encountered"},
+ {BEZT_IPO_LIN,
+ "LINEAR",
+ ICON_IPO_LINEAR,
+ "Linear",
+ "Straight-line interpolation between A and B (i.e. no ease in/out)"},
+ {BEZT_IPO_BEZ,
+ "BEZIER",
+ ICON_IPO_BEZIER,
+ "Bezier",
+ "Smooth interpolation between A and B, with some control over curve shape"},
+
+ /* easing */
+ {0,
+ "",
+ 0,
+ N_("Easing (by strength)"),
+ "Predefined inertial transitions, useful for motion graphics (from least to most "
+ "''dramatic'')"},
+ {BEZT_IPO_SINE,
+ "SINE",
+ ICON_IPO_SINE,
+ "Sinusoidal",
+ "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
+ {BEZT_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
+ {BEZT_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
+ {BEZT_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
+ {BEZT_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
+ {BEZT_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
+ {BEZT_IPO_CIRC,
+ "CIRC",
+ ICON_IPO_CIRC,
+ "Circular",
+ "Circular easing (strongest and most dynamic)"},
+
+ {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
+ {BEZT_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
+ {BEZT_IPO_BOUNCE,
+ "BOUNCE",
+ ICON_IPO_BOUNCE,
+ "Bounce",
+ "Exponentially decaying parabolic bounce, like when objects collide"},
+ {BEZT_IPO_ELASTIC,
+ "ELASTIC",
+ ICON_IPO_ELASTIC,
+ "Elastic",
+ "Exponentially decaying sine wave, like an elastic band"},
+
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem curve_type_items[] = {
- {CU_POLY, "POLY", 0, "Poly", ""},
- {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
- {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
- {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
- {CU_NURBS, "NURBS", 0, "Ease", ""},
- {0, NULL, 0, NULL, NULL},
+ {CU_POLY, "POLY", 0, "Poly", ""},
+ {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
+ {CU_BSPLINE, "BSPLINE", 0, "BSpline", ""},
+ {CU_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
+ {CU_NURBS, "NURBS", 0, "Ease", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem curve3d_fill_mode_items[] = {
- {0, "FULL", 0, "Full", ""},
- {CU_BACK, "BACK", 0, "Back", ""},
- {CU_FRONT, "FRONT", 0, "Front", ""},
- {CU_FRONT | CU_BACK, "HALF", 0, "Half", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "FULL", 0, "Full", ""},
+ {CU_BACK, "BACK", 0, "Back", ""},
+ {CU_FRONT, "FRONT", 0, "Front", ""},
+ {CU_FRONT | CU_BACK, "HALF", 0, "Half", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem curve2d_fill_mode_items[] = {
- {0, "NONE", 0, "None", ""},
- {CU_BACK, "BACK", 0, "Back", ""},
- {CU_FRONT, "FRONT", 0, "Front", ""},
- {CU_FRONT | CU_BACK, "BOTH", 0, "Both", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "NONE", 0, "None", ""},
+ {CU_BACK, "BACK", 0, "Back", ""},
+ {CU_FRONT, "FRONT", 0, "Front", ""},
+ {CU_FRONT | CU_BACK, "BOTH", 0, "Both", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#include "DNA_object_types.h"
+# include "DNA_object_types.h"
-#include "BKE_curve.h"
-#include "BKE_main.h"
+# include "BKE_curve.h"
+# include "BKE_main.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "WM_api.h"
+# include "WM_api.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "ED_curve.h" /* for BKE_curve_nurbs_get */
+# include "ED_curve.h" /* for BKE_curve_nurbs_get */
/* highly irritating but from RNA we cant know this */
static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index)
{
- ListBase *nurbs = BKE_curve_nurbs_get(cu);
- Nurb *nu;
- int i = 0;
-
- for (nu = nurbs->first; nu; nu = nu->next, i++) {
- if (nu->type == CU_BEZIER) {
- if (point >= (void *)nu->bezt && point < (void *)(nu->bezt + nu->pntsu)) {
- break;
- }
- }
- else {
- if (point >= (void *)nu->bp && point < (void *)(nu->bp + (nu->pntsu * nu->pntsv))) {
- break;
- }
- }
- }
-
- if (nu) {
- if (nu_index) {
- *nu_index = i;
- }
-
- if (pt_index) {
- if (nu->type == CU_BEZIER) *pt_index = (int)((BezTriple *)point - nu->bezt);
- else *pt_index = (int)((BPoint *)point - nu->bp);
- }
- }
-
- return nu;
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
+ Nurb *nu;
+ int i = 0;
+
+ for (nu = nurbs->first; nu; nu = nu->next, i++) {
+ if (nu->type == CU_BEZIER) {
+ if (point >= (void *)nu->bezt && point < (void *)(nu->bezt + nu->pntsu)) {
+ break;
+ }
+ }
+ else {
+ if (point >= (void *)nu->bp && point < (void *)(nu->bp + (nu->pntsu * nu->pntsv))) {
+ break;
+ }
+ }
+ }
+
+ if (nu) {
+ if (nu_index) {
+ *nu_index = i;
+ }
+
+ if (pt_index) {
+ if (nu->type == CU_BEZIER)
+ *pt_index = (int)((BezTriple *)point - nu->bezt);
+ else
+ *pt_index = (int)((BPoint *)point - nu->bp);
+ }
+ }
+
+ return nu;
}
static StructRNA *rna_Curve_refine(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->data;
- short obtype = BKE_curve_type_get(cu);
+ Curve *cu = (Curve *)ptr->data;
+ short obtype = BKE_curve_type_get(cu);
- if (obtype == OB_FONT) return &RNA_TextCurve;
- else if (obtype == OB_SURF) return &RNA_SurfaceCurve;
- else return &RNA_Curve;
+ if (obtype == OB_FONT)
+ return &RNA_TextCurve;
+ else if (obtype == OB_SURF)
+ return &RNA_SurfaceCurve;
+ else
+ return &RNA_Curve;
}
static void rna_BezTriple_handle1_get(PointerRNA *ptr, float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
- copy_v3_v3(values, bezt->vec[0]);
+ BezTriple *bezt = (BezTriple *)ptr->data;
+ copy_v3_v3(values, bezt->vec[0]);
}
static void rna_BezTriple_handle1_set(PointerRNA *ptr, const float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
- copy_v3_v3(bezt->vec[0], values);
+ BezTriple *bezt = (BezTriple *)ptr->data;
+ copy_v3_v3(bezt->vec[0], values);
}
static void rna_BezTriple_handle2_get(PointerRNA *ptr, float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
- copy_v3_v3(values, bezt->vec[2]);
+ BezTriple *bezt = (BezTriple *)ptr->data;
+ copy_v3_v3(values, bezt->vec[2]);
}
static void rna_BezTriple_handle2_set(PointerRNA *ptr, const float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
- copy_v3_v3(bezt->vec[2], values);
+ BezTriple *bezt = (BezTriple *)ptr->data;
+ copy_v3_v3(bezt->vec[2], values);
}
static void rna_BezTriple_ctrlpoint_get(PointerRNA *ptr, float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
- copy_v3_v3(values, bezt->vec[1]);
+ BezTriple *bezt = (BezTriple *)ptr->data;
+ copy_v3_v3(values, bezt->vec[1]);
}
static void rna_BezTriple_ctrlpoint_set(PointerRNA *ptr, const float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
- copy_v3_v3(bezt->vec[1], values);
+ BezTriple *bezt = (BezTriple *)ptr->data;
+ copy_v3_v3(bezt->vec[1], values);
}
static void rna_Curve_texspace_set(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->data;
+ Curve *cu = (Curve *)ptr->data;
- if (cu->texflag & CU_AUTOSPACE)
- BKE_curve_texspace_calc(cu);
+ if (cu->texflag & CU_AUTOSPACE)
+ BKE_curve_texspace_calc(cu);
}
static int rna_Curve_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- Curve *cu = (Curve *)ptr->data;
- return (cu->texflag & CU_AUTOSPACE) ? 0 : PROP_EDITABLE;
+ Curve *cu = (Curve *)ptr->data;
+ return (cu->texflag & CU_AUTOSPACE) ? 0 : PROP_EDITABLE;
}
static void rna_Curve_texspace_loc_get(PointerRNA *ptr, float *values)
{
- Curve *cu = (Curve *)ptr->data;
+ Curve *cu = (Curve *)ptr->data;
- if (!cu->bb)
- BKE_curve_texspace_calc(cu);
+ if (!cu->bb)
+ BKE_curve_texspace_calc(cu);
- copy_v3_v3(values, cu->loc);
+ copy_v3_v3(values, cu->loc);
}
static void rna_Curve_texspace_loc_set(PointerRNA *ptr, const float *values)
{
- Curve *cu = (Curve *)ptr->data;
+ Curve *cu = (Curve *)ptr->data;
- copy_v3_v3(cu->loc, values);
+ copy_v3_v3(cu->loc, values);
}
static void rna_Curve_texspace_size_get(PointerRNA *ptr, float *values)
{
- Curve *cu = (Curve *)ptr->data;
+ Curve *cu = (Curve *)ptr->data;
- if (!cu->bb)
- BKE_curve_texspace_calc(cu);
+ if (!cu->bb)
+ BKE_curve_texspace_calc(cu);
- copy_v3_v3(values, cu->size);
+ copy_v3_v3(values, cu->size);
}
static void rna_Curve_texspace_size_set(PointerRNA *ptr, const float *values)
{
- Curve *cu = (Curve *)ptr->data;
+ Curve *cu = (Curve *)ptr->data;
- copy_v3_v3(cu->size, values);
+ copy_v3_v3(cu->size, values);
}
-static void rna_Curve_material_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Curve_material_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Curve *cu = (Curve *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, cu->totcol - 1);
+ Curve *cu = (Curve *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, cu->totcol - 1);
}
/* simply offset by don't expose -1 */
static int rna_ChariInfo_material_index_get(PointerRNA *ptr)
{
- CharInfo *info = ptr->data;
- return info->mat_nr ? info->mat_nr - 1 : 0;
+ CharInfo *info = ptr->data;
+ return info->mat_nr ? info->mat_nr - 1 : 0;
}
static void rna_ChariInfo_material_index_set(PointerRNA *ptr, int value)
{
- CharInfo *info = ptr->data;
- info->mat_nr = value + 1;
+ CharInfo *info = ptr->data;
+ info->mat_nr = value + 1;
}
-static void rna_Curve_active_textbox_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Curve_active_textbox_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Curve *cu = (Curve *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, cu->totbox - 1);
+ Curve *cu = (Curve *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, cu->totbox - 1);
}
-
static void rna_Curve_dimension_set(PointerRNA *ptr, int value)
{
- Curve *cu = (Curve *)ptr->id.data;
- if (value == CU_3D) cu->flag |= CU_3D;
- else cu->flag &= ~CU_3D;
+ Curve *cu = (Curve *)ptr->id.data;
+ if (value == CU_3D)
+ cu->flag |= CU_3D;
+ else
+ cu->flag &= ~CU_3D;
- BKE_curve_curve_dimension_update(cu);
+ BKE_curve_curve_dimension_update(cu);
}
-static const EnumPropertyItem *rna_Curve_fill_mode_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Curve_fill_mode_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- Curve *cu = (Curve *)ptr->id.data;
+ Curve *cu = (Curve *)ptr->id.data;
- /* cast to quiet warning it IS a const still */
- return (EnumPropertyItem *)((cu->flag & CU_3D) ? curve3d_fill_mode_items : curve2d_fill_mode_items);
+ /* cast to quiet warning it IS a const still */
+ return (EnumPropertyItem *)((cu->flag & CU_3D) ? curve3d_fill_mode_items :
+ curve2d_fill_mode_items);
}
static int rna_Nurb_length(PointerRNA *ptr)
{
- Nurb *nu = (Nurb *)ptr->data;
- if (nu->type == CU_BEZIER) return 0;
- return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu;
+ Nurb *nu = (Nurb *)ptr->data;
+ if (nu->type == CU_BEZIER)
+ return 0;
+ return nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu;
}
static void rna_Nurb_type_set(PointerRNA *ptr, int value)
{
- Curve *cu = (Curve *)ptr->id.data;
- Nurb *nu = (Nurb *)ptr->data;
- const int pntsu_prev = nu->pntsu;
+ Curve *cu = (Curve *)ptr->id.data;
+ Nurb *nu = (Nurb *)ptr->data;
+ const int pntsu_prev = nu->pntsu;
- if (BKE_nurb_type_convert(nu, value, true)) {
- if (nu->pntsu != pntsu_prev) {
- cu->actvert = CU_ACT_NONE;
- }
- }
+ if (BKE_nurb_type_convert(nu, value, true)) {
+ if (nu->pntsu != pntsu_prev) {
+ cu->actvert = CU_ACT_NONE;
+ }
+ }
}
static void rna_BPoint_array_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Nurb *nu = (Nurb *)ptr->data;
- rna_iterator_array_begin(iter, (void *)nu->bp, sizeof(BPoint),
- nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu, 0, NULL);
+ Nurb *nu = (Nurb *)ptr->data;
+ rna_iterator_array_begin(iter,
+ (void *)nu->bp,
+ sizeof(BPoint),
+ nu->pntsv > 0 ? nu->pntsu * nu->pntsv : nu->pntsu,
+ 0,
+ NULL);
}
static void rna_Curve_update_data_id(Main *UNUSED(bmain), Scene *UNUSED(scene), ID *id)
{
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
static void rna_Curve_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_Curve_update_data_id(bmain, scene, ptr->id.data);
+ rna_Curve_update_data_id(bmain, scene, ptr->id.data);
}
static void rna_Curve_update_deps(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
- rna_Curve_update_data(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Curve_update_points(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- Nurb *nu = curve_nurb_from_point(cu, ptr->data, NULL, NULL);
+ Curve *cu = (Curve *)ptr->id.data;
+ Nurb *nu = curve_nurb_from_point(cu, ptr->data, NULL, NULL);
- if (nu)
- BKE_nurb_handles_calc(nu);
+ if (nu)
+ BKE_nurb_handles_calc(nu);
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static PointerRNA rna_Curve_bevelObject_get(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- Object *ob = cu->bevobj;
+ Curve *cu = (Curve *)ptr->id.data;
+ Object *ob = cu->bevobj;
- if (ob)
- return rna_pointer_inherit_refine(ptr, &RNA_Object, ob);
+ if (ob)
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, ob);
- return rna_pointer_inherit_refine(ptr, NULL, NULL);
+ return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_Curve_bevelObject_set(PointerRNA *ptr, PointerRNA value)
{
- Curve *cu = (Curve *)ptr->id.data;
- Object *ob = (Object *)value.data;
+ Curve *cu = (Curve *)ptr->id.data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- /* if bevel object has got the save curve, as object, for which it's */
- /* set as bevobj, there could be infinity loop in displist calculation */
- if (ob->type == OB_CURVE && ob->data != cu) {
- cu->bevobj = ob;
- id_lib_extern((ID *)ob);
- }
- }
- else {
- cu->bevobj = NULL;
- }
+ if (ob) {
+ /* if bevel object has got the save curve, as object, for which it's */
+ /* set as bevobj, there could be infinity loop in displist calculation */
+ if (ob->type == OB_CURVE && ob->data != cu) {
+ cu->bevobj = ob;
+ id_lib_extern((ID *)ob);
+ }
+ }
+ else {
+ cu->bevobj = NULL;
+ }
}
static bool rna_Curve_otherObject_poll(PointerRNA *ptr, PointerRNA value)
{
- Curve *cu = (Curve *)ptr->id.data;
- Object *ob = (Object *)value.data;
+ Curve *cu = (Curve *)ptr->id.data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- if (ob->type == OB_CURVE && ob->data != cu) {
- return 1;
- }
- }
+ if (ob) {
+ if (ob->type == OB_CURVE && ob->data != cu) {
+ return 1;
+ }
+ }
- return 0;
+ return 0;
}
static PointerRNA rna_Curve_taperObject_get(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- Object *ob = cu->taperobj;
+ Curve *cu = (Curve *)ptr->id.data;
+ Object *ob = cu->taperobj;
- if (ob)
- return rna_pointer_inherit_refine(ptr, &RNA_Object, ob);
+ if (ob)
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, ob);
- return rna_pointer_inherit_refine(ptr, NULL, NULL);
+ return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_Curve_taperObject_set(PointerRNA *ptr, PointerRNA value)
{
- Curve *cu = (Curve *)ptr->id.data;
- Object *ob = (Object *)value.data;
+ Curve *cu = (Curve *)ptr->id.data;
+ Object *ob = (Object *)value.data;
- if (ob) {
- /* if taper object has got the save curve, as object, for which it's */
- /* set as bevobj, there could be infinity loop in displist calculation */
- if (ob->type == OB_CURVE && ob->data != cu) {
- cu->taperobj = ob;
- id_lib_extern((ID *)ob);
- }
- }
- else {
- cu->taperobj = NULL;
- }
+ if (ob) {
+ /* if taper object has got the save curve, as object, for which it's */
+ /* set as bevobj, there could be infinity loop in displist calculation */
+ if (ob->type == OB_CURVE && ob->data != cu) {
+ cu->taperobj = ob;
+ id_lib_extern((ID *)ob);
+ }
+ }
+ else {
+ cu->taperobj = NULL;
+ }
}
static void rna_Curve_resolution_u_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- ListBase *nurbs = BKE_curve_nurbs_get(cu);
- Nurb *nu = nurbs->first;
+ Curve *cu = (Curve *)ptr->id.data;
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
+ Nurb *nu = nurbs->first;
- while (nu) {
- nu->resolu = cu->resolu;
- nu = nu->next;
- }
+ while (nu) {
+ nu->resolu = cu->resolu;
+ nu = nu->next;
+ }
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Curve_resolution_v_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- ListBase *nurbs = BKE_curve_nurbs_get(cu);
- Nurb *nu = nurbs->first;
-
+ Curve *cu = (Curve *)ptr->id.data;
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
+ Nurb *nu = nurbs->first;
- while (nu) {
- nu->resolv = cu->resolv;
- nu = nu->next;
- }
+ while (nu) {
+ nu->resolv = cu->resolv;
+ nu = nu->next;
+ }
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static float rna_Curve_offset_get(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- return cu->width - 1.0f;
+ Curve *cu = (Curve *)ptr->id.data;
+ return cu->width - 1.0f;
}
static void rna_Curve_offset_set(PointerRNA *ptr, float value)
{
- Curve *cu = (Curve *)ptr->id.data;
- cu->width = 1.0f + value;
+ Curve *cu = (Curve *)ptr->id.data;
+ cu->width = 1.0f + value;
}
static int rna_Curve_body_length(PointerRNA *ptr);
static void rna_Curve_body_get(PointerRNA *ptr, char *value)
{
- Curve *cu = (Curve *)ptr->id.data;
- BLI_strncpy(value, cu->str, rna_Curve_body_length(ptr) + 1);
+ Curve *cu = (Curve *)ptr->id.data;
+ BLI_strncpy(value, cu->str, rna_Curve_body_length(ptr) + 1);
}
static int rna_Curve_body_length(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- return cu->len;
+ Curve *cu = (Curve *)ptr->id.data;
+ return cu->len;
}
/* TODO, how to handle editmode? */
static void rna_Curve_body_set(PointerRNA *ptr, const char *value)
{
- size_t len_bytes;
- size_t len_chars = BLI_strlen_utf8_ex(value, &len_bytes);
+ size_t len_bytes;
+ size_t len_chars = BLI_strlen_utf8_ex(value, &len_bytes);
- Curve *cu = (Curve *)ptr->id.data;
+ Curve *cu = (Curve *)ptr->id.data;
- cu->len_wchar = len_chars;
- cu->len = len_bytes;
- cu->pos = len_chars;
+ cu->len_wchar = len_chars;
+ cu->len = len_bytes;
+ cu->pos = len_chars;
- if (cu->str)
- MEM_freeN(cu->str);
- if (cu->strinfo)
- MEM_freeN(cu->strinfo);
+ if (cu->str)
+ MEM_freeN(cu->str);
+ if (cu->strinfo)
+ MEM_freeN(cu->strinfo);
- cu->str = MEM_mallocN(len_bytes + sizeof(wchar_t), "str");
- cu->strinfo = MEM_callocN((len_chars + 4) * sizeof(CharInfo), "strinfo");
+ cu->str = MEM_mallocN(len_bytes + sizeof(wchar_t), "str");
+ cu->strinfo = MEM_callocN((len_chars + 4) * sizeof(CharInfo), "strinfo");
- BLI_strncpy(cu->str, value, len_bytes + 1);
+ BLI_strncpy(cu->str, value, len_bytes + 1);
}
static void rna_Nurb_update_cyclic_u(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Nurb *nu = (Nurb *)ptr->data;
+ Nurb *nu = (Nurb *)ptr->data;
- if (nu->type == CU_BEZIER) {
- BKE_nurb_handles_calc(nu);
- }
- else {
- BKE_nurb_knot_calc_u(nu);
- }
+ if (nu->type == CU_BEZIER) {
+ BKE_nurb_handles_calc(nu);
+ }
+ else {
+ BKE_nurb_knot_calc_u(nu);
+ }
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Nurb_update_cyclic_v(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Nurb *nu = (Nurb *)ptr->data;
+ Nurb *nu = (Nurb *)ptr->data;
- BKE_nurb_knot_calc_v(nu);
+ BKE_nurb_knot_calc_v(nu);
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Nurb_update_knot_u(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Nurb *nu = (Nurb *)ptr->data;
+ Nurb *nu = (Nurb *)ptr->data;
- BKE_nurb_order_clamp_u(nu);
- BKE_nurb_knot_calc_u(nu);
+ BKE_nurb_order_clamp_u(nu);
+ BKE_nurb_knot_calc_u(nu);
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Nurb_update_knot_v(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Nurb *nu = (Nurb *)ptr->data;
+ Nurb *nu = (Nurb *)ptr->data;
- BKE_nurb_order_clamp_v(nu);
- BKE_nurb_knot_calc_v(nu);
+ BKE_nurb_order_clamp_v(nu);
+ BKE_nurb_knot_calc_v(nu);
- rna_Curve_update_data(bmain, scene, ptr);
+ rna_Curve_update_data(bmain, scene, ptr);
}
static void rna_Curve_spline_points_add(ID *id, Nurb *nu, ReportList *reports, int number)
{
- if (nu->type == CU_BEZIER) {
- BKE_report(reports, RPT_ERROR, "Bezier spline cannot have points added");
- }
- else if (number == 0) {
- /* do nothing */
- }
- else {
+ if (nu->type == CU_BEZIER) {
+ BKE_report(reports, RPT_ERROR, "Bezier spline cannot have points added");
+ }
+ else if (number == 0) {
+ /* do nothing */
+ }
+ else {
- BKE_nurb_points_add(nu, number);
+ BKE_nurb_points_add(nu, number);
- /* update */
- BKE_nurb_knot_calc_u(nu);
+ /* update */
+ BKE_nurb_knot_calc_u(nu);
- rna_Curve_update_data_id(NULL, NULL, id);
- }
+ rna_Curve_update_data_id(NULL, NULL, id);
+ }
}
static void rna_Curve_spline_bezpoints_add(ID *id, Nurb *nu, ReportList *reports, int number)
{
- if (nu->type != CU_BEZIER) {
- BKE_report(reports, RPT_ERROR, "Only Bezier splines can be added");
- }
- else if (number == 0) {
- /* do nothing */
- }
- else {
- BKE_nurb_bezierPoints_add(nu, number);
+ if (nu->type != CU_BEZIER) {
+ BKE_report(reports, RPT_ERROR, "Only Bezier splines can be added");
+ }
+ else if (number == 0) {
+ /* do nothing */
+ }
+ else {
+ BKE_nurb_bezierPoints_add(nu, number);
- /* update */
- BKE_nurb_knot_calc_u(nu);
+ /* update */
+ BKE_nurb_knot_calc_u(nu);
- rna_Curve_update_data_id(NULL, NULL, id);
- }
+ rna_Curve_update_data_id(NULL, NULL, id);
+ }
}
static Nurb *rna_Curve_spline_new(Curve *cu, int type)
{
- Nurb *nu = (Nurb *) MEM_callocN(sizeof(Nurb), "spline.new");
+ Nurb *nu = (Nurb *)MEM_callocN(sizeof(Nurb), "spline.new");
- if (type == CU_BEZIER) {
- BezTriple *bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
- bezt->radius = 1.0;
- nu->bezt = bezt;
- }
- else {
- BPoint *bp = (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp");
- bp->radius = 1.0f;
- nu->bp = bp;
- }
+ if (type == CU_BEZIER) {
+ BezTriple *bezt = (BezTriple *)MEM_callocN(sizeof(BezTriple), "spline.new.bezt");
+ bezt->radius = 1.0;
+ nu->bezt = bezt;
+ }
+ else {
+ BPoint *bp = (BPoint *)MEM_callocN(sizeof(BPoint), "spline.new.bp");
+ bp->radius = 1.0f;
+ nu->bp = bp;
+ }
- nu->type = type;
- nu->pntsu = 1;
- nu->pntsv = 1;
+ nu->type = type;
+ nu->pntsu = 1;
+ nu->pntsv = 1;
- nu->orderu = nu->orderv = 4;
- nu->resolu = nu->resolv = 12;
- nu->flag = CU_SMOOTH;
+ nu->orderu = nu->orderv = 4;
+ nu->resolu = nu->resolv = 12;
+ nu->flag = CU_SMOOTH;
- if ((cu->flag & CU_3D) == 0) {
- nu->flag |= CU_2D;
- }
+ if ((cu->flag & CU_3D) == 0) {
+ nu->flag |= CU_2D;
+ }
- BLI_addtail(BKE_curve_nurbs_get(cu), nu);
+ BLI_addtail(BKE_curve_nurbs_get(cu), nu);
- return nu;
+ return nu;
}
static void rna_Curve_spline_remove(Curve *cu, ReportList *reports, PointerRNA *nu_ptr)
{
- Nurb *nu = nu_ptr->data;
- ListBase *nurbs = BKE_curve_nurbs_get(cu);
+ Nurb *nu = nu_ptr->data;
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
- if (BLI_remlink_safe(nurbs, nu) == false) {
- BKE_reportf(reports, RPT_ERROR, "Curve '%s' does not contain spline given", cu->id.name + 2);
- return;
- }
+ if (BLI_remlink_safe(nurbs, nu) == false) {
+ BKE_reportf(reports, RPT_ERROR, "Curve '%s' does not contain spline given", cu->id.name + 2);
+ return;
+ }
- BKE_nurb_free(nu);
- RNA_POINTER_INVALIDATE(nu_ptr);
+ BKE_nurb_free(nu);
+ RNA_POINTER_INVALIDATE(nu_ptr);
- DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
+ DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
}
static void rna_Curve_spline_clear(Curve *cu)
{
- ListBase *nurbs = BKE_curve_nurbs_get(cu);
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
- BKE_nurbList_free(nurbs);
+ BKE_nurbList_free(nurbs);
- DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
+ DEG_id_tag_update(&cu->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
}
static PointerRNA rna_Curve_active_spline_get(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->data;
- Nurb *nu;
- ListBase *nurbs = BKE_curve_nurbs_get(cu);
+ Curve *cu = (Curve *)ptr->data;
+ Nurb *nu;
+ ListBase *nurbs = BKE_curve_nurbs_get(cu);
- /* for curve outside editmode will set to -1, should be changed to be allowed outside of editmode. */
- nu = BLI_findlink(nurbs, cu->actnu);
+ /* for curve outside editmode will set to -1, should be changed to be allowed outside of editmode. */
+ nu = BLI_findlink(nurbs, cu->actnu);
- if (nu)
- return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
+ if (nu)
+ return rna_pointer_inherit_refine(ptr, &RNA_Spline, nu);
- return rna_pointer_inherit_refine(ptr, NULL, NULL);
+ return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_Curve_active_spline_set(PointerRNA *ptr, PointerRNA value)
{
- Curve *cu = (Curve *)ptr->data;
- Nurb *nu = value.data;
- ListBase *nubase = BKE_curve_nurbs_get(cu);
+ Curve *cu = (Curve *)ptr->data;
+ Nurb *nu = value.data;
+ ListBase *nubase = BKE_curve_nurbs_get(cu);
- /* -1 is ok for an unset index */
- if (nu == NULL)
- cu->actnu = -1;
- else
- cu->actnu = BLI_findindex(nubase, nu);
+ /* -1 is ok for an unset index */
+ if (nu == NULL)
+ cu->actnu = -1;
+ else
+ cu->actnu = BLI_findindex(nubase, nu);
}
static char *rna_Curve_spline_path(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- ListBase *nubase = BKE_curve_nurbs_get(cu);
- Nurb *nu = ptr->data;
- int index = BLI_findindex(nubase, nu);
+ Curve *cu = (Curve *)ptr->id.data;
+ ListBase *nubase = BKE_curve_nurbs_get(cu);
+ Nurb *nu = ptr->data;
+ int index = BLI_findindex(nubase, nu);
- if (index >= 0)
- return BLI_sprintfN("splines[%d]", index);
- else
- return BLI_strdup("");
+ if (index >= 0)
+ return BLI_sprintfN("splines[%d]", index);
+ else
+ return BLI_strdup("");
}
/* use for both bezier and nurbs */
static char *rna_Curve_spline_point_path(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- Nurb *nu;
- void *point = ptr->data;
- int nu_index, pt_index;
+ Curve *cu = (Curve *)ptr->id.data;
+ Nurb *nu;
+ void *point = ptr->data;
+ int nu_index, pt_index;
- nu = curve_nurb_from_point(cu, point, &nu_index, &pt_index);
+ nu = curve_nurb_from_point(cu, point, &nu_index, &pt_index);
- if (nu) {
- if (nu->type == CU_BEZIER) {
- return BLI_sprintfN("splines[%d].bezier_points[%d]", nu_index, pt_index);
- }
- else {
- return BLI_sprintfN("splines[%d].points[%d]", nu_index, pt_index);
- }
- }
- else {
- return BLI_strdup("");
- }
+ if (nu) {
+ if (nu->type == CU_BEZIER) {
+ return BLI_sprintfN("splines[%d].bezier_points[%d]", nu_index, pt_index);
+ }
+ else {
+ return BLI_sprintfN("splines[%d].points[%d]", nu_index, pt_index);
+ }
+ }
+ else {
+ return BLI_strdup("");
+ }
}
-
static char *rna_TextBox_path(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- TextBox *tb = ptr->data;
- int index = (int)(tb - cu->tb);
+ Curve *cu = (Curve *)ptr->id.data;
+ TextBox *tb = ptr->data;
+ int index = (int)(tb - cu->tb);
- if (index >= 0 && index < cu->totbox)
- return BLI_sprintfN("text_boxes[%d]", index);
- else
- return BLI_strdup("");
+ if (index >= 0 && index < cu->totbox)
+ return BLI_sprintfN("text_boxes[%d]", index);
+ else
+ return BLI_strdup("");
}
static void rna_Curve_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- rna_iterator_listbase_begin(iter, BKE_curve_nurbs_get(cu), NULL);
+ Curve *cu = (Curve *)ptr->id.data;
+ rna_iterator_listbase_begin(iter, BKE_curve_nurbs_get(cu), NULL);
}
static bool rna_Curve_is_editmode_get(PointerRNA *ptr)
{
- Curve *cu = (Curve *)ptr->id.data;
- const short type = BKE_curve_type_get(cu);
- if (type == OB_FONT) {
- return (cu->editfont != NULL);
- }
- else {
- return (cu->editnurb != NULL);
- }
+ Curve *cu = (Curve *)ptr->id.data;
+ const short type = BKE_curve_type_get(cu);
+ if (type == OB_FONT) {
+ return (cu->editfont != NULL);
+ }
+ else {
+ return (cu->editnurb != NULL);
+ }
}
#else
@@ -750,1042 +814,1160 @@ static const float tilt_limit = DEG2RADF(21600.0f);
static void rna_def_bpoint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SplinePoint", NULL);
- RNA_def_struct_sdna(srna, "BPoint");
- RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles");
-
- /* Boolean values */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
- RNA_def_property_ui_text(prop, "Select", "Selection status");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
- RNA_def_property_ui_text(prop, "Hide", "Visibility status");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* Vector value */
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_sdna(prop, NULL, "vec");
- RNA_def_property_ui_text(prop, "Point", "Point coordinates");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vec[3]");
- RNA_def_property_ui_text(prop, "Weight", "NURBS weight");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* Number values */
- prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, -tilt_limit, tilt_limit);
- RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
- RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_range(prop, 0.01f, 100.0f);
- RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SplinePoint", NULL);
+ RNA_def_struct_sdna(srna, "BPoint");
+ RNA_def_struct_ui_text(srna, "SplinePoint", "Spline point without handles");
+
+ /* Boolean values */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_ui_text(prop, "Select", "Selection status");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
+ RNA_def_property_ui_text(prop, "Hide", "Visibility status");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* Vector value */
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_sdna(prop, NULL, "vec");
+ RNA_def_property_ui_text(prop, "Point", "Point coordinates");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vec[3]");
+ RNA_def_property_ui_text(prop, "Weight", "NURBS weight");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* Number values */
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, -tilt_limit, tilt_limit);
+ RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
+ RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
}
static void rna_def_beztriple(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BezierSplinePoint", NULL);
- RNA_def_struct_sdna(srna, "BezTriple");
- RNA_def_struct_ui_text(srna, "Bezier Curve Point", "Bezier curve point with two handles");
-
- /* Boolean values */
- prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
- RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
- RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
- RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
- RNA_def_property_ui_text(prop, "Hide", "Visibility status");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* Enums */
- prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "h1");
- RNA_def_property_enum_items(prop, beztriple_handle_type_items);
- RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
- RNA_def_property_update(prop, 0, "rna_Curve_update_points");
-
- prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "h2");
- RNA_def_property_enum_items(prop, beztriple_handle_type_items);
- RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
- RNA_def_property_update(prop, 0, "rna_Curve_update_points");
-
- /* Vector values */
- prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL);
- RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_Curve_update_points");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL);
- RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_Curve_update_points");
-
- prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL);
- RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_Curve_update_points");
-
- /* Number values */
- prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, -tilt_limit, tilt_limit);
- RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
- RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_range(prop, 0.01f, 100.0f);
- RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BezierSplinePoint", NULL);
+ RNA_def_struct_sdna(srna, "BezTriple");
+ RNA_def_struct_ui_text(srna, "Bezier Curve Point", "Bezier curve point with two handles");
+
+ /* Boolean values */
+ prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_ui_text(prop, "Handle 1 selected", "Handle 1 selection status");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
+ RNA_def_property_ui_text(prop, "Handle 2 selected", "Handle 2 selection status");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
+ RNA_def_property_ui_text(prop, "Control Point selected", "Control point selection status");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "hide", 0);
+ RNA_def_property_ui_text(prop, "Hide", "Visibility status");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* Enums */
+ prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "h1");
+ RNA_def_property_enum_items(prop, beztriple_handle_type_items);
+ RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle types");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_points");
+
+ prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "h2");
+ RNA_def_property_enum_items(prop, beztriple_handle_type_items);
+ RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle types");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_points");
+
+ /* Vector values */
+ prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(
+ prop, "rna_BezTriple_handle1_get", "rna_BezTriple_handle1_set", NULL);
+ RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_points");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(
+ prop, "rna_BezTriple_ctrlpoint_get", "rna_BezTriple_ctrlpoint_set", NULL);
+ RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_points");
+
+ prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(
+ prop, "rna_BezTriple_handle2_get", "rna_BezTriple_handle2_set", NULL);
+ RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_points");
+
+ /* Number values */
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, -tilt_limit, tilt_limit);
+ RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
+ RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Bevel Radius", "Radius for beveling");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ RNA_def_struct_path_func(srna, "rna_Curve_spline_point_path");
}
static void rna_def_path(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
- PropertyRNA *prop;
-
- /* number values */
- prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "pathlen");
- RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_ui_text(prop, "Path Length",
- "The number of frames that are needed to traverse the path, "
- "defining the maximum value for the 'Evaluation Time' setting");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* flags */
- prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
- RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
- RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
- RNA_def_property_ui_text(prop, "Stretch", "Option for curve-deform: "
- "make deformed child to stretch along entire path");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_DEFORM_BOUNDS_OFF);
- RNA_def_property_ui_text(prop, "Bounds Clamp", "Option for curve-deform: "
- "Use the mesh bounds to clamp the deformation");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH_RADIUS);
- RNA_def_property_ui_text(prop, "Radius", "Option for paths and curve-deform: "
- "apply the curve radius with path following it and deforming");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ PropertyRNA *prop;
+
+ /* number values */
+ prop = RNA_def_property(srna, "path_duration", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "pathlen");
+ RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_ui_text(prop,
+ "Path Length",
+ "The number of frames that are needed to traverse the path, "
+ "defining the maximum value for the 'Evaluation Time' setting");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH);
+ RNA_def_property_ui_text(prop, "Path", "Enable the curve to become a translation path");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_path_follow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FOLLOW);
+ RNA_def_property_ui_text(prop, "Follow", "Make curve path children to rotate along the path");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_stretch", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_STRETCH);
+ RNA_def_property_ui_text(prop,
+ "Stretch",
+ "Option for curve-deform: "
+ "make deformed child to stretch along entire path");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_deform_bounds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", CU_DEFORM_BOUNDS_OFF);
+ RNA_def_property_ui_text(prop,
+ "Bounds Clamp",
+ "Option for curve-deform: "
+ "Use the mesh bounds to clamp the deformation");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_PATH_RADIUS);
+ RNA_def_property_ui_text(prop,
+ "Radius",
+ "Option for paths and curve-deform: "
+ "apply the curve radius with path following it and deforming");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_nurbs(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- /* flags */
- prop = RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
- RNA_def_property_ui_text(prop, "Use UV for Mapping", "Uses the UV values as Generated textured coordinates");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ /* flags */
+ prop = RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
+ RNA_def_property_ui_text(
+ prop, "Use UV for Mapping", "Uses the UV values as Generated textured coordinates");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_font(BlenderRNA *UNUSED(brna), StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_align_items[] = {
- {CU_ALIGN_X_LEFT, "LEFT", ICON_ALIGN_LEFT, "Left", "Align text to the left"},
- {CU_ALIGN_X_MIDDLE, "CENTER", ICON_ALIGN_CENTER, "Center", "Center text"},
- {CU_ALIGN_X_RIGHT, "RIGHT", ICON_ALIGN_RIGHT, "Right", "Align text to the right"},
- {CU_ALIGN_X_JUSTIFY, "JUSTIFY", ICON_ALIGN_JUSTIFY, "Justify", "Align to the left and the right"},
- {CU_ALIGN_X_FLUSH, "FLUSH", ICON_ALIGN_FLUSH, "Flush", "Align to the left and the right, with equal character spacing"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_align_y_items[] = {
- {CU_ALIGN_Y_TOP_BASELINE, "TOP_BASELINE", ICON_ALIGN_TOP, "Top Base-Line", "Align to top but use the base-line of the text"},
- {CU_ALIGN_Y_TOP, "TOP", ICON_ALIGN_TOP, "Top", "Align text to the top"},
- {CU_ALIGN_Y_CENTER, "CENTER", ICON_ALIGN_MIDDLE, "Center", "Align text to the middle"},
- {CU_ALIGN_Y_BOTTOM, "BOTTOM", ICON_ALIGN_BOTTOM, "Bottom", "Align text to the bottom"},
- {CU_ALIGN_Y_BOTTOM_BASELINE, "BOTTOM_BASELINE", ICON_ALIGN_BOTTOM, "Bottom Base-Line",
- "Align text to the bottom but use the base-line of the text"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_overflow_items[] = {
- {CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"},
- {CU_OVERFLOW_SCALE, "SCALE", 0, "Scale to Fit", "Scale down the text to fit inside the text boxes"},
- {CU_OVERFLOW_TRUNCATE, "TRUNCATE", 0, "Truncate", "Truncate the text that would go outside the text boxes"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Enums */
- prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "spacemode");
- RNA_def_property_enum_items(prop, prop_align_items);
- RNA_def_property_ui_text(prop, "Text Horizontal Align", "Text horizontal align from the object center");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "align_y");
- RNA_def_property_enum_items(prop, prop_align_y_items);
- RNA_def_property_ui_text(prop, "Text Vertical Align", "Text vertical align from the object center");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "overflow");
- RNA_def_property_enum_items(prop, prop_overflow_items);
- RNA_def_property_enum_default(prop, CU_OVERFLOW_NONE);
- RNA_def_property_ui_text(prop, "Textbox Overflow",
- "Handle the text behavior when it doesn't fit in the text boxes");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* number values */
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fsize");
- RNA_def_property_range(prop, 0.0001f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
- RNA_def_property_ui_text(prop, "Font size", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "smallcaps_scale");
- RNA_def_property_ui_range(prop, 0, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Small Caps", "Scale of small capitals");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "linedist");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Distance between lines of text", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "wordspace");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Spacing between words", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spacing");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Global spacing between characters", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shear");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "xof");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
- RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "yof");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ulpos");
- RNA_def_property_range(prop, -0.2f, 0.8f);
- RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ulheight");
- RNA_def_property_range(prop, 0.0f, 0.8f);
- RNA_def_property_ui_text(prop, "Underline Thickness", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "tb", "totbox");
- RNA_def_property_struct_type(prop, "TextBox");
- RNA_def_property_ui_text(prop, "Textboxes", "");
-
- prop = RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "actbox");
- RNA_def_property_ui_text(prop, "The active text box", "");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_active_textbox_index_range");
-
- /* strings */
- prop = RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_ui_text(prop, "Object Font",
- "Use Objects as font characters (give font objects a common name "
- "followed by the character they represent, eg. 'family-a', 'family-b', etc, "
- "set this setting to 'family-', and turn on Vertex Duplication)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "str");
- RNA_def_property_ui_text(prop, "Body Text", "Content of this text object");
- RNA_def_property_string_funcs(prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
- RNA_def_property_string_maxlength(prop, 8192); /* note that originally str did not have a limit! */
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len_wchar");
- RNA_def_property_struct_type(prop, "TextCharacterFormat");
- RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character");
-
- /* pointers */
- prop = RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "textoncurve");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_otherObject_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object");
- RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
-
- prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "vfont");
- RNA_def_property_ui_text(prop, "Font", "");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "vfontb");
- RNA_def_property_ui_text(prop, "Font Bold", "");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "vfonti");
- RNA_def_property_ui_text(prop, "Font Italic", "");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "vfontbi");
- RNA_def_property_ui_text(prop, "Font Bold Italic", "");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
- RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* flags */
- prop = RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST);
- RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_align_items[] = {
+ {CU_ALIGN_X_LEFT, "LEFT", ICON_ALIGN_LEFT, "Left", "Align text to the left"},
+ {CU_ALIGN_X_MIDDLE, "CENTER", ICON_ALIGN_CENTER, "Center", "Center text"},
+ {CU_ALIGN_X_RIGHT, "RIGHT", ICON_ALIGN_RIGHT, "Right", "Align text to the right"},
+ {CU_ALIGN_X_JUSTIFY,
+ "JUSTIFY",
+ ICON_ALIGN_JUSTIFY,
+ "Justify",
+ "Align to the left and the right"},
+ {CU_ALIGN_X_FLUSH,
+ "FLUSH",
+ ICON_ALIGN_FLUSH,
+ "Flush",
+ "Align to the left and the right, with equal character spacing"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_align_y_items[] = {
+ {CU_ALIGN_Y_TOP_BASELINE,
+ "TOP_BASELINE",
+ ICON_ALIGN_TOP,
+ "Top Base-Line",
+ "Align to top but use the base-line of the text"},
+ {CU_ALIGN_Y_TOP, "TOP", ICON_ALIGN_TOP, "Top", "Align text to the top"},
+ {CU_ALIGN_Y_CENTER, "CENTER", ICON_ALIGN_MIDDLE, "Center", "Align text to the middle"},
+ {CU_ALIGN_Y_BOTTOM, "BOTTOM", ICON_ALIGN_BOTTOM, "Bottom", "Align text to the bottom"},
+ {CU_ALIGN_Y_BOTTOM_BASELINE,
+ "BOTTOM_BASELINE",
+ ICON_ALIGN_BOTTOM,
+ "Bottom Base-Line",
+ "Align text to the bottom but use the base-line of the text"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_overflow_items[] = {
+ {CU_OVERFLOW_NONE, "NONE", 0, "Overflow", "Let the text overflow outside the text boxes"},
+ {CU_OVERFLOW_SCALE,
+ "SCALE",
+ 0,
+ "Scale to Fit",
+ "Scale down the text to fit inside the text boxes"},
+ {CU_OVERFLOW_TRUNCATE,
+ "TRUNCATE",
+ 0,
+ "Truncate",
+ "Truncate the text that would go outside the text boxes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Enums */
+ prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "spacemode");
+ RNA_def_property_enum_items(prop, prop_align_items);
+ RNA_def_property_ui_text(
+ prop, "Text Horizontal Align", "Text horizontal align from the object center");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align_y");
+ RNA_def_property_enum_items(prop, prop_align_y_items);
+ RNA_def_property_ui_text(
+ prop, "Text Vertical Align", "Text vertical align from the object center");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "overflow", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "overflow");
+ RNA_def_property_enum_items(prop, prop_overflow_items);
+ RNA_def_property_enum_default(prop, CU_OVERFLOW_NONE);
+ RNA_def_property_ui_text(
+ prop, "Textbox Overflow", "Handle the text behavior when it doesn't fit in the text boxes");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* number values */
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fsize");
+ RNA_def_property_range(prop, 0.0001f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
+ RNA_def_property_ui_text(prop, "Font size", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "small_caps_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "smallcaps_scale");
+ RNA_def_property_ui_range(prop, 0, 1.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Small Caps", "Scale of small capitals");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "space_line", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "linedist");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Distance between lines of text", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "space_word", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "wordspace");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Spacing between words", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "space_character", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spacing");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Global spacing between characters", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shear");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Shear", "Italic angle of the characters");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "xof");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "X Offset", "Horizontal offset from the object origin");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "yof");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Y Offset", "Vertical offset from the object origin");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "underline_position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ulpos");
+ RNA_def_property_range(prop, -0.2f, 0.8f);
+ RNA_def_property_ui_text(prop, "Underline Position", "Vertical position of underline");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "underline_height", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ulheight");
+ RNA_def_property_range(prop, 0.0f, 0.8f);
+ RNA_def_property_ui_text(prop, "Underline Thickness", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "text_boxes", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "tb", "totbox");
+ RNA_def_property_struct_type(prop, "TextBox");
+ RNA_def_property_ui_text(prop, "Textboxes", "");
+
+ prop = RNA_def_property(srna, "active_textbox", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "actbox");
+ RNA_def_property_ui_text(prop, "The active text box", "");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_active_textbox_index_range");
+
+ /* strings */
+ prop = RNA_def_property(srna, "family", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Object Font",
+ "Use Objects as font characters (give font objects a common name "
+ "followed by the character they represent, eg. 'family-a', 'family-b', etc, "
+ "set this setting to 'family-', and turn on Vertex Duplication)");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "str");
+ RNA_def_property_ui_text(prop, "Body Text", "Content of this text object");
+ RNA_def_property_string_funcs(
+ prop, "rna_Curve_body_get", "rna_Curve_body_length", "rna_Curve_body_set");
+ RNA_def_property_string_maxlength(prop,
+ 8192); /* note that originally str did not have a limit! */
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "body_format", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "strinfo", "len_wchar");
+ RNA_def_property_struct_type(prop, "TextCharacterFormat");
+ RNA_def_property_ui_text(prop, "Character Info", "Stores the style of each character");
+
+ /* pointers */
+ prop = RNA_def_property(srna, "follow_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "textoncurve");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Curve_otherObject_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Text on Curve", "Curve deforming text object");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
+
+ prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "vfont");
+ RNA_def_property_ui_text(prop, "Font", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "font_bold", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "vfontb");
+ RNA_def_property_ui_text(prop, "Font Bold", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "font_italic", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "vfonti");
+ RNA_def_property_ui_text(prop, "Font Italic", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "font_bold_italic", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "vfontbi");
+ RNA_def_property_ui_text(prop, "Font Bold Italic", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "edit_format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curinfo");
+ RNA_def_property_ui_text(prop, "Edit Format", "Editing settings character formatting");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_fast_edit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FAST);
+ RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_textbox(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "TextBox", NULL);
- RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout");
+ srna = RNA_def_struct(brna, "TextBox", NULL);
+ RNA_def_struct_ui_text(srna, "Text Box", "Text bounding box for layout");
- /* number values */
- prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Textbox X Offset", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ /* number values */
+ prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Textbox X Offset", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "y");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "y");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -50.0f, 50.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Textbox Y Offset", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "w");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Textbox Width", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "w");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Textbox Width", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "h");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Textbox Height", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "h");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 50.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Textbox Height", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
- RNA_def_struct_path_func(srna, "rna_TextBox_path");
+ RNA_def_struct_path_func(srna, "rna_TextBox_path");
}
static void rna_def_charinfo(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TextCharacterFormat", NULL);
- RNA_def_struct_sdna(srna, "CharInfo");
- RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings");
-
- /* flags */
- prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_BOLD);
- RNA_def_property_ui_text(prop, "Bold", "");
- RNA_def_property_ui_icon(prop, ICON_BOLD, 0);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_ITALIC);
- RNA_def_property_ui_text(prop, "Italic", "");
- RNA_def_property_ui_icon(prop, ICON_ITALIC, 0);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_UNDERLINE);
- RNA_def_property_ui_text(prop, "Underline", "");
- RNA_def_property_ui_icon(prop, ICON_UNDERLINE, 0);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* probably there is no reason to expose this */
-#if 0
- prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_WRAP);
- RNA_def_property_ui_text(prop, "Wrap", "");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data"); */
-#endif
-
- prop = RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_SMALLCAPS);
- RNA_def_property_ui_text(prop, "Small Caps", "");
- RNA_def_property_ui_icon(prop, ICON_SMALL_CAPS, 0);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
- // RNA_def_property_int_sdna(prop, NULL, "mat_nr");
- RNA_def_property_ui_text(prop, "Material Index", "");
- RNA_def_property_int_funcs(prop, "rna_ChariInfo_material_index_get", "rna_ChariInfo_material_index_set", "rna_Curve_material_index_range");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "kerning", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "kern");
- RNA_def_property_ui_text(prop, "Kerning", "Spacing between characters");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TextCharacterFormat", NULL);
+ RNA_def_struct_sdna(srna, "CharInfo");
+ RNA_def_struct_ui_text(srna, "Text Character Format", "Text character formatting settings");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_bold", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_BOLD);
+ RNA_def_property_ui_text(prop, "Bold", "");
+ RNA_def_property_ui_icon(prop, ICON_BOLD, 0);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_italic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_ITALIC);
+ RNA_def_property_ui_text(prop, "Italic", "");
+ RNA_def_property_ui_icon(prop, ICON_ITALIC, 0);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_underline", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_UNDERLINE);
+ RNA_def_property_ui_text(prop, "Underline", "");
+ RNA_def_property_ui_icon(prop, ICON_UNDERLINE, 0);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* probably there is no reason to expose this */
+# if 0
+ prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_WRAP);
+ RNA_def_property_ui_text(prop, "Wrap", "");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data"); */
+# endif
+
+ prop = RNA_def_property(srna, "use_small_caps", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_CHINFO_SMALLCAPS);
+ RNA_def_property_ui_text(prop, "Small Caps", "");
+ RNA_def_property_ui_icon(prop, ICON_SMALL_CAPS, 0);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+ // RNA_def_property_int_sdna(prop, NULL, "mat_nr");
+ RNA_def_property_ui_text(prop, "Material Index", "");
+ RNA_def_property_int_funcs(prop,
+ "rna_ChariInfo_material_index_get",
+ "rna_ChariInfo_material_index_set",
+ "rna_Curve_material_index_range");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "kerning", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "kern");
+ RNA_def_property_ui_text(prop, "Kerning", "Spacing between characters");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
}
static void rna_def_surface(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "SurfaceCurve", "Curve");
- RNA_def_struct_sdna(srna, "Curve");
- RNA_def_struct_ui_text(srna, "Surface Curve", "Curve data-block used for storing surfaces");
- RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA);
+ srna = RNA_def_struct(brna, "SurfaceCurve", "Curve");
+ RNA_def_struct_sdna(srna, "Curve");
+ RNA_def_struct_ui_text(srna, "Surface Curve", "Curve data-block used for storing surfaces");
+ RNA_def_struct_ui_icon(srna, ICON_SURFACE_DATA);
- rna_def_nurbs(brna, srna);
+ rna_def_nurbs(brna, srna);
}
static void rna_def_text(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "TextCurve", "Curve");
- RNA_def_struct_sdna(srna, "Curve");
- RNA_def_struct_ui_text(srna, "Text Curve", "Curve data-block used for storing text");
- RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
+ srna = RNA_def_struct(brna, "TextCurve", "Curve");
+ RNA_def_struct_sdna(srna, "Curve");
+ RNA_def_struct_ui_text(srna, "Text Curve", "Curve data-block used for storing text");
+ RNA_def_struct_ui_icon(srna, ICON_FONT_DATA);
- rna_def_font(brna, srna);
- rna_def_nurbs(brna, srna);
+ rna_def_font(brna, srna);
+ rna_def_nurbs(brna, srna);
}
-
/* curve.splines[0].points */
static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- /*PropertyRNA *prop; */
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "SplinePoints");
- srna = RNA_def_struct(brna, "SplinePoints", NULL);
- RNA_def_struct_sdna(srna, "Nurb");
- RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
-
- func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
- RNA_def_function_ui_description(func, "Add a number of points to this spline");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
-#if 0
- func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
- RNA_def_function_ui_description(func, "Remove a spline from a curve");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-#endif
-}
-
-static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
-{
- StructRNA *srna;
- /*PropertyRNA *prop; */
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "SplineBezierPoints");
- srna = RNA_def_struct(brna, "SplineBezierPoints", NULL);
- RNA_def_struct_sdna(srna, "Nurb");
- RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline Bezier points");
-
- func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
- RNA_def_function_ui_description(func, "Add a number of points to this spline");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
-#if 0
- func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
- RNA_def_function_ui_description(func, "Remove a spline from a curve");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-#endif
-}
-
-/* curve.splines */
-static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
-{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ /*PropertyRNA *prop; */
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "CurveSplines");
- srna = RNA_def_struct(brna, "CurveSplines", NULL);
- RNA_def_struct_sdna(srna, "Curve");
- RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
+ RNA_def_property_srna(cprop, "SplinePoints");
+ srna = RNA_def_struct(brna, "SplinePoints", NULL);
+ RNA_def_struct_sdna(srna, "Nurb");
+ RNA_def_struct_ui_text(srna, "Spline Points", "Collection of spline points");
- func = RNA_def_function(srna, "new", "rna_Curve_spline_new");
- RNA_def_function_ui_description(func, "Add a new spline to the curve");
- parm = RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "add", "rna_Curve_spline_points_add");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
- RNA_def_function_ui_description(func, "Remove a spline from a curve");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
- RNA_def_function_ui_description(func, "Remove all splines from a curve");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Spline");
- RNA_def_property_pointer_funcs(prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline");
+# if 0
+ func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+# endif
}
-
-static void rna_def_curve(BlenderRNA *brna)
+static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ /*PropertyRNA *prop; */
- static const EnumPropertyItem curve_twist_mode_items[] = {
- {CU_TWIST_Z_UP, "Z_UP", 0, "Z-Up", "Use Z-Up axis to calculate the curve twist at each point"},
- {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"},
- {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
- {0, NULL, 0, NULL, NULL},
- };
+ FunctionRNA *func;
+ PropertyRNA *parm;
- static const EnumPropertyItem curve_axis_items[] = {
- {0, "2D", 0, "2D", "Clamp the Z axis of the curve"},
- {CU_3D, "3D", 0, "3D",
- "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
- {0, NULL, 0, NULL, NULL},
- };
+ RNA_def_property_srna(cprop, "SplineBezierPoints");
+ srna = RNA_def_struct(brna, "SplineBezierPoints", NULL);
+ RNA_def_struct_sdna(srna, "Nurb");
+ RNA_def_struct_ui_text(srna, "Spline Bezier Points", "Collection of spline Bezier points");
- static const EnumPropertyItem bevfac_mapping_items[] = {
- {CU_BEVFAC_MAP_RESOLU, "RESOLUTION", 0, "Resolution", "Map the bevel factor to the number of subdivisions of a spline (U resolution)"},
- {CU_BEVFAC_MAP_SEGMENT, "SEGMENTS", 0, "Segments", "Map the bevel factor to the length of a segment and to the number of subdivisions of a segment"},
- {CU_BEVFAC_MAP_SPLINE, "SPLINE", 0, "Spline", "Map the bevel factor to the length of a spline"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Curve", "ID");
- RNA_def_struct_ui_text(srna, "Curve", "Curve data-block storing curves, splines and NURBS");
- RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
- RNA_def_struct_refine_func(srna, "rna_Curve_refine");
-
-
- prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "key");
- RNA_def_property_ui_text(prop, "Shape Keys", "");
+ func = RNA_def_function(srna, "add", "rna_Curve_spline_bezpoints_add");
+ RNA_def_function_ui_description(func, "Add a number of points to this spline");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+# if 0
+ func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+# endif
+}
- prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
-#if 0
- RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
-#else
- /* this way we get editmode nurbs too, keyframe in editmode */
- RNA_def_property_collection_funcs(prop, "rna_Curve_splines_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
-#endif
- RNA_def_property_struct_type(prop, "Spline");
- RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
- rna_def_curve_splines(brna, prop);
-
- rna_def_path(brna, srna);
-
- /* Number values */
- prop = RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "bevresol");
- RNA_def_property_range(prop, 0, 32);
- RNA_def_property_ui_range(prop, 0, 32, 1.0, -1);
- RNA_def_property_ui_text(prop, "Bevel Resolution",
- "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "width");
- RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
- RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL);
- RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "ext1");
- RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Extrude", "Amount of curve extrusion when not using a bevel object");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "ext2");
- RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolu");
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_range(prop, 1, 64, 1, -1);
- RNA_def_property_ui_text(prop, "Resolution U", "Surface resolution in U direction");
- RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
-
- prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolv");
- RNA_def_property_ui_range(prop, 1, 64, 1, -1);
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_text(prop, "Resolution V", "Surface resolution in V direction");
- RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
-
- prop = RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolu_ren");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_range(prop, 0, 64, 1, -1);
- RNA_def_property_ui_text(prop, "Render Resolution U",
- "Surface resolution in U direction used while rendering (zero uses preview resolution)");
-
- prop = RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolv_ren");
- RNA_def_property_ui_range(prop, 0, 64, 1, -1);
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "Render Resolution V",
- "Surface resolution in V direction used while rendering (zero uses preview resolution)");
-
-
- prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "ctime");
- RNA_def_property_ui_text(prop, "Evaluation Time",
- "Parametric position along the length of the curve that Objects 'following' it should be "
- "at (position is evaluated by dividing by the 'Path Length' value)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* pointers */
- prop = RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape");
- RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
- RNA_def_property_pointer_funcs(prop, "rna_Curve_bevelObject_get", "rna_Curve_bevelObject_set", NULL,
- "rna_Curve_otherObject_poll");
-
- prop = RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_pointer_sdna(prop, NULL, "taperobj");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Taper Object", "Curve object name that defines the taper (width)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
- RNA_def_property_pointer_funcs(prop, "rna_Curve_taperObject_get", "rna_Curve_taperObject_set", NULL,
- "rna_Curve_otherObject_poll");
-
- /* Flags */
-
- prop = RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, curve_axis_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_dimension_set", NULL);
- RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, curve3d_fill_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Curve_fill_mode_itemf");
- RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "twist_mode");
- RNA_def_property_enum_items(prop, curve_twist_mode_items);
- RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "bevel_factor_mapping_start", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bevfac1_mapping");
- RNA_def_property_enum_items(prop, bevfac_mapping_items);
- RNA_def_property_ui_text(prop, "Start Mapping Type", "Determines how the start bevel factor is mapped to a spline");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "bevel_factor_mapping_end", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bevfac2_mapping");
- RNA_def_property_enum_items(prop, bevfac_mapping_items);
- RNA_def_property_ui_text(prop, "End Mapping Type", "Determines how the end bevel factor is mapped to a spline");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* XXX - would be nice to have a better way to do this, only add for testing. */
- prop = RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "twist_smooth");
- RNA_def_property_ui_range(prop, 0, 100.0, 1, 2);
- RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_fill_deform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL);
- RNA_def_property_ui_text(prop, "Fill Deformed", "Fill curve after applying shape keys and all modifiers");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FILL_CAPS);
- RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for beveled curves");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_map_taper", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_MAP_TAPER);
- RNA_def_property_ui_text(prop, "Map Taper", "Map effect of taper object on actually beveled curve");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* texture space */
- prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space",
- "Adjust active object's texture space automatically when transforming object");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Curve_texspace_set");
-
- prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 3);
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
- RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", NULL);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- /* not supported yet */
-#if 0
- prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
- RNA_def_property_editable_func(prop, texspace_editable);
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-#endif
+/* curve.splines */
+static void rna_def_curve_splines(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
- RNA_def_property_ui_text(prop, "Use UV for mapping", "Uses the UV values as Generated textured coordinates");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ FunctionRNA *func;
+ PropertyRNA *parm;
- /* materials */
- prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_ui_text(prop, "Materials", "");
- RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+ RNA_def_property_srna(cprop, "CurveSplines");
+ srna = RNA_def_struct(brna, "CurveSplines", NULL);
+ RNA_def_struct_sdna(srna, "Curve");
+ RNA_def_struct_ui_text(srna, "Curve Splines", "Collection of curve splines");
- prop = RNA_def_property(srna, "bevel_factor_start", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "bevfac1");
- RNA_def_property_range(prop, 0, 1.0);
- RNA_def_property_ui_text(prop, "Start Bevel Factor", "Factor that defines from where beveling of spline happens (0=from the very beginning, 1=from the very end)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ func = RNA_def_function(srna, "new", "rna_Curve_spline_new");
+ RNA_def_function_ui_description(func, "Add a new spline to the curve");
+ parm = RNA_def_enum(func, "type", curve_type_items, CU_POLY, "", "type for the new spline");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "spline", "Spline", "", "The newly created spline");
+ RNA_def_function_return(func, parm);
- prop = RNA_def_property(srna, "bevel_factor_end", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "bevfac2");
- RNA_def_property_range(prop, 0, 1.0);
- RNA_def_property_ui_text(prop, "End Bevel Factor", "Factor that defines to where beveling of spline happens (0=to the very beginning, 1=to the very end)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+ func = RNA_def_function(srna, "remove", "rna_Curve_spline_remove");
+ RNA_def_function_ui_description(func, "Remove a spline from a curve");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "spline", "Spline", "", "The spline to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+ func = RNA_def_function(srna, "clear", "rna_Curve_spline_clear");
+ RNA_def_function_ui_description(func, "Remove all splines from a curve");
- rna_def_animdata_common(srna);
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Spline");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Curve_active_spline_get", "rna_Curve_active_spline_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Spline", "Active curve spline");
+}
- RNA_api_curve(srna);
+static void rna_def_curve(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem curve_twist_mode_items[] = {
+ {CU_TWIST_Z_UP,
+ "Z_UP",
+ 0,
+ "Z-Up",
+ "Use Z-Up axis to calculate the curve twist at each point"},
+ {CU_TWIST_MINIMUM, "MINIMUM", 0, "Minimum", "Use the least twist over the entire curve"},
+ {CU_TWIST_TANGENT, "TANGENT", 0, "Tangent", "Use the tangent to calculate twist"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem curve_axis_items[] = {
+ {0, "2D", 0, "2D", "Clamp the Z axis of the curve"},
+ {CU_3D,
+ "3D",
+ 0,
+ "3D",
+ "Allow editing on the Z axis of this curve, also allows tilt and curve radius to be used"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem bevfac_mapping_items[] = {
+ {CU_BEVFAC_MAP_RESOLU,
+ "RESOLUTION",
+ 0,
+ "Resolution",
+ "Map the bevel factor to the number of subdivisions of a spline (U resolution)"},
+ {CU_BEVFAC_MAP_SEGMENT,
+ "SEGMENTS",
+ 0,
+ "Segments",
+ "Map the bevel factor to the length of a segment and to the number of subdivisions of a "
+ "segment"},
+ {CU_BEVFAC_MAP_SPLINE,
+ "SPLINE",
+ 0,
+ "Spline",
+ "Map the bevel factor to the length of a spline"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Curve", "ID");
+ RNA_def_struct_ui_text(srna, "Curve", "Curve data-block storing curves, splines and NURBS");
+ RNA_def_struct_ui_icon(srna, ICON_CURVE_DATA);
+ RNA_def_struct_refine_func(srna, "rna_Curve_refine");
+
+ prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "key");
+ RNA_def_property_ui_text(prop, "Shape Keys", "");
+
+ prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
+# if 0
+ RNA_def_property_collection_sdna(prop, NULL, "nurb", NULL);
+# else
+ /* this way we get editmode nurbs too, keyframe in editmode */
+ RNA_def_property_collection_funcs(prop,
+ "rna_Curve_splines_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+# endif
+ RNA_def_property_struct_type(prop, "Spline");
+ RNA_def_property_ui_text(prop, "Splines", "Collection of splines in this curve data object");
+ rna_def_curve_splines(brna, prop);
+
+ rna_def_path(brna, srna);
+
+ /* Number values */
+ prop = RNA_def_property(srna, "bevel_resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "bevresol");
+ RNA_def_property_range(prop, 0, 32);
+ RNA_def_property_ui_range(prop, 0, 32, 1.0, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Bevel Resolution",
+ "Bevel resolution when depth is non-zero and no specific bevel object has been defined");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "width");
+ RNA_def_property_ui_range(prop, -1.0, 1.0, 0.1, 3);
+ RNA_def_property_float_funcs(prop, "rna_Curve_offset_get", "rna_Curve_offset_set", NULL);
+ RNA_def_property_ui_text(prop, "Offset", "Offset the curve to adjust the width of a text");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "extrude", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "ext1");
+ RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Extrude", "Amount of curve extrusion when not using a bevel object");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "bevel_depth", PROP_FLOAT, PROP_NONE | PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "ext2");
+ RNA_def_property_ui_range(prop, 0, 100.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Bevel Depth", "Bevel depth when not using a bevel object");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolu");
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_range(prop, 1, 64, 1, -1);
+ RNA_def_property_ui_text(prop, "Resolution U", "Surface resolution in U direction");
+ RNA_def_property_update(prop, 0, "rna_Curve_resolution_u_update_data");
+
+ prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolv");
+ RNA_def_property_ui_range(prop, 1, 64, 1, -1);
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_text(prop, "Resolution V", "Surface resolution in V direction");
+ RNA_def_property_update(prop, 0, "rna_Curve_resolution_v_update_data");
+
+ prop = RNA_def_property(srna, "render_resolution_u", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolu_ren");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_range(prop, 0, 64, 1, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Render Resolution U",
+ "Surface resolution in U direction used while rendering (zero uses preview resolution)");
+
+ prop = RNA_def_property(srna, "render_resolution_v", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolv_ren");
+ RNA_def_property_ui_range(prop, 0, 64, 1, -1);
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(
+ prop,
+ "Render Resolution V",
+ "Surface resolution in V direction used while rendering (zero uses preview resolution)");
+
+ prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "ctime");
+ RNA_def_property_ui_text(
+ prop,
+ "Evaluation Time",
+ "Parametric position along the length of the curve that Objects 'following' it should be "
+ "at (position is evaluated by dividing by the 'Path Length' value)");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* pointers */
+ prop = RNA_def_property(srna, "bevel_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_pointer_sdna(prop, NULL, "bevobj");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Bevel Object", "Curve object name that defines the bevel shape");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_Curve_bevelObject_get",
+ "rna_Curve_bevelObject_set",
+ NULL,
+ "rna_Curve_otherObject_poll");
+
+ prop = RNA_def_property(srna, "taper_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_pointer_sdna(prop, NULL, "taperobj");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Taper Object", "Curve object name that defines the taper (width)");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_deps");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_Curve_taperObject_get",
+ "rna_Curve_taperObject_set",
+ NULL,
+ "rna_Curve_otherObject_poll");
+
+ /* Flags */
+
+ prop = RNA_def_property(srna, "dimensions", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, curve_axis_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Curve_dimension_set", NULL);
+ RNA_def_property_ui_text(prop, "Dimensions", "Select 2D or 3D curve type");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "fill_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, curve3d_fill_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Curve_fill_mode_itemf");
+ RNA_def_property_ui_text(prop, "Fill Mode", "Mode of filling curve");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "twist_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "twist_mode");
+ RNA_def_property_enum_items(prop, curve_twist_mode_items);
+ RNA_def_property_ui_text(prop, "Twist Method", "The type of tilt calculation for 3D Curves");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "bevel_factor_mapping_start", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bevfac1_mapping");
+ RNA_def_property_enum_items(prop, bevfac_mapping_items);
+ RNA_def_property_ui_text(
+ prop, "Start Mapping Type", "Determines how the start bevel factor is mapped to a spline");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "bevel_factor_mapping_end", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bevfac2_mapping");
+ RNA_def_property_enum_items(prop, bevfac_mapping_items);
+ RNA_def_property_ui_text(
+ prop, "End Mapping Type", "Determines how the end bevel factor is mapped to a spline");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* XXX - would be nice to have a better way to do this, only add for testing. */
+ prop = RNA_def_property(srna, "twist_smooth", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "twist_smooth");
+ RNA_def_property_ui_range(prop, 0, 100.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Twist Smooth", "Smoothing iteration for tangents");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_fill_deform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_DEFORM_FILL);
+ RNA_def_property_ui_text(
+ prop, "Fill Deformed", "Fill curve after applying shape keys and all modifiers");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_fill_caps", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_FILL_CAPS);
+ RNA_def_property_ui_text(prop, "Fill Caps", "Fill caps for beveled curves");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_map_taper", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_MAP_TAPER);
+ RNA_def_property_ui_text(
+ prop, "Map Taper", "Map effect of taper object on actually beveled curve");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* texture space */
+ prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "texflag", CU_AUTOSPACE);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Texture Space",
+ "Adjust active object's texture space automatically when transforming object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Curve_texspace_set");
+
+ prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
+ RNA_def_property_float_funcs(
+ prop, "rna_Curve_texspace_loc_get", "rna_Curve_texspace_loc_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
+ RNA_def_property_editable_func(prop, "rna_Curve_texspace_editable");
+ RNA_def_property_float_funcs(
+ prop, "rna_Curve_texspace_size_get", "rna_Curve_texspace_size_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* not supported yet */
+# if 0
+ prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+# endif
+
+ prop = RNA_def_property(srna, "use_uv_as_generated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_UV_ORCO);
+ RNA_def_property_ui_text(
+ prop, "Use UV for mapping", "Uses the UV values as Generated textured coordinates");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ /* materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+
+ prop = RNA_def_property(srna, "bevel_factor_start", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "bevfac1");
+ RNA_def_property_range(prop, 0, 1.0);
+ RNA_def_property_ui_text(prop,
+ "Start Bevel Factor",
+ "Factor that defines from where beveling of spline happens (0=from the "
+ "very beginning, 1=from the very end)");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "bevel_factor_end", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "bevfac2");
+ RNA_def_property_range(prop, 0, 1.0);
+ RNA_def_property_ui_text(prop,
+ "End Bevel Factor",
+ "Factor that defines to where beveling of spline happens (0=to the "
+ "very beginning, 1=to the very end)");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Curve_is_editmode_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+
+ rna_def_animdata_common(srna);
+
+ RNA_api_curve(srna);
}
static void rna_def_curve_nurb(BlenderRNA *brna)
{
- static const EnumPropertyItem spline_interpolation_items[] = {
- {KEY_LINEAR, "LINEAR", 0, "Linear", ""},
- {KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
- {KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""},
- {KEY_CU_EASE, "EASE", 0, "Ease", ""}, /* todo, define somewhere, not one of BEZT_IPO_* */
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Spline", NULL);
- RNA_def_struct_sdna(srna, "Nurb");
- RNA_def_struct_ui_text(srna, "Spline",
- "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects");
-
- prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
- RNA_def_property_struct_type(prop, "SplinePoint");
- RNA_def_property_collection_funcs(prop, "rna_BPoint_array_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", "rna_Nurb_length",
- NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Points", "Collection of points that make up this poly or nurbs spline");
- rna_def_curve_spline_points(brna, prop);
-
- prop = RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "BezierSplinePoint");
- RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu");
- RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for Bezier curves only");
- rna_def_curve_spline_bezpoints(brna, prop);
-
-
- prop = RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tilt_interp");
- RNA_def_property_enum_items(prop, spline_interpolation_items);
- RNA_def_property_ui_text(prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bezier curves");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "radius_interp");
- RNA_def_property_enum_items(prop, spline_interpolation_items);
- RNA_def_property_ui_text(prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, curve_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
- RNA_def_property_int_sdna(prop, NULL, "pntsu");
- RNA_def_property_ui_text(prop, "Points U", "Total number points for the curve or surface in the U direction");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
- RNA_def_property_int_sdna(prop, NULL, "pntsv");
- RNA_def_property_ui_text(prop, "Points V", "Total number points for the surface on the V direction");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
-
- prop = RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "orderu");
- RNA_def_property_range(prop, 2, 6);
- RNA_def_property_ui_text(prop, "Order U",
- "NURBS order in the U direction (for splines and surfaces, higher values "
- "let points influence a greater area)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
-
- prop = RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "orderv");
- RNA_def_property_range(prop, 2, 6);
- RNA_def_property_ui_text(prop, "Order V",
- "NURBS order in the V direction (for surfaces only, higher values "
- "let points influence a greater area)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
-
-
- prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolu");
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_range(prop, 1, 64, 1, -1);
- RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolv");
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_range(prop, 1, 64, 1, -1);
- RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
-
- prop = RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
-
-
- /* Note, endpoint and bezier flags should never be on at the same time! */
- prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
- RNA_def_property_ui_text(prop, "Endpoint U",
- "Make this nurbs curve or surface meet the endpoints in the U direction "
- "(Cyclic U must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
-
- prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
- RNA_def_property_ui_text(prop, "Endpoint V",
- "Make this nurbs surface meet the endpoints in the V direction "
- "(Cyclic V must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
-
- prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
- RNA_def_property_ui_text(prop, "Bezier U",
- "Make this nurbs curve or surface act like a Bezier spline in the U direction "
- "(Order U must be 3 or 4, Cyclic U must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
-
- prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
- RNA_def_property_ui_text(prop, "Bezier V",
- "Make this nurbs surface act like a Bezier spline in the V direction "
- "(Order V must be 3 or 4, Cyclic V must be disabled)");
- RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
-
-
- prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SMOOTH);
- RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "hide", 1);
- RNA_def_property_ui_text(prop, "Hide", "Hide this curve in Edit mode");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "mat_nr");
- RNA_def_property_ui_text(prop, "Material Index", "");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_material_index_range");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "charidx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
- RNA_def_property_ui_text(prop, "Character Index",
- "Location of this character in the text data (only for text curves)");
- RNA_def_property_update(prop, 0, "rna_Curve_update_data");
-
- RNA_def_struct_path_func(srna, "rna_Curve_spline_path");
-
- RNA_api_curve_nurb(srna);
+ static const EnumPropertyItem spline_interpolation_items[] = {
+ {KEY_LINEAR, "LINEAR", 0, "Linear", ""},
+ {KEY_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
+ {KEY_BSPLINE, "BSPLINE", 0, "BSpline", ""},
+ {KEY_CU_EASE, "EASE", 0, "Ease", ""}, /* todo, define somewhere, not one of BEZT_IPO_* */
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Spline", NULL);
+ RNA_def_struct_sdna(srna, "Nurb");
+ RNA_def_struct_ui_text(
+ srna,
+ "Spline",
+ "Element of a curve, either NURBS, Bezier or Polyline or a character with text objects");
+
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "bp", NULL);
+ RNA_def_property_struct_type(prop, "SplinePoint");
+ RNA_def_property_collection_funcs(prop,
+ "rna_BPoint_array_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Nurb_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Points", "Collection of points that make up this poly or nurbs spline");
+ rna_def_curve_spline_points(brna, prop);
+
+ prop = RNA_def_property(srna, "bezier_points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BezierSplinePoint");
+ RNA_def_property_collection_sdna(prop, NULL, "bezt", "pntsu");
+ RNA_def_property_ui_text(prop, "Bezier Points", "Collection of points for Bezier curves only");
+ rna_def_curve_spline_bezpoints(brna, prop);
+
+ prop = RNA_def_property(srna, "tilt_interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tilt_interp");
+ RNA_def_property_enum_items(prop, spline_interpolation_items);
+ RNA_def_property_ui_text(
+ prop, "Tilt Interpolation", "The type of tilt interpolation for 3D, Bezier curves");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "radius_interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "radius_interp");
+ RNA_def_property_enum_items(prop, spline_interpolation_items);
+ RNA_def_property_ui_text(
+ prop, "Radius Interpolation", "The type of radius interpolation for Bezier curves");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, curve_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Nurb_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "The interpolation type for this curve element");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
+ RNA_def_property_int_sdna(prop, NULL, "pntsu");
+ RNA_def_property_ui_text(
+ prop, "Points U", "Total number points for the curve or surface in the U direction");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
+ RNA_def_property_int_sdna(prop, NULL, "pntsv");
+ RNA_def_property_ui_text(
+ prop, "Points V", "Total number points for the surface on the V direction");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "order_u", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "orderu");
+ RNA_def_property_range(prop, 2, 6);
+ RNA_def_property_ui_text(
+ prop,
+ "Order U",
+ "NURBS order in the U direction (for splines and surfaces, higher values "
+ "let points influence a greater area)");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
+
+ prop = RNA_def_property(srna, "order_v", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "orderv");
+ RNA_def_property_range(prop, 2, 6);
+ RNA_def_property_ui_text(prop,
+ "Order V",
+ "NURBS order in the V direction (for surfaces only, higher values "
+ "let points influence a greater area)");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
+
+ prop = RNA_def_property(srna, "resolution_u", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolu");
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_range(prop, 1, 64, 1, -1);
+ RNA_def_property_ui_text(prop, "Resolution U", "Curve or Surface subdivisions per segment");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "resolution_v", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolv");
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_range(prop, 1, 64, 1, -1);
+ RNA_def_property_ui_text(prop, "Resolution V", "Surface subdivisions per segment");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "use_cyclic_u", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_CYCLIC);
+ RNA_def_property_ui_text(
+ prop, "Cyclic U", "Make this curve or surface a closed loop in the U direction");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_u");
+
+ prop = RNA_def_property(srna, "use_cyclic_v", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_CYCLIC);
+ RNA_def_property_ui_text(prop, "Cyclic V", "Make this surface a closed loop in the V direction");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_cyclic_v");
+
+ /* Note, endpoint and bezier flags should never be on at the same time! */
+ prop = RNA_def_property(srna, "use_endpoint_u", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_ENDPOINT);
+ RNA_def_property_ui_text(
+ prop,
+ "Endpoint U",
+ "Make this nurbs curve or surface meet the endpoints in the U direction "
+ "(Cyclic U must be disabled)");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
+
+ prop = RNA_def_property(srna, "use_endpoint_v", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_ENDPOINT);
+ RNA_def_property_ui_text(prop,
+ "Endpoint V",
+ "Make this nurbs surface meet the endpoints in the V direction "
+ "(Cyclic V must be disabled)");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
+
+ prop = RNA_def_property(srna, "use_bezier_u", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagu", CU_NURB_BEZIER);
+ RNA_def_property_ui_text(
+ prop,
+ "Bezier U",
+ "Make this nurbs curve or surface act like a Bezier spline in the U direction "
+ "(Order U must be 3 or 4, Cyclic U must be disabled)");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_u");
+
+ prop = RNA_def_property(srna, "use_bezier_v", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flagv", CU_NURB_BEZIER);
+ RNA_def_property_ui_text(prop,
+ "Bezier V",
+ "Make this nurbs surface act like a Bezier spline in the V direction "
+ "(Order V must be 3 or 4, Cyclic V must be disabled)");
+ RNA_def_property_update(prop, 0, "rna_Nurb_update_knot_v");
+
+ prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CU_SMOOTH);
+ RNA_def_property_ui_text(prop, "Smooth", "Smooth the normals of the surface or beveled curve");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "hide", 1);
+ RNA_def_property_ui_text(prop, "Hide", "Hide this curve in Edit mode");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "mat_nr");
+ RNA_def_property_ui_text(prop, "Material Index", "");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Curve_material_index_range");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "charidx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/
+ RNA_def_property_ui_text(prop,
+ "Character Index",
+ "Location of this character in the text data (only for text curves)");
+ RNA_def_property_update(prop, 0, "rna_Curve_update_data");
+
+ RNA_def_struct_path_func(srna, "rna_Curve_spline_path");
+
+ RNA_api_curve_nurb(srna);
}
void RNA_def_curve(BlenderRNA *brna)
{
- rna_def_curve(brna);
- rna_def_surface(brna);
- rna_def_text(brna);
- rna_def_textbox(brna);
- rna_def_charinfo(brna);
- rna_def_bpoint(brna);
- rna_def_beztriple(brna);
- rna_def_curve_nurb(brna);
+ rna_def_curve(brna);
+ rna_def_surface(brna);
+ rna_def_text(brna);
+ rna_def_textbox(brna);
+ rna_def_charinfo(brna);
+ rna_def_bpoint(brna);
+ rna_def_beztriple(brna);
+ rna_def_curve_nurb(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_curve_api.c b/source/blender/makesrna/intern/rna_curve_api.c
index fc2b75ceda8..3ff244aed6d 100644
--- a/source/blender/makesrna/intern/rna_curve_api.c
+++ b/source/blender/makesrna/intern/rna_curve_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -33,62 +32,76 @@
#include "BKE_curve.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
static void rna_Curve_transform(Curve *cu, float *mat, bool shape_keys)
{
- BKE_curve_transform(cu, (float (*)[4])mat, shape_keys, true);
+ BKE_curve_transform(cu, (float(*)[4])mat, shape_keys, true);
- DEG_id_tag_update(&cu->id, 0);
+ DEG_id_tag_update(&cu->id, 0);
}
static void rna_Curve_update_gpu_tag(Curve *cu)
{
- BKE_curve_batch_cache_dirty_tag(cu, BKE_CURVE_BATCH_DIRTY_ALL);
+ BKE_curve_batch_cache_dirty_tag(cu, BKE_CURVE_BATCH_DIRTY_ALL);
}
static float rna_Nurb_calc_length(Nurb *nu, int resolution_u)
{
- return BKE_nurb_calc_length(nu, resolution_u);
+ return BKE_nurb_calc_length(nu, resolution_u);
}
#else
void RNA_api_curve(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "transform", "rna_Curve_transform");
- RNA_def_function_ui_description(func, "Transform curve by a matrix");
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
-
- func = RNA_def_function(srna, "validate_material_indices", "BKE_curve_material_index_validate");
- RNA_def_function_ui_description(func, "Validate material indices of splines or letters, return True when the curve "
- "has had invalid indices corrected (to default 0)");
- parm = RNA_def_boolean(func, "result", 0, "Result", "");
- RNA_def_function_return(func, parm);
-
- RNA_def_function(srna, "update_gpu_tag", "rna_Curve_update_gpu_tag");
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "transform", "rna_Curve_transform");
+ RNA_def_function_ui_description(func, "Transform curve by a matrix");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
+
+ func = RNA_def_function(srna, "validate_material_indices", "BKE_curve_material_index_validate");
+ RNA_def_function_ui_description(
+ func,
+ "Validate material indices of splines or letters, return True when the curve "
+ "has had invalid indices corrected (to default 0)");
+ parm = RNA_def_boolean(func, "result", 0, "Result", "");
+ RNA_def_function_return(func, parm);
+
+ RNA_def_function(srna, "update_gpu_tag", "rna_Curve_update_gpu_tag");
}
void RNA_api_curve_nurb(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "calc_length", "rna_Nurb_calc_length");
- RNA_def_function_ui_description(func, "Calculate spline length");
- RNA_def_int(
- func, "resolution", 0, 0, 1024, "Resolution",
- "Spline resolution to be used, 0 defaults to the resolution_u", 0, 64);
- parm = RNA_def_float_distance(
- func, "length", 0.0f, 0.0f, FLT_MAX, "Length",
- "Length of the polygonaly approximated spline", 0.0f, FLT_MAX);
- RNA_def_function_return(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "calc_length", "rna_Nurb_calc_length");
+ RNA_def_function_ui_description(func, "Calculate spline length");
+ RNA_def_int(func,
+ "resolution",
+ 0,
+ 0,
+ 1024,
+ "Resolution",
+ "Spline resolution to be used, 0 defaults to the resolution_u",
+ 0,
+ 64);
+ parm = RNA_def_float_distance(func,
+ "length",
+ 0.0f,
+ 0.0f,
+ FLT_MAX,
+ "Length",
+ "Length of the polygonaly approximated spline",
+ 0.0f,
+ FLT_MAX);
+ RNA_def_function_return(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c
index e51fa50ddff..9972bbaa829 100644
--- a/source/blender/makesrna/intern/rna_define.c
+++ b/source/blender/makesrna/intern/rna_define.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <float.h>
#include <limits.h>
#include <stdio.h>
@@ -38,7 +37,7 @@
#include "BLT_translation.h"
-#include "UI_interface.h" /* For things like UI_PRECISION_FLOAT_MAX... */
+#include "UI_interface.h" /* For things like UI_PRECISION_FLOAT_MAX... */
#include "RNA_define.h"
@@ -50,12 +49,13 @@ static CLG_LogRef LOG = {"rna.define"};
#ifdef DEBUG
# define ASSERT_SOFT_HARD_LIMITS \
- if (softmin < hardmin || softmax > hardmax) { \
- CLOG_ERROR(&LOG, "error with soft/hard limits: %s.%s", CONTAINER_RNA_ID(cont), identifier); \
- BLI_assert(!"invalid soft/hard limits"); \
- } (void)0
+ if (softmin < hardmin || softmax > hardmax) { \
+ CLOG_ERROR(&LOG, "error with soft/hard limits: %s.%s", CONTAINER_RNA_ID(cont), identifier); \
+ BLI_assert(!"invalid soft/hard limits"); \
+ } \
+ (void)0
#else
-# define ASSERT_SOFT_HARD_LIMITS (void)0
+# define ASSERT_SOFT_HARD_LIMITS (void)0
#endif
/* Global used during defining */
@@ -64,7 +64,7 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1, 1};
#ifndef RNA_RUNTIME
static struct {
- GHash *struct_map_static_from_alias;
+ GHash *struct_map_static_from_alias;
} g_version_data;
#endif
@@ -72,14 +72,18 @@ static struct {
/* pedantic check for final '.', note '...' are allowed though. */
#ifndef NDEBUG
-# define DESCR_CHECK(description, id1, id2) \
- if (description && (description)[0]) { \
- int i = strlen(description); \
- if (i > 3 && (description)[i - 1] == '.' && (description)[i - 3] != '.') { \
- CLOG_WARN(&LOG, "'%s' description from '%s' '%s' ends with a '.' !", \
- description, id1 ? id1 : "", id2 ? id2 : ""); \
- } \
- } (void)0
+# define DESCR_CHECK(description, id1, id2) \
+ if (description && (description)[0]) { \
+ int i = strlen(description); \
+ if (i > 3 && (description)[i - 1] == '.' && (description)[i - 3] != '.') { \
+ CLOG_WARN(&LOG, \
+ "'%s' description from '%s' '%s' ends with a '.' !", \
+ description, \
+ id1 ? id1 : "", \
+ id2 ? id2 : ""); \
+ } \
+ } \
+ (void)0
#else
# define DESCR_CHECK(description, id1, id2)
@@ -87,989 +91,1022 @@ static struct {
void rna_addtail(ListBase *listbase, void *vlink)
{
- Link *link = vlink;
+ Link *link = vlink;
- link->next = NULL;
- link->prev = listbase->last;
+ link->next = NULL;
+ link->prev = listbase->last;
- if (listbase->last) ((Link *)listbase->last)->next = link;
- if (listbase->first == NULL) listbase->first = link;
- listbase->last = link;
+ if (listbase->last)
+ ((Link *)listbase->last)->next = link;
+ if (listbase->first == NULL)
+ listbase->first = link;
+ listbase->last = link;
}
static void rna_remlink(ListBase *listbase, void *vlink)
{
- Link *link = vlink;
+ Link *link = vlink;
- if (link->next) link->next->prev = link->prev;
- if (link->prev) link->prev->next = link->next;
+ if (link->next)
+ link->next->prev = link->prev;
+ if (link->prev)
+ link->prev->next = link->next;
- if (listbase->last == link) listbase->last = link->prev;
- if (listbase->first == link) listbase->first = link->next;
+ if (listbase->last == link)
+ listbase->last = link->prev;
+ if (listbase->first == link)
+ listbase->first = link->next;
}
PropertyDefRNA *rna_findlink(ListBase *listbase, const char *identifier)
{
- Link *link;
+ Link *link;
- for (link = listbase->first; link; link = link->next) {
- PropertyRNA *prop = ((PropertyDefRNA *)link)->prop;
- if (prop && (STREQ(prop->identifier, identifier))) {
- return (PropertyDefRNA *)link;
- }
- }
+ for (link = listbase->first; link; link = link->next) {
+ PropertyRNA *prop = ((PropertyDefRNA *)link)->prop;
+ if (prop && (STREQ(prop->identifier, identifier))) {
+ return (PropertyDefRNA *)link;
+ }
+ }
- return NULL;
+ return NULL;
}
void rna_freelinkN(ListBase *listbase, void *vlink)
{
- rna_remlink(listbase, vlink);
- MEM_freeN(vlink);
+ rna_remlink(listbase, vlink);
+ MEM_freeN(vlink);
}
void rna_freelistN(ListBase *listbase)
{
- Link *link, *next;
+ Link *link, *next;
- for (link = listbase->first; link; link = next) {
- next = link->next;
- MEM_freeN(link);
- }
+ for (link = listbase->first; link; link = next) {
+ next = link->next;
+ MEM_freeN(link);
+ }
- listbase->first = listbase->last = NULL;
+ listbase->first = listbase->last = NULL;
}
static void rna_brna_structs_add(BlenderRNA *brna, StructRNA *srna)
{
- rna_addtail(&brna->structs, srna);
- brna->structs_len += 1;
+ rna_addtail(&brna->structs, srna);
+ brna->structs_len += 1;
- /* This exception is only needed for pre-processing.
- * otherwise we don't allow empty names. */
- if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) &&
- (srna->identifier[0] != '\0'))
- {
- BLI_ghash_insert(brna->structs_map, (void *)srna->identifier, srna);
- }
+ /* This exception is only needed for pre-processing.
+ * otherwise we don't allow empty names. */
+ if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && (srna->identifier[0] != '\0')) {
+ BLI_ghash_insert(brna->structs_map, (void *)srna->identifier, srna);
+ }
}
#ifdef RNA_RUNTIME
static void rna_brna_structs_remove_and_free(BlenderRNA *brna, StructRNA *srna)
{
- if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && brna->structs_map) {
- if (srna->identifier[0] != '\0') {
- BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
- }
- }
+ if ((srna->flag & STRUCT_PUBLIC_NAMESPACE) && brna->structs_map) {
+ if (srna->identifier[0] != '\0') {
+ BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
+ }
+ }
- RNA_def_struct_free_pointers(NULL, srna);
+ RNA_def_struct_free_pointers(NULL, srna);
- if (srna->flag & STRUCT_RUNTIME) {
- rna_freelinkN(&brna->structs, srna);
- }
- brna->structs_len -= 1;
+ if (srna->flag & STRUCT_RUNTIME) {
+ rna_freelinkN(&brna->structs, srna);
+ }
+ brna->structs_len -= 1;
}
#endif
-
static int DNA_struct_find_nr_wrapper(const struct SDNA *sdna, const char *struct_name)
{
- struct_name = DNA_struct_rename_legacy_hack_static_from_alias(struct_name);
+ struct_name = DNA_struct_rename_legacy_hack_static_from_alias(struct_name);
#ifdef RNA_RUNTIME
- /* We may support this at some point but for now we don't. */
- BLI_assert(0);
+ /* We may support this at some point but for now we don't. */
+ BLI_assert(0);
#else
- struct_name = BLI_ghash_lookup_default(
- g_version_data.struct_map_static_from_alias, struct_name, (void *)struct_name);
+ struct_name = BLI_ghash_lookup_default(
+ g_version_data.struct_map_static_from_alias, struct_name, (void *)struct_name);
#endif
- return DNA_struct_find_nr(sdna, struct_name);
+ return DNA_struct_find_nr(sdna, struct_name);
}
StructDefRNA *rna_find_struct_def(StructRNA *srna)
{
- StructDefRNA *dsrna;
+ StructDefRNA *dsrna;
- if (!DefRNA.preprocess) {
- /* we should never get here */
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return NULL;
- }
+ if (!DefRNA.preprocess) {
+ /* we should never get here */
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return NULL;
+ }
- dsrna = DefRNA.structs.last;
- for (; dsrna; dsrna = dsrna->cont.prev)
- if (dsrna->srna == srna)
- return dsrna;
+ dsrna = DefRNA.structs.last;
+ for (; dsrna; dsrna = dsrna->cont.prev)
+ if (dsrna->srna == srna)
+ return dsrna;
- return NULL;
+ return NULL;
}
PropertyDefRNA *rna_find_struct_property_def(StructRNA *srna, PropertyRNA *prop)
{
- StructDefRNA *dsrna;
- PropertyDefRNA *dprop;
+ StructDefRNA *dsrna;
+ PropertyDefRNA *dprop;
- if (!DefRNA.preprocess) {
- /* we should never get here */
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return NULL;
- }
+ if (!DefRNA.preprocess) {
+ /* we should never get here */
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return NULL;
+ }
- dsrna = rna_find_struct_def(srna);
- dprop = dsrna->cont.properties.last;
- for (; dprop; dprop = dprop->prev)
- if (dprop->prop == prop)
- return dprop;
+ dsrna = rna_find_struct_def(srna);
+ dprop = dsrna->cont.properties.last;
+ for (; dprop; dprop = dprop->prev)
+ if (dprop->prop == prop)
+ return dprop;
- dsrna = DefRNA.structs.last;
- for (; dsrna; dsrna = dsrna->cont.prev) {
- dprop = dsrna->cont.properties.last;
- for (; dprop; dprop = dprop->prev)
- if (dprop->prop == prop)
- return dprop;
- }
+ dsrna = DefRNA.structs.last;
+ for (; dsrna; dsrna = dsrna->cont.prev) {
+ dprop = dsrna->cont.properties.last;
+ for (; dprop; dprop = dprop->prev)
+ if (dprop->prop == prop)
+ return dprop;
+ }
- return NULL;
+ return NULL;
}
#if 0
static PropertyDefRNA *rna_find_property_def(PropertyRNA *prop)
{
- PropertyDefRNA *dprop;
+ PropertyDefRNA *dprop;
- if (!DefRNA.preprocess) {
- /* we should never get here */
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return NULL;
- }
+ if (!DefRNA.preprocess) {
+ /* we should never get here */
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return NULL;
+ }
- dprop = rna_find_struct_property_def(DefRNA.laststruct, prop);
- if (dprop)
- return dprop;
+ dprop = rna_find_struct_property_def(DefRNA.laststruct, prop);
+ if (dprop)
+ return dprop;
- dprop = rna_find_parameter_def(prop);
- if (dprop)
- return dprop;
+ dprop = rna_find_parameter_def(prop);
+ if (dprop)
+ return dprop;
- return NULL;
+ return NULL;
}
#endif
FunctionDefRNA *rna_find_function_def(FunctionRNA *func)
{
- StructDefRNA *dsrna;
- FunctionDefRNA *dfunc;
+ StructDefRNA *dsrna;
+ FunctionDefRNA *dfunc;
- if (!DefRNA.preprocess) {
- /* we should never get here */
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return NULL;
- }
+ if (!DefRNA.preprocess) {
+ /* we should never get here */
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return NULL;
+ }
- dsrna = rna_find_struct_def(DefRNA.laststruct);
- dfunc = dsrna->functions.last;
- for (; dfunc; dfunc = dfunc->cont.prev)
- if (dfunc->func == func)
- return dfunc;
+ dsrna = rna_find_struct_def(DefRNA.laststruct);
+ dfunc = dsrna->functions.last;
+ for (; dfunc; dfunc = dfunc->cont.prev)
+ if (dfunc->func == func)
+ return dfunc;
- dsrna = DefRNA.structs.last;
- for (; dsrna; dsrna = dsrna->cont.prev) {
- dfunc = dsrna->functions.last;
- for (; dfunc; dfunc = dfunc->cont.prev)
- if (dfunc->func == func)
- return dfunc;
- }
+ dsrna = DefRNA.structs.last;
+ for (; dsrna; dsrna = dsrna->cont.prev) {
+ dfunc = dsrna->functions.last;
+ for (; dfunc; dfunc = dfunc->cont.prev)
+ if (dfunc->func == func)
+ return dfunc;
+ }
- return NULL;
+ return NULL;
}
PropertyDefRNA *rna_find_parameter_def(PropertyRNA *parm)
{
- StructDefRNA *dsrna;
- FunctionDefRNA *dfunc;
- PropertyDefRNA *dparm;
-
- if (!DefRNA.preprocess) {
- /* we should never get here */
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return NULL;
- }
-
- dsrna = rna_find_struct_def(DefRNA.laststruct);
- dfunc = dsrna->functions.last;
- for (; dfunc; dfunc = dfunc->cont.prev) {
- dparm = dfunc->cont.properties.last;
- for (; dparm; dparm = dparm->prev)
- if (dparm->prop == parm)
- return dparm;
- }
-
- dsrna = DefRNA.structs.last;
- for (; dsrna; dsrna = dsrna->cont.prev) {
- dfunc = dsrna->functions.last;
- for (; dfunc; dfunc = dfunc->cont.prev) {
- dparm = dfunc->cont.properties.last;
- for (; dparm; dparm = dparm->prev)
- if (dparm->prop == parm)
- return dparm;
- }
- }
-
- return NULL;
+ StructDefRNA *dsrna;
+ FunctionDefRNA *dfunc;
+ PropertyDefRNA *dparm;
+
+ if (!DefRNA.preprocess) {
+ /* we should never get here */
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return NULL;
+ }
+
+ dsrna = rna_find_struct_def(DefRNA.laststruct);
+ dfunc = dsrna->functions.last;
+ for (; dfunc; dfunc = dfunc->cont.prev) {
+ dparm = dfunc->cont.properties.last;
+ for (; dparm; dparm = dparm->prev)
+ if (dparm->prop == parm)
+ return dparm;
+ }
+
+ dsrna = DefRNA.structs.last;
+ for (; dsrna; dsrna = dsrna->cont.prev) {
+ dfunc = dsrna->functions.last;
+ for (; dfunc; dfunc = dfunc->cont.prev) {
+ dparm = dfunc->cont.properties.last;
+ for (; dparm; dparm = dparm->prev)
+ if (dparm->prop == parm)
+ return dparm;
+ }
+ }
+
+ return NULL;
}
static ContainerDefRNA *rna_find_container_def(ContainerRNA *cont)
{
- StructDefRNA *ds;
- FunctionDefRNA *dfunc;
+ StructDefRNA *ds;
+ FunctionDefRNA *dfunc;
- if (!DefRNA.preprocess) {
- /* we should never get here */
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return NULL;
- }
+ if (!DefRNA.preprocess) {
+ /* we should never get here */
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return NULL;
+ }
- ds = rna_find_struct_def((StructRNA *)cont);
- if (ds)
- return &ds->cont;
+ ds = rna_find_struct_def((StructRNA *)cont);
+ if (ds)
+ return &ds->cont;
- dfunc = rna_find_function_def((FunctionRNA *)cont);
- if (dfunc)
- return &dfunc->cont;
+ dfunc = rna_find_function_def((FunctionRNA *)cont);
+ if (dfunc)
+ return &dfunc->cont;
- return NULL;
+ return NULL;
}
/* DNA utility function for looking up members */
typedef struct DNAStructMember {
- const char *type;
- const char *name;
- int arraylength;
- int pointerlevel;
+ const char *type;
+ const char *name;
+ int arraylength;
+ int pointerlevel;
} DNAStructMember;
static int rna_member_cmp(const char *name, const char *oname)
{
- int a = 0;
-
- /* compare without pointer or array part */
- while (name[0] == '*')
- name++;
- while (oname[0] == '*')
- oname++;
-
- while (1) {
- if (name[a] == '[' && oname[a] == 0) return 1;
- if (name[a] == '[' && oname[a] == '[') return 1;
- if (name[a] == 0) break;
- if (name[a] != oname[a]) return 0;
- a++;
- }
- if (name[a] == 0 && oname[a] == '.') return 2;
- if (name[a] == 0 && oname[a] == '-' && oname[a + 1] == '>') return 3;
-
- return (name[a] == oname[a]);
-}
-
-static int rna_find_sdna_member(SDNA *sdna, const char *structname, const char *membername, DNAStructMember *smember)
-{
- const char *dnaname;
- const short *sp;
- int a, b, structnr, totmember, cmp;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return 0;
- }
- structnr = DNA_struct_find_nr_wrapper(sdna, structname);
-
- if (structnr == -1)
- return 0;
-
- sp = sdna->structs[structnr];
- totmember = sp[1];
- sp += 2;
-
- for (a = 0; a < totmember; a++, sp += 2) {
- dnaname = sdna->alias.names[sp[1]];
- cmp = rna_member_cmp(dnaname, membername);
-
- if (cmp == 1) {
- smember->type = sdna->alias.types[sp[0]];
- smember->name = dnaname;
-
- if (strstr(membername, "["))
- smember->arraylength = 0;
- else
- smember->arraylength = DNA_elem_array_size(smember->name);
-
- smember->pointerlevel = 0;
- for (b = 0; dnaname[b] == '*'; b++)
- smember->pointerlevel++;
-
- return 1;
- }
- else if (cmp == 2) {
- smember->type = "";
- smember->name = dnaname;
- smember->pointerlevel = 0;
- smember->arraylength = 0;
-
- membername = strstr(membername, ".") + strlen(".");
- rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember);
-
- return 1;
- }
- else if (cmp == 3) {
- smember->type = "";
- smember->name = dnaname;
- smember->pointerlevel = 0;
- smember->arraylength = 0;
-
- membername = strstr(membername, "->") + strlen("->");
- rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember);
-
- return 1;
- }
- }
-
- return 0;
+ int a = 0;
+
+ /* compare without pointer or array part */
+ while (name[0] == '*')
+ name++;
+ while (oname[0] == '*')
+ oname++;
+
+ while (1) {
+ if (name[a] == '[' && oname[a] == 0)
+ return 1;
+ if (name[a] == '[' && oname[a] == '[')
+ return 1;
+ if (name[a] == 0)
+ break;
+ if (name[a] != oname[a])
+ return 0;
+ a++;
+ }
+ if (name[a] == 0 && oname[a] == '.')
+ return 2;
+ if (name[a] == 0 && oname[a] == '-' && oname[a + 1] == '>')
+ return 3;
+
+ return (name[a] == oname[a]);
+}
+
+static int rna_find_sdna_member(SDNA *sdna,
+ const char *structname,
+ const char *membername,
+ DNAStructMember *smember)
+{
+ const char *dnaname;
+ const short *sp;
+ int a, b, structnr, totmember, cmp;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return 0;
+ }
+ structnr = DNA_struct_find_nr_wrapper(sdna, structname);
+
+ if (structnr == -1)
+ return 0;
+
+ sp = sdna->structs[structnr];
+ totmember = sp[1];
+ sp += 2;
+
+ for (a = 0; a < totmember; a++, sp += 2) {
+ dnaname = sdna->alias.names[sp[1]];
+ cmp = rna_member_cmp(dnaname, membername);
+
+ if (cmp == 1) {
+ smember->type = sdna->alias.types[sp[0]];
+ smember->name = dnaname;
+
+ if (strstr(membername, "["))
+ smember->arraylength = 0;
+ else
+ smember->arraylength = DNA_elem_array_size(smember->name);
+
+ smember->pointerlevel = 0;
+ for (b = 0; dnaname[b] == '*'; b++)
+ smember->pointerlevel++;
+
+ return 1;
+ }
+ else if (cmp == 2) {
+ smember->type = "";
+ smember->name = dnaname;
+ smember->pointerlevel = 0;
+ smember->arraylength = 0;
+
+ membername = strstr(membername, ".") + strlen(".");
+ rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember);
+
+ return 1;
+ }
+ else if (cmp == 3) {
+ smember->type = "";
+ smember->name = dnaname;
+ smember->pointerlevel = 0;
+ smember->arraylength = 0;
+
+ membername = strstr(membername, "->") + strlen("->");
+ rna_find_sdna_member(sdna, sdna->alias.types[sp[0]], membername, smember);
+
+ return 1;
+ }
+ }
+
+ return 0;
}
static int rna_validate_identifier(const char *identifier, char *error, bool property)
{
- int a = 0;
-
- /* list is from...
- * ", ".join(['"%s"' % kw for kw in __import__("keyword").kwlist if kw not in {"False", "None", "True"}])
- */
- static const char *kwlist[] = {
- /* "False", "None", "True", */
- "and", "as", "assert", "async", "await", "break",
- "class", "continue", "def", "del", "elif", "else", "except",
- "finally", "for", "from", "global", "if", "import", "in",
- "is", "lambda", "nonlocal", "not", "or", "pass", "raise",
- "return", "try", "while", "with", "yield", NULL,
- };
-
-
- if (!isalpha(identifier[0])) {
- strcpy(error, "first character failed isalpha() check");
- return 0;
- }
-
- for (a = 0; identifier[a]; a++) {
- if (DefRNA.preprocess && property) {
- if (isalpha(identifier[a]) && isupper(identifier[a])) {
- strcpy(error, "property names must contain lower case characters only");
- return 0;
- }
- }
-
- if (identifier[a] == '_') {
- continue;
- }
-
- if (identifier[a] == ' ') {
- strcpy(error, "spaces are not okay in identifier names");
- return 0;
- }
-
- if (isalnum(identifier[a]) == 0) {
- strcpy(error, "one of the characters failed an isalnum() check and is not an underscore");
- return 0;
- }
- }
-
- for (a = 0; kwlist[a]; a++) {
- if (STREQ(identifier, kwlist[a])) {
- strcpy(error, "this keyword is reserved by python");
- return 0;
- }
- }
-
- if (property) {
- static const char *kwlist_prop[] = {
- /* not keywords but reserved all the same because py uses */
- "keys", "values", "items", "get",
- NULL,
- };
-
- for (a = 0; kwlist_prop[a]; a++) {
- if (STREQ(identifier, kwlist_prop[a])) {
- strcpy(error, "this keyword is reserved by python");
- return 0;
- }
- }
- }
-
- return 1;
+ int a = 0;
+
+ /* list is from...
+ * ", ".join(['"%s"' % kw for kw in __import__("keyword").kwlist if kw not in {"False", "None", "True"}])
+ */
+ static const char *kwlist[] = {
+ /* "False", "None", "True", */
+ "and", "as", "assert", "async", "await", "break", "class", "continue", "def",
+ "del", "elif", "else", "except", "finally", "for", "from", "global", "if",
+ "import", "in", "is", "lambda", "nonlocal", "not", "or", "pass", "raise",
+ "return", "try", "while", "with", "yield", NULL,
+ };
+
+ if (!isalpha(identifier[0])) {
+ strcpy(error, "first character failed isalpha() check");
+ return 0;
+ }
+
+ for (a = 0; identifier[a]; a++) {
+ if (DefRNA.preprocess && property) {
+ if (isalpha(identifier[a]) && isupper(identifier[a])) {
+ strcpy(error, "property names must contain lower case characters only");
+ return 0;
+ }
+ }
+
+ if (identifier[a] == '_') {
+ continue;
+ }
+
+ if (identifier[a] == ' ') {
+ strcpy(error, "spaces are not okay in identifier names");
+ return 0;
+ }
+
+ if (isalnum(identifier[a]) == 0) {
+ strcpy(error, "one of the characters failed an isalnum() check and is not an underscore");
+ return 0;
+ }
+ }
+
+ for (a = 0; kwlist[a]; a++) {
+ if (STREQ(identifier, kwlist[a])) {
+ strcpy(error, "this keyword is reserved by python");
+ return 0;
+ }
+ }
+
+ if (property) {
+ static const char *kwlist_prop[] = {
+ /* not keywords but reserved all the same because py uses */
+ "keys",
+ "values",
+ "items",
+ "get",
+ NULL,
+ };
+
+ for (a = 0; kwlist_prop[a]; a++) {
+ if (STREQ(identifier, kwlist_prop[a])) {
+ strcpy(error, "this keyword is reserved by python");
+ return 0;
+ }
+ }
+ }
+
+ return 1;
}
void RNA_identifier_sanitize(char *identifier, int property)
{
- int a = 0;
-
- /* list from http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */
- static const char *kwlist[] = {
- /* "False", "None", "True", */
- "and", "as", "assert", "break",
- "class", "continue", "def", "del", "elif", "else", "except",
- "finally", "for", "from", "global", "if", "import", "in",
- "is", "lambda", "nonlocal", "not", "or", "pass", "raise",
- "return", "try", "while", "with", "yield", NULL,
- };
-
-
- if (!isalpha(identifier[0])) {
- /* first character failed isalpha() check */
- identifier[0] = '_';
- }
-
- for (a = 0; identifier[a]; a++) {
- if (DefRNA.preprocess && property) {
- if (isalpha(identifier[a]) && isupper(identifier[a])) {
- /* property names must contain lower case characters only */
- identifier[a] = tolower(identifier[a]);
- }
- }
-
- if (identifier[a] == '_') {
- continue;
- }
-
- if (identifier[a] == ' ') {
- /* spaces are not okay in identifier names */
- identifier[a] = '_';
- }
-
- if (isalnum(identifier[a]) == 0) {
- /* one of the characters failed an isalnum() check and is not an underscore */
- identifier[a] = '_';
- }
- }
-
- for (a = 0; kwlist[a]; a++) {
- if (STREQ(identifier, kwlist[a])) {
- /* this keyword is reserved by python.
- * just replace the last character by '_' to keep it readable.
- */
- identifier[strlen(identifier) - 1] = '_';
- break;
- }
- }
-
- if (property) {
- static const char *kwlist_prop[] = {
- /* not keywords but reserved all the same because py uses */
- "keys", "values", "items", "get",
- NULL,
- };
-
- for (a = 0; kwlist_prop[a]; a++) {
- if (STREQ(identifier, kwlist_prop[a])) {
- /* this keyword is reserved by python.
- * just replace the last character by '_' to keep it readable.
- */
- identifier[strlen(identifier) - 1] = '_';
- break;
- }
- }
- }
+ int a = 0;
+
+ /* list from http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */
+ static const char *kwlist[] = {
+ /* "False", "None", "True", */
+ "and", "as", "assert", "break", "class", "continue", "def", "del",
+ "elif", "else", "except", "finally", "for", "from", "global", "if",
+ "import", "in", "is", "lambda", "nonlocal", "not", "or", "pass",
+ "raise", "return", "try", "while", "with", "yield", NULL,
+ };
+
+ if (!isalpha(identifier[0])) {
+ /* first character failed isalpha() check */
+ identifier[0] = '_';
+ }
+
+ for (a = 0; identifier[a]; a++) {
+ if (DefRNA.preprocess && property) {
+ if (isalpha(identifier[a]) && isupper(identifier[a])) {
+ /* property names must contain lower case characters only */
+ identifier[a] = tolower(identifier[a]);
+ }
+ }
+
+ if (identifier[a] == '_') {
+ continue;
+ }
+
+ if (identifier[a] == ' ') {
+ /* spaces are not okay in identifier names */
+ identifier[a] = '_';
+ }
+
+ if (isalnum(identifier[a]) == 0) {
+ /* one of the characters failed an isalnum() check and is not an underscore */
+ identifier[a] = '_';
+ }
+ }
+
+ for (a = 0; kwlist[a]; a++) {
+ if (STREQ(identifier, kwlist[a])) {
+ /* this keyword is reserved by python.
+ * just replace the last character by '_' to keep it readable.
+ */
+ identifier[strlen(identifier) - 1] = '_';
+ break;
+ }
+ }
+
+ if (property) {
+ static const char *kwlist_prop[] = {
+ /* not keywords but reserved all the same because py uses */
+ "keys",
+ "values",
+ "items",
+ "get",
+ NULL,
+ };
+
+ for (a = 0; kwlist_prop[a]; a++) {
+ if (STREQ(identifier, kwlist_prop[a])) {
+ /* this keyword is reserved by python.
+ * just replace the last character by '_' to keep it readable.
+ */
+ identifier[strlen(identifier) - 1] = '_';
+ break;
+ }
+ }
+ }
}
/* Blender Data Definition */
BlenderRNA *RNA_create(void)
{
- BlenderRNA *brna;
+ BlenderRNA *brna;
- brna = MEM_callocN(sizeof(BlenderRNA), "BlenderRNA");
- const char *error_message = NULL;
+ brna = MEM_callocN(sizeof(BlenderRNA), "BlenderRNA");
+ const char *error_message = NULL;
- BLI_listbase_clear(&DefRNA.structs);
- brna->structs_map = BLI_ghash_str_new_ex(__func__, 2048);
+ BLI_listbase_clear(&DefRNA.structs);
+ brna->structs_map = BLI_ghash_str_new_ex(__func__, 2048);
- DefRNA.error = 0;
- DefRNA.preprocess = 1;
+ DefRNA.error = 0;
+ DefRNA.preprocess = 1;
- DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, &error_message);
- if (DefRNA.sdna == NULL) {
- CLOG_ERROR(&LOG, "Failed to decode SDNA: %s.", error_message);
- DefRNA.error = 1;
- }
+ DefRNA.sdna = DNA_sdna_from_data(DNAstr, DNAlen, false, false, &error_message);
+ if (DefRNA.sdna == NULL) {
+ CLOG_ERROR(&LOG, "Failed to decode SDNA: %s.", error_message);
+ DefRNA.error = 1;
+ }
- /* We need both alias and static (on-disk) DNA names. */
- DNA_sdna_alias_data_ensure(DefRNA.sdna);
+ /* We need both alias and static (on-disk) DNA names. */
+ DNA_sdna_alias_data_ensure(DefRNA.sdna);
#ifndef RNA_RUNTIME
- DNA_alias_maps(
- DNA_RENAME_STATIC_FROM_ALIAS,
- &g_version_data.struct_map_static_from_alias,
- NULL);
+ DNA_alias_maps(DNA_RENAME_STATIC_FROM_ALIAS, &g_version_data.struct_map_static_from_alias, NULL);
#endif
- return brna;
+ return brna;
}
void RNA_define_free(BlenderRNA *UNUSED(brna))
{
- StructDefRNA *ds;
- FunctionDefRNA *dfunc;
- AllocDefRNA *alloc;
+ StructDefRNA *ds;
+ FunctionDefRNA *dfunc;
+ AllocDefRNA *alloc;
- for (alloc = DefRNA.allocs.first; alloc; alloc = alloc->next)
- MEM_freeN(alloc->mem);
- rna_freelistN(&DefRNA.allocs);
+ for (alloc = DefRNA.allocs.first; alloc; alloc = alloc->next)
+ MEM_freeN(alloc->mem);
+ rna_freelistN(&DefRNA.allocs);
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
- for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
- rna_freelistN(&dfunc->cont.properties);
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
+ for (dfunc = ds->functions.first; dfunc; dfunc = dfunc->cont.next)
+ rna_freelistN(&dfunc->cont.properties);
- rna_freelistN(&ds->cont.properties);
- rna_freelistN(&ds->functions);
- }
+ rna_freelistN(&ds->cont.properties);
+ rna_freelistN(&ds->functions);
+ }
- rna_freelistN(&DefRNA.structs);
+ rna_freelistN(&DefRNA.structs);
- if (DefRNA.sdna) {
- DNA_sdna_free(DefRNA.sdna);
- DefRNA.sdna = NULL;
- }
+ if (DefRNA.sdna) {
+ DNA_sdna_free(DefRNA.sdna);
+ DefRNA.sdna = NULL;
+ }
- DefRNA.error = 0;
+ DefRNA.error = 0;
}
void RNA_define_verify_sdna(bool verify)
{
- DefRNA.verify = verify;
+ DefRNA.verify = verify;
}
#ifndef RNA_RUNTIME
void RNA_define_animate_sdna(bool animate)
{
- DefRNA.animate = animate;
+ DefRNA.animate = animate;
}
#endif
void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *ext)
{
#ifdef RNA_RUNTIME
- ext->free(ext->data); /* decref's the PyObject that the srna owns */
- RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */
- RNA_struct_py_type_set(srna, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
+ ext->free(ext->data); /* decref's the PyObject that the srna owns */
+ RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */
+ RNA_struct_py_type_set(
+ srna, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
#else
- (void)srna;
- (void)ext;
+ (void)srna;
+ (void)ext;
#endif
}
void RNA_struct_free(BlenderRNA *brna, StructRNA *srna)
{
#ifdef RNA_RUNTIME
- FunctionRNA *func, *nextfunc;
- PropertyRNA *prop, *nextprop;
- PropertyRNA *parm, *nextparm;
+ FunctionRNA *func, *nextfunc;
+ PropertyRNA *prop, *nextprop;
+ PropertyRNA *parm, *nextparm;
-#if 0
- if (srna->flag & STRUCT_RUNTIME) {
- if (RNA_struct_py_type_get(srna)) {
- fprintf(stderr, "%s '%s' freed while holding a python reference.", srna->identifier);
- }
- }
-#endif
+# if 0
+ if (srna->flag & STRUCT_RUNTIME) {
+ if (RNA_struct_py_type_get(srna)) {
+ fprintf(stderr, "%s '%s' freed while holding a python reference.", srna->identifier);
+ }
+ }
+# endif
- for (prop = srna->cont.properties.first; prop; prop = nextprop) {
- nextprop = prop->next;
+ for (prop = srna->cont.properties.first; prop; prop = nextprop) {
+ nextprop = prop->next;
- RNA_def_property_free_pointers(prop);
+ RNA_def_property_free_pointers(prop);
- if (prop->flag_internal & PROP_INTERN_RUNTIME)
- rna_freelinkN(&srna->cont.properties, prop);
- }
+ if (prop->flag_internal & PROP_INTERN_RUNTIME)
+ rna_freelinkN(&srna->cont.properties, prop);
+ }
- for (func = srna->functions.first; func; func = nextfunc) {
- nextfunc = func->cont.next;
+ for (func = srna->functions.first; func; func = nextfunc) {
+ nextfunc = func->cont.next;
- for (parm = func->cont.properties.first; parm; parm = nextparm) {
- nextparm = parm->next;
+ for (parm = func->cont.properties.first; parm; parm = nextparm) {
+ nextparm = parm->next;
- RNA_def_property_free_pointers(parm);
+ RNA_def_property_free_pointers(parm);
- if (parm->flag_internal & PROP_INTERN_RUNTIME)
- rna_freelinkN(&func->cont.properties, parm);
- }
+ if (parm->flag_internal & PROP_INTERN_RUNTIME)
+ rna_freelinkN(&func->cont.properties, parm);
+ }
- RNA_def_func_free_pointers(func);
+ RNA_def_func_free_pointers(func);
- if (func->flag & FUNC_RUNTIME)
- rna_freelinkN(&srna->functions, func);
- }
+ if (func->flag & FUNC_RUNTIME)
+ rna_freelinkN(&srna->functions, func);
+ }
-
- rna_brna_structs_remove_and_free(brna, srna);
+ rna_brna_structs_remove_and_free(brna, srna);
#else
- UNUSED_VARS(brna, srna);
+ UNUSED_VARS(brna, srna);
#endif
}
void RNA_free(BlenderRNA *brna)
{
- StructRNA *srna, *nextsrna;
- FunctionRNA *func;
+ StructRNA *srna, *nextsrna;
+ FunctionRNA *func;
- BLI_ghash_free(brna->structs_map, NULL, NULL);
- brna->structs_map = NULL;
+ BLI_ghash_free(brna->structs_map, NULL, NULL);
+ brna->structs_map = NULL;
- if (DefRNA.preprocess) {
- RNA_define_free(brna);
+ if (DefRNA.preprocess) {
+ RNA_define_free(brna);
- for (srna = brna->structs.first; srna; srna = srna->cont.next) {
- for (func = srna->functions.first; func; func = func->cont.next)
- rna_freelistN(&func->cont.properties);
+ for (srna = brna->structs.first; srna; srna = srna->cont.next) {
+ for (func = srna->functions.first; func; func = func->cont.next)
+ rna_freelistN(&func->cont.properties);
- rna_freelistN(&srna->cont.properties);
- rna_freelistN(&srna->functions);
- }
+ rna_freelistN(&srna->cont.properties);
+ rna_freelistN(&srna->functions);
+ }
- rna_freelistN(&brna->structs);
+ rna_freelistN(&brna->structs);
- MEM_freeN(brna);
- }
- else {
- for (srna = brna->structs.first; srna; srna = nextsrna) {
- nextsrna = srna->cont.next;
- RNA_struct_free(brna, srna);
- }
- }
+ MEM_freeN(brna);
+ }
+ else {
+ for (srna = brna->structs.first; srna; srna = nextsrna) {
+ nextsrna = srna->cont.next;
+ RNA_struct_free(brna, srna);
+ }
+ }
#ifndef RNA_RUNTIME
- BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
- g_version_data.struct_map_static_from_alias = NULL;
+ BLI_ghash_free(g_version_data.struct_map_static_from_alias, NULL, NULL);
+ g_version_data.struct_map_static_from_alias = NULL;
#endif
-
}
static size_t rna_property_type_sizeof(PropertyType type)
{
- switch (type) {
- case PROP_BOOLEAN: return sizeof(BoolPropertyRNA);
- case PROP_INT: return sizeof(IntPropertyRNA);
- case PROP_FLOAT: return sizeof(FloatPropertyRNA);
- case PROP_STRING: return sizeof(StringPropertyRNA);
- case PROP_ENUM: return sizeof(EnumPropertyRNA);
- case PROP_POINTER: return sizeof(PointerPropertyRNA);
- case PROP_COLLECTION: return sizeof(CollectionPropertyRNA);
- default: return 0;
- }
+ switch (type) {
+ case PROP_BOOLEAN:
+ return sizeof(BoolPropertyRNA);
+ case PROP_INT:
+ return sizeof(IntPropertyRNA);
+ case PROP_FLOAT:
+ return sizeof(FloatPropertyRNA);
+ case PROP_STRING:
+ return sizeof(StringPropertyRNA);
+ case PROP_ENUM:
+ return sizeof(EnumPropertyRNA);
+ case PROP_POINTER:
+ return sizeof(PointerPropertyRNA);
+ case PROP_COLLECTION:
+ return sizeof(CollectionPropertyRNA);
+ default:
+ return 0;
+ }
}
static StructDefRNA *rna_find_def_struct(StructRNA *srna)
{
- StructDefRNA *ds;
+ StructDefRNA *ds;
- for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
- if (ds->srna == srna)
- return ds;
+ for (ds = DefRNA.structs.first; ds; ds = ds->cont.next)
+ if (ds->srna == srna)
+ return ds;
- return NULL;
+ return NULL;
}
/* Struct Definition */
StructRNA *RNA_def_struct_ptr(BlenderRNA *brna, const char *identifier, StructRNA *srnafrom)
{
- StructRNA *srna;
- StructDefRNA *ds = NULL, *dsfrom = NULL;
- PropertyRNA *prop;
-
- if (DefRNA.preprocess) {
- char error[512];
-
- if (rna_validate_identifier(identifier, error, false) == 0) {
- CLOG_ERROR(&LOG, "struct identifier \"%s\" error - %s", identifier, error);
- DefRNA.error = 1;
- }
- }
-
- srna = MEM_callocN(sizeof(StructRNA), "StructRNA");
- DefRNA.laststruct = srna;
-
- if (srnafrom) {
- /* copy from struct to derive stuff, a bit clumsy since we can't
- * use MEM_dupallocN, data structs may not be alloced but builtin */
- memcpy(srna, srnafrom, sizeof(StructRNA));
- srna->cont.prophash = NULL;
- BLI_listbase_clear(&srna->cont.properties);
- BLI_listbase_clear(&srna->functions);
- srna->py_type = NULL;
-
- srna->base = srnafrom;
-
- if (DefRNA.preprocess) {
- dsfrom = rna_find_def_struct(srnafrom);
- }
- else {
- if (srnafrom->flag & STRUCT_PUBLIC_NAMESPACE_INHERIT) {
- srna->flag |= STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT;
- }
- else {
- srna->flag &= ~(STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT);
- }
- }
- }
-
- srna->identifier = identifier;
- srna->name = identifier; /* may be overwritten later RNA_def_struct_ui_text */
- srna->description = "";
- /* may be overwritten later RNA_def_struct_translation_context */
- srna->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA;
- srna->flag |= STRUCT_UNDO;
- if (!srnafrom)
- srna->icon = ICON_DOT;
-
- if (DefRNA.preprocess) {
- srna->flag |= STRUCT_PUBLIC_NAMESPACE;
- }
-
- rna_brna_structs_add(brna, srna);
-
- if (DefRNA.preprocess) {
- ds = MEM_callocN(sizeof(StructDefRNA), "StructDefRNA");
- ds->srna = srna;
- rna_addtail(&DefRNA.structs, ds);
-
- if (dsfrom)
- ds->dnafromname = dsfrom->dnaname;
- }
-
- /* in preprocess, try to find sdna */
- if (DefRNA.preprocess)
- RNA_def_struct_sdna(srna, srna->identifier);
- else
- srna->flag |= STRUCT_RUNTIME;
-
- if (srnafrom) {
- srna->nameproperty = srnafrom->nameproperty;
- srna->iteratorproperty = srnafrom->iteratorproperty;
- }
- else {
- /* define some builtin properties */
- prop = RNA_def_property(&srna->cont, "rna_properties", PROP_COLLECTION, PROP_NONE);
- prop->flag_internal |= PROP_INTERN_BUILTIN;
- RNA_def_property_ui_text(prop, "Properties", "RNA property collection");
-
- if (DefRNA.preprocess) {
- RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_builtin_properties_begin", "rna_builtin_properties_next",
- "rna_iterator_listbase_end", "rna_builtin_properties_get", NULL, NULL,
- "rna_builtin_properties_lookup_string", NULL);
- }
- else {
+ StructRNA *srna;
+ StructDefRNA *ds = NULL, *dsfrom = NULL;
+ PropertyRNA *prop;
+
+ if (DefRNA.preprocess) {
+ char error[512];
+
+ if (rna_validate_identifier(identifier, error, false) == 0) {
+ CLOG_ERROR(&LOG, "struct identifier \"%s\" error - %s", identifier, error);
+ DefRNA.error = 1;
+ }
+ }
+
+ srna = MEM_callocN(sizeof(StructRNA), "StructRNA");
+ DefRNA.laststruct = srna;
+
+ if (srnafrom) {
+ /* copy from struct to derive stuff, a bit clumsy since we can't
+ * use MEM_dupallocN, data structs may not be alloced but builtin */
+ memcpy(srna, srnafrom, sizeof(StructRNA));
+ srna->cont.prophash = NULL;
+ BLI_listbase_clear(&srna->cont.properties);
+ BLI_listbase_clear(&srna->functions);
+ srna->py_type = NULL;
+
+ srna->base = srnafrom;
+
+ if (DefRNA.preprocess) {
+ dsfrom = rna_find_def_struct(srnafrom);
+ }
+ else {
+ if (srnafrom->flag & STRUCT_PUBLIC_NAMESPACE_INHERIT) {
+ srna->flag |= STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT;
+ }
+ else {
+ srna->flag &= ~(STRUCT_PUBLIC_NAMESPACE | STRUCT_PUBLIC_NAMESPACE_INHERIT);
+ }
+ }
+ }
+
+ srna->identifier = identifier;
+ srna->name = identifier; /* may be overwritten later RNA_def_struct_ui_text */
+ srna->description = "";
+ /* may be overwritten later RNA_def_struct_translation_context */
+ srna->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA;
+ srna->flag |= STRUCT_UNDO;
+ if (!srnafrom)
+ srna->icon = ICON_DOT;
+
+ if (DefRNA.preprocess) {
+ srna->flag |= STRUCT_PUBLIC_NAMESPACE;
+ }
+
+ rna_brna_structs_add(brna, srna);
+
+ if (DefRNA.preprocess) {
+ ds = MEM_callocN(sizeof(StructDefRNA), "StructDefRNA");
+ ds->srna = srna;
+ rna_addtail(&DefRNA.structs, ds);
+
+ if (dsfrom)
+ ds->dnafromname = dsfrom->dnaname;
+ }
+
+ /* in preprocess, try to find sdna */
+ if (DefRNA.preprocess)
+ RNA_def_struct_sdna(srna, srna->identifier);
+ else
+ srna->flag |= STRUCT_RUNTIME;
+
+ if (srnafrom) {
+ srna->nameproperty = srnafrom->nameproperty;
+ srna->iteratorproperty = srnafrom->iteratorproperty;
+ }
+ else {
+ /* define some builtin properties */
+ prop = RNA_def_property(&srna->cont, "rna_properties", PROP_COLLECTION, PROP_NONE);
+ prop->flag_internal |= PROP_INTERN_BUILTIN;
+ RNA_def_property_ui_text(prop, "Properties", "RNA property collection");
+
+ if (DefRNA.preprocess) {
+ RNA_def_property_struct_type(prop, "Property");
+ RNA_def_property_collection_funcs(prop,
+ "rna_builtin_properties_begin",
+ "rna_builtin_properties_next",
+ "rna_iterator_listbase_end",
+ "rna_builtin_properties_get",
+ NULL,
+ NULL,
+ "rna_builtin_properties_lookup_string",
+ NULL);
+ }
+ else {
#ifdef RNA_RUNTIME
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- cprop->begin = rna_builtin_properties_begin;
- cprop->next = rna_builtin_properties_next;
- cprop->get = rna_builtin_properties_get;
- cprop->item_type = &RNA_Property;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ cprop->begin = rna_builtin_properties_begin;
+ cprop->next = rna_builtin_properties_next;
+ cprop->get = rna_builtin_properties_get;
+ cprop->item_type = &RNA_Property;
#endif
- }
+ }
- prop = RNA_def_property(&srna->cont, "rna_type", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_property_ui_text(prop, "RNA", "RNA type definition");
+ prop = RNA_def_property(&srna->cont, "rna_type", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_property_ui_text(prop, "RNA", "RNA type definition");
- if (DefRNA.preprocess) {
- RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL, NULL);
- }
- else {
+ if (DefRNA.preprocess) {
+ RNA_def_property_struct_type(prop, "Struct");
+ RNA_def_property_pointer_funcs(prop, "rna_builtin_type_get", NULL, NULL, NULL);
+ }
+ else {
#ifdef RNA_RUNTIME
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- pprop->get = rna_builtin_type_get;
- pprop->type = &RNA_Struct;
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ pprop->get = rna_builtin_type_get;
+ pprop->type = &RNA_Struct;
#endif
- }
- }
+ }
+ }
- return srna;
+ return srna;
}
StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char *from)
{
- StructRNA *srnafrom = NULL;
+ StructRNA *srnafrom = NULL;
- /* only use RNA_def_struct() while pre-processing, otherwise use RNA_def_struct_ptr() */
- BLI_assert(DefRNA.preprocess);
+ /* only use RNA_def_struct() while pre-processing, otherwise use RNA_def_struct_ptr() */
+ BLI_assert(DefRNA.preprocess);
- if (from) {
- /* find struct to derive from */
- /* Inline RNA_struct_find(...) because it wont link from here. */
- srnafrom = BLI_ghash_lookup(brna->structs_map, from);
- if (!srnafrom) {
- CLOG_ERROR(&LOG, "struct %s not found to define %s.", from, identifier);
- DefRNA.error = 1;
- }
- }
+ if (from) {
+ /* find struct to derive from */
+ /* Inline RNA_struct_find(...) because it wont link from here. */
+ srnafrom = BLI_ghash_lookup(brna->structs_map, from);
+ if (!srnafrom) {
+ CLOG_ERROR(&LOG, "struct %s not found to define %s.", from, identifier);
+ DefRNA.error = 1;
+ }
+ }
- return RNA_def_struct_ptr(brna, identifier, srnafrom);
+ return RNA_def_struct_ptr(brna, identifier, srnafrom);
}
void RNA_def_struct_sdna(StructRNA *srna, const char *structname)
{
- StructDefRNA *ds;
+ StructDefRNA *ds;
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- ds = rna_find_def_struct(srna);
+ ds = rna_find_def_struct(srna);
- /* there are far too many structs which initialize without valid DNA struct names,
- * this can't be checked without adding an option to disable (tested this and it means changes all over - Campbell) */
+ /* there are far too many structs which initialize without valid DNA struct names,
+ * this can't be checked without adding an option to disable (tested this and it means changes all over - Campbell) */
#if 0
- if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
- if (!DefRNA.silent) {
- CLOG_ERROR(&LOG, "%s not found.", structname);
- DefRNA.error = 1;
- }
- return;
- }
+ if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
+ if (!DefRNA.silent) {
+ CLOG_ERROR(&LOG, "%s not found.", structname);
+ DefRNA.error = 1;
+ }
+ return;
+ }
#endif
- ds->dnaname = structname;
+ ds->dnaname = structname;
}
void RNA_def_struct_sdna_from(StructRNA *srna, const char *structname, const char *propname)
{
- StructDefRNA *ds;
+ StructDefRNA *ds;
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- ds = rna_find_def_struct(srna);
+ ds = rna_find_def_struct(srna);
- if (!ds->dnaname) {
- CLOG_ERROR(&LOG, "%s base struct must know DNA already.", structname);
- return;
- }
+ if (!ds->dnaname) {
+ CLOG_ERROR(&LOG, "%s base struct must know DNA already.", structname);
+ return;
+ }
- if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
- if (!DefRNA.silent) {
- CLOG_ERROR(&LOG, "%s not found.", structname);
- DefRNA.error = 1;
- }
- return;
- }
+ if (DNA_struct_find_nr_wrapper(DefRNA.sdna, structname) == -1) {
+ if (!DefRNA.silent) {
+ CLOG_ERROR(&LOG, "%s not found.", structname);
+ DefRNA.error = 1;
+ }
+ return;
+ }
- ds->dnafromprop = propname;
- ds->dnaname = structname;
+ ds->dnafromprop = propname;
+ ds->dnaname = structname;
}
void RNA_def_struct_name_property(struct StructRNA *srna, struct PropertyRNA *prop)
{
- if (prop->type != PROP_STRING) {
- CLOG_ERROR(&LOG, "\"%s.%s\", must be a string property.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- else
- srna->nameproperty = prop;
+ if (prop->type != PROP_STRING) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", must be a string property.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+ else
+ srna->nameproperty = prop;
}
void RNA_def_struct_nested(BlenderRNA *brna, StructRNA *srna, const char *structname)
{
- StructRNA *srnafrom;
+ StructRNA *srnafrom;
- /* find struct to derive from */
- srnafrom = BLI_ghash_lookup(brna->structs_map, structname);
- if (!srnafrom) {
- CLOG_ERROR(&LOG, "struct %s not found for %s.", structname, srna->identifier);
- DefRNA.error = 1;
- }
+ /* find struct to derive from */
+ srnafrom = BLI_ghash_lookup(brna->structs_map, structname);
+ if (!srnafrom) {
+ CLOG_ERROR(&LOG, "struct %s not found for %s.", structname, srna->identifier);
+ DefRNA.error = 1;
+ }
- srna->nested = srnafrom;
+ srna->nested = srnafrom;
}
void RNA_def_struct_flag(StructRNA *srna, int flag)
{
- srna->flag |= flag;
+ srna->flag |= flag;
}
void RNA_def_struct_clear_flag(StructRNA *srna, int flag)
{
- srna->flag &= ~flag;
+ srna->flag &= ~flag;
}
void RNA_def_struct_property_tags(StructRNA *srna, const EnumPropertyItem *prop_tag_defines)
{
- srna->prop_tag_defines = prop_tag_defines;
+ srna->prop_tag_defines = prop_tag_defines;
}
void RNA_def_struct_refine_func(StructRNA *srna, const char *refine)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (refine) srna->refine = (StructRefineFunc)refine;
+ if (refine)
+ srna->refine = (StructRefineFunc)refine;
}
void RNA_def_struct_idprops_func(StructRNA *srna, const char *idproperties)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (idproperties) srna->idproperties = (IDPropertiesFunc)idproperties;
+ if (idproperties)
+ srna->idproperties = (IDPropertiesFunc)idproperties;
}
-void RNA_def_struct_register_funcs(StructRNA *srna, const char *reg, const char *unreg, const char *instance)
+void RNA_def_struct_register_funcs(StructRNA *srna,
+ const char *reg,
+ const char *unreg,
+ const char *instance)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (reg) srna->reg = (StructRegisterFunc)reg;
- if (unreg) srna->unreg = (StructUnregisterFunc)unreg;
- if (instance) srna->instance = (StructInstanceFunc)instance;
+ if (reg)
+ srna->reg = (StructRegisterFunc)reg;
+ if (unreg)
+ srna->unreg = (StructUnregisterFunc)unreg;
+ if (instance)
+ srna->instance = (StructInstanceFunc)instance;
}
void RNA_def_struct_path_func(StructRNA *srna, const char *path)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (path) srna->path = (StructPathFunc)path;
+ if (path)
+ srna->path = (StructPathFunc)path;
}
void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *identifier)
{
- if (DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only at runtime.");
- return;
- }
+ if (DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only at runtime.");
+ return;
+ }
- /* Operator registration may set twice, see: operator_properties_init */
- if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
- if (identifier != srna->identifier) {
- if (srna->identifier[0] != '\0') {
- BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
- }
- if (identifier[0] != '\0') {
- BLI_ghash_insert(brna->structs_map, (void *)identifier, srna);
- }
- }
- }
+ /* Operator registration may set twice, see: operator_properties_init */
+ if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
+ if (identifier != srna->identifier) {
+ if (srna->identifier[0] != '\0') {
+ BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
+ }
+ if (identifier[0] != '\0') {
+ BLI_ghash_insert(brna->structs_map, (void *)identifier, srna);
+ }
+ }
+ }
- srna->identifier = identifier;
+ srna->identifier = identifier;
}
/**
@@ -1077,268 +1114,272 @@ void RNA_def_struct_identifier(BlenderRNA *brna, StructRNA *srna, const char *id
*/
void RNA_def_struct_identifier_no_struct_map(StructRNA *srna, const char *identifier)
{
- if (DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only at runtime.");
- return;
- }
+ if (DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only at runtime.");
+ return;
+ }
- srna->identifier = identifier;
+ srna->identifier = identifier;
}
void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description)
{
- DESCR_CHECK(description, srna->identifier, NULL);
+ DESCR_CHECK(description, srna->identifier, NULL);
- srna->name = name;
- srna->description = description;
+ srna->name = name;
+ srna->description = description;
}
void RNA_def_struct_ui_icon(StructRNA *srna, int icon)
{
- srna->icon = icon;
+ srna->icon = icon;
}
void RNA_def_struct_translation_context(StructRNA *srna, const char *context)
{
- srna->translation_context = context ? context : BLT_I18NCONTEXT_DEFAULT_BPYRNA;
+ srna->translation_context = context ? context : BLT_I18NCONTEXT_DEFAULT_BPYRNA;
}
/* Property Definition */
-PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, const char *identifier, int type, int subtype)
-{
- /*StructRNA *srna = DefRNA.laststruct;*/ /* invalid for python defined props */
- ContainerRNA *cont = cont_;
- ContainerDefRNA *dcont;
- PropertyDefRNA *dprop = NULL;
- PropertyRNA *prop;
-
- if (DefRNA.preprocess) {
- char error[512];
-
- if (rna_validate_identifier(identifier, error, true) == 0) {
- CLOG_ERROR(&LOG, "property identifier \"%s.%s\" - %s",
- CONTAINER_RNA_ID(cont), identifier, error);
- DefRNA.error = 1;
- }
-
- dcont = rna_find_container_def(cont);
-
- /* XXX - toto, detect supertype collisions */
- if (rna_findlink(&dcont->properties, identifier)) {
- CLOG_ERROR(&LOG, "duplicate identifier \"%s.%s\"", CONTAINER_RNA_ID(cont), identifier);
- DefRNA.error = 1;
- }
-
- dprop = MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA");
- rna_addtail(&dcont->properties, dprop);
- }
- else {
+PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int type,
+ int subtype)
+{
+ /*StructRNA *srna = DefRNA.laststruct;*/ /* invalid for python defined props */
+ ContainerRNA *cont = cont_;
+ ContainerDefRNA *dcont;
+ PropertyDefRNA *dprop = NULL;
+ PropertyRNA *prop;
+
+ if (DefRNA.preprocess) {
+ char error[512];
+
+ if (rna_validate_identifier(identifier, error, true) == 0) {
+ CLOG_ERROR(
+ &LOG, "property identifier \"%s.%s\" - %s", CONTAINER_RNA_ID(cont), identifier, error);
+ DefRNA.error = 1;
+ }
+
+ dcont = rna_find_container_def(cont);
+
+ /* XXX - toto, detect supertype collisions */
+ if (rna_findlink(&dcont->properties, identifier)) {
+ CLOG_ERROR(&LOG, "duplicate identifier \"%s.%s\"", CONTAINER_RNA_ID(cont), identifier);
+ DefRNA.error = 1;
+ }
+
+ dprop = MEM_callocN(sizeof(PropertyDefRNA), "PropertyDefRNA");
+ rna_addtail(&dcont->properties, dprop);
+ }
+ else {
#ifdef DEBUG
- char error[512];
- if (rna_validate_identifier(identifier, error, true) == 0) {
- CLOG_ERROR(&LOG, "runtime property identifier \"%s.%s\" - %s",
- CONTAINER_RNA_ID(cont), identifier, error);
- DefRNA.error = 1;
- }
+ char error[512];
+ if (rna_validate_identifier(identifier, error, true) == 0) {
+ CLOG_ERROR(&LOG,
+ "runtime property identifier \"%s.%s\" - %s",
+ CONTAINER_RNA_ID(cont),
+ identifier,
+ error);
+ DefRNA.error = 1;
+ }
#endif
- }
-
- prop = MEM_callocN(rna_property_type_sizeof(type), "PropertyRNA");
-
- switch (type) {
- case PROP_BOOLEAN:
- if (DefRNA.preprocess) {
- if ((subtype & ~(PROP_LAYER_MEMBER)) != PROP_NONE) {
- CLOG_ERROR(&LOG, "subtype does not apply to 'PROP_BOOLEAN' \"%s.%s\"",
- CONTAINER_RNA_ID(cont), identifier);
- DefRNA.error = 1;
- }
- }
- break;
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ }
+
+ prop = MEM_callocN(rna_property_type_sizeof(type), "PropertyRNA");
+
+ switch (type) {
+ case PROP_BOOLEAN:
+ if (DefRNA.preprocess) {
+ if ((subtype & ~(PROP_LAYER_MEMBER)) != PROP_NONE) {
+ CLOG_ERROR(&LOG,
+ "subtype does not apply to 'PROP_BOOLEAN' \"%s.%s\"",
+ CONTAINER_RNA_ID(cont),
+ identifier);
+ DefRNA.error = 1;
+ }
+ }
+ break;
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
#ifndef RNA_RUNTIME
- if (subtype == PROP_DISTANCE) {
- CLOG_ERROR(&LOG, "subtype does not apply to 'PROP_INT' \"%s.%s\"",
- CONTAINER_RNA_ID(cont), identifier);
- DefRNA.error = 1;
- }
+ if (subtype == PROP_DISTANCE) {
+ CLOG_ERROR(&LOG,
+ "subtype does not apply to 'PROP_INT' \"%s.%s\"",
+ CONTAINER_RNA_ID(cont),
+ identifier);
+ DefRNA.error = 1;
+ }
#endif
- iprop->hardmin = (subtype == PROP_UNSIGNED) ? 0 : INT_MIN;
- iprop->hardmax = INT_MAX;
-
- iprop->softmin = (subtype == PROP_UNSIGNED) ? 0 : -10000; /* rather arbitrary .. */
- iprop->softmax = 10000;
- iprop->step = 1;
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- fprop->hardmin = (subtype == PROP_UNSIGNED) ? 0.0f : -FLT_MAX;
- fprop->hardmax = FLT_MAX;
-
- if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
- fprop->softmin = fprop->hardmin = 0.0f;
- fprop->softmax = 1.0f;
- }
- else if (subtype == PROP_FACTOR) {
- fprop->softmin = fprop->hardmin = 0.0f;
- fprop->softmax = fprop->hardmax = 1.0f;
- }
- else {
- fprop->softmin = (subtype == PROP_UNSIGNED) ? 0.0f : -10000.0f; /* rather arbitrary .. */
- fprop->softmax = 10000.0f;
- }
- fprop->step = 10;
- fprop->precision = 3;
- break;
- }
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- /* By default don't allow NULL string args, callers may clear. */
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- sprop->defaultvalue = "";
- break;
- }
- case PROP_POINTER:
- prop->flag |= PROP_THICK_WRAP; /* needed for default behavior when PARM_RNAPTR is set */
- break;
- case PROP_ENUM:
- case PROP_COLLECTION:
- break;
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", invalid property type.", CONTAINER_RNA_ID(cont), identifier);
- DefRNA.error = 1;
- return NULL;
- }
-
- if (DefRNA.preprocess) {
- dprop->cont = cont;
- dprop->prop = prop;
- }
-
- prop->magic = RNA_MAGIC;
- prop->identifier = identifier;
- prop->type = type;
- prop->subtype = subtype;
- prop->name = identifier;
- prop->description = "";
- prop->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA;
- /* a priori not raw editable */
- prop->rawtype = -1;
-
- if (type != PROP_COLLECTION && type != PROP_POINTER) {
- prop->flag = PROP_EDITABLE;
-
- if (type != PROP_STRING) {
+ iprop->hardmin = (subtype == PROP_UNSIGNED) ? 0 : INT_MIN;
+ iprop->hardmax = INT_MAX;
+
+ iprop->softmin = (subtype == PROP_UNSIGNED) ? 0 : -10000; /* rather arbitrary .. */
+ iprop->softmax = 10000;
+ iprop->step = 1;
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ fprop->hardmin = (subtype == PROP_UNSIGNED) ? 0.0f : -FLT_MAX;
+ fprop->hardmax = FLT_MAX;
+
+ if (ELEM(subtype, PROP_COLOR, PROP_COLOR_GAMMA)) {
+ fprop->softmin = fprop->hardmin = 0.0f;
+ fprop->softmax = 1.0f;
+ }
+ else if (subtype == PROP_FACTOR) {
+ fprop->softmin = fprop->hardmin = 0.0f;
+ fprop->softmax = fprop->hardmax = 1.0f;
+ }
+ else {
+ fprop->softmin = (subtype == PROP_UNSIGNED) ? 0.0f : -10000.0f; /* rather arbitrary .. */
+ fprop->softmax = 10000.0f;
+ }
+ fprop->step = 10;
+ fprop->precision = 3;
+ break;
+ }
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ /* By default don't allow NULL string args, callers may clear. */
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ sprop->defaultvalue = "";
+ break;
+ }
+ case PROP_POINTER:
+ prop->flag |= PROP_THICK_WRAP; /* needed for default behavior when PARM_RNAPTR is set */
+ break;
+ case PROP_ENUM:
+ case PROP_COLLECTION:
+ break;
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid property type.", CONTAINER_RNA_ID(cont), identifier);
+ DefRNA.error = 1;
+ return NULL;
+ }
+
+ if (DefRNA.preprocess) {
+ dprop->cont = cont;
+ dprop->prop = prop;
+ }
+
+ prop->magic = RNA_MAGIC;
+ prop->identifier = identifier;
+ prop->type = type;
+ prop->subtype = subtype;
+ prop->name = identifier;
+ prop->description = "";
+ prop->translation_context = BLT_I18NCONTEXT_DEFAULT_BPYRNA;
+ /* a priori not raw editable */
+ prop->rawtype = -1;
+
+ if (type != PROP_COLLECTION && type != PROP_POINTER) {
+ prop->flag = PROP_EDITABLE;
+
+ if (type != PROP_STRING) {
#ifdef RNA_RUNTIME
- prop->flag |= PROP_ANIMATABLE;
+ prop->flag |= PROP_ANIMATABLE;
#else
- if (DefRNA.animate) {
- prop->flag |= PROP_ANIMATABLE;
- }
+ if (DefRNA.animate) {
+ prop->flag |= PROP_ANIMATABLE;
+ }
#endif
- }
- }
-
- if (type == PROP_STRING) {
- /* used so generated 'get/length/set' functions skip a NULL check
- * in some cases we want it */
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- }
-
- if (DefRNA.preprocess) {
- switch (type) {
- case PROP_BOOLEAN:
- DefRNA.silent = 1;
- RNA_def_property_boolean_sdna(prop, NULL, identifier, 0);
- DefRNA.silent = 0;
- break;
- case PROP_INT:
- {
- DefRNA.silent = 1;
- RNA_def_property_int_sdna(prop, NULL, identifier);
- DefRNA.silent = 0;
- break;
- }
- case PROP_FLOAT:
- {
- DefRNA.silent = 1;
- RNA_def_property_float_sdna(prop, NULL, identifier);
- DefRNA.silent = 0;
- break;
- }
- case PROP_STRING:
- {
- DefRNA.silent = 1;
- RNA_def_property_string_sdna(prop, NULL, identifier);
- DefRNA.silent = 0;
- break;
- }
- case PROP_ENUM:
- DefRNA.silent = 1;
- RNA_def_property_enum_sdna(prop, NULL, identifier);
- DefRNA.silent = 0;
- break;
- case PROP_POINTER:
- DefRNA.silent = 1;
- RNA_def_property_pointer_sdna(prop, NULL, identifier);
- DefRNA.silent = 0;
- break;
- case PROP_COLLECTION:
- DefRNA.silent = 1;
- RNA_def_property_collection_sdna(prop, NULL, identifier, NULL);
- DefRNA.silent = 0;
- break;
- }
- }
- else {
- prop->flag |= PROP_IDPROPERTY;
- prop->flag_internal |= PROP_INTERN_RUNTIME;
+ }
+ }
+
+ if (type == PROP_STRING) {
+ /* used so generated 'get/length/set' functions skip a NULL check
+ * in some cases we want it */
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ }
+
+ if (DefRNA.preprocess) {
+ switch (type) {
+ case PROP_BOOLEAN:
+ DefRNA.silent = 1;
+ RNA_def_property_boolean_sdna(prop, NULL, identifier, 0);
+ DefRNA.silent = 0;
+ break;
+ case PROP_INT: {
+ DefRNA.silent = 1;
+ RNA_def_property_int_sdna(prop, NULL, identifier);
+ DefRNA.silent = 0;
+ break;
+ }
+ case PROP_FLOAT: {
+ DefRNA.silent = 1;
+ RNA_def_property_float_sdna(prop, NULL, identifier);
+ DefRNA.silent = 0;
+ break;
+ }
+ case PROP_STRING: {
+ DefRNA.silent = 1;
+ RNA_def_property_string_sdna(prop, NULL, identifier);
+ DefRNA.silent = 0;
+ break;
+ }
+ case PROP_ENUM:
+ DefRNA.silent = 1;
+ RNA_def_property_enum_sdna(prop, NULL, identifier);
+ DefRNA.silent = 0;
+ break;
+ case PROP_POINTER:
+ DefRNA.silent = 1;
+ RNA_def_property_pointer_sdna(prop, NULL, identifier);
+ DefRNA.silent = 0;
+ break;
+ case PROP_COLLECTION:
+ DefRNA.silent = 1;
+ RNA_def_property_collection_sdna(prop, NULL, identifier, NULL);
+ DefRNA.silent = 0;
+ break;
+ }
+ }
+ else {
+ prop->flag |= PROP_IDPROPERTY;
+ prop->flag_internal |= PROP_INTERN_RUNTIME;
#ifdef RNA_RUNTIME
- if (cont->prophash)
- BLI_ghash_insert(cont->prophash, (void *)prop->identifier, prop);
+ if (cont->prophash)
+ BLI_ghash_insert(cont->prophash, (void *)prop->identifier, prop);
#endif
- }
+ }
- /* Override handling. */
- if (DefRNA.preprocess) {
- prop->override_diff = (RNAPropOverrideDiff)"rna_property_override_diff_default";
- prop->override_store = (RNAPropOverrideStore)"rna_property_override_store_default";
- prop->override_apply = (RNAPropOverrideApply)"rna_property_override_apply_default";
- }
- /* TODO: do we want that for runtime-defined stuff too? I’d say no, but... maybe yes :/ */
+ /* Override handling. */
+ if (DefRNA.preprocess) {
+ prop->override_diff = (RNAPropOverrideDiff) "rna_property_override_diff_default";
+ prop->override_store = (RNAPropOverrideStore) "rna_property_override_store_default";
+ prop->override_apply = (RNAPropOverrideApply) "rna_property_override_apply_default";
+ }
+ /* TODO: do we want that for runtime-defined stuff too? I’d say no, but... maybe yes :/ */
- rna_addtail(&cont->properties, prop);
+ rna_addtail(&cont->properties, prop);
- return prop;
+ return prop;
}
void RNA_def_property_flag(PropertyRNA *prop, PropertyFlag flag)
{
- prop->flag |= flag;
+ prop->flag |= flag;
}
void RNA_def_property_clear_flag(PropertyRNA *prop, PropertyFlag flag)
{
- prop->flag &= ~flag;
+ prop->flag &= ~flag;
}
void RNA_def_property_override_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
{
- prop->flag_override |= flag;
+ prop->flag_override |= flag;
}
void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFlag flag)
{
- prop->flag_override &= ~flag;
+ prop->flag_override &= ~flag;
}
/**
@@ -1350,65 +1391,79 @@ void RNA_def_property_override_clear_flag(PropertyRNA *prop, PropertyOverrideFla
*/
void RNA_def_property_tags(PropertyRNA *prop, int tags)
{
- prop->tags |= tags;
+ prop->tags |= tags;
}
-void RNA_def_parameter_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
+void RNA_def_parameter_flags(PropertyRNA *prop,
+ PropertyFlag flag_property,
+ ParameterFlag flag_parameter)
{
- prop->flag |= flag_property;
- prop->flag_parameter |= flag_parameter;
+ prop->flag |= flag_property;
+ prop->flag_parameter |= flag_parameter;
}
-void RNA_def_parameter_clear_flags(PropertyRNA *prop, PropertyFlag flag_property, ParameterFlag flag_parameter)
+void RNA_def_parameter_clear_flags(PropertyRNA *prop,
+ PropertyFlag flag_property,
+ ParameterFlag flag_parameter)
{
- prop->flag &= ~flag_property;
- prop->flag_parameter &= ~flag_parameter;
+ prop->flag &= ~flag_property;
+ prop->flag_parameter &= ~flag_parameter;
}
void RNA_def_property_subtype(PropertyRNA *prop, PropertySubType subtype)
{
- prop->subtype = subtype;
+ prop->subtype = subtype;
}
void RNA_def_property_array(PropertyRNA *prop, int length)
{
- StructRNA *srna = DefRNA.laststruct;
-
- if (length < 0) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array length must be zero of greater.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
-
- if (length > RNA_MAX_ARRAY_LENGTH) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array length must be smaller than %d.",
- srna->identifier, prop->identifier, RNA_MAX_ARRAY_LENGTH);
- DefRNA.error = 1;
- return;
- }
-
- if (prop->arraydimension > 1) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.",
- srna->identifier, prop->identifier, prop->arraydimension);
- DefRNA.error = 1;
- return;
- }
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- case PROP_INT:
- case PROP_FLOAT:
- prop->arraylength[0] = length;
- prop->totarraylength = length;
- prop->arraydimension = 1;
- break;
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", only boolean/int/float can be array.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (length < 0) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", array length must be zero of greater.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
+
+ if (length > RNA_MAX_ARRAY_LENGTH) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", array length must be smaller than %d.",
+ srna->identifier,
+ prop->identifier,
+ RNA_MAX_ARRAY_LENGTH);
+ DefRNA.error = 1;
+ return;
+ }
+
+ if (prop->arraydimension > 1) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", array dimensions has been set to %u but would be overwritten as 1.",
+ srna->identifier,
+ prop->identifier,
+ prop->arraydimension);
+ DefRNA.error = 1;
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_BOOLEAN:
+ case PROP_INT:
+ case PROP_FLOAT:
+ prop->arraylength[0] = length;
+ prop->totarraylength = length;
+ prop->arraydimension = 1;
+ break;
+ default:
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", only boolean/int/float can be array.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
/* common args for defaults. */
@@ -1423,59 +1478,64 @@ const int rna_matrix_dimsize_4x2[] = {4, 2};
void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int length[])
{
- StructRNA *srna = DefRNA.laststruct;
- int i;
-
- if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array dimension must be between 1 and %d.",
- srna->identifier, prop->identifier, RNA_MAX_ARRAY_DIMENSION);
- DefRNA.error = 1;
- return;
- }
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- case PROP_INT:
- case PROP_FLOAT:
- break;
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", only boolean/int/float can be array.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-
- prop->arraydimension = dimension;
- prop->totarraylength = 0;
-
- if (length) {
- memcpy(prop->arraylength, length, sizeof(int) * dimension);
-
- prop->totarraylength = length[0];
- for (i = 1; i < dimension; i++)
- prop->totarraylength *= length[i];
- }
- else
- memset(prop->arraylength, 0, sizeof(prop->arraylength));
-
- /* TODO make sure arraylength values are sane */
+ StructRNA *srna = DefRNA.laststruct;
+ int i;
+
+ if (dimension < 1 || dimension > RNA_MAX_ARRAY_DIMENSION) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", array dimension must be between 1 and %d.",
+ srna->identifier,
+ prop->identifier,
+ RNA_MAX_ARRAY_DIMENSION);
+ DefRNA.error = 1;
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_BOOLEAN:
+ case PROP_INT:
+ case PROP_FLOAT:
+ break;
+ default:
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", only boolean/int/float can be array.",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+
+ prop->arraydimension = dimension;
+ prop->totarraylength = 0;
+
+ if (length) {
+ memcpy(prop->arraylength, length, sizeof(int) * dimension);
+
+ prop->totarraylength = length[0];
+ for (i = 1; i < dimension; i++)
+ prop->totarraylength *= length[i];
+ }
+ else
+ memset(prop->arraylength, 0, sizeof(prop->arraylength));
+
+ /* TODO make sure arraylength values are sane */
}
void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description)
{
- DESCR_CHECK(description, prop->identifier, NULL);
+ DESCR_CHECK(description, prop->identifier, NULL);
- prop->name = name;
- prop->description = description;
+ prop->name = name;
+ prop->description = description;
}
void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
{
- prop->icon = icon;
- if (consecutive != 0)
- prop->flag |= PROP_ICONS_CONSECUTIVE;
- if (consecutive < 0)
- prop->flag |= PROP_ICONS_REVERSE;
+ prop->icon = icon;
+ if (consecutive != 0)
+ prop->flag |= PROP_ICONS_CONSECUTIVE;
+ if (consecutive < 0)
+ prop->flag |= PROP_ICONS_REVERSE;
}
/**
@@ -1489,800 +1549,816 @@ void RNA_def_property_ui_icon(PropertyRNA *prop, int icon, int consecutive)
* \param precision: The number of zeros to show
* (as a whole number - common range is 1 - 6), see UI_PRECISION_FLOAT_MAX
*/
-void RNA_def_property_ui_range(PropertyRNA *prop, double min, double max, double step, int precision)
+void RNA_def_property_ui_range(
+ PropertyRNA *prop, double min, double max, double step, int precision)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
#ifndef NDEBUG
- if (min > max) {
- CLOG_ERROR(&LOG, "\"%s.%s\", min > max.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
-
- if (step < 0 || step > 100) {
- CLOG_ERROR(&LOG, "\"%s.%s\", step outside range.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
-
- if (precision < -1 || precision > UI_PRECISION_FLOAT_MAX) {
- CLOG_ERROR(&LOG, "\"%s.%s\", precision outside range.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
+ if (min > max) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", min > max.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+
+ if (step < 0 || step > 100) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", step outside range.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+
+ if (precision < -1 || precision > UI_PRECISION_FLOAT_MAX) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", precision outside range.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
#endif
- switch (prop->type) {
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- iprop->softmin = (int)min;
- iprop->softmax = (int)max;
- iprop->step = (int)step;
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- fprop->softmin = (float)min;
- fprop->softmax = (float)max;
- fprop->step = (float)step;
- fprop->precision = (int)precision;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for ui range.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ iprop->softmin = (int)min;
+ iprop->softmax = (int)max;
+ iprop->step = (int)step;
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ fprop->softmin = (float)min;
+ fprop->softmax = (float)max;
+ fprop->step = (float)step;
+ fprop->precision = (int)precision;
+ break;
+ }
+ default:
+ CLOG_ERROR(
+ &LOG, "\"%s.%s\", invalid type for ui range.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_range(PropertyRNA *prop, double min, double max)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
#ifdef DEBUG
- if (min > max) {
- CLOG_ERROR(&LOG, "\"%s.%s\", min > max.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
+ if (min > max) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", min > max.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
#endif
- switch (prop->type) {
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- iprop->hardmin = (int)min;
- iprop->hardmax = (int)max;
- iprop->softmin = MAX2((int)min, iprop->hardmin);
- iprop->softmax = MIN2((int)max, iprop->hardmax);
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- fprop->hardmin = (float)min;
- fprop->hardmax = (float)max;
- fprop->softmin = MAX2((float)min, fprop->hardmin);
- fprop->softmax = MIN2((float)max, fprop->hardmax);
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for range.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ iprop->hardmin = (int)min;
+ iprop->hardmax = (int)max;
+ iprop->softmin = MAX2((int)min, iprop->hardmin);
+ iprop->softmax = MIN2((int)max, iprop->hardmax);
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ fprop->hardmin = (float)min;
+ fprop->hardmax = (float)max;
+ fprop->softmin = MAX2((float)min, fprop->hardmin);
+ fprop->softmax = MIN2((float)max, fprop->hardmax);
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for range.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_struct_type(PropertyRNA *prop, const char *type)
{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- fprintf(stderr, "\"%s.%s\": only during preprocessing.", srna->identifier, prop->identifier);
- return;
- }
-
- switch (prop->type) {
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- pprop->type = (StructRNA *)type;
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- cprop->item_type = (StructRNA *)type;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for struct type.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ fprintf(stderr, "\"%s.%s\": only during preprocessing.", srna->identifier, prop->identifier);
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ pprop->type = (StructRNA *)type;
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ cprop->item_type = (StructRNA *)type;
+ break;
+ }
+ default:
+ CLOG_ERROR(
+ &LOG, "\"%s.%s\", invalid type for struct type.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type)
{
- StructRNA *srna = DefRNA.laststruct;
-
- if (DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only at runtime.");
- return;
- }
-
- switch (prop->type) {
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
- pprop->type = type;
-
- if (type && (type->flag & STRUCT_ID_REFCOUNT))
- prop->flag |= PROP_ID_REFCOUNT;
-
- break;
- }
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- cprop->item_type = type;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for struct type.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only at runtime.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+ pprop->type = type;
+
+ if (type && (type->flag & STRUCT_ID_REFCOUNT))
+ prop->flag |= PROP_ID_REFCOUNT;
+
+ break;
+ }
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ cprop->item_type = type;
+ break;
+ }
+ default:
+ CLOG_ERROR(
+ &LOG, "\"%s.%s\", invalid type for struct type.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_enum_items(PropertyRNA *prop, const EnumPropertyItem *item)
{
- StructRNA *srna = DefRNA.laststruct;
- int i, defaultfound = 0;
-
- switch (prop->type) {
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- eprop->item = (EnumPropertyItem *)item;
- eprop->totitem = 0;
- for (i = 0; item[i].identifier; i++) {
- eprop->totitem++;
-
- if (item[i].identifier[0] && item[i].value == eprop->defaultvalue)
- defaultfound = 1;
- }
-
- if (!defaultfound) {
- for (i = 0; item[i].identifier; i++) {
- if (item[i].identifier[0]) {
- eprop->defaultvalue = item[i].value;
- break;
- }
- }
- }
-
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", invalid type for struct type.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+ int i, defaultfound = 0;
+
+ switch (prop->type) {
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ eprop->item = (EnumPropertyItem *)item;
+ eprop->totitem = 0;
+ for (i = 0; item[i].identifier; i++) {
+ eprop->totitem++;
+
+ if (item[i].identifier[0] && item[i].value == eprop->defaultvalue)
+ defaultfound = 1;
+ }
+
+ if (!defaultfound) {
+ for (i = 0; item[i].identifier; i++) {
+ if (item[i].identifier[0]) {
+ eprop->defaultvalue = item[i].value;
+ break;
+ }
+ }
+ }
+
+ break;
+ }
+ default:
+ CLOG_ERROR(
+ &LOG, "\"%s.%s\", invalid type for struct type.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_string_maxlength(PropertyRNA *prop, int maxlength)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
- switch (prop->type) {
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- sprop->maxlength = maxlength;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ sprop->maxlength = maxlength;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_boolean_default(PropertyRNA *prop, bool value)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- BLI_assert(ELEM(value, false, true));
- bprop->defaultvalue = value;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ BLI_assert(ELEM(value, false, true));
+ bprop->defaultvalue = value;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_boolean_array_default(PropertyRNA *prop, const bool *array)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- bprop->defaultarray = array;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ bprop->defaultarray = array;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_int_default(PropertyRNA *prop, int value)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
- switch (prop->type) {
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- iprop->defaultvalue = value;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ iprop->defaultvalue = value;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_int_array_default(PropertyRNA *prop, const int *array)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
- switch (prop->type) {
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- iprop->defaultarray = array;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ iprop->defaultarray = array;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_float_default(PropertyRNA *prop, float value)
{
- StructRNA *srna = DefRNA.laststruct;
-
- switch (prop->type) {
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- fprop->defaultvalue = value;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+
+ switch (prop->type) {
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ fprop->defaultvalue = value;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
/* array must remain valid after this function finishes */
void RNA_def_property_float_array_default(PropertyRNA *prop, const float *array)
{
- StructRNA *srna = DefRNA.laststruct;
+ StructRNA *srna = DefRNA.laststruct;
- switch (prop->type) {
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- fprop->defaultarray = array; /* WARNING, this array must not come from the stack and lost */
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ switch (prop->type) {
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ fprop->defaultarray = array; /* WARNING, this array must not come from the stack and lost */
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_string_default(PropertyRNA *prop, const char *value)
{
- StructRNA *srna = DefRNA.laststruct;
-
- switch (prop->type) {
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
-
- if (value == NULL) {
- CLOG_ERROR(&LOG, "\"%s.%s\", NULL string passed (dont call in this case).", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-
- if (!value[0]) {
- CLOG_ERROR(&LOG, "\"%s.%s\", empty string passed (dont call in this case).", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- // BLI_assert(0);
- break;
- }
-
- sprop->defaultvalue = value;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+
+ switch (prop->type) {
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+
+ if (value == NULL) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", NULL string passed (dont call in this case).",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+
+ if (!value[0]) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", empty string passed (dont call in this case).",
+ srna->identifier,
+ prop->identifier);
+ DefRNA.error = 1;
+ // BLI_assert(0);
+ break;
+ }
+
+ sprop->defaultvalue = value;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_enum_default(PropertyRNA *prop, int value)
{
- StructRNA *srna = DefRNA.laststruct;
- int i, defaultfound = 0;
-
- switch (prop->type) {
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- eprop->defaultvalue = value;
-
- if (prop->flag & PROP_ENUM_FLAG) {
- /* check all bits are accounted for */
- int totflag = 0;
- for (i = 0; i < eprop->totitem; i++) {
- if (eprop->item[i].identifier[0]) {
- totflag |= eprop->item[i].value;
- }
- }
-
- if (eprop->defaultvalue & ~totflag) {
- CLOG_ERROR(&LOG, "\"%s.%s\", default includes unused bits (%d).",
- srna->identifier, prop->identifier, eprop->defaultvalue & ~totflag);
- DefRNA.error = 1;
- }
- }
- else {
- for (i = 0; i < eprop->totitem; i++) {
- if (eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue)
- defaultfound = 1;
- }
-
- if (!defaultfound && eprop->totitem) {
- if (value == 0) {
- eprop->defaultvalue = eprop->item[0].value;
- }
- else {
- CLOG_ERROR(&LOG, "\"%s.%s\", default is not in items.",
- srna->identifier, prop->identifier);
- DefRNA.error = 1;
- }
- }
- }
-
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ StructRNA *srna = DefRNA.laststruct;
+ int i, defaultfound = 0;
+
+ switch (prop->type) {
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ eprop->defaultvalue = value;
+
+ if (prop->flag & PROP_ENUM_FLAG) {
+ /* check all bits are accounted for */
+ int totflag = 0;
+ for (i = 0; i < eprop->totitem; i++) {
+ if (eprop->item[i].identifier[0]) {
+ totflag |= eprop->item[i].value;
+ }
+ }
+
+ if (eprop->defaultvalue & ~totflag) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", default includes unused bits (%d).",
+ srna->identifier,
+ prop->identifier,
+ eprop->defaultvalue & ~totflag);
+ DefRNA.error = 1;
+ }
+ }
+ else {
+ for (i = 0; i < eprop->totitem; i++) {
+ if (eprop->item[i].identifier[0] && eprop->item[i].value == eprop->defaultvalue)
+ defaultfound = 1;
+ }
+
+ if (!defaultfound && eprop->totitem) {
+ if (value == 0) {
+ eprop->defaultvalue = eprop->item[0].value;
+ }
+ else {
+ CLOG_ERROR(
+ &LOG, "\"%s.%s\", default is not in items.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ }
+ }
+ }
+
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
/* SDNA */
-static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop, const char *structname, const char *propname)
-{
- DNAStructMember smember;
- StructDefRNA *ds;
- PropertyDefRNA *dp;
-
- dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
- if (dp == NULL) return NULL;
-
- ds = rna_find_struct_def((StructRNA *)dp->cont);
-
- if (!structname)
- structname = ds->dnaname;
- if (!propname)
- propname = prop->identifier;
-
- if (!rna_find_sdna_member(DefRNA.sdna, structname, propname, &smember)) {
- if (DefRNA.silent) {
- return NULL;
- }
- else if (!DefRNA.verify) {
- /* some basic values to survive even with sdna info */
- dp->dnastructname = structname;
- dp->dnaname = propname;
- if (prop->type == PROP_BOOLEAN)
- dp->dnaarraylength = 1;
- if (prop->type == PROP_POINTER)
- dp->dnapointerlevel = 1;
- return dp;
- }
- else {
- CLOG_ERROR(&LOG, "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.",
- structname, propname, prop->identifier);
- DefRNA.error = 1;
- return NULL;
- }
- }
-
- if (smember.arraylength > 1) {
- prop->arraylength[0] = smember.arraylength;
- prop->totarraylength = smember.arraylength;
- prop->arraydimension = 1;
- }
- else {
- prop->arraydimension = 0;
- prop->totarraylength = 0;
- }
-
- dp->dnastructname = structname;
- dp->dnastructfromname = ds->dnafromname;
- dp->dnastructfromprop = ds->dnafromprop;
- dp->dnaname = propname;
- dp->dnatype = smember.type;
- dp->dnaarraylength = smember.arraylength;
- dp->dnapointerlevel = smember.pointerlevel;
-
- return dp;
-}
-
-void RNA_def_property_boolean_sdna(PropertyRNA *prop, const char *structname, const char *propname, int bit)
-{
- PropertyDefRNA *dp;
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- if (prop->type != PROP_BOOLEAN) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
-
- if ((dp = rna_def_property_sdna(prop, structname, propname))) {
-
- if (DefRNA.silent == 0) {
- /* error check to ensure floats are not wrapped as ints/bools */
- if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
- CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
- srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
- DefRNA.error = 1;
- return;
- }
- }
-
- dp->booleanbit = bit;
- }
-}
-
-void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop, const char *structname,
- const char *propname, int booleanbit)
-{
- PropertyDefRNA *dp;
-
- RNA_def_property_boolean_sdna(prop, structname, propname, booleanbit);
-
- dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
-
- if (dp)
- dp->booleannegative = 1;
+static PropertyDefRNA *rna_def_property_sdna(PropertyRNA *prop,
+ const char *structname,
+ const char *propname)
+{
+ DNAStructMember smember;
+ StructDefRNA *ds;
+ PropertyDefRNA *dp;
+
+ dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
+ if (dp == NULL)
+ return NULL;
+
+ ds = rna_find_struct_def((StructRNA *)dp->cont);
+
+ if (!structname)
+ structname = ds->dnaname;
+ if (!propname)
+ propname = prop->identifier;
+
+ if (!rna_find_sdna_member(DefRNA.sdna, structname, propname, &smember)) {
+ if (DefRNA.silent) {
+ return NULL;
+ }
+ else if (!DefRNA.verify) {
+ /* some basic values to survive even with sdna info */
+ dp->dnastructname = structname;
+ dp->dnaname = propname;
+ if (prop->type == PROP_BOOLEAN)
+ dp->dnaarraylength = 1;
+ if (prop->type == PROP_POINTER)
+ dp->dnapointerlevel = 1;
+ return dp;
+ }
+ else {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\" (identifier \"%s\") not found. Struct must be in DNA.",
+ structname,
+ propname,
+ prop->identifier);
+ DefRNA.error = 1;
+ return NULL;
+ }
+ }
+
+ if (smember.arraylength > 1) {
+ prop->arraylength[0] = smember.arraylength;
+ prop->totarraylength = smember.arraylength;
+ prop->arraydimension = 1;
+ }
+ else {
+ prop->arraydimension = 0;
+ prop->totarraylength = 0;
+ }
+
+ dp->dnastructname = structname;
+ dp->dnastructfromname = ds->dnafromname;
+ dp->dnastructfromprop = ds->dnafromprop;
+ dp->dnaname = propname;
+ dp->dnatype = smember.type;
+ dp->dnaarraylength = smember.arraylength;
+ dp->dnapointerlevel = smember.pointerlevel;
+
+ return dp;
+}
+
+void RNA_def_property_boolean_sdna(PropertyRNA *prop,
+ const char *structname,
+ const char *propname,
+ int bit)
+{
+ PropertyDefRNA *dp;
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ if (prop->type != PROP_BOOLEAN) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
+
+ if ((dp = rna_def_property_sdna(prop, structname, propname))) {
+
+ if (DefRNA.silent == 0) {
+ /* error check to ensure floats are not wrapped as ints/bools */
+ if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
+ CLOG_ERROR(&LOG,
+ "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier,
+ prop->identifier,
+ dp->dnatype,
+ RNA_property_typename(prop->type));
+ DefRNA.error = 1;
+ return;
+ }
+ }
+
+ dp->booleanbit = bit;
+ }
+}
+
+void RNA_def_property_boolean_negative_sdna(PropertyRNA *prop,
+ const char *structname,
+ const char *propname,
+ int booleanbit)
+{
+ PropertyDefRNA *dp;
+
+ RNA_def_property_boolean_sdna(prop, structname, propname, booleanbit);
+
+ dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
+
+ if (dp)
+ dp->booleannegative = 1;
}
void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const char *propname)
{
- PropertyDefRNA *dp;
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- if (prop->type != PROP_INT) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
-
- if ((dp = rna_def_property_sdna(prop, structname, propname))) {
-
- /* error check to ensure floats are not wrapped as ints/bools */
- if (DefRNA.silent == 0) {
- if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
- CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
- srna->identifier, prop->identifier, dp->dnatype, RNA_property_typename(prop->type));
- DefRNA.error = 1;
- return;
- }
- }
-
- /* SDNA doesn't pass us unsigned unfortunately .. */
- if (dp->dnatype && STREQ(dp->dnatype, "char")) {
- iprop->hardmin = iprop->softmin = CHAR_MIN;
- iprop->hardmax = iprop->softmax = CHAR_MAX;
- }
- else if (dp->dnatype && STREQ(dp->dnatype, "short")) {
- iprop->hardmin = iprop->softmin = SHRT_MIN;
- iprop->hardmax = iprop->softmax = SHRT_MAX;
- }
- else if (dp->dnatype && STREQ(dp->dnatype, "int")) {
- iprop->hardmin = INT_MIN;
- iprop->hardmax = INT_MAX;
-
- iprop->softmin = -10000; /* rather arbitrary .. */
- iprop->softmax = 10000;
- }
-
- if (prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE || prop->subtype == PROP_FACTOR)
- iprop->hardmin = iprop->softmin = 0;
- }
+ PropertyDefRNA *dp;
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ if (prop->type != PROP_INT) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
+
+ if ((dp = rna_def_property_sdna(prop, structname, propname))) {
+
+ /* error check to ensure floats are not wrapped as ints/bools */
+ if (DefRNA.silent == 0) {
+ if (dp->dnatype && *dp->dnatype && IS_DNATYPE_INT_COMPAT(dp->dnatype) == 0) {
+ CLOG_ERROR(&LOG,
+ "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier,
+ prop->identifier,
+ dp->dnatype,
+ RNA_property_typename(prop->type));
+ DefRNA.error = 1;
+ return;
+ }
+ }
+
+ /* SDNA doesn't pass us unsigned unfortunately .. */
+ if (dp->dnatype && STREQ(dp->dnatype, "char")) {
+ iprop->hardmin = iprop->softmin = CHAR_MIN;
+ iprop->hardmax = iprop->softmax = CHAR_MAX;
+ }
+ else if (dp->dnatype && STREQ(dp->dnatype, "short")) {
+ iprop->hardmin = iprop->softmin = SHRT_MIN;
+ iprop->hardmax = iprop->softmax = SHRT_MAX;
+ }
+ else if (dp->dnatype && STREQ(dp->dnatype, "int")) {
+ iprop->hardmin = INT_MIN;
+ iprop->hardmax = INT_MAX;
+
+ iprop->softmin = -10000; /* rather arbitrary .. */
+ iprop->softmax = 10000;
+ }
+
+ if (prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE ||
+ prop->subtype == PROP_FACTOR)
+ iprop->hardmin = iprop->softmin = 0;
+ }
}
void RNA_def_property_float_sdna(PropertyRNA *prop, const char *structname, const char *propname)
{
- PropertyDefRNA *dp;
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- if (prop->type != PROP_FLOAT) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
-
- if ((dp = rna_def_property_sdna(prop, structname, propname))) {
- /* silent is for internal use */
- if (DefRNA.silent == 0) {
- if (dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
- if (prop->subtype != PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
- CLOG_ERROR(&LOG, "%s.%s is a '%s' but wrapped as type '%s'.",
- srna->identifier, prop->identifier, dp->dnatype,
- RNA_property_typename(prop->type));
- DefRNA.error = 1;
- return;
- }
- }
- }
-
- if (dp->dnatype && STREQ(dp->dnatype, "char")) {
- fprop->hardmin = fprop->softmin = 0.0f;
- fprop->hardmax = fprop->softmax = 1.0f;
- }
- }
-
- rna_def_property_sdna(prop, structname, propname);
+ PropertyDefRNA *dp;
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ if (prop->type != PROP_FLOAT) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
+
+ if ((dp = rna_def_property_sdna(prop, structname, propname))) {
+ /* silent is for internal use */
+ if (DefRNA.silent == 0) {
+ if (dp->dnatype && *dp->dnatype && IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0) {
+ if (prop->subtype !=
+ PROP_COLOR_GAMMA) { /* colors are an exception. these get translated */
+ CLOG_ERROR(&LOG,
+ "%s.%s is a '%s' but wrapped as type '%s'.",
+ srna->identifier,
+ prop->identifier,
+ dp->dnatype,
+ RNA_property_typename(prop->type));
+ DefRNA.error = 1;
+ return;
+ }
+ }
+ }
+
+ if (dp->dnatype && STREQ(dp->dnatype, "char")) {
+ fprop->hardmin = fprop->softmin = 0.0f;
+ fprop->hardmax = fprop->softmax = 1.0f;
+ }
+ }
+
+ rna_def_property_sdna(prop, structname, propname);
}
void RNA_def_property_enum_sdna(PropertyRNA *prop, const char *structname, const char *propname)
{
- /* PropertyDefRNA *dp; */
- StructRNA *srna = DefRNA.laststruct;
+ /* PropertyDefRNA *dp; */
+ StructRNA *srna = DefRNA.laststruct;
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (prop->type != PROP_ENUM) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
+ if (prop->type != PROP_ENUM) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
- if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
- if (prop->arraydimension) {
- prop->arraydimension = 0;
- prop->totarraylength = 0;
+ if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
+ if (prop->arraydimension) {
+ prop->arraydimension = 0;
+ prop->totarraylength = 0;
- if (!DefRNA.silent) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array not supported for enum type.",
- structname, propname);
- DefRNA.error = 1;
- }
- }
- }
+ if (!DefRNA.silent) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", array not supported for enum type.", structname, propname);
+ DefRNA.error = 1;
+ }
+ }
+ }
}
-void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop, const char *structname, const char *propname)
+void RNA_def_property_enum_bitflag_sdna(PropertyRNA *prop,
+ const char *structname,
+ const char *propname)
{
- PropertyDefRNA *dp;
+ PropertyDefRNA *dp;
- RNA_def_property_enum_sdna(prop, structname, propname);
+ RNA_def_property_enum_sdna(prop, structname, propname);
- dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
+ dp = rna_find_struct_property_def(DefRNA.laststruct, prop);
- if (dp)
- dp->enumbitflags = 1;
+ if (dp)
+ dp->enumbitflags = 1;
}
void RNA_def_property_string_sdna(PropertyRNA *prop, const char *structname, const char *propname)
{
- /* PropertyDefRNA *dp; */
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- StructRNA *srna = DefRNA.laststruct;
+ /* PropertyDefRNA *dp; */
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ StructRNA *srna = DefRNA.laststruct;
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (prop->type != PROP_STRING) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
+ if (prop->type != PROP_STRING) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
- if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
- if (prop->arraydimension) {
- sprop->maxlength = prop->totarraylength;
- prop->arraydimension = 0;
- prop->totarraylength = 0;
- }
- }
+ if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
+ if (prop->arraydimension) {
+ sprop->maxlength = prop->totarraylength;
+ prop->arraydimension = 0;
+ prop->totarraylength = 0;
+ }
+ }
}
void RNA_def_property_pointer_sdna(PropertyRNA *prop, const char *structname, const char *propname)
{
- /* PropertyDefRNA *dp; */
- StructRNA *srna = DefRNA.laststruct;
+ /* PropertyDefRNA *dp; */
+ StructRNA *srna = DefRNA.laststruct;
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (prop->type != PROP_POINTER) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not pointer.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
+ if (prop->type != PROP_POINTER) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not pointer.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
- if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
- if (prop->arraydimension) {
- prop->arraydimension = 0;
- prop->totarraylength = 0;
+ if ((/* dp= */ rna_def_property_sdna(prop, structname, propname))) {
+ if (prop->arraydimension) {
+ prop->arraydimension = 0;
+ prop->totarraylength = 0;
- if (!DefRNA.silent) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array not supported for pointer type.",
- structname, propname);
- DefRNA.error = 1;
- }
- }
- }
+ if (!DefRNA.silent) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", array not supported for pointer type.", structname, propname);
+ DefRNA.error = 1;
+ }
+ }
+ }
}
-void RNA_def_property_collection_sdna(PropertyRNA *prop, const char *structname, const char *propname,
+void RNA_def_property_collection_sdna(PropertyRNA *prop,
+ const char *structname,
+ const char *propname,
const char *lengthpropname)
{
- PropertyDefRNA *dp;
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- if (prop->type != PROP_COLLECTION) {
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not collection.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- return;
- }
-
- if ((dp = rna_def_property_sdna(prop, structname, propname))) {
- if (prop->arraydimension && !lengthpropname) {
- prop->arraydimension = 0;
- prop->totarraylength = 0;
-
- if (!DefRNA.silent) {
- CLOG_ERROR(&LOG, "\"%s.%s\", array of collections not supported.",
- structname, propname);
- DefRNA.error = 1;
- }
- }
-
- if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
- cprop->next = (PropCollectionNextFunc)"rna_iterator_listbase_next";
- cprop->get = (PropCollectionGetFunc)"rna_iterator_listbase_get";
- cprop->end = (PropCollectionEndFunc)"rna_iterator_listbase_end";
- }
- }
-
- if (dp && lengthpropname) {
- DNAStructMember smember;
- StructDefRNA *ds = rna_find_struct_def((StructRNA *)dp->cont);
-
- if (!structname)
- structname = ds->dnaname;
-
- if (lengthpropname[0] == 0 || rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) {
- if (lengthpropname[0] == 0) {
- dp->dnalengthfixed = prop->totarraylength;
- prop->arraydimension = 0;
- prop->totarraylength = 0;
- }
- else {
- dp->dnalengthstructname = structname;
- dp->dnalengthname = lengthpropname;
- prop->totarraylength = 0;
- }
-
- cprop->next = (PropCollectionNextFunc)"rna_iterator_array_next";
- cprop->end = (PropCollectionEndFunc)"rna_iterator_array_end";
-
- if (dp->dnapointerlevel >= 2)
- cprop->get = (PropCollectionGetFunc)"rna_iterator_array_dereference_get";
- else
- cprop->get = (PropCollectionGetFunc)"rna_iterator_array_get";
- }
- else {
- if (!DefRNA.silent) {
- CLOG_ERROR(&LOG, "\"%s.%s\" not found.", structname, lengthpropname);
- DefRNA.error = 1;
- }
- }
- }
+ PropertyDefRNA *dp;
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ if (prop->type != PROP_COLLECTION) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not collection.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ return;
+ }
+
+ if ((dp = rna_def_property_sdna(prop, structname, propname))) {
+ if (prop->arraydimension && !lengthpropname) {
+ prop->arraydimension = 0;
+ prop->totarraylength = 0;
+
+ if (!DefRNA.silent) {
+ CLOG_ERROR(&LOG, "\"%s.%s\", array of collections not supported.", structname, propname);
+ DefRNA.error = 1;
+ }
+ }
+
+ if (dp->dnatype && STREQ(dp->dnatype, "ListBase")) {
+ cprop->next = (PropCollectionNextFunc) "rna_iterator_listbase_next";
+ cprop->get = (PropCollectionGetFunc) "rna_iterator_listbase_get";
+ cprop->end = (PropCollectionEndFunc) "rna_iterator_listbase_end";
+ }
+ }
+
+ if (dp && lengthpropname) {
+ DNAStructMember smember;
+ StructDefRNA *ds = rna_find_struct_def((StructRNA *)dp->cont);
+
+ if (!structname)
+ structname = ds->dnaname;
+
+ if (lengthpropname[0] == 0 ||
+ rna_find_sdna_member(DefRNA.sdna, structname, lengthpropname, &smember)) {
+ if (lengthpropname[0] == 0) {
+ dp->dnalengthfixed = prop->totarraylength;
+ prop->arraydimension = 0;
+ prop->totarraylength = 0;
+ }
+ else {
+ dp->dnalengthstructname = structname;
+ dp->dnalengthname = lengthpropname;
+ prop->totarraylength = 0;
+ }
+
+ cprop->next = (PropCollectionNextFunc) "rna_iterator_array_next";
+ cprop->end = (PropCollectionEndFunc) "rna_iterator_array_end";
+
+ if (dp->dnapointerlevel >= 2)
+ cprop->get = (PropCollectionGetFunc) "rna_iterator_array_dereference_get";
+ else
+ cprop->get = (PropCollectionGetFunc) "rna_iterator_array_get";
+ }
+ else {
+ if (!DefRNA.silent) {
+ CLOG_ERROR(&LOG, "\"%s.%s\" not found.", structname, lengthpropname);
+ DefRNA.error = 1;
+ }
+ }
+ }
}
void RNA_def_property_translation_context(PropertyRNA *prop, const char *context)
{
- prop->translation_context = context ? context : BLT_I18NCONTEXT_DEFAULT_BPYRNA;
+ prop->translation_context = context ? context : BLT_I18NCONTEXT_DEFAULT_BPYRNA;
}
/* Functions */
void RNA_def_property_editable_func(PropertyRNA *prop, const char *editable)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (editable) prop->editable = (EditableFunc)editable;
+ if (editable)
+ prop->editable = (EditableFunc)editable;
}
void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editable)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (editable) prop->itemeditable = (ItemEditableFunc)editable;
+ if (editable)
+ prop->itemeditable = (ItemEditableFunc)editable;
}
/**
@@ -2290,1131 +2366,1425 @@ void RNA_def_property_editable_array_func(PropertyRNA *prop, const char *editabl
*
* \note \a diff callback will also be used by RNA comparison/equality functions.
*/
-void RNA_def_property_override_funcs(PropertyRNA *prop, const char *diff, const char *store, const char *apply)
-{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- if (diff) {
- prop->override_diff = (RNAPropOverrideDiff)diff;
- }
- if (store) {
- prop->override_store = (RNAPropOverrideStore)store;
- }
- if (apply) {
- prop->override_apply = (RNAPropOverrideApply)apply;
- }
+void RNA_def_property_override_funcs(PropertyRNA *prop,
+ const char *diff,
+ const char *store,
+ const char *apply)
+{
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ if (diff) {
+ prop->override_diff = (RNAPropOverrideDiff)diff;
+ }
+ if (store) {
+ prop->override_store = (RNAPropOverrideStore)store;
+ }
+ if (apply) {
+ prop->override_apply = (RNAPropOverrideApply)apply;
+ }
}
void RNA_def_property_update(PropertyRNA *prop, int noteflag, const char *func)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- prop->noteflag = noteflag;
- prop->update = (UpdateFunc)func;
+ prop->noteflag = noteflag;
+ prop->update = (UpdateFunc)func;
}
void RNA_def_property_update_runtime(PropertyRNA *prop, const void *func)
{
- prop->update = (void *)func;
+ prop->update = (void *)func;
}
void RNA_def_property_poll_runtime(PropertyRNA *prop, const void *func)
{
- if (prop->type == PROP_POINTER) {
- ((PointerPropertyRNA *)prop)->poll = (void *)func;
- }
- else {
- CLOG_ERROR(&LOG, "%s is not a Pointer Property.", prop->identifier);
- }
+ if (prop->type == PROP_POINTER) {
+ ((PointerPropertyRNA *)prop)->poll = (void *)func;
+ }
+ else {
+ CLOG_ERROR(&LOG, "%s is not a Pointer Property.", prop->identifier);
+ }
}
void RNA_def_property_dynamic_array_funcs(PropertyRNA *prop, const char *getlength)
{
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
- if (!(prop->flag & PROP_DYNAMIC)) {
- CLOG_ERROR(&LOG, "property is a not dynamic array.");
- DefRNA.error = 1;
- return;
- }
+ if (!(prop->flag & PROP_DYNAMIC)) {
+ CLOG_ERROR(&LOG, "property is a not dynamic array.");
+ DefRNA.error = 1;
+ return;
+ }
- if (getlength) prop->getlength = (PropArrayLengthGetFunc)getlength;
+ if (getlength)
+ prop->getlength = (PropArrayLengthGetFunc)getlength;
}
void RNA_def_property_boolean_funcs(PropertyRNA *prop, const char *get, const char *set)
{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
-
- if (prop->arraydimension) {
- if (get) bprop->getarray = (PropBooleanArrayGetFunc)get;
- if (set) bprop->setarray = (PropBooleanArraySetFunc)set;
- }
- else {
- if (get) bprop->get = (PropBooleanGetFunc)get;
- if (set) bprop->set = (PropBooleanSetFunc)set;
- }
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-}
-
-void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop, BooleanPropertyGetFunc getfunc, BooleanPropertySetFunc setfunc)
-{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
-
- if (getfunc) bprop->get_ex = getfunc;
- if (setfunc) bprop->set_ex = setfunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop, BooleanArrayPropertyGetFunc getfunc, BooleanArrayPropertySetFunc setfunc)
-{
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
-
- if (getfunc) bprop->getarray_ex = getfunc;
- if (setfunc) bprop->setarray_ex = setfunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_int_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
-{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
-
- if (prop->arraydimension) {
- if (get) iprop->getarray = (PropIntArrayGetFunc)get;
- if (set) iprop->setarray = (PropIntArraySetFunc)set;
- }
- else {
- if (get) iprop->get = (PropIntGetFunc)get;
- if (set) iprop->set = (PropIntSetFunc)set;
- }
- if (range) iprop->range = (PropIntRangeFunc)range;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-}
-
-void RNA_def_property_int_funcs_runtime(PropertyRNA *prop, IntPropertyGetFunc getfunc, IntPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc)
-{
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
-
- if (getfunc) iprop->get_ex = getfunc;
- if (setfunc) iprop->set_ex = setfunc;
- if (rangefunc) iprop->range_ex = rangefunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop, IntArrayPropertyGetFunc getfunc, IntArrayPropertySetFunc setfunc, IntPropertyRangeFunc rangefunc)
-{
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
-
- if (getfunc) iprop->getarray_ex = getfunc;
- if (setfunc) iprop->setarray_ex = setfunc;
- if (rangefunc) iprop->range_ex = rangefunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_float_funcs(PropertyRNA *prop, const char *get, const char *set, const char *range)
-{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- if (prop->arraydimension) {
- if (get) fprop->getarray = (PropFloatArrayGetFunc)get;
- if (set) fprop->setarray = (PropFloatArraySetFunc)set;
- }
- else {
- if (get) fprop->get = (PropFloatGetFunc)get;
- if (set) fprop->set = (PropFloatSetFunc)set;
- }
- if (range) fprop->range = (PropFloatRangeFunc)range;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-}
-
-void RNA_def_property_float_funcs_runtime(PropertyRNA *prop, FloatPropertyGetFunc getfunc, FloatPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc)
-{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- if (getfunc) fprop->get_ex = getfunc;
- if (setfunc) fprop->set_ex = setfunc;
- if (rangefunc) fprop->range_ex = rangefunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop, FloatArrayPropertyGetFunc getfunc, FloatArrayPropertySetFunc setfunc, FloatPropertyRangeFunc rangefunc)
-{
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- if (getfunc) fprop->getarray_ex = getfunc;
- if (setfunc) fprop->setarray_ex = setfunc;
- if (rangefunc) fprop->range_ex = rangefunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_enum_funcs(PropertyRNA *prop, const char *get, const char *set, const char *item)
-{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
-
- if (get) eprop->get = (PropEnumGetFunc)get;
- if (set) eprop->set = (PropEnumSetFunc)set;
- if (item) eprop->itemf = (PropEnumItemFunc)item;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-}
-
-void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop, EnumPropertyGetFunc getfunc, EnumPropertySetFunc setfunc, EnumPropertyItemFunc itemfunc)
-{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
-
- if (getfunc) eprop->get_ex = getfunc;
- if (setfunc) eprop->set_ex = setfunc;
- if (itemfunc) eprop->itemf = itemfunc;
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+
+ if (prop->arraydimension) {
+ if (get)
+ bprop->getarray = (PropBooleanArrayGetFunc)get;
+ if (set)
+ bprop->setarray = (PropBooleanArraySetFunc)set;
+ }
+ else {
+ if (get)
+ bprop->get = (PropBooleanGetFunc)get;
+ if (set)
+ bprop->set = (PropBooleanSetFunc)set;
+ }
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not boolean.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+}
+
+void RNA_def_property_boolean_funcs_runtime(PropertyRNA *prop,
+ BooleanPropertyGetFunc getfunc,
+ BooleanPropertySetFunc setfunc)
+{
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+
+ if (getfunc)
+ bprop->get_ex = getfunc;
+ if (setfunc)
+ bprop->set_ex = setfunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_boolean_array_funcs_runtime(PropertyRNA *prop,
+ BooleanArrayPropertyGetFunc getfunc,
+ BooleanArrayPropertySetFunc setfunc)
+{
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+
+ if (getfunc)
+ bprop->getarray_ex = getfunc;
+ if (setfunc)
+ bprop->setarray_ex = setfunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_int_funcs(PropertyRNA *prop,
+ const char *get,
+ const char *set,
+ const char *range)
+{
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+
+ if (prop->arraydimension) {
+ if (get)
+ iprop->getarray = (PropIntArrayGetFunc)get;
+ if (set)
+ iprop->setarray = (PropIntArraySetFunc)set;
+ }
+ else {
+ if (get)
+ iprop->get = (PropIntGetFunc)get;
+ if (set)
+ iprop->set = (PropIntSetFunc)set;
+ }
+ if (range)
+ iprop->range = (PropIntRangeFunc)range;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not int.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+}
+
+void RNA_def_property_int_funcs_runtime(PropertyRNA *prop,
+ IntPropertyGetFunc getfunc,
+ IntPropertySetFunc setfunc,
+ IntPropertyRangeFunc rangefunc)
+{
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+
+ if (getfunc)
+ iprop->get_ex = getfunc;
+ if (setfunc)
+ iprop->set_ex = setfunc;
+ if (rangefunc)
+ iprop->range_ex = rangefunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_int_array_funcs_runtime(PropertyRNA *prop,
+ IntArrayPropertyGetFunc getfunc,
+ IntArrayPropertySetFunc setfunc,
+ IntPropertyRangeFunc rangefunc)
+{
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+
+ if (getfunc)
+ iprop->getarray_ex = getfunc;
+ if (setfunc)
+ iprop->setarray_ex = setfunc;
+ if (rangefunc)
+ iprop->range_ex = rangefunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_float_funcs(PropertyRNA *prop,
+ const char *get,
+ const char *set,
+ const char *range)
+{
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ if (prop->arraydimension) {
+ if (get)
+ fprop->getarray = (PropFloatArrayGetFunc)get;
+ if (set)
+ fprop->setarray = (PropFloatArraySetFunc)set;
+ }
+ else {
+ if (get)
+ fprop->get = (PropFloatGetFunc)get;
+ if (set)
+ fprop->set = (PropFloatSetFunc)set;
+ }
+ if (range)
+ fprop->range = (PropFloatRangeFunc)range;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not float.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+}
+
+void RNA_def_property_float_funcs_runtime(PropertyRNA *prop,
+ FloatPropertyGetFunc getfunc,
+ FloatPropertySetFunc setfunc,
+ FloatPropertyRangeFunc rangefunc)
+{
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ if (getfunc)
+ fprop->get_ex = getfunc;
+ if (setfunc)
+ fprop->set_ex = setfunc;
+ if (rangefunc)
+ fprop->range_ex = rangefunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_float_array_funcs_runtime(PropertyRNA *prop,
+ FloatArrayPropertyGetFunc getfunc,
+ FloatArrayPropertySetFunc setfunc,
+ FloatPropertyRangeFunc rangefunc)
+{
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ if (getfunc)
+ fprop->getarray_ex = getfunc;
+ if (setfunc)
+ fprop->setarray_ex = setfunc;
+ if (rangefunc)
+ fprop->range_ex = rangefunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_enum_funcs(PropertyRNA *prop,
+ const char *get,
+ const char *set,
+ const char *item)
+{
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+
+ if (get)
+ eprop->get = (PropEnumGetFunc)get;
+ if (set)
+ eprop->set = (PropEnumSetFunc)set;
+ if (item)
+ eprop->itemf = (PropEnumItemFunc)item;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not enum.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+}
+
+void RNA_def_property_enum_funcs_runtime(PropertyRNA *prop,
+ EnumPropertyGetFunc getfunc,
+ EnumPropertySetFunc setfunc,
+ EnumPropertyItemFunc itemfunc)
+{
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+
+ if (getfunc)
+ eprop->get_ex = getfunc;
+ if (setfunc)
+ eprop->set_ex = setfunc;
+ if (itemfunc)
+ eprop->itemf = itemfunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
}
void RNA_def_property_enum_py_data(PropertyRNA *prop, void *py_data)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- eprop->py_data = py_data;
-}
-
-void RNA_def_property_string_funcs(PropertyRNA *prop, const char *get, const char *length, const char *set)
-{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
-
- if (get) sprop->get = (PropStringGetFunc)get;
- if (length) sprop->length = (PropStringLengthFunc)length;
- if (set) sprop->set = (PropStringSetFunc)set;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-}
-
-void RNA_def_property_string_funcs_runtime(PropertyRNA *prop, StringPropertyGetFunc getfunc, StringPropertyLengthFunc lengthfunc, StringPropertySetFunc setfunc)
-{
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
-
- if (getfunc) sprop->get_ex = getfunc;
- if (lengthfunc) sprop->length_ex = lengthfunc;
- if (setfunc) sprop->set_ex = setfunc;
-
- if (getfunc || setfunc) {
- /* don't save in id properties */
- prop->flag &= ~PROP_IDPROPERTY;
-
- if (!setfunc)
- prop->flag &= ~PROP_EDITABLE;
- }
-}
-
-void RNA_def_property_pointer_funcs(PropertyRNA *prop, const char *get, const char *set,
- const char *typef, const char *poll)
-{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_POINTER:
- {
- PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
-
- if (get) pprop->get = (PropPointerGetFunc)get;
- if (set) pprop->set = (PropPointerSetFunc)set;
- if (typef) pprop->typef = (PropPointerTypeFunc)typef;
- if (poll) pprop->poll = (PropPointerPollFunc)poll;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not pointer.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
-}
-
-void RNA_def_property_collection_funcs(PropertyRNA *prop, const char *begin, const char *next, const char *end,
- const char *get, const char *length, const char *lookupint,
- const char *lookupstring, const char *assignint)
-{
- StructRNA *srna = DefRNA.laststruct;
-
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only during preprocessing.");
- return;
- }
-
- switch (prop->type) {
- case PROP_COLLECTION:
- {
- CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
-
- if (begin) cprop->begin = (PropCollectionBeginFunc)begin;
- if (next) cprop->next = (PropCollectionNextFunc)next;
- if (end) cprop->end = (PropCollectionEndFunc)end;
- if (get) cprop->get = (PropCollectionGetFunc)get;
- if (length) cprop->length = (PropCollectionLengthFunc)length;
- if (lookupint) cprop->lookupint = (PropCollectionLookupIntFunc)lookupint;
- if (lookupstring) cprop->lookupstring = (PropCollectionLookupStringFunc)lookupstring;
- if (assignint) cprop->assignint = (PropCollectionAssignIntFunc)assignint;
- break;
- }
- default:
- CLOG_ERROR(&LOG, "\"%s.%s\", type is not collection.", srna->identifier, prop->identifier);
- DefRNA.error = 1;
- break;
- }
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ eprop->py_data = py_data;
+}
+
+void RNA_def_property_string_funcs(PropertyRNA *prop,
+ const char *get,
+ const char *length,
+ const char *set)
+{
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+
+ if (get)
+ sprop->get = (PropStringGetFunc)get;
+ if (length)
+ sprop->length = (PropStringLengthFunc)length;
+ if (set)
+ sprop->set = (PropStringSetFunc)set;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not string.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+}
+
+void RNA_def_property_string_funcs_runtime(PropertyRNA *prop,
+ StringPropertyGetFunc getfunc,
+ StringPropertyLengthFunc lengthfunc,
+ StringPropertySetFunc setfunc)
+{
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+
+ if (getfunc)
+ sprop->get_ex = getfunc;
+ if (lengthfunc)
+ sprop->length_ex = lengthfunc;
+ if (setfunc)
+ sprop->set_ex = setfunc;
+
+ if (getfunc || setfunc) {
+ /* don't save in id properties */
+ prop->flag &= ~PROP_IDPROPERTY;
+
+ if (!setfunc)
+ prop->flag &= ~PROP_EDITABLE;
+ }
+}
+
+void RNA_def_property_pointer_funcs(
+ PropertyRNA *prop, const char *get, const char *set, const char *typef, const char *poll)
+{
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_POINTER: {
+ PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop;
+
+ if (get)
+ pprop->get = (PropPointerGetFunc)get;
+ if (set)
+ pprop->set = (PropPointerSetFunc)set;
+ if (typef)
+ pprop->typef = (PropPointerTypeFunc)typef;
+ if (poll)
+ pprop->poll = (PropPointerPollFunc)poll;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not pointer.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
+}
+
+void RNA_def_property_collection_funcs(PropertyRNA *prop,
+ const char *begin,
+ const char *next,
+ const char *end,
+ const char *get,
+ const char *length,
+ const char *lookupint,
+ const char *lookupstring,
+ const char *assignint)
+{
+ StructRNA *srna = DefRNA.laststruct;
+
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only during preprocessing.");
+ return;
+ }
+
+ switch (prop->type) {
+ case PROP_COLLECTION: {
+ CollectionPropertyRNA *cprop = (CollectionPropertyRNA *)prop;
+
+ if (begin)
+ cprop->begin = (PropCollectionBeginFunc)begin;
+ if (next)
+ cprop->next = (PropCollectionNextFunc)next;
+ if (end)
+ cprop->end = (PropCollectionEndFunc)end;
+ if (get)
+ cprop->get = (PropCollectionGetFunc)get;
+ if (length)
+ cprop->length = (PropCollectionLengthFunc)length;
+ if (lookupint)
+ cprop->lookupint = (PropCollectionLookupIntFunc)lookupint;
+ if (lookupstring)
+ cprop->lookupstring = (PropCollectionLookupStringFunc)lookupstring;
+ if (assignint)
+ cprop->assignint = (PropCollectionAssignIntFunc)assignint;
+ break;
+ }
+ default:
+ CLOG_ERROR(&LOG, "\"%s.%s\", type is not collection.", srna->identifier, prop->identifier);
+ DefRNA.error = 1;
+ break;
+ }
}
void RNA_def_property_srna(PropertyRNA *prop, const char *type)
{
- prop->srna = (StructRNA *)type;
+ prop->srna = (StructRNA *)type;
}
void RNA_def_py_data(PropertyRNA *prop, void *py_data)
{
- prop->py_data = py_data;
+ prop->py_data = py_data;
}
/* Compact definitions */
-PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_, const char *identifier, bool default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ bool default_value,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_boolean_array(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ bool *default_value,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_NONE);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_boolean_array_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value,
- const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+PropertyRNA *RNA_def_boolean_layer(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ bool *default_value,
+ const char *ui_name,
+ const char *ui_description)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_boolean_array_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ return prop;
+}
+
+PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ bool *default_value,
+ const char *ui_name,
+ const char *ui_description)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- return prop;
-}
+ prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_boolean_array_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ bool *default_value,
+ const char *ui_name,
+ const char *ui_description)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_XYZ); /* XXX */
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_boolean_array_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int default_value,
+ int hardmin,
+ int hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ int softmin,
+ int softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const int *default_value,
+ int hardmin,
+ int hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ int softmin,
+ int softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
-PropertyRNA *RNA_def_boolean_layer_member(StructOrFunctionRNA *cont_, const char *identifier, int len,
- bool *default_value, const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_INT, PROP_XYZ); /* XXX */
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_int_array_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const int *default_value,
+ int hardmin,
+ int hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ int softmin,
+ int softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
- prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_LAYER_MEMBER);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_int_array_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const char *default_value,
+ int maxlen,
+ const char *ui_name,
+ const char *ui_description)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ BLI_assert(default_value == NULL || default_value[0]);
- return prop;
-}
-
-PropertyRNA *RNA_def_boolean_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, bool *default_value,
- const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
+ if (maxlen != 0)
+ RNA_def_property_string_maxlength(prop, maxlen);
+ if (default_value)
+ RNA_def_property_string_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- prop = RNA_def_property(cont, identifier, PROP_BOOLEAN, PROP_XYZ); /* XXX */
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_boolean_array_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_int(StructOrFunctionRNA *cont_, const char *identifier, int default_value,
- int hardmin, int hardmax, const char *ui_name, const char *ui_description,
- int softmin, int softmax)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- ASSERT_SOFT_HARD_LIMITS;
-
- prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
-
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_int_vector(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
- int hardmin, int hardmax, const char *ui_name, const char *ui_description,
- int softmin, int softmax)
+PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const char *default_value,
+ int maxlen,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- ASSERT_SOFT_HARD_LIMITS;
+ BLI_assert(default_value == NULL || default_value[0]);
- prop = RNA_def_property(cont, identifier, PROP_INT, PROP_XYZ); /* XXX */
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_int_array_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+ prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILEPATH);
+ if (maxlen != 0)
+ RNA_def_property_string_maxlength(prop, maxlen);
+ if (default_value)
+ RNA_def_property_string_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_int_array(StructOrFunctionRNA *cont_, const char *identifier, int len, const int *default_value,
- int hardmin, int hardmax, const char *ui_name, const char *ui_description,
- int softmin, int softmax)
+PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const char *default_value,
+ int maxlen,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- ASSERT_SOFT_HARD_LIMITS;
+ BLI_assert(default_value == NULL || default_value[0]);
- prop = RNA_def_property(cont, identifier, PROP_INT, PROP_NONE);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_int_array_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+ prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_DIRPATH);
+ if (maxlen != 0)
+ RNA_def_property_string_maxlength(prop, maxlen);
+ if (default_value)
+ RNA_def_property_string_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_string(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value, int maxlen,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const char *default_value,
+ int maxlen,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- BLI_assert(default_value == NULL || default_value[0]);
+ BLI_assert(default_value == NULL || default_value[0]);
- prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_NONE);
- if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
- if (default_value) RNA_def_property_string_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILENAME);
+ if (maxlen != 0)
+ RNA_def_property_string_maxlength(prop, maxlen);
+ if (default_value)
+ RNA_def_property_string_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_string_file_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
- int maxlen, const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const EnumPropertyItem *items,
+ int default_value,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- BLI_assert(default_value == NULL || default_value[0]);
+ if (!items) {
+ CLOG_ERROR(&LOG, "items not allowed to be NULL.");
+ return NULL;
+ }
- prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILEPATH);
- if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
- if (default_value) RNA_def_property_string_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
+ if (items)
+ RNA_def_property_enum_items(prop, items);
+ RNA_def_property_enum_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
-}
-
-PropertyRNA *RNA_def_string_dir_path(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
- int maxlen, const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- BLI_assert(default_value == NULL || default_value[0]);
-
- prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_DIRPATH);
- if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
- if (default_value) RNA_def_property_string_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_string_file_name(StructOrFunctionRNA *cont_, const char *identifier, const char *default_value,
- int maxlen, const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- BLI_assert(default_value == NULL || default_value[0]);
-
- prop = RNA_def_property(cont, identifier, PROP_STRING, PROP_FILENAME);
- if (maxlen != 0) RNA_def_property_string_maxlength(prop, maxlen);
- if (default_value) RNA_def_property_string_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_enum(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
- int default_value, const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- if (!items) {
- CLOG_ERROR(&LOG, "items not allowed to be NULL.");
- return NULL;
- }
-
- prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
- if (items) RNA_def_property_enum_items(prop, items);
- RNA_def_property_enum_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
+ return prop;
}
/* same as above but sets 'PROP_ENUM_FLAG' before setting the default value */
-PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_, const char *identifier, const EnumPropertyItem *items,
- int default_value, const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_enum_flag(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const EnumPropertyItem *items,
+ int default_value,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- if (!items) {
- CLOG_ERROR(&LOG, "items not allowed to be NULL.");
- return NULL;
- }
+ if (!items) {
+ CLOG_ERROR(&LOG, "items not allowed to be NULL.");
+ return NULL;
+ }
- prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
- if (items) RNA_def_property_enum_items(prop, items);
- RNA_def_property_enum_default(prop, default_value);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
+ if (items)
+ RNA_def_property_enum_items(prop, items);
+ RNA_def_property_enum_default(prop, default_value);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
void RNA_def_enum_funcs(PropertyRNA *prop, EnumPropertyItemFunc itemfunc)
{
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
- eprop->itemf = itemfunc;
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+ eprop->itemf = itemfunc;
+}
+
+PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ float default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const float *default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_XYZ);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_float_array_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const float *default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ PropertyRNA *prop;
+
+ prop = RNA_def_float_vector(cont_,
+ identifier,
+ len,
+ default_value,
+ hardmin,
+ hardmax,
+ ui_name,
+ ui_description,
+ softmin,
+ softmax);
+ prop->subtype = PROP_XYZ_LENGTH;
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const float *default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_COLOR);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_float_array_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int rows,
+ int columns,
+ const float *default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+ const int length[2] = {rows, columns};
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, length);
+ if (default_value)
+ RNA_def_property_float_array_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const float *default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len >= 3) ? PROP_EULER : PROP_ANGLE);
+ if (len != 0) {
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_float_array_default(prop, default_value);
+ }
+ else {
+ /* RNA_def_property_float_default must be called outside */
+ BLI_assert(default_value == NULL);
+ }
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 10, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_distance(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ float default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ PropertyRNA *prop = RNA_def_float(cont_,
+ identifier,
+ default_value,
+ hardmin,
+ hardmax,
+ ui_name,
+ ui_description,
+ softmin,
+ softmax);
+ RNA_def_property_subtype(prop, PROP_DISTANCE);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ int len,
+ const float *default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
+ if (len != 0)
+ RNA_def_property_array(prop, len);
+ if (default_value)
+ RNA_def_property_float_array_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
+}
+
+PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ float default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
+{
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
+
+ ASSERT_SOFT_HARD_LIMITS;
+
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+
+ return prop;
}
-
-PropertyRNA *RNA_def_float(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description,
- float softmin, float softmax)
+
+PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ float default_value,
+ float hardmin,
+ float hardmax,
+ const char *ui_name,
+ const char *ui_description,
+ float softmin,
+ float softmax)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- ASSERT_SOFT_HARD_LIMITS;
+ ASSERT_SOFT_HARD_LIMITS;
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+ prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, default_value);
+ if (hardmin != hardmax)
+ RNA_def_property_range(prop, hardmin, hardmax);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
+ RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_float_vector(StructOrFunctionRNA *cont_, const char *identifier, int len,
- const float *default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const char *type,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- ASSERT_SOFT_HARD_LIMITS;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_XYZ);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_float_array_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
+ prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, type);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_float_vector_xyz(StructOrFunctionRNA *cont_, const char *identifier, int len,
- const float *default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ StructRNA *type,
+ const char *ui_name,
+ const char *ui_description)
{
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- prop = RNA_def_float_vector(cont_, identifier, len, default_value, hardmin, hardmax, ui_name, ui_description,
- softmin, softmax);
- prop->subtype = PROP_XYZ_LENGTH;
+ prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_runtime(prop, type);
+ if ((type->flag & STRUCT_ID) != 0) {
+ prop->flag |= PROP_EDITABLE;
+ }
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_float_color(StructOrFunctionRNA *cont_, const char *identifier, int len,
- const float *default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
+PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ const char *type,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- ASSERT_SOFT_HARD_LIMITS;
+ prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, type);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_COLOR);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_float_array_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
-
- return prop;
-}
-
-
-PropertyRNA *RNA_def_float_matrix(StructOrFunctionRNA *cont_, const char *identifier, int rows, int columns,
- const float *default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
- const int length[2] = {rows, columns};
-
- ASSERT_SOFT_HARD_LIMITS;
-
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, length);
- if (default_value) RNA_def_property_float_array_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_float_rotation(StructOrFunctionRNA *cont_, const char *identifier, int len,
- const float *default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- ASSERT_SOFT_HARD_LIMITS;
-
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, (len >= 3) ? PROP_EULER : PROP_ANGLE);
- if (len != 0) {
- RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_float_array_default(prop, default_value);
- }
- else {
- /* RNA_def_property_float_default must be called outside */
- BLI_assert(default_value == NULL);
- }
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 10, 3);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_float_distance(StructOrFunctionRNA *cont_, const char *identifier,
- float default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
-{
- PropertyRNA *prop = RNA_def_float(cont_, identifier, default_value,
- hardmin, hardmax, ui_name, ui_description,
- softmin, softmax);
- RNA_def_property_subtype(prop, PROP_DISTANCE);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_float_array(StructOrFunctionRNA *cont_, const char *identifier, int len,
- const float *default_value, float hardmin, float hardmax, const char *ui_name,
- const char *ui_description, float softmin, float softmax)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- ASSERT_SOFT_HARD_LIMITS;
-
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_NONE);
- if (len != 0) RNA_def_property_array(prop, len);
- if (default_value) RNA_def_property_float_array_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_float_percentage(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description,
- float softmin, float softmax)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- ASSERT_SOFT_HARD_LIMITS;
-
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_float_factor(StructOrFunctionRNA *cont_, const char *identifier, float default_value,
- float hardmin, float hardmax, const char *ui_name, const char *ui_description,
- float softmin, float softmax)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- ASSERT_SOFT_HARD_LIMITS;
-
- prop = RNA_def_property(cont, identifier, PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, default_value);
- if (hardmin != hardmax) RNA_def_property_range(prop, hardmin, hardmax);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
- RNA_def_property_ui_range(prop, softmin, softmax, 1, 3);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_pointer(StructOrFunctionRNA *cont_, const char *identifier, const char *type,
- const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, type);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
+ return prop;
}
-PropertyRNA *RNA_def_pointer_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type,
- const char *ui_name, const char *ui_description)
+PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont_,
+ const char *identifier,
+ StructRNA *type,
+ const char *ui_name,
+ const char *ui_description)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- prop = RNA_def_property(cont, identifier, PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_runtime(prop, type);
- if ((type->flag & STRUCT_ID) != 0) {
- prop->flag |= PROP_EDITABLE;
- }
- RNA_def_property_ui_text(prop, ui_name, ui_description);
+ prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_runtime(prop, type);
+ RNA_def_property_ui_text(prop, ui_name, ui_description);
- return prop;
-}
-
-PropertyRNA *RNA_def_collection(StructOrFunctionRNA *cont_, const char *identifier, const char *type,
- const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, type);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
-}
-
-PropertyRNA *RNA_def_collection_runtime(StructOrFunctionRNA *cont_, const char *identifier, StructRNA *type,
- const char *ui_name, const char *ui_description)
-{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
-
- prop = RNA_def_property(cont, identifier, PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_runtime(prop, type);
- RNA_def_property_ui_text(prop, ui_name, ui_description);
-
- return prop;
+ return prop;
}
/* Function */
static FunctionRNA *rna_def_function(StructRNA *srna, const char *identifier)
{
- FunctionRNA *func;
- StructDefRNA *dsrna;
- FunctionDefRNA *dfunc;
+ FunctionRNA *func;
+ StructDefRNA *dsrna;
+ FunctionDefRNA *dfunc;
- if (DefRNA.preprocess) {
- char error[512];
+ if (DefRNA.preprocess) {
+ char error[512];
- if (rna_validate_identifier(identifier, error, false) == 0) {
- CLOG_ERROR(&LOG, "function identifier \"%s\" - %s", identifier, error);
- DefRNA.error = 1;
- }
- }
+ if (rna_validate_identifier(identifier, error, false) == 0) {
+ CLOG_ERROR(&LOG, "function identifier \"%s\" - %s", identifier, error);
+ DefRNA.error = 1;
+ }
+ }
- func = MEM_callocN(sizeof(FunctionRNA), "FunctionRNA");
- func->identifier = identifier;
- func->description = identifier;
+ func = MEM_callocN(sizeof(FunctionRNA), "FunctionRNA");
+ func->identifier = identifier;
+ func->description = identifier;
- rna_addtail(&srna->functions, func);
+ rna_addtail(&srna->functions, func);
- if (DefRNA.preprocess) {
- dsrna = rna_find_struct_def(srna);
- dfunc = MEM_callocN(sizeof(FunctionDefRNA), "FunctionDefRNA");
- rna_addtail(&dsrna->functions, dfunc);
- dfunc->func = func;
- }
- else
- func->flag |= FUNC_RUNTIME;
+ if (DefRNA.preprocess) {
+ dsrna = rna_find_struct_def(srna);
+ dfunc = MEM_callocN(sizeof(FunctionDefRNA), "FunctionDefRNA");
+ rna_addtail(&dsrna->functions, dfunc);
+ dfunc->func = func;
+ }
+ else
+ func->flag |= FUNC_RUNTIME;
- return func;
+ return func;
}
FunctionRNA *RNA_def_function(StructRNA *srna, const char *identifier, const char *call)
{
- FunctionRNA *func;
- FunctionDefRNA *dfunc;
+ FunctionRNA *func;
+ FunctionDefRNA *dfunc;
- if (BLI_findstring_ptr(&srna->functions, identifier, offsetof(FunctionRNA, identifier))) {
- CLOG_ERROR(&LOG, "%s.%s already defined.", srna->identifier, identifier);
- return NULL;
- }
+ if (BLI_findstring_ptr(&srna->functions, identifier, offsetof(FunctionRNA, identifier))) {
+ CLOG_ERROR(&LOG, "%s.%s already defined.", srna->identifier, identifier);
+ return NULL;
+ }
- func = rna_def_function(srna, identifier);
+ func = rna_def_function(srna, identifier);
- if (!DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only at preprocess time.");
- return func;
- }
+ if (!DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only at preprocess time.");
+ return func;
+ }
- dfunc = rna_find_function_def(func);
- dfunc->call = call;
+ dfunc = rna_find_function_def(func);
+ dfunc->call = call;
- return func;
+ return func;
}
FunctionRNA *RNA_def_function_runtime(StructRNA *srna, const char *identifier, CallFunc call)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = rna_def_function(srna, identifier);
+ func = rna_def_function(srna, identifier);
- if (DefRNA.preprocess) {
- CLOG_ERROR(&LOG, "only at runtime.");
- return func;
- }
+ if (DefRNA.preprocess) {
+ CLOG_ERROR(&LOG, "only at runtime.");
+ return func;
+ }
- func->call = call;
+ func->call = call;
-
- return func;
+ return func;
}
/* C return value only!, multiple RNA returns can be done with RNA_def_function_output */
void RNA_def_function_return(FunctionRNA *func, PropertyRNA *ret)
{
- if (ret->flag & PROP_DYNAMIC) {
- CLOG_ERROR(&LOG, "\"%s.%s\", dynamic values are not allowed as strict returns, "
- "use RNA_def_function_output instead.", func->identifier, ret->identifier);
- return;
- }
- else if (ret->arraydimension) {
- CLOG_ERROR(&LOG, "\"%s.%s\", arrays are not allowed as strict returns, "
- "use RNA_def_function_output instead.", func->identifier, ret->identifier);
- return;
- }
-
- BLI_assert(func->c_ret == NULL);
- func->c_ret = ret;
-
- RNA_def_function_output(func, ret);
+ if (ret->flag & PROP_DYNAMIC) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", dynamic values are not allowed as strict returns, "
+ "use RNA_def_function_output instead.",
+ func->identifier,
+ ret->identifier);
+ return;
+ }
+ else if (ret->arraydimension) {
+ CLOG_ERROR(&LOG,
+ "\"%s.%s\", arrays are not allowed as strict returns, "
+ "use RNA_def_function_output instead.",
+ func->identifier,
+ ret->identifier);
+ return;
+ }
+
+ BLI_assert(func->c_ret == NULL);
+ func->c_ret = ret;
+
+ RNA_def_function_output(func, ret);
}
void RNA_def_function_output(FunctionRNA *UNUSED(func), PropertyRNA *ret)
{
- ret->flag_parameter |= PARM_OUTPUT;
+ ret->flag_parameter |= PARM_OUTPUT;
}
void RNA_def_function_flag(FunctionRNA *func, int flag)
{
- func->flag |= flag;
+ func->flag |= flag;
}
void RNA_def_function_ui_description(FunctionRNA *func, const char *description)
{
- func->description = description;
+ func->description = description;
}
int rna_parameter_size(PropertyRNA *parm)
{
- PropertyType ptype = parm->type;
- int len = parm->totarraylength;
-
- /* XXX in other parts is mentioned that strings can be dynamic as well */
- if (parm->flag & PROP_DYNAMIC)
- return sizeof(ParameterDynAlloc);
-
- if (len > 0) {
- switch (ptype) {
- case PROP_BOOLEAN:
- return sizeof(bool) * len;
- case PROP_INT:
- return sizeof(int) * len;
- case PROP_FLOAT:
- return sizeof(float) * len;
- default:
- break;
- }
- }
- else {
- switch (ptype) {
- case PROP_BOOLEAN:
- return sizeof(bool);
- case PROP_INT:
- case PROP_ENUM:
- return sizeof(int);
- case PROP_FLOAT:
- return sizeof(float);
- case PROP_STRING:
- /* return values don't store a pointer to the original */
- if (parm->flag & PROP_THICK_WRAP) {
- StringPropertyRNA *sparm = (StringPropertyRNA *)parm;
- return sizeof(char) * sparm->maxlength;
- }
- else {
- return sizeof(char *);
- }
- case PROP_POINTER:
- {
+ PropertyType ptype = parm->type;
+ int len = parm->totarraylength;
+
+ /* XXX in other parts is mentioned that strings can be dynamic as well */
+ if (parm->flag & PROP_DYNAMIC)
+ return sizeof(ParameterDynAlloc);
+
+ if (len > 0) {
+ switch (ptype) {
+ case PROP_BOOLEAN:
+ return sizeof(bool) * len;
+ case PROP_INT:
+ return sizeof(int) * len;
+ case PROP_FLOAT:
+ return sizeof(float) * len;
+ default:
+ break;
+ }
+ }
+ else {
+ switch (ptype) {
+ case PROP_BOOLEAN:
+ return sizeof(bool);
+ case PROP_INT:
+ case PROP_ENUM:
+ return sizeof(int);
+ case PROP_FLOAT:
+ return sizeof(float);
+ case PROP_STRING:
+ /* return values don't store a pointer to the original */
+ if (parm->flag & PROP_THICK_WRAP) {
+ StringPropertyRNA *sparm = (StringPropertyRNA *)parm;
+ return sizeof(char) * sparm->maxlength;
+ }
+ else {
+ return sizeof(char *);
+ }
+ case PROP_POINTER: {
#ifdef RNA_RUNTIME
- if (parm->flag_parameter & PARM_RNAPTR)
- if (parm->flag & PROP_THICK_WRAP) {
- return sizeof(PointerRNA);
- }
- else {
- return sizeof(PointerRNA *);
- }
- else
- return sizeof(void *);
+ if (parm->flag_parameter & PARM_RNAPTR)
+ if (parm->flag & PROP_THICK_WRAP) {
+ return sizeof(PointerRNA);
+ }
+ else {
+ return sizeof(PointerRNA *);
+ }
+ else
+ return sizeof(void *);
#else
- if (parm->flag_parameter & PARM_RNAPTR) {
- if (parm->flag & PROP_THICK_WRAP) {
- return sizeof(PointerRNA);
- }
- else {
- return sizeof(PointerRNA *);
- }
- }
- else {
- return sizeof(void *);
- }
+ if (parm->flag_parameter & PARM_RNAPTR) {
+ if (parm->flag & PROP_THICK_WRAP) {
+ return sizeof(PointerRNA);
+ }
+ else {
+ return sizeof(PointerRNA *);
+ }
+ }
+ else {
+ return sizeof(void *);
+ }
#endif
- }
- case PROP_COLLECTION:
- return sizeof(ListBase);
- }
- }
+ }
+ case PROP_COLLECTION:
+ return sizeof(ListBase);
+ }
+ }
- return sizeof(void *);
+ return sizeof(void *);
}
/* Dynamic Enums */
void RNA_enum_item_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
{
- EnumPropertyItem *newitems;
- int tot = *totitem;
+ EnumPropertyItem *newitems;
+ int tot = *totitem;
- if (tot == 0) {
- *items = MEM_callocN(sizeof(EnumPropertyItem) * 8, "RNA_enum_items_add");
- }
- else if (tot >= 8 && (tot & (tot - 1)) == 0) {
- /* power of two > 8 */
- newitems = MEM_callocN(sizeof(EnumPropertyItem) * tot * 2, "RNA_enum_items_add");
- memcpy(newitems, *items, sizeof(EnumPropertyItem) * tot);
- MEM_freeN(*items);
- *items = newitems;
- }
+ if (tot == 0) {
+ *items = MEM_callocN(sizeof(EnumPropertyItem) * 8, "RNA_enum_items_add");
+ }
+ else if (tot >= 8 && (tot & (tot - 1)) == 0) {
+ /* power of two > 8 */
+ newitems = MEM_callocN(sizeof(EnumPropertyItem) * tot * 2, "RNA_enum_items_add");
+ memcpy(newitems, *items, sizeof(EnumPropertyItem) * tot);
+ MEM_freeN(*items);
+ *items = newitems;
+ }
- (*items)[tot] = *item;
- *totitem = tot + 1;
+ (*items)[tot] = *item;
+ *totitem = tot + 1;
}
void RNA_enum_item_add_separator(EnumPropertyItem **items, int *totitem)
{
- static const EnumPropertyItem sepr = {0, "", 0, NULL, NULL};
- RNA_enum_item_add(items, totitem, &sepr);
+ static const EnumPropertyItem sepr = {0, "", 0, NULL, NULL};
+ RNA_enum_item_add(items, totitem, &sepr);
}
void RNA_enum_items_add(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item)
{
- for (; item->identifier; item++)
- RNA_enum_item_add(items, totitem, item);
+ for (; item->identifier; item++)
+ RNA_enum_item_add(items, totitem, item);
}
-void RNA_enum_items_add_value(EnumPropertyItem **items, int *totitem, const EnumPropertyItem *item, int value)
+void RNA_enum_items_add_value(EnumPropertyItem **items,
+ int *totitem,
+ const EnumPropertyItem *item,
+ int value)
{
- for (; item->identifier; item++) {
- if (item->value == value) {
- RNA_enum_item_add(items, totitem, item);
- /* break on first match - does this break anything?
- * (is quick hack to get object->parent_type working ok for armature/lattice) */
- break;
- }
- }
+ for (; item->identifier; item++) {
+ if (item->value == value) {
+ RNA_enum_item_add(items, totitem, item);
+ /* break on first match - does this break anything?
+ * (is quick hack to get object->parent_type working ok for armature/lattice) */
+ break;
+ }
+ }
}
void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
{
- static const EnumPropertyItem empty = {0, NULL, 0, NULL, NULL};
- RNA_enum_item_add(items, totitem, &empty);
+ static const EnumPropertyItem empty = {0, NULL, 0, NULL, NULL};
+ RNA_enum_item_add(items, totitem, &empty);
}
/* Memory management */
@@ -3422,266 +3792,269 @@ void RNA_enum_item_end(EnumPropertyItem **items, int *totitem)
#ifdef RNA_RUNTIME
void RNA_def_struct_duplicate_pointers(BlenderRNA *brna, StructRNA *srna)
{
- if (srna->identifier) {
- srna->identifier = BLI_strdup(srna->identifier);
- if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
- BLI_ghash_replace_key(brna->structs_map, (void *)srna->identifier);
- }
- }
- if (srna->name) {
- srna->name = BLI_strdup(srna->name);
- }
- if (srna->description) {
- srna->description = BLI_strdup(srna->description);
- }
+ if (srna->identifier) {
+ srna->identifier = BLI_strdup(srna->identifier);
+ if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
+ BLI_ghash_replace_key(brna->structs_map, (void *)srna->identifier);
+ }
+ }
+ if (srna->name) {
+ srna->name = BLI_strdup(srna->name);
+ }
+ if (srna->description) {
+ srna->description = BLI_strdup(srna->description);
+ }
- srna->flag |= STRUCT_FREE_POINTERS;
+ srna->flag |= STRUCT_FREE_POINTERS;
}
void RNA_def_struct_free_pointers(BlenderRNA *brna, StructRNA *srna)
{
- if (srna->flag & STRUCT_FREE_POINTERS) {
- if (srna->identifier) {
- if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
- if (brna != NULL) {
- BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
- }
- }
- MEM_freeN((void *)srna->identifier);
- }
- if (srna->name) {
- MEM_freeN((void *)srna->name);
- }
- if (srna->description) {
- MEM_freeN((void *)srna->description);
- }
- }
+ if (srna->flag & STRUCT_FREE_POINTERS) {
+ if (srna->identifier) {
+ if (srna->flag & STRUCT_PUBLIC_NAMESPACE) {
+ if (brna != NULL) {
+ BLI_ghash_remove(brna->structs_map, (void *)srna->identifier, NULL, NULL);
+ }
+ }
+ MEM_freeN((void *)srna->identifier);
+ }
+ if (srna->name) {
+ MEM_freeN((void *)srna->name);
+ }
+ if (srna->description) {
+ MEM_freeN((void *)srna->description);
+ }
+ }
}
void RNA_def_func_duplicate_pointers(FunctionRNA *func)
{
- if (func->identifier) func->identifier = BLI_strdup(func->identifier);
- if (func->description) func->description = BLI_strdup(func->description);
+ if (func->identifier)
+ func->identifier = BLI_strdup(func->identifier);
+ if (func->description)
+ func->description = BLI_strdup(func->description);
- func->flag |= FUNC_FREE_POINTERS;
+ func->flag |= FUNC_FREE_POINTERS;
}
void RNA_def_func_free_pointers(FunctionRNA *func)
{
- if (func->flag & FUNC_FREE_POINTERS) {
- if (func->identifier) MEM_freeN((void *)func->identifier);
- if (func->description) MEM_freeN((void *)func->description);
- }
+ if (func->flag & FUNC_FREE_POINTERS) {
+ if (func->identifier)
+ MEM_freeN((void *)func->identifier);
+ if (func->description)
+ MEM_freeN((void *)func->description);
+ }
}
void RNA_def_property_duplicate_pointers(StructOrFunctionRNA *cont_, PropertyRNA *prop)
{
- ContainerRNA *cont = cont_;
- int a;
-
- /* annoying since we just added this to a hash, could make this add the correct key to the hash
- * in the first place */
- if (prop->identifier) {
- if (cont->prophash) {
- prop->identifier = BLI_strdup(prop->identifier);
- BLI_ghash_reinsert(cont->prophash, (void *)prop->identifier, prop, NULL, NULL);
- }
- else {
- prop->identifier = BLI_strdup(prop->identifier);
- }
- }
-
- if (prop->name) {
- prop->name = BLI_strdup(prop->name);
- }
- if (prop->description) {
- prop->description = BLI_strdup(prop->description);
- }
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
-
- if (bprop->defaultarray) {
- bool *array = MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store");
- memcpy(array, bprop->defaultarray, sizeof(bool) * prop->totarraylength);
- bprop->defaultarray = array;
- }
- break;
- }
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
-
- if (iprop->defaultarray) {
- int *array = MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store");
- memcpy(array, iprop->defaultarray, sizeof(int) * prop->totarraylength);
- iprop->defaultarray = array;
- }
- break;
- }
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
-
- if (eprop->item) {
- EnumPropertyItem *array = MEM_mallocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1), "RNA_def_property_store");
- memcpy(array, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1));
- eprop->item = array;
-
- for (a = 0; a < eprop->totitem; a++) {
- if (array[a].identifier) {
- array[a].identifier = BLI_strdup(array[a].identifier);
- }
- if (array[a].name) {
- array[a].name = BLI_strdup(array[a].name);
- }
- if (array[a].description) {
- array[a].description = BLI_strdup(array[a].description);
- }
- }
- }
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
-
- if (fprop->defaultarray) {
- float *array = MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store");
- memcpy(array, fprop->defaultarray, sizeof(float) * prop->totarraylength);
- fprop->defaultarray = array;
- }
- break;
- }
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- if (sprop->defaultvalue)
- sprop->defaultvalue = BLI_strdup(sprop->defaultvalue);
- break;
- }
- default:
- break;
- }
-
- prop->flag_internal |= PROP_INTERN_FREE_POINTERS;
+ ContainerRNA *cont = cont_;
+ int a;
+
+ /* annoying since we just added this to a hash, could make this add the correct key to the hash
+ * in the first place */
+ if (prop->identifier) {
+ if (cont->prophash) {
+ prop->identifier = BLI_strdup(prop->identifier);
+ BLI_ghash_reinsert(cont->prophash, (void *)prop->identifier, prop, NULL, NULL);
+ }
+ else {
+ prop->identifier = BLI_strdup(prop->identifier);
+ }
+ }
+
+ if (prop->name) {
+ prop->name = BLI_strdup(prop->name);
+ }
+ if (prop->description) {
+ prop->description = BLI_strdup(prop->description);
+ }
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+
+ if (bprop->defaultarray) {
+ bool *array = MEM_mallocN(sizeof(bool) * prop->totarraylength, "RNA_def_property_store");
+ memcpy(array, bprop->defaultarray, sizeof(bool) * prop->totarraylength);
+ bprop->defaultarray = array;
+ }
+ break;
+ }
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+
+ if (iprop->defaultarray) {
+ int *array = MEM_mallocN(sizeof(int) * prop->totarraylength, "RNA_def_property_store");
+ memcpy(array, iprop->defaultarray, sizeof(int) * prop->totarraylength);
+ iprop->defaultarray = array;
+ }
+ break;
+ }
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+
+ if (eprop->item) {
+ EnumPropertyItem *array = MEM_mallocN(sizeof(EnumPropertyItem) * (eprop->totitem + 1),
+ "RNA_def_property_store");
+ memcpy(array, eprop->item, sizeof(EnumPropertyItem) * (eprop->totitem + 1));
+ eprop->item = array;
+
+ for (a = 0; a < eprop->totitem; a++) {
+ if (array[a].identifier) {
+ array[a].identifier = BLI_strdup(array[a].identifier);
+ }
+ if (array[a].name) {
+ array[a].name = BLI_strdup(array[a].name);
+ }
+ if (array[a].description) {
+ array[a].description = BLI_strdup(array[a].description);
+ }
+ }
+ }
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+
+ if (fprop->defaultarray) {
+ float *array = MEM_mallocN(sizeof(float) * prop->totarraylength, "RNA_def_property_store");
+ memcpy(array, fprop->defaultarray, sizeof(float) * prop->totarraylength);
+ fprop->defaultarray = array;
+ }
+ break;
+ }
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ if (sprop->defaultvalue)
+ sprop->defaultvalue = BLI_strdup(sprop->defaultvalue);
+ break;
+ }
+ default:
+ break;
+ }
+
+ prop->flag_internal |= PROP_INTERN_FREE_POINTERS;
}
void RNA_def_property_free_pointers(PropertyRNA *prop)
{
- if (prop->flag_internal & PROP_INTERN_FREE_POINTERS) {
- int a;
-
- if (prop->identifier)
- MEM_freeN((void *)prop->identifier);
- if (prop->name)
- MEM_freeN((void *)prop->name);
- if (prop->description)
- MEM_freeN((void *)prop->description);
- if (prop->py_data)
- MEM_freeN(prop->py_data);
-
- switch (prop->type) {
- case PROP_BOOLEAN:
- {
- BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
- if (bprop->defaultarray)
- MEM_freeN((void *)bprop->defaultarray);
- break;
- }
- case PROP_INT:
- {
- IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
- if (iprop->defaultarray)
- MEM_freeN((void *)iprop->defaultarray);
- break;
- }
- case PROP_FLOAT:
- {
- FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
- if (fprop->defaultarray)
- MEM_freeN((void *)fprop->defaultarray);
- break;
- }
- case PROP_ENUM:
- {
- EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
-
- for (a = 0; a < eprop->totitem; a++) {
- if (eprop->item[a].identifier)
- MEM_freeN((void *)eprop->item[a].identifier);
- if (eprop->item[a].name)
- MEM_freeN((void *)eprop->item[a].name);
- if (eprop->item[a].description)
- MEM_freeN((void *)eprop->item[a].description);
- }
-
- if (eprop->item) MEM_freeN((void *)eprop->item);
- break;
- }
- case PROP_STRING:
- {
- StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
- if (sprop->defaultvalue)
- MEM_freeN((void *)sprop->defaultvalue);
- break;
- }
- default:
- break;
- }
- }
+ if (prop->flag_internal & PROP_INTERN_FREE_POINTERS) {
+ int a;
+
+ if (prop->identifier)
+ MEM_freeN((void *)prop->identifier);
+ if (prop->name)
+ MEM_freeN((void *)prop->name);
+ if (prop->description)
+ MEM_freeN((void *)prop->description);
+ if (prop->py_data)
+ MEM_freeN(prop->py_data);
+
+ switch (prop->type) {
+ case PROP_BOOLEAN: {
+ BoolPropertyRNA *bprop = (BoolPropertyRNA *)prop;
+ if (bprop->defaultarray)
+ MEM_freeN((void *)bprop->defaultarray);
+ break;
+ }
+ case PROP_INT: {
+ IntPropertyRNA *iprop = (IntPropertyRNA *)prop;
+ if (iprop->defaultarray)
+ MEM_freeN((void *)iprop->defaultarray);
+ break;
+ }
+ case PROP_FLOAT: {
+ FloatPropertyRNA *fprop = (FloatPropertyRNA *)prop;
+ if (fprop->defaultarray)
+ MEM_freeN((void *)fprop->defaultarray);
+ break;
+ }
+ case PROP_ENUM: {
+ EnumPropertyRNA *eprop = (EnumPropertyRNA *)prop;
+
+ for (a = 0; a < eprop->totitem; a++) {
+ if (eprop->item[a].identifier)
+ MEM_freeN((void *)eprop->item[a].identifier);
+ if (eprop->item[a].name)
+ MEM_freeN((void *)eprop->item[a].name);
+ if (eprop->item[a].description)
+ MEM_freeN((void *)eprop->item[a].description);
+ }
+
+ if (eprop->item)
+ MEM_freeN((void *)eprop->item);
+ break;
+ }
+ case PROP_STRING: {
+ StringPropertyRNA *sprop = (StringPropertyRNA *)prop;
+ if (sprop->defaultvalue)
+ MEM_freeN((void *)sprop->defaultvalue);
+ break;
+ }
+ default:
+ break;
+ }
+ }
}
static void rna_def_property_free(StructOrFunctionRNA *cont_, PropertyRNA *prop)
{
- ContainerRNA *cont = cont_;
+ ContainerRNA *cont = cont_;
- if (prop->flag_internal & PROP_INTERN_RUNTIME) {
- if (cont->prophash)
- BLI_ghash_remove(cont->prophash, prop->identifier, NULL, NULL);
+ if (prop->flag_internal & PROP_INTERN_RUNTIME) {
+ if (cont->prophash)
+ BLI_ghash_remove(cont->prophash, prop->identifier, NULL, NULL);
- RNA_def_property_free_pointers(prop);
- rna_freelinkN(&cont->properties, prop);
- }
- else {
- RNA_def_property_free_pointers(prop);
- }
+ RNA_def_property_free_pointers(prop);
+ rna_freelinkN(&cont->properties, prop);
+ }
+ else {
+ RNA_def_property_free_pointers(prop);
+ }
}
/* note: only intended for removing dynamic props */
int RNA_def_property_free_identifier(StructOrFunctionRNA *cont_, const char *identifier)
{
- ContainerRNA *cont = cont_;
- PropertyRNA *prop;
+ ContainerRNA *cont = cont_;
+ PropertyRNA *prop;
- for (prop = cont->properties.first; prop; prop = prop->next) {
- if (STREQ(prop->identifier, identifier)) {
- if (prop->flag_internal & PROP_INTERN_RUNTIME) {
- rna_def_property_free(cont_, prop);
- return 1;
- }
- else {
- return -1;
- }
- }
- }
- return 0;
+ for (prop = cont->properties.first; prop; prop = prop->next) {
+ if (STREQ(prop->identifier, identifier)) {
+ if (prop->flag_internal & PROP_INTERN_RUNTIME) {
+ rna_def_property_free(cont_, prop);
+ return 1;
+ }
+ else {
+ return -1;
+ }
+ }
+ }
+ return 0;
}
-#endif /* RNA_RUNTIME */
+#endif /* RNA_RUNTIME */
const char *RNA_property_typename(PropertyType type)
{
- switch (type) {
- case PROP_BOOLEAN: return "PROP_BOOLEAN";
- case PROP_INT: return "PROP_INT";
- case PROP_FLOAT: return "PROP_FLOAT";
- case PROP_STRING: return "PROP_STRING";
- case PROP_ENUM: return "PROP_ENUM";
- case PROP_POINTER: return "PROP_POINTER";
- case PROP_COLLECTION: return "PROP_COLLECTION";
- }
-
- return "PROP_UNKNOWN";
+ switch (type) {
+ case PROP_BOOLEAN:
+ return "PROP_BOOLEAN";
+ case PROP_INT:
+ return "PROP_INT";
+ case PROP_FLOAT:
+ return "PROP_FLOAT";
+ case PROP_STRING:
+ return "PROP_STRING";
+ case PROP_ENUM:
+ return "PROP_ENUM";
+ case PROP_POINTER:
+ return "PROP_POINTER";
+ case PROP_COLLECTION:
+ return "PROP_COLLECTION";
+ }
+
+ return "PROP_UNKNOWN";
}
diff --git a/source/blender/makesrna/intern/rna_depsgraph.c b/source/blender/makesrna/intern/rna_depsgraph.c
index 8c2148896fd..3df4feba024 100644
--- a/source/blender/makesrna/intern/rna_depsgraph.c
+++ b/source/blender/makesrna/intern/rna_depsgraph.c
@@ -36,257 +36,259 @@
#ifdef RNA_RUNTIME
-#include "BLI_iterator.h"
-#include "BLI_math.h"
+# include "BLI_iterator.h"
+# include "BLI_math.h"
-#include "BKE_anim.h"
-#include "BKE_object.h"
+# include "BKE_anim.h"
+# include "BKE_object.h"
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_debug.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph_debug.h"
+# include "DEG_depsgraph_query.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
/* **************** Object Instance **************** */
static PointerRNA rna_DepsgraphObjectInstance_object_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Object, iterator->current);
+ BLI_Iterator *iterator = ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, iterator->current);
}
static int rna_DepsgraphObjectInstance_is_instance_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- return (deg_iter->dupli_object_current != NULL);
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ return (deg_iter->dupli_object_current != NULL);
}
static PointerRNA rna_DepsgraphObjectInstance_instance_object_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- Object *instance_object = NULL;
- if (deg_iter->dupli_object_current != NULL) {
- instance_object = deg_iter->dupli_object_current->ob;
- }
- return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object);
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ Object *instance_object = NULL;
+ if (deg_iter->dupli_object_current != NULL) {
+ instance_object = deg_iter->dupli_object_current->ob;
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, instance_object);
}
static bool rna_DepsgraphObjectInstance_show_self_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
- return (ob_visibility & OB_VISIBLE_SELF) != 0;
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
+ return (ob_visibility & OB_VISIBLE_SELF) != 0;
}
static bool rna_DepsgraphObjectInstance_show_particles_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
- return (ob_visibility & OB_VISIBLE_PARTICLES) != 0;
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ int ob_visibility = BKE_object_visibility(iterator->current, deg_iter->eval_mode);
+ return (ob_visibility & OB_VISIBLE_PARTICLES) != 0;
}
static PointerRNA rna_DepsgraphObjectInstance_parent_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- Object *dupli_parent = NULL;
- if (deg_iter->dupli_object_current != NULL) {
- dupli_parent = deg_iter->dupli_parent;
- }
- return rna_pointer_inherit_refine(ptr, &RNA_Object, dupli_parent);
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ Object *dupli_parent = NULL;
+ if (deg_iter->dupli_object_current != NULL) {
+ dupli_parent = deg_iter->dupli_parent;
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, dupli_parent);
}
static PointerRNA rna_DepsgraphObjectInstance_particle_system_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- struct ParticleSystem *particle_system = NULL;
- if (deg_iter->dupli_object_current != NULL) {
- particle_system = deg_iter->dupli_object_current->particle_system;
- }
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, particle_system);
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ struct ParticleSystem *particle_system = NULL;
+ if (deg_iter->dupli_object_current != NULL) {
+ particle_system = deg_iter->dupli_object_current->particle_system;
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, particle_system);
}
static void rna_DepsgraphObjectInstance_persistent_id_get(PointerRNA *ptr, int *persistent_id)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- if (deg_iter->dupli_object_current != NULL) {
- memcpy(persistent_id, deg_iter->dupli_object_current->persistent_id,
- sizeof(deg_iter->dupli_object_current->persistent_id));
- }
- else {
- memset(persistent_id, 0, sizeof(deg_iter->dupli_object_current->persistent_id));
- }
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ if (deg_iter->dupli_object_current != NULL) {
+ memcpy(persistent_id,
+ deg_iter->dupli_object_current->persistent_id,
+ sizeof(deg_iter->dupli_object_current->persistent_id));
+ }
+ else {
+ memset(persistent_id, 0, sizeof(deg_iter->dupli_object_current->persistent_id));
+ }
}
static unsigned int rna_DepsgraphObjectInstance_random_id_get(PointerRNA *ptr)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- if (deg_iter->dupli_object_current != NULL) {
- return deg_iter->dupli_object_current->random_id;
- }
- else {
- return 0;
- }
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ if (deg_iter->dupli_object_current != NULL) {
+ return deg_iter->dupli_object_current->random_id;
+ }
+ else {
+ return 0;
+ }
}
static void rna_DepsgraphObjectInstance_matrix_world_get(PointerRNA *ptr, float *mat)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- if (deg_iter->dupli_object_current != NULL) {
- copy_m4_m4((float(*)[4])mat, deg_iter->dupli_object_current->mat);
- }
- else {
- /* We can return actual object's matrix here, no reason to return identity matrix
- * when this is not actually an instance... */
- Object *ob = (Object *)iterator->current;
- copy_m4_m4((float(*)[4])mat, ob->obmat);
- }
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ if (deg_iter->dupli_object_current != NULL) {
+ copy_m4_m4((float(*)[4])mat, deg_iter->dupli_object_current->mat);
+ }
+ else {
+ /* We can return actual object's matrix here, no reason to return identity matrix
+ * when this is not actually an instance... */
+ Object *ob = (Object *)iterator->current;
+ copy_m4_m4((float(*)[4])mat, ob->obmat);
+ }
}
static void rna_DepsgraphObjectInstance_orco_get(PointerRNA *ptr, float *orco)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- if (deg_iter->dupli_object_current != NULL) {
- copy_v3_v3(orco, deg_iter->dupli_object_current->orco);
- }
- else {
- zero_v3(orco);
- }
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ if (deg_iter->dupli_object_current != NULL) {
+ copy_v3_v3(orco, deg_iter->dupli_object_current->orco);
+ }
+ else {
+ zero_v3(orco);
+ }
}
static void rna_DepsgraphObjectInstance_uv_get(PointerRNA *ptr, float *uv)
{
- BLI_Iterator *iterator = ptr->data;
- DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
- if (deg_iter->dupli_object_current != NULL) {
- copy_v2_v2(uv, deg_iter->dupli_object_current->uv);
- }
- else {
- zero_v2(uv);
- }
+ BLI_Iterator *iterator = ptr->data;
+ DEGObjectIterData *deg_iter = (DEGObjectIterData *)iterator->data;
+ if (deg_iter->dupli_object_current != NULL) {
+ copy_v2_v2(uv, deg_iter->dupli_object_current->uv);
+ }
+ else {
+ zero_v2(uv);
+ }
}
/* ******************** Sorted ***************** */
static int rna_Depsgraph_mode_get(PointerRNA *ptr)
{
- Depsgraph *depsgraph = ptr->data;
- return DEG_get_mode(depsgraph);
+ Depsgraph *depsgraph = ptr->data;
+ return DEG_get_mode(depsgraph);
}
/* ******************** Updates ***************** */
static PointerRNA rna_DepsgraphUpdate_id_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ID, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_ID, ptr->data);
}
static bool rna_DepsgraphUpdate_is_updated_transform_get(PointerRNA *ptr)
{
- ID *id = ptr->data;
- return ((id->recalc & ID_RECALC_TRANSFORM) != 0);
+ ID *id = ptr->data;
+ return ((id->recalc & ID_RECALC_TRANSFORM) != 0);
}
static bool rna_DepsgraphUpdate_is_updated_geometry_get(PointerRNA *ptr)
{
- ID *id = ptr->data;
- if (id->recalc & ID_RECALC_GEOMETRY) {
- return true;
- }
- if (GS(id->name) != ID_OB) {
- return false;
- }
- Object *object = (Object *)id;
- ID *data = object->data;
- if (data == NULL) {
- return false;
- }
- return ((data->recalc & ID_RECALC_ALL) != 0);
+ ID *id = ptr->data;
+ if (id->recalc & ID_RECALC_GEOMETRY) {
+ return true;
+ }
+ if (GS(id->name) != ID_OB) {
+ return false;
+ }
+ Object *object = (Object *)id;
+ ID *data = object->data;
+ if (data == NULL) {
+ return false;
+ }
+ return ((data->recalc & ID_RECALC_ALL) != 0);
}
/* **************** Depsgraph **************** */
-static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *depsgraph,
- const char *filename)
+static void rna_Depsgraph_debug_relations_graphviz(Depsgraph *depsgraph, const char *filename)
{
- FILE *f = fopen(filename, "w");
- if (f == NULL) {
- return;
- }
- DEG_debug_relations_graphviz(depsgraph, f, "Depsgraph");
- fclose(f);
+ FILE *f = fopen(filename, "w");
+ if (f == NULL) {
+ return;
+ }
+ DEG_debug_relations_graphviz(depsgraph, f, "Depsgraph");
+ fclose(f);
}
static void rna_Depsgraph_debug_stats_gnuplot(Depsgraph *depsgraph,
const char *filename,
const char *output_filename)
{
- FILE *f = fopen(filename, "w");
- if (f == NULL) {
- return;
- }
- DEG_debug_stats_gnuplot(depsgraph, f, "Timing Statistics", output_filename);
- fclose(f);
+ FILE *f = fopen(filename, "w");
+ if (f == NULL) {
+ return;
+ }
+ DEG_debug_stats_gnuplot(depsgraph, f, "Timing Statistics", output_filename);
+ fclose(f);
}
static void rna_Depsgraph_debug_tag_update(Depsgraph *depsgraph)
{
- DEG_graph_tag_relations_update(depsgraph);
+ DEG_graph_tag_relations_update(depsgraph);
}
static void rna_Depsgraph_debug_stats(Depsgraph *depsgraph, char *result)
{
- size_t outer, ops, rels;
- DEG_stats_simple(depsgraph, &outer, &ops, &rels);
- BLI_snprintf(result, STATS_MAX_SIZE,
- "Approx %lu Operations, %lu Relations, %lu Outer Nodes",
- ops, rels, outer);
+ size_t outer, ops, rels;
+ DEG_stats_simple(depsgraph, &outer, &ops, &rels);
+ BLI_snprintf(result,
+ STATS_MAX_SIZE,
+ "Approx %lu Operations, %lu Relations, %lu Outer Nodes",
+ ops,
+ rels,
+ outer);
}
/* Iteration over objects, simple version */
static void rna_Depsgraph_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
- DEGObjectIterData *data = MEM_callocN(sizeof(DEGObjectIterData), __func__);
+ iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
+ DEGObjectIterData *data = MEM_callocN(sizeof(DEGObjectIterData), __func__);
- data->graph = (Depsgraph *)ptr->data;
- data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
- DEG_ITER_OBJECT_FLAG_VISIBLE |
- DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
+ data->graph = (Depsgraph *)ptr->data;
+ data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_VISIBLE |
+ DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET;
- ((BLI_Iterator *)iter->internal.custom)->valid = true;
- DEG_iterator_objects_begin(iter->internal.custom, data);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ ((BLI_Iterator *)iter->internal.custom)->valid = true;
+ DEG_iterator_objects_begin(iter->internal.custom, data);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static void rna_Depsgraph_objects_next(CollectionPropertyIterator *iter)
{
- DEG_iterator_objects_next(iter->internal.custom);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ DEG_iterator_objects_next(iter->internal.custom);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static void rna_Depsgraph_objects_end(CollectionPropertyIterator *iter)
{
- DEG_iterator_objects_end(iter->internal.custom);
- MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
- MEM_freeN(iter->internal.custom);
+ DEG_iterator_objects_end(iter->internal.custom);
+ MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
+ MEM_freeN(iter->internal.custom);
}
static PointerRNA rna_Depsgraph_objects_get(CollectionPropertyIterator *iter)
{
- Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
+ Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
}
/* Iteration over objects, extended version
@@ -298,402 +300,451 @@ static PointerRNA rna_Depsgraph_objects_get(CollectionPropertyIterator *iter)
* This forces us to use that nasty ping-pong game between two sets of iterator data, so that previous one remains
* valid memory for python to access to. Yuck.
*/
-typedef struct RNA_Depsgraph_Instances_Iterator
-{
- BLI_Iterator iterators[2];
- DEGObjectIterData deg_data[2];
- DupliObject dupli_object_current[2];
- int counter;
+typedef struct RNA_Depsgraph_Instances_Iterator {
+ BLI_Iterator iterators[2];
+ DEGObjectIterData deg_data[2];
+ DupliObject dupli_object_current[2];
+ int counter;
} RNA_Depsgraph_Instances_Iterator;
static void rna_Depsgraph_object_instances_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- RNA_Depsgraph_Instances_Iterator *di_it = iter->internal.custom = MEM_callocN(sizeof(*di_it), __func__);
+ RNA_Depsgraph_Instances_Iterator *di_it = iter->internal.custom = MEM_callocN(sizeof(*di_it),
+ __func__);
- DEGObjectIterData *data = &di_it->deg_data[0];
- data->graph = (Depsgraph *)ptr->data;
- data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY |
- DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
- DEG_ITER_OBJECT_FLAG_VISIBLE |
- DEG_ITER_OBJECT_FLAG_DUPLI;
+ DEGObjectIterData *data = &di_it->deg_data[0];
+ data->graph = (Depsgraph *)ptr->data;
+ data->flag = DEG_ITER_OBJECT_FLAG_LINKED_DIRECTLY | DEG_ITER_OBJECT_FLAG_LINKED_VIA_SET |
+ DEG_ITER_OBJECT_FLAG_VISIBLE | DEG_ITER_OBJECT_FLAG_DUPLI;
- di_it->iterators[0].valid = true;
- DEG_iterator_objects_begin(&di_it->iterators[0], data);
- iter->valid = di_it->iterators[0].valid;
+ di_it->iterators[0].valid = true;
+ DEG_iterator_objects_begin(&di_it->iterators[0], data);
+ iter->valid = di_it->iterators[0].valid;
}
static void rna_Depsgraph_object_instances_next(CollectionPropertyIterator *iter)
{
- RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)iter->internal.custom;
+ RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)
+ iter->internal.custom;
- /* We need to copy current iterator status to next one beeing worked on. */
- di_it->iterators[(di_it->counter + 1) % 2] = di_it->iterators[di_it->counter % 2];
- di_it->deg_data[(di_it->counter + 1) % 2] = di_it->deg_data[di_it->counter % 2];
- di_it->counter++;
+ /* We need to copy current iterator status to next one beeing worked on. */
+ di_it->iterators[(di_it->counter + 1) % 2] = di_it->iterators[di_it->counter % 2];
+ di_it->deg_data[(di_it->counter + 1) % 2] = di_it->deg_data[di_it->counter % 2];
+ di_it->counter++;
- di_it->iterators[di_it->counter % 2].data = &di_it->deg_data[di_it->counter % 2];
- DEG_iterator_objects_next(&di_it->iterators[di_it->counter % 2]);
- /* Dupli_object_current is also temp memory generated during the iterations,
- * it may be freed when last item has been iterated, so we have same issue as with the iterator itself:
- * we need to keep a local copy, which memory remains valid a bit longer, for python accesses to work. */
- if (di_it->deg_data[di_it->counter % 2].dupli_object_current != NULL) {
- di_it->dupli_object_current[di_it->counter % 2] = *di_it->deg_data[di_it->counter % 2].dupli_object_current;
- di_it->deg_data[di_it->counter % 2].dupli_object_current = &di_it->dupli_object_current[di_it->counter % 2];
- }
- iter->valid = di_it->iterators[di_it->counter % 2].valid;
+ di_it->iterators[di_it->counter % 2].data = &di_it->deg_data[di_it->counter % 2];
+ DEG_iterator_objects_next(&di_it->iterators[di_it->counter % 2]);
+ /* Dupli_object_current is also temp memory generated during the iterations,
+ * it may be freed when last item has been iterated, so we have same issue as with the iterator itself:
+ * we need to keep a local copy, which memory remains valid a bit longer, for python accesses to work. */
+ if (di_it->deg_data[di_it->counter % 2].dupli_object_current != NULL) {
+ di_it->dupli_object_current[di_it->counter % 2] =
+ *di_it->deg_data[di_it->counter % 2].dupli_object_current;
+ di_it->deg_data[di_it->counter % 2].dupli_object_current =
+ &di_it->dupli_object_current[di_it->counter % 2];
+ }
+ iter->valid = di_it->iterators[di_it->counter % 2].valid;
}
static void rna_Depsgraph_object_instances_end(CollectionPropertyIterator *iter)
{
- RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)iter->internal.custom;
- DEG_iterator_objects_end(&di_it->iterators[0]);
- DEG_iterator_objects_end(&di_it->iterators[1]);
- MEM_freeN(di_it);
+ RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)
+ iter->internal.custom;
+ DEG_iterator_objects_end(&di_it->iterators[0]);
+ DEG_iterator_objects_end(&di_it->iterators[1]);
+ MEM_freeN(di_it);
}
static PointerRNA rna_Depsgraph_object_instances_get(CollectionPropertyIterator *iter)
{
- RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)iter->internal.custom;
- BLI_Iterator *iterator = &di_it->iterators[di_it->counter % 2];
- return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphObjectInstance, iterator);
+ RNA_Depsgraph_Instances_Iterator *di_it = (RNA_Depsgraph_Instances_Iterator *)
+ iter->internal.custom;
+ BLI_Iterator *iterator = &di_it->iterators[di_it->counter % 2];
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphObjectInstance, iterator);
}
/* Iteration over evaluated IDs */
static void rna_Depsgraph_ids_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
- DEGIDIterData *data = MEM_callocN(sizeof(DEGIDIterData), __func__);
+ iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
+ DEGIDIterData *data = MEM_callocN(sizeof(DEGIDIterData), __func__);
- data->graph = (Depsgraph *)ptr->data;
+ data->graph = (Depsgraph *)ptr->data;
- ((BLI_Iterator *)iter->internal.custom)->valid = true;
- DEG_iterator_ids_begin(iter->internal.custom, data);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ ((BLI_Iterator *)iter->internal.custom)->valid = true;
+ DEG_iterator_ids_begin(iter->internal.custom, data);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static void rna_Depsgraph_ids_next(CollectionPropertyIterator *iter)
{
- DEG_iterator_ids_next(iter->internal.custom);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ DEG_iterator_ids_next(iter->internal.custom);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static void rna_Depsgraph_ids_end(CollectionPropertyIterator *iter)
{
- DEG_iterator_ids_end(iter->internal.custom);
- MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
- MEM_freeN(iter->internal.custom);
+ DEG_iterator_ids_end(iter->internal.custom);
+ MEM_freeN(((BLI_Iterator *)iter->internal.custom)->data);
+ MEM_freeN(iter->internal.custom);
}
static PointerRNA rna_Depsgraph_ids_get(CollectionPropertyIterator *iter)
{
- ID *id = ((BLI_Iterator *)iter->internal.custom)->current;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_ID, id);
+ ID *id = ((BLI_Iterator *)iter->internal.custom)->current;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_ID, id);
}
static void rna_Depsgraph_updates_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
- DEGIDIterData *data = MEM_callocN(sizeof(DEGIDIterData), __func__);
+ iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
+ DEGIDIterData *data = MEM_callocN(sizeof(DEGIDIterData), __func__);
- data->graph = (Depsgraph *)ptr->data;
- data->only_updated = true;
+ data->graph = (Depsgraph *)ptr->data;
+ data->only_updated = true;
- ((BLI_Iterator *)iter->internal.custom)->valid = true;
- DEG_iterator_ids_begin(iter->internal.custom, data);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ ((BLI_Iterator *)iter->internal.custom)->valid = true;
+ DEG_iterator_ids_begin(iter->internal.custom, data);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static PointerRNA rna_Depsgraph_updates_get(CollectionPropertyIterator *iter)
{
- ID *id = ((BLI_Iterator *)iter->internal.custom)->current;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphUpdate, id);
+ ID *id = ((BLI_Iterator *)iter->internal.custom)->current;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_DepsgraphUpdate, id);
}
static ID *rna_Depsgraph_id_eval_get(Depsgraph *depsgraph, ID *id_orig)
{
- return DEG_get_evaluated_id(depsgraph, id_orig);
+ return DEG_get_evaluated_id(depsgraph, id_orig);
}
static bool rna_Depsgraph_id_type_updated(Depsgraph *depsgraph, int id_type)
{
- return DEG_id_type_updated(depsgraph, id_type);
+ return DEG_id_type_updated(depsgraph, id_type);
}
static PointerRNA rna_Depsgraph_scene_get(PointerRNA *ptr)
{
- Depsgraph *depsgraph = (Depsgraph *)ptr->data;
- Scene *scene = DEG_get_input_scene(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene);
+ Depsgraph *depsgraph = (Depsgraph *)ptr->data;
+ Scene *scene = DEG_get_input_scene(depsgraph);
+ return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene);
}
static PointerRNA rna_Depsgraph_view_layer_get(PointerRNA *ptr)
{
- Depsgraph *depsgraph = (Depsgraph *)ptr->data;
- ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer);
+ Depsgraph *depsgraph = (Depsgraph *)ptr->data;
+ ViewLayer *view_layer = DEG_get_input_view_layer(depsgraph);
+ return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer);
}
static PointerRNA rna_Depsgraph_scene_eval_get(PointerRNA *ptr)
{
- Depsgraph *depsgraph = (Depsgraph *)ptr->data;
- Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene_eval);
+ Depsgraph *depsgraph = (Depsgraph *)ptr->data;
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ return rna_pointer_inherit_refine(ptr, &RNA_Scene, scene_eval);
}
static PointerRNA rna_Depsgraph_view_layer_eval_get(PointerRNA *ptr)
{
- Depsgraph *depsgraph = (Depsgraph *)ptr->data;
- ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
- return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer_eval);
+ Depsgraph *depsgraph = (Depsgraph *)ptr->data;
+ ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
+ return rna_pointer_inherit_refine(ptr, &RNA_ViewLayer, view_layer_eval);
}
#else
static void rna_def_depsgraph_instance(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "DepsgraphObjectInstance", NULL);
- RNA_def_struct_ui_text(srna, "Dependency Graph Object Instance",
- "Extended information about dependency graph object iterator "
- "(WARNING: all data here is *evaluated* one, not original .blend IDs...)");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "Object", "Evaluated object the iterator points to");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_object_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "show_self", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Show Self", "The object geometry itself should be visible in the render");
- RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_self_get", NULL);
-
- prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Show Particles", "Particles part of the object should be visible in the render");
- RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_particles_get", NULL);
-
- prop = RNA_def_property(srna, "is_instance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Instance", "Denotes if the object is generated by another object");
- RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_is_instance_get", NULL);
-
- prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "Instance Object", "Evaluated object which is being instanced by this iterator");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_instance_object_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "Parent", "If the object is an instance, the parent object that generated it");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_parent_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Particle System", "Evaluated particle system that this object was instanced from");
- RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_particle_system_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Persistent ID",
- "Persistent identifier for inter-frame matching of objects with motion blur");
- RNA_def_property_array(prop, 2 * MAX_DUPLI_RECUR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_persistent_id_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "random_id", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Dupli random id", "Random id for this instance, typically for randomized shading");
- RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_random_id_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Generated Matrix", "Generated transform matrix in world space");
- RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_matrix_world_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Generated Coordinates", "Generated coordinates in parent object space");
- RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_orco_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
- RNA_def_property_array(prop, 2);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_uv_get", NULL, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "DepsgraphObjectInstance", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "Dependency Graph Object Instance",
+ "Extended information about dependency graph object iterator "
+ "(WARNING: all data here is *evaluated* one, not original .blend IDs...)");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_ui_text(prop, "Object", "Evaluated object the iterator points to");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_object_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "show_self", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Show Self", "The object geometry itself should be visible in the render");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_self_get", NULL);
+
+ prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Show Particles", "Particles part of the object should be visible in the render");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_show_particles_get", NULL);
+
+ prop = RNA_def_property(srna, "is_instance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Is Instance", "Denotes if the object is generated by another object");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphObjectInstance_is_instance_get", NULL);
+
+ prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_ui_text(
+ prop, "Instance Object", "Evaluated object which is being instanced by this iterator");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_DepsgraphObjectInstance_instance_object_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_ui_text(
+ prop, "Parent", "If the object is an instance, the parent object that generated it");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_DepsgraphObjectInstance_parent_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Particle System", "Evaluated particle system that this object was instanced from");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_DepsgraphObjectInstance_particle_system_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "persistent_id", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Persistent ID",
+ "Persistent identifier for inter-frame matching of objects with motion blur");
+ RNA_def_property_array(prop, 2 * MAX_DUPLI_RECUR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_persistent_id_get", NULL, NULL);
+
+ prop = RNA_def_property(srna, "random_id", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Dupli random id", "Random id for this instance, typically for randomized shading");
+ RNA_def_property_int_funcs(prop, "rna_DepsgraphObjectInstance_random_id_get", NULL, NULL);
+
+ prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Generated Matrix", "Generated transform matrix in world space");
+ RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_matrix_world_get", NULL, NULL);
+
+ prop = RNA_def_property(srna, "orco", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Generated Coordinates", "Generated coordinates in parent object space");
+ RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_orco_get", NULL, NULL);
+
+ prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "UV Coordinates", "UV coordinates in parent object space");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_DepsgraphObjectInstance_uv_get", NULL, NULL);
}
static void rna_def_depsgraph_update(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "DepsgraphUpdate", NULL);
- RNA_def_struct_ui_text(srna, "Dependency Graph Update",
- "Information about ID that was updated");
+ srna = RNA_def_struct(brna, "DepsgraphUpdate", NULL);
+ RNA_def_struct_ui_text(srna, "Dependency Graph Update", "Information about ID that was updated");
- prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_ui_text(prop, "ID", "Updated datablock");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_DepsgraphUpdate_id_get", NULL, NULL, NULL);
+ prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_ui_text(prop, "ID", "Updated datablock");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, "rna_DepsgraphUpdate_id_get", NULL, NULL, NULL);
- /* Use term 'is_updated' instead of 'is_dirty' here because this is a signal
- * that users of the depsgraph may want to update their data (render engines for eg). */
+ /* Use term 'is_updated' instead of 'is_dirty' here because this is a signal
+ * that users of the depsgraph may want to update their data (render engines for eg). */
- prop = RNA_def_property(srna, "is_updated_transform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Transform", "Object transformation is updated");
- RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_transform_get", NULL);
+ prop = RNA_def_property(srna, "is_updated_transform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Transform", "Object transformation is updated");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_transform_get", NULL);
- prop = RNA_def_property(srna, "is_updated_geometry", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Geometry", "Object geometry is updated");
- RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_geometry_get", NULL);
+ prop = RNA_def_property(srna, "is_updated_geometry", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Geometry", "Object geometry is updated");
+ RNA_def_property_boolean_funcs(prop, "rna_DepsgraphUpdate_is_updated_geometry_get", NULL);
}
static void rna_def_depsgraph(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
- PropertyRNA *prop;
-
- static EnumPropertyItem enum_depsgraph_mode_items[] = {
- {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport non-rendered mode"},
- {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Depsgraph", NULL);
- RNA_def_struct_ui_text(srna, "Dependency Graph", "");
-
- prop = RNA_def_enum(srna, "mode", enum_depsgraph_mode_items, 0, "Mode", "Evaluation mode");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_funcs(prop, "rna_Depsgraph_mode_get", NULL, NULL);
-
- /* Debug helpers. */
-
- func = RNA_def_function(srna, "debug_relations_graphviz", "rna_Depsgraph_debug_relations_graphviz");
- parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
- "File in which to store graphviz debug output");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "debug_stats_gnuplot", "rna_Depsgraph_debug_stats_gnuplot");
- parm = RNA_def_string_file_path(func, "filename", NULL, FILE_MAX, "File Name",
- "File in which to store graphviz debug output");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string_file_path(func, "output_filename", NULL, FILE_MAX, "Output File Name",
- "File name where gnuplot script will save the result");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "debug_tag_update", "rna_Depsgraph_debug_tag_update");
-
- func = RNA_def_function(srna, "debug_stats", "rna_Depsgraph_debug_stats");
- RNA_def_function_ui_description(func, "Report the number of elements in the Dependency Graph");
- /* weak!, no way to return dynamic string type */
- parm = RNA_def_string(func, "result", NULL, STATS_MAX_SIZE, "result", "");
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
- RNA_def_function_output(func, parm);
-
- /* Queries for original datablockls (the ones depsgraph is built for). */
-
- prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Scene");
- RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_scene_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Scene", "Original scene dependency graph is built for");
-
- prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "View Layer", "Original view layer dependency graph is built for");
-
- /* Queries for evaluated datablockls (the ones depsgraph is evaluating). */
-
- func = RNA_def_function(srna, "id_eval_get", "rna_Depsgraph_id_eval_get");
- parm = RNA_def_pointer(func, "id", "ID", "", "Original ID to get evaluated complementary part for");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "id_eval", "ID", "", "Evaluated ID for the given original one");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "id_type_updated", "rna_Depsgraph_id_type_updated");
- parm = RNA_def_enum(func, "id_type", rna_enum_id_type_items, 0, "ID Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "updated", false, "Updated", "True if any datablock with this type was added, updated or removed");
- RNA_def_function_return(func, parm);
-
- prop = RNA_def_property(srna, "scene_eval", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Scene");
- RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_scene_eval_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Scene", "Original scene dependency graph is built for");
-
- prop = RNA_def_property(srna, "view_layer_eval", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_eval_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "View Layer", "Original view layer dependency graph is built for");
-
- /* Iterators. */
-
- prop = RNA_def_property(srna, "ids", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_collection_funcs(prop,
- "rna_Depsgraph_ids_begin",
- "rna_Depsgraph_ids_next",
- "rna_Depsgraph_ids_end",
- "rna_Depsgraph_ids_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "IDs", "All evaluated datablocks");
-
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_collection_funcs(prop,
- "rna_Depsgraph_objects_begin",
- "rna_Depsgraph_objects_next",
- "rna_Depsgraph_objects_end",
- "rna_Depsgraph_objects_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Objects", "Evaluated objects in the dependency graph");
-
- prop = RNA_def_property(srna, "object_instances", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "DepsgraphObjectInstance");
- RNA_def_property_collection_funcs(prop,
- "rna_Depsgraph_object_instances_begin",
- "rna_Depsgraph_object_instances_next",
- "rna_Depsgraph_object_instances_end",
- "rna_Depsgraph_object_instances_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Object Instances",
- "All object instances to display or render "
- "(WARNING: only use this as an iterator, never as a sequence, "
- "and do not keep any references to its items)");
-
- prop = RNA_def_property(srna, "updates", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "DepsgraphUpdate");
- RNA_def_property_collection_funcs(prop,
- "rna_Depsgraph_updates_begin",
- "rna_Depsgraph_ids_next",
- "rna_Depsgraph_ids_end",
- "rna_Depsgraph_updates_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Updates", "Updates to datablocks");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem enum_depsgraph_mode_items[] = {
+ {DAG_EVAL_VIEWPORT, "VIEWPORT", 0, "Viewport", "Viewport non-rendered mode"},
+ {DAG_EVAL_RENDER, "RENDER", 0, "Render", "Render"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Depsgraph", NULL);
+ RNA_def_struct_ui_text(srna, "Dependency Graph", "");
+
+ prop = RNA_def_enum(srna, "mode", enum_depsgraph_mode_items, 0, "Mode", "Evaluation mode");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_funcs(prop, "rna_Depsgraph_mode_get", NULL, NULL);
+
+ /* Debug helpers. */
+
+ func = RNA_def_function(
+ srna, "debug_relations_graphviz", "rna_Depsgraph_debug_relations_graphviz");
+ parm = RNA_def_string_file_path(func,
+ "filename",
+ NULL,
+ FILE_MAX,
+ "File Name",
+ "File in which to store graphviz debug output");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "debug_stats_gnuplot", "rna_Depsgraph_debug_stats_gnuplot");
+ parm = RNA_def_string_file_path(func,
+ "filename",
+ NULL,
+ FILE_MAX,
+ "File Name",
+ "File in which to store graphviz debug output");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string_file_path(func,
+ "output_filename",
+ NULL,
+ FILE_MAX,
+ "Output File Name",
+ "File name where gnuplot script will save the result");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "debug_tag_update", "rna_Depsgraph_debug_tag_update");
+
+ func = RNA_def_function(srna, "debug_stats", "rna_Depsgraph_debug_stats");
+ RNA_def_function_ui_description(func, "Report the number of elements in the Dependency Graph");
+ /* weak!, no way to return dynamic string type */
+ parm = RNA_def_string(func, "result", NULL, STATS_MAX_SIZE, "result", "");
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
+ RNA_def_function_output(func, parm);
+
+ /* Queries for original datablockls (the ones depsgraph is built for). */
+
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_scene_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Scene", "Original scene dependency graph is built for");
+
+ prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ViewLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "View Layer", "Original view layer dependency graph is built for");
+
+ /* Queries for evaluated datablockls (the ones depsgraph is evaluating). */
+
+ func = RNA_def_function(srna, "id_eval_get", "rna_Depsgraph_id_eval_get");
+ parm = RNA_def_pointer(
+ func, "id", "ID", "", "Original ID to get evaluated complementary part for");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "id_eval", "ID", "", "Evaluated ID for the given original one");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "id_type_updated", "rna_Depsgraph_id_type_updated");
+ parm = RNA_def_enum(func, "id_type", rna_enum_id_type_items, 0, "ID Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func,
+ "updated",
+ false,
+ "Updated",
+ "True if any datablock with this type was added, updated or removed");
+ RNA_def_function_return(func, parm);
+
+ prop = RNA_def_property(srna, "scene_eval", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_scene_eval_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Scene", "Original scene dependency graph is built for");
+
+ prop = RNA_def_property(srna, "view_layer_eval", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ViewLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Depsgraph_view_layer_eval_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "View Layer", "Original view layer dependency graph is built for");
+
+ /* Iterators. */
+
+ prop = RNA_def_property(srna, "ids", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Depsgraph_ids_begin",
+ "rna_Depsgraph_ids_next",
+ "rna_Depsgraph_ids_end",
+ "rna_Depsgraph_ids_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "IDs", "All evaluated datablocks");
+
+ prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Depsgraph_objects_begin",
+ "rna_Depsgraph_objects_next",
+ "rna_Depsgraph_objects_end",
+ "rna_Depsgraph_objects_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Objects", "Evaluated objects in the dependency graph");
+
+ prop = RNA_def_property(srna, "object_instances", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "DepsgraphObjectInstance");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Depsgraph_object_instances_begin",
+ "rna_Depsgraph_object_instances_next",
+ "rna_Depsgraph_object_instances_end",
+ "rna_Depsgraph_object_instances_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop,
+ "Object Instances",
+ "All object instances to display or render "
+ "(WARNING: only use this as an iterator, never as a sequence, "
+ "and do not keep any references to its items)");
+
+ prop = RNA_def_property(srna, "updates", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "DepsgraphUpdate");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Depsgraph_updates_begin",
+ "rna_Depsgraph_ids_next",
+ "rna_Depsgraph_ids_end",
+ "rna_Depsgraph_updates_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Updates", "Updates to datablocks");
}
void RNA_def_depsgraph(BlenderRNA *brna)
{
- rna_def_depsgraph_instance(brna);
- rna_def_depsgraph_update(brna);
- rna_def_depsgraph(brna);
+ rna_def_depsgraph_instance(brna);
+ rna_def_depsgraph_update(brna);
+ rna_def_depsgraph(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index d7b58896675..85764dec682 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <limits.h>
-
#include "BKE_modifier.h"
#include "BKE_dynamicpaint.h"
@@ -39,260 +38,268 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[] = {
- {MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""},
- {MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""},
- {0, NULL, 0, NULL, NULL},
+ {MOD_DYNAMICPAINT_TYPE_CANVAS, "CANVAS", 0, "Canvas", ""},
+ {MOD_DYNAMICPAINT_TYPE_BRUSH, "BRUSH", 0, "Brush", ""},
+ {0, NULL, 0, NULL, NULL},
};
-
#ifdef RNA_RUNTIME
-#include "BKE_context.h"
-#include "BKE_particle.h"
+# include "BKE_context.h"
+# include "BKE_particle.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static char *rna_DynamicPaintCanvasSettings_path(PointerRNA *ptr)
{
- DynamicPaintCanvasSettings *settings = (DynamicPaintCanvasSettings *)ptr->data;
- ModifierData *md = (ModifierData *)settings->pmd;
- char name_esc[sizeof(md->name) * 2];
+ DynamicPaintCanvasSettings *settings = (DynamicPaintCanvasSettings *)ptr->data;
+ ModifierData *md = (ModifierData *)settings->pmd;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].canvas_settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].canvas_settings", name_esc);
}
static char *rna_DynamicPaintBrushSettings_path(PointerRNA *ptr)
{
- DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings *)ptr->data;
- ModifierData *md = (ModifierData *)settings->pmd;
- char name_esc[sizeof(md->name) * 2];
+ DynamicPaintBrushSettings *settings = (DynamicPaintBrushSettings *)ptr->data;
+ ModifierData *md = (ModifierData *)settings->pmd;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].brush_settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].brush_settings", name_esc);
}
static char *rna_DynamicPaintSurface_path(PointerRNA *ptr)
{
- DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
- ModifierData *md = (ModifierData *)surface->canvas->pmd;
- char name_esc[sizeof(md->name) * 2];
- char name_esc_surface[sizeof(surface->name) * 2];
-
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
- return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]", name_esc, name_esc_surface);
+ DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
+ ModifierData *md = (ModifierData *)surface->canvas->pmd;
+ char name_esc[sizeof(md->name) * 2];
+ char name_esc_surface[sizeof(surface->name) * 2];
+
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
+ return BLI_sprintfN(
+ "modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]", name_esc, name_esc_surface);
}
-
/*
* Surfaces
*/
-static void rna_DynamicPaint_redoModifier(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_DynamicPaint_redoModifier(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
}
-static void rna_DynamicPaintSurfaces_updateFrames(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_DynamicPaintSurfaces_updateFrames(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- dynamicPaint_cacheUpdateFrames((DynamicPaintSurface *)ptr->data);
+ dynamicPaint_cacheUpdateFrames((DynamicPaintSurface *)ptr->data);
}
static void rna_DynamicPaintSurface_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
- rna_DynamicPaint_redoModifier(bmain, scene, ptr);
+ dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
+ rna_DynamicPaint_redoModifier(bmain, scene, ptr);
}
static void rna_DynamicPaintSurface_initialcolortype(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
+ DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
- surface->init_layername[0] = '\0';
- dynamicPaint_clearSurface(scene, surface);
- rna_DynamicPaint_redoModifier(bmain, scene, ptr);
+ surface->init_layername[0] = '\0';
+ dynamicPaint_clearSurface(scene, surface);
+ rna_DynamicPaint_redoModifier(bmain, scene, ptr);
}
static void rna_DynamicPaintSurface_changePreview(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DynamicPaintSurface *act_surface = (DynamicPaintSurface *)ptr->data;
- DynamicPaintSurface *surface = act_surface->canvas->surfaces.first;
-
- /* since only one color surface can show preview at time
- * disable preview on other surfaces. */
- for (; surface; surface = surface->next) {
- if (surface != act_surface)
- surface->flags &= ~MOD_DPAINT_PREVIEW;
- }
- rna_DynamicPaint_redoModifier(bmain, scene, ptr);
+ DynamicPaintSurface *act_surface = (DynamicPaintSurface *)ptr->data;
+ DynamicPaintSurface *surface = act_surface->canvas->surfaces.first;
+
+ /* since only one color surface can show preview at time
+ * disable preview on other surfaces. */
+ for (; surface; surface = surface->next) {
+ if (surface != act_surface)
+ surface->flags &= ~MOD_DPAINT_PREVIEW;
+ }
+ rna_DynamicPaint_redoModifier(bmain, scene, ptr);
}
-static void rna_DynamicPaintSurface_uniqueName(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_DynamicPaintSurface_uniqueName(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- dynamicPaintSurface_setUniqueName((DynamicPaintSurface *)ptr->data, ((DynamicPaintSurface *)ptr->data)->name);
+ dynamicPaintSurface_setUniqueName((DynamicPaintSurface *)ptr->data,
+ ((DynamicPaintSurface *)ptr->data)->name);
}
-
static void rna_DynamicPaintSurface_changeType(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data);
- dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
- rna_DynamicPaintSurface_reset(bmain, scene, ptr);
+ dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data);
+ dynamicPaint_resetSurface(scene, (DynamicPaintSurface *)ptr->data);
+ rna_DynamicPaintSurface_reset(bmain, scene, ptr);
}
static void rna_DynamicPaintSurfaces_changeFormat(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
+ DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
- surface->type = MOD_DPAINT_SURFACE_T_PAINT;
- dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data);
- rna_DynamicPaintSurface_reset(bmain, scene, ptr);
+ surface->type = MOD_DPAINT_SURFACE_T_PAINT;
+ dynamicPaintSurface_updateType((DynamicPaintSurface *)ptr->data);
+ rna_DynamicPaintSurface_reset(bmain, scene, ptr);
}
-static void rna_DynamicPaint_reset_dependency(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_DynamicPaint_reset_dependency(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
}
static void rna_DynamicPaintSurface_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_DynamicPaintSurface_reset(bmain, scene, ptr);
- rna_DynamicPaint_reset_dependency(bmain, scene, ptr);
+ rna_DynamicPaintSurface_reset(bmain, scene, ptr);
+ rna_DynamicPaint_reset_dependency(bmain, scene, ptr);
}
static PointerRNA rna_PaintSurface_active_get(PointerRNA *ptr)
{
- DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
- DynamicPaintSurface *surface = canvas->surfaces.first;
- int id = 0;
-
- for (; surface; surface = surface->next) {
- if (id == canvas->active_sur)
- return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, surface);
- id++;
- }
- return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, NULL);
+ DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
+ DynamicPaintSurface *surface = canvas->surfaces.first;
+ int id = 0;
+
+ for (; surface; surface = surface->next) {
+ if (id == canvas->active_sur)
+ return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, surface);
+ id++;
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_DynamicPaintSurface, NULL);
}
static void rna_DynamicPaint_surfaces_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
- /*rna_iterator_array_begin(iter, (void *)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0); */
- rna_iterator_listbase_begin(iter, &canvas->surfaces, NULL);
+ DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
+ /*rna_iterator_array_begin(iter, (void *)canvas->surfaces, sizeof(PaintSurface), canvas->totsur, 0, 0); */
+ rna_iterator_listbase_begin(iter, &canvas->surfaces, NULL);
}
static int rna_Surface_active_point_index_get(PointerRNA *ptr)
{
- DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
- return canvas->active_sur;
+ DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
+ return canvas->active_sur;
}
static void rna_Surface_active_point_index_set(struct PointerRNA *ptr, int value)
{
- DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
- canvas->active_sur = value;
- return;
+ DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
+ canvas->active_sur = value;
+ return;
}
-static void rna_Surface_active_point_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Surface_active_point_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
+ DynamicPaintCanvasSettings *canvas = (DynamicPaintCanvasSettings *)ptr->data;
- *min = 0;
- *max = BLI_listbase_count(&canvas->surfaces) - 1;
+ *min = 0;
+ *max = BLI_listbase_count(&canvas->surfaces) - 1;
}
/* uvlayer */
static void rna_DynamicPaint_uvlayer_set(PointerRNA *ptr, const char *value)
{
- DynamicPaintCanvasSettings *canvas = ((DynamicPaintSurface *)ptr->data)->canvas;
- DynamicPaintSurface *surface = canvas->surfaces.first;
- int id = 0;
-
- for (; surface; surface = surface->next) {
- if (id == canvas->active_sur) {
- rna_object_uvlayer_name_set(ptr, value, surface->uvlayer_name, sizeof(surface->uvlayer_name));
- return;
- }
- id++;
- }
+ DynamicPaintCanvasSettings *canvas = ((DynamicPaintSurface *)ptr->data)->canvas;
+ DynamicPaintSurface *surface = canvas->surfaces.first;
+ int id = 0;
+
+ for (; surface; surface = surface->next) {
+ if (id == canvas->active_sur) {
+ rna_object_uvlayer_name_set(
+ ptr, value, surface->uvlayer_name, sizeof(surface->uvlayer_name));
+ return;
+ }
+ id++;
+ }
}
/* is point cache used */
static bool rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr)
{
- DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
+ DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
- return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0;
+ return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0;
}
/* is some 3D view preview available */
static bool rna_DynamicPaint_use_color_preview_get(PointerRNA *ptr)
{
- DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
+ DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
- return dynamicPaint_surfaceHasColorPreview(surface);
+ return dynamicPaint_surfaceHasColorPreview(surface);
}
/* does output layer exist*/
static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index)
{
- return dynamicPaint_outputLayerExists(surface, ob, index);
+ return dynamicPaint_outputLayerExists(surface, ob, index);
}
-
-static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
-
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- int totitem = 0;
-
- /* Paint type - available for all formats */
- tmp.value = MOD_DPAINT_SURFACE_T_PAINT;
- tmp.identifier = "PAINT";
- tmp.name = "Paint";
- tmp.icon = ICON_TPAINT_HLT;
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- /* Displace */
- if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX ||
- surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ)
- {
- tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE;
- tmp.identifier = "DISPLACE";
- tmp.name = "Displace";
- tmp.icon = ICON_MOD_DISPLACE;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- /* Weight */
- if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
- tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT;
- tmp.identifier = "WEIGHT";
- tmp.name = "Weight";
- tmp.icon = ICON_MOD_VERTEX_WEIGHT;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- /* Height waves */
- {
- tmp.value = MOD_DPAINT_SURFACE_T_WAVE;
- tmp.identifier = "WAVE";
- tmp.name = "Waves";
- tmp.icon = ICON_MOD_WAVE;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data;
+
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+
+ /* Paint type - available for all formats */
+ tmp.value = MOD_DPAINT_SURFACE_T_PAINT;
+ tmp.identifier = "PAINT";
+ tmp.name = "Paint";
+ tmp.icon = ICON_TPAINT_HLT;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ /* Displace */
+ if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX ||
+ surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) {
+ tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE;
+ tmp.identifier = "DISPLACE";
+ tmp.name = "Displace";
+ tmp.icon = ICON_MOD_DISPLACE;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ /* Weight */
+ if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX) {
+ tmp.value = MOD_DPAINT_SURFACE_T_WEIGHT;
+ tmp.identifier = "WEIGHT";
+ tmp.name = "Weight";
+ tmp.icon = ICON_MOD_VERTEX_WEIGHT;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ /* Height waves */
+ {
+ tmp.value = MOD_DPAINT_SURFACE_T_WAVE;
+ tmp.identifier = "WAVE";
+ tmp.name = "Waves";
+ tmp.icon = ICON_MOD_WAVE;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
#else
@@ -300,703 +307,745 @@ static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(
/* canvas.canvas_surfaces */
static void rna_def_canvas_surfaces(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "DynamicPaintSurfaces");
- srna = RNA_def_struct(brna, "DynamicPaintSurfaces", NULL);
- RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
- RNA_def_struct_ui_text(srna, "Canvas Surfaces", "Collection of Dynamic Paint Canvas surfaces");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_Surface_active_point_index_get", "rna_Surface_active_point_index_set",
- "rna_Surface_active_point_range");
- RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "DynamicPaintSurface");
- RNA_def_property_pointer_funcs(prop, "rna_PaintSurface_active_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Surface", "Active Dynamic Paint surface being displayed");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "DynamicPaintSurfaces");
+ srna = RNA_def_struct(brna, "DynamicPaintSurfaces", NULL);
+ RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
+ RNA_def_struct_ui_text(srna, "Canvas Surfaces", "Collection of Dynamic Paint Canvas surfaces");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_Surface_active_point_index_get",
+ "rna_Surface_active_point_index_set",
+ "rna_Surface_active_point_range");
+ RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "DynamicPaintSurface");
+ RNA_def_property_pointer_funcs(prop, "rna_PaintSurface_active_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Surface", "Active Dynamic Paint surface being displayed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
}
-
static void rna_def_canvas_surface(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- /* Surface format */
- static const EnumPropertyItem prop_dynamicpaint_surface_format[] = {
- /*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */
- {MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
- {MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Surface type - generated dynamically based on surface format */
- static const EnumPropertyItem prop_dynamicpaint_surface_type[] = {
- {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Surface output preview. currently only paint has multiple outputs */
- static const EnumPropertyItem prop_dynamicpaint_surface_preview[] = {
- {MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""},
- {MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Initial color setting */
- static const EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
- {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
- {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
- {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
- {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Effect type
- * Only used by ui to view per effect settings */
- static const EnumPropertyItem prop_dynamicpaint_effecttype[] = {
- {1, "SPREAD", 0, "Spread", ""},
- {2, "DRIP", 0, "Drip", ""},
- {3, "SHRINK", 0, "Shrink", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Displacemap file format */
- static const EnumPropertyItem prop_dynamicpaint_image_fileformat[] = {
- {MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""},
-#ifdef WITH_OPENEXR
- {MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Displacemap type */
- static const EnumPropertyItem prop_dynamicpaint_displace_type[] = {
- {MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
- {MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
-
-
- /* Surface */
- srna = RNA_def_struct(brna, "DynamicPaintSurface", NULL);
- RNA_def_struct_sdna(srna, "DynamicPaintSurface");
- RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
- RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");
-
- prop = RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "format");
- RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
- RNA_def_property_ui_text(prop, "Format", "Surface Format");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");
-
- prop = RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DynamicPaint_surface_type_itemf");
- RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changeType");
-
- prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE);
- RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW);
- RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Surface name");
- RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "brush_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "brush_group");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Brush Collection", "Only use brush objects from this collection");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset_dependency");
-
-
- /*
- * Paint, wet and displace
- */
-
- prop = RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
- RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
-
- prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "diss_speed");
- RNA_def_property_range(prop, 1.0, 10000.0);
- RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
- RNA_def_property_ui_text(prop, "Dissolve Time", "Approximately in how many frames should dissolve happen");
-
- prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
- RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
-
- prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_TIME);
- RNA_def_property_range(prop, 1.0, 10000.0);
- RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
- RNA_def_property_ui_text(prop, "Dry Time", "Approximately in how many frames should drying happen");
-
- /*
- * Simulation settings
- */
- prop = RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 16.0, 4096.0);
- RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, -1);
- RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
- RNA_def_property_ui_text(prop, "UV Map", "UV map name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "start_frame");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1.0, MAXFRAMEF);
- RNA_def_property_ui_range(prop, 1.0, 9999, 1, -1);
- RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "end_frame");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1.0, MAXFRAMEF);
- RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, -1);
- RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
-
- prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "substeps");
- RNA_def_property_range(prop, 0.0, 20.0);
- RNA_def_property_ui_range(prop, 0.0, 10, 1, -1);
- RNA_def_property_ui_text(prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
-
- prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS);
- RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smooth paint edges");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "influence_scale");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Influence Scale", "Adjust influence brush objects have on this surface");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "radius_scale");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Radius Scale", "Adjust radius of proximity brushes or particles for this surface");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- /*
- * Initial Color
- */
-
- prop = RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
- RNA_def_property_ui_text(prop, "Initial Color", "");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_initialcolortype");
-
- prop = RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- prop = RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Texture", "");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- prop = RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Data Layer", "");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- /*
- * Effect Settings
- */
- prop = RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
- RNA_def_property_ui_text(prop, "Effect Type", "");
-
- prop = RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG);
- RNA_def_property_ui_text(prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");
-
- prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
- RNA_def_property_ui_text(prop, "Slow",
- "Use logarithmic dissolve (makes high values to fade faster than low values)");
-
- prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD);
- RNA_def_property_ui_text(prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- prop = RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spread_speed");
- RNA_def_property_range(prop, 0.001, 10.0);
- RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Spread Speed", "How fast spread effect moves on the canvas surface");
-
- prop = RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "color_dry_threshold");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Color Dry", "The wetness level when colors start to shift to the background");
-
- prop = RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "color_spread_speed");
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
- RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
-
- prop = RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP);
- RNA_def_property_ui_text(prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- prop = RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK);
- RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- prop = RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
- RNA_def_property_range(prop, 0.001, 10.0);
- RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");
-
- prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EffectorWeights");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Weights", "");
-
- prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "drip_vel");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping");
-
- prop = RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "drip_acc");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping");
-
- /*
- * Output settings
- */
- prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA);
- RNA_def_property_ui_text(prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)");
-
- prop = RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "image_output_path");
- RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
-
- /* output for primary surface data */
- prop = RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "output_name");
- RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
-
- prop = RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
- RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
-
- /* output for secondary sufrace data */
- prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "output_name2");
- RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
-
- prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
- RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
-
- prop = RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "preview_id");
- RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview);
- RNA_def_property_ui_text(prop, "Preview", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- /* to check if output name exists */
- func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
- RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
- parm = RNA_def_pointer(func, "object", "Object", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_boolean(func, "exists", 0, "", "");
- RNA_def_function_return(func, parm);
-
- prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.00, 50.0);
- RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Max Displace",
- "Maximum level of depth intersection in object space (use 0.0 to disable)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "disp_factor");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, -50.0, 50.0);
- RNA_def_property_ui_range(prop, -5.0, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Displace Factor", "Strength of displace when applied to the mesh");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
- RNA_def_property_ui_text(prop, "File Format", "");
-
- prop = RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "disp_type");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
- RNA_def_property_ui_text(prop, "Data Type", "");
-
- prop = RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISP_INCREMENTAL);
- RNA_def_property_ui_text(prop, "Incremental", "New displace is added cumulatively on top of existing");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
-
- /* wave simulator settings */
- prop = RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
-
- prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 5.0);
- RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
- RNA_def_property_ui_text(prop, "Speed", "Wave propagation speed");
-
- prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 3.0);
- RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
- RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");
-
- prop = RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");
-
- prop = RNA_def_property(srna, "wave_smoothness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.1, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Smoothness", "Limit maximum steepness of wave slope between simulation points "
- "(use higher values for smoother waves at expense of reduced detail)");
-
- prop = RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
- RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
-
- /* cache */
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
- RNA_def_property_struct_type(prop, "PointCache");
- RNA_def_property_ui_text(prop, "Point Cache", "");
-
- /* is cache used */
- prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
- RNA_def_property_ui_text(prop, "Use Cache", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
-
- /* whether this surface has preview data for 3D view */
- RNA_define_verify_sdna(false);
- prop = RNA_def_property(srna, "use_color_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_use_color_preview_get", NULL);
- RNA_def_property_ui_text(prop, "Use Color Preview", "Whether this surface has some color preview for 3D view");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_define_verify_sdna(true);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ /* Surface format */
+ static const EnumPropertyItem prop_dynamicpaint_surface_format[] = {
+ /*{MOD_DPAINT_SURFACE_F_PTEX, "PTEX", ICON_TEXTURE_SHADED, "Ptex", ""}, */
+ {MOD_DPAINT_SURFACE_F_VERTEX, "VERTEX", ICON_OUTLINER_DATA_MESH, "Vertex", ""},
+ {MOD_DPAINT_SURFACE_F_IMAGESEQ, "IMAGE", ICON_FILE_IMAGE, "Image Sequence", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Surface type - generated dynamically based on surface format */
+ static const EnumPropertyItem prop_dynamicpaint_surface_type[] = {
+ {MOD_DPAINT_SURFACE_T_PAINT, "PAINT", 0, "Paint", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Surface output preview. currently only paint has multiple outputs */
+ static const EnumPropertyItem prop_dynamicpaint_surface_preview[] = {
+ {MOD_DPAINT_SURFACE_PREV_PAINT, "PAINT", 0, "Paint", ""},
+ {MOD_DPAINT_SURFACE_PREV_WETMAP, "WETMAP", 0, "Wetmap", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Initial color setting */
+ static const EnumPropertyItem prop_dynamicpaint_init_color_type[] = {
+ {MOD_DPAINT_INITIAL_NONE, "NONE", 0, "None", ""},
+ {MOD_DPAINT_INITIAL_COLOR, "COLOR", ICON_COLOR, "Color", ""},
+ {MOD_DPAINT_INITIAL_TEXTURE, "TEXTURE", ICON_TEXTURE, "UV Texture", ""},
+ {MOD_DPAINT_INITIAL_VERTEXCOLOR, "VERTEX_COLOR", ICON_GROUP_VCOL, "Vertex Color", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Effect type
+ * Only used by ui to view per effect settings */
+ static const EnumPropertyItem prop_dynamicpaint_effecttype[] = {
+ {1, "SPREAD", 0, "Spread", ""},
+ {2, "DRIP", 0, "Drip", ""},
+ {3, "SHRINK", 0, "Shrink", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Displacemap file format */
+ static const EnumPropertyItem prop_dynamicpaint_image_fileformat[] = {
+ {MOD_DPAINT_IMGFORMAT_PNG, "PNG", 0, "PNG", ""},
+# ifdef WITH_OPENEXR
+ {MOD_DPAINT_IMGFORMAT_OPENEXR, "OPENEXR", 0, "OpenEXR", ""},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Displacemap type */
+ static const EnumPropertyItem prop_dynamicpaint_displace_type[] = {
+ {MOD_DPAINT_DISP_DISPLACE, "DISPLACE", 0, "Displacement", ""},
+ {MOD_DPAINT_DISP_DEPTH, "DEPTH", 0, "Depth", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Surface */
+ srna = RNA_def_struct(brna, "DynamicPaintSurface", NULL);
+ RNA_def_struct_sdna(srna, "DynamicPaintSurface");
+ RNA_def_struct_ui_text(srna, "Paint Surface", "A canvas surface layer");
+ RNA_def_struct_path_func(srna, "rna_DynamicPaintSurface_path");
+
+ prop = RNA_def_property(srna, "surface_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "format");
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_format);
+ RNA_def_property_ui_text(prop, "Format", "Surface Format");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_changeFormat");
+
+ prop = RNA_def_property(srna, "surface_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_type);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DynamicPaint_surface_type_itemf");
+ RNA_def_property_ui_text(prop, "Surface Type", "Surface Type");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changeType");
+
+ prop = RNA_def_property(srna, "is_active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ACTIVE);
+ RNA_def_property_ui_text(prop, "Is Active", "Toggle whether surface is processed or ignored");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PREVIEW);
+ RNA_def_property_ui_text(prop, "Show Preview", "Display surface preview in 3D-views");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_changePreview");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Surface name");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_DynamicPaintSurface_uniqueName");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "brush_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "brush_group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Brush Collection", "Only use brush objects from this collection");
+ RNA_def_property_update(
+ prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset_dependency");
+
+ /*
+ * Paint, wet and displace
+ */
+
+ prop = RNA_def_property(srna, "use_dissolve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE);
+ RNA_def_property_ui_text(prop, "Dissolve", "Enable to make surface changes disappear over time");
+
+ prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "diss_speed");
+ RNA_def_property_range(prop, 1.0, 10000.0);
+ RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
+ RNA_def_property_ui_text(
+ prop, "Dissolve Time", "Approximately in how many frames should dissolve happen");
+
+ prop = RNA_def_property(srna, "use_drying", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_USE_DRYING);
+ RNA_def_property_ui_text(prop, "Dry", "Enable to make surface wetness dry over time");
+
+ prop = RNA_def_property(srna, "dry_speed", PROP_INT, PROP_TIME);
+ RNA_def_property_range(prop, 1.0, 10000.0);
+ RNA_def_property_ui_range(prop, 1.0, 10000.0, 5, -1);
+ RNA_def_property_ui_text(
+ prop, "Dry Time", "Approximately in how many frames should drying happen");
+
+ /*
+ * Simulation settings
+ */
+ prop = RNA_def_property(srna, "image_resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 16.0, 4096.0);
+ RNA_def_property_ui_range(prop, 16.0, 4096.0, 1, -1);
+ RNA_def_property_ui_text(prop, "Resolution", "Output image resolution");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
+ RNA_def_property_ui_text(prop, "UV Map", "UV map name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DynamicPaint_uvlayer_set");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "start_frame");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1.0, MAXFRAMEF);
+ RNA_def_property_ui_range(prop, 1.0, 9999, 1, -1);
+ RNA_def_property_ui_text(prop, "Start Frame", "Simulation start frame");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "end_frame");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1.0, MAXFRAMEF);
+ RNA_def_property_ui_range(prop, 1.0, 9999.0, 1, -1);
+ RNA_def_property_ui_text(prop, "End Frame", "Simulation end frame");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurfaces_updateFrames");
+
+ prop = RNA_def_property(srna, "frame_substeps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "substeps");
+ RNA_def_property_range(prop, 0.0, 20.0);
+ RNA_def_property_ui_range(prop, 0.0, 10, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Sub-Steps", "Do extra frames between scene frames to ensure smooth motion");
+
+ prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ANTIALIAS);
+ RNA_def_property_ui_text(prop, "Anti-aliasing", "Use 5x multisampling to smooth paint edges");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ prop = RNA_def_property(srna, "brush_influence_scale", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "influence_scale");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Influence Scale", "Adjust influence brush objects have on this surface");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "brush_radius_scale", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "radius_scale");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Radius Scale", "Adjust radius of proximity brushes or particles for this surface");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ /*
+ * Initial Color
+ */
+
+ prop = RNA_def_property(srna, "init_color_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_init_color_type);
+ RNA_def_property_ui_text(prop, "Initial Color", "");
+ RNA_def_property_update(prop,
+ NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER,
+ "rna_DynamicPaintSurface_initialcolortype");
+
+ prop = RNA_def_property(srna, "init_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Color", "Initial color of the surface");
+ RNA_def_property_update(
+ prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ prop = RNA_def_property(srna, "init_texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Texture", "");
+ RNA_def_property_update(
+ prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ prop = RNA_def_property(srna, "init_layername", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Data Layer", "");
+ RNA_def_property_update(
+ prop, NC_MATERIAL | ND_SHADING_DRAW | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ /*
+ * Effect Settings
+ */
+ prop = RNA_def_property(srna, "effect_ui", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_effecttype);
+ RNA_def_property_ui_text(prop, "Effect Type", "");
+
+ prop = RNA_def_property(srna, "use_dry_log", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DRY_LOG);
+ RNA_def_property_ui_text(
+ prop, "Slow", "Use logarithmic drying (makes high values to dry faster than low values)");
+
+ prop = RNA_def_property(srna, "use_dissolve_log", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISSOLVE_LOG);
+ RNA_def_property_ui_text(
+ prop, "Slow", "Use logarithmic dissolve (makes high values to fade faster than low values)");
+
+ prop = RNA_def_property(srna, "use_spread", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SPREAD);
+ RNA_def_property_ui_text(
+ prop, "Use Spread", "Process spread effect (spread wet paint around surface)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ prop = RNA_def_property(srna, "spread_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spread_speed");
+ RNA_def_property_range(prop, 0.001, 10.0);
+ RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Spread Speed", "How fast spread effect moves on the canvas surface");
+
+ prop = RNA_def_property(srna, "color_dry_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "color_dry_threshold");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Color Dry", "The wetness level when colors start to shift to the background");
+
+ prop = RNA_def_property(srna, "color_spread_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "color_spread_speed");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_range(prop, 0.0, 2.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Color Spread", "How fast colors get mixed within wet paint");
+
+ prop = RNA_def_property(srna, "use_drip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_DRIP);
+ RNA_def_property_ui_text(
+ prop, "Use Drip", "Process drip effect (drip wet paint to gravity direction)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ prop = RNA_def_property(srna, "use_shrink", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "effect", MOD_DPAINT_EFFECT_DO_SHRINK);
+ RNA_def_property_ui_text(prop, "Use Shrink", "Process shrink effect (shrink paint areas)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ prop = RNA_def_property(srna, "shrink_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shrink_speed");
+ RNA_def_property_range(prop, 0.001, 10.0);
+ RNA_def_property_ui_range(prop, 0.01, 5.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Shrink Speed", "How fast shrink effect moves on the canvas surface");
+
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ prop = RNA_def_property(srna, "drip_velocity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "drip_vel");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Velocity", "How much surface velocity affects dripping");
+
+ prop = RNA_def_property(srna, "drip_acceleration", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "drip_acc");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Acceleration", "How much surface acceleration affects dripping");
+
+ /*
+ * Output settings
+ */
+ prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_MULALPHA);
+ RNA_def_property_ui_text(
+ prop, "Premultiply alpha", "Multiply color by alpha (recommended for Blender input)");
+
+ prop = RNA_def_property(srna, "image_output_path", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "image_output_path");
+ RNA_def_property_ui_text(prop, "Output Path", "Directory to save the textures");
+
+ /* output for primary surface data */
+ prop = RNA_def_property(srna, "output_name_a", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "output_name");
+ RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
+
+ prop = RNA_def_property(srna, "use_output_a", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT1);
+ RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
+
+ /* output for secondary sufrace data */
+ prop = RNA_def_property(srna, "output_name_b", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "output_name2");
+ RNA_def_property_ui_text(prop, "Output Name", "Name used to save output from this surface");
+
+ prop = RNA_def_property(srna, "use_output_b", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_OUT2);
+ RNA_def_property_ui_text(prop, "Use Output", "Save this output layer");
+
+ prop = RNA_def_property(srna, "preview_id", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "preview_id");
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_surface_preview);
+ RNA_def_property_ui_text(prop, "Preview", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ /* to check if output name exists */
+ func = RNA_def_function(srna, "output_exists", "rna_DynamicPaint_is_output_exists");
+ RNA_def_function_ui_description(func, "Checks if surface output layer of given name exists");
+ parm = RNA_def_pointer(func, "object", "Object", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(func, "index", 0, 0, 1, "Index", "", 0, 1);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_boolean(func, "exists", 0, "", "");
+ RNA_def_function_return(func, parm);
+
+ prop = RNA_def_property(srna, "depth_clamp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.00, 50.0);
+ RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Max Displace",
+ "Maximum level of depth intersection in object space (use 0.0 to disable)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "displace_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "disp_factor");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, -50.0, 50.0);
+ RNA_def_property_ui_range(prop, -5.0, 5.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Displace Factor", "Strength of displace when applied to the mesh");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "image_fileformat", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_image_fileformat);
+ RNA_def_property_ui_text(prop, "File Format", "");
+
+ prop = RNA_def_property(srna, "displace_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "disp_type");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_displace_type);
+ RNA_def_property_ui_text(prop, "Data Type", "");
+
+ prop = RNA_def_property(srna, "use_incremental_displace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DISP_INCREMENTAL);
+ RNA_def_property_ui_text(
+ prop, "Incremental", "New displace is added cumulatively on top of existing");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaintSurface_reset");
+
+ /* wave simulator settings */
+ prop = RNA_def_property(srna, "wave_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Damping", "Wave damping factor");
+
+ prop = RNA_def_property(srna, "wave_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 5.0);
+ RNA_def_property_ui_range(prop, 0.20, 4.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Speed", "Wave propagation speed");
+
+ prop = RNA_def_property(srna, "wave_timescale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 3.0);
+ RNA_def_property_ui_range(prop, 0.01, 1.5, 1, 2);
+ RNA_def_property_ui_text(prop, "Timescale", "Wave time scaling factor");
+
+ prop = RNA_def_property(srna, "wave_spring", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.01, 1.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Spring", "Spring force that pulls water level back to zero");
+
+ prop = RNA_def_property(srna, "wave_smoothness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.1, 5.0, 1, 2);
+ RNA_def_property_ui_text(prop,
+ "Smoothness",
+ "Limit maximum steepness of wave slope between simulation points "
+ "(use higher values for smoother waves at expense of reduced detail)");
+
+ prop = RNA_def_property(srna, "use_wave_open_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_WAVE_OPEN_BORDERS);
+ RNA_def_property_ui_text(prop, "Open Borders", "Pass waves through mesh edges");
+
+ /* cache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ /* is cache used */
+ prop = RNA_def_property(srna, "is_cache_user", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_is_cache_user_get", NULL);
+ RNA_def_property_ui_text(prop, "Use Cache", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+
+ /* whether this surface has preview data for 3D view */
+ RNA_define_verify_sdna(false);
+ prop = RNA_def_property(srna, "use_color_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_DynamicPaint_use_color_preview_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Use Color Preview", "Whether this surface has some color preview for 3D view");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_define_verify_sdna(true);
}
static void rna_def_dynamic_paint_canvas_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", NULL);
- RNA_def_struct_ui_text(srna, "Canvas Settings", "Dynamic Paint canvas settings");
- RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
- RNA_def_struct_path_func(srna, "rna_DynamicPaintCanvasSettings_path");
-
- /*
- * Surface Slots
- */
- prop = RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_DynamicPaint_surfaces_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "DynamicPaintSurface");
- RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
- rna_def_canvas_surfaces(brna, prop);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "DynamicPaintCanvasSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Canvas Settings", "Dynamic Paint canvas settings");
+ RNA_def_struct_sdna(srna, "DynamicPaintCanvasSettings");
+ RNA_def_struct_path_func(srna, "rna_DynamicPaintCanvasSettings_path");
+
+ /*
+ * Surface Slots
+ */
+ prop = RNA_def_property(srna, "canvas_surfaces", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_DynamicPaint_surfaces_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "DynamicPaintSurface");
+ RNA_def_property_ui_text(prop, "Paint Surface List", "Paint surface list");
+ rna_def_canvas_surfaces(brna, prop);
}
static void rna_def_dynamic_paint_brush_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* paint collision type */
- static const EnumPropertyItem prop_dynamicpaint_collisiontype[] = {
- {MOD_DPAINT_COL_PSYS, "PARTICLE_SYSTEM", ICON_PARTICLES, "Particle System", ""},
- {MOD_DPAINT_COL_POINT, "POINT", ICON_EMPTY_AXIS, "Object Center", ""},
- {MOD_DPAINT_COL_DIST, "DISTANCE", ICON_DRIVER_DISTANCE, "Proximity", ""},
- {MOD_DPAINT_COL_VOLDIST, "VOLUME_DISTANCE", ICON_META_CUBE, "Mesh Volume + Proximity", ""},
- {MOD_DPAINT_COL_VOLUME, "VOLUME", ICON_MESH_CUBE, "Mesh Volume", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_dynamicpaint_prox_falloff[] = {
- {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""},
- {MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""},
- {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
- {MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""},
- {MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
- {MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
- {MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = {
- {MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""},
- {MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""},
- {MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "DynamicPaintBrushSettings", NULL);
- RNA_def_struct_ui_text(srna, "Brush Settings", "Brush settings");
- RNA_def_struct_sdna(srna, "DynamicPaintBrushSettings");
- RNA_def_struct_path_func(srna, "rna_DynamicPaintBrushSettings_path");
-
- /*
- * Paint
- */
- prop = RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Paint Color", "Color of the paint");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
- RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA);
- RNA_def_property_ui_text(prop, "Absolute Alpha",
- "Only increase alpha value if paint alpha is higher than existing");
-
- prop = RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "wetness");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
- RNA_def_property_ui_text(prop, "Paint Wetness",
- "Paint wetness, visible in wetmap (some effects only affect wet paint)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ERASE);
- RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
- RNA_def_property_ui_text(prop, "Wave Type", "");
-
- prop = RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -2.0, 2.0);
- RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
- RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush");
-
- prop = RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.00, 50.0);
- RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
- RNA_def_property_ui_text(prop, "Clamp Waves",
- "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
-
- prop = RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
- RNA_def_property_ui_text(prop, "Do Smudge", "Make this brush to smudge existing paint as it moves");
-
- prop = RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
- RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
-
- prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_velocity");
- RNA_def_property_range(prop, 0.0001, 10.0);
- RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
- RNA_def_property_ui_text(prop, "Max Velocity",
- "Velocity considered as maximum influence (Blender units per frame)");
-
- prop = RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA);
- RNA_def_property_ui_text(prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH);
- RNA_def_property_ui_text(prop, "Multiply Depth",
- "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_COLOR);
- RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- /*
- * Paint Area / Collision
- */
- prop = RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "collision");
- RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype);
- RNA_def_property_ui_text(prop, "Paint Source", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "paint_distance");
- RNA_def_property_range(prop, 0.0, 500.0);
- RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
- RNA_def_property_ui_text(prop, "Proximity Distance",
- "Maximum distance from brush to mesh surface to affect paint");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA);
- RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "proximity_falloff");
- RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
- RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT);
- RNA_def_property_ui_text(prop, "Project",
- "Brush is projected to canvas from defined direction within brush proximity");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ray_dir");
- RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
- RNA_def_property_ui_text(prop, "Ray Direction",
- "Ray direction to use for projection (if brush object is located in that direction "
- "it's painted)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX);
- RNA_def_property_ui_text(prop, "Inner Proximity", "Proximity falloff is applied inside the volume");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME);
- RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
-
- /*
- * Particle
- */
- prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "psys");
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Particle Systems", "The particle system to paint with");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_reset_dependency");
-
-
- prop = RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD);
- RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "particle_radius");
- RNA_def_property_range(prop, 0.01, 10.0);
- RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
- RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "particle_smooth");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 5, -1);
- RNA_def_property_ui_text(prop, "Smooth Radius", "Smooth falloff added after solid radius");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
-
- /*
- * Color ramps
- */
- prop = RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "paint_ramp");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Paint Color Ramp", "Color ramp used to define proximity falloff");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
-
- prop = RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "vel_ramp");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Velocity Color Ramp", "Color ramp used to define brush velocity effect");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* paint collision type */
+ static const EnumPropertyItem prop_dynamicpaint_collisiontype[] = {
+ {MOD_DPAINT_COL_PSYS, "PARTICLE_SYSTEM", ICON_PARTICLES, "Particle System", ""},
+ {MOD_DPAINT_COL_POINT, "POINT", ICON_EMPTY_AXIS, "Object Center", ""},
+ {MOD_DPAINT_COL_DIST, "DISTANCE", ICON_DRIVER_DISTANCE, "Proximity", ""},
+ {MOD_DPAINT_COL_VOLDIST, "VOLUME_DISTANCE", ICON_META_CUBE, "Mesh Volume + Proximity", ""},
+ {MOD_DPAINT_COL_VOLUME, "VOLUME", ICON_MESH_CUBE, "Mesh Volume", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_dynamicpaint_prox_falloff[] = {
+ {MOD_DPAINT_PRFALL_SMOOTH, "SMOOTH", ICON_SPHERECURVE, "Smooth", ""},
+ {MOD_DPAINT_PRFALL_CONSTANT, "CONSTANT", ICON_NOCURVE, "Constant", ""},
+ {MOD_DPAINT_PRFALL_RAMP, "RAMP", ICON_COLOR, "Color Ramp", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_dynamicpaint_brush_wave_type[] = {
+ {MOD_DPAINT_WAVEB_CHANGE, "CHANGE", 0, "Depth Change", ""},
+ {MOD_DPAINT_WAVEB_DEPTH, "DEPTH", 0, "Obstacle", ""},
+ {MOD_DPAINT_WAVEB_FORCE, "FORCE", 0, "Force", ""},
+ {MOD_DPAINT_WAVEB_REFLECT, "REFLECT", 0, "Reflect Only", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_dynamicpaint_brush_ray_dir[] = {
+ {MOD_DPAINT_RAY_CANVAS, "CANVAS", 0, "Canvas Normal", ""},
+ {MOD_DPAINT_RAY_BRUSH_AVG, "BRUSH", 0, "Brush Normal", ""},
+ {MOD_DPAINT_RAY_ZPLUS, "Z_AXIS", 0, "Z-Axis", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "DynamicPaintBrushSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Brush Settings", "Brush settings");
+ RNA_def_struct_sdna(srna, "DynamicPaintBrushSettings");
+ RNA_def_struct_path_func(srna, "rna_DynamicPaintBrushSettings_path");
+
+ /*
+ * Paint
+ */
+ prop = RNA_def_property(srna, "paint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Paint Color", "Color of the paint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "paint_alpha", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
+ RNA_def_property_ui_text(prop, "Paint Alpha", "Paint alpha");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_absolute_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ABS_ALPHA);
+ RNA_def_property_ui_text(
+ prop, "Absolute Alpha", "Only increase alpha value if paint alpha is higher than existing");
+
+ prop = RNA_def_property(srna, "paint_wetness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "wetness");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Paint Wetness",
+ "Paint wetness, visible in wetmap (some effects only affect wet paint)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_paint_erase", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_ERASE);
+ RNA_def_property_ui_text(prop, "Erase Paint", "Erase / remove paint instead of adding it");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_wave_type);
+ RNA_def_property_ui_text(prop, "Wave Type", "");
+
+ prop = RNA_def_property(srna, "wave_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -2.0, 2.0);
+ RNA_def_property_ui_range(prop, -1.0, 1.0, 5, 2);
+ RNA_def_property_ui_text(prop, "Factor", "Multiplier for wave influence of this brush");
+
+ prop = RNA_def_property(srna, "wave_clamp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.00, 50.0);
+ RNA_def_property_ui_range(prop, 0.00, 5.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Clamp Waves",
+ "Maximum level of surface intersection used to influence waves (use 0.0 to disable)");
+
+ prop = RNA_def_property(srna, "use_smudge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_DO_SMUDGE);
+ RNA_def_property_ui_text(
+ prop, "Do Smudge", "Make this brush to smudge existing paint as it moves");
+
+ prop = RNA_def_property(srna, "smudge_strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 2);
+ RNA_def_property_ui_text(prop, "Smudge Strength", "Smudge effect strength");
+
+ prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_velocity");
+ RNA_def_property_range(prop, 0.0001, 10.0);
+ RNA_def_property_ui_range(prop, 0.1, 2.0, 5, 2);
+ RNA_def_property_ui_text(
+ prop, "Max Velocity", "Velocity considered as maximum influence (Blender units per frame)");
+
+ prop = RNA_def_property(srna, "use_velocity_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_ALPHA);
+ RNA_def_property_ui_text(
+ prop, "Multiply Alpha", "Multiply brush influence by velocity color ramp alpha");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_velocity_depth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_DEPTH);
+ RNA_def_property_ui_text(
+ prop,
+ "Multiply Depth",
+ "Multiply brush intersection depth (displace, waves) by velocity ramp alpha");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_velocity_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_VELOCITY_COLOR);
+ RNA_def_property_ui_text(prop, "Replace Color", "Replace brush color by velocity color ramp");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ /*
+ * Paint Area / Collision
+ */
+ prop = RNA_def_property(srna, "paint_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "collision");
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_collisiontype);
+ RNA_def_property_ui_text(prop, "Paint Source", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "paint_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "paint_distance");
+ RNA_def_property_range(prop, 0.0, 500.0);
+ RNA_def_property_ui_range(prop, 0.0, 500.0, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Proximity Distance", "Maximum distance from brush to mesh surface to affect paint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_proximity_ramp_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_RAMP_ALPHA);
+ RNA_def_property_ui_text(prop, "Only Use Alpha", "Only read color ramp alpha");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "proximity_falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "proximity_falloff");
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_prox_falloff);
+ RNA_def_property_ui_text(prop, "Falloff", "Proximity falloff type");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_proximity_project", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PROX_PROJECT);
+ RNA_def_property_ui_text(
+ prop,
+ "Project",
+ "Brush is projected to canvas from defined direction within brush proximity");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "ray_direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ray_dir");
+ RNA_def_property_enum_items(prop, prop_dynamicpaint_brush_ray_dir);
+ RNA_def_property_ui_text(
+ prop,
+ "Ray Direction",
+ "Ray direction to use for projection (if brush object is located in that direction "
+ "it's painted)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "invert_proximity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_INVERSE_PROX);
+ RNA_def_property_ui_text(
+ prop, "Inner Proximity", "Proximity falloff is applied inside the volume");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "use_negative_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_NEGATE_VOLUME);
+ RNA_def_property_ui_text(prop, "Negate Volume", "Negate influence inside the volume");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ /*
+ * Particle
+ */
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "psys");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Particle Systems", "The particle system to paint with");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_reset_dependency");
+
+ prop = RNA_def_property(srna, "use_particle_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DPAINT_PART_RAD);
+ RNA_def_property_ui_text(prop, "Use Particle Radius", "Use radius from particle settings");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "solid_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "particle_radius");
+ RNA_def_property_range(prop, 0.01, 10.0);
+ RNA_def_property_ui_range(prop, 0.01, 2.0, 5, 3);
+ RNA_def_property_ui_text(prop, "Solid Radius", "Radius that will be painted solid");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "smooth_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "particle_smooth");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 5, -1);
+ RNA_def_property_ui_text(prop, "Smooth Radius", "Smooth falloff added after solid radius");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ /*
+ * Color ramps
+ */
+ prop = RNA_def_property(srna, "paint_ramp", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "paint_ramp");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(
+ prop, "Paint Color Ramp", "Color ramp used to define proximity falloff");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
+
+ prop = RNA_def_property(srna, "velocity_ramp", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "vel_ramp");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(
+ prop, "Velocity Color Ramp", "Color ramp used to define brush velocity effect");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_redoModifier");
}
void RNA_def_dynamic_paint(BlenderRNA *brna)
{
- rna_def_dynamic_paint_canvas_settings(brna);
- rna_def_dynamic_paint_brush_settings(brna);
- rna_def_canvas_surface(brna);
+ rna_def_dynamic_paint_canvas_settings(brna);
+ rna_def_dynamic_paint_brush_settings(brna);
+ rna_def_canvas_surface(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c
index 4d981fe6e9c..d8a687fdb84 100644
--- a/source/blender/makesrna/intern/rna_fcurve.c
+++ b/source/blender/makesrna/intern/rna_fcurve.c
@@ -27,7 +27,6 @@
#include "MEM_guardedalloc.h"
-
#include "BLT_translation.h"
#include "BKE_action.h"
@@ -44,149 +43,197 @@
#include "ED_keyframes_edit.h"
const EnumPropertyItem rna_enum_fmodifier_type_items[] = {
- {FMODIFIER_TYPE_NULL, "NULL", 0, "Invalid", ""},
- {FMODIFIER_TYPE_GENERATOR, "GENERATOR", 0, "Generator",
- "Generate a curve using a factorized or expanded polynomial"},
- {FMODIFIER_TYPE_FN_GENERATOR, "FNGENERATOR", 0, "Built-In Function",
- "Generate a curve using standard math functions such as sin and cos"},
- {FMODIFIER_TYPE_ENVELOPE, "ENVELOPE", 0, "Envelope",
- "Reshape F-Curve values - e.g. change amplitude of movements"},
- {FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles",
- "Cyclic extend/repeat keyframe sequence"},
- {FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise",
- "Add pseudo-random noise on top of F-Curves"},
- /*{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},*/ /* FIXME: not implemented yet! */
- /*{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},*/ /* FIXME: not implemented yet! */
- {FMODIFIER_TYPE_LIMITS, "LIMITS", 0, "Limits",
- "Restrict maximum and minimum values of F-Curve"},
- {FMODIFIER_TYPE_STEPPED, "STEPPED", 0, "Stepped Interpolation",
- "Snap values to nearest grid-step - e.g. for a stop-motion look"},
- {0, NULL, 0, NULL, NULL},
+ {FMODIFIER_TYPE_NULL, "NULL", 0, "Invalid", ""},
+ {FMODIFIER_TYPE_GENERATOR,
+ "GENERATOR",
+ 0,
+ "Generator",
+ "Generate a curve using a factorized or expanded polynomial"},
+ {FMODIFIER_TYPE_FN_GENERATOR,
+ "FNGENERATOR",
+ 0,
+ "Built-In Function",
+ "Generate a curve using standard math functions such as sin and cos"},
+ {FMODIFIER_TYPE_ENVELOPE,
+ "ENVELOPE",
+ 0,
+ "Envelope",
+ "Reshape F-Curve values - e.g. change amplitude of movements"},
+ {FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", "Cyclic extend/repeat keyframe sequence"},
+ {FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", "Add pseudo-random noise on top of F-Curves"},
+ /*{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},*/ /* FIXME: not implemented yet! */
+ /*{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},*/ /* FIXME: not implemented yet! */
+ {FMODIFIER_TYPE_LIMITS,
+ "LIMITS",
+ 0,
+ "Limits",
+ "Restrict maximum and minimum values of F-Curve"},
+ {FMODIFIER_TYPE_STEPPED,
+ "STEPPED",
+ 0,
+ "Stepped Interpolation",
+ "Snap values to nearest grid-step - e.g. for a stop-motion look"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[] = {
- {BEZT_KEYTYPE_KEYFRAME, "KEYFRAME", ICON_KEYTYPE_KEYFRAME_VEC, "Keyframe", "Normal keyframe - e.g. for key poses"},
- {BEZT_KEYTYPE_BREAKDOWN, "BREAKDOWN", ICON_KEYTYPE_BREAKDOWN_VEC, "Breakdown", "A breakdown pose - e.g. for transitions between key poses"},
- {BEZT_KEYTYPE_MOVEHOLD, "MOVING_HOLD", ICON_KEYTYPE_MOVING_HOLD_VEC, "Moving Hold", "A keyframe that is part of a moving hold"},
- {BEZT_KEYTYPE_EXTREME, "EXTREME", ICON_KEYTYPE_EXTREME_VEC, "Extreme", "An 'extreme' pose, or some other purpose as needed"},
- {BEZT_KEYTYPE_JITTER, "JITTER", ICON_KEYTYPE_JITTER_VEC, "Jitter", "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
- {0, NULL, 0, NULL, NULL},
+ {BEZT_KEYTYPE_KEYFRAME,
+ "KEYFRAME",
+ ICON_KEYTYPE_KEYFRAME_VEC,
+ "Keyframe",
+ "Normal keyframe - e.g. for key poses"},
+ {BEZT_KEYTYPE_BREAKDOWN,
+ "BREAKDOWN",
+ ICON_KEYTYPE_BREAKDOWN_VEC,
+ "Breakdown",
+ "A breakdown pose - e.g. for transitions between key poses"},
+ {BEZT_KEYTYPE_MOVEHOLD,
+ "MOVING_HOLD",
+ ICON_KEYTYPE_MOVING_HOLD_VEC,
+ "Moving Hold",
+ "A keyframe that is part of a moving hold"},
+ {BEZT_KEYTYPE_EXTREME,
+ "EXTREME",
+ ICON_KEYTYPE_EXTREME_VEC,
+ "Extreme",
+ "An 'extreme' pose, or some other purpose as needed"},
+ {BEZT_KEYTYPE_JITTER,
+ "JITTER",
+ ICON_KEYTYPE_JITTER_VEC,
+ "Jitter",
+ "A filler or baked keyframe for keying on ones, or some other purpose as needed"},
+ {0, NULL, 0, NULL, NULL},
};
-const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[] = {
- /* XXX: auto-easing is currently using a placeholder icon... */
- {BEZT_IPO_EASE_AUTO, "AUTO", ICON_IPO_EASE_IN_OUT, "Automatic Easing",
- "Easing type is chosen automatically based on what the type of interpolation used "
- "(e.g. 'Ease In' for transitional types, and 'Ease Out' for dynamic effects)"},
-
- {BEZT_IPO_EASE_IN, "EASE_IN", ICON_IPO_EASE_IN, "Ease In", "Only on the end closest to the next keyframe"},
- {BEZT_IPO_EASE_OUT, "EASE_OUT", ICON_IPO_EASE_OUT, "Ease Out", "Only on the end closest to the first keyframe"},
- {BEZT_IPO_EASE_IN_OUT, "EASE_IN_OUT", ICON_IPO_EASE_IN_OUT, "Ease In and Out", "Segment between both keyframes"},
- {0, NULL, 0, NULL, NULL},
+const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[] = {
+ /* XXX: auto-easing is currently using a placeholder icon... */
+ {BEZT_IPO_EASE_AUTO,
+ "AUTO",
+ ICON_IPO_EASE_IN_OUT,
+ "Automatic Easing",
+ "Easing type is chosen automatically based on what the type of interpolation used "
+ "(e.g. 'Ease In' for transitional types, and 'Ease Out' for dynamic effects)"},
+
+ {BEZT_IPO_EASE_IN,
+ "EASE_IN",
+ ICON_IPO_EASE_IN,
+ "Ease In",
+ "Only on the end closest to the next keyframe"},
+ {BEZT_IPO_EASE_OUT,
+ "EASE_OUT",
+ ICON_IPO_EASE_OUT,
+ "Ease Out",
+ "Only on the end closest to the first keyframe"},
+ {BEZT_IPO_EASE_IN_OUT,
+ "EASE_IN_OUT",
+ ICON_IPO_EASE_IN_OUT,
+ "Ease In and Out",
+ "Segment between both keyframes"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "WM_api.h"
+# include "WM_api.h"
static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr)
{
- FModifier *fcm = (FModifier *)ptr->data;
-
- switch (fcm->type) {
- case FMODIFIER_TYPE_GENERATOR:
- return &RNA_FModifierGenerator;
- case FMODIFIER_TYPE_FN_GENERATOR:
- return &RNA_FModifierFunctionGenerator;
- case FMODIFIER_TYPE_ENVELOPE:
- return &RNA_FModifierEnvelope;
- case FMODIFIER_TYPE_CYCLES:
- return &RNA_FModifierCycles;
- case FMODIFIER_TYPE_NOISE:
- return &RNA_FModifierNoise;
-#if 0
- case FMODIFIER_TYPE_FILTER:
- return &RNA_FModifierFilter;
-#endif
- case FMODIFIER_TYPE_PYTHON:
- return &RNA_FModifierPython;
- case FMODIFIER_TYPE_LIMITS:
- return &RNA_FModifierLimits;
- case FMODIFIER_TYPE_STEPPED:
- return &RNA_FModifierStepped;
- default:
- return &RNA_UnknownType;
- }
+ FModifier *fcm = (FModifier *)ptr->data;
+
+ switch (fcm->type) {
+ case FMODIFIER_TYPE_GENERATOR:
+ return &RNA_FModifierGenerator;
+ case FMODIFIER_TYPE_FN_GENERATOR:
+ return &RNA_FModifierFunctionGenerator;
+ case FMODIFIER_TYPE_ENVELOPE:
+ return &RNA_FModifierEnvelope;
+ case FMODIFIER_TYPE_CYCLES:
+ return &RNA_FModifierCycles;
+ case FMODIFIER_TYPE_NOISE:
+ return &RNA_FModifierNoise;
+# if 0
+ case FMODIFIER_TYPE_FILTER:
+ return &RNA_FModifierFilter;
+# endif
+ case FMODIFIER_TYPE_PYTHON:
+ return &RNA_FModifierPython;
+ case FMODIFIER_TYPE_LIMITS:
+ return &RNA_FModifierLimits;
+ case FMODIFIER_TYPE_STEPPED:
+ return &RNA_FModifierStepped;
+ default:
+ return &RNA_UnknownType;
+ }
}
/* ****************************** */
-#include "BKE_fcurve.h"
-#include "BKE_animsys.h"
+# include "BKE_fcurve.h"
+# include "BKE_animsys.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static bool rna_ChannelDriver_is_simple_expression_get(PointerRNA *ptr)
{
- ChannelDriver *driver = ptr->data;
+ ChannelDriver *driver = ptr->data;
- return BKE_driver_has_simple_expression(driver);
+ return BKE_driver_has_simple_expression(driver);
}
static void rna_ChannelDriver_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- ChannelDriver *driver = ptr->data;
+ ID *id = ptr->id.data;
+ ChannelDriver *driver = ptr->data;
- driver->flag &= ~DRIVER_FLAG_INVALID;
+ driver->flag &= ~DRIVER_FLAG_INVALID;
- /* TODO: this really needs an update guard... */
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update(id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ /* TODO: this really needs an update guard... */
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update(id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
+ WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
}
static void rna_ChannelDriver_update_expr(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ChannelDriver *driver = ptr->data;
+ ChannelDriver *driver = ptr->data;
- /* tag driver as needing to be recompiled */
- BKE_driver_invalidate_expression(driver, true, false);
+ /* tag driver as needing to be recompiled */
+ BKE_driver_invalidate_expression(driver, true, false);
- /* update_data() clears invalid flag and schedules for updates */
- rna_ChannelDriver_update_data(bmain, scene, ptr);
+ /* update_data() clears invalid flag and schedules for updates */
+ rna_ChannelDriver_update_data(bmain, scene, ptr);
}
static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- PointerRNA driverptr;
- ChannelDriver *driver;
- FCurve *fcu;
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ PointerRNA driverptr;
+ ChannelDriver *driver;
+ FCurve *fcu;
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
- /* find the driver this belongs to and update it */
- for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
- driver = fcu->driver;
- fcu->flag &= ~FCURVE_DISABLED;
+ /* find the driver this belongs to and update it */
+ for (fcu = adt->drivers.first; fcu; fcu = fcu->next) {
+ driver = fcu->driver;
+ fcu->flag &= ~FCURVE_DISABLED;
- if (driver) {
- /* FIXME: need to be able to search targets for required one... */
- /*BLI_findindex(&driver->targets, ptr->data) != -1) */
- RNA_pointer_create(ptr->id.data, &RNA_Driver, driver, &driverptr);
- rna_ChannelDriver_update_data(bmain, scene, &driverptr);
- return;
- }
- }
+ if (driver) {
+ /* FIXME: need to be able to search targets for required one... */
+ /*BLI_findindex(&driver->targets, ptr->data) != -1) */
+ RNA_pointer_create(ptr->id.data, &RNA_Driver, driver, &driverptr);
+ rna_ChannelDriver_update_data(bmain, scene, &driverptr);
+ return;
+ }
+ }
}
static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ChannelDriver *driver = ptr->data;
- rna_DriverTarget_update_data(bmain, scene, ptr);
+ ChannelDriver *driver = ptr->data;
+ rna_DriverTarget_update_data(bmain, scene, ptr);
- BKE_driver_invalidate_expression(driver, false, true);
+ BKE_driver_invalidate_expression(driver, false, true);
}
/* ----------- */
@@ -194,297 +241,301 @@ static void rna_DriverTarget_update_name(Main *bmain, Scene *scene, PointerRNA *
/* note: this function exists only to avoid id refcounting */
static void rna_DriverTarget_id_set(PointerRNA *ptr, PointerRNA value)
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
- dtar->id = value.data;
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
+ dtar->id = value.data;
}
static StructRNA *rna_DriverTarget_id_typef(PointerRNA *ptr)
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
- return ID_code_to_RNA_type(dtar->idtype);
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
+ return ID_code_to_RNA_type(dtar->idtype);
}
static int rna_DriverTarget_id_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
- return (dtar->idtype) ? PROP_EDITABLE : 0;
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
+ return (dtar->idtype) ? PROP_EDITABLE : 0;
}
static int rna_DriverTarget_id_type_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
- /* when the id-type can only be object, don't allow editing
- * otherwise, there may be strange crashes
- */
- return ((dtar->flag & DTAR_FLAG_ID_OB_ONLY) == 0);
+ /* when the id-type can only be object, don't allow editing
+ * otherwise, there may be strange crashes
+ */
+ return ((dtar->flag & DTAR_FLAG_ID_OB_ONLY) == 0);
}
static void rna_DriverTarget_id_type_set(PointerRNA *ptr, int value)
{
- DriverTarget *data = (DriverTarget *)(ptr->data);
+ DriverTarget *data = (DriverTarget *)(ptr->data);
- /* check if ID-type is settable */
- if ((data->flag & DTAR_FLAG_ID_OB_ONLY) == 0) {
- /* change ID-type to the new type */
- data->idtype = value;
- }
- else {
- /* make sure ID-type is Object */
- data->idtype = ID_OB;
- }
+ /* check if ID-type is settable */
+ if ((data->flag & DTAR_FLAG_ID_OB_ONLY) == 0) {
+ /* change ID-type to the new type */
+ data->idtype = value;
+ }
+ else {
+ /* make sure ID-type is Object */
+ data->idtype = ID_OB;
+ }
- /* clear the id-block if the type is invalid */
- if ((data->id) && (GS(data->id->name) != data->idtype))
- data->id = NULL;
+ /* clear the id-block if the type is invalid */
+ if ((data->id) && (GS(data->id->name) != data->idtype))
+ data->id = NULL;
}
static void rna_DriverTarget_RnaPath_get(PointerRNA *ptr, char *value)
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
- if (dtar->rna_path)
- strcpy(value, dtar->rna_path);
- else
- value[0] = '\0';
+ if (dtar->rna_path)
+ strcpy(value, dtar->rna_path);
+ else
+ value[0] = '\0';
}
static int rna_DriverTarget_RnaPath_length(PointerRNA *ptr)
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
- if (dtar->rna_path)
- return strlen(dtar->rna_path);
- else
- return 0;
+ if (dtar->rna_path)
+ return strlen(dtar->rna_path);
+ else
+ return 0;
}
static void rna_DriverTarget_RnaPath_set(PointerRNA *ptr, const char *value)
{
- DriverTarget *dtar = (DriverTarget *)ptr->data;
+ DriverTarget *dtar = (DriverTarget *)ptr->data;
- /* XXX in this case we need to be very careful, as this will require some new dependencies to be added! */
- if (dtar->rna_path)
- MEM_freeN(dtar->rna_path);
+ /* XXX in this case we need to be very careful, as this will require some new dependencies to be added! */
+ if (dtar->rna_path)
+ MEM_freeN(dtar->rna_path);
- if (value[0])
- dtar->rna_path = BLI_strdup(value);
- else
- dtar->rna_path = NULL;
+ if (value[0])
+ dtar->rna_path = BLI_strdup(value);
+ else
+ dtar->rna_path = NULL;
}
static void rna_DriverVariable_type_set(PointerRNA *ptr, int value)
{
- DriverVar *dvar = (DriverVar *)ptr->data;
+ DriverVar *dvar = (DriverVar *)ptr->data;
- /* call the API function for this */
- driver_change_variable_type(dvar, value);
+ /* call the API function for this */
+ driver_change_variable_type(dvar, value);
}
void rna_DriverVariable_name_set(PointerRNA *ptr, const char *value)
{
- DriverVar *data = (DriverVar *)(ptr->data);
+ DriverVar *data = (DriverVar *)(ptr->data);
- BLI_strncpy_utf8(data->name, value, 64);
- driver_variable_name_validate(data);
+ BLI_strncpy_utf8(data->name, value, 64);
+ driver_variable_name_validate(data);
}
-
/* ----------- */
static DriverVar *rna_Driver_new_variable(ChannelDriver *driver)
{
- /* call the API function for this */
- return driver_add_new_variable(driver);
+ /* call the API function for this */
+ return driver_add_new_variable(driver);
}
-static void rna_Driver_remove_variable(ChannelDriver *driver, ReportList *reports, PointerRNA *dvar_ptr)
+static void rna_Driver_remove_variable(ChannelDriver *driver,
+ ReportList *reports,
+ PointerRNA *dvar_ptr)
{
- DriverVar *dvar = dvar_ptr->data;
- if (BLI_findindex(&driver->variables, dvar) == -1) {
- BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver");
- return;
- }
+ DriverVar *dvar = dvar_ptr->data;
+ if (BLI_findindex(&driver->variables, dvar) == -1) {
+ BKE_report(reports, RPT_ERROR, "Variable does not exist in this driver");
+ return;
+ }
- driver_free_variable_ex(driver, dvar);
- RNA_POINTER_INVALIDATE(dvar_ptr);
+ driver_free_variable_ex(driver, dvar);
+ RNA_POINTER_INVALIDATE(dvar_ptr);
}
/* ****************************** */
static void rna_FKeyframe_handle1_get(PointerRNA *ptr, float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
+ BezTriple *bezt = (BezTriple *)ptr->data;
- values[0] = bezt->vec[0][0];
- values[1] = bezt->vec[0][1];
+ values[0] = bezt->vec[0][0];
+ values[1] = bezt->vec[0][1];
}
static void rna_FKeyframe_handle1_set(PointerRNA *ptr, const float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
+ BezTriple *bezt = (BezTriple *)ptr->data;
- bezt->vec[0][0] = values[0];
- bezt->vec[0][1] = values[1];
+ bezt->vec[0][0] = values[0];
+ bezt->vec[0][1] = values[1];
}
static void rna_FKeyframe_handle2_get(PointerRNA *ptr, float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
+ BezTriple *bezt = (BezTriple *)ptr->data;
- values[0] = bezt->vec[2][0];
- values[1] = bezt->vec[2][1];
+ values[0] = bezt->vec[2][0];
+ values[1] = bezt->vec[2][1];
}
static void rna_FKeyframe_handle2_set(PointerRNA *ptr, const float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
+ BezTriple *bezt = (BezTriple *)ptr->data;
- bezt->vec[2][0] = values[0];
- bezt->vec[2][1] = values[1];
+ bezt->vec[2][0] = values[0];
+ bezt->vec[2][1] = values[1];
}
static void rna_FKeyframe_ctrlpoint_get(PointerRNA *ptr, float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
+ BezTriple *bezt = (BezTriple *)ptr->data;
- values[0] = bezt->vec[1][0];
- values[1] = bezt->vec[1][1];
+ values[0] = bezt->vec[1][0];
+ values[1] = bezt->vec[1][1];
}
static void rna_FKeyframe_ctrlpoint_set(PointerRNA *ptr, const float *values)
{
- BezTriple *bezt = (BezTriple *)ptr->data;
+ BezTriple *bezt = (BezTriple *)ptr->data;
- bezt->vec[1][0] = values[0];
- bezt->vec[1][1] = values[1];
+ bezt->vec[1][0] = values[0];
+ bezt->vec[1][1] = values[1];
}
/* ****************************** */
static void rna_FCurve_RnaPath_get(PointerRNA *ptr, char *value)
{
- FCurve *fcu = (FCurve *)ptr->data;
+ FCurve *fcu = (FCurve *)ptr->data;
- if (fcu->rna_path)
- strcpy(value, fcu->rna_path);
- else
- value[0] = '\0';
+ if (fcu->rna_path)
+ strcpy(value, fcu->rna_path);
+ else
+ value[0] = '\0';
}
static int rna_FCurve_RnaPath_length(PointerRNA *ptr)
{
- FCurve *fcu = (FCurve *)ptr->data;
+ FCurve *fcu = (FCurve *)ptr->data;
- if (fcu->rna_path)
- return strlen(fcu->rna_path);
- else
- return 0;
+ if (fcu->rna_path)
+ return strlen(fcu->rna_path);
+ else
+ return 0;
}
static void rna_FCurve_RnaPath_set(PointerRNA *ptr, const char *value)
{
- FCurve *fcu = (FCurve *)ptr->data;
+ FCurve *fcu = (FCurve *)ptr->data;
- if (fcu->rna_path)
- MEM_freeN(fcu->rna_path);
+ if (fcu->rna_path)
+ MEM_freeN(fcu->rna_path);
- if (value[0]) {
- fcu->rna_path = BLI_strdup(value);
- fcu->flag &= ~FCURVE_DISABLED;
- }
- else
- fcu->rna_path = NULL;
+ if (value[0]) {
+ fcu->rna_path = BLI_strdup(value);
+ fcu->flag &= ~FCURVE_DISABLED;
+ }
+ else
+ fcu->rna_path = NULL;
}
static void rna_FCurve_group_set(PointerRNA *ptr, PointerRNA value)
{
- ID *pid = (ID *)ptr->id.data;
- ID *vid = (ID *)value.id.data;
- FCurve *fcu = ptr->data;
- bAction *act = NULL;
-
- /* get action */
- if (ELEM(NULL, pid, vid)) {
- printf("ERROR: one of the ID's for the groups to assign to is invalid (ptr=%p, val=%p)\n", pid, vid);
- return;
- }
- else if (value.data && (pid != vid)) {
- /* id's differ, cant do this, should raise an error */
- printf("ERROR: ID's differ - ptr=%p vs value=%p\n", pid, vid);
- return;
- }
-
- if (GS(pid->name) == ID_AC && GS(vid->name) == ID_AC) {
- /* the ID given is the action already - usually when F-Curve is obtained from an action's pointer */
- act = (bAction *)pid;
- }
- else {
- /* the ID given is the owner of the F-Curve (for drivers) */
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
- act = (adt) ? adt->action : NULL;
- }
-
- /* already belongs to group? */
- if (fcu->grp == value.data) {
- /* nothing to do */
- printf("ERROR: F-Curve already belongs to this group\n");
- return;
- }
-
- /* can only change group if we have info about the action the F-Curve is in
- * (i.e. for drivers or random F-Curves, this cannot be done)
- */
- if (act == NULL) {
- /* can't change the grouping of F-Curve when it doesn't belong to an action */
- printf("ERROR: cannot assign F-Curve to group, since F-Curve is not attached to any ID\n");
- return;
- }
- /* make sure F-Curve exists in this action first, otherwise we could still have been tricked */
- else if (BLI_findindex(&act->curves, fcu) == -1) {
- printf("ERROR: F-Curve (%p) doesn't exist in action '%s'\n", fcu, act->id.name);
- return;
- }
-
- /* try to remove F-Curve from action (including from any existing groups) */
- action_groups_remove_channel(act, fcu);
-
- /* add the F-Curve back to the action now in the right place */
- /* TODO: make the api function handle the case where there isn't any group to assign to */
- if (value.data) {
- /* add to its group using API function, which makes sure everything goes ok */
- action_groups_add_channel(act, value.data, fcu);
- }
- else {
- /* need to add this back, but it can only go at the end of the list (or else will corrupt groups) */
- BLI_addtail(&act->curves, fcu);
- }
+ ID *pid = (ID *)ptr->id.data;
+ ID *vid = (ID *)value.id.data;
+ FCurve *fcu = ptr->data;
+ bAction *act = NULL;
+
+ /* get action */
+ if (ELEM(NULL, pid, vid)) {
+ printf("ERROR: one of the ID's for the groups to assign to is invalid (ptr=%p, val=%p)\n",
+ pid,
+ vid);
+ return;
+ }
+ else if (value.data && (pid != vid)) {
+ /* id's differ, cant do this, should raise an error */
+ printf("ERROR: ID's differ - ptr=%p vs value=%p\n", pid, vid);
+ return;
+ }
+
+ if (GS(pid->name) == ID_AC && GS(vid->name) == ID_AC) {
+ /* the ID given is the action already - usually when F-Curve is obtained from an action's pointer */
+ act = (bAction *)pid;
+ }
+ else {
+ /* the ID given is the owner of the F-Curve (for drivers) */
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ act = (adt) ? adt->action : NULL;
+ }
+
+ /* already belongs to group? */
+ if (fcu->grp == value.data) {
+ /* nothing to do */
+ printf("ERROR: F-Curve already belongs to this group\n");
+ return;
+ }
+
+ /* can only change group if we have info about the action the F-Curve is in
+ * (i.e. for drivers or random F-Curves, this cannot be done)
+ */
+ if (act == NULL) {
+ /* can't change the grouping of F-Curve when it doesn't belong to an action */
+ printf("ERROR: cannot assign F-Curve to group, since F-Curve is not attached to any ID\n");
+ return;
+ }
+ /* make sure F-Curve exists in this action first, otherwise we could still have been tricked */
+ else if (BLI_findindex(&act->curves, fcu) == -1) {
+ printf("ERROR: F-Curve (%p) doesn't exist in action '%s'\n", fcu, act->id.name);
+ return;
+ }
+
+ /* try to remove F-Curve from action (including from any existing groups) */
+ action_groups_remove_channel(act, fcu);
+
+ /* add the F-Curve back to the action now in the right place */
+ /* TODO: make the api function handle the case where there isn't any group to assign to */
+ if (value.data) {
+ /* add to its group using API function, which makes sure everything goes ok */
+ action_groups_add_channel(act, value.data, fcu);
+ }
+ else {
+ /* need to add this back, but it can only go at the end of the list (or else will corrupt groups) */
+ BLI_addtail(&act->curves, fcu);
+ }
}
/* calculate time extents of F-Curve */
static void rna_FCurve_range(FCurve *fcu, float range[2])
{
- calc_fcurve_range(fcu, range, range + 1, false, false);
+ calc_fcurve_range(fcu, range, range + 1, false, false);
}
-
/* allow scripts to update curve after editing manually */
static void rna_FCurve_update_data_ex(FCurve *fcu)
{
- sort_time_fcurve(fcu);
- calchandles_fcurve(fcu);
+ sort_time_fcurve(fcu);
+ calchandles_fcurve(fcu);
}
/* RNA update callback for F-Curves after curve shape changes */
static void rna_FCurve_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- BLI_assert(ptr->type == &RNA_FCurve);
- rna_FCurve_update_data_ex((FCurve *)ptr->data);
+ BLI_assert(ptr->type == &RNA_FCurve);
+ rna_FCurve_update_data_ex((FCurve *)ptr->data);
}
-static void rna_FCurve_update_data_relations(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_FCurve_update_data_relations(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
}
/* RNA update callback for F-Curves to indicate that there are copy-on-write tagging/flushing needed
@@ -492,1632 +543,1850 @@ static void rna_FCurve_update_data_relations(Main *bmain, Scene *UNUSED(scene),
*/
static void rna_FCurve_update_eval(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
- if (iat && iat->adt && iat->adt->action) {
- /* action is separate datablock, needs separate tag */
- DEG_id_tag_update(&iat->adt->action->id, ID_RECALC_ANIMATION);
- }
+ IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
+ if (iat && iat->adt && iat->adt->action) {
+ /* action is separate datablock, needs separate tag */
+ DEG_id_tag_update(&iat->adt->action->id, ID_RECALC_ANIMATION);
+ }
}
-
static PointerRNA rna_FCurve_active_modifier_get(PointerRNA *ptr)
{
- FCurve *fcu = (FCurve *)ptr->data;
- FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
- return rna_pointer_inherit_refine(ptr, &RNA_FModifier, fcm);
+ FCurve *fcu = (FCurve *)ptr->data;
+ FModifier *fcm = find_active_fmodifier(&fcu->modifiers);
+ return rna_pointer_inherit_refine(ptr, &RNA_FModifier, fcm);
}
static void rna_FCurve_active_modifier_set(PointerRNA *ptr, PointerRNA value)
{
- FCurve *fcu = (FCurve *)ptr->data;
- set_active_fmodifier(&fcu->modifiers, (FModifier *)value.data);
+ FCurve *fcu = (FCurve *)ptr->data;
+ set_active_fmodifier(&fcu->modifiers, (FModifier *)value.data);
}
static FModifier *rna_FCurve_modifiers_new(FCurve *fcu, int type)
{
- return add_fmodifier(&fcu->modifiers, type, fcu);
+ return add_fmodifier(&fcu->modifiers, type, fcu);
}
static void rna_FCurve_modifiers_remove(FCurve *fcu, ReportList *reports, PointerRNA *fcm_ptr)
{
- FModifier *fcm = fcm_ptr->data;
- if (BLI_findindex(&fcu->modifiers, fcm) == -1) {
- BKE_reportf(reports, RPT_ERROR, "F-Curve modifier '%s' not found in F-Curve", fcm->name);
- return;
- }
+ FModifier *fcm = fcm_ptr->data;
+ if (BLI_findindex(&fcu->modifiers, fcm) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "F-Curve modifier '%s' not found in F-Curve", fcm->name);
+ return;
+ }
- remove_fmodifier(&fcu->modifiers, fcm);
- RNA_POINTER_INVALIDATE(fcm_ptr);
+ remove_fmodifier(&fcu->modifiers, fcm);
+ RNA_POINTER_INVALIDATE(fcm_ptr);
}
static void rna_FModifier_active_set(PointerRNA *ptr, bool UNUSED(value))
{
- FModifier *fcm = (FModifier *)ptr->data;
+ FModifier *fcm = (FModifier *)ptr->data;
- /* don't toggle, always switch on */
- fcm->flag |= FMODIFIER_FLAG_ACTIVE;
+ /* don't toggle, always switch on */
+ fcm->flag |= FMODIFIER_FLAG_ACTIVE;
}
static void rna_FModifier_start_frame_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
+ FModifier *fcm = (FModifier *)ptr->data;
- CLAMP(value, MINAFRAMEF, MAXFRAMEF);
- fcm->sfra = value;
+ CLAMP(value, MINAFRAMEF, MAXFRAMEF);
+ fcm->sfra = value;
- /* XXX: maintain old offset? */
- if (fcm->sfra >= fcm->efra) {
- fcm->efra = fcm->sfra;
- }
+ /* XXX: maintain old offset? */
+ if (fcm->sfra >= fcm->efra) {
+ fcm->efra = fcm->sfra;
+ }
}
static void rna_FModifer_end_frame_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
+ FModifier *fcm = (FModifier *)ptr->data;
- CLAMP(value, MINAFRAMEF, MAXFRAMEF);
- fcm->efra = value;
+ CLAMP(value, MINAFRAMEF, MAXFRAMEF);
+ fcm->efra = value;
- /* XXX: maintain old offset? */
- if (fcm->efra <= fcm->sfra) {
- fcm->sfra = fcm->efra;
- }
+ /* XXX: maintain old offset? */
+ if (fcm->efra <= fcm->sfra) {
+ fcm->sfra = fcm->efra;
+ }
}
-static void rna_FModifier_start_frame_range(PointerRNA *UNUSED(ptr), float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifier_start_frame_range(PointerRNA *UNUSED(ptr),
+ float *min,
+ float *max,
+ float *UNUSED(softmin),
+ float *UNUSED(softmax))
{
- // FModifier *fcm = (FModifier *)ptr->data;
+ // FModifier *fcm = (FModifier *)ptr->data;
- /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
- * or else it becomes tricky to adjust the range... [#36844]
- *
- * NOTE: we do not set soft-limits on lower bounds, as it's too confusing when you
- * can't easily use the slider to set things here
- */
- *min = MINAFRAMEF;
- *max = MAXFRAMEF;
+ /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
+ * or else it becomes tricky to adjust the range... [#36844]
+ *
+ * NOTE: we do not set soft-limits on lower bounds, as it's too confusing when you
+ * can't easily use the slider to set things here
+ */
+ *min = MINAFRAMEF;
+ *max = MAXFRAMEF;
}
-static void rna_FModifier_end_frame_range(PointerRNA *ptr, float *min, float *max,
- float *softmin, float *softmax)
+static void rna_FModifier_end_frame_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- FModifier *fcm = (FModifier *)ptr->data;
+ FModifier *fcm = (FModifier *)ptr->data;
- /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
- * or else it becomes tricky to adjust the range... [#36844]
- */
- *min = MINAFRAMEF;
- *softmin = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
+ /* Technically, "sfra <= efra" must hold; however, we can't strictly enforce that,
+ * or else it becomes tricky to adjust the range... [#36844]
+ */
+ *min = MINAFRAMEF;
+ *softmin = (fcm->flag & FMODIFIER_FLAG_RANGERESTRICT) ? fcm->sfra : MINAFRAMEF;
- *softmax = MAXFRAMEF;
- *max = MAXFRAMEF;
+ *softmax = MAXFRAMEF;
+ *max = MAXFRAMEF;
}
-static void rna_FModifier_blending_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifier_blending_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- FModifier *fcm = (FModifier *)ptr->data;
+ FModifier *fcm = (FModifier *)ptr->data;
- *min = 0.0f;
- *max = fcm->efra - fcm->sfra;
+ *min = 0.0f;
+ *max = fcm->efra - fcm->sfra;
}
static void rna_FModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- FModifier *fcm = (FModifier *)ptr->data;
- AnimData *adt = BKE_animdata_from_id(id);
+ ID *id = ptr->id.data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ AnimData *adt = BKE_animdata_from_id(id);
- DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
- /* tag datablock for time update so that animation is recalculated,
- * as FModifiers affect how animation plays...
- */
- DEG_id_tag_update(id, ID_RECALC_ANIMATION);
- if (adt != NULL) {
- if (adt->action != NULL) {
- /* action is separate datablock, needs separate tag */
- DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION);
- }
- }
+ /* tag datablock for time update so that animation is recalculated,
+ * as FModifiers affect how animation plays...
+ */
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+ if (adt != NULL) {
+ if (adt->action != NULL) {
+ /* action is separate datablock, needs separate tag */
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION);
+ }
+ }
- if (fcm->curve && fcm->type == FMODIFIER_TYPE_CYCLES) {
- calchandles_fcurve(fcm->curve);
- }
+ if (fcm->curve && fcm->type == FMODIFIER_TYPE_CYCLES) {
+ calchandles_fcurve(fcm->curve);
+ }
}
static void rna_FModifier_verify_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- FModifier *fcm = (FModifier *)ptr->data;
- const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
+ FModifier *fcm = (FModifier *)ptr->data;
+ const FModifierTypeInfo *fmi = fmodifier_get_typeinfo(fcm);
- /* call the verify callback on the modifier if applicable */
- if (fmi && fmi->verify_data)
- fmi->verify_data(fcm);
+ /* call the verify callback on the modifier if applicable */
+ if (fmi && fmi->verify_data)
+ fmi->verify_data(fcm);
- rna_FModifier_update(bmain, scene, ptr);
+ rna_FModifier_update(bmain, scene, ptr);
}
static void rna_FModifier_active_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- FModifier *fm, *fmo = (FModifier *)ptr->data;
+ FModifier *fm, *fmo = (FModifier *)ptr->data;
- /* clear active state of other FModifiers in this list */
- for (fm = fmo->prev; fm; fm = fm->prev) {
- fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
- }
- for (fm = fmo->next; fm; fm = fm->next) {
- fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
- }
+ /* clear active state of other FModifiers in this list */
+ for (fm = fmo->prev; fm; fm = fm->prev) {
+ fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
+ }
+ for (fm = fmo->next; fm; fm = fm->next) {
+ fm->flag &= ~FMODIFIER_FLAG_ACTIVE;
+ }
- rna_FModifier_update(bmain, scene, ptr);
+ rna_FModifier_update(bmain, scene, ptr);
}
-static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_FModifierGenerator_coefficients_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Generator *gen = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Generator *gen = fcm->data;
- if (gen)
- length[0] = gen->arraysize;
- else
- length[0] = 100; /* for raw_access, untested */
+ if (gen)
+ length[0] = gen->arraysize;
+ else
+ length[0] = 100; /* for raw_access, untested */
- return length[0];
+ return length[0];
}
static void rna_FModifierGenerator_coefficients_get(PointerRNA *ptr, float *values)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Generator *gen = fcm->data;
- memcpy(values, gen->coefficients, gen->arraysize * sizeof(float));
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Generator *gen = fcm->data;
+ memcpy(values, gen->coefficients, gen->arraysize * sizeof(float));
}
static void rna_FModifierGenerator_coefficients_set(PointerRNA *ptr, const float *values)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Generator *gen = fcm->data;
- memcpy(gen->coefficients, values, gen->arraysize * sizeof(float));
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Generator *gen = fcm->data;
+ memcpy(gen->coefficients, values, gen->arraysize * sizeof(float));
}
-
static void rna_FModifierLimits_minx_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Limits *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
- data->rect.xmin = value;
+ data->rect.xmin = value;
- if (data->rect.xmin >= data->rect.xmax) {
- data->rect.xmax = data->rect.xmin;
- }
+ if (data->rect.xmin >= data->rect.xmax) {
+ data->rect.xmax = data->rect.xmin;
+ }
}
static void rna_FModifierLimits_maxx_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Limits *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
- data->rect.xmax = value;
+ data->rect.xmax = value;
- if (data->rect.xmax <= data->rect.xmin) {
- data->rect.xmin = data->rect.xmax;
- }
+ if (data->rect.xmax <= data->rect.xmin) {
+ data->rect.xmin = data->rect.xmax;
+ }
}
static void rna_FModifierLimits_miny_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Limits *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
- data->rect.ymin = value;
+ data->rect.ymin = value;
- if (data->rect.ymin >= data->rect.ymax) {
- data->rect.ymax = data->rect.ymin;
- }
+ if (data->rect.ymin >= data->rect.ymax) {
+ data->rect.ymax = data->rect.ymin;
+ }
}
static void rna_FModifierLimits_maxy_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Limits *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
- data->rect.ymax = value;
+ data->rect.ymax = value;
- if (data->rect.ymax <= data->rect.ymin) {
- data->rect.ymin = data->rect.ymax;
- }
+ if (data->rect.ymax <= data->rect.ymin) {
+ data->rect.ymin = data->rect.ymax;
+ }
}
-static void rna_FModifierLimits_minx_range(PointerRNA *UNUSED(ptr), float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifierLimits_minx_range(PointerRNA *UNUSED(ptr),
+ float *min,
+ float *max,
+ float *UNUSED(softmin),
+ float *UNUSED(softmax))
{
- // FModifier *fcm = (FModifier *)ptr->data;
- // FMod_Limits *data = fcm->data;
+ // FModifier *fcm = (FModifier *)ptr->data;
+ // FMod_Limits *data = fcm->data;
- /* no soft-limits on lower bound - it's too confusing when you can't easily use the slider to set things here */
- *min = MINAFRAMEF;
- *max = MAXFRAMEF;
+ /* no soft-limits on lower bound - it's too confusing when you can't easily use the slider to set things here */
+ *min = MINAFRAMEF;
+ *max = MAXFRAMEF;
}
-static void rna_FModifierLimits_maxx_range(PointerRNA *ptr, float *min, float *max,
- float *softmin, float *softmax)
+static void rna_FModifierLimits_maxx_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Limits *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
- *min = MINAFRAMEF;
- *softmin = (data->flag & FCM_LIMIT_XMIN) ? data->rect.xmin : MINAFRAMEF;
+ *min = MINAFRAMEF;
+ *softmin = (data->flag & FCM_LIMIT_XMIN) ? data->rect.xmin : MINAFRAMEF;
- *softmax = MAXFRAMEF;
- *max = MAXFRAMEF;
+ *softmax = MAXFRAMEF;
+ *max = MAXFRAMEF;
}
-static void rna_FModifierLimits_miny_range(PointerRNA *UNUSED(ptr), float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifierLimits_miny_range(PointerRNA *UNUSED(ptr),
+ float *min,
+ float *max,
+ float *UNUSED(softmin),
+ float *UNUSED(softmax))
{
- // FModifier *fcm = (FModifier *)ptr->data;
- // FMod_Limits *data = fcm->data;
+ // FModifier *fcm = (FModifier *)ptr->data;
+ // FMod_Limits *data = fcm->data;
- /* no soft-limits on lower bound - it's too confusing when you can't easily use the slider to set things here */
- *min = -FLT_MAX;
- *max = FLT_MAX;
+ /* no soft-limits on lower bound - it's too confusing when you can't easily use the slider to set things here */
+ *min = -FLT_MAX;
+ *max = FLT_MAX;
}
-static void rna_FModifierLimits_maxy_range(PointerRNA *ptr, float *min, float *max,
- float *softmin, float *softmax)
+static void rna_FModifierLimits_maxy_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Limits *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Limits *data = fcm->data;
- *min = -FLT_MAX;
- *softmin = (data->flag & FCM_LIMIT_YMIN) ? data->rect.ymin : -FLT_MAX;
+ *min = -FLT_MAX;
+ *softmin = (data->flag & FCM_LIMIT_YMIN) ? data->rect.ymin : -FLT_MAX;
- *softmax = FLT_MAX;
- *max = FLT_MAX;
+ *softmax = FLT_MAX;
+ *max = FLT_MAX;
}
-
-static void rna_FModifierStepped_start_frame_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifierStepped_start_frame_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Stepped *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Stepped *data = fcm->data;
- *min = MINAFRAMEF;
- *max = (data->flag & FCM_STEPPED_NO_AFTER) ? data->end_frame : MAXFRAMEF;
+ *min = MINAFRAMEF;
+ *max = (data->flag & FCM_STEPPED_NO_AFTER) ? data->end_frame : MAXFRAMEF;
}
-static void rna_FModifierStepped_end_frame_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_FModifierStepped_end_frame_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Stepped *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Stepped *data = fcm->data;
- *min = (data->flag & FCM_STEPPED_NO_BEFORE) ? data->start_frame : MINAFRAMEF;
- *max = MAXFRAMEF;
+ *min = (data->flag & FCM_STEPPED_NO_BEFORE) ? data->start_frame : MINAFRAMEF;
+ *max = MAXFRAMEF;
}
static void rna_FModifierStepped_frame_start_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Stepped *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Stepped *data = fcm->data;
- float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;
- rna_FModifierStepped_start_frame_range(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);
- value = CLAMPIS(value, prop_clamp_min, prop_clamp_max);
+ float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;
+ rna_FModifierStepped_start_frame_range(
+ ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);
+ value = CLAMPIS(value, prop_clamp_min, prop_clamp_max);
- /* Need to set both step-data's start/end and the start/end on the base-data,
- * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009)
- */
- data->start_frame = value;
- fcm->sfra = value;
+ /* Need to set both step-data's start/end and the start/end on the base-data,
+ * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009)
+ */
+ data->start_frame = value;
+ fcm->sfra = value;
}
static void rna_FModifierStepped_frame_end_set(PointerRNA *ptr, float value)
{
- FModifier *fcm = (FModifier *)ptr->data;
- FMod_Stepped *data = fcm->data;
+ FModifier *fcm = (FModifier *)ptr->data;
+ FMod_Stepped *data = fcm->data;
- float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;
- rna_FModifierStepped_end_frame_range(ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);
- value = CLAMPIS(value, prop_clamp_min, prop_clamp_max);
+ float prop_clamp_min = -FLT_MAX, prop_clamp_max = FLT_MAX, prop_soft_min, prop_soft_max;
+ rna_FModifierStepped_end_frame_range(
+ ptr, &prop_clamp_min, &prop_clamp_max, &prop_soft_min, &prop_soft_max);
+ value = CLAMPIS(value, prop_clamp_min, prop_clamp_max);
- /* Need to set both step-data's start/end and the start/end on the base-data,
- * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009)
- */
- data->end_frame = value;
- fcm->efra = value;
+ /* Need to set both step-data's start/end and the start/end on the base-data,
+ * or else Restrict-Range doesn't work due to RNA-property shadowing (T52009)
+ */
+ data->end_frame = value;
+ fcm->efra = value;
}
-static BezTriple *rna_FKeyframe_points_insert(FCurve *fcu, float frame, float value, int keyframe_type, int flag)
+static BezTriple *rna_FKeyframe_points_insert(
+ FCurve *fcu, float frame, float value, int keyframe_type, int flag)
{
- int index = insert_vert_fcurve(fcu, frame, value, (char)keyframe_type, flag | INSERTKEY_NO_USERPREF);
- return ((fcu->bezt) && (index >= 0)) ? (fcu->bezt + index) : NULL;
+ int index = insert_vert_fcurve(
+ fcu, frame, value, (char)keyframe_type, flag | INSERTKEY_NO_USERPREF);
+ return ((fcu->bezt) && (index >= 0)) ? (fcu->bezt + index) : NULL;
}
static void rna_FKeyframe_points_add(FCurve *fcu, int tot)
{
- if (tot > 0) {
- BezTriple *bezt;
-
- fcu->bezt = MEM_recallocN(fcu->bezt, sizeof(BezTriple) * (fcu->totvert + tot));
-
- bezt = fcu->bezt + fcu->totvert;
- fcu->totvert += tot;
-
- while (tot--) {
- /* defaults, no userprefs gives predictable results for API */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_BEZ;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- bezt++;
- }
- }
+ if (tot > 0) {
+ BezTriple *bezt;
+
+ fcu->bezt = MEM_recallocN(fcu->bezt, sizeof(BezTriple) * (fcu->totvert + tot));
+
+ bezt = fcu->bezt + fcu->totvert;
+ fcu->totvert += tot;
+
+ while (tot--) {
+ /* defaults, no userprefs gives predictable results for API */
+ bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+ bezt->ipo = BEZT_IPO_BEZ;
+ bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
+ bezt++;
+ }
+ }
+}
+
+static void rna_FKeyframe_points_remove(FCurve *fcu,
+ ReportList *reports,
+ PointerRNA *bezt_ptr,
+ bool do_fast)
+{
+ BezTriple *bezt = bezt_ptr->data;
+ int index = (int)(bezt - fcu->bezt);
+ if (index < 0 || index >= fcu->totvert) {
+ BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve");
+ return;
+ }
+
+ delete_fcurve_key(fcu, index, !do_fast);
+ RNA_POINTER_INVALIDATE(bezt_ptr);
+}
+
+static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(FModifier *fmod,
+ ReportList *reports,
+ float frame)
+{
+ FCM_EnvelopeData fed;
+ FMod_Envelope *env = (FMod_Envelope *)fmod->data;
+ int i;
+
+ /* init template data */
+ fed.min = -1.0f;
+ fed.max = 1.0f;
+ fed.time = frame;
+ fed.f1 = fed.f2 = 0;
+
+ if (env->data) {
+ bool exists;
+ i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists);
+ if (exists) {
+ BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame);
+ return NULL;
+ }
+
+ /* realloc memory for extra point */
+ env->data = (FCM_EnvelopeData *)MEM_reallocN((void *)env->data,
+ (env->totvert + 1) * sizeof(FCM_EnvelopeData));
+
+ /* move the points after the added point */
+ if (i < env->totvert) {
+ memmove(env->data + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
+ }
+
+ env->totvert++;
+ }
+ else {
+ env->data = MEM_mallocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
+ env->totvert = 1;
+ i = 0;
+ }
+
+ /* add point to paste at index i */
+ *(env->data + i) = fed;
+ return (env->data + i);
+}
+
+static void rna_FModifierEnvelope_points_remove(FModifier *fmod,
+ ReportList *reports,
+ PointerRNA *point)
+{
+ FCM_EnvelopeData *cp = point->data;
+ FMod_Envelope *env = (FMod_Envelope *)fmod->data;
+
+ int index = (int)(cp - env->data);
+
+ /* test point is in range */
+ if (index < 0 || index >= env->totvert) {
+ BKE_report(reports, RPT_ERROR, "Control point not in Envelope F-Modifier");
+ return;
+ }
+
+ if (env->totvert > 1) {
+ /* move data after the removed point */
+
+ memmove(env->data + index,
+ env->data + (index + 1),
+ sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
+
+ /* realloc smaller array */
+ env->totvert--;
+ env->data = (FCM_EnvelopeData *)MEM_reallocN((void *)env->data,
+ (env->totvert) * sizeof(FCM_EnvelopeData));
+ }
+ else {
+ /* just free array, since the only vert was deleted */
+ if (env->data) {
+ MEM_freeN(env->data);
+ env->data = NULL;
+ }
+ env->totvert = 0;
+ }
+ RNA_POINTER_INVALIDATE(point);
}
-static void rna_FKeyframe_points_remove(FCurve *fcu, ReportList *reports, PointerRNA *bezt_ptr, bool do_fast)
-{
- BezTriple *bezt = bezt_ptr->data;
- int index = (int)(bezt - fcu->bezt);
- if (index < 0 || index >= fcu->totvert) {
- BKE_report(reports, RPT_ERROR, "Keyframe not in F-Curve");
- return;
- }
-
- delete_fcurve_key(fcu, index, !do_fast);
- RNA_POINTER_INVALIDATE(bezt_ptr);
-}
-
-static FCM_EnvelopeData *rna_FModifierEnvelope_points_add(FModifier *fmod, ReportList *reports, float frame)
-{
- FCM_EnvelopeData fed;
- FMod_Envelope *env = (FMod_Envelope *)fmod->data;
- int i;
-
- /* init template data */
- fed.min = -1.0f;
- fed.max = 1.0f;
- fed.time = frame;
- fed.f1 = fed.f2 = 0;
-
- if (env->data) {
- bool exists;
- i = BKE_fcm_envelope_find_index(env->data, frame, env->totvert, &exists);
- if (exists) {
- BKE_reportf(reports, RPT_ERROR, "Already a control point at frame %.6f", frame);
- return NULL;
- }
-
- /* realloc memory for extra point */
- env->data = (FCM_EnvelopeData *) MEM_reallocN((void *)env->data, (env->totvert + 1) * sizeof(FCM_EnvelopeData));
-
- /* move the points after the added point */
- if (i < env->totvert) {
- memmove(env->data + i + 1, env->data + i, (env->totvert - i) * sizeof(FCM_EnvelopeData));
- }
-
- env->totvert++;
- }
- else {
- env->data = MEM_mallocN(sizeof(FCM_EnvelopeData), "FCM_EnvelopeData");
- env->totvert = 1;
- i = 0;
- }
-
- /* add point to paste at index i */
- *(env->data + i) = fed;
- return (env->data + i);
-}
-
-static void rna_FModifierEnvelope_points_remove(FModifier *fmod, ReportList *reports, PointerRNA *point)
-{
- FCM_EnvelopeData *cp = point->data;
- FMod_Envelope *env = (FMod_Envelope *)fmod->data;
-
- int index = (int)(cp - env->data);
-
- /* test point is in range */
- if (index < 0 || index >= env->totvert) {
- BKE_report(reports, RPT_ERROR, "Control point not in Envelope F-Modifier");
- return;
- }
-
- if (env->totvert > 1) {
- /* move data after the removed point */
-
- memmove(env->data + index, env->data + (index + 1), sizeof(FCM_EnvelopeData) * ((env->totvert - index) - 1));
-
- /* realloc smaller array */
- env->totvert--;
- env->data = (FCM_EnvelopeData *) MEM_reallocN((void *)env->data, (env->totvert) * sizeof(FCM_EnvelopeData));
- }
- else {
- /* just free array, since the only vert was deleted */
- if (env->data) {
- MEM_freeN(env->data);
- env->data = NULL;
- }
- env->totvert = 0;
- }
- RNA_POINTER_INVALIDATE(point);
-}
-
-
static void rna_Keyframe_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- AnimData *adt = BKE_animdata_from_id(id);
+ ID *id = ptr->id.data;
+ AnimData *adt = BKE_animdata_from_id(id);
- DEG_id_tag_update(id, ID_RECALC_ANIMATION);
+ DEG_id_tag_update(id, ID_RECALC_ANIMATION);
- if (adt != NULL) {
- if (adt->action != NULL) {
- /* action is separate datablock, needs separate tag */
- DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION);
- }
- }
+ if (adt != NULL) {
+ if (adt->action != NULL) {
+ /* action is separate datablock, needs separate tag */
+ DEG_id_tag_update(&adt->action->id, ID_RECALC_ANIMATION);
+ }
+ }
}
#else
static void rna_def_fmodifier_generator(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem generator_mode_items[] = {
- {FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""},
- {FCM_GENERATOR_POLYNOMIAL_FACTORISED, "POLYNOMIAL_FACTORISED", 0, "Factorized Polynomial", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FModifierGenerator", "FModifier");
- RNA_def_struct_ui_text(srna, "Generator F-Modifier", "Deterministically generate values for the modified F-Curve");
- RNA_def_struct_sdna_from(srna, "FMod_Generator", "data");
-
- /* define common props */
- prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
- RNA_def_property_ui_text(prop, "Additive",
- "Values generated by this modifier are applied on top of "
- "the existing values instead of overwriting them");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, generator_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Type of generator to use");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
-
- /* order of the polynomial */
- prop = RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Polynomial Order",
- "The highest power of 'x' for this polynomial (number of coefficients - 1)");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
-
- /* coefficients array */
- prop = RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length");
- RNA_def_property_float_funcs(prop, "rna_FModifierGenerator_coefficients_get",
- "rna_FModifierGenerator_coefficients_set", NULL);
- RNA_def_property_ui_text(prop, "Coefficients", "Coefficients for 'x' (starting from lowest power of x^0)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem generator_mode_items[] = {
+ {FCM_GENERATOR_POLYNOMIAL, "POLYNOMIAL", 0, "Expanded Polynomial", ""},
+ {FCM_GENERATOR_POLYNOMIAL_FACTORISED,
+ "POLYNOMIAL_FACTORISED",
+ 0,
+ "Factorized Polynomial",
+ ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FModifierGenerator", "FModifier");
+ RNA_def_struct_ui_text(
+ srna, "Generator F-Modifier", "Deterministically generate values for the modified F-Curve");
+ RNA_def_struct_sdna_from(srna, "FMod_Generator", "data");
+
+ /* define common props */
+ prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
+ RNA_def_property_ui_text(prop,
+ "Additive",
+ "Values generated by this modifier are applied on top of "
+ "the existing values instead of overwriting them");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, generator_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Type of generator to use");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
+
+ /* order of the polynomial */
+ prop = RNA_def_property(srna, "poly_order", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Polynomial Order",
+ "The highest power of 'x' for this polynomial (number of coefficients - 1)");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_verify_data_update");
+
+ /* coefficients array */
+ prop = RNA_def_property(srna, "coefficients", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_FModifierGenerator_coefficients_get_length");
+ RNA_def_property_float_funcs(prop,
+ "rna_FModifierGenerator_coefficients_get",
+ "rna_FModifierGenerator_coefficients_set",
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Coefficients", "Coefficients for 'x' (starting from lowest power of x^0)");
}
/* --------- */
static void rna_def_fmodifier_function_generator(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_type_items[] = {
- {0, "SIN", 0, "Sine", ""},
- {1, "COS", 0, "Cosine", ""},
- {2, "TAN", 0, "Tangent", ""},
- {3, "SQRT", 0, "Square Root", ""},
- {4, "LN", 0, "Natural Logarithm", ""},
- {5, "SINC", 0, "Normalized Sine", "sin(x) / x"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier");
- RNA_def_struct_ui_text(srna, "Built-In Function F-Modifier", "Generate values using a Built-In Function");
- RNA_def_struct_sdna_from(srna, "FMod_FunctionGenerator", "data");
-
- /* coefficients */
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Amplitude", "Scale factor determining the maximum/minimum values");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Phase Multiplier", "Scale factor determining the 'speed' of the function");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Phase Offset", "Constant factor to offset time by for function");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "value_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Value Offset", "Constant factor to offset values by");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- /* flags */
- prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
- RNA_def_property_ui_text(prop, "Additive",
- "Values generated by this modifier are applied on top of "
- "the existing values instead of overwriting them");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "function_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, "Type", "Type of built-in function to use");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_type_items[] = {
+ {0, "SIN", 0, "Sine", ""},
+ {1, "COS", 0, "Cosine", ""},
+ {2, "TAN", 0, "Tangent", ""},
+ {3, "SQRT", 0, "Square Root", ""},
+ {4, "LN", 0, "Natural Logarithm", ""},
+ {5, "SINC", 0, "Normalized Sine", "sin(x) / x"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FModifierFunctionGenerator", "FModifier");
+ RNA_def_struct_ui_text(
+ srna, "Built-In Function F-Modifier", "Generate values using a Built-In Function");
+ RNA_def_struct_sdna_from(srna, "FMod_FunctionGenerator", "data");
+
+ /* coefficients */
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Amplitude", "Scale factor determining the maximum/minimum values");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "phase_multiplier", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Phase Multiplier", "Scale factor determining the 'speed' of the function");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "phase_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Phase Offset", "Constant factor to offset time by for function");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "value_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Value Offset", "Constant factor to offset values by");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_additive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_GENERATOR_ADDITIVE);
+ RNA_def_property_ui_text(prop,
+ "Additive",
+ "Values generated by this modifier are applied on top of "
+ "the existing values instead of overwriting them");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "function_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, "Type", "Type of built-in function to use");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
}
/* --------- */
static void rna_def_fmodifier_envelope_ctrl(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoint", NULL);
- RNA_def_struct_ui_text(srna, "Envelope Control Point", "Control point for envelope F-Modifier");
- RNA_def_struct_sdna(srna, "FCM_EnvelopeData");
+ srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoint", NULL);
+ RNA_def_struct_ui_text(srna, "Envelope Control Point", "Control point for envelope F-Modifier");
+ RNA_def_struct_sdna(srna, "FCM_EnvelopeData");
- /* min/max extents
- * - for now, these are allowed to go past each other, so that we can have inverted action
- * - technically, the range is limited by the settings in the envelope-modifier data, not here...
- */
- prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Minimum Value", "Lower bound of envelope at this control-point");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ /* min/max extents
+ * - for now, these are allowed to go past each other, so that we can have inverted action
+ * - technically, the range is limited by the settings in the envelope-modifier data, not here...
+ */
+ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum Value", "Lower bound of envelope at this control-point");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
- prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_ui_text(prop, "Maximum Value", "Upper bound of envelope at this control-point");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum Value", "Upper bound of envelope at this control-point");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
- /* Frame */
- prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "time");
- RNA_def_property_ui_text(prop, "Frame", "Frame this control-point occurs on");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ /* Frame */
+ prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "time");
+ RNA_def_property_ui_text(prop, "Frame", "Frame this control-point occurs on");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
- /* TODO: */
- /* - selection flags (not implemented in UI yet though) */
+ /* TODO: */
+ /* - selection flags (not implemented in UI yet though) */
}
static void rna_def_fmodifier_envelope_control_points(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "FModifierEnvelopeControlPoints");
- srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoints", NULL);
- RNA_def_struct_sdna(srna, "FModifier");
-
- RNA_def_struct_ui_text(srna, "Control Points", "Control points defining the shape of the envelope");
-
- func = RNA_def_function(srna, "add", "rna_FModifierEnvelope_points_add");
- RNA_def_function_ui_description(func, "Add a control point to a FModifierEnvelope");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "",
- "Frame to add this control-point", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "point", "FModifierEnvelopeControlPoint", "", "Newly created control-point");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_FModifierEnvelope_points_remove");
- RNA_def_function_ui_description(func, "Remove a control-point from an FModifierEnvelope");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "point", "FModifierEnvelopeControlPoint", "", "Control-point to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "FModifierEnvelopeControlPoints");
+ srna = RNA_def_struct(brna, "FModifierEnvelopeControlPoints", NULL);
+ RNA_def_struct_sdna(srna, "FModifier");
+
+ RNA_def_struct_ui_text(
+ srna, "Control Points", "Control points defining the shape of the envelope");
+
+ func = RNA_def_function(srna, "add", "rna_FModifierEnvelope_points_add");
+ RNA_def_function_ui_description(func, "Add a control point to a FModifierEnvelope");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_float(func,
+ "frame",
+ 0.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "Frame to add this control-point",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "point", "FModifierEnvelopeControlPoint", "", "Newly created control-point");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_FModifierEnvelope_points_remove");
+ RNA_def_function_ui_description(func, "Remove a control-point from an FModifierEnvelope");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "point", "FModifierEnvelopeControlPoint", "", "Control-point to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
}
-
static void rna_def_fmodifier_envelope(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FModifierEnvelope", "FModifier");
- RNA_def_struct_ui_text(srna, "Envelope F-Modifier", "Scale the values of the modified F-Curve");
- RNA_def_struct_sdna_from(srna, "FMod_Envelope", "data");
-
- /* Collections */
- prop = RNA_def_property(srna, "control_points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "data", "totvert");
- RNA_def_property_struct_type(prop, "FModifierEnvelopeControlPoint");
- RNA_def_property_ui_text(prop, "Control Points", "Control points defining the shape of the envelope");
- rna_def_fmodifier_envelope_control_points(brna, prop);
-
- /* Range Settings */
- prop = RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "midval");
- RNA_def_property_ui_text(prop, "Reference Value", "Value that envelope's influence is centered around / based on");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "default_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Default Minimum", "Lower distance from Reference Value for 1:1 default influence");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "default_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_ui_text(prop, "Default Maximum", "Upper distance from Reference Value for 1:1 default influence");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FModifierEnvelope", "FModifier");
+ RNA_def_struct_ui_text(srna, "Envelope F-Modifier", "Scale the values of the modified F-Curve");
+ RNA_def_struct_sdna_from(srna, "FMod_Envelope", "data");
+
+ /* Collections */
+ prop = RNA_def_property(srna, "control_points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "data", "totvert");
+ RNA_def_property_struct_type(prop, "FModifierEnvelopeControlPoint");
+ RNA_def_property_ui_text(
+ prop, "Control Points", "Control points defining the shape of the envelope");
+ rna_def_fmodifier_envelope_control_points(brna, prop);
+
+ /* Range Settings */
+ prop = RNA_def_property(srna, "reference_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "midval");
+ RNA_def_property_ui_text(
+ prop, "Reference Value", "Value that envelope's influence is centered around / based on");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "default_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(
+ prop, "Default Minimum", "Lower distance from Reference Value for 1:1 default influence");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "default_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(
+ prop, "Default Maximum", "Upper distance from Reference Value for 1:1 default influence");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
}
/* --------- */
static void rna_def_fmodifier_cycles(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_type_items[] = {
- {FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"},
- {FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"},
- {FCM_EXTRAPOLATE_CYCLIC_OFFSET, "REPEAT_OFFSET", 0, "Repeat with Offset",
- "Repeat keyframe range, but with offset based on gradient between "
- "start and end values"},
- {FCM_EXTRAPOLATE_MIRROR, "MIRROR", 0, "Repeat Mirrored",
- "Alternate between forward and reverse playback of keyframe range"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FModifierCycles", "FModifier");
- RNA_def_struct_ui_text(srna, "Cycles F-Modifier", "Repeat the values of the modified F-Curve");
- RNA_def_struct_sdna_from(srna, "FMod_Cycles", "data");
-
- /* before */
- prop = RNA_def_property(srna, "mode_before", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "before_mode");
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Before Mode", "Cycling mode to use before first keyframe");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "before_cycles");
- RNA_def_property_ui_text(prop, "Before Cycles",
- "Maximum number of cycles to allow before first keyframe (0 = infinite)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- /* after */
- prop = RNA_def_property(srna, "mode_after", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "after_mode");
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "After Mode", "Cycling mode to use after last keyframe");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "after_cycles");
- RNA_def_property_ui_text(prop, "After Cycles",
- "Maximum number of cycles to allow after last keyframe (0 = infinite)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_type_items[] = {
+ {FCM_EXTRAPOLATE_NONE, "NONE", 0, "No Cycles", "Don't do anything"},
+ {FCM_EXTRAPOLATE_CYCLIC, "REPEAT", 0, "Repeat Motion", "Repeat keyframe range as-is"},
+ {FCM_EXTRAPOLATE_CYCLIC_OFFSET,
+ "REPEAT_OFFSET",
+ 0,
+ "Repeat with Offset",
+ "Repeat keyframe range, but with offset based on gradient between "
+ "start and end values"},
+ {FCM_EXTRAPOLATE_MIRROR,
+ "MIRROR",
+ 0,
+ "Repeat Mirrored",
+ "Alternate between forward and reverse playback of keyframe range"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FModifierCycles", "FModifier");
+ RNA_def_struct_ui_text(srna, "Cycles F-Modifier", "Repeat the values of the modified F-Curve");
+ RNA_def_struct_sdna_from(srna, "FMod_Cycles", "data");
+
+ /* before */
+ prop = RNA_def_property(srna, "mode_before", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "before_mode");
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "Before Mode", "Cycling mode to use before first keyframe");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "cycles_before", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "before_cycles");
+ RNA_def_property_ui_text(
+ prop,
+ "Before Cycles",
+ "Maximum number of cycles to allow before first keyframe (0 = infinite)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ /* after */
+ prop = RNA_def_property(srna, "mode_after", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "after_mode");
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "After Mode", "Cycling mode to use after last keyframe");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "cycles_after", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "after_cycles");
+ RNA_def_property_ui_text(prop,
+ "After Cycles",
+ "Maximum number of cycles to allow after last keyframe (0 = infinite)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
}
/* --------- */
static void rna_def_fmodifier_python(BlenderRNA *brna)
{
- StructRNA *srna;
- /*PropertyRNA *prop; */
+ StructRNA *srna;
+ /*PropertyRNA *prop; */
- srna = RNA_def_struct(brna, "FModifierPython", "FModifier");
- RNA_def_struct_ui_text(srna, "Python F-Modifier", "Perform user-defined operation on the modified F-Curve");
- RNA_def_struct_sdna_from(srna, "FMod_Python", "data");
+ srna = RNA_def_struct(brna, "FModifierPython", "FModifier");
+ RNA_def_struct_ui_text(
+ srna, "Python F-Modifier", "Perform user-defined operation on the modified F-Curve");
+ RNA_def_struct_sdna_from(srna, "FMod_Python", "data");
}
/* --------- */
static void rna_def_fmodifier_limits(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FModifierLimits", "FModifier");
- RNA_def_struct_ui_text(srna, "Limit F-Modifier", "Limit the time/value ranges of the modified F-Curve");
- RNA_def_struct_sdna_from(srna, "FMod_Limits", "data");
-
- prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMIN);
- RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMIN);
- RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMAX);
- RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMAX);
- RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rect.xmin");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_minx_set", "rna_FModifierLimits_minx_range");
- RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rect.ymin");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_miny_set", "rna_FModifierLimits_miny_range");
- RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rect.xmax");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_maxx_set", "rna_FModifierLimits_maxx_range");
- RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rect.ymax");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifierLimits_maxy_set", "rna_FModifierLimits_maxy_range");
- RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FModifierLimits", "FModifier");
+ RNA_def_struct_ui_text(
+ srna, "Limit F-Modifier", "Limit the time/value ranges of the modified F-Curve");
+ RNA_def_struct_sdna_from(srna, "FMod_Limits", "data");
+
+ prop = RNA_def_property(srna, "use_min_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMIN);
+ RNA_def_property_ui_text(prop, "Minimum X", "Use the minimum X value");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "use_min_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMIN);
+ RNA_def_property_ui_text(prop, "Minimum Y", "Use the minimum Y value");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "use_max_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_XMAX);
+ RNA_def_property_ui_text(prop, "Maximum X", "Use the maximum X value");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "use_max_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_LIMIT_YMAX);
+ RNA_def_property_ui_text(prop, "Maximum Y", "Use the maximum Y value");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rect.xmin");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifierLimits_minx_set", "rna_FModifierLimits_minx_range");
+ RNA_def_property_ui_text(prop, "Minimum X", "Lowest X value to allow");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rect.ymin");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifierLimits_miny_set", "rna_FModifierLimits_miny_range");
+ RNA_def_property_ui_text(prop, "Minimum Y", "Lowest Y value to allow");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rect.xmax");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifierLimits_maxx_set", "rna_FModifierLimits_maxx_range");
+ RNA_def_property_ui_text(prop, "Maximum X", "Highest X value to allow");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rect.ymax");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifierLimits_maxy_set", "rna_FModifierLimits_maxy_range");
+ RNA_def_property_ui_text(prop, "Maximum Y", "Highest Y value to allow");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
}
/* --------- */
static void rna_def_fmodifier_noise(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_modification_items[] = {
- {FCM_NOISE_MODIF_REPLACE, "REPLACE", 0, "Replace", ""},
- {FCM_NOISE_MODIF_ADD, "ADD", 0, "Add", ""},
- {FCM_NOISE_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
- {FCM_NOISE_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FModifierNoise", "FModifier");
- RNA_def_struct_ui_text(srna, "Noise F-Modifier", "Give randomness to the modified F-Curve");
- RNA_def_struct_sdna_from(srna, "FMod_Noise", "data");
-
- prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "modification");
- RNA_def_property_enum_items(prop, prop_modification_items);
- RNA_def_property_ui_text(prop, "Blend Type", "Method of modifying the existing F-Curve");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_ui_text(prop, "Scale", "Scaling (in time) of the noise");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "strength");
- RNA_def_property_ui_text(prop, "Strength",
- "Amplitude of the noise - the amount that it modifies the underlying curve");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "phase");
- RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset", "Time offset for the noise effect");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "depth");
- RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_modification_items[] = {
+ {FCM_NOISE_MODIF_REPLACE, "REPLACE", 0, "Replace", ""},
+ {FCM_NOISE_MODIF_ADD, "ADD", 0, "Add", ""},
+ {FCM_NOISE_MODIF_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
+ {FCM_NOISE_MODIF_MULTIPLY, "MULTIPLY", 0, "Multiply", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FModifierNoise", "FModifier");
+ RNA_def_struct_ui_text(srna, "Noise F-Modifier", "Give randomness to the modified F-Curve");
+ RNA_def_struct_sdna_from(srna, "FMod_Noise", "data");
+
+ prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "modification");
+ RNA_def_property_enum_items(prop, prop_modification_items);
+ RNA_def_property_ui_text(prop, "Blend Type", "Method of modifying the existing F-Curve");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(prop, "Scale", "Scaling (in time) of the noise");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "strength");
+ RNA_def_property_ui_text(
+ prop,
+ "Strength",
+ "Amplitude of the noise - the amount that it modifies the underlying curve");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phase");
+ RNA_def_property_ui_text(prop, "Phase", "A random seed for the noise effect");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "Time offset for the noise effect");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "depth");
+ RNA_def_property_ui_text(prop, "Depth", "Amount of fine level detail present in the noise");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
}
/* --------- */
static void rna_def_fmodifier_stepped(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FModifierStepped", "FModifier");
- RNA_def_struct_ui_text(srna, "Stepped Interpolation F-Modifier",
- "Hold each interpolated value from the F-Curve for several frames without "
- "changing the timing");
- RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data");
-
- /* properties */
- prop = RNA_def_property(srna, "frame_step", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "step_size");
- RNA_def_property_ui_text(prop, "Step Size", "Number of frames to hold each value");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset",
- "Reference number of frames before frames get held "
- "(use to get hold for '1-3' vs '5-7' holding patterns)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_BEFORE);
- RNA_def_property_ui_text(prop, "Use Start Frame", "Restrict modifier to only act after its 'start' frame");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "use_frame_end", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_AFTER);
- RNA_def_property_ui_text(prop, "Use End Frame", "Restrict modifier to only act before its 'end' frame");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "start_frame");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifierStepped_frame_start_set", "rna_FModifierStepped_start_frame_range");
- RNA_def_property_ui_text(prop, "Start Frame", "Frame that modifier's influence starts (if applicable)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "end_frame");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifierStepped_frame_end_set", "rna_FModifierStepped_end_frame_range");
- RNA_def_property_ui_text(prop, "End Frame", "Frame that modifier's influence ends (if applicable)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FModifierStepped", "FModifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Stepped Interpolation F-Modifier",
+ "Hold each interpolated value from the F-Curve for several frames without "
+ "changing the timing");
+ RNA_def_struct_sdna_from(srna, "FMod_Stepped", "data");
+
+ /* properties */
+ prop = RNA_def_property(srna, "frame_step", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "step_size");
+ RNA_def_property_ui_text(prop, "Step Size", "Number of frames to hold each value");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "frame_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop,
+ "Offset",
+ "Reference number of frames before frames get held "
+ "(use to get hold for '1-3' vs '5-7' holding patterns)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "use_frame_start", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_BEFORE);
+ RNA_def_property_ui_text(
+ prop, "Use Start Frame", "Restrict modifier to only act after its 'start' frame");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "use_frame_end", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCM_STEPPED_NO_AFTER);
+ RNA_def_property_ui_text(
+ prop, "Use End Frame", "Restrict modifier to only act before its 'end' frame");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "start_frame");
+ RNA_def_property_float_funcs(prop,
+ NULL,
+ "rna_FModifierStepped_frame_start_set",
+ "rna_FModifierStepped_start_frame_range");
+ RNA_def_property_ui_text(
+ prop, "Start Frame", "Frame that modifier's influence starts (if applicable)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "end_frame");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifierStepped_frame_end_set", "rna_FModifierStepped_end_frame_range");
+ RNA_def_property_ui_text(
+ prop, "End Frame", "Frame that modifier's influence ends (if applicable)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FModifier_update");
}
/* --------- */
-
static void rna_def_fmodifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* base struct definition */
- srna = RNA_def_struct(brna, "FModifier", NULL);
- RNA_def_struct_refine_func(srna, "rna_FModifierType_refine");
- RNA_def_struct_ui_text(srna, "F-Modifier", "Modifier for values of F-Curve");
-
-#if 0 /* XXX not used yet */
- /* name */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_ui_text(prop, "Name", "Short description of F-Curve Modifier");
-#endif /* XXX not used yet */
-
- /* type */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_fmodifier_type_items);
- RNA_def_property_ui_text(prop, "Type", "F-Curve Modifier Type");
-
- /* settings */
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_EXPANDED);
- RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
- RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
-
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FMODIFIER_FLAG_DISABLED);
- RNA_def_property_ui_text(prop, "Disabled", "F-Curve Modifier has invalid settings and will not be evaluated");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
-
- /* TODO: setting this to true must ensure that all others in stack are turned off too... */
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_ACTIVE);
- RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited ");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_active_set");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_active_update");
- RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1);
-
- /* restricted range */
- prop = RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_RANGERESTRICT);
- RNA_def_property_ui_text(prop, "Restrict Frame Range",
- "F-Curve Modifier is only applied for the specified frame range to help "
- "mask off effects in order to chain them");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); /* XXX: depends on UI implementation */
-
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sfra");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifier_start_frame_set", "rna_FModifier_start_frame_range");
- RNA_def_property_ui_text(prop, "Start Frame",
- "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "efra");
- RNA_def_property_float_funcs(prop, NULL, "rna_FModifer_end_frame_set", "rna_FModifier_end_frame_range");
- RNA_def_property_ui_text(prop, "End Frame",
- "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "blendin");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
- RNA_def_property_ui_text(prop, "Blend In", "Number of frames from start frame for influence to take effect");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
-
- prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "blendout");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
- RNA_def_property_ui_text(prop, "Blend Out", "Number of frames from end frame for influence to fade out");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
-
- /* influence */
- prop = RNA_def_property(srna, "use_influence", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_USEINFLUENCE);
- RNA_def_property_ui_text(prop, "Use Influence", "F-Curve Modifier's effects will be tempered by a default factor");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1); /* XXX: depends on UI implementation */
-
- prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "influence");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Influence",
- "Amount of influence F-Curve Modifier will have when not fading in/out");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* base struct definition */
+ srna = RNA_def_struct(brna, "FModifier", NULL);
+ RNA_def_struct_refine_func(srna, "rna_FModifierType_refine");
+ RNA_def_struct_ui_text(srna, "F-Modifier", "Modifier for values of F-Curve");
+
+# if 0 /* XXX not used yet */
+ /* name */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_ui_text(prop, "Name", "Short description of F-Curve Modifier");
+# endif /* XXX not used yet */
+
+ /* type */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_fmodifier_type_items);
+ RNA_def_property_ui_text(prop, "Type", "F-Curve Modifier Type");
+
+ /* settings */
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "F-Curve Modifier's panel is expanded in UI");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_MUTED);
+ RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+ RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
+
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FMODIFIER_FLAG_DISABLED);
+ RNA_def_property_ui_text(
+ prop, "Disabled", "F-Curve Modifier has invalid settings and will not be evaluated");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+
+ /* TODO: setting this to true must ensure that all others in stack are turned off too... */
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_ACTIVE);
+ RNA_def_property_ui_text(prop, "Active", "F-Curve Modifier is the one being edited ");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_FModifier_active_set");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_active_update");
+ RNA_def_property_ui_icon(prop, ICON_RADIOBUT_OFF, 1);
+
+ /* restricted range */
+ prop = RNA_def_property(srna, "use_restricted_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_RANGERESTRICT);
+ RNA_def_property_ui_text(
+ prop,
+ "Restrict Frame Range",
+ "F-Curve Modifier is only applied for the specified frame range to help "
+ "mask off effects in order to chain them");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+ RNA_def_property_ui_icon(
+ prop, ICON_DISCLOSURE_TRI_RIGHT, 1); /* XXX: depends on UI implementation */
+
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sfra");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifier_start_frame_set", "rna_FModifier_start_frame_range");
+ RNA_def_property_ui_text(
+ prop,
+ "Start Frame",
+ "Frame that modifier's influence starts (if Restrict Frame Range is in use)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "efra");
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_FModifer_end_frame_set", "rna_FModifier_end_frame_range");
+ RNA_def_property_ui_text(
+ prop,
+ "End Frame",
+ "Frame that modifier's influence ends (if Restrict Frame Range is in use)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "blendin");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
+ RNA_def_property_ui_text(
+ prop, "Blend In", "Number of frames from start frame for influence to take effect");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+
+ prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "blendout");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_FModifier_blending_range");
+ RNA_def_property_ui_text(
+ prop, "Blend Out", "Number of frames from end frame for influence to fade out");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+
+ /* influence */
+ prop = RNA_def_property(srna, "use_influence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FMODIFIER_FLAG_USEINFLUENCE);
+ RNA_def_property_ui_text(
+ prop, "Use Influence", "F-Curve Modifier's effects will be tempered by a default factor");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
+ RNA_def_property_ui_icon(
+ prop, ICON_DISCLOSURE_TRI_RIGHT, 1); /* XXX: depends on UI implementation */
+
+ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "influence");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Influence", "Amount of influence F-Curve Modifier will have when not fading in/out");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_FModifier_update");
}
/* *********************** */
static void rna_def_drivertarget(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_trans_chan_items[] = {
- {DTAR_TRANSCHAN_LOCX, "LOC_X", 0, "X Location", ""},
- {DTAR_TRANSCHAN_LOCY, "LOC_Y", 0, "Y Location", ""},
- {DTAR_TRANSCHAN_LOCZ, "LOC_Z", 0, "Z Location", ""},
- {DTAR_TRANSCHAN_ROTX, "ROT_X", 0, "X Rotation", ""},
- {DTAR_TRANSCHAN_ROTY, "ROT_Y", 0, "Y Rotation", ""},
- {DTAR_TRANSCHAN_ROTZ, "ROT_Z", 0, "Z Rotation", ""},
- {DTAR_TRANSCHAN_SCALEX, "SCALE_X", 0, "X Scale", ""},
- {DTAR_TRANSCHAN_SCALEY, "SCALE_Y", 0, "Y Scale", ""},
- {DTAR_TRANSCHAN_SCALEZ, "SCALE_Z", 0, "Z Scale", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_local_space_items[] = {
- {0, "WORLD_SPACE", 0, "World Space", "Transforms include effects of parenting/restpose and constraints"},
- {DTAR_FLAG_LOCALSPACE, "TRANSFORM_SPACE", 0, "Transform Space",
- "Transforms don't include parenting/restpose or constraints"},
- {DTAR_FLAG_LOCALSPACE | DTAR_FLAG_LOCAL_CONSTS, "LOCAL_SPACE", 0, "Local Space",
- "Transforms include effects of constraints but not "
- "parenting/restpose"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "DriverTarget", NULL);
- RNA_def_struct_ui_text(srna, "Driver Target", "Source of input values for driver variables");
-
- /* Target Properties - ID-block to Drive */
- prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
- /* note: custom set function is ONLY to avoid rna setting a user for this. */
- RNA_def_property_pointer_funcs(prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL);
- RNA_def_property_ui_text(prop, "ID",
- "ID-block that the specific property used can be found from "
- "(id_type property must be set first)");
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
-
- prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "idtype");
- RNA_def_property_enum_items(prop, rna_enum_id_type_items);
- RNA_def_property_enum_default(prop, ID_OB);
- RNA_def_property_enum_funcs(prop, NULL, "rna_DriverTarget_id_type_set", NULL);
- RNA_def_property_editable_func(prop, "rna_DriverTarget_id_type_editable");
- RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
-
- /* Target Properties - Property to Drive */
- prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length",
- "rna_DriverTarget_RnaPath_set");
- RNA_def_property_ui_text(prop, "Data Path", "RNA Path (from ID-block) to property used");
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
-
- prop = RNA_def_property(srna, "bone_target", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "pchan_name");
- RNA_def_property_ui_text(prop, "Bone Name", "Name of PoseBone to use as target");
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
-
- prop = RNA_def_property(srna, "transform_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "transChan");
- RNA_def_property_enum_items(prop, prop_trans_chan_items);
- RNA_def_property_ui_text(prop, "Type", "Driver variable type");
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
-
- prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_local_space_items);
- RNA_def_property_ui_text(prop, "Transform Space", "Space in which transforms are used");
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_trans_chan_items[] = {
+ {DTAR_TRANSCHAN_LOCX, "LOC_X", 0, "X Location", ""},
+ {DTAR_TRANSCHAN_LOCY, "LOC_Y", 0, "Y Location", ""},
+ {DTAR_TRANSCHAN_LOCZ, "LOC_Z", 0, "Z Location", ""},
+ {DTAR_TRANSCHAN_ROTX, "ROT_X", 0, "X Rotation", ""},
+ {DTAR_TRANSCHAN_ROTY, "ROT_Y", 0, "Y Rotation", ""},
+ {DTAR_TRANSCHAN_ROTZ, "ROT_Z", 0, "Z Rotation", ""},
+ {DTAR_TRANSCHAN_SCALEX, "SCALE_X", 0, "X Scale", ""},
+ {DTAR_TRANSCHAN_SCALEY, "SCALE_Y", 0, "Y Scale", ""},
+ {DTAR_TRANSCHAN_SCALEZ, "SCALE_Z", 0, "Z Scale", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_local_space_items[] = {
+ {0,
+ "WORLD_SPACE",
+ 0,
+ "World Space",
+ "Transforms include effects of parenting/restpose and constraints"},
+ {DTAR_FLAG_LOCALSPACE,
+ "TRANSFORM_SPACE",
+ 0,
+ "Transform Space",
+ "Transforms don't include parenting/restpose or constraints"},
+ {DTAR_FLAG_LOCALSPACE | DTAR_FLAG_LOCAL_CONSTS,
+ "LOCAL_SPACE",
+ 0,
+ "Local Space",
+ "Transforms include effects of constraints but not "
+ "parenting/restpose"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "DriverTarget", NULL);
+ RNA_def_struct_ui_text(srna, "Driver Target", "Source of input values for driver variables");
+
+ /* Target Properties - ID-block to Drive */
+ prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable");
+ /* note: custom set function is ONLY to avoid rna setting a user for this. */
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_DriverTarget_id_set", "rna_DriverTarget_id_typef", NULL);
+ RNA_def_property_ui_text(prop,
+ "ID",
+ "ID-block that the specific property used can be found from "
+ "(id_type property must be set first)");
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
+
+ prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "idtype");
+ RNA_def_property_enum_items(prop, rna_enum_id_type_items);
+ RNA_def_property_enum_default(prop, ID_OB);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_DriverTarget_id_type_set", NULL);
+ RNA_def_property_editable_func(prop, "rna_DriverTarget_id_type_editable");
+ RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
+
+ /* Target Properties - Property to Drive */
+ prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_DriverTarget_RnaPath_get",
+ "rna_DriverTarget_RnaPath_length",
+ "rna_DriverTarget_RnaPath_set");
+ RNA_def_property_ui_text(prop, "Data Path", "RNA Path (from ID-block) to property used");
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
+
+ prop = RNA_def_property(srna, "bone_target", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "pchan_name");
+ RNA_def_property_ui_text(prop, "Bone Name", "Name of PoseBone to use as target");
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
+
+ prop = RNA_def_property(srna, "transform_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "transChan");
+ RNA_def_property_enum_items(prop, prop_trans_chan_items);
+ RNA_def_property_ui_text(prop, "Type", "Driver variable type");
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
+
+ prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_local_space_items);
+ RNA_def_property_ui_text(prop, "Transform Space", "Space in which transforms are used");
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data");
}
static void rna_def_drivervar(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_type_items[] = {
- {DVAR_TYPE_SINGLE_PROP, "SINGLE_PROP", ICON_RNA, "Single Property", "Use the value from some RNA property (Default)"},
- {DVAR_TYPE_TRANSFORM_CHAN, "TRANSFORMS", ICON_DRIVER_TRANSFORM, "Transform Channel",
- "Final transformation value of object or bone"},
- {DVAR_TYPE_ROT_DIFF, "ROTATION_DIFF", ICON_DRIVER_ROTATIONAL_DIFFERENCE, "Rotational Difference", "Use the angle between two bones"},
- {DVAR_TYPE_LOC_DIFF, "LOC_DIFF", ICON_DRIVER_DISTANCE, "Distance", "Distance between two bones or objects"},
- {0, NULL, 0, NULL, NULL},
- };
-
-
- srna = RNA_def_struct(brna, "DriverVariable", NULL);
- RNA_def_struct_sdna(srna, "DriverVar");
- RNA_def_struct_ui_text(srna, "Driver Variable", "Variable from some source/target for driver relationship");
-
- /* Variable Name */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DriverVariable_name_set");
- RNA_def_property_ui_text(prop, "Name",
- "Name to use in scripted expressions/functions (no spaces or dots are allowed, "
- "and must start with a letter)");
- RNA_def_property_update(prop, 0, "rna_DriverTarget_update_name"); /* XXX */
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_DriverVariable_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type", "Driver variable type");
- RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); /* XXX */
-
- /* Targets */
- /* TODO: for nicer api, only expose the relevant props via subclassing,
- * instead of exposing the collection of targets */
- prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "targets", "num_targets");
- RNA_def_property_struct_type(prop, "DriverTarget");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Targets", "Sources of input data for evaluating this variable");
-
- /* Name Validity Flags */
- prop = RNA_def_property(srna, "is_name_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", DVAR_FLAG_INVALID_NAME);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Name Valid", "Is this a valid name for a driver variable");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_type_items[] = {
+ {DVAR_TYPE_SINGLE_PROP,
+ "SINGLE_PROP",
+ ICON_RNA,
+ "Single Property",
+ "Use the value from some RNA property (Default)"},
+ {DVAR_TYPE_TRANSFORM_CHAN,
+ "TRANSFORMS",
+ ICON_DRIVER_TRANSFORM,
+ "Transform Channel",
+ "Final transformation value of object or bone"},
+ {DVAR_TYPE_ROT_DIFF,
+ "ROTATION_DIFF",
+ ICON_DRIVER_ROTATIONAL_DIFFERENCE,
+ "Rotational Difference",
+ "Use the angle between two bones"},
+ {DVAR_TYPE_LOC_DIFF,
+ "LOC_DIFF",
+ ICON_DRIVER_DISTANCE,
+ "Distance",
+ "Distance between two bones or objects"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "DriverVariable", NULL);
+ RNA_def_struct_sdna(srna, "DriverVar");
+ RNA_def_struct_ui_text(
+ srna, "Driver Variable", "Variable from some source/target for driver relationship");
+
+ /* Variable Name */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DriverVariable_name_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Name",
+ "Name to use in scripted expressions/functions (no spaces or dots are allowed, "
+ "and must start with a letter)");
+ RNA_def_property_update(prop, 0, "rna_DriverTarget_update_name"); /* XXX */
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_DriverVariable_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "Driver variable type");
+ RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); /* XXX */
+
+ /* Targets */
+ /* TODO: for nicer api, only expose the relevant props via subclassing,
+ * instead of exposing the collection of targets */
+ prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "targets", "num_targets");
+ RNA_def_property_struct_type(prop, "DriverTarget");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Targets", "Sources of input data for evaluating this variable");
+
+ /* Name Validity Flags */
+ prop = RNA_def_property(srna, "is_name_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", DVAR_FLAG_INVALID_NAME);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Name Valid", "Is this a valid name for a driver variable");
}
-
/* channeldriver.variables.* */
static void rna_def_channeldriver_variables(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- /* PropertyRNA *prop; */
+ StructRNA *srna;
+ /* PropertyRNA *prop; */
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "ChannelDriverVariables");
- srna = RNA_def_struct(brna, "ChannelDriverVariables", NULL);
- RNA_def_struct_sdna(srna, "ChannelDriver");
- RNA_def_struct_ui_text(srna, "ChannelDriver Variables", "Collection of channel driver Variables");
+ RNA_def_property_srna(cprop, "ChannelDriverVariables");
+ srna = RNA_def_struct(brna, "ChannelDriverVariables", NULL);
+ RNA_def_struct_sdna(srna, "ChannelDriver");
+ RNA_def_struct_ui_text(
+ srna, "ChannelDriver Variables", "Collection of channel driver Variables");
+ /* add variable */
+ func = RNA_def_function(srna, "new", "rna_Driver_new_variable");
+ RNA_def_function_ui_description(func, "Add a new variable for the driver");
+ /* return type */
+ parm = RNA_def_pointer(func, "var", "DriverVariable", "", "Newly created Driver Variable");
+ RNA_def_function_return(func, parm);
- /* add variable */
- func = RNA_def_function(srna, "new", "rna_Driver_new_variable");
- RNA_def_function_ui_description(func, "Add a new variable for the driver");
- /* return type */
- parm = RNA_def_pointer(func, "var", "DriverVariable", "", "Newly created Driver Variable");
- RNA_def_function_return(func, parm);
-
- /* remove variable */
- func = RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
- RNA_def_function_ui_description(func, "Remove an existing variable from the driver");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* target to remove */
- parm = RNA_def_pointer(func, "variable", "DriverVariable", "", "Variable to remove from the driver");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ /* remove variable */
+ func = RNA_def_function(srna, "remove", "rna_Driver_remove_variable");
+ RNA_def_function_ui_description(func, "Remove an existing variable from the driver");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* target to remove */
+ parm = RNA_def_pointer(
+ func, "variable", "DriverVariable", "", "Variable to remove from the driver");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_channeldriver(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_type_items[] = {
- {DRIVER_TYPE_AVERAGE, "AVERAGE", 0, "Averaged Value", ""},
- {DRIVER_TYPE_SUM, "SUM", 0, "Sum Values", ""},
- {DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""},
- {DRIVER_TYPE_MIN, "MIN", 0, "Minimum Value", ""},
- {DRIVER_TYPE_MAX, "MAX", 0, "Maximum Value", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Driver", NULL);
- RNA_def_struct_sdna(srna, "ChannelDriver");
- RNA_def_struct_ui_text(srna, "Driver", "Driver for the value of a setting based on an external value");
- RNA_def_struct_ui_icon(srna, ICON_DRIVER);
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Type", "Driver type");
- RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data");
-
- /* String values */
- prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression");
- RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_expr");
-
- /* Collections */
- prop = RNA_def_property(srna, "variables", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "variables", NULL);
- RNA_def_property_struct_type(prop, "DriverVariable");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Variables", "Properties acting as inputs for this driver");
- rna_def_channeldriver_variables(brna, prop);
-
- /* Settings */
- prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", DRIVER_FLAG_USE_SELF);
- RNA_def_property_ui_text(prop, "Use Self",
- "Include a 'self' variable in the name-space, "
- "so drivers can easily reference the data being modified (object, bone, etc...)");
-
- /* State Info (for Debugging) */
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", DRIVER_FLAG_INVALID);
- RNA_def_property_ui_text(prop, "Invalid", "Driver could not be evaluated in past, so should be skipped");
-
- prop = RNA_def_property(srna, "is_simple_expression", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_ChannelDriver_is_simple_expression_get", NULL);
- RNA_def_property_ui_text(prop, "Simple Expression", "The scripted expression can be evaluated without using the full python interpreter");
-
- /* Functions */
- RNA_api_drivers(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_type_items[] = {
+ {DRIVER_TYPE_AVERAGE, "AVERAGE", 0, "Averaged Value", ""},
+ {DRIVER_TYPE_SUM, "SUM", 0, "Sum Values", ""},
+ {DRIVER_TYPE_PYTHON, "SCRIPTED", 0, "Scripted Expression", ""},
+ {DRIVER_TYPE_MIN, "MIN", 0, "Minimum Value", ""},
+ {DRIVER_TYPE_MAX, "MAX", 0, "Maximum Value", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Driver", NULL);
+ RNA_def_struct_sdna(srna, "ChannelDriver");
+ RNA_def_struct_ui_text(
+ srna, "Driver", "Driver for the value of a setting based on an external value");
+ RNA_def_struct_ui_icon(srna, ICON_DRIVER);
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Driver type");
+ RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data");
+
+ /* String values */
+ prop = RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression");
+ RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_expr");
+
+ /* Collections */
+ prop = RNA_def_property(srna, "variables", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "variables", NULL);
+ RNA_def_property_struct_type(prop, "DriverVariable");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Variables", "Properties acting as inputs for this driver");
+ rna_def_channeldriver_variables(brna, prop);
+
+ /* Settings */
+ prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", DRIVER_FLAG_USE_SELF);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Self",
+ "Include a 'self' variable in the name-space, "
+ "so drivers can easily reference the data being modified (object, bone, etc...)");
+
+ /* State Info (for Debugging) */
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", DRIVER_FLAG_INVALID);
+ RNA_def_property_ui_text(
+ prop, "Invalid", "Driver could not be evaluated in past, so should be skipped");
+
+ prop = RNA_def_property(srna, "is_simple_expression", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_ChannelDriver_is_simple_expression_get", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Simple Expression",
+ "The scripted expression can be evaluated without using the full python interpreter");
+
+ /* Functions */
+ RNA_api_drivers(srna);
}
/* *********************** */
static void rna_def_fpoint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "FCurveSample", NULL);
- RNA_def_struct_sdna(srna, "FPoint");
- RNA_def_struct_ui_text(srna, "F-Curve Sample", "Sample point for F-Curve");
+ srna = RNA_def_struct(brna, "FCurveSample", NULL);
+ RNA_def_struct_sdna(srna, "FPoint");
+ RNA_def_struct_ui_text(srna, "F-Curve Sample", "Sample point for F-Curve");
- /* Boolean values */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
- RNA_def_property_ui_text(prop, "Select", "Selection status");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
+ /* Boolean values */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
+ RNA_def_property_ui_text(prop, "Select", "Selection status");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
- /* Vector value */
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
- RNA_def_property_float_sdna(prop, NULL, "vec");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Point", "Point coordinates");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
+ /* Vector value */
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+ RNA_def_property_float_sdna(prop, NULL, "vec");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Point", "Point coordinates");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
}
-
/* duplicate of BezTriple in rna_curve.c
* but with F-Curve specific options updates/functionality
*/
static void rna_def_fkeyframe(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Keyframe", NULL);
- RNA_def_struct_sdna(srna, "BezTriple");
- RNA_def_struct_ui_text(srna, "Keyframe", "Bezier curve point with two handles defining a Keyframe on an F-Curve");
-
- /* Boolean values */
- prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
- RNA_def_property_ui_text(prop, "Handle 1 selected", "Left handle selection status");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
- RNA_def_property_ui_text(prop, "Handle 2 selected", "Right handle selection status");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
- RNA_def_property_ui_text(prop, "Select", "Control point selection status");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
- /* Enums */
- prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "h1");
- RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
- RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "h2");
- RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
- RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ipo");
- RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_mode_items);
- RNA_def_property_ui_text(prop, "Interpolation",
- "Interpolation method to use for segment of the F-Curve from "
- "this Keyframe until the next Keyframe");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "hide");
- RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
-
- prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "easing");
- RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
- RNA_def_property_ui_text(prop, "Easing",
- "Which ends of the segment between this and the next keyframe easing "
- "interpolation is applied to");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "back");
- RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
- RNA_def_property_ui_text(prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
-
- /* Vector values */
- prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL);
- RNA_def_property_ui_text(prop, "Left Handle", "Coordinates of the left handle (before the control point)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL);
- RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
-
- prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL);
- RNA_def_property_ui_text(prop, "Right Handle", "Coordinates of the right handle (after the control point)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Keyframe", NULL);
+ RNA_def_struct_sdna(srna, "BezTriple");
+ RNA_def_struct_ui_text(
+ srna, "Keyframe", "Bezier curve point with two handles defining a Keyframe on an F-Curve");
+
+ /* Boolean values */
+ prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_ui_text(prop, "Handle 1 selected", "Left handle selection status");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f3", 0);
+ RNA_def_property_ui_text(prop, "Handle 2 selected", "Right handle selection status");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "select_control_point", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f2", 0);
+ RNA_def_property_ui_text(prop, "Select", "Control point selection status");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
+
+ /* Enums */
+ prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "h1");
+ RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
+ RNA_def_property_ui_text(prop, "Left Handle Type", "Handle types");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "h2");
+ RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
+ RNA_def_property_ui_text(prop, "Right Handle Type", "Handle types");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ipo");
+ RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_mode_items);
+ RNA_def_property_ui_text(prop,
+ "Interpolation",
+ "Interpolation method to use for segment of the F-Curve from "
+ "this Keyframe until the next Keyframe");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "hide");
+ RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of keyframe (for visual purposes only)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "easing");
+ RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
+ RNA_def_property_ui_text(prop,
+ "Easing",
+ "Which ends of the segment between this and the next keyframe easing "
+ "interpolation is applied to");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "back");
+ RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
+ RNA_def_property_ui_text(
+ prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, "rna_Keyframe_update");
+
+ /* Vector values */
+ prop = RNA_def_property(
+ srna, "handle_left", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_FKeyframe_handle1_get", "rna_FKeyframe_handle1_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Left Handle", "Coordinates of the left handle (before the control point)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_FKeyframe_ctrlpoint_get", "rna_FKeyframe_ctrlpoint_set", NULL);
+ RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
+
+ prop = RNA_def_property(
+ srna, "handle_right", PROP_FLOAT, PROP_COORDS); /* keyframes are dimensionless */
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_FKeyframe_handle2_get", "rna_FKeyframe_handle2_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Right Handle", "Coordinates of the right handle (after the control point)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_Keyframe_update");
}
static void rna_def_fcurve_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- /* add modifiers */
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "FCurveModifiers");
- srna = RNA_def_struct(brna, "FCurveModifiers", NULL);
- RNA_def_struct_sdna(srna, "FCurve");
- RNA_def_struct_ui_text(srna, "F-Curve Modifiers", "Collection of F-Curve Modifiers");
-
-
- /* Collection active property */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "FModifier");
- RNA_def_property_pointer_funcs(prop, "rna_FCurve_active_modifier_get",
- "rna_FCurve_active_modifier_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active F-Curve Modifier", "Active F-Curve Modifier");
-
- /* Constraint collection */
- func = RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
- RNA_def_function_ui_description(func, "Add a constraint to this object");
- /* return type */
- parm = RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier");
- RNA_def_function_return(func, parm);
- /* object to add */
- parm = RNA_def_enum(func, "type", rna_enum_fmodifier_type_items, 1, "", "Constraint type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a modifier from this F-Curve");
- /* modifier to remove */
- parm = RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ /* add modifiers */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "FCurveModifiers");
+ srna = RNA_def_struct(brna, "FCurveModifiers", NULL);
+ RNA_def_struct_sdna(srna, "FCurve");
+ RNA_def_struct_ui_text(srna, "F-Curve Modifiers", "Collection of F-Curve Modifiers");
+
+ /* Collection active property */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FModifier");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_FCurve_active_modifier_get", "rna_FCurve_active_modifier_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active F-Curve Modifier", "Active F-Curve Modifier");
+
+ /* Constraint collection */
+ func = RNA_def_function(srna, "new", "rna_FCurve_modifiers_new");
+ RNA_def_function_ui_description(func, "Add a constraint to this object");
+ /* return type */
+ parm = RNA_def_pointer(func, "fmodifier", "FModifier", "", "New fmodifier");
+ RNA_def_function_return(func, parm);
+ /* object to add */
+ parm = RNA_def_enum(
+ func, "type", rna_enum_fmodifier_type_items, 1, "", "Constraint type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_FCurve_modifiers_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a modifier from this F-Curve");
+ /* modifier to remove */
+ parm = RNA_def_pointer(func, "modifier", "FModifier", "", "Removed modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
/* fcurve.keyframe_points */
static void rna_def_fcurve_keyframe_points(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem keyframe_flag_items[] = {
- {INSERTKEY_REPLACE, "REPLACE", 0, "Replace", "Don't add any new keyframes, but just replace existing ones"},
- {INSERTKEY_NEEDED, "NEEDED", 0, "Needed", "Only adds keyframes that are needed"},
- {INSERTKEY_FAST, "FAST", 0, "Fast", "Fast keyframe insertion to avoid recalculating the curve each time"},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_property_srna(cprop, "FCurveKeyframePoints");
- srna = RNA_def_struct(brna, "FCurveKeyframePoints", NULL);
- RNA_def_struct_sdna(srna, "FCurve");
- RNA_def_struct_ui_text(srna, "Keyframe Points", "Collection of keyframe points");
-
- func = RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
- RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
- parm = RNA_def_float(func, "frame", 0.0f, -FLT_MAX, FLT_MAX, "",
- "X Value of this keyframe point", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "value", 0.0f, -FLT_MAX, FLT_MAX, "",
- "Y Value of this keyframe point", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_enum_flag(func, "options", keyframe_flag_items, 0, "", "Keyframe options");
- RNA_def_enum(func, "keyframe_type", rna_enum_beztriple_keyframe_type_items, BEZT_KEYTYPE_KEYFRAME, "",
- "Type of keyframe to insert");
- parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
- RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
- parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
- RNA_def_function_ui_description(func, "Remove keyframe from an F-Curve");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Keyframe to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- /* optional */
- RNA_def_boolean(func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem keyframe_flag_items[] = {
+ {INSERTKEY_REPLACE,
+ "REPLACE",
+ 0,
+ "Replace",
+ "Don't add any new keyframes, but just replace existing ones"},
+ {INSERTKEY_NEEDED, "NEEDED", 0, "Needed", "Only adds keyframes that are needed"},
+ {INSERTKEY_FAST,
+ "FAST",
+ 0,
+ "Fast",
+ "Fast keyframe insertion to avoid recalculating the curve each time"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_property_srna(cprop, "FCurveKeyframePoints");
+ srna = RNA_def_struct(brna, "FCurveKeyframePoints", NULL);
+ RNA_def_struct_sdna(srna, "FCurve");
+ RNA_def_struct_ui_text(srna, "Keyframe Points", "Collection of keyframe points");
+
+ func = RNA_def_function(srna, "insert", "rna_FKeyframe_points_insert");
+ RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
+ parm = RNA_def_float(func,
+ "frame",
+ 0.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "X Value of this keyframe point",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(func,
+ "value",
+ 0.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "Y Value of this keyframe point",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_enum_flag(func, "options", keyframe_flag_items, 0, "", "Keyframe options");
+ RNA_def_enum(func,
+ "keyframe_type",
+ rna_enum_beztriple_keyframe_type_items,
+ BEZT_KEYTYPE_KEYFRAME,
+ "",
+ "Type of keyframe to insert");
+ parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Newly created keyframe");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "add", "rna_FKeyframe_points_add");
+ RNA_def_function_ui_description(func, "Add a keyframe point to a F-Curve");
+ parm = RNA_def_int(
+ func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_FKeyframe_points_remove");
+ RNA_def_function_ui_description(func, "Remove keyframe from an F-Curve");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "keyframe", "Keyframe", "", "Keyframe to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ /* optional */
+ RNA_def_boolean(
+ func, "fast", 0, "Fast", "Fast keyframe removal to avoid recalculating the curve each time");
}
static void rna_def_fcurve(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem prop_mode_extend_items[] = {
- {FCURVE_EXTRAPOLATE_CONSTANT, "CONSTANT", 0, "Constant", "Hold values of endpoint keyframes"},
- {FCURVE_EXTRAPOLATE_LINEAR, "LINEAR", 0, "Linear", "Use slope of curve leading in/out of endpoint keyframes"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem prop_mode_color_items[] = {
- {FCURVE_COLOR_AUTO_RAINBOW, "AUTO_RAINBOW", 0, "Auto Rainbow",
- "Cycle through the rainbow, trying to give each curve a unique color"},
- {FCURVE_COLOR_AUTO_RGB, "AUTO_RGB", 0, "Auto XYZ to RGB",
- "Use axis colors for transform and color properties, and auto-rainbow for the rest"},
- {FCURVE_COLOR_AUTO_YRGB, "AUTO_YRGB", 0, "Auto WXYZ to YRGB",
- "Use axis colors for XYZ parts of transform, and yellow for the 'W' channel"},
- {FCURVE_COLOR_CUSTOM, "CUSTOM", 0, "User Defined",
- "Use custom hand-picked color for F-Curve"},
- {0, NULL, 0, NULL, NULL},
- };
- static EnumPropertyItem prop_mode_smoothing_items[] = {
- {FCURVE_SMOOTH_NONE, "NONE", 0, "None", "Auto handles only take adjacent keys into account (legacy mode)"},
- {FCURVE_SMOOTH_CONT_ACCEL, "CONT_ACCEL", 0, "Continuous Acceleration", "Auto handles are placed to avoid jumps in acceleration"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FCurve", NULL);
- RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time");
- RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
-
- /* Enums */
- prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "extend");
- RNA_def_property_enum_items(prop, prop_mode_extend_items);
- RNA_def_property_ui_text(prop, "Extrapolation",
- "Method used for evaluating value of F-Curve outside first and last keyframes");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
-
- /* Pointers */
- prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)");
-
- prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "grp");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Group", "Action Group that this F-Curve belongs to");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_FCurve_group_set", NULL, NULL);
- RNA_def_property_update(prop, NC_ANIMATION, NULL);
-
- /* Path + Array Index */
- prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length",
- "rna_FCurve_RnaPath_set");
- RNA_def_property_ui_text(prop, "Data Path", "RNA Path to property affected by F-Curve");
- /* XXX need an update callback for this to that animation gets evaluated */
- RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
-
- /* called 'index' when given as function arg */
- prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "RNA Array Index",
- "Index to the specific property affected by F-Curve if applicable");
- /* XXX need an update callback for this so that animation gets evaluated */
- RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
-
- /* Color */
- prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mode_color_items);
- RNA_def_property_ui_text(prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor");
- RNA_def_property_update(prop, NC_ANIMATION, NULL);
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor");
- RNA_def_property_update(prop, NC_ANIMATION, NULL);
-
- /* Flags */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_SELECTED);
- RNA_def_property_ui_text(prop, "Select", "F-Curve is selected for editing");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_PROTECTED);
- RNA_def_property_ui_text(prop, "Lock", "F-Curve's settings cannot be edited");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
- RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_VISIBLE);
- RNA_def_property_ui_text(prop, "Hide", "F-Curve and its keyframes are hidden in the Graph Editor graphs");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "auto_smoothing", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mode_smoothing_items);
- RNA_def_property_ui_text(prop, "Auto Handle Smoothing", "Algorithm used to compute automatic handles");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
-
- /* State Info (for Debugging) */
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_DISABLED);
- RNA_def_property_ui_text(prop, "Valid",
- "False when F-Curve could not be evaluated in past, so should be skipped "
- "when evaluating");
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
-
- /* Collections */
- prop = RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");
- RNA_def_property_struct_type(prop, "FCurveSample");
- RNA_def_property_ui_text(prop, "Sampled Points", "Sampled animation data");
-
- prop = RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "bezt", "totvert");
- RNA_def_property_struct_type(prop, "Keyframe");
- RNA_def_property_ui_text(prop, "Keyframes", "User-editable keyframes");
- rna_def_fcurve_keyframe_points(brna, prop);
-
- prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "FModifier");
- RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve");
- rna_def_fcurve_modifiers(brna, prop);
-
- /* Functions */
- /* -- evaluate -- */
- func = RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
- RNA_def_function_ui_description(func, "Evaluate F-Curve");
- parm = RNA_def_float(func, "frame", 1.0f, -FLT_MAX, FLT_MAX, "Frame",
- "Evaluate F-Curve at given frame", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return value */
- parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "Value", "Value of F-Curve specific frame", -FLT_MAX, FLT_MAX);
- RNA_def_function_return(func, parm);
-
- /* -- update / recalculate -- */
- func = RNA_def_function(srna, "update", "rna_FCurve_update_data_ex");
- RNA_def_function_ui_description(func, "Ensure keyframes are sorted in chronological order and handles are set correctly");
-
- /* -- time extents/range -- */
- func = RNA_def_function(srna, "range", "rna_FCurve_range");
- RNA_def_function_ui_description(func, "Get the time extents for F-Curve");
- /* return value */
- parm = RNA_def_float_vector(func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range",
- "Min/Max values", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
- /* -- auto-flag validity (ensures valid handling for data type) -- */
- func = RNA_def_function(srna, "update_autoflags", "update_autoflags_fcurve"); /* calls the C/API direct */
- RNA_def_function_ui_description(func, "Update FCurve flags set automatically from affected property "
- "(currently, integer/discrete flags set when the property is not a float)");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "data", "AnyType", "Data",
- "Data containing the property controlled by given FCurve");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-
-
- /* Functions */
- RNA_api_fcurves(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem prop_mode_extend_items[] = {
+ {FCURVE_EXTRAPOLATE_CONSTANT,
+ "CONSTANT",
+ 0,
+ "Constant",
+ "Hold values of endpoint keyframes"},
+ {FCURVE_EXTRAPOLATE_LINEAR,
+ "LINEAR",
+ 0,
+ "Linear",
+ "Use slope of curve leading in/out of endpoint keyframes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem prop_mode_color_items[] = {
+ {FCURVE_COLOR_AUTO_RAINBOW,
+ "AUTO_RAINBOW",
+ 0,
+ "Auto Rainbow",
+ "Cycle through the rainbow, trying to give each curve a unique color"},
+ {FCURVE_COLOR_AUTO_RGB,
+ "AUTO_RGB",
+ 0,
+ "Auto XYZ to RGB",
+ "Use axis colors for transform and color properties, and auto-rainbow for the rest"},
+ {FCURVE_COLOR_AUTO_YRGB,
+ "AUTO_YRGB",
+ 0,
+ "Auto WXYZ to YRGB",
+ "Use axis colors for XYZ parts of transform, and yellow for the 'W' channel"},
+ {FCURVE_COLOR_CUSTOM,
+ "CUSTOM",
+ 0,
+ "User Defined",
+ "Use custom hand-picked color for F-Curve"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static EnumPropertyItem prop_mode_smoothing_items[] = {
+ {FCURVE_SMOOTH_NONE,
+ "NONE",
+ 0,
+ "None",
+ "Auto handles only take adjacent keys into account (legacy mode)"},
+ {FCURVE_SMOOTH_CONT_ACCEL,
+ "CONT_ACCEL",
+ 0,
+ "Continuous Acceleration",
+ "Auto handles are placed to avoid jumps in acceleration"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FCurve", NULL);
+ RNA_def_struct_ui_text(srna, "F-Curve", "F-Curve defining values of a period of time");
+ RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
+
+ /* Enums */
+ prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "extend");
+ RNA_def_property_enum_items(prop, prop_mode_extend_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Extrapolation",
+ "Method used for evaluating value of F-Curve outside first and last keyframes");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
+
+ /* Pointers */
+ prop = RNA_def_property(srna, "driver", PROP_POINTER, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Driver", "Channel Driver (only set for Driver F-Curves)");
+
+ prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "grp");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Group", "Action Group that this F-Curve belongs to");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_FCurve_group_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
+
+ /* Path + Array Index */
+ prop = RNA_def_property(srna, "data_path", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_FCurve_RnaPath_get", "rna_FCurve_RnaPath_length", "rna_FCurve_RnaPath_set");
+ RNA_def_property_ui_text(prop, "Data Path", "RNA Path to property affected by F-Curve");
+ /* XXX need an update callback for this to that animation gets evaluated */
+ RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
+
+ /* called 'index' when given as function arg */
+ prop = RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "RNA Array Index", "Index to the specific property affected by F-Curve if applicable");
+ /* XXX need an update callback for this so that animation gets evaluated */
+ RNA_def_property_update(prop, NC_ANIMATION, "rna_FCurve_update_data_relations");
+
+ /* Color */
+ prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mode_color_items);
+ RNA_def_property_ui_text(
+ prop, "Color Mode", "Method used to determine color of F-Curve in Graph Editor");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Color", "Color of the F-Curve in the Graph Editor");
+ RNA_def_property_update(prop, NC_ANIMATION, NULL);
+
+ /* Flags */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_SELECTED);
+ RNA_def_property_ui_text(prop, "Select", "F-Curve is selected for editing");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_PROTECTED);
+ RNA_def_property_ui_text(prop, "Lock", "F-Curve's settings cannot be edited");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
+ RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_VISIBLE);
+ RNA_def_property_ui_text(
+ prop, "Hide", "F-Curve and its keyframes are hidden in the Graph Editor graphs");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "auto_smoothing", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mode_smoothing_items);
+ RNA_def_property_ui_text(
+ prop, "Auto Handle Smoothing", "Algorithm used to compute automatic handles");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_FCurve_update_data");
+
+ /* State Info (for Debugging) */
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FCURVE_DISABLED);
+ RNA_def_property_ui_text(
+ prop,
+ "Valid",
+ "False when F-Curve could not be evaluated in past, so should be skipped "
+ "when evaluating");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
+
+ /* Collections */
+ prop = RNA_def_property(srna, "sampled_points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "fpt", "totvert");
+ RNA_def_property_struct_type(prop, "FCurveSample");
+ RNA_def_property_ui_text(prop, "Sampled Points", "Sampled animation data");
+
+ prop = RNA_def_property(srna, "keyframe_points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "bezt", "totvert");
+ RNA_def_property_struct_type(prop, "Keyframe");
+ RNA_def_property_ui_text(prop, "Keyframes", "User-editable keyframes");
+ rna_def_fcurve_keyframe_points(brna, prop);
+
+ prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FModifier");
+ RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the shape of the F-Curve");
+ rna_def_fcurve_modifiers(brna, prop);
+
+ /* Functions */
+ /* -- evaluate -- */
+ func = RNA_def_function(srna, "evaluate", "evaluate_fcurve"); /* calls the C/API direct */
+ RNA_def_function_ui_description(func, "Evaluate F-Curve");
+ parm = RNA_def_float(func,
+ "frame",
+ 1.0f,
+ -FLT_MAX,
+ FLT_MAX,
+ "Frame",
+ "Evaluate F-Curve at given frame",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return value */
+ parm = RNA_def_float(func,
+ "value",
+ 0,
+ -FLT_MAX,
+ FLT_MAX,
+ "Value",
+ "Value of F-Curve specific frame",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_function_return(func, parm);
+
+ /* -- update / recalculate -- */
+ func = RNA_def_function(srna, "update", "rna_FCurve_update_data_ex");
+ RNA_def_function_ui_description(
+ func, "Ensure keyframes are sorted in chronological order and handles are set correctly");
+
+ /* -- time extents/range -- */
+ func = RNA_def_function(srna, "range", "rna_FCurve_range");
+ RNA_def_function_ui_description(func, "Get the time extents for F-Curve");
+ /* return value */
+ parm = RNA_def_float_vector(
+ func, "range", 2, NULL, -FLT_MAX, FLT_MAX, "Range", "Min/Max values", -FLT_MAX, FLT_MAX);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ /* -- auto-flag validity (ensures valid handling for data type) -- */
+ func = RNA_def_function(
+ srna, "update_autoflags", "update_autoflags_fcurve"); /* calls the C/API direct */
+ RNA_def_function_ui_description(
+ func,
+ "Update FCurve flags set automatically from affected property "
+ "(currently, integer/discrete flags set when the property is not a float)");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "data", "AnyType", "Data", "Data containing the property controlled by given FCurve");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+
+ /* Functions */
+ RNA_api_fcurves(srna);
}
/* *********************** */
void RNA_def_fcurve(BlenderRNA *brna)
{
- rna_def_fcurve(brna);
- rna_def_fkeyframe(brna);
- rna_def_fpoint(brna);
+ rna_def_fcurve(brna);
+ rna_def_fkeyframe(brna);
+ rna_def_fpoint(brna);
- rna_def_drivertarget(brna);
- rna_def_drivervar(brna);
- rna_def_channeldriver(brna);
+ rna_def_drivertarget(brna);
+ rna_def_drivervar(brna);
+ rna_def_channeldriver(brna);
- rna_def_fmodifier(brna);
+ rna_def_fmodifier(brna);
- rna_def_fmodifier_generator(brna);
- rna_def_fmodifier_function_generator(brna);
+ rna_def_fmodifier_generator(brna);
+ rna_def_fmodifier_function_generator(brna);
- rna_def_fmodifier_envelope(brna);
- rna_def_fmodifier_envelope_ctrl(brna);
+ rna_def_fmodifier_envelope(brna);
+ rna_def_fmodifier_envelope_ctrl(brna);
- rna_def_fmodifier_cycles(brna);
- rna_def_fmodifier_python(brna);
- rna_def_fmodifier_limits(brna);
- rna_def_fmodifier_noise(brna);
- rna_def_fmodifier_stepped(brna);
+ rna_def_fmodifier_cycles(brna);
+ rna_def_fmodifier_python(brna);
+ rna_def_fmodifier_limits(brna);
+ rna_def_fmodifier_noise(brna);
+ rna_def_fmodifier_stepped(brna);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_fcurve_api.c b/source/blender/makesrna/intern/rna_fcurve_api.c
index 4fc20d29991..ea3ad074452 100644
--- a/source/blender/makesrna/intern/rna_fcurve_api.c
+++ b/source/blender/makesrna/intern/rna_fcurve_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -34,128 +33,132 @@
#include "DNA_anim_types.h"
#include "DNA_scene_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include <stddef.h>
+# include <stddef.h>
-#include "BKE_animsys.h"
-#include "BKE_fcurve.h"
+# include "BKE_animsys.h"
+# include "BKE_fcurve.h"
-#include "BLI_math.h"
+# include "BLI_math.h"
static void rna_FCurve_convert_to_samples(FCurve *fcu, ReportList *reports, int start, int end)
{
- /* XXX fcurve_store_samples uses end frame included, which is not consistent with usual behavior in Blender,
- * nor python slices, etc. Let have public py API be consistent here at least. */
- end--;
- if (start > end) {
- BKE_reportf(reports, RPT_ERROR, "Invalid frame range (%d - %d)", start, end + 1);
- }
- else if (fcu->fpt) {
- BKE_report(reports, RPT_WARNING, "FCurve has already sample points");
- }
- else if (!fcu->bezt) {
- BKE_report(reports, RPT_WARNING, "FCurve has no keyframes");
- }
- else {
- fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve);
- WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
- }
+ /* XXX fcurve_store_samples uses end frame included, which is not consistent with usual behavior in Blender,
+ * nor python slices, etc. Let have public py API be consistent here at least. */
+ end--;
+ if (start > end) {
+ BKE_reportf(reports, RPT_ERROR, "Invalid frame range (%d - %d)", start, end + 1);
+ }
+ else if (fcu->fpt) {
+ BKE_report(reports, RPT_WARNING, "FCurve has already sample points");
+ }
+ else if (!fcu->bezt) {
+ BKE_report(reports, RPT_WARNING, "FCurve has no keyframes");
+ }
+ else {
+ fcurve_store_samples(fcu, NULL, start, end, fcurve_samplingcb_evalcurve);
+ WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ }
}
static void rna_FCurve_convert_to_keyframes(FCurve *fcu, ReportList *reports, int start, int end)
{
- if (start >= end) {
- BKE_reportf(reports, RPT_ERROR, "Invalid frame range (%d - %d)", start, end);
- }
- else if (fcu->bezt) {
- BKE_report(reports, RPT_WARNING, "FCurve has already keyframes");
- }
- else if (!fcu->fpt) {
- BKE_report(reports, RPT_WARNING, "FCurve has no sample points");
- }
- else {
- BezTriple *bezt;
- FPoint *fpt = fcu->fpt;
- int tot_kf = end - start;
- int tot_sp = fcu->totvert;
-
- bezt = fcu->bezt = MEM_callocN(sizeof(*fcu->bezt) * (size_t)tot_kf, __func__);
- fcu->totvert = tot_kf;
-
- /* Get first sample point to 'copy' as keyframe. */
- for (; tot_sp && (fpt->vec[0] < (float)start); fpt++, tot_sp--);
-
- /* Add heading dummy flat points if needed. */
- for (; tot_kf && (fpt->vec[0] > (float)start); start++, bezt++, tot_kf--) {
- /* Linear interpolation, of course. */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_LIN;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- bezt->vec[1][0] = (float)start;
- bezt->vec[1][1] = fpt->vec[1];
- }
-
- /* Copy actual sample points. */
- for (; tot_kf && tot_sp; start++, bezt++, tot_kf--, fpt++, tot_sp--) {
- /* Linear interpolation, of course. */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_LIN;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- copy_v2_v2(bezt->vec[1], fpt->vec);
- }
-
- /* Add leading dummy flat points if needed. */
- for (fpt--; tot_kf; start++, bezt++, tot_kf--) {
- /* Linear interpolation, of course. */
- bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
- bezt->ipo = BEZT_IPO_LIN;
- bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
- bezt->vec[1][0] = (float)start;
- bezt->vec[1][1] = fpt->vec[1];
- }
-
- MEM_SAFE_FREE(fcu->fpt);
-
- /* Not strictly needed since we use linear interpolation, but better be consistent here. */
- calchandles_fcurve(fcu);
- WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
- }
+ if (start >= end) {
+ BKE_reportf(reports, RPT_ERROR, "Invalid frame range (%d - %d)", start, end);
+ }
+ else if (fcu->bezt) {
+ BKE_report(reports, RPT_WARNING, "FCurve has already keyframes");
+ }
+ else if (!fcu->fpt) {
+ BKE_report(reports, RPT_WARNING, "FCurve has no sample points");
+ }
+ else {
+ BezTriple *bezt;
+ FPoint *fpt = fcu->fpt;
+ int tot_kf = end - start;
+ int tot_sp = fcu->totvert;
+
+ bezt = fcu->bezt = MEM_callocN(sizeof(*fcu->bezt) * (size_t)tot_kf, __func__);
+ fcu->totvert = tot_kf;
+
+ /* Get first sample point to 'copy' as keyframe. */
+ for (; tot_sp && (fpt->vec[0] < (float)start); fpt++, tot_sp--)
+ ;
+
+ /* Add heading dummy flat points if needed. */
+ for (; tot_kf && (fpt->vec[0] > (float)start); start++, bezt++, tot_kf--) {
+ /* Linear interpolation, of course. */
+ bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+ bezt->ipo = BEZT_IPO_LIN;
+ bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
+ bezt->vec[1][0] = (float)start;
+ bezt->vec[1][1] = fpt->vec[1];
+ }
+
+ /* Copy actual sample points. */
+ for (; tot_kf && tot_sp; start++, bezt++, tot_kf--, fpt++, tot_sp--) {
+ /* Linear interpolation, of course. */
+ bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+ bezt->ipo = BEZT_IPO_LIN;
+ bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
+ copy_v2_v2(bezt->vec[1], fpt->vec);
+ }
+
+ /* Add leading dummy flat points if needed. */
+ for (fpt--; tot_kf; start++, bezt++, tot_kf--) {
+ /* Linear interpolation, of course. */
+ bezt->f1 = bezt->f2 = bezt->f3 = SELECT;
+ bezt->ipo = BEZT_IPO_LIN;
+ bezt->h1 = bezt->h2 = HD_AUTO_ANIM;
+ bezt->vec[1][0] = (float)start;
+ bezt->vec[1][1] = fpt->vec[1];
+ }
+
+ MEM_SAFE_FREE(fcu->fpt);
+
+ /* Not strictly needed since we use linear interpolation, but better be consistent here. */
+ calchandles_fcurve(fcu);
+ WM_main_add_notifier(NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
+ }
}
#else
void RNA_api_fcurves(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "convert_to_samples", "rna_FCurve_convert_to_samples");
- RNA_def_function_ui_description(func,
- "Convert current FCurve from keyframes to sample points, if necessary");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "start", 0, MINAFRAME, MAXFRAME, "Start Frame", "", MINAFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "end", 0, MINAFRAME, MAXFRAME, "End Frame", "", MINAFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "convert_to_keyframes", "rna_FCurve_convert_to_keyframes");
- RNA_def_function_ui_description(func,
- "Convert current FCurve from sample points to keyframes (linear interpolation), "
- "if necessary");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "start", 0, MINAFRAME, MAXFRAME, "Start Frame", "", MINAFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "end", 0, MINAFRAME, MAXFRAME, "End Frame", "", MINAFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "convert_to_samples", "rna_FCurve_convert_to_samples");
+ RNA_def_function_ui_description(
+ func, "Convert current FCurve from keyframes to sample points, if necessary");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "start", 0, MINAFRAME, MAXFRAME, "Start Frame", "", MINAFRAME, MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "end", 0, MINAFRAME, MAXFRAME, "End Frame", "", MINAFRAME, MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "convert_to_keyframes", "rna_FCurve_convert_to_keyframes");
+ RNA_def_function_ui_description(
+ func,
+ "Convert current FCurve from sample points to keyframes (linear interpolation), "
+ "if necessary");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "start", 0, MINAFRAME, MAXFRAME, "Start Frame", "", MINAFRAME, MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "end", 0, MINAFRAME, MAXFRAME, "End Frame", "", MINAFRAME, MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_api_drivers(StructRNA *UNUSED(srna))
{
-/* FunctionRNA *func; */
-/* PropertyRNA *parm; */
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
}
#endif
diff --git a/source/blender/makesrna/intern/rna_fluidsim.c b/source/blender/makesrna/intern/rna_fluidsim.c
index d37ac0cb68d..6c91b69fbd8 100644
--- a/source/blender/makesrna/intern/rna_fluidsim.c
+++ b/source/blender/makesrna/intern/rna_fluidsim.c
@@ -35,678 +35,754 @@
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "DNA_scene_types.h"
-#include "DNA_particle_types.h"
+# include "DNA_scene_types.h"
+# include "DNA_particle_types.h"
-#include "BKE_fluidsim.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
+# include "BKE_fluidsim.h"
+# include "BKE_global.h"
+# include "BKE_main.h"
+# include "BKE_modifier.h"
+# include "BKE_particle.h"
+# include "BKE_pointcache.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
static StructRNA *rna_FluidSettings_refine(struct PointerRNA *ptr)
{
- FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
-
- switch (fss->type) {
- case OB_FLUIDSIM_DOMAIN:
- return &RNA_DomainFluidSettings;
- case OB_FLUIDSIM_FLUID:
- return &RNA_FluidFluidSettings;
- case OB_FLUIDSIM_OBSTACLE:
- return &RNA_ObstacleFluidSettings;
- case OB_FLUIDSIM_INFLOW:
- return &RNA_InflowFluidSettings;
- case OB_FLUIDSIM_OUTFLOW:
- return &RNA_OutflowFluidSettings;
- case OB_FLUIDSIM_PARTICLE:
- return &RNA_ParticleFluidSettings;
- case OB_FLUIDSIM_CONTROL:
- return &RNA_ControlFluidSettings;
- default:
- return &RNA_FluidSettings;
- }
+ FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
+
+ switch (fss->type) {
+ case OB_FLUIDSIM_DOMAIN:
+ return &RNA_DomainFluidSettings;
+ case OB_FLUIDSIM_FLUID:
+ return &RNA_FluidFluidSettings;
+ case OB_FLUIDSIM_OBSTACLE:
+ return &RNA_ObstacleFluidSettings;
+ case OB_FLUIDSIM_INFLOW:
+ return &RNA_InflowFluidSettings;
+ case OB_FLUIDSIM_OUTFLOW:
+ return &RNA_OutflowFluidSettings;
+ case OB_FLUIDSIM_PARTICLE:
+ return &RNA_ParticleFluidSettings;
+ case OB_FLUIDSIM_CONTROL:
+ return &RNA_ControlFluidSettings;
+ default:
+ return &RNA_FluidSettings;
+ }
}
static void rna_fluid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
+ Object *ob = ptr->id.data;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
static int fluidsim_find_lastframe(Main *bmain, Object *ob, FluidsimSettings *fss)
{
- char targetFileTest[FILE_MAX];
- char targetFile[FILE_MAX];
- int curFrame = 1;
+ char targetFileTest[FILE_MAX];
+ char targetFile[FILE_MAX];
+ int curFrame = 1;
- BLI_join_dirfile(targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME);
- BLI_path_abs(targetFile, modifier_path_relbase(bmain, ob));
+ BLI_join_dirfile(
+ targetFile, sizeof(targetFile), fss->surfdataPath, OB_FLUIDSIM_SURF_FINAL_OBJ_FNAME);
+ BLI_path_abs(targetFile, modifier_path_relbase(bmain, ob));
- do {
- BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest));
- BLI_path_frame(targetFileTest, curFrame++, 0);
- } while (BLI_exists(targetFileTest));
+ do {
+ BLI_strncpy(targetFileTest, targetFile, sizeof(targetFileTest));
+ BLI_path_frame(targetFileTest, curFrame++, 0);
+ } while (BLI_exists(targetFileTest));
- return curFrame - 1;
+ return curFrame - 1;
}
static void rna_fluid_find_enframe(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
-
- if (fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) {
- fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(bmain, ob, fluidmd->fss);
- }
- else {
- fluidmd->fss->lastgoodframe = -1;
- }
- rna_fluid_update(bmain, scene, ptr);
+ Object *ob = ptr->id.data;
+ FluidsimModifierData *fluidmd = (FluidsimModifierData *)modifiers_findByType(
+ ob, eModifierType_Fluidsim);
+
+ if (fluidmd->fss->flag & OB_FLUIDSIM_REVERSE) {
+ fluidmd->fss->lastgoodframe = fluidsim_find_lastframe(bmain, ob, fluidmd->fss);
+ }
+ else {
+ fluidmd->fss->lastgoodframe = -1;
+ }
+ rna_fluid_update(bmain, scene, ptr);
}
static void rna_FluidSettings_update_type(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- FluidsimModifierData *fluidmd;
- ParticleSystemModifierData *psmd;
- ParticleSystem *psys, *next_psys;
- ParticleSettings *part;
-
- fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
- fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; /* clear flag */
-
- /* remove fluidsim particle system */
- if (fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) {
- for (psys = ob->particlesystem.first; psys; psys = psys->next)
- if (psys->part->type == PART_FLUID)
- break;
-
- if (ob->type == OB_MESH && !psys) {
- /* add particle system */
- part = BKE_particlesettings_add(bmain, "ParticleSettings");
- psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
-
- part->type = PART_FLUID;
- psys->part = part;
- psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
- BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
- BLI_addtail(&ob->particlesystem, psys);
-
- /* add modifier */
- psmd = (ParticleSystemModifierData *)modifier_new(eModifierType_ParticleSystem);
- BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
- psmd->psys = psys;
- BLI_addtail(&ob->modifiers, psmd);
- modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);
- }
- }
- else {
- for (psys = ob->particlesystem.first; psys; psys = next_psys) {
- next_psys = psys->next;
- if (psys->part->type == PART_FLUID) {
- /* clear modifier */
- psmd = psys_get_modifier(ob, psys);
- BLI_remlink(&ob->modifiers, psmd);
- modifier_free((ModifierData *)psmd);
-
- /* clear particle system */
- BLI_remlink(&ob->particlesystem, psys);
- psys_free(ob, psys);
- }
- }
- }
-
- rna_fluid_update(bmain, scene, ptr);
+ Object *ob = (Object *)ptr->id.data;
+ FluidsimModifierData *fluidmd;
+ ParticleSystemModifierData *psmd;
+ ParticleSystem *psys, *next_psys;
+ ParticleSettings *part;
+
+ fluidmd = (FluidsimModifierData *)modifiers_findByType(ob, eModifierType_Fluidsim);
+ fluidmd->fss->flag &= ~OB_FLUIDSIM_REVERSE; /* clear flag */
+
+ /* remove fluidsim particle system */
+ if (fluidmd->fss->type & OB_FLUIDSIM_PARTICLE) {
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ if (psys->part->type == PART_FLUID)
+ break;
+
+ if (ob->type == OB_MESH && !psys) {
+ /* add particle system */
+ part = BKE_particlesettings_add(bmain, "ParticleSettings");
+ psys = MEM_callocN(sizeof(ParticleSystem), "particle_system");
+
+ part->type = PART_FLUID;
+ psys->part = part;
+ psys->pointcache = BKE_ptcache_add(&psys->ptcaches);
+ BLI_strncpy(psys->name, "FluidParticles", sizeof(psys->name));
+ BLI_addtail(&ob->particlesystem, psys);
+
+ /* add modifier */
+ psmd = (ParticleSystemModifierData *)modifier_new(eModifierType_ParticleSystem);
+ BLI_strncpy(psmd->modifier.name, "FluidParticleSystem", sizeof(psmd->modifier.name));
+ psmd->psys = psys;
+ BLI_addtail(&ob->modifiers, psmd);
+ modifier_unique_name(&ob->modifiers, (ModifierData *)psmd);
+ }
+ }
+ else {
+ for (psys = ob->particlesystem.first; psys; psys = next_psys) {
+ next_psys = psys->next;
+ if (psys->part->type == PART_FLUID) {
+ /* clear modifier */
+ psmd = psys_get_modifier(ob, psys);
+ BLI_remlink(&ob->modifiers, psmd);
+ modifier_free((ModifierData *)psmd);
+
+ /* clear particle system */
+ BLI_remlink(&ob->particlesystem, psys);
+ psys_free(ob, psys);
+ }
+ }
+ }
+
+ rna_fluid_update(bmain, scene, ptr);
}
static void rna_DomainFluidSettings_memory_estimate_get(PointerRNA *ptr, char *value)
{
-#ifndef WITH_MOD_FLUID
- (void)ptr;
- value[0] = '\0';
-#else
- Object *ob = (Object *)ptr->id.data;
- FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
-
- fluid_estimate_memory(ob, fss, value);
-#endif
+# ifndef WITH_MOD_FLUID
+ (void)ptr;
+ value[0] = '\0';
+# else
+ Object *ob = (Object *)ptr->id.data;
+ FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
+
+ fluid_estimate_memory(ob, fss, value);
+# endif
}
static int rna_DomainFluidSettings_memory_estimate_length(PointerRNA *ptr)
{
-#ifndef WITH_MOD_FLUID
- UNUSED_VARS(ptr);
- return 0;
-#else
- char value[32];
-
- rna_DomainFluidSettings_memory_estimate_get(ptr, value);
- return strlen(value);
-#endif
+# ifndef WITH_MOD_FLUID
+ UNUSED_VARS(ptr);
+ return 0;
+# else
+ char value[32];
+
+ rna_DomainFluidSettings_memory_estimate_get(ptr, value);
+ return strlen(value);
+# endif
}
static char *rna_FluidSettings_path(PointerRNA *ptr)
{
- FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
- ModifierData *md = (ModifierData *)fss->fmd;
- char name_esc[sizeof(md->name) * 2];
+ FluidsimSettings *fss = (FluidsimSettings *)ptr->data;
+ ModifierData *md = (ModifierData *)fss->fmd;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
}
#else
static void rna_def_fluidsim_slip(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem slip_items[] = {
- {OB_FSBND_NOSLIP, "NOSLIP", 0, "No Slip",
- "Obstacle causes zero normal and tangential velocity (=sticky), default for all "
- "(only option for moving objects)"},
- {OB_FSBND_PARTSLIP, "PARTIALSLIP", 0, "Partial Slip",
- "Mix between no-slip and free-slip (non moving objects only!)"},
- {OB_FSBND_FREESLIP, "FREESLIP", 0, "Free Slip",
- "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "typeFlags");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, slip_items);
- RNA_def_property_ui_text(prop, "Slip Type", "");
-
- prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "partSlipValue");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Partial Slip Amount",
- "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem slip_items[] = {
+ {OB_FSBND_NOSLIP,
+ "NOSLIP",
+ 0,
+ "No Slip",
+ "Obstacle causes zero normal and tangential velocity (=sticky), default for all "
+ "(only option for moving objects)"},
+ {OB_FSBND_PARTSLIP,
+ "PARTIALSLIP",
+ 0,
+ "Partial Slip",
+ "Mix between no-slip and free-slip (non moving objects only!)"},
+ {OB_FSBND_FREESLIP,
+ "FREESLIP",
+ 0,
+ "Free Slip",
+ "Obstacle only causes zero normal velocity (=not sticky, non moving objects only!)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "slip_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "typeFlags");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, slip_items);
+ RNA_def_property_ui_text(prop, "Slip Type", "");
+
+ prop = RNA_def_property(srna, "partial_slip_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "partSlipValue");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Partial Slip Amount",
+ "Amount of mixing between no- and free-slip, 0 is no slip and 1 is free slip");
}
static void rna_def_fluid_mesh_vertices(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FluidVertexVelocity", NULL);
- RNA_def_struct_ui_text(srna, "Fluid Mesh Velocity", "Velocity of a simulated fluid mesh");
- RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
-
- prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_sdna(prop, NULL, "vel");
- RNA_def_property_ui_text(prop, "Velocity", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FluidVertexVelocity", NULL);
+ RNA_def_struct_ui_text(srna, "Fluid Mesh Velocity", "Velocity of a simulated fluid mesh");
+ RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
+
+ prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_sdna(prop, NULL, "vel");
+ RNA_def_property_ui_text(prop, "Velocity", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
-
static void rna_def_fluidsim_domain(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem quality_items[] = {
- {OB_FSDOM_GEOM, "GEOMETRY", 0, "Geometry", "Display geometry"},
- {OB_FSDOM_PREVIEW, "PREVIEW", 0, "Preview", "Display preview quality results"},
- {OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Domain Fluid Simulation Settings",
- "Fluid simulation settings for the domain of a fluid simulation");
-
- /* standard settings */
-
- prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "threads");
- RNA_def_property_range(prop, 0, BLENDER_MAX_THREADS);
- RNA_def_property_ui_text(prop, "Simulation Threads", "Override number of threads for the simulation, 0 is automatic");
-
- prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "resolutionxyz");
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_text(prop, "Resolution", "Domain resolution in X,Y and Z direction");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "preview_resolution", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "previewresxyz");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Preview Resolution", "Preview resolution in X,Y and Z direction");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "viewport_display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "guiDisplayMode");
- RNA_def_property_enum_items(prop, quality_items);
- RNA_def_property_ui_text(prop, "Viewport Display Mode", "How to display the mesh in the viewport");
- RNA_def_property_update(prop, 0, "rna_fluid_update");
-
- prop = RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "renderDisplayMode");
- RNA_def_property_enum_items(prop, quality_items);
- RNA_def_property_ui_text(prop, "Render Display Mode", "How to display the mesh for rendering");
-
- prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
- RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse fluid frames");
- RNA_def_property_update(prop, 0, "rna_fluid_find_enframe");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_maxlength(prop, FILE_MAX);
- RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
- RNA_def_property_ui_text(prop, "Path",
- "Directory (and/or filename prefix) to store baked fluid simulation files in");
- RNA_def_property_update(prop, 0, "rna_fluid_update");
-
- prop = RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_DomainFluidSettings_memory_estimate_get",
- "rna_DomainFluidSettings_memory_estimate_length", NULL);
- RNA_def_property_ui_text(prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain");
-
- /* advanced settings */
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
- RNA_def_property_float_sdna(prop, NULL, "grav");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1000.1, 1000.1);
- RNA_def_property_ui_text(prop, "Gravity", "Gravity in X, Y and Z direction");
-
- prop = RNA_def_property(srna, "use_time_override", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_OVERRIDE_TIME);
- RNA_def_property_ui_text(prop, "Override Time",
- "Use a custom start and end time (in seconds) instead of the scene's timeline");
-
- prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "animStart");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Start Time", "Simulation time of the first blender frame (in seconds)");
-
- prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "animEnd");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "End Time", "Simulation time of the last blender frame (in seconds)");
-
- prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "frameOffset");
- RNA_def_property_ui_text(prop, "Cache Offset", "Offset when reading baked cache");
- RNA_def_property_update(prop, NC_OBJECT, "rna_fluid_update");
-
- prop = RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "realsize");
- RNA_def_property_range(prop, 0.001, 10);
- RNA_def_property_ui_text(prop, "Real World Size", "Size of the simulation domain in meters");
-
- prop = RNA_def_property(srna, "simulation_rate", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "animRate");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_text(prop, "Simulation Speed", "Fluid motion rate (0 = stationary, 1 = normal speed)");
-
- prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "viscosityValue");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Viscosity Base",
- "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
-
- prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "viscosityExponent");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Viscosity Exponent",
- "Negative exponent for the viscosity value (to simplify entering small values "
- "e.g. 5*10^-6)");
-
- prop = RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "maxRefine");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, -1, 4);
- RNA_def_property_ui_text(prop, "Grid Levels", "Number of coarsened grids to use (-1 for automatic)");
-
- prop = RNA_def_property(srna, "compressibility", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "gstar");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_text(prop, "Compressibility",
- "Allowed compressibility due to gravitational force for standing fluid "
- "(directly affects simulation step size)");
-
- /* domain boundary settings */
-
- rna_def_fluidsim_slip(srna);
-
- prop = RNA_def_property(srna, "surface_smooth", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0, 5.0);
- RNA_def_property_ui_text(prop, "Surface Smoothing",
- "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and "
- "more than 1 is extra smoothing)");
-
- prop = RNA_def_property(srna, "surface_subdivisions", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 5);
- RNA_def_property_ui_text(prop, "Surface Subdivisions",
- "Number of isosurface subdivisions (this is necessary for the inclusion of particles "
- "into the surface generation - WARNING: can lead to longer computation times !)");
-
- prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Generate Speed Vectors", "Generate speed vectors for vector blur");
-
- /* no collision object surface */
- prop = RNA_def_property(srna, "use_surface_noobs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSSG_NOOBS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Remove air bubbles",
- "Removes the air gap between fluid surface and obstacles - WARNING: Can result "
- "in a dissolving surface in other areas");
-
- /* particles */
-
- prop = RNA_def_property(srna, "tracer_particles", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "generateTracers");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 10000);
- RNA_def_property_ui_text(prop, "Tracer Particles", "Number of tracer particles to generate");
-
- prop = RNA_def_property(srna, "generate_particles", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "generateParticles");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)");
-
- /* simulated fluid mesh data */
- prop = RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "meshVelocities", "totvert");
- RNA_def_property_struct_type(prop, "FluidVertexVelocity");
- RNA_def_property_ui_text(prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation");
-
- rna_def_fluid_mesh_vertices(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem quality_items[] = {
+ {OB_FSDOM_GEOM, "GEOMETRY", 0, "Geometry", "Display geometry"},
+ {OB_FSDOM_PREVIEW, "PREVIEW", 0, "Preview", "Display preview quality results"},
+ {OB_FSDOM_FINAL, "FINAL", 0, "Final", "Display final quality results"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "DomainFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(srna,
+ "Domain Fluid Simulation Settings",
+ "Fluid simulation settings for the domain of a fluid simulation");
+
+ /* standard settings */
+
+ prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "threads");
+ RNA_def_property_range(prop, 0, BLENDER_MAX_THREADS);
+ RNA_def_property_ui_text(
+ prop, "Simulation Threads", "Override number of threads for the simulation, 0 is automatic");
+
+ prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "resolutionxyz");
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_text(prop, "Resolution", "Domain resolution in X,Y and Z direction");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "preview_resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "previewresxyz");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(
+ prop, "Preview Resolution", "Preview resolution in X,Y and Z direction");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "viewport_display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "guiDisplayMode");
+ RNA_def_property_enum_items(prop, quality_items);
+ RNA_def_property_ui_text(
+ prop, "Viewport Display Mode", "How to display the mesh in the viewport");
+ RNA_def_property_update(prop, 0, "rna_fluid_update");
+
+ prop = RNA_def_property(srna, "render_display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "renderDisplayMode");
+ RNA_def_property_enum_items(prop, quality_items);
+ RNA_def_property_ui_text(prop, "Render Display Mode", "How to display the mesh for rendering");
+
+ prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
+ RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse fluid frames");
+ RNA_def_property_update(prop, 0, "rna_fluid_find_enframe");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_maxlength(prop, FILE_MAX);
+ RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
+ RNA_def_property_ui_text(
+ prop, "Path", "Directory (and/or filename prefix) to store baked fluid simulation files in");
+ RNA_def_property_update(prop, 0, "rna_fluid_update");
+
+ prop = RNA_def_property(srna, "memory_estimate", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop,
+ "rna_DomainFluidSettings_memory_estimate_get",
+ "rna_DomainFluidSettings_memory_estimate_length",
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Memory Estimate", "Estimated amount of memory needed for baking the domain");
+
+ /* advanced settings */
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+ RNA_def_property_float_sdna(prop, NULL, "grav");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1000.1, 1000.1);
+ RNA_def_property_ui_text(prop, "Gravity", "Gravity in X, Y and Z direction");
+
+ prop = RNA_def_property(srna, "use_time_override", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_OVERRIDE_TIME);
+ RNA_def_property_ui_text(
+ prop,
+ "Override Time",
+ "Use a custom start and end time (in seconds) instead of the scene's timeline");
+
+ prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "animStart");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Start Time", "Simulation time of the first blender frame (in seconds)");
+
+ prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "animEnd");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "End Time", "Simulation time of the last blender frame (in seconds)");
+
+ prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "frameOffset");
+ RNA_def_property_ui_text(prop, "Cache Offset", "Offset when reading baked cache");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_fluid_update");
+
+ prop = RNA_def_property(srna, "simulation_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "realsize");
+ RNA_def_property_range(prop, 0.001, 10);
+ RNA_def_property_ui_text(prop, "Real World Size", "Size of the simulation domain in meters");
+
+ prop = RNA_def_property(srna, "simulation_rate", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "animRate");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_text(
+ prop, "Simulation Speed", "Fluid motion rate (0 = stationary, 1 = normal speed)");
+
+ prop = RNA_def_property(srna, "viscosity_base", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "viscosityValue");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(
+ prop,
+ "Viscosity Base",
+ "Viscosity setting: value that is multiplied by 10 to the power of (exponent*-1)");
+
+ prop = RNA_def_property(srna, "viscosity_exponent", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "viscosityExponent");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(
+ prop,
+ "Viscosity Exponent",
+ "Negative exponent for the viscosity value (to simplify entering small values "
+ "e.g. 5*10^-6)");
+
+ prop = RNA_def_property(srna, "grid_levels", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "maxRefine");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, -1, 4);
+ RNA_def_property_ui_text(
+ prop, "Grid Levels", "Number of coarsened grids to use (-1 for automatic)");
+
+ prop = RNA_def_property(srna, "compressibility", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gstar");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_text(prop,
+ "Compressibility",
+ "Allowed compressibility due to gravitational force for standing fluid "
+ "(directly affects simulation step size)");
+
+ /* domain boundary settings */
+
+ rna_def_fluidsim_slip(srna);
+
+ prop = RNA_def_property(srna, "surface_smooth", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0, 5.0);
+ RNA_def_property_ui_text(
+ prop,
+ "Surface Smoothing",
+ "Amount of surface smoothing (a value of 0 is off, 1 is normal smoothing and "
+ "more than 1 is extra smoothing)");
+
+ prop = RNA_def_property(srna, "surface_subdivisions", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "surfaceSubdivs");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 5);
+ RNA_def_property_ui_text(
+ prop,
+ "Surface Subdivisions",
+ "Number of isosurface subdivisions (this is necessary for the inclusion of particles "
+ "into the surface generation - WARNING: can lead to longer computation times !)");
+
+ prop = RNA_def_property(srna, "use_speed_vectors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "domainNovecgen", 0);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Generate Speed Vectors", "Generate speed vectors for vector blur");
+
+ /* no collision object surface */
+ prop = RNA_def_property(srna, "use_surface_noobs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSSG_NOOBS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Remove air bubbles",
+ "Removes the air gap between fluid surface and obstacles - WARNING: Can result "
+ "in a dissolving surface in other areas");
+
+ /* particles */
+
+ prop = RNA_def_property(srna, "tracer_particles", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "generateTracers");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_ui_text(prop, "Tracer Particles", "Number of tracer particles to generate");
+
+ prop = RNA_def_property(srna, "generate_particles", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "generateParticles");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(
+ prop, "Generate Particles", "Amount of particles to generate (0=off, 1=normal, >1=more)");
+
+ /* simulated fluid mesh data */
+ prop = RNA_def_property(srna, "fluid_mesh_vertices", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "meshVelocities", "totvert");
+ RNA_def_property_struct_type(prop, "FluidVertexVelocity");
+ RNA_def_property_ui_text(
+ prop, "Fluid Mesh Vertices", "Vertices of the fluid mesh generated by simulation");
+
+ rna_def_fluid_mesh_vertices(brna);
}
static void rna_def_fluidsim_volume(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem volume_type_items[] = {
- {1, "VOLUME", 0, "Volume", "Use only the inner volume of the mesh"},
- {2, "SHELL", 0, "Shell", "Use only the outer shell of the mesh"},
- {3, "BOTH", 0, "Both", "Use both the inner volume and the outer shell of the mesh"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "volume_initialization", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "volumeInitType");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, volume_type_items);
- RNA_def_property_ui_text(prop, "Volume Initialization", "Volume initialization type "
- "(WARNING: complex volumes might require too much memory and break simulation)");
-
- prop = RNA_def_property(srna, "use_animated_mesh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "domainNovecgen", 0);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Export Animated Mesh",
- "Export this mesh as an animated one (slower and enforces No Slip, only use if really "
- "necessary [e.g. armatures or parented objects], animated pos/rot/scale F-Curves "
- "do not require it)");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem volume_type_items[] = {
+ {1, "VOLUME", 0, "Volume", "Use only the inner volume of the mesh"},
+ {2, "SHELL", 0, "Shell", "Use only the outer shell of the mesh"},
+ {3, "BOTH", 0, "Both", "Use both the inner volume and the outer shell of the mesh"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "volume_initialization", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "volumeInitType");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, volume_type_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Volume Initialization",
+ "Volume initialization type "
+ "(WARNING: complex volumes might require too much memory and break simulation)");
+
+ prop = RNA_def_property(srna, "use_animated_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "domainNovecgen", 0);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Export Animated Mesh",
+ "Export this mesh as an animated one (slower and enforces No Slip, only use if really "
+ "necessary [e.g. armatures or parented objects], animated pos/rot/scale F-Curves "
+ "do not require it)");
}
static void rna_def_fluidsim_active(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_ACTIVE);
- RNA_def_property_ui_text(prop, "Enabled", "Object contributes to the fluid simulation");
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_ACTIVE);
+ RNA_def_property_ui_text(prop, "Enabled", "Object contributes to the fluid simulation");
}
static void rna_def_fluidsim_fluid(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FluidFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Fluid Fluid Simulation Settings",
- "Fluid simulation settings for the fluid in the simulation");
-
- rna_def_fluidsim_active(srna);
- rna_def_fluidsim_volume(srna);
-
- prop = RNA_def_property(srna, "initial_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "iniVelx");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1000.1, 1000.1);
- RNA_def_property_ui_text(prop, "Initial Velocity", "Initial velocity of fluid");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FluidFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(srna,
+ "Fluid Fluid Simulation Settings",
+ "Fluid simulation settings for the fluid in the simulation");
+
+ rna_def_fluidsim_active(srna);
+ rna_def_fluidsim_volume(srna);
+
+ prop = RNA_def_property(srna, "initial_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "iniVelx");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1000.1, 1000.1);
+ RNA_def_property_ui_text(prop, "Initial Velocity", "Initial velocity of fluid");
}
static void rna_def_fluidsim_obstacle(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ObstacleFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Obstacle Fluid Simulation Settings",
- "Fluid simulation settings for obstacles in the simulation");
-
- rna_def_fluidsim_active(srna);
- rna_def_fluidsim_volume(srna);
- rna_def_fluidsim_slip(srna);
-
- prop = RNA_def_property(srna, "impact_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, -2.0, 10.0);
- RNA_def_property_ui_text(prop, "Impact Factor",
- "This is an unphysical value for moving objects - it controls the impact an obstacle "
- "has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, "
- "while >1 results in high forces (can be used to tweak total mass)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ObstacleFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(srna,
+ "Obstacle Fluid Simulation Settings",
+ "Fluid simulation settings for obstacles in the simulation");
+
+ rna_def_fluidsim_active(srna);
+ rna_def_fluidsim_volume(srna);
+ rna_def_fluidsim_slip(srna);
+
+ prop = RNA_def_property(srna, "impact_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "surfaceSmoothing");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, -2.0, 10.0);
+ RNA_def_property_ui_text(
+ prop,
+ "Impact Factor",
+ "This is an unphysical value for moving objects - it controls the impact an obstacle "
+ "has on the fluid, =0 behaves a bit like outflow (deleting fluid), =1 is default, "
+ "while >1 results in high forces (can be used to tweak total mass)");
}
static void rna_def_fluidsim_inflow(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "InflowFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Inflow Fluid Simulation Settings",
- "Fluid simulation settings for objects adding fluids in the simulation");
-
- rna_def_fluidsim_active(srna);
- rna_def_fluidsim_volume(srna);
-
- prop = RNA_def_property(srna, "inflow_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "iniVelx");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1000.1, 1000.1);
- RNA_def_property_ui_text(prop, "Inflow Velocity", "Initial velocity of fluid");
-
- prop = RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSINFLOW_LOCALCOORD);
- RNA_def_property_ui_text(prop, "Local Coordinates",
- "Use local coordinates for inflow (e.g. for rotating objects)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "InflowFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(srna,
+ "Inflow Fluid Simulation Settings",
+ "Fluid simulation settings for objects adding fluids in the simulation");
+
+ rna_def_fluidsim_active(srna);
+ rna_def_fluidsim_volume(srna);
+
+ prop = RNA_def_property(srna, "inflow_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "iniVelx");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1000.1, 1000.1);
+ RNA_def_property_ui_text(prop, "Inflow Velocity", "Initial velocity of fluid");
+
+ prop = RNA_def_property(srna, "use_local_coords", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSINFLOW_LOCALCOORD);
+ RNA_def_property_ui_text(
+ prop, "Local Coordinates", "Use local coordinates for inflow (e.g. for rotating objects)");
}
static void rna_def_fluidsim_outflow(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "OutflowFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Outflow Fluid Simulation Settings",
- "Fluid simulation settings for objects removing fluids from the simulation");
+ srna = RNA_def_struct(brna, "OutflowFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(
+ srna,
+ "Outflow Fluid Simulation Settings",
+ "Fluid simulation settings for objects removing fluids from the simulation");
- rna_def_fluidsim_active(srna);
- rna_def_fluidsim_volume(srna);
+ rna_def_fluidsim_active(srna);
+ rna_def_fluidsim_volume(srna);
}
static void rna_def_fluidsim_particle(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ParticleFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Particle Fluid Simulation Settings",
- "Fluid simulation settings for objects storing fluid particles generated"
- " by the simulation");
-
- prop = RNA_def_property(srna, "use_drops", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_DROP);
- RNA_def_property_ui_text(prop, "Drops", "Show drop particles");
-
- prop = RNA_def_property(srna, "use_floats", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_FLOAT);
- RNA_def_property_ui_text(prop, "Floats", "Show floating foam particles");
-
- prop = RNA_def_property(srna, "show_tracer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_TRACER);
- RNA_def_property_ui_text(prop, "Tracer", "Show tracer particles");
-
- prop = RNA_def_property(srna, "particle_influence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "particleInfSize");
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Particle Influence",
- "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), "
- ">1=stronger");
-
- prop = RNA_def_property(srna, "alpha_influence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "particleInfAlpha");
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Alpha Influence",
- "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), "
- "1=full (larger particles get lower alphas, smaller ones higher values)");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_maxlength(prop, FILE_MAX);
- RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
- RNA_def_property_ui_text(prop, "Path", "Directory (and/or filename prefix) to store and load particles from");
- RNA_def_property_update(prop, 0, "rna_fluid_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ParticleFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(srna,
+ "Particle Fluid Simulation Settings",
+ "Fluid simulation settings for objects storing fluid particles generated"
+ " by the simulation");
+
+ prop = RNA_def_property(srna, "use_drops", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_DROP);
+ RNA_def_property_ui_text(prop, "Drops", "Show drop particles");
+
+ prop = RNA_def_property(srna, "use_floats", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_FLOAT);
+ RNA_def_property_ui_text(prop, "Floats", "Show floating foam particles");
+
+ prop = RNA_def_property(srna, "show_tracer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "typeFlags", OB_FSPART_TRACER);
+ RNA_def_property_ui_text(prop, "Tracer", "Show tracer particles");
+
+ prop = RNA_def_property(srna, "particle_influence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "particleInfSize");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(
+ prop,
+ "Particle Influence",
+ "Amount of particle size scaling: 0=off (all same size), 1=full (range 0.2-2.0), "
+ ">1=stronger");
+
+ prop = RNA_def_property(srna, "alpha_influence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "particleInfAlpha");
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(
+ prop,
+ "Alpha Influence",
+ "Amount of particle alpha change, inverse of size influence: 0=off (all same alpha), "
+ "1=full (larger particles get lower alphas, smaller ones higher values)");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_maxlength(prop, FILE_MAX);
+ RNA_def_property_string_sdna(prop, NULL, "surfdataPath");
+ RNA_def_property_ui_text(
+ prop, "Path", "Directory (and/or filename prefix) to store and load particles from");
+ RNA_def_property_update(prop, 0, "rna_fluid_update");
}
static void rna_def_fluidsim_control(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ControlFluidSettings", "FluidSettings");
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_ui_text(srna, "Control Fluid Simulation Settings",
- "Fluid simulation settings for objects controlling the motion of fluid in the simulation");
-
- rna_def_fluidsim_active(srna);
-
- prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "cpsTimeStart");
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Start Time", "Time when the control particles are activated");
-
- prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "cpsTimeEnd");
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(prop, "End Time", "Time when the control particles are deactivated");
-
- prop = RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "attractforceStrength");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_text(prop, "Attraction Strength",
- "Force strength for directional attraction towards the control object");
-
- prop = RNA_def_property(srna, "attraction_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "attractforceRadius");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Attraction Radius", "Force field radius around the control object");
-
- prop = RNA_def_property(srna, "velocity_strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "velocityforceStrength");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Velocity Strength",
- "Force strength of how much of the control object's velocity is influencing the "
- "fluid velocity");
-
- prop = RNA_def_property(srna, "velocity_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "velocityforceRadius");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Velocity Radius", "Force field radius around the control object");
-
- prop = RNA_def_property(srna, "quality", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cpsQuality");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 5.0, 100.0);
- RNA_def_property_ui_text(prop, "Quality",
- "Quality which is used for object sampling (higher = better but slower)");
-
- prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse control object movement");
- RNA_def_property_update(prop, 0, "rna_fluid_find_enframe");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ControlFluidSettings", "FluidSettings");
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_ui_text(
+ srna,
+ "Control Fluid Simulation Settings",
+ "Fluid simulation settings for objects controlling the motion of fluid in the simulation");
+
+ rna_def_fluidsim_active(srna);
+
+ prop = RNA_def_property(srna, "start_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "cpsTimeStart");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Start Time", "Time when the control particles are activated");
+
+ prop = RNA_def_property(srna, "end_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "cpsTimeEnd");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "End Time", "Time when the control particles are deactivated");
+
+ prop = RNA_def_property(srna, "attraction_strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "attractforceStrength");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_ui_text(prop,
+ "Attraction Strength",
+ "Force strength for directional attraction towards the control object");
+
+ prop = RNA_def_property(srna, "attraction_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "attractforceRadius");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(
+ prop, "Attraction Radius", "Force field radius around the control object");
+
+ prop = RNA_def_property(srna, "velocity_strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "velocityforceStrength");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(
+ prop,
+ "Velocity Strength",
+ "Force strength of how much of the control object's velocity is influencing the "
+ "fluid velocity");
+
+ prop = RNA_def_property(srna, "velocity_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "velocityforceRadius");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(
+ prop, "Velocity Radius", "Force field radius around the control object");
+
+ prop = RNA_def_property(srna, "quality", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cpsQuality");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 5.0, 100.0);
+ RNA_def_property_ui_text(
+ prop, "Quality", "Quality which is used for object sampling (higher = better but slower)");
+
+ prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OB_FLUIDSIM_REVERSE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Reverse Frames", "Reverse control object movement");
+ RNA_def_property_update(prop, 0, "rna_fluid_find_enframe");
}
void RNA_def_fluidsim(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_fluid_type_items[] = {
- {OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""},
- {OB_FLUIDSIM_DOMAIN, "DOMAIN", 0, "Domain",
- "Bounding box of this object represents the computational domain of the "
- "fluid simulation"},
- {OB_FLUIDSIM_FLUID, "FLUID", 0, "Fluid", "Object represents a volume of fluid in the simulation"},
- {OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle"},
- {OB_FLUIDSIM_INFLOW, "INFLOW", 0, "Inflow", "Object adds fluid to the simulation"},
- {OB_FLUIDSIM_OUTFLOW, "OUTFLOW", 0, "Outflow", "Object removes fluid from the simulation"},
- {OB_FLUIDSIM_PARTICLE, "PARTICLE", 0, "Particle",
- "Object is made a particle system to display particles generated by a "
- "fluidsim domain object"},
- {OB_FLUIDSIM_CONTROL, "CONTROL", 0, "Control",
- "Object is made a fluid control mesh, which influences the fluid"},
- {0, NULL, 0, NULL, NULL},
- };
-
-
- srna = RNA_def_struct(brna, "FluidSettings", NULL);
- RNA_def_struct_sdna(srna, "FluidsimSettings");
- RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine");
- RNA_def_struct_path_func(srna, "rna_FluidSettings_path");
- RNA_def_struct_ui_text(srna, "Fluid Simulation Settings",
- "Fluid simulation settings for an object taking part in the simulation");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_fluid_type_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Type", "Type of participation in the fluid simulation");
- RNA_def_property_update(prop, 0, "rna_FluidSettings_update_type");
-
- /*prop = RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); */
- /*RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by fluid simulation settings"); */
-
- /* types */
-
- rna_def_fluidsim_domain(brna);
- rna_def_fluidsim_fluid(brna);
- rna_def_fluidsim_obstacle(brna);
- rna_def_fluidsim_inflow(brna);
- rna_def_fluidsim_outflow(brna);
- rna_def_fluidsim_particle(brna);
- rna_def_fluidsim_control(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_fluid_type_items[] = {
+ {OB_FLUIDSIM_ENABLE, "NONE", 0, "None", ""},
+ {OB_FLUIDSIM_DOMAIN,
+ "DOMAIN",
+ 0,
+ "Domain",
+ "Bounding box of this object represents the computational domain of the "
+ "fluid simulation"},
+ {OB_FLUIDSIM_FLUID,
+ "FLUID",
+ 0,
+ "Fluid",
+ "Object represents a volume of fluid in the simulation"},
+ {OB_FLUIDSIM_OBSTACLE, "OBSTACLE", 0, "Obstacle", "Object is a fixed obstacle"},
+ {OB_FLUIDSIM_INFLOW, "INFLOW", 0, "Inflow", "Object adds fluid to the simulation"},
+ {OB_FLUIDSIM_OUTFLOW, "OUTFLOW", 0, "Outflow", "Object removes fluid from the simulation"},
+ {OB_FLUIDSIM_PARTICLE,
+ "PARTICLE",
+ 0,
+ "Particle",
+ "Object is made a particle system to display particles generated by a "
+ "fluidsim domain object"},
+ {OB_FLUIDSIM_CONTROL,
+ "CONTROL",
+ 0,
+ "Control",
+ "Object is made a fluid control mesh, which influences the fluid"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FluidSettings", NULL);
+ RNA_def_struct_sdna(srna, "FluidsimSettings");
+ RNA_def_struct_refine_func(srna, "rna_FluidSettings_refine");
+ RNA_def_struct_path_func(srna, "rna_FluidSettings_path");
+ RNA_def_struct_ui_text(srna,
+ "Fluid Simulation Settings",
+ "Fluid simulation settings for an object taking part in the simulation");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_fluid_type_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Type", "Type of participation in the fluid simulation");
+ RNA_def_property_update(prop, 0, "rna_FluidSettings_update_type");
+
+ /*prop = RNA_def_property(srna, "ipo", PROP_POINTER, PROP_NONE); */
+ /*RNA_def_property_ui_text(prop, "IPO Curves", "IPO curves used by fluid simulation settings"); */
+
+ /* types */
+
+ rna_def_fluidsim_domain(brna);
+ rna_def_fluidsim_fluid(brna);
+ rna_def_fluidsim_obstacle(brna);
+ rna_def_fluidsim_inflow(brna);
+ rna_def_fluidsim_outflow(brna);
+ rna_def_fluidsim_particle(brna);
+ rna_def_fluidsim_control(brna);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index d154f8de4ad..05cc12636ef 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -42,1711 +42,1810 @@
#include "WM_types.h"
- /* parent type */
+/* parent type */
static const EnumPropertyItem parent_type_items[] = {
- {PAROBJECT, "OBJECT", 0, "Object", "The layer is parented to an object"},
- {PARSKEL, "ARMATURE", 0, "Armature", ""},
- {PARBONE, "BONE", 0, "Bone", "The layer is parented to a bone"},
- {0, NULL, 0, NULL, NULL},
+ {PAROBJECT, "OBJECT", 0, "Object", "The layer is parented to an object"},
+ {PARSKEL, "ARMATURE", 0, "Armature", ""},
+ {PARBONE, "BONE", 0, "Bone", "The layer is parented to a bone"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static EnumPropertyItem rna_enum_gpencil_stroke_depth_order_items[] = {
- {GP_DRAWMODE_2D, "2D", 0, "2D Layers", "Display strokes using grease pencil layers to define order"},
- {GP_DRAWMODE_3D, "3D", 0, "3D Location", "Display strokes using real 3D position in 3D space"},
- {0, NULL, 0, NULL, NULL},
+ {GP_DRAWMODE_2D,
+ "2D",
+ 0,
+ "2D Layers",
+ "Display strokes using grease pencil layers to define order"},
+ {GP_DRAWMODE_3D, "3D", 0, "3D Location", "Display strokes using real 3D position in 3D space"},
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_gpencil_onion_modes_items[] = {
- {GP_ONION_MODE_ABSOLUTE, "ABSOLUTE", 0, "Frames", "Frames in absolute range of the scene frame"},
- {GP_ONION_MODE_RELATIVE, "RELATIVE", 0, "Keyframes", "Frames in relative range of the Grease Pencil keyframes"},
- {GP_ONION_MODE_SELECTED, "SELECTED", 0, "Selected", "Only selected keyframes"},
- {0, NULL, 0, NULL, NULL},
+ {GP_ONION_MODE_ABSOLUTE,
+ "ABSOLUTE",
+ 0,
+ "Frames",
+ "Frames in absolute range of the scene frame"},
+ {GP_ONION_MODE_RELATIVE,
+ "RELATIVE",
+ 0,
+ "Keyframes",
+ "Frames in relative range of the Grease Pencil keyframes"},
+ {GP_ONION_MODE_SELECTED, "SELECTED", 0, "Selected", "Only selected keyframes"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_gplayer_move_type_items[] = {
- {-1, "UP", 0, "Up", ""},
- {1, "DOWN", 0, "Down", ""},
- {0, NULL, 0, NULL, NULL},
+ {-1, "UP", 0, "Up", ""},
+ {1, "DOWN", 0, "Down", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_layer_blend_modes_items[] = {
- {eGplBlendMode_Normal, "NORMAL", 0, "Regular", "" },
- {eGplBlendMode_Overlay, "OVERLAY", 0, "Overlay", "" },
- {eGplBlendMode_Add, "ADD", 0, "Add", "" },
- {eGplBlendMode_Subtract, "SUBTRACT", 0, "Subtract", "" },
- {eGplBlendMode_Multiply, "MULTIPLY", 0, "Multiply", "" },
- {eGplBlendMode_Divide, "DIVIDE", 0, "Divide", "" },
- {0, NULL, 0, NULL, NULL }
-};
+ {eGplBlendMode_Normal, "NORMAL", 0, "Regular", ""},
+ {eGplBlendMode_Overlay, "OVERLAY", 0, "Overlay", ""},
+ {eGplBlendMode_Add, "ADD", 0, "Add", ""},
+ {eGplBlendMode_Subtract, "SUBTRACT", 0, "Subtract", ""},
+ {eGplBlendMode_Multiply, "MULTIPLY", 0, "Multiply", ""},
+ {eGplBlendMode_Divide, "DIVIDE", 0, "Divide", ""},
+ {0, NULL, 0, NULL, NULL}};
static EnumPropertyItem rna_enum_gpencil_caps_modes_items[] = {
- {GP_STROKE_CAP_ROUND, "ROUND", 0, "Rounded", ""},
- {GP_STROKE_CAP_FLAT, "FLAT", 0, "Flat", ""},
- {0, NULL, 0, NULL, NULL},
+ {GP_STROKE_CAP_ROUND, "ROUND", 0, "Rounded", ""},
+ {GP_STROKE_CAP_FLAT, "FLAT", 0, "Flat", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#include "BLI_ghash.h"
-#include "BLI_string_utils.h"
-
-#include "WM_api.h"
+# include "BLI_ghash.h"
+# include "BLI_string_utils.h"
-#include "BKE_action.h"
-#include "BKE_animsys.h"
-#include "BKE_gpencil.h"
-#include "BKE_icons.h"
+# include "WM_api.h"
-#include "DEG_depsgraph.h"
+# include "BKE_action.h"
+# include "BKE_animsys.h"
+# include "BKE_gpencil.h"
+# include "BKE_icons.h"
+# include "DEG_depsgraph.h"
static void rna_GPencil_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
static void rna_GPencil_autolock(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
- bGPDlayer *gpl = NULL;
-
- if (gpd->flag & GP_DATA_AUTOLOCK_LAYERS) {
- bGPDlayer *layer = BKE_gpencil_layer_getactive(gpd);
-
- /* Lock all other layers */
- for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- /* unlock active layer */
- if (gpl == layer) {
- gpl->flag &= ~GP_LAYER_LOCKED;
- }
- else {
- gpl->flag |= GP_LAYER_LOCKED;
- }
- }
- }
- else {
- /* If disable is better unlock all layers by default or it looks there is
- * a problem in the UI because the user expects all layers will be unlocked
- */
- for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- gpl->flag &= ~GP_LAYER_LOCKED;
- }
- }
-
- /* standard update */
- rna_GPencil_update(bmain, scene, ptr);
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPDlayer *gpl = NULL;
+
+ if (gpd->flag & GP_DATA_AUTOLOCK_LAYERS) {
+ bGPDlayer *layer = BKE_gpencil_layer_getactive(gpd);
+
+ /* Lock all other layers */
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ /* unlock active layer */
+ if (gpl == layer) {
+ gpl->flag &= ~GP_LAYER_LOCKED;
+ }
+ else {
+ gpl->flag |= GP_LAYER_LOCKED;
+ }
+ }
+ }
+ else {
+ /* If disable is better unlock all layers by default or it looks there is
+ * a problem in the UI because the user expects all layers will be unlocked
+ */
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ gpl->flag &= ~GP_LAYER_LOCKED;
+ }
+ }
+
+ /* standard update */
+ rna_GPencil_update(bmain, scene, ptr);
}
static void rna_GPencil_editmode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- /* Notify all places where GPencil data lives that the editing state is different */
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
- WM_main_add_notifier(NC_SCENE | ND_MODE | NC_MOVIECLIP, NULL);
+ /* Notify all places where GPencil data lives that the editing state is different */
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_MODE | NC_MOVIECLIP, NULL);
}
-static void UNUSED_FUNCTION(rna_GPencil_onion_skinning_update)(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void UNUSED_FUNCTION(rna_GPencil_onion_skinning_update)(Main *bmain,
+ Scene *scene,
+ PointerRNA *ptr)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
- bGPDlayer *gpl;
- bool enabled = false;
-
- /* Ensure that the datablock's onionskinning toggle flag
- * stays in sync with the status of the actual layers
- */
- for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- if (gpl->onion_flag & GP_LAYER_ONIONSKIN) {
- enabled = true;
- }
- }
-
- if (enabled)
- gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
- else
- gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
-
-
- /* Now do standard updates... */
- rna_GPencil_update(bmain, scene, ptr);
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPDlayer *gpl;
+ bool enabled = false;
+
+ /* Ensure that the datablock's onionskinning toggle flag
+ * stays in sync with the status of the actual layers
+ */
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ if (gpl->onion_flag & GP_LAYER_ONIONSKIN) {
+ enabled = true;
+ }
+ }
+
+ if (enabled)
+ gpd->flag |= GP_DATA_SHOW_ONIONSKINS;
+ else
+ gpd->flag &= ~GP_DATA_SHOW_ONIONSKINS;
+
+ /* Now do standard updates... */
+ rna_GPencil_update(bmain, scene, ptr);
}
-
/* Poll Callback to filter GP Datablocks to only show those for Annotations */
bool rna_GPencil_datablocks_annotations_poll(PointerRNA *UNUSED(ptr), const PointerRNA value)
{
- bGPdata *gpd = value.data;
- return (gpd->flag & GP_DATA_ANNOTATIONS) != 0;
+ bGPdata *gpd = value.data;
+ return (gpd->flag & GP_DATA_ANNOTATIONS) != 0;
}
/* Poll Callback to filter GP Datablocks to only show those for GP Objects */
bool rna_GPencil_datablocks_obdata_poll(PointerRNA *UNUSED(ptr), const PointerRNA value)
{
- bGPdata *gpd = value.data;
- return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
+ bGPdata *gpd = value.data;
+ return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
}
-
static char *rna_GPencilLayer_path(PointerRNA *ptr)
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- char name_esc[sizeof(gpl->info) * 2];
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ char name_esc[sizeof(gpl->info) * 2];
- BLI_strescape(name_esc, gpl->info, sizeof(name_esc));
+ BLI_strescape(name_esc, gpl->info, sizeof(name_esc));
- return BLI_sprintfN("layers[\"%s\"]", name_esc);
+ return BLI_sprintfN("layers[\"%s\"]", name_esc);
}
static int rna_GPencilLayer_active_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- /* surely there must be other criteria too... */
- if (gpl->flag & GP_LAYER_LOCKED)
- return 0;
- else
- return PROP_EDITABLE;
+ /* surely there must be other criteria too... */
+ if (gpl->flag & GP_LAYER_LOCKED)
+ return 0;
+ else
+ return PROP_EDITABLE;
}
/* set parent */
static void set_parent(bGPDlayer *gpl, Object *par, const int type, const char *substr)
{
- if (type == PAROBJECT) {
- invert_m4_m4(gpl->inverse, par->obmat);
- gpl->parent = par;
- gpl->partype |= PAROBJECT;
- gpl->parsubstr[0] = 0;
- }
- else if (type == PARSKEL) {
- invert_m4_m4(gpl->inverse, par->obmat);
- gpl->parent = par;
- gpl->partype |= PARSKEL;
- gpl->parsubstr[0] = 0;
- }
- else if (type == PARBONE) {
- bPoseChannel *pchan = BKE_pose_channel_find_name(par->pose, substr);
- if (pchan) {
- float tmp_mat[4][4];
- mul_m4_m4m4(tmp_mat, par->obmat, pchan->pose_mat);
-
- invert_m4_m4(gpl->inverse, tmp_mat);
- gpl->parent = par;
- gpl->partype |= PARBONE;
- BLI_strncpy(gpl->parsubstr, substr, sizeof(gpl->parsubstr));
- }
- }
+ if (type == PAROBJECT) {
+ invert_m4_m4(gpl->inverse, par->obmat);
+ gpl->parent = par;
+ gpl->partype |= PAROBJECT;
+ gpl->parsubstr[0] = 0;
+ }
+ else if (type == PARSKEL) {
+ invert_m4_m4(gpl->inverse, par->obmat);
+ gpl->parent = par;
+ gpl->partype |= PARSKEL;
+ gpl->parsubstr[0] = 0;
+ }
+ else if (type == PARBONE) {
+ bPoseChannel *pchan = BKE_pose_channel_find_name(par->pose, substr);
+ if (pchan) {
+ float tmp_mat[4][4];
+ mul_m4_m4m4(tmp_mat, par->obmat, pchan->pose_mat);
+
+ invert_m4_m4(gpl->inverse, tmp_mat);
+ gpl->parent = par;
+ gpl->partype |= PARBONE;
+ BLI_strncpy(gpl->parsubstr, substr, sizeof(gpl->parsubstr));
+ }
+ }
}
/* set parent object and inverse matrix */
static void rna_GPencilLayer_parent_set(PointerRNA *ptr, PointerRNA value)
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- Object *par = (Object *)value.data;
-
- if (par != NULL) {
- set_parent(gpl, par, gpl->partype, gpl->parsubstr);
- }
- else {
- /* clear parent */
- gpl->parent = NULL;
- }
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ Object *par = (Object *)value.data;
+
+ if (par != NULL) {
+ set_parent(gpl, par, gpl->partype, gpl->parsubstr);
+ }
+ else {
+ /* clear parent */
+ gpl->parent = NULL;
+ }
}
/* set parent type */
static void rna_GPencilLayer_parent_type_set(PointerRNA *ptr, int value)
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- Object *par = gpl->parent;
- gpl->partype = value;
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ Object *par = gpl->parent;
+ gpl->partype = value;
- if (par != NULL) {
- set_parent(gpl, par, value, gpl->parsubstr);
- }
+ if (par != NULL) {
+ set_parent(gpl, par, value, gpl->parsubstr);
+ }
}
/* set parent bone */
static void rna_GPencilLayer_parent_bone_set(PointerRNA *ptr, const char *value)
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- Object *par = gpl->parent;
- gpl->partype = PARBONE;
+ Object *par = gpl->parent;
+ gpl->partype = PARBONE;
- if (par != NULL) {
- set_parent(gpl, par, gpl->partype, value);
- }
+ if (par != NULL) {
+ set_parent(gpl, par, gpl->partype, value);
+ }
}
-
/* parent types enum */
-static const EnumPropertyItem *rna_Object_parent_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
+ RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
- if (gpl->parent) {
- Object *par = gpl->parent;
+ if (gpl->parent) {
+ Object *par = gpl->parent;
- if (par->type == OB_ARMATURE) {
- /* special hack: prevents this being overridden */
- RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
- RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
- }
- }
+ if (par->type == OB_ARMATURE) {
+ /* special hack: prevents this being overridden */
+ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
+ RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
+ }
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static bool rna_GPencilLayer_is_parented_get(PointerRNA *ptr)
{
- bGPDlayer *gpl = (bGPDlayer *)ptr->data;
- return (gpl->parent != NULL);
+ bGPDlayer *gpl = (bGPDlayer *)ptr->data;
+ return (gpl->parent != NULL);
}
static PointerRNA rna_GPencil_active_layer_get(PointerRNA *ptr)
{
- bGPdata *gpd = ptr->id.data;
+ bGPdata *gpd = ptr->id.data;
- if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */
- bGPDlayer *gl;
+ if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */
+ bGPDlayer *gl;
- for (gl = gpd->layers.first; gl; gl = gl->next) {
- if (gl->flag & GP_LAYER_ACTIVE) {
- break;
- }
- }
+ for (gl = gpd->layers.first; gl; gl = gl->next) {
+ if (gl->flag & GP_LAYER_ACTIVE) {
+ break;
+ }
+ }
- if (gl) {
- return rna_pointer_inherit_refine(ptr, &RNA_GPencilLayer, gl);
- }
- }
+ if (gl) {
+ return rna_pointer_inherit_refine(ptr, &RNA_GPencilLayer, gl);
+ }
+ }
- return rna_pointer_inherit_refine(ptr, NULL, NULL);
+ return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_GPencil_active_layer_set(PointerRNA *ptr, PointerRNA value)
{
- bGPdata *gpd = ptr->id.data;
-
- /* Don't allow setting active layer to NULL if layers exist
- * as this breaks various tools. Tools should be used instead
- * if it's necessary to remove layers
- */
- if (value.data == NULL) {
- printf("%s: Setting active layer to None is not allowed\n", __func__);
- return;
- }
-
- if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */
- bGPDlayer *gl;
-
- for (gl = gpd->layers.first; gl; gl = gl->next) {
- if (gl == value.data) {
- gl->flag |= GP_LAYER_ACTIVE;
- }
- else {
- gl->flag &= ~GP_LAYER_ACTIVE;
- }
- }
-
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
- }
+ bGPdata *gpd = ptr->id.data;
+
+ /* Don't allow setting active layer to NULL if layers exist
+ * as this breaks various tools. Tools should be used instead
+ * if it's necessary to remove layers
+ */
+ if (value.data == NULL) {
+ printf("%s: Setting active layer to None is not allowed\n", __func__);
+ return;
+ }
+
+ if (GS(gpd->id.name) == ID_GD) { /* why would this ever be not GD */
+ bGPDlayer *gl;
+
+ for (gl = gpd->layers.first; gl; gl = gl->next) {
+ if (gl == value.data) {
+ gl->flag |= GP_LAYER_ACTIVE;
+ }
+ else {
+ gl->flag &= ~GP_LAYER_ACTIVE;
+ }
+ }
+
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ }
}
static int rna_GPencil_active_layer_index_get(PointerRNA *ptr)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
- bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPDlayer *gpl = BKE_gpencil_layer_getactive(gpd);
- return BLI_findindex(&gpd->layers, gpl);
+ return BLI_findindex(&gpd->layers, gpl);
}
static void rna_GPencil_active_layer_index_set(PointerRNA *ptr, int value)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
- bGPDlayer *gpl = BLI_findlink(&gpd->layers, value);
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPDlayer *gpl = BLI_findlink(&gpd->layers, value);
- BKE_gpencil_layer_setactive(gpd, gpl);
+ BKE_gpencil_layer_setactive(gpd, gpl);
- /* Now do standard updates... */
- DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL);
+ /* Now do standard updates... */
+ DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED | ND_SPACE_PROPERTIES, NULL);
}
-static void rna_GPencil_active_layer_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_GPencil_active_layer_index_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&gpd->layers) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&gpd->layers) - 1);
- *softmin = *min;
- *softmax = *max;
+ *softmin = *min;
+ *softmax = *max;
}
-static const EnumPropertyItem *rna_GPencil_active_layer_itemf(
- bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_GPencil_active_layer_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- bGPdata *gpd = (bGPdata *)ptr->id.data;
- bGPDlayer *gpl;
- EnumPropertyItem *item = NULL, item_tmp = { 0 };
- int totitem = 0;
- int i = 0;
+ bGPdata *gpd = (bGPdata *)ptr->id.data;
+ bGPDlayer *gpl;
+ EnumPropertyItem *item = NULL, item_tmp = {0};
+ int totitem = 0;
+ int i = 0;
- if (ELEM(NULL, C, gpd)) {
- return DummyRNA_NULL_items;
- }
+ if (ELEM(NULL, C, gpd)) {
+ return DummyRNA_NULL_items;
+ }
- /* Existing layers */
- for (gpl = gpd->layers.first, i = 0; gpl; gpl = gpl->next, i++) {
- item_tmp.identifier = gpl->info;
- item_tmp.name = gpl->info;
- item_tmp.value = i;
+ /* Existing layers */
+ for (gpl = gpd->layers.first, i = 0; gpl; gpl = gpl->next, i++) {
+ item_tmp.identifier = gpl->info;
+ item_tmp.name = gpl->info;
+ item_tmp.value = i;
- item_tmp.icon = BKE_icon_gplayer_color_ensure(gpl);
+ item_tmp.icon = BKE_icon_gplayer_color_ensure(gpl);
- RNA_enum_item_add(&item, &totitem, &item_tmp);
- }
+ RNA_enum_item_add(&item, &totitem, &item_tmp);
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static void rna_GPencilLayer_info_set(PointerRNA *ptr, const char *value)
{
- bGPdata *gpd = ptr->id.data;
- bGPDlayer *gpl = ptr->data;
+ bGPdata *gpd = ptr->id.data;
+ bGPDlayer *gpl = ptr->data;
- char oldname[128] = "";
- BLI_strncpy(oldname, gpl->info, sizeof(oldname));
+ char oldname[128] = "";
+ BLI_strncpy(oldname, gpl->info, sizeof(oldname));
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(gpl->info, value, sizeof(gpl->info));
- BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
+ BLI_uniquename(
+ &gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
- /* now fix animation paths */
- BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info);
+ /* now fix animation paths */
+ BKE_animdata_fix_paths_rename_all(&gpd->id, "layers", oldname, gpl->info);
}
-static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd, const bGPDspoint *pt, bGPDlayer **r_gpl, bGPDframe **r_gpf)
+static bGPDstroke *rna_GPencil_stroke_point_find_stroke(const bGPdata *gpd,
+ const bGPDspoint *pt,
+ bGPDlayer **r_gpl,
+ bGPDframe **r_gpf)
{
- bGPDlayer *gpl;
- bGPDstroke *gps;
-
- /* sanity checks */
- if (ELEM(NULL, gpd, pt)) {
- return NULL;
- }
-
- if (r_gpl) *r_gpl = NULL;
- if (r_gpf) *r_gpf = NULL;
-
- /* there's no faster alternative than just looping over everything... */
- for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
- if (gpl->actframe) {
- for (gps = gpl->actframe->strokes.first; gps; gps = gps->next) {
- if ((pt >= gps->points) && (pt < &gps->points[gps->totpoints])) {
- /* found it */
- if (r_gpl) *r_gpl = gpl;
- if (r_gpf) *r_gpf = gpl->actframe;
-
- return gps;
- }
- }
- }
- }
-
- /* didn't find it */
- return NULL;
+ bGPDlayer *gpl;
+ bGPDstroke *gps;
+
+ /* sanity checks */
+ if (ELEM(NULL, gpd, pt)) {
+ return NULL;
+ }
+
+ if (r_gpl)
+ *r_gpl = NULL;
+ if (r_gpf)
+ *r_gpf = NULL;
+
+ /* there's no faster alternative than just looping over everything... */
+ for (gpl = gpd->layers.first; gpl; gpl = gpl->next) {
+ if (gpl->actframe) {
+ for (gps = gpl->actframe->strokes.first; gps; gps = gps->next) {
+ if ((pt >= gps->points) && (pt < &gps->points[gps->totpoints])) {
+ /* found it */
+ if (r_gpl)
+ *r_gpl = gpl;
+ if (r_gpf)
+ *r_gpf = gpl->actframe;
+
+ return gps;
+ }
+ }
+ }
+ }
+
+ /* didn't find it */
+ return NULL;
}
static void rna_GPencil_stroke_point_select_set(PointerRNA *ptr, const bool value)
{
- bGPdata *gpd = ptr->id.data;
- bGPDspoint *pt = ptr->data;
- bGPDstroke *gps = NULL;
-
- /* Ensure that corresponding stroke is set
- * - Since we don't have direct access, we're going to have to search
- * - We don't apply selection value unless we can find the corresponding
- * stroke, so that they don't get out of sync
- */
- gps = rna_GPencil_stroke_point_find_stroke(gpd, pt, NULL, NULL);
- if (gps) {
- /* Set the new selection state for the point */
- if (value)
- pt->flag |= GP_SPOINT_SELECT;
- else
- pt->flag &= ~GP_SPOINT_SELECT;
-
- /* Check if the stroke should be selected or not... */
- BKE_gpencil_stroke_sync_selection(gps);
- }
+ bGPdata *gpd = ptr->id.data;
+ bGPDspoint *pt = ptr->data;
+ bGPDstroke *gps = NULL;
+
+ /* Ensure that corresponding stroke is set
+ * - Since we don't have direct access, we're going to have to search
+ * - We don't apply selection value unless we can find the corresponding
+ * stroke, so that they don't get out of sync
+ */
+ gps = rna_GPencil_stroke_point_find_stroke(gpd, pt, NULL, NULL);
+ if (gps) {
+ /* Set the new selection state for the point */
+ if (value)
+ pt->flag |= GP_SPOINT_SELECT;
+ else
+ pt->flag &= ~GP_SPOINT_SELECT;
+
+ /* Check if the stroke should be selected or not... */
+ BKE_gpencil_stroke_sync_selection(gps);
+ }
}
-static void rna_GPencil_stroke_point_add(ID *id, bGPDstroke *stroke, int count, float pressure, float strength)
+static void rna_GPencil_stroke_point_add(
+ ID *id, bGPDstroke *stroke, int count, float pressure, float strength)
{
- bGPdata *gpd = (bGPdata *)id;
-
- if (count > 0) {
- /* create space at the end of the array for extra points */
- stroke->points = MEM_recallocN_id(
- stroke->points,
- sizeof(bGPDspoint) * (stroke->totpoints + count),
- "gp_stroke_points");
- stroke->dvert = MEM_recallocN_id(
- stroke->dvert,
- sizeof(MDeformVert) * (stroke->totpoints + count),
- "gp_stroke_weight");
-
- /* init the pressure and strength values so that old scripts won't need to
- * be modified to give these initial values...
- */
- for (int i = 0; i < count; i++) {
- bGPDspoint *pt = stroke->points + (stroke->totpoints + i);
- MDeformVert *dvert = stroke->dvert + (stroke->totpoints + i);
- pt->pressure = pressure;
- pt->strength = strength;
-
- dvert->totweight = 0;
- dvert->dw = NULL;
- }
-
- stroke->totpoints += count;
-
- stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
-
- gpd->flag |= GP_DATA_PYTHON_UPDATED;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
-
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
- }
+ bGPdata *gpd = (bGPdata *)id;
+
+ if (count > 0) {
+ /* create space at the end of the array for extra points */
+ stroke->points = MEM_recallocN_id(
+ stroke->points, sizeof(bGPDspoint) * (stroke->totpoints + count), "gp_stroke_points");
+ stroke->dvert = MEM_recallocN_id(
+ stroke->dvert, sizeof(MDeformVert) * (stroke->totpoints + count), "gp_stroke_weight");
+
+ /* init the pressure and strength values so that old scripts won't need to
+ * be modified to give these initial values...
+ */
+ for (int i = 0; i < count; i++) {
+ bGPDspoint *pt = stroke->points + (stroke->totpoints + i);
+ MDeformVert *dvert = stroke->dvert + (stroke->totpoints + i);
+ pt->pressure = pressure;
+ pt->strength = strength;
+
+ dvert->totweight = 0;
+ dvert->dw = NULL;
+ }
+
+ stroke->totpoints += count;
+
+ stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
+
+ gpd->flag |= GP_DATA_PYTHON_UPDATED;
+ DEG_id_tag_update(&gpd->id,
+ ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ }
}
-static void rna_GPencil_stroke_point_pop(ID *id, bGPDstroke *stroke, ReportList *reports, int index)
+static void rna_GPencil_stroke_point_pop(ID *id,
+ bGPDstroke *stroke,
+ ReportList *reports,
+ int index)
{
- bGPdata *gpd = (bGPdata *)id;
- bGPDspoint *pt_tmp = stroke->points;
- MDeformVert *pt_dvert = stroke->dvert;
-
- /* python style negative indexing */
- if (index < 0) {
- index += stroke->totpoints;
- }
-
- if (stroke->totpoints <= index || index < 0) {
- BKE_report(reports, RPT_ERROR, "GPencilStrokePoints.pop: index out of range");
- return;
- }
-
- stroke->totpoints--;
-
- stroke->points = MEM_callocN(sizeof(bGPDspoint) * stroke->totpoints, "gp_stroke_points");
- if (pt_dvert != NULL) {
- stroke->dvert = MEM_callocN(sizeof(MDeformVert) * stroke->totpoints, "gp_stroke_weights");
- }
-
- if (index > 0) {
- memcpy(stroke->points, pt_tmp, sizeof(bGPDspoint) * index);
- /* verify weight data is available */
- if (pt_dvert != NULL) {
- memcpy(stroke->dvert, pt_dvert, sizeof(MDeformVert) * index);
- }
- }
-
- if (index < stroke->totpoints) {
- memcpy(&stroke->points[index], &pt_tmp[index + 1], sizeof(bGPDspoint) * (stroke->totpoints - index));
- if (pt_dvert != NULL) {
- memcpy(&stroke->dvert[index], &pt_dvert[index + 1], sizeof(MDeformVert) * (stroke->totpoints - index));
- }
- }
-
- /* free temp buffer */
- MEM_freeN(pt_tmp);
- if (pt_dvert != NULL) {
- MEM_freeN(pt_dvert);
- }
-
- stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
-
- gpd->flag |= GP_DATA_PYTHON_UPDATED;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
-
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ bGPdata *gpd = (bGPdata *)id;
+ bGPDspoint *pt_tmp = stroke->points;
+ MDeformVert *pt_dvert = stroke->dvert;
+
+ /* python style negative indexing */
+ if (index < 0) {
+ index += stroke->totpoints;
+ }
+
+ if (stroke->totpoints <= index || index < 0) {
+ BKE_report(reports, RPT_ERROR, "GPencilStrokePoints.pop: index out of range");
+ return;
+ }
+
+ stroke->totpoints--;
+
+ stroke->points = MEM_callocN(sizeof(bGPDspoint) * stroke->totpoints, "gp_stroke_points");
+ if (pt_dvert != NULL) {
+ stroke->dvert = MEM_callocN(sizeof(MDeformVert) * stroke->totpoints, "gp_stroke_weights");
+ }
+
+ if (index > 0) {
+ memcpy(stroke->points, pt_tmp, sizeof(bGPDspoint) * index);
+ /* verify weight data is available */
+ if (pt_dvert != NULL) {
+ memcpy(stroke->dvert, pt_dvert, sizeof(MDeformVert) * index);
+ }
+ }
+
+ if (index < stroke->totpoints) {
+ memcpy(&stroke->points[index],
+ &pt_tmp[index + 1],
+ sizeof(bGPDspoint) * (stroke->totpoints - index));
+ if (pt_dvert != NULL) {
+ memcpy(&stroke->dvert[index],
+ &pt_dvert[index + 1],
+ sizeof(MDeformVert) * (stroke->totpoints - index));
+ }
+ }
+
+ /* free temp buffer */
+ MEM_freeN(pt_tmp);
+ if (pt_dvert != NULL) {
+ MEM_freeN(pt_dvert);
+ }
+
+ stroke->flag |= GP_STROKE_RECALC_GEOMETRY;
+
+ gpd->flag |= GP_DATA_PYTHON_UPDATED;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
+
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame)
{
- bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
- BLI_addtail(&frame->strokes, stroke);
+ bGPDstroke *stroke = MEM_callocN(sizeof(bGPDstroke), "gp_stroke");
+ BLI_addtail(&frame->strokes, stroke);
- return stroke;
+ return stroke;
}
-static void rna_GPencil_stroke_remove(bGPDframe *frame, ReportList *reports, PointerRNA *stroke_ptr)
+static void rna_GPencil_stroke_remove(bGPDframe *frame,
+ ReportList *reports,
+ PointerRNA *stroke_ptr)
{
- bGPDstroke *stroke = stroke_ptr->data;
- if (BLI_findindex(&frame->strokes, stroke) == -1) {
- BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame");
- return;
- }
+ bGPDstroke *stroke = stroke_ptr->data;
+ if (BLI_findindex(&frame->strokes, stroke) == -1) {
+ BKE_report(reports, RPT_ERROR, "Stroke not found in grease pencil frame");
+ return;
+ }
- BLI_freelinkN(&frame->strokes, stroke);
- RNA_POINTER_INVALIDATE(stroke_ptr);
+ BLI_freelinkN(&frame->strokes, stroke);
+ RNA_POINTER_INVALIDATE(stroke_ptr);
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
static void rna_GPencil_stroke_select_set(PointerRNA *ptr, const bool value)
{
- bGPDstroke *gps = ptr->data;
- bGPDspoint *pt;
- int i;
-
- /* set new value */
- if (value)
- gps->flag |= GP_STROKE_SELECT;
- else
- gps->flag &= ~GP_STROKE_SELECT;
-
- /* ensure that the stroke's points are selected in the same way */
- for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
- if (value)
- pt->flag |= GP_SPOINT_SELECT;
- else
- pt->flag &= ~GP_SPOINT_SELECT;
- }
+ bGPDstroke *gps = ptr->data;
+ bGPDspoint *pt;
+ int i;
+
+ /* set new value */
+ if (value)
+ gps->flag |= GP_STROKE_SELECT;
+ else
+ gps->flag &= ~GP_STROKE_SELECT;
+
+ /* ensure that the stroke's points are selected in the same way */
+ for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
+ if (value)
+ pt->flag |= GP_SPOINT_SELECT;
+ else
+ pt->flag &= ~GP_SPOINT_SELECT;
+ }
}
static bGPDframe *rna_GPencil_frame_new(bGPDlayer *layer, ReportList *reports, int frame_number)
{
- bGPDframe *frame;
+ bGPDframe *frame;
- if (BKE_gpencil_layer_find_frame(layer, frame_number)) {
- BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number);
- return NULL;
- }
+ if (BKE_gpencil_layer_find_frame(layer, frame_number)) {
+ BKE_reportf(reports, RPT_ERROR, "Frame already exists on this frame number %d", frame_number);
+ return NULL;
+ }
- frame = BKE_gpencil_frame_addnew(layer, frame_number);
+ frame = BKE_gpencil_frame_addnew(layer, frame_number);
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
- return frame;
+ return frame;
}
static void rna_GPencil_frame_remove(bGPDlayer *layer, ReportList *reports, PointerRNA *frame_ptr)
{
- bGPDframe *frame = frame_ptr->data;
- if (BLI_findindex(&layer->frames, frame) == -1) {
- BKE_report(reports, RPT_ERROR, "Frame not found in grease pencil layer");
- return;
- }
+ bGPDframe *frame = frame_ptr->data;
+ if (BLI_findindex(&layer->frames, frame) == -1) {
+ BKE_report(reports, RPT_ERROR, "Frame not found in grease pencil layer");
+ return;
+ }
- BKE_gpencil_layer_delframe(layer, frame);
- RNA_POINTER_INVALIDATE(frame_ptr);
+ BKE_gpencil_layer_delframe(layer, frame);
+ RNA_POINTER_INVALIDATE(frame_ptr);
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
static bGPDframe *rna_GPencil_frame_copy(bGPDlayer *layer, bGPDframe *src)
{
- bGPDframe *frame = BKE_gpencil_frame_duplicate(src);
+ bGPDframe *frame = BKE_gpencil_frame_duplicate(src);
- while (BKE_gpencil_layer_find_frame(layer, frame->framenum)) {
- frame->framenum++;
- }
+ while (BKE_gpencil_layer_find_frame(layer, frame->framenum)) {
+ frame->framenum++;
+ }
- BLI_addtail(&layer->frames, frame);
+ BLI_addtail(&layer->frames, frame);
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
- return frame;
+ return frame;
}
static bGPDlayer *rna_GPencil_layer_new(bGPdata *gpd, const char *name, bool setactive)
{
- bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0);
+ bGPDlayer *gpl = BKE_gpencil_layer_addnew(gpd, name, setactive != 0);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
- return gpl;
+ return gpl;
}
static void rna_GPencil_layer_remove(bGPdata *gpd, ReportList *reports, PointerRNA *layer_ptr)
{
- bGPDlayer *layer = layer_ptr->data;
- if (BLI_findindex(&gpd->layers, layer) == -1) {
- BKE_report(reports, RPT_ERROR, "Layer not found in grease pencil data");
- return;
- }
+ bGPDlayer *layer = layer_ptr->data;
+ if (BLI_findindex(&gpd->layers, layer) == -1) {
+ BKE_report(reports, RPT_ERROR, "Layer not found in grease pencil data");
+ return;
+ }
- BKE_gpencil_layer_delete(gpd, layer);
- RNA_POINTER_INVALIDATE(layer_ptr);
+ BKE_gpencil_layer_delete(gpd, layer);
+ RNA_POINTER_INVALIDATE(layer_ptr);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
-static void rna_GPencil_layer_move(bGPdata *gpd, ReportList *reports, PointerRNA *layer_ptr, int type)
+static void rna_GPencil_layer_move(bGPdata *gpd,
+ ReportList *reports,
+ PointerRNA *layer_ptr,
+ int type)
{
- bGPDlayer *gpl = layer_ptr->data;
- if (BLI_findindex(&gpd->layers, gpl) == -1) {
- BKE_report(reports, RPT_ERROR, "Layer not found in grease pencil data");
- return;
- }
+ bGPDlayer *gpl = layer_ptr->data;
+ if (BLI_findindex(&gpd->layers, gpl) == -1) {
+ BKE_report(reports, RPT_ERROR, "Layer not found in grease pencil data");
+ return;
+ }
- BLI_assert(ELEM(type, -1, 0, 1)); /* we use value below */
+ BLI_assert(ELEM(type, -1, 0, 1)); /* we use value below */
- const int direction = type * -1;
+ const int direction = type * -1;
- if (BLI_listbase_link_move(&gpd->layers, gpl, direction)) {
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- }
+ if (BLI_listbase_link_move(&gpd->layers, gpl, direction)) {
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ }
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
static void rna_GPencil_frame_clear(bGPDframe *frame)
{
- BKE_gpencil_free_strokes(frame);
+ BKE_gpencil_free_strokes(frame);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
static void rna_GPencil_layer_clear(bGPDlayer *layer)
{
- BKE_gpencil_free_frames(layer);
+ BKE_gpencil_free_frames(layer);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
static void rna_GPencil_clear(bGPdata *gpd)
{
- BKE_gpencil_free_layers(&gpd->layers);
+ BKE_gpencil_free_layers(&gpd->layers);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
static void rna_GpencilVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- bGPDstroke *gps = ptr->data;
+ bGPDstroke *gps = ptr->data;
- if (gps->dvert) {
- MDeformVert *dvert = gps->dvert;
+ if (gps->dvert) {
+ MDeformVert *dvert = gps->dvert;
- rna_iterator_array_begin(iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
- }
- else
- rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
+ rna_iterator_array_begin(
+ iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
+ }
+ else
+ rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
static char *rna_GreasePencilGrid_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("grid");
+ return BLI_strdup("grid");
}
#else
static void rna_def_gpencil_stroke_point(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "GPencilStrokePoint", NULL);
- RNA_def_struct_sdna(srna, "bGPDspoint");
- RNA_def_struct_ui_text(srna, "Grease Pencil Stroke Point", "Data point for freehand stroke curve");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Coordinates", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pressure");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Pressure", "Pressure of tablet at point when drawing it");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "strength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Strength", "Color intensity (alpha factor)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "uv_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_fac");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "UV Factor", "Internal UV factor");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "uv_rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "uv_rot");
- RNA_def_property_range(prop, 0.0f, M_PI * 2);
- RNA_def_property_ui_text(prop, "UV Rotation", "Internal UV factor for dot mode");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SPOINT_SELECT);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_point_select_set");
- RNA_def_property_ui_text(prop, "Select", "Point is selected for viewport editing");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GPencilStrokePoint", NULL);
+ RNA_def_struct_sdna(srna, "bGPDspoint");
+ RNA_def_struct_ui_text(
+ srna, "Grease Pencil Stroke Point", "Data point for freehand stroke curve");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Coordinates", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pressure");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Pressure", "Pressure of tablet at point when drawing it");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "strength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Strength", "Color intensity (alpha factor)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "uv_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_fac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "UV Factor", "Internal UV factor");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "uv_rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "uv_rot");
+ RNA_def_property_range(prop, 0.0f, M_PI * 2);
+ RNA_def_property_ui_text(prop, "UV Rotation", "Internal UV factor for dot mode");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SPOINT_SELECT);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_point_select_set");
+ RNA_def_property_ui_text(prop, "Select", "Point is selected for viewport editing");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
}
static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "GPencilStrokePoints");
- srna = RNA_def_struct(brna, "GPencilStrokePoints", NULL);
- RNA_def_struct_sdna(srna, "bGPDstroke");
- RNA_def_struct_ui_text(srna, "Grease Pencil Stroke Points", "Collection of grease pencil stroke points");
-
- func = RNA_def_function(srna, "add", "rna_GPencil_stroke_point_add");
- RNA_def_function_ui_description(func, "Add a new grease pencil stroke point");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the stroke", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float(func, "pressure", 1.0f, 0.0f, 1.0f, "Pressure", "Pressure for newly created points", 0.0f, 1.0f);
- RNA_def_float(func, "strength", 1.0f, 0.0f, 1.0f, "Strength", "Color intensity (alpha factor) for newly created points", 0.0f, 1.0f);
-
- func = RNA_def_function(srna, "pop", "rna_GPencil_stroke_point_pop");
- RNA_def_function_ui_description(func, "Remove a grease pencil stroke point");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- RNA_def_int(func, "index", -1, INT_MIN, INT_MAX, "Index", "point index", INT_MIN, INT_MAX);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "GPencilStrokePoints");
+ srna = RNA_def_struct(brna, "GPencilStrokePoints", NULL);
+ RNA_def_struct_sdna(srna, "bGPDstroke");
+ RNA_def_struct_ui_text(
+ srna, "Grease Pencil Stroke Points", "Collection of grease pencil stroke points");
+
+ func = RNA_def_function(srna, "add", "rna_GPencil_stroke_point_add");
+ RNA_def_function_ui_description(func, "Add a new grease pencil stroke point");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_int(
+ func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the stroke", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_float(func,
+ "pressure",
+ 1.0f,
+ 0.0f,
+ 1.0f,
+ "Pressure",
+ "Pressure for newly created points",
+ 0.0f,
+ 1.0f);
+ RNA_def_float(func,
+ "strength",
+ 1.0f,
+ 0.0f,
+ 1.0f,
+ "Strength",
+ "Color intensity (alpha factor) for newly created points",
+ 0.0f,
+ 1.0f);
+
+ func = RNA_def_function(srna, "pop", "rna_GPencil_stroke_point_pop");
+ RNA_def_function_ui_description(func, "Remove a grease pencil stroke point");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ RNA_def_int(func, "index", -1, INT_MIN, INT_MAX, "Index", "point index", INT_MIN, INT_MAX);
}
/* This information is read only and it can be used by add-ons */
static void rna_def_gpencil_triangle(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "GPencilTriangle", NULL);
- RNA_def_struct_sdna(srna, "bGPDtriangle");
- RNA_def_struct_ui_text(srna, "Triangle", "Triangulation data for Grease Pencil fills");
-
- /* point v1 */
- prop = RNA_def_property(srna, "v1", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "verts[0]");
- RNA_def_property_ui_text(prop, "v1", "First triangle vertex index");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* point v2 */
- prop = RNA_def_property(srna, "v2", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "verts[1]");
- RNA_def_property_ui_text(prop, "v2", "Second triangle vertex index");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* point v3 */
- prop = RNA_def_property(srna, "v3", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "verts[2]");
- RNA_def_property_ui_text(prop, "v3", "Third triangle vertex index");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* texture coord for point v1 */
- prop = RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "uv[0]");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "uv1", "First triangle vertex texture coordinates");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* texture coord for point v2 */
- prop = RNA_def_property(srna, "uv2", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "uv[1]");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "uv2", "Second triangle vertex texture coordinates");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* texture coord for point v3 */
- prop = RNA_def_property(srna, "uv3", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "uv[2]");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "uv3", "Third triangle vertex texture coordinates");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GPencilTriangle", NULL);
+ RNA_def_struct_sdna(srna, "bGPDtriangle");
+ RNA_def_struct_ui_text(srna, "Triangle", "Triangulation data for Grease Pencil fills");
+
+ /* point v1 */
+ prop = RNA_def_property(srna, "v1", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "verts[0]");
+ RNA_def_property_ui_text(prop, "v1", "First triangle vertex index");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* point v2 */
+ prop = RNA_def_property(srna, "v2", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "verts[1]");
+ RNA_def_property_ui_text(prop, "v2", "Second triangle vertex index");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* point v3 */
+ prop = RNA_def_property(srna, "v3", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "verts[2]");
+ RNA_def_property_ui_text(prop, "v3", "Third triangle vertex index");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* texture coord for point v1 */
+ prop = RNA_def_property(srna, "uv1", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "uv[0]");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "uv1", "First triangle vertex texture coordinates");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* texture coord for point v2 */
+ prop = RNA_def_property(srna, "uv2", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "uv[1]");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "uv2", "Second triangle vertex texture coordinates");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* texture coord for point v3 */
+ prop = RNA_def_property(srna, "uv3", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "uv[2]");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "uv3", "Third triangle vertex texture coordinates");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_gpencil_mvert_group(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "GpencilVertexGroupElement", NULL);
- RNA_def_struct_sdna(srna, "MDeformWeight");
- RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
- RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
-
- /* we can't point to actual group, it is in the object and so
- * there is no unique group to point to, hence the index */
- prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "def_nr");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Group Index", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GpencilVertexGroupElement", NULL);
+ RNA_def_struct_sdna(srna, "MDeformWeight");
+ RNA_def_struct_ui_text(
+ srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
+
+ /* we can't point to actual group, it is in the object and so
+ * there is no unique group to point to, hence the index */
+ prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "def_nr");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Group Index", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
}
static void rna_def_gpencil_stroke(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem stroke_display_mode_items[] = {
- {0, "SCREEN", 0, "Screen", "Stroke is in screen-space"},
- {GP_STROKE_3DSPACE, "3DSPACE", 0, "3D Space", "Stroke is in 3D-space"},
- {GP_STROKE_2DSPACE, "2DSPACE", 0, "2D Space", "Stroke is in 2D-space"},
- {GP_STROKE_2DIMAGE, "2DIMAGE", 0, "2D Image", "Stroke is in 2D-space (but with special 'image' scaling)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "GPencilStroke", NULL);
- RNA_def_struct_sdna(srna, "bGPDstroke");
- RNA_def_struct_ui_text(srna, "Grease Pencil Stroke", "Freehand curve defining part of a sketch");
-
- /* Points */
- prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "points", "totpoints");
- RNA_def_property_struct_type(prop, "GPencilStrokePoint");
- RNA_def_property_ui_text(prop, "Stroke Points", "Stroke data points");
- rna_def_gpencil_stroke_points_api(brna, prop);
-
- /* vertex groups */
- prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(
- prop, "rna_GpencilVertex_groups_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "GpencilVertexGroupElement");
- RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of");
-
- /* Triangles */
- prop = RNA_def_property(srna, "triangles", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "triangles", "tot_triangles");
- RNA_def_property_struct_type(prop, "GPencilTriangle");
- RNA_def_property_ui_text(prop, "Triangles", "Triangulation data for HQ fill");
-
- /* Material Index */
- prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mat_nr");
- RNA_def_property_ui_text(prop, "Material Index", "Index of material used in this stroke");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Settings */
- prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, stroke_display_mode_items);
- RNA_def_property_ui_text(prop, "Draw Mode", "Coordinate space that stroke is in");
- RNA_def_property_update(prop, 0, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_SELECT);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_select_set");
- RNA_def_property_ui_text(prop, "Select", "Stroke is selected for viewport editing");
- RNA_def_property_update(prop, 0, "rna_GPencil_update");
-
- /* Cyclic: Draw a line from end to start point */
- prop = RNA_def_property(srna, "draw_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic", "Enable cyclic drawing, closing the stroke");
- RNA_def_property_update(prop, 0, "rna_GPencil_update");
-
- /* Caps mode */
- prop = RNA_def_property(srna, "start_cap_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "caps[0]");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
- RNA_def_property_ui_text(prop, "Start Cap", "Stroke start extreme cap style");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "end_cap_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "caps[1]");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
- RNA_def_property_ui_text(prop, "End Cap", "Stroke end extreme cap style");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* No fill: The stroke never must fill area and must use fill color as stroke color (this is a special flag for fill brush) */
- prop = RNA_def_property(srna, "is_nofill_stroke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_NOFILL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "No Fill", "Special stroke to use as boundary for filling areas");
- RNA_def_property_update(prop, 0, "rna_GPencil_update");
-
- /* Line Thickness */
- prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "thickness");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_range(prop, 1, 10, 1, 0);
- RNA_def_property_ui_text(prop, "Thickness", "Thickness of stroke (in pixels)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* gradient control along y */
- prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gradient_f");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Border Opacity Factor",
- "Amount of gradient along section of stroke");
- RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* gradient shape ratio */
- prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "gradient_s");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, 0.01f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Aspect Ratio", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem stroke_display_mode_items[] = {
+ {0, "SCREEN", 0, "Screen", "Stroke is in screen-space"},
+ {GP_STROKE_3DSPACE, "3DSPACE", 0, "3D Space", "Stroke is in 3D-space"},
+ {GP_STROKE_2DSPACE, "2DSPACE", 0, "2D Space", "Stroke is in 2D-space"},
+ {GP_STROKE_2DIMAGE,
+ "2DIMAGE",
+ 0,
+ "2D Image",
+ "Stroke is in 2D-space (but with special 'image' scaling)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "GPencilStroke", NULL);
+ RNA_def_struct_sdna(srna, "bGPDstroke");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Stroke", "Freehand curve defining part of a sketch");
+
+ /* Points */
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "points", "totpoints");
+ RNA_def_property_struct_type(prop, "GPencilStrokePoint");
+ RNA_def_property_ui_text(prop, "Stroke Points", "Stroke data points");
+ rna_def_gpencil_stroke_points_api(brna, prop);
+
+ /* vertex groups */
+ prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_GpencilVertex_groups_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "GpencilVertexGroupElement");
+ RNA_def_property_ui_text(
+ prop, "Groups", "Weights for the vertex groups this vertex is member of");
+
+ /* Triangles */
+ prop = RNA_def_property(srna, "triangles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "triangles", "tot_triangles");
+ RNA_def_property_struct_type(prop, "GPencilTriangle");
+ RNA_def_property_ui_text(prop, "Triangles", "Triangulation data for HQ fill");
+
+ /* Material Index */
+ prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mat_nr");
+ RNA_def_property_ui_text(prop, "Material Index", "Index of material used in this stroke");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Settings */
+ prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, stroke_display_mode_items);
+ RNA_def_property_ui_text(prop, "Draw Mode", "Coordinate space that stroke is in");
+ RNA_def_property_update(prop, 0, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_SELECT);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencil_stroke_select_set");
+ RNA_def_property_ui_text(prop, "Select", "Stroke is selected for viewport editing");
+ RNA_def_property_update(prop, 0, "rna_GPencil_update");
+
+ /* Cyclic: Draw a line from end to start point */
+ prop = RNA_def_property(srna, "draw_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_CYCLIC);
+ RNA_def_property_ui_text(prop, "Cyclic", "Enable cyclic drawing, closing the stroke");
+ RNA_def_property_update(prop, 0, "rna_GPencil_update");
+
+ /* Caps mode */
+ prop = RNA_def_property(srna, "start_cap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "caps[0]");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
+ RNA_def_property_ui_text(prop, "Start Cap", "Stroke start extreme cap style");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "end_cap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "caps[1]");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_caps_modes_items);
+ RNA_def_property_ui_text(prop, "End Cap", "Stroke end extreme cap style");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* No fill: The stroke never must fill area and must use fill color as stroke color (this is a special flag for fill brush) */
+ prop = RNA_def_property(srna, "is_nofill_stroke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STROKE_NOFILL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "No Fill", "Special stroke to use as boundary for filling areas");
+ RNA_def_property_update(prop, 0, "rna_GPencil_update");
+
+ /* Line Thickness */
+ prop = RNA_def_property(srna, "line_width", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "thickness");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 10, 1, 0);
+ RNA_def_property_ui_text(prop, "Thickness", "Thickness of stroke (in pixels)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* gradient control along y */
+ prop = RNA_def_property(srna, "gradient_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_f");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Border Opacity Factor", "Amount of gradient along section of stroke");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* gradient shape ratio */
+ prop = RNA_def_property(srna, "gradient_shape", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_s");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.01f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Aspect Ratio", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
}
static void rna_def_gpencil_strokes_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "GPencilStrokes");
- srna = RNA_def_struct(brna, "GPencilStrokes", NULL);
- RNA_def_struct_sdna(srna, "bGPDframe");
- RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of grease pencil stroke");
-
- func = RNA_def_function(srna, "new", "rna_GPencil_stroke_new");
- RNA_def_function_ui_description(func, "Add a new grease pencil stroke");
- parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "", "The newly created stroke");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_GPencil_stroke_remove");
- RNA_def_function_ui_description(func, "Remove a grease pencil stroke");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The stroke to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "GPencilStrokes");
+ srna = RNA_def_struct(brna, "GPencilStrokes", NULL);
+ RNA_def_struct_sdna(srna, "bGPDframe");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of grease pencil stroke");
+
+ func = RNA_def_function(srna, "new", "rna_GPencil_stroke_new");
+ RNA_def_function_ui_description(func, "Add a new grease pencil stroke");
+ parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "", "The newly created stroke");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_GPencil_stroke_remove");
+ RNA_def_function_ui_description(func, "Remove a grease pencil stroke");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "stroke", "GPencilStroke", "Stroke", "The stroke to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_gpencil_frame(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "GPencilFrame", NULL);
- RNA_def_struct_sdna(srna, "bGPDframe");
- RNA_def_struct_ui_text(srna, "Grease Pencil Frame", "Collection of related sketches on a particular frame");
-
- /* Strokes */
- prop = RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "strokes", NULL);
- RNA_def_property_struct_type(prop, "GPencilStroke");
- RNA_def_property_ui_text(prop, "Strokes", "Freehand curves defining the sketch on this frame");
- rna_def_gpencil_strokes_api(brna, prop);
-
- /* Frame Number */
- prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "framenum");
- /* XXX note: this cannot occur on the same frame as another sketch */
- RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
-
- /* Flags */
- prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_PAINT); /* XXX should it be editable? */
- RNA_def_property_ui_text(prop, "Paint Lock", "Frame is being edited (painted on)");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_SELECT);
- RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet");
-
-
- /* API */
- func = RNA_def_function(srna, "clear", "rna_GPencil_frame_clear");
- RNA_def_function_ui_description(func, "Remove all the grease pencil frame data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "GPencilFrame", NULL);
+ RNA_def_struct_sdna(srna, "bGPDframe");
+ RNA_def_struct_ui_text(
+ srna, "Grease Pencil Frame", "Collection of related sketches on a particular frame");
+
+ /* Strokes */
+ prop = RNA_def_property(srna, "strokes", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "strokes", NULL);
+ RNA_def_property_struct_type(prop, "GPencilStroke");
+ RNA_def_property_ui_text(prop, "Strokes", "Freehand curves defining the sketch on this frame");
+ rna_def_gpencil_strokes_api(brna, prop);
+
+ /* Frame Number */
+ prop = RNA_def_property(srna, "frame_number", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "framenum");
+ /* XXX note: this cannot occur on the same frame as another sketch */
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Frame Number", "The frame on which this sketch appears");
+
+ /* Flags */
+ prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "flag", GP_FRAME_PAINT); /* XXX should it be editable? */
+ RNA_def_property_ui_text(prop, "Paint Lock", "Frame is being edited (painted on)");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_FRAME_SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Frame is selected for editing in the Dope Sheet");
+
+ /* API */
+ func = RNA_def_function(srna, "clear", "rna_GPencil_frame_clear");
+ RNA_def_function_ui_description(func, "Remove all the grease pencil frame data");
}
static void rna_def_gpencil_frames_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "GPencilFrames");
- srna = RNA_def_struct(brna, "GPencilFrames", NULL);
- RNA_def_struct_sdna(srna, "bGPDlayer");
- RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of grease pencil frames");
-
- func = RNA_def_function(srna, "new", "rna_GPencil_frame_new");
- RNA_def_function_ui_description(func, "Add a new grease pencil frame");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(
- func, "frame_number", 1, MINAFRAME, MAXFRAME, "Frame Number",
- "The frame on which this sketch appears", MINAFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "frame", "GPencilFrame", "", "The newly created frame");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_GPencil_frame_remove");
- RNA_def_function_ui_description(func, "Remove a grease pencil frame");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "frame", "GPencilFrame", "Frame", "The frame to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "copy", "rna_GPencil_frame_copy");
- RNA_def_function_ui_description(func, "Copy a grease pencil frame");
- parm = RNA_def_pointer(func, "source", "GPencilFrame", "Source", "The source frame");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "copy", "GPencilFrame", "", "The newly copied frame");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "GPencilFrames");
+ srna = RNA_def_struct(brna, "GPencilFrames", NULL);
+ RNA_def_struct_sdna(srna, "bGPDlayer");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Frames", "Collection of grease pencil frames");
+
+ func = RNA_def_function(srna, "new", "rna_GPencil_frame_new");
+ RNA_def_function_ui_description(func, "Add a new grease pencil frame");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(func,
+ "frame_number",
+ 1,
+ MINAFRAME,
+ MAXFRAME,
+ "Frame Number",
+ "The frame on which this sketch appears",
+ MINAFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "frame", "GPencilFrame", "", "The newly created frame");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_GPencil_frame_remove");
+ RNA_def_function_ui_description(func, "Remove a grease pencil frame");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "frame", "GPencilFrame", "Frame", "The frame to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "copy", "rna_GPencil_frame_copy");
+ RNA_def_function_ui_description(func, "Copy a grease pencil frame");
+ parm = RNA_def_pointer(func, "source", "GPencilFrame", "Source", "The source frame");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "copy", "GPencilFrame", "", "The newly copied frame");
+ RNA_def_function_return(func, parm);
}
static void rna_def_gpencil_layer(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- static const float default_onion_color_b[] = { 0.302f, 0.851f, 0.302f };
- static const float default_onion_color_a[] = { 0.250f, 0.1f, 1.0f };
-
- srna = RNA_def_struct(brna, "GPencilLayer", NULL);
- RNA_def_struct_sdna(srna, "bGPDlayer");
- RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related sketches");
- RNA_def_struct_path_func(srna, "rna_GPencilLayer_path");
-
- /* Name */
- prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Info", "Layer name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, NULL);
-
- /* Frames */
- prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "frames", NULL);
- RNA_def_property_struct_type(prop, "GPencilFrame");
- RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
- rna_def_gpencil_frames_api(brna, prop);
-
- /* Active Frame */
- prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "actframe");
- RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
- RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
-
- /* Layer Opacity */
- prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "opacity");
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* layer channel color (grease pencil) */
- prop = RNA_def_property(srna, "channel_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Custom Channel Color",
- "Custom color for animation channel in Dopesheet");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Stroke Drawing Color (Annotations) */
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Line Thickness (Annotations) */
- prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "thickness");
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation strokes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Tint Color */
- prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "tintcolor");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Tint Color", "Color for tinting stroke colors");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Tint factor */
- prop = RNA_def_property(srna, "tint_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tintcolor[3]");
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Tint Factor", "Factor of tinting color");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Line Thickness Change */
- prop = RNA_def_property(srna, "line_change", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "line_change");
- RNA_def_property_range(prop, -300, 300);
- RNA_def_property_ui_range(prop, -100, 100, 1.0, 1);
- RNA_def_property_ui_text(prop, "Thickness Change", "Thickness change to apply to current strokes (in pixels)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
-
- /* Onion-Skinning */
- prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_LAYER_ONIONSKIN);
- RNA_def_property_ui_text(prop, "Onion Skinning", "Display onion skins before and after the current frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_annotation_onion_skinning", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_LAYER_ONIONSKIN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(
- prop, "Onion Skinning",
- "Display annotation onion skins before and after the current frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "annotation_onion_before_range", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gstep");
- RNA_def_property_range(prop, -1, 120);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(
- prop, "Frames Before",
- "Maximum number of frames to show before current frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "annotation_onion_after_range", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gstep_next");
- RNA_def_property_range(prop, -1, 120);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(
- prop, "Frames After",
- "Maximum number of frames to show after current frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "annotation_onion_before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gcolor_prev");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_onion_color_b);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "annotation_onion_after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gcolor_next");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_onion_color_a);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* pass index for compositing and modifiers */
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Layer Index\" pass");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "viewlayer_render", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "viewlayername");
- RNA_def_property_ui_text(
- prop, "ViewLayer",
- "Only include Layer in this View Layer render output (leave blank to include always)");
-
- /* blend mode */
- 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, rna_enum_layer_blend_modes_items);
- RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Flags */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
- RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "annotation_hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Hide", "Set annotation Visibility");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_ui_text(prop, "Locked", "Protect layer from further editing and/or frame changes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "lock_material", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_UNLOCK_COLOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Lock Material", "Disable Material editing");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "clamp_layer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_MASK);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(
- prop, "Clamp Layer",
- "Clamp any pixel outside underlying layers drawing");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* solo mode: Only display frames with keyframe */
- prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE);
- RNA_def_property_ui_text(
- prop, "Solo Mode",
- "In Paint mode display only layers with keyframe in current frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* exposed as layers.active */
-#if 0
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");
- RNA_def_property_ui_text(prop, "Active", "Set active layer for editing");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
-#endif
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ static const float default_onion_color_b[] = {0.302f, 0.851f, 0.302f};
+ static const float default_onion_color_a[] = {0.250f, 0.1f, 1.0f};
+
+ srna = RNA_def_struct(brna, "GPencilLayer", NULL);
+ RNA_def_struct_sdna(srna, "bGPDlayer");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Layer", "Collection of related sketches");
+ RNA_def_struct_path_func(srna, "rna_GPencilLayer_path");
+
+ /* Name */
+ prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Info", "Layer name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_info_set");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_RENAME, NULL);
+
+ /* Frames */
+ prop = RNA_def_property(srna, "frames", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "frames", NULL);
+ RNA_def_property_struct_type(prop, "GPencilFrame");
+ RNA_def_property_ui_text(prop, "Frames", "Sketches for this layer on different frames");
+ rna_def_gpencil_frames_api(brna, prop);
+
+ /* Active Frame */
+ prop = RNA_def_property(srna, "active_frame", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "actframe");
+ RNA_def_property_ui_text(prop, "Active Frame", "Frame currently being displayed for this layer");
+ RNA_def_property_editable_func(prop, "rna_GPencilLayer_active_frame_editable");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Layer Opacity */
+ prop = RNA_def_property(srna, "opacity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "opacity");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* layer channel color (grease pencil) */
+ prop = RNA_def_property(srna, "channel_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Custom Channel Color", "Custom color for animation channel in Dopesheet");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Stroke Drawing Color (Annotations) */
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Color", "Color for all strokes in this layer");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Line Thickness (Annotations) */
+ prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "thickness");
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Thickness", "Thickness of annotation strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Tint Color */
+ prop = RNA_def_property(srna, "tint_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "tintcolor");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Tint Color", "Color for tinting stroke colors");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Tint factor */
+ prop = RNA_def_property(srna, "tint_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tintcolor[3]");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Tint Factor", "Factor of tinting color");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Line Thickness Change */
+ prop = RNA_def_property(srna, "line_change", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "line_change");
+ RNA_def_property_range(prop, -300, 300);
+ RNA_def_property_ui_range(prop, -100, 100, 1.0, 1);
+ RNA_def_property_ui_text(
+ prop, "Thickness Change", "Thickness change to apply to current strokes (in pixels)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Onion-Skinning */
+ prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_LAYER_ONIONSKIN);
+ RNA_def_property_ui_text(
+ prop, "Onion Skinning", "Display onion skins before and after the current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_annotation_onion_skinning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_LAYER_ONIONSKIN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Onion Skinning", "Display annotation onion skins before and after the current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "annotation_onion_before_range", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gstep");
+ RNA_def_property_range(prop, -1, 120);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Frames Before", "Maximum number of frames to show before current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "annotation_onion_after_range", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gstep_next");
+ RNA_def_property_range(prop, -1, 120);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Frames After", "Maximum number of frames to show after current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "annotation_onion_before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gcolor_prev");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_onion_color_b);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "annotation_onion_after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gcolor_next");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_onion_color_a);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* pass index for compositing and modifiers */
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Layer Index\" pass");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "viewlayer_render", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "viewlayername");
+ RNA_def_property_ui_text(
+ prop,
+ "ViewLayer",
+ "Only include Layer in this View Layer render output (leave blank to include always)");
+
+ /* blend mode */
+ 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, rna_enum_layer_blend_modes_items);
+ RNA_def_property_ui_text(prop, "Blend Mode", "Blend mode");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Flags */
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_ui_text(prop, "Hide", "Set layer Visibility");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "annotation_hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_HIDE);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Hide", "Set annotation Visibility");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_LOCKED);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_ui_text(
+ prop, "Locked", "Protect layer from further editing and/or frame changes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "lock_frame", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_FRAMELOCK);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Frame Locked", "Lock current frame displayed by layer");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "lock_material", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_UNLOCK_COLOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Lock Material", "Disable Material editing");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "clamp_layer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_USE_MASK);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Clamp Layer", "Clamp any pixel outside underlying layers drawing");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* solo mode: Only display frames with keyframe */
+ prop = RNA_def_property(srna, "use_solo_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SOLO_MODE);
+ RNA_def_property_ui_text(
+ prop, "Solo Mode", "In Paint mode display only layers with keyframe in current frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* exposed as layers.active */
+# if 0
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_ACTIVE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_GPencilLayer_active_set");
+ RNA_def_property_ui_text(prop, "Active", "Set active layer for editing");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
+# endif
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG);
+ RNA_def_property_ui_text(
+ prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* In Front */
+ prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY);
+ RNA_def_property_ui_text(prop, "In Front", "Make the layer draw in front of objects");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Parent object */
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_GPencilLayer_parent_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(prop, "Parent", "Parent Object");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_SELECT);
- RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "show_points", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LAYER_DRAWDEBUG);
- RNA_def_property_ui_text(prop, "Show Points", "Draw the points which make up the strokes (for debugging purposes)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* In Front */
- prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_LAYER_NO_XRAY);
- RNA_def_property_ui_text(prop, "In Front", "Make the layer draw in front of objects");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Parent object */
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_GPencilLayer_parent_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Parent", "Parent Object");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* parent type */
- prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
- RNA_def_property_enum_items(prop, parent_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilLayer_parent_type_set", "rna_Object_parent_type_itemf");
- RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* parent bone */
- prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "parsubstr");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_parent_bone_set");
- RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* matrix */
- prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "inverse");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Inverse Matrix", "Parent inverse transformation matrix");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* read only parented flag */
- prop = RNA_def_property(srna, "is_parented", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_GPencilLayer_is_parented_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Parented", "True when the layer parent object is set");
-
- /* Layers API */
- func = RNA_def_function(srna, "clear", "rna_GPencil_layer_clear");
- RNA_def_function_ui_description(func, "Remove all the grease pencil layer data");
+ /* parent type */
+ prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
+ RNA_def_property_enum_items(prop, parent_type_items);
+ RNA_def_property_enum_funcs(
+ prop, NULL, "rna_GPencilLayer_parent_type_set", "rna_Object_parent_type_itemf");
+ RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* parent bone */
+ prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "parsubstr");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GPencilLayer_parent_bone_set");
+ RNA_def_property_ui_text(
+ prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* matrix */
+ prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "inverse");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Inverse Matrix", "Parent inverse transformation matrix");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* read only parented flag */
+ prop = RNA_def_property(srna, "is_parented", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_GPencilLayer_is_parented_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Parented", "True when the layer parent object is set");
+
+ /* Layers API */
+ func = RNA_def_function(srna, "clear", "rna_GPencil_layer_clear");
+ RNA_def_function_ui_description(func, "Remove all the grease pencil layer data");
}
static void rna_def_gpencil_layers_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "GreasePencilLayers");
- srna = RNA_def_struct(brna, "GreasePencilLayers", NULL);
- RNA_def_struct_sdna(srna, "bGPdata");
- RNA_def_struct_ui_text(srna, "Grease Pencil Layers", "Collection of grease pencil layers");
-
- func = RNA_def_function(srna, "new", "rna_GPencil_layer_new");
- RNA_def_function_ui_description(func, "Add a new grease pencil layer");
- parm = RNA_def_string(func, "name", "GPencilLayer", MAX_NAME, "Name", "Name of the layer");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "set_active", true, "Set Active", "Set the newly created layer to the active layer");
- parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The newly created layer");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_GPencil_layer_remove");
- RNA_def_function_ui_description(func, "Remove a grease pencil layer");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The layer to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "move", "rna_GPencil_layer_move");
- RNA_def_function_ui_description(func, "Move a grease pencil layer in the layer stack");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The layer to move");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- parm = RNA_def_enum(func, "type", rna_enum_gplayer_move_type_items, 1, "", "Direction of movement");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "GPencilLayer");
- RNA_def_property_pointer_funcs(prop, "rna_GPencil_active_layer_get", "rna_GPencil_active_layer_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Layer", "Active grease pencil layer");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(
- prop,
- "rna_GPencil_active_layer_index_get",
- "rna_GPencil_active_layer_index_set",
- "rna_GPencil_active_layer_index_range");
- RNA_def_property_ui_text(prop, "Active Layer Index", "Index of active grease pencil layer");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
-
- /* Active Layer - As an enum (for selecting active layer for annotations) */
- prop = RNA_def_property(srna, "active_note", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(
- prop,
- "rna_GPencil_active_layer_index_get",
- "rna_GPencil_active_layer_index_set",
- "rna_GPencil_active_layer_itemf");
- RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items); /* purely dynamic, as it maps to user-data */
- RNA_def_property_ui_text(prop, "Active Note", "Note/Layer to add annotation strokes to");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "GreasePencilLayers");
+ srna = RNA_def_struct(brna, "GreasePencilLayers", NULL);
+ RNA_def_struct_sdna(srna, "bGPdata");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Layers", "Collection of grease pencil layers");
+
+ func = RNA_def_function(srna, "new", "rna_GPencil_layer_new");
+ RNA_def_function_ui_description(func, "Add a new grease pencil layer");
+ parm = RNA_def_string(func, "name", "GPencilLayer", MAX_NAME, "Name", "Name of the layer");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(
+ func, "set_active", true, "Set Active", "Set the newly created layer to the active layer");
+ parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The newly created layer");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_GPencil_layer_remove");
+ RNA_def_function_ui_description(func, "Remove a grease pencil layer");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The layer to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "move", "rna_GPencil_layer_move");
+ RNA_def_function_ui_description(func, "Move a grease pencil layer in the layer stack");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "layer", "GPencilLayer", "", "The layer to move");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ parm = RNA_def_enum(
+ func, "type", rna_enum_gplayer_move_type_items, 1, "", "Direction of movement");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "GPencilLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_GPencil_active_layer_get", "rna_GPencil_active_layer_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Layer", "Active grease pencil layer");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_GPencil_active_layer_index_get",
+ "rna_GPencil_active_layer_index_set",
+ "rna_GPencil_active_layer_index_range");
+ RNA_def_property_ui_text(prop, "Active Layer Index", "Index of active grease pencil layer");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_SELECTED, NULL);
+
+ /* Active Layer - As an enum (for selecting active layer for annotations) */
+ prop = RNA_def_property(srna, "active_note", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop,
+ "rna_GPencil_active_layer_index_get",
+ "rna_GPencil_active_layer_index_set",
+ "rna_GPencil_active_layer_itemf");
+ RNA_def_property_enum_items(
+ prop, DummyRNA_DEFAULT_items); /* purely dynamic, as it maps to user-data */
+ RNA_def_property_ui_text(prop, "Active Note", "Note/Layer to add annotation strokes to");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
}
static void rna_def_gpencil_grid(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const float default_grid_color[] = { 0.5f, 0.5f, 0.5f };
-
- srna = RNA_def_struct(brna, "GreasePencilGrid", NULL);
- RNA_def_struct_sdna(srna, "bGPgrid");
- RNA_def_struct_nested(brna, srna, "GreasePencil");
-
- RNA_def_struct_path_func(srna, "rna_GreasePencilGrid_path");
- RNA_def_struct_ui_text(
- srna, "Grid and Canvas Settings",
- "Settings for grid and canvas in 3D viewport");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_range(prop, 0.01f, FLT_MAX);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Grid Scale", "Grid scale");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_grid_color);
- RNA_def_property_ui_text(prop, "Grid Color", "Color for grid lines");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "lines", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "lines");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_int_default(prop, GP_DEFAULT_GRID_LINES);
- RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions in each side of symmetry line");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Offset", "Offset of the canvas");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const float default_grid_color[] = {0.5f, 0.5f, 0.5f};
+
+ srna = RNA_def_struct(brna, "GreasePencilGrid", NULL);
+ RNA_def_struct_sdna(srna, "bGPgrid");
+ RNA_def_struct_nested(brna, srna, "GreasePencil");
+
+ RNA_def_struct_path_func(srna, "rna_GreasePencilGrid_path");
+ RNA_def_struct_ui_text(
+ srna, "Grid and Canvas Settings", "Settings for grid and canvas in 3D viewport");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_range(prop, 0.01f, FLT_MAX);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Grid Scale", "Grid scale");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_grid_color);
+ RNA_def_property_ui_text(prop, "Grid Color", "Color for grid lines");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "lines", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "lines");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_int_default(prop, GP_DEFAULT_GRID_LINES);
+ RNA_def_property_ui_text(
+ prop, "Grid Subdivisions", "Number of subdivisions in each side of symmetry line");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Offset", "Offset of the canvas");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
}
static void rna_def_gpencil_data(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
-
- static float default_1[4] = { 0.6f, 0.6f, 0.6f, 0.5f };
- static float onion_dft1[3] = { 0.145098f, 0.419608f, 0.137255f }; /* green */
- static float onion_dft2[3] = { 0.125490f, 0.082353f, 0.529412f }; /* blue */
-
- static const EnumPropertyItem stroke_thickness_items[] = {
- {0, "WORLDSPACE", 0, "World Space", "Set stroke thickness relative to the world space"},
- {GP_DATA_STROKE_KEEPTHICKNESS, "SCREENSPACE", 0, "Screen Space", "Set stroke thickness relative to the screen space"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "GreasePencil", "ID");
- RNA_def_struct_sdna(srna, "bGPdata");
- RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook");
- RNA_def_struct_ui_icon(srna, ICON_GREASEPENCIL);
-
- /* Layers */
- prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
- RNA_def_property_struct_type(prop, "GPencilLayer");
- RNA_def_property_ui_text(prop, "Layers", "");
- rna_def_gpencil_layers_api(brna, prop);
-
- /* Animation Data */
- rna_def_animdata_common(srna);
-
- /* materials */
- prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_ui_text(prop, "Materials", "");
- RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
-
- /* Depth */
- prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "draw_mode");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_stroke_depth_order_items);
- RNA_def_property_ui_text(
- prop, "Stroke Depth Order",
- "Defines how the strokes are ordered in 3D space");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Flags */
- prop = RNA_def_property(srna, "use_stroke_edit_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_EDITMODE);
- RNA_def_property_ui_text(prop, "Stroke Edit Mode", "Edit Grease Pencil strokes instead of viewport data");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
-
- prop = RNA_def_property(srna, "is_stroke_paint_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_PAINTMODE);
- RNA_def_property_ui_text(prop, "Stroke Paint Mode", "Draw Grease Pencil strokes on click/drag");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
-
- prop = RNA_def_property(srna, "is_stroke_sculpt_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_SCULPTMODE);
- RNA_def_property_ui_text(prop, "Stroke Sculpt Mode", "Sculpt Grease Pencil strokes instead of viewport data");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
-
- prop = RNA_def_property(srna, "is_stroke_weight_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_WEIGHTMODE);
- RNA_def_property_ui_text(prop, "Stroke Weight Paint Mode", "Grease Pencil weight paint");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
-
- prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_ONIONSKINS);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Onion Skins", "Show ghosts of the keyframes before and after the current frame");
- RNA_def_property_update(prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "show_stroke_direction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_DIRECTION);
- RNA_def_property_ui_text(prop, "Show Direction", "Show stroke drawing direction with a bigger green dot (start) "
- "and smaller red dot (end) points");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "stroke_thickness_space", PROP_ENUM, PROP_NONE); /* as an enum */
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, stroke_thickness_items);
- RNA_def_property_ui_text(prop, "Stroke Thickness", "Set stroke thickness in screen space or world space");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "pixel_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pixfactor");
- RNA_def_property_range(prop, 0.1f, 30.0f);
- RNA_def_property_ui_range(prop, 0.1f, 30.0f, 1, 2);
- RNA_def_property_ui_text(prop, "Scale", "Scale conversion factor for pixel size (use larger values for thicker lines)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_MULTIEDIT);
- RNA_def_property_ui_text(prop, "MultiFrame", "Edit strokes from multiple grease pencil keyframes at the same time (keyframes must be selected to be included)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_force_fill_recalc", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_FORCE_RECALC);
- RNA_def_property_ui_text(prop, "Force Fill Update", "Force recalc of fill data after use deformation modifiers (reduce FPS)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_adaptive_uv", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_UV_ADAPTIVE);
- RNA_def_property_ui_text(prop, "Adaptive UV", "Automatic UVs are calculated depending of the stroke size");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS);
- RNA_def_property_ui_text(
- prop, "Autolock Layers",
- "Lock automatically all layers except active one to avoid accidental changes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_autolock");
-
- prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "line_color");
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_ui_text(prop, "Edit Line Color", "Color for editing line");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* onion skinning */
- prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gstep");
- RNA_def_property_range(prop, 0, 120);
- RNA_def_property_int_default(prop, 1);
- RNA_def_property_ui_text(
- prop, "Frames Before",
- "Maximum number of frames to show before current frame "
- "(0 = don't show any frames before current)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "ghost_after_range", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gstep_next");
- RNA_def_property_range(prop, 0, 120);
- RNA_def_property_int_default(prop, 1);
- RNA_def_property_ui_text(
- prop, "Frames After",
- "Maximum number of frames to show after current frame "
- "(0 = don't show any frames after current)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL);
- RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gcolor_prev");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, onion_dft1);
- RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
- RNA_def_property_update(prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gcolor_next");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, onion_dft2);
- RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
- RNA_def_property_update(prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_ghosts_always", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_GHOST_ALWAYS);
- RNA_def_property_ui_text(
- prop, "Always Show Ghosts",
- "Ghosts are shown in renders and animation playback. Useful for special effects (e.g. motion blur)");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "onion_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "onion_mode");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_onion_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Mode to display frames");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_onion_fade", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_FADE);
- RNA_def_property_ui_text(
- prop, "Fade",
- "Display onion keyframes with a fade in color transparency");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_onion_loop", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_LOOP);
- RNA_def_property_ui_text(
- prop, "Loop",
- "Display first onion keyframes using next frame color to show indication of loop start frame");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "onion_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "onion_factor");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Onion Opacity", "Change fade opacity of displayed onion frames");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "zdepth_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zdepth_offset");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 5);
- RNA_def_property_ui_text(
- prop, "Surface Offset",
- "Offset amount when drawing in surface mode");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Nested Structs */
- prop = RNA_def_property(srna, "grid", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "GreasePencilGrid");
- RNA_def_property_ui_text(prop, "Grid Settings", "Settings for grid and canvas in the 3D viewport");
-
- rna_def_gpencil_grid(brna);
-
- /* API Functions */
- func = RNA_def_function(srna, "clear", "rna_GPencil_clear");
- RNA_def_function_ui_description(func, "Remove all the Grease Pencil data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+
+ static float default_1[4] = {0.6f, 0.6f, 0.6f, 0.5f};
+ static float onion_dft1[3] = {0.145098f, 0.419608f, 0.137255f}; /* green */
+ static float onion_dft2[3] = {0.125490f, 0.082353f, 0.529412f}; /* blue */
+
+ static const EnumPropertyItem stroke_thickness_items[] = {
+ {0, "WORLDSPACE", 0, "World Space", "Set stroke thickness relative to the world space"},
+ {GP_DATA_STROKE_KEEPTHICKNESS,
+ "SCREENSPACE",
+ 0,
+ "Screen Space",
+ "Set stroke thickness relative to the screen space"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "GreasePencil", "ID");
+ RNA_def_struct_sdna(srna, "bGPdata");
+ RNA_def_struct_ui_text(srna, "Grease Pencil", "Freehand annotation sketchbook");
+ RNA_def_struct_ui_icon(srna, ICON_GREASEPENCIL);
+
+ /* Layers */
+ prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "layers", NULL);
+ RNA_def_property_struct_type(prop, "GPencilLayer");
+ RNA_def_property_ui_text(prop, "Layers", "");
+ rna_def_gpencil_layers_api(brna, prop);
+
+ /* Animation Data */
+ rna_def_animdata_common(srna);
+
+ /* materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+
+ /* Depth */
+ prop = RNA_def_property(srna, "stroke_depth_order", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_mode");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_stroke_depth_order_items);
+ RNA_def_property_ui_text(
+ prop, "Stroke Depth Order", "Defines how the strokes are ordered in 3D space");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Flags */
+ prop = RNA_def_property(srna, "use_stroke_edit_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_EDITMODE);
+ RNA_def_property_ui_text(
+ prop, "Stroke Edit Mode", "Edit Grease Pencil strokes instead of viewport data");
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
+
+ prop = RNA_def_property(srna, "is_stroke_paint_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_PAINTMODE);
+ RNA_def_property_ui_text(prop, "Stroke Paint Mode", "Draw Grease Pencil strokes on click/drag");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
+
+ prop = RNA_def_property(srna, "is_stroke_sculpt_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_SCULPTMODE);
+ RNA_def_property_ui_text(
+ prop, "Stroke Sculpt Mode", "Sculpt Grease Pencil strokes instead of viewport data");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
+
+ prop = RNA_def_property(srna, "is_stroke_weight_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_WEIGHTMODE);
+ RNA_def_property_ui_text(prop, "Stroke Weight Paint Mode", "Grease Pencil weight paint");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(
+ prop, NC_GPENCIL | ND_DATA | ND_GPENCIL_EDITMODE, "rna_GPencil_editmode_update");
+
+ prop = RNA_def_property(srna, "use_onion_skinning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_ONIONSKINS);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(
+ prop, "Onion Skins", "Show ghosts of the keyframes before and after the current frame");
+ RNA_def_property_update(
+ prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "show_stroke_direction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_SHOW_DIRECTION);
+ RNA_def_property_ui_text(prop,
+ "Show Direction",
+ "Show stroke drawing direction with a bigger green dot (start) "
+ "and smaller red dot (end) points");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "stroke_thickness_space", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, stroke_thickness_items);
+ RNA_def_property_ui_text(
+ prop, "Stroke Thickness", "Set stroke thickness in screen space or world space");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "pixel_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pixfactor");
+ RNA_def_property_range(prop, 0.1f, 30.0f);
+ RNA_def_property_ui_range(prop, 0.1f, 30.0f, 1, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Scale",
+ "Scale conversion factor for pixel size (use larger values for thicker lines)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_multiedit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_MULTIEDIT);
+ RNA_def_property_ui_text(prop,
+ "MultiFrame",
+ "Edit strokes from multiple grease pencil keyframes at the same time "
+ "(keyframes must be selected to be included)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_force_fill_recalc", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_STROKE_FORCE_RECALC);
+ RNA_def_property_ui_text(
+ prop,
+ "Force Fill Update",
+ "Force recalc of fill data after use deformation modifiers (reduce FPS)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_adaptive_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_UV_ADAPTIVE);
+ RNA_def_property_ui_text(
+ prop, "Adaptive UV", "Automatic UVs are calculated depending of the stroke size");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_autolock_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_DATA_AUTOLOCK_LAYERS);
+ RNA_def_property_ui_text(
+ prop,
+ "Autolock Layers",
+ "Lock automatically all layers except active one to avoid accidental changes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_autolock");
+
+ prop = RNA_def_property(srna, "edit_line_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "line_color");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_text(prop, "Edit Line Color", "Color for editing line");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* onion skinning */
+ prop = RNA_def_property(srna, "ghost_before_range", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gstep");
+ RNA_def_property_range(prop, 0, 120);
+ RNA_def_property_int_default(prop, 1);
+ RNA_def_property_ui_text(prop,
+ "Frames Before",
+ "Maximum number of frames to show before current frame "
+ "(0 = don't show any frames before current)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "ghost_after_range", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gstep_next");
+ RNA_def_property_range(prop, 0, 120);
+ RNA_def_property_int_default(prop, 1);
+ RNA_def_property_ui_text(prop,
+ "Frames After",
+ "Maximum number of frames to show after current frame "
+ "(0 = don't show any frames after current)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_ghost_custom_colors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "onion_flag", GP_ONION_GHOST_PREVCOL | GP_ONION_GHOST_NEXTCOL);
+ RNA_def_property_ui_text(prop, "Use Custom Ghost Colors", "Use custom colors for ghost frames");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "before_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gcolor_prev");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, onion_dft1);
+ RNA_def_property_ui_text(prop, "Before Color", "Base color for ghosts before the active frame");
+ RNA_def_property_update(
+ prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "after_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gcolor_next");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, onion_dft2);
+ RNA_def_property_ui_text(prop, "After Color", "Base color for ghosts after the active frame");
+ RNA_def_property_update(
+ prop, NC_SCREEN | NC_SCENE | ND_TOOLSETTINGS | ND_DATA | NC_GPENCIL, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_ghosts_always", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_GHOST_ALWAYS);
+ RNA_def_property_ui_text(prop,
+ "Always Show Ghosts",
+ "Ghosts are shown in renders and animation playback. Useful for "
+ "special effects (e.g. motion blur)");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "onion_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "onion_mode");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_onion_modes_items);
+ RNA_def_property_ui_text(prop, "Mode", "Mode to display frames");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_onion_fade", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_FADE);
+ RNA_def_property_ui_text(
+ prop, "Fade", "Display onion keyframes with a fade in color transparency");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_onion_loop", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "onion_flag", GP_ONION_LOOP);
+ RNA_def_property_ui_text(prop,
+ "Loop",
+ "Display first onion keyframes using next frame color to show "
+ "indication of loop start frame");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "onion_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "onion_factor");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Onion Opacity", "Change fade opacity of displayed onion frames");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "zdepth_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zdepth_offset");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 5);
+ RNA_def_property_ui_text(prop, "Surface Offset", "Offset amount when drawing in surface mode");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Nested Structs */
+ prop = RNA_def_property(srna, "grid", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "GreasePencilGrid");
+ RNA_def_property_ui_text(
+ prop, "Grid Settings", "Settings for grid and canvas in the 3D viewport");
+
+ rna_def_gpencil_grid(brna);
+
+ /* API Functions */
+ func = RNA_def_function(srna, "clear", "rna_GPencil_clear");
+ RNA_def_function_ui_description(func, "Remove all the Grease Pencil data");
}
/* --- */
void RNA_def_gpencil(BlenderRNA *brna)
{
- rna_def_gpencil_data(brna);
+ rna_def_gpencil_data(brna);
- rna_def_gpencil_layer(brna);
- rna_def_gpencil_frame(brna);
+ rna_def_gpencil_layer(brna);
+ rna_def_gpencil_frame(brna);
- rna_def_gpencil_stroke(brna);
- rna_def_gpencil_stroke_point(brna);
- rna_def_gpencil_triangle(brna);
+ rna_def_gpencil_stroke(brna);
+ rna_def_gpencil_stroke_point(brna);
+ rna_def_gpencil_triangle(brna);
- rna_def_gpencil_mvert_group(brna);
+ rna_def_gpencil_mvert_group(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 23be3bb2980..076f0d8b85a 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <float.h>
#include <limits.h>
#include <stdlib.h>
@@ -56,169 +55,217 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = {
- {0, "", 0, N_("Generate"), "" },
- {eGpencilModifierType_Array, "GP_ARRAY", ICON_MOD_ARRAY, "Array", "Create array of duplicate instances"},
- {eGpencilModifierType_Build, "GP_BUILD", ICON_MOD_BUILD, "Build", "Create duplication of strokes"},
- {eGpencilModifierType_Mirror, "GP_MIRROR", ICON_MOD_MIRROR, "Mirror", "Duplicate strokes like a mirror"},
- {eGpencilModifierType_Simplify, "GP_SIMPLIFY", ICON_MOD_SIMPLIFY, "Simplify", "Simplify stroke reducing number of points"},
- {eGpencilModifierType_Subdiv, "GP_SUBDIV", ICON_MOD_SUBSURF, "Subdivide", "Subdivide stroke adding more control points"},
- {0, "", 0, N_("Deform"), "" },
- {eGpencilModifierType_Armature, "GP_ARMATURE", ICON_MOD_ARMATURE, "Armature", "Deform stroke points using armature object"},
- {eGpencilModifierType_Hook, "GP_HOOK", ICON_HOOK, "Hook", "Deform stroke points using objects"},
- {eGpencilModifierType_Lattice, "GP_LATTICE", ICON_MOD_LATTICE, "Lattice", "Deform strokes using lattice"},
- {eGpencilModifierType_Noise, "GP_NOISE", ICON_MOD_NOISE, "Noise", "Add noise to strokes"},
- {eGpencilModifierType_Offset, "GP_OFFSET", ICON_MOD_OFFSET, "Offset", "Change stroke location, rotation or scale"},
- {eGpencilModifierType_Smooth, "GP_SMOOTH", ICON_MOD_SMOOTH, "Smooth", "Smooth stroke"},
- {eGpencilModifierType_Thick, "GP_THICK", ICON_MOD_THICKNESS, "Thickness", "Change stroke thickness"},
- {eGpencilModifierType_Time, "GP_TIME", ICON_MOD_TIME, "Time Offset", "Offset keyframes"},
- {0, "", 0, N_("Color"), "" },
- {eGpencilModifierType_Color, "GP_COLOR", ICON_MOD_HUE_SATURATION, "Hue/Saturation", "Apply changes to stroke colors"},
- {eGpencilModifierType_Opacity, "GP_OPACITY", ICON_MOD_OPACITY, "Opacity", "Opacity of the strokes"},
- {eGpencilModifierType_Tint, "GP_TINT", ICON_MOD_TINT, "Tint", "Tint strokes with new color"},
- {0, NULL, 0, NULL, NULL},
+ {0, "", 0, N_("Generate"), ""},
+ {eGpencilModifierType_Array,
+ "GP_ARRAY",
+ ICON_MOD_ARRAY,
+ "Array",
+ "Create array of duplicate instances"},
+ {eGpencilModifierType_Build,
+ "GP_BUILD",
+ ICON_MOD_BUILD,
+ "Build",
+ "Create duplication of strokes"},
+ {eGpencilModifierType_Mirror,
+ "GP_MIRROR",
+ ICON_MOD_MIRROR,
+ "Mirror",
+ "Duplicate strokes like a mirror"},
+ {eGpencilModifierType_Simplify,
+ "GP_SIMPLIFY",
+ ICON_MOD_SIMPLIFY,
+ "Simplify",
+ "Simplify stroke reducing number of points"},
+ {eGpencilModifierType_Subdiv,
+ "GP_SUBDIV",
+ ICON_MOD_SUBSURF,
+ "Subdivide",
+ "Subdivide stroke adding more control points"},
+ {0, "", 0, N_("Deform"), ""},
+ {eGpencilModifierType_Armature,
+ "GP_ARMATURE",
+ ICON_MOD_ARMATURE,
+ "Armature",
+ "Deform stroke points using armature object"},
+ {eGpencilModifierType_Hook,
+ "GP_HOOK",
+ ICON_HOOK,
+ "Hook",
+ "Deform stroke points using objects"},
+ {eGpencilModifierType_Lattice,
+ "GP_LATTICE",
+ ICON_MOD_LATTICE,
+ "Lattice",
+ "Deform strokes using lattice"},
+ {eGpencilModifierType_Noise, "GP_NOISE", ICON_MOD_NOISE, "Noise", "Add noise to strokes"},
+ {eGpencilModifierType_Offset,
+ "GP_OFFSET",
+ ICON_MOD_OFFSET,
+ "Offset",
+ "Change stroke location, rotation or scale"},
+ {eGpencilModifierType_Smooth, "GP_SMOOTH", ICON_MOD_SMOOTH, "Smooth", "Smooth stroke"},
+ {eGpencilModifierType_Thick,
+ "GP_THICK",
+ ICON_MOD_THICKNESS,
+ "Thickness",
+ "Change stroke thickness"},
+ {eGpencilModifierType_Time, "GP_TIME", ICON_MOD_TIME, "Time Offset", "Offset keyframes"},
+ {0, "", 0, N_("Color"), ""},
+ {eGpencilModifierType_Color,
+ "GP_COLOR",
+ ICON_MOD_HUE_SATURATION,
+ "Hue/Saturation",
+ "Apply changes to stroke colors"},
+ {eGpencilModifierType_Opacity,
+ "GP_OPACITY",
+ ICON_MOD_OPACITY,
+ "Opacity",
+ "Opacity of the strokes"},
+ {eGpencilModifierType_Tint, "GP_TINT", ICON_MOD_TINT, "Tint", "Tint strokes with new color"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem modifier_modify_color_items[] = {
- {GP_MODIFY_COLOR_BOTH, "BOTH", 0, "Both", "Modify fill and stroke colors"},
- {GP_MODIFY_COLOR_STROKE, "STROKE", 0, "Stroke", "Modify stroke color only"},
- {GP_MODIFY_COLOR_FILL, "FILL", 0, "Fill", "Modify fill color only"},
- {0, NULL, 0, NULL, NULL},
+ {GP_MODIFY_COLOR_BOTH, "BOTH", 0, "Both", "Modify fill and stroke colors"},
+ {GP_MODIFY_COLOR_STROKE, "STROKE", 0, "Stroke", "Modify stroke color only"},
+ {GP_MODIFY_COLOR_FILL, "FILL", 0, "Fill", "Modify fill color only"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem modifier_gphook_falloff_items[] = {
- {eGPHook_Falloff_None, "NONE", 0, "No Falloff", ""},
- {eGPHook_Falloff_Curve, "CURVE", 0, "Curve", ""},
- {eGPHook_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
- {eGPHook_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
- {eGPHook_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
- {eGPHook_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", ""},
- {eGPHook_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
- {eGPHook_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
- {eGPHook_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
- {0, NULL, 0, NULL, NULL},
+ {eGPHook_Falloff_None, "NONE", 0, "No Falloff", ""},
+ {eGPHook_Falloff_Curve, "CURVE", 0, "Curve", ""},
+ {eGPHook_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
+ {eGPHook_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
+ {eGPHook_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
+ {eGPHook_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", ""},
+ {eGPHook_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
+ {eGPHook_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
+ {eGPHook_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_time_mode_items[] = {
- {GP_TIME_MODE_NORMAL, "NORMAL", 0, "Regular", "Apply offset in usual animation direction"},
- {GP_TIME_MODE_REVERSE, "REVERSE", 0, "Reverse", "Apply offset in reverse animation direction"},
- {GP_TIME_MODE_FIX, "FIX", 0, "Fixed Frame", "Keep frame and do not change with time"},
- {0, NULL, 0, NULL, NULL},
+ {GP_TIME_MODE_NORMAL, "NORMAL", 0, "Regular", "Apply offset in usual animation direction"},
+ {GP_TIME_MODE_REVERSE, "REVERSE", 0, "Reverse", "Apply offset in reverse animation direction"},
+ {GP_TIME_MODE_FIX, "FIX", 0, "Fixed Frame", "Keep frame and do not change with time"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#include "DNA_particle_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_smoke_types.h"
+# include "DNA_particle_types.h"
+# include "DNA_curve_types.h"
+# include "DNA_smoke_types.h"
-#include "BKE_cachefile.h"
-#include "BKE_context.h"
-#include "BKE_gpencil_modifier.h"
-#include "BKE_object.h"
-#include "BKE_gpencil.h"
+# include "BKE_cachefile.h"
+# include "BKE_context.h"
+# include "BKE_gpencil_modifier.h"
+# include "BKE_object.h"
+# include "BKE_gpencil.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static StructRNA *rna_GpencilModifier_refine(struct PointerRNA *ptr)
{
- GpencilModifierData *md = (GpencilModifierData *)ptr->data;
-
- switch ((GpencilModifierType)md->type) {
- case eGpencilModifierType_Noise:
- return &RNA_NoiseGpencilModifier;
- case eGpencilModifierType_Subdiv:
- return &RNA_SubdivGpencilModifier;
- case eGpencilModifierType_Simplify:
- return &RNA_SimplifyGpencilModifier;
- case eGpencilModifierType_Thick:
- return &RNA_ThickGpencilModifier;
- case eGpencilModifierType_Tint:
- return &RNA_TintGpencilModifier;
- case eGpencilModifierType_Time:
- return &RNA_TimeGpencilModifier;
- case eGpencilModifierType_Color:
- return &RNA_ColorGpencilModifier;
- case eGpencilModifierType_Array:
- return &RNA_ArrayGpencilModifier;
- case eGpencilModifierType_Build:
- return &RNA_BuildGpencilModifier;
- case eGpencilModifierType_Opacity:
- return &RNA_OpacityGpencilModifier;
- case eGpencilModifierType_Lattice:
- return &RNA_LatticeGpencilModifier;
- case eGpencilModifierType_Mirror:
- return &RNA_MirrorGpencilModifier;
- case eGpencilModifierType_Smooth:
- return &RNA_SmoothGpencilModifier;
- case eGpencilModifierType_Hook:
- return &RNA_HookGpencilModifier;
- case eGpencilModifierType_Offset:
- return &RNA_OffsetGpencilModifier;
- case eGpencilModifierType_Armature:
- return &RNA_ArmatureGpencilModifier;
- /* Default */
- case eGpencilModifierType_None:
- case NUM_GREASEPENCIL_MODIFIER_TYPES:
- return &RNA_GpencilModifier;
- }
-
- return &RNA_GpencilModifier;
+ GpencilModifierData *md = (GpencilModifierData *)ptr->data;
+
+ switch ((GpencilModifierType)md->type) {
+ case eGpencilModifierType_Noise:
+ return &RNA_NoiseGpencilModifier;
+ case eGpencilModifierType_Subdiv:
+ return &RNA_SubdivGpencilModifier;
+ case eGpencilModifierType_Simplify:
+ return &RNA_SimplifyGpencilModifier;
+ case eGpencilModifierType_Thick:
+ return &RNA_ThickGpencilModifier;
+ case eGpencilModifierType_Tint:
+ return &RNA_TintGpencilModifier;
+ case eGpencilModifierType_Time:
+ return &RNA_TimeGpencilModifier;
+ case eGpencilModifierType_Color:
+ return &RNA_ColorGpencilModifier;
+ case eGpencilModifierType_Array:
+ return &RNA_ArrayGpencilModifier;
+ case eGpencilModifierType_Build:
+ return &RNA_BuildGpencilModifier;
+ case eGpencilModifierType_Opacity:
+ return &RNA_OpacityGpencilModifier;
+ case eGpencilModifierType_Lattice:
+ return &RNA_LatticeGpencilModifier;
+ case eGpencilModifierType_Mirror:
+ return &RNA_MirrorGpencilModifier;
+ case eGpencilModifierType_Smooth:
+ return &RNA_SmoothGpencilModifier;
+ case eGpencilModifierType_Hook:
+ return &RNA_HookGpencilModifier;
+ case eGpencilModifierType_Offset:
+ return &RNA_OffsetGpencilModifier;
+ case eGpencilModifierType_Armature:
+ return &RNA_ArmatureGpencilModifier;
+ /* Default */
+ case eGpencilModifierType_None:
+ case NUM_GREASEPENCIL_MODIFIER_TYPES:
+ return &RNA_GpencilModifier;
+ }
+
+ return &RNA_GpencilModifier;
}
static void rna_GpencilModifier_name_set(PointerRNA *ptr, const char *value)
{
- GpencilModifierData *gmd = ptr->data;
- char oldname[sizeof(gmd->name)];
+ GpencilModifierData *gmd = ptr->data;
+ char oldname[sizeof(gmd->name)];
- /* make a copy of the old name first */
- BLI_strncpy(oldname, gmd->name, sizeof(gmd->name));
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, gmd->name, sizeof(gmd->name));
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(gmd->name, value, sizeof(gmd->name));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(gmd->name, value, sizeof(gmd->name));
- /* make sure the name is truly unique */
- if (ptr->id.data) {
- Object *ob = ptr->id.data;
- BKE_gpencil_modifier_unique_name(&ob->greasepencil_modifiers, gmd);
- }
+ /* make sure the name is truly unique */
+ if (ptr->id.data) {
+ Object *ob = ptr->id.data;
+ BKE_gpencil_modifier_unique_name(&ob->greasepencil_modifiers, gmd);
+ }
- /* fix all the animation data which may link to this */
- BKE_animdata_fix_paths_rename_all(NULL, "grease_pencil_modifiers", oldname, gmd->name);
+ /* fix all the animation data which may link to this */
+ BKE_animdata_fix_paths_rename_all(NULL, "grease_pencil_modifiers", oldname, gmd->name);
}
static char *rna_GpencilModifier_path(PointerRNA *ptr)
{
- GpencilModifierData *gmd = ptr->data;
- char name_esc[sizeof(gmd->name) * 2];
+ GpencilModifierData *gmd = ptr->data;
+ char name_esc[sizeof(gmd->name) * 2];
- BLI_strescape(name_esc, gmd->name, sizeof(name_esc));
- return BLI_sprintfN("grease_pencil_modifiers[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, gmd->name, sizeof(name_esc));
+ return BLI_sprintfN("grease_pencil_modifiers[\"%s\"]", name_esc);
}
static void rna_GpencilModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
}
static void rna_GpencilModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_GpencilModifier_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
+ rna_GpencilModifier_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
}
/* Vertex Groups */
-#define RNA_GP_MOD_VGROUP_NAME_SET(_type, _prop) \
-static void rna_##_type##GpencilModifier_##_prop##_set(PointerRNA *ptr, const char *value) \
-{ \
- _type##GpencilModifierData *tmd = (_type##GpencilModifierData *)ptr->data; \
- rna_object_vgroup_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
-}
+# define RNA_GP_MOD_VGROUP_NAME_SET(_type, _prop) \
+ static void rna_##_type##GpencilModifier_##_prop##_set(PointerRNA *ptr, const char *value) \
+ { \
+ _type##GpencilModifierData *tmd = (_type##GpencilModifierData *)ptr->data; \
+ rna_object_vgroup_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
+ }
RNA_GP_MOD_VGROUP_NAME_SET(Noise, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Thick, vgname);
@@ -229,1427 +276,1487 @@ RNA_GP_MOD_VGROUP_NAME_SET(Hook, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Offset, vgname);
RNA_GP_MOD_VGROUP_NAME_SET(Armature, vgname);
-#undef RNA_GP_MOD_VGROUP_NAME_SET
+# undef RNA_GP_MOD_VGROUP_NAME_SET
/* Objects */
-static void greasepencil_modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
+static void greasepencil_modifier_object_set(Object *self,
+ Object **ob_p,
+ int type,
+ PointerRNA value)
{
- Object *ob = value.data;
-
- if (!self || ob != self) {
- if (!ob || type == OB_EMPTY || ob->type == type) {
- id_lib_extern((ID *)ob);
- *ob_p = ob;
- }
- }
+ Object *ob = value.data;
+
+ if (!self || ob != self) {
+ if (!ob || type == OB_EMPTY || ob->type == type) {
+ id_lib_extern((ID *)ob);
+ *ob_p = ob;
+ }
+ }
}
-#define RNA_GP_MOD_OBJECT_SET(_type, _prop, _obtype) \
-static void rna_##_type##GpencilModifier_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
-{ \
- _type##GpencilModifierData *tmd = (_type##GpencilModifierData *)ptr->data; \
- greasepencil_modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
-}
+# define RNA_GP_MOD_OBJECT_SET(_type, _prop, _obtype) \
+ static void rna_##_type##GpencilModifier_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
+ { \
+ _type##GpencilModifierData *tmd = (_type##GpencilModifierData *)ptr->data; \
+ greasepencil_modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
+ }
RNA_GP_MOD_OBJECT_SET(Armature, object, OB_ARMATURE);
RNA_GP_MOD_OBJECT_SET(Lattice, object, OB_LATTICE);
RNA_GP_MOD_OBJECT_SET(Mirror, object, OB_EMPTY);
-#undef RNA_GP_MOD_OBJECT_SET
+# undef RNA_GP_MOD_OBJECT_SET
static void rna_HookGpencilModifier_object_set(PointerRNA *ptr, PointerRNA value)
{
- HookGpencilModifierData *hmd = ptr->data;
- Object *ob = (Object *)value.data;
+ HookGpencilModifierData *hmd = ptr->data;
+ Object *ob = (Object *)value.data;
- hmd->object = ob;
- id_lib_extern((ID *)ob);
- BKE_object_modifier_gpencil_hook_reset(ob, hmd);
+ hmd->object = ob;
+ id_lib_extern((ID *)ob);
+ BKE_object_modifier_gpencil_hook_reset(ob, hmd);
}
static void rna_TimeModifier_start_frame_set(PointerRNA *ptr, int value)
{
- TimeGpencilModifierData *tmd = ptr->data;
- CLAMP(value, MINFRAME, MAXFRAME);
- tmd->sfra = value;
+ TimeGpencilModifierData *tmd = ptr->data;
+ CLAMP(value, MINFRAME, MAXFRAME);
+ tmd->sfra = value;
- if (tmd->sfra >= tmd->efra) {
- tmd->efra = MIN2(tmd->sfra, MAXFRAME);
- }
+ if (tmd->sfra >= tmd->efra) {
+ tmd->efra = MIN2(tmd->sfra, MAXFRAME);
+ }
}
static void rna_TimeModifier_end_frame_set(PointerRNA *ptr, int value)
{
- TimeGpencilModifierData *tmd = ptr->data;
- CLAMP(value, MINFRAME, MAXFRAME);
- tmd->efra = value;
+ TimeGpencilModifierData *tmd = ptr->data;
+ CLAMP(value, MINFRAME, MAXFRAME);
+ tmd->efra = value;
- if (tmd->sfra >= tmd->efra) {
- tmd->sfra = MAX2(tmd->efra, MINFRAME);
- }
+ if (tmd->sfra >= tmd->efra) {
+ tmd->sfra = MAX2(tmd->efra, MINFRAME);
+ }
}
#else
static void rna_def_modifier_gpencilnoise(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "NoiseGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Noise Modifier", "Noise effect modifier");
- RNA_def_struct_sdna(srna, "NoiseGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_NOISE);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NoiseGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_range(prop, 0, 30.0);
- RNA_def_property_ui_text(prop, "Factor", "Amount of noise to apply");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "random", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_USE_RANDOM);
- RNA_def_property_ui_text(prop, "Random", "Use random values");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_LOCATION);
- RNA_def_property_ui_text(prop, "Affect Position", "The modifier affects the position of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_STRENGTH);
- RNA_def_property_ui_text(prop, "Affect Strength", "The modifier affects the color strength of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_thickness", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_THICKNESS);
- RNA_def_property_ui_text(prop, "Affect Thickness", "The modifier affects the thickness of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_uv", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_UV);
- RNA_def_property_ui_text(prop, "Affect UV", "The modifier affects the UV rotation factor of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "full_stroke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_FULL_STROKE);
- RNA_def_property_ui_text(prop, "Full Stroke", "The noise moves the stroke as a whole, not point by point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "move_extreme", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOVE_EXTREME);
- RNA_def_property_ui_text(prop, "Move Extremes", "The noise moves the stroke extreme points");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "step");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Step", "Number of frames before recalculate random values again");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "NoiseGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Noise Modifier", "Noise effect modifier");
+ RNA_def_struct_sdna(srna, "NoiseGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_NOISE);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NoiseGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, 0, 30.0);
+ RNA_def_property_ui_text(prop, "Factor", "Amount of noise to apply");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_USE_RANDOM);
+ RNA_def_property_ui_text(prop, "Random", "Use random values");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_LOCATION);
+ RNA_def_property_ui_text(
+ prop, "Affect Position", "The modifier affects the position of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_STRENGTH);
+ RNA_def_property_ui_text(
+ prop, "Affect Strength", "The modifier affects the color strength of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_thickness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_THICKNESS);
+ RNA_def_property_ui_text(
+ prop, "Affect Thickness", "The modifier affects the thickness of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOD_UV);
+ RNA_def_property_ui_text(
+ prop, "Affect UV", "The modifier affects the UV rotation factor of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "full_stroke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_FULL_STROKE);
+ RNA_def_property_ui_text(
+ prop, "Full Stroke", "The noise moves the stroke as a whole, not point by point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "move_extreme", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_MOVE_EXTREME);
+ RNA_def_property_ui_text(prop, "Move Extremes", "The noise moves the stroke extreme points");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(
+ prop, "Step", "Number of frames before recalculate random values again");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_NOISE_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilsmooth(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SmoothGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smooth effect modifier");
- RNA_def_struct_sdna(srna, "SmoothGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Factor", "Amount of smooth to apply");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_LOCATION);
- RNA_def_property_ui_text(prop, "Affect Position", "The modifier affects the position of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_STRENGTH);
- RNA_def_property_ui_text(prop, "Affect Strength", "The modifier affects the color strength of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_thickness", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_THICKNESS);
- RNA_def_property_ui_text(prop, "Affect Thickness", "The modifier affects the thickness of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_edit_uv", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_UV);
- RNA_def_property_ui_text(prop, "Affect UV", "The modifier affects the UV rotation factor of the point");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "step");
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_text(prop, "Step", "Number of times to apply smooth (high numbers can reduce fps)");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SmoothGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smooth effect modifier");
+ RNA_def_struct_sdna(srna, "SmoothGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Factor", "Amount of smooth to apply");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_LOCATION);
+ RNA_def_property_ui_text(
+ prop, "Affect Position", "The modifier affects the position of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_STRENGTH);
+ RNA_def_property_ui_text(
+ prop, "Affect Strength", "The modifier affects the color strength of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_thickness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_THICKNESS);
+ RNA_def_property_ui_text(
+ prop, "Affect Thickness", "The modifier affects the thickness of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_edit_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_MOD_UV);
+ RNA_def_property_ui_text(
+ prop, "Affect UV", "The modifier affects the UV rotation factor of the point");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(
+ prop, "Step", "Number of times to apply smooth (high numbers can reduce fps)");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SMOOTH_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilsubdiv(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SubdivGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Subdivision Modifier", "Subdivide Stroke modifier");
- RNA_def_struct_sdna(srna, "SubdivGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "level", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "level");
- RNA_def_property_range(prop, 0, 5);
- RNA_def_property_ui_text(prop, "Level", "Number of subdivisions");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "simple", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_SIMPLE);
- RNA_def_property_ui_text(prop, "Simple", "The modifier only add control points");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SubdivGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Subdivision Modifier", "Subdivide Stroke modifier");
+ RNA_def_struct_sdna(srna, "SubdivGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "level", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "level");
+ RNA_def_property_range(prop, 0, 5);
+ RNA_def_property_ui_text(prop, "Level", "Number of subdivisions");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "simple", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_SIMPLE);
+ RNA_def_property_ui_text(prop, "Simple", "The modifier only add control points");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SUBDIV_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem prop_gpencil_simplify_mode_items[] = {
- {GP_SIMPLIFY_FIXED, "FIXED", ICON_IPO_CONSTANT, "Fixed",
- "Delete alternative vertices in the stroke, except extremes"},
- {GP_SIMPLIFY_ADAPTIVE, "ADAPTIVE", ICON_IPO_EASE_IN_OUT, "Adaptive",
- "Use a RDP algorithm to simplify" },
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SimplifyGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Simplify Modifier", "Simplify Stroke modifier");
- RNA_def_struct_sdna(srna, "SimplifyGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLIFY);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_range(prop, 0, 100.0);
- RNA_def_property_ui_range(prop, 0, 100.0, 1.0f, 3);
- RNA_def_property_ui_text(prop, "Factor", "Factor of Simplify");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- /* Mode */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_gpencil_simplify_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "How simplify the stroke");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "step");
- RNA_def_property_range(prop, 1, 50);
- RNA_def_property_ui_text(prop, "Iterations", "Number of times to apply simplify");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem prop_gpencil_simplify_mode_items[] = {
+ {GP_SIMPLIFY_FIXED,
+ "FIXED",
+ ICON_IPO_CONSTANT,
+ "Fixed",
+ "Delete alternative vertices in the stroke, except extremes"},
+ {GP_SIMPLIFY_ADAPTIVE,
+ "ADAPTIVE",
+ ICON_IPO_EASE_IN_OUT,
+ "Adaptive",
+ "Use a RDP algorithm to simplify"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SimplifyGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Simplify Modifier", "Simplify Stroke modifier");
+ RNA_def_struct_sdna(srna, "SimplifyGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLIFY);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, 0, 100.0);
+ RNA_def_property_ui_range(prop, 0, 100.0, 1.0f, 3);
+ RNA_def_property_ui_text(prop, "Factor", "Factor of Simplify");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SIMPLIFY_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Mode */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_gpencil_simplify_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "How simplify the stroke");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, 50);
+ RNA_def_property_ui_text(prop, "Iterations", "Number of times to apply simplify");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilthick(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ThickGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Thick Modifier", "Subdivide and Smooth Stroke modifier");
- RNA_def_struct_sdna(srna, "ThickGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_THICKNESS);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ThickGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "thickness");
- RNA_def_property_range(prop, -100, 500);
- RNA_def_property_ui_text(prop, "Thickness", "Factor of thickness change");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_custom_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_CUSTOM_CURVE);
- RNA_def_property_ui_text(prop, "Custom Curve", "Use a custom curve to define thickness changes");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "normalize_thickness", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_NORMALIZE);
- RNA_def_property_ui_text(prop, "Normalize", "Normalize the full stroke to modifier thickness");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_thickness");
- RNA_def_property_ui_text(prop, "Curve", "Custom Thickness Curve");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ThickGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Thick Modifier", "Subdivide and Smooth Stroke modifier");
+ RNA_def_struct_sdna(srna, "ThickGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_THICKNESS);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ThickGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "thickness", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "thickness");
+ RNA_def_property_range(prop, -100, 500);
+ RNA_def_property_ui_text(prop, "Thickness", "Factor of thickness change");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_custom_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_CUSTOM_CURVE);
+ RNA_def_property_ui_text(prop, "Custom Curve", "Use a custom curve to define thickness changes");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "normalize_thickness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_NORMALIZE);
+ RNA_def_property_ui_text(prop, "Normalize", "Normalize the full stroke to modifier thickness");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_thickness");
+ RNA_def_property_ui_text(prop, "Curve", "Custom Thickness Curve");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpenciloffset(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "OffsetGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Offset Modifier", "Offset Stroke modifier");
- RNA_def_struct_sdna(srna, "OffsetGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_OFFSET);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_OffsetGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_ui_text(prop, "Location", "Values for change location");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Rotation", "Values for changes in rotation");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_ui_text(prop, "Scale", "Values for changes in scale");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "OffsetGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Offset Modifier", "Offset Stroke modifier");
+ RNA_def_struct_sdna(srna, "OffsetGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_OFFSET);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_OffsetGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OFFSET_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Location", "Values for change location");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "Values for changes in rotation");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(prop, "Scale", "Values for changes in scale");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpenciltint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TintGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Tint Modifier", "Tint Stroke Color modifier");
- RNA_def_struct_sdna(srna, "TintGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_COLOR);
-
- prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */
- RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "rgb");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Color used for tinting");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Factor", "Factor for mixing color");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "create_materials", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_CREATE_COLORS);
- RNA_def_property_ui_text(prop, "Create Materials", "When apply modifier, create new material");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TintGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Tint Modifier", "Tint Stroke Color modifier");
+ RNA_def_struct_sdna(srna, "TintGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_COLOR);
+
+ prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */
+ RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "rgb");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Color used for tinting");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Factor", "Factor for mixing color");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "create_materials", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_CREATE_COLORS);
+ RNA_def_property_ui_text(prop, "Create Materials", "When apply modifier, create new material");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TINT_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpenciltime(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TimeGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Time Offset Modifier", "Time offset modifier");
- RNA_def_struct_sdna(srna, "TimeGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_TIME);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_time_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, -INT_MAX, INT_MAX);
- RNA_def_property_ui_text(prop, "Frame Offset",
- "Number of frames to offset original keyframe number or frame to fix");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "frame_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frame_scale");
- RNA_def_property_range(prop, 0.001f, 100.0f);
- RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "sfra");
- RNA_def_property_int_funcs(prop, NULL, "rna_TimeModifier_start_frame_set", NULL);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_int_default(prop, 1);
- RNA_def_property_ui_text(prop, "Start Frame", "First frame of the range");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "efra");
- RNA_def_property_int_funcs(prop, NULL, "rna_TimeModifier_end_frame_set", NULL);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_int_default(prop, 250);
- RNA_def_property_ui_text(prop, "End Frame", "Final frame of the range");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_keep_loop", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_KEEP_LOOP);
- RNA_def_property_ui_text(prop, "Keep Loop",
- "Retiming end frames and move to start of animation to keep loop");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_custom_frame_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_CUSTOM_RANGE);
- RNA_def_property_ui_text(
- prop, "Custom Range",
- "Define a custom range of frames to use in modifier");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TimeGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Time Offset Modifier", "Time offset modifier");
+ RNA_def_struct_sdna(srna, "TimeGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_TIME);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_time_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, -INT_MAX, INT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Frame Offset", "Number of frames to offset original keyframe number or frame to fix");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "frame_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame_scale");
+ RNA_def_property_range(prop, 0.001f, 100.0f);
+ RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "sfra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_TimeModifier_start_frame_set", NULL);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_int_default(prop, 1);
+ RNA_def_property_ui_text(prop, "Start Frame", "First frame of the range");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "efra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_TimeModifier_end_frame_set", NULL);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_int_default(prop, 250);
+ RNA_def_property_ui_text(prop, "End Frame", "Final frame of the range");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_keep_loop", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_KEEP_LOOP);
+ RNA_def_property_ui_text(
+ prop, "Keep Loop", "Retiming end frames and move to start of animation to keep loop");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_custom_frame_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TIME_CUSTOM_RANGE);
+ RNA_def_property_ui_text(
+ prop, "Custom Range", "Define a custom range of frames to use in modifier");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilcolor(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ColorGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Hue/Saturation Modifier", "Change Hue/Saturation modifier");
- RNA_def_struct_sdna(srna, "ColorGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_TINT);
-
- prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */
- RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "hue", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 3);
- RNA_def_property_float_sdna(prop, NULL, "hsv[0]");
- RNA_def_property_ui_text(prop, "Hue", "Color Hue");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 3);
- RNA_def_property_float_sdna(prop, NULL, "hsv[1]");
- RNA_def_property_ui_text(prop, "Saturation", "Color Saturation");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 3);
- RNA_def_property_float_sdna(prop, NULL, "hsv[2]");
- RNA_def_property_ui_text(prop, "Value", "Color Value");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "create_materials", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_CREATE_COLORS);
- RNA_def_property_ui_text(prop, "Create Materials", "When apply modifier, create new material");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ColorGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Hue/Saturation Modifier", "Change Hue/Saturation modifier");
+ RNA_def_struct_sdna(srna, "ColorGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_TINT);
+
+ prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */
+ RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "hue", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "hsv[0]");
+ RNA_def_property_ui_text(prop, "Hue", "Color Hue");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "hsv[1]");
+ RNA_def_property_ui_text(prop, "Saturation", "Color Saturation");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_range(prop, 0.0, 2.0, 0.1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "hsv[2]");
+ RNA_def_property_ui_text(prop, "Value", "Color Value");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "create_materials", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_CREATE_COLORS);
+ RNA_def_property_ui_text(prop, "Create Materials", "When apply modifier, create new material");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_COLOR_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilopacity(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "OpacityGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Opacity Modifier", "Opacity of Strokes modifier");
- RNA_def_struct_sdna(srna, "OpacityGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_OPACITY);
-
- prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */
- RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_OpacityGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Factor", "Factor of Opacity");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "create_materials", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_CREATE_COLORS);
- RNA_def_property_ui_text(prop, "Create Materials", "When apply modifier, create new material");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "OpacityGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Opacity Modifier", "Opacity of Strokes modifier");
+ RNA_def_struct_sdna(srna, "OpacityGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_OPACITY);
+
+ prop = RNA_def_property(srna, "modify_color", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_modify_color_items); /* share the enum */
+ RNA_def_property_ui_text(prop, "Mode", "Set what colors of the stroke are affected");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_OpacityGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Factor", "Factor of Opacity");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "create_materials", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_CREATE_COLORS);
+ RNA_def_property_ui_text(prop, "Create Materials", "When apply modifier, create new material");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_OPACITY_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilinstance(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ArrayGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Instance Modifier", "Create grid of duplicate instances");
- RNA_def_struct_sdna(srna, "ArrayGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_ui_range(prop, 1, 50, 1, -1);
- RNA_def_property_ui_text(prop, "Count", "Number of items");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- /* Offset parameters */
- prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "object");
- RNA_def_property_ui_text(
- prop, "Object Offset",
- "Use the location and rotation of another object to determine the distance and "
- "rotational change between arrayed items");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset", "Value for the distance between items");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "shift");
- RNA_def_property_ui_text(prop, "Shift", "Shiftiness value");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Rotation", "Value for changes in rotation");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_ui_text(prop, "Scale", "Value for changes in scale");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "random_rot", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_RANDOM_ROT);
- RNA_def_property_ui_text(prop, "Random Rotation", "Use random factors for rotation");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "rot_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rnd_rot");
- RNA_def_property_ui_text(prop, "Rotation Factor", "Random factor for rotation");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "random_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_RANDOM_SIZE);
- RNA_def_property_ui_text(prop, "Random Scale", "Use random factors for scale");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "scale_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rnd_size");
- RNA_def_property_ui_text(prop, "Scale Factor", "Random factor for scale");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "replace_material", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mat_rpl");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Material", "Index of the material used for generated strokes (0 keep original material)");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "keep_on_top", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_KEEP_ONTOP);
- RNA_def_property_ui_text(
- prop, "Keep On Top",
- "Keep the original stroke in front of new instances (only affect by layer)");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ArrayGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Instance Modifier", "Create grid of duplicate instances");
+ RNA_def_struct_sdna(srna, "ArrayGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_range(prop, 1, 50, 1, -1);
+ RNA_def_property_ui_text(prop, "Count", "Number of items");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Offset parameters */
+ prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object");
+ RNA_def_property_ui_text(
+ prop,
+ "Object Offset",
+ "Use the location and rotation of another object to determine the distance and "
+ "rotational change between arrayed items");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "Value for the distance between items");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "shift");
+ RNA_def_property_ui_text(prop, "Shift", "Shiftiness value");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "Value for changes in rotation");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(prop, "Scale", "Value for changes in scale");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "random_rot", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_RANDOM_ROT);
+ RNA_def_property_ui_text(prop, "Random Rotation", "Use random factors for rotation");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "rot_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rnd_rot");
+ RNA_def_property_ui_text(prop, "Rotation Factor", "Random factor for rotation");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "random_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_RANDOM_SIZE);
+ RNA_def_property_ui_text(prop, "Random Scale", "Use random factors for scale");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "scale_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rnd_size");
+ RNA_def_property_ui_text(prop, "Scale Factor", "Random factor for scale");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "replace_material", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mat_rpl");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Material",
+ "Index of the material used for generated strokes (0 keep original material)");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "keep_on_top", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_ARRAY_KEEP_ONTOP);
+ RNA_def_property_ui_text(
+ prop,
+ "Keep On Top",
+ "Keep the original stroke in front of new instances (only affect by layer)");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilbuild(BlenderRNA *brna)
{
- static EnumPropertyItem prop_gpencil_build_mode_items[] = {
- {GP_BUILD_MODE_SEQUENTIAL, "SEQUENTIAL", ICON_PARTICLE_POINT, "Sequential",
- "Strokes appear/disappear one after the other, but only a single one changes at a time"},
- {GP_BUILD_MODE_CONCURRENT, "CONCURRENT", ICON_PARTICLE_TIP, "Concurrent",
- "Multiple strokes appear/disappear at once"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem prop_gpencil_build_transition_items[] = {
- {GP_BUILD_TRANSITION_GROW, "GROW", 0, "Grow",
- "Show points in the order they occur in each stroke "
- "(e.g. for animating lines being drawn)"},
- {GP_BUILD_TRANSITION_SHRINK, "SHRINK", 0, "Shrink",
- "Hide points from the end of each stroke to the start "
- "(e.g. for animating lines being erased)"},
- {GP_BUILD_TRANSITION_FADE, "FADE", 0, "Fade",
- "Hide points in the order they occur in each stroke "
- "(e.g. for animating ink fading or vanishing after getting drawn)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem prop_gpencil_build_time_align_items[] = {
- {GP_BUILD_TIMEALIGN_START, "START", 0, "Align Start",
- "All strokes start at same time (i.e. short strokes finish earlier)"},
- {GP_BUILD_TIMEALIGN_END, "END", 0, "Align End",
- "All strokes end at same time (i.e. short strokes start later)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BuildGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Build Modifier", "Animate strokes appearing and disappearing");
- RNA_def_struct_sdna(srna, "BuildGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
-
- /* Mode */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_gpencil_build_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "How many strokes are being animated at a time");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- /* Direction */
- prop = RNA_def_property(srna, "transition", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_gpencil_build_transition_items);
- RNA_def_property_ui_text(prop, "Transition", "How are strokes animated (i.e. are they appearing or disappearing)");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
-
- /* Transition Onset Delay + Length */
- prop = RNA_def_property(srna, "start_delay", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "start_delay");
- RNA_def_property_ui_text(prop, "Start Delay", "Number of frames after each GP keyframe before the modifier has any effect");
- RNA_def_property_range(prop, 0, MAXFRAMEF);
- RNA_def_property_ui_range(prop, 0, 200, 1, -1);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "length");
- RNA_def_property_ui_text(prop, "Length",
- "Maximum number of frames that the build effect can run for "
- "(unless another GP keyframe occurs before this time has elapsed)");
- RNA_def_property_range(prop, 1, MAXFRAMEF);
- RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
-
- /* Concurrent Mode Settings */
- prop = RNA_def_property(srna, "concurrent_time_alignment", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "time_alignment");
- RNA_def_property_enum_items(prop, prop_gpencil_build_time_align_items);
- RNA_def_property_ui_text(prop, "Time Alignment", "When should strokes start to appear/disappear");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
-
-
- /* Time Limits */
- prop = RNA_def_property(srna, "use_restrict_frame_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_RESTRICT_TIME);
- RNA_def_property_ui_text(prop, "Restrict Frame Range", "Only modify strokes during the specified frame range");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "start_frame");
- RNA_def_property_ui_text(prop, "Start Frame", "Start Frame (when Restrict Frame Range is enabled)");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "end_frame");
- RNA_def_property_ui_text(prop, "End Frame", "End Frame (when Restrict Frame Range is enabled)");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
-
- /* Filters - Layer */
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ static EnumPropertyItem prop_gpencil_build_mode_items[] = {
+ {GP_BUILD_MODE_SEQUENTIAL,
+ "SEQUENTIAL",
+ ICON_PARTICLE_POINT,
+ "Sequential",
+ "Strokes appear/disappear one after the other, but only a single one changes at a time"},
+ {GP_BUILD_MODE_CONCURRENT,
+ "CONCURRENT",
+ ICON_PARTICLE_TIP,
+ "Concurrent",
+ "Multiple strokes appear/disappear at once"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_gpencil_build_transition_items[] = {
+ {GP_BUILD_TRANSITION_GROW,
+ "GROW",
+ 0,
+ "Grow",
+ "Show points in the order they occur in each stroke "
+ "(e.g. for animating lines being drawn)"},
+ {GP_BUILD_TRANSITION_SHRINK,
+ "SHRINK",
+ 0,
+ "Shrink",
+ "Hide points from the end of each stroke to the start "
+ "(e.g. for animating lines being erased)"},
+ {GP_BUILD_TRANSITION_FADE,
+ "FADE",
+ 0,
+ "Fade",
+ "Hide points in the order they occur in each stroke "
+ "(e.g. for animating ink fading or vanishing after getting drawn)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_gpencil_build_time_align_items[] = {
+ {GP_BUILD_TIMEALIGN_START,
+ "START",
+ 0,
+ "Align Start",
+ "All strokes start at same time (i.e. short strokes finish earlier)"},
+ {GP_BUILD_TIMEALIGN_END,
+ "END",
+ 0,
+ "Align End",
+ "All strokes end at same time (i.e. short strokes start later)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BuildGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(srna, "Build Modifier", "Animate strokes appearing and disappearing");
+ RNA_def_struct_sdna(srna, "BuildGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
+
+ /* Mode */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_gpencil_build_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "How many strokes are being animated at a time");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Direction */
+ prop = RNA_def_property(srna, "transition", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_gpencil_build_transition_items);
+ RNA_def_property_ui_text(
+ prop, "Transition", "How are strokes animated (i.e. are they appearing or disappearing)");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Transition Onset Delay + Length */
+ prop = RNA_def_property(srna, "start_delay", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "start_delay");
+ RNA_def_property_ui_text(
+ prop,
+ "Start Delay",
+ "Number of frames after each GP keyframe before the modifier has any effect");
+ RNA_def_property_range(prop, 0, MAXFRAMEF);
+ RNA_def_property_ui_range(prop, 0, 200, 1, -1);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "length");
+ RNA_def_property_ui_text(prop,
+ "Length",
+ "Maximum number of frames that the build effect can run for "
+ "(unless another GP keyframe occurs before this time has elapsed)");
+ RNA_def_property_range(prop, 1, MAXFRAMEF);
+ RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Concurrent Mode Settings */
+ prop = RNA_def_property(srna, "concurrent_time_alignment", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "time_alignment");
+ RNA_def_property_enum_items(prop, prop_gpencil_build_time_align_items);
+ RNA_def_property_ui_text(
+ prop, "Time Alignment", "When should strokes start to appear/disappear");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Time Limits */
+ prop = RNA_def_property(srna, "use_restrict_frame_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_RESTRICT_TIME);
+ RNA_def_property_ui_text(
+ prop, "Restrict Frame Range", "Only modify strokes during the specified frame range");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "start_frame");
+ RNA_def_property_ui_text(
+ prop, "Start Frame", "Start Frame (when Restrict Frame Range is enabled)");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "end_frame");
+ RNA_def_property_ui_text(prop, "End Frame", "End Frame (when Restrict Frame Range is enabled)");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ /* Filters - Layer */
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_BUILD_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencillattice(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LatticeGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Lattice Modifier", "Change stroke using lattice to deform modifier");
- RNA_def_struct_sdna(srna, "LatticeGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeGpencilModifier_object_set", NULL, "rna_Lattice_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 10, 2);
- RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LatticeGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(
+ srna, "Lattice Modifier", "Change stroke using lattice to deform modifier");
+ RNA_def_struct_sdna(srna, "LatticeGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LATTICE_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_LatticeGpencilModifier_object_set", NULL, "rna_Lattice_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 2);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilmirror(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MirrorGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Mirror Modifier", "Change stroke using lattice to deform modifier");
- RNA_def_struct_sdna(srna, "MirrorGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Object used as center");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_MirrorGpencilModifier_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_CLIPPING);
- RNA_def_property_ui_text(prop, "Clip", "Clip points");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "x_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_X);
- RNA_def_property_ui_text(prop, "X", "Mirror this axis");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "y_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Y);
- RNA_def_property_ui_text(prop, "Y", "Mirror this axis");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "z_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Z);
- RNA_def_property_ui_text(prop, "Z", "Mirror this axis");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MirrorGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(
+ srna, "Mirror Modifier", "Change stroke using lattice to deform modifier");
+ RNA_def_struct_sdna(srna, "MirrorGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object used as center");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_MirrorGpencilModifier_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_CLIPPING);
+ RNA_def_property_ui_text(prop, "Clip", "Clip points");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "x_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_X);
+ RNA_def_property_ui_text(prop, "X", "Mirror this axis");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "y_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Y);
+ RNA_def_property_ui_text(prop, "Y", "Mirror this axis");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "z_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_MIRROR_AXIS_Z);
+ RNA_def_property_ui_text(prop, "Z", "Mirror this axis");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilhook(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "HookGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of stroke points");
- RNA_def_struct_sdna(srna, "HookGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_HOOK);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_HookGpencilModifier_object_set", NULL, NULL);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(
- prop, "Sub-Target",
- "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layername");
- RNA_def_property_ui_text(prop, "Layer", "Layer name");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pass_index");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_LAYER);
- RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_PASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "layer_pass");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_LAYERPASS);
- RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "force");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_gphook_falloff_items); /* share the enum */
- RNA_def_property_ui_text(prop, "Falloff Type", "");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "falloff");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 100, 2);
- RNA_def_property_ui_text(prop, "Radius", "If not zero, the distance from the hook where influence ends");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
- RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Light Falloff Curve");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cent");
- RNA_def_property_ui_text(prop, "Hook Center", "");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "parentinv");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Matrix", "Reverse the transformation between this object and its target");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_GpencilModifier_update");
-
- prop = RNA_def_property(srna, "use_falloff_uniform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_UNIFORM_SPACE);
- RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "HookGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(
+ srna, "Hook Modifier", "Hook modifier to modify the location of stroke points");
+ RNA_def_struct_sdna(srna, "HookGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_HOOK);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Object", "Parent Object for hook, also recalculates and clears offset");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_HookGpencilModifier_object_set", NULL, NULL);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(
+ prop,
+ "Sub-Target",
+ "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layername");
+ RNA_def_property_ui_text(prop, "Layer", "Layer name");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pass_index");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_LAYER);
+ RNA_def_property_ui_text(prop, "Inverse Layers", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_material_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_PASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Inverse VertexGroup", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "layer_pass", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "layer_pass");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Pass", "Layer pass index");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "invert_layer_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_INVERT_LAYERPASS);
+ RNA_def_property_ui_text(prop, "Inverse Pass", "Inverse filter");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "force");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_gphook_falloff_items); /* share the enum */
+ RNA_def_property_ui_text(prop, "Falloff Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "falloff");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 100, 2);
+ RNA_def_property_ui_text(
+ prop, "Radius", "If not zero, the distance from the hook where influence ends");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
+ RNA_def_property_ui_text(prop, "Falloff Curve", "Custom Light Falloff Curve");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cent");
+ RNA_def_property_ui_text(prop, "Hook Center", "");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "parentinv");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ prop, "Matrix", "Reverse the transformation between this object and its target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_GpencilModifier_update");
+
+ prop = RNA_def_property(srna, "use_falloff_uniform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_HOOK_UNIFORM_SPACE);
+ RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilarmature(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ArmatureGpencilModifier", "GpencilModifier");
- RNA_def_struct_ui_text(srna, "Armature Modifier", "Change stroke using armature to deform modifier");
- RNA_def_struct_sdna(srna, "ArmatureGpencilModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
- RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
- RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
- RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
-#if 0 /* GPXX keep disabled now */
- prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
- RNA_def_property_ui_text(
- prop, "Multi Modifier",
- "Use same input as previous modifier, and mix results using overall vgroup");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-#endif
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgname");
- RNA_def_property_ui_text(
- prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureGpencilModifier_vgname_set");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ArmatureGpencilModifier", "GpencilModifier");
+ RNA_def_struct_ui_text(
+ srna, "Armature Modifier", "Change stroke using armature to deform modifier");
+ RNA_def_struct_sdna(srna, "ArmatureGpencilModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ArmatureGpencilModifier_object_set", NULL, "rna_Armature_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
+ RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
+ RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
+ RNA_def_property_ui_text(
+ prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+# if 0 /* GPXX keep disabled now */
+ prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
+ RNA_def_property_ui_text(
+ prop, "Multi Modifier",
+ "Use same input as previous modifier, and mix results using overall vgroup");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+# endif
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgname");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureGpencilModifier_vgname_set");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_dependency_update");
}
void RNA_def_greasepencil_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* data */
- srna = RNA_def_struct(brna, "GpencilModifier", NULL);
- RNA_def_struct_ui_text(srna, "GpencilModifier", "Modifier affecting the grease pencil object");
- RNA_def_struct_refine_func(srna, "rna_GpencilModifier_refine");
- RNA_def_struct_path_func(srna, "rna_GpencilModifier_path");
- RNA_def_struct_sdna(srna, "GpencilModifierData");
-
- /* strings */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GpencilModifier_name_set");
- RNA_def_property_ui_text(prop, "Name", "Modifier name");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- /* enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_object_greasepencil_modifier_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
-
- /* flags */
- prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Realtime);
- RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
-
- prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Render);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Render", "Use modifier during render");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
-
- prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Editmode);
- RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode");
- RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
- RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Expanded);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- /* types */
- rna_def_modifier_gpencilnoise(brna);
- rna_def_modifier_gpencilsmooth(brna);
- rna_def_modifier_gpencilsubdiv(brna);
- rna_def_modifier_gpencilsimplify(brna);
- rna_def_modifier_gpencilthick(brna);
- rna_def_modifier_gpenciloffset(brna);
- rna_def_modifier_gpenciltint(brna);
- rna_def_modifier_gpenciltime(brna);
- rna_def_modifier_gpencilcolor(brna);
- rna_def_modifier_gpencilinstance(brna);
- rna_def_modifier_gpencilbuild(brna);
- rna_def_modifier_gpencilopacity(brna);
- rna_def_modifier_gpencillattice(brna);
- rna_def_modifier_gpencilmirror(brna);
- rna_def_modifier_gpencilhook(brna);
- rna_def_modifier_gpencilarmature(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* data */
+ srna = RNA_def_struct(brna, "GpencilModifier", NULL);
+ RNA_def_struct_ui_text(srna, "GpencilModifier", "Modifier affecting the grease pencil object");
+ RNA_def_struct_refine_func(srna, "rna_GpencilModifier_refine");
+ RNA_def_struct_path_func(srna, "rna_GpencilModifier_path");
+ RNA_def_struct_sdna(srna, "GpencilModifierData");
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GpencilModifier_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Modifier name");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_object_greasepencil_modifier_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* flags */
+ prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Realtime);
+ RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
+
+ prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Render);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Render", "Use modifier during render");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Editmode);
+ RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode");
+ RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
+ RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eGpencilModifierMode_Expanded);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ /* types */
+ rna_def_modifier_gpencilnoise(brna);
+ rna_def_modifier_gpencilsmooth(brna);
+ rna_def_modifier_gpencilsubdiv(brna);
+ rna_def_modifier_gpencilsimplify(brna);
+ rna_def_modifier_gpencilthick(brna);
+ rna_def_modifier_gpenciloffset(brna);
+ rna_def_modifier_gpenciltint(brna);
+ rna_def_modifier_gpenciltime(brna);
+ rna_def_modifier_gpencilcolor(brna);
+ rna_def_modifier_gpencilinstance(brna);
+ rna_def_modifier_gpencilbuild(brna);
+ rna_def_modifier_gpencilopacity(brna);
+ rna_def_modifier_gpencillattice(brna);
+ rna_def_modifier_gpencilmirror(brna);
+ rna_def_modifier_gpencilhook(brna);
+ rna_def_modifier_gpencilarmature(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index 231d4d6dbc8..34373e469c1 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -41,859 +41,899 @@
#include "WM_api.h"
const EnumPropertyItem rna_enum_image_generated_type_items[] = {
- {IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"},
- {IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
- {IMA_GENTYPE_GRID_COLOR, "COLOR_GRID", 0, "Color Grid", "Generated improved UV grid to test UV mappings"},
- {0, NULL, 0, NULL, NULL},
+ {IMA_GENTYPE_BLANK, "BLANK", 0, "Blank", "Generate a blank image"},
+ {IMA_GENTYPE_GRID, "UV_GRID", 0, "UV Grid", "Generated grid to test UV mappings"},
+ {IMA_GENTYPE_GRID_COLOR,
+ "COLOR_GRID",
+ 0,
+ "Color Grid",
+ "Generated improved UV grid to test UV mappings"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem image_source_items[] = {
- {IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"},
- {IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
- {IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"},
- {IMA_SRC_GENERATED, "GENERATED", 0, "Generated", "Generated image"},
- {IMA_SRC_VIEWER, "VIEWER", 0, "Viewer", "Compositing node viewer"},
- {0, NULL, 0, NULL, NULL},
+ {IMA_SRC_FILE, "FILE", 0, "Single Image", "Single image file"},
+ {IMA_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
+ {IMA_SRC_MOVIE, "MOVIE", 0, "Movie", "Movie file"},
+ {IMA_SRC_GENERATED, "GENERATED", 0, "Generated", "Generated image"},
+ {IMA_SRC_VIEWER, "VIEWER", 0, "Viewer", "Compositing node viewer"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_math_base.h"
+# include "BLI_math_base.h"
-#include "BKE_global.h"
+# include "BKE_global.h"
-#include "GPU_draw.h"
-#include "GPU_texture.h"
+# include "GPU_draw.h"
+# include "GPU_texture.h"
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
+# include "IMB_imbuf.h"
+# include "IMB_imbuf_types.h"
-#include "ED_node.h"
+# include "ED_node.h"
static bool rna_Image_is_stereo_3d_get(PointerRNA *ptr)
{
- return BKE_image_is_stereo((Image *)ptr->data);
+ return BKE_image_is_stereo((Image *)ptr->data);
}
static bool rna_Image_is_multiview_get(PointerRNA *ptr)
{
- return BKE_image_is_multiview((Image *)ptr->data);
+ return BKE_image_is_multiview((Image *)ptr->data);
}
static bool rna_Image_dirty_get(PointerRNA *ptr)
{
- return BKE_image_is_dirty((Image *)ptr->data);
+ return BKE_image_is_dirty((Image *)ptr->data);
}
static void rna_Image_source_set(PointerRNA *ptr, int value)
{
- Image *ima = ptr->id.data;
+ Image *ima = ptr->id.data;
- if (value != ima->source) {
- ima->source = value;
- BLI_assert(BKE_id_is_in_global_main(&ima->id));
- BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_SRC_CHANGE);
- DEG_id_tag_update(&ima->id, 0);
- DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
- DEG_relations_tag_update(G_MAIN);
- }
+ if (value != ima->source) {
+ ima->source = value;
+ BLI_assert(BKE_id_is_in_global_main(&ima->id));
+ BKE_image_signal(G_MAIN, ima, NULL, IMA_SIGNAL_SRC_CHANGE);
+ DEG_id_tag_update(&ima->id, 0);
+ DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
+ DEG_relations_tag_update(G_MAIN);
+ }
}
static void rna_Image_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Image *ima = ptr->id.data;
- BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_RELOAD);
- WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
- DEG_id_tag_update(&ima->id, 0);
- DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
+ Image *ima = ptr->id.data;
+ BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_RELOAD);
+ WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
+ DEG_id_tag_update(&ima->id, 0);
+ DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
}
static void rna_Image_generated_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Image *ima = ptr->id.data;
- BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
+ Image *ima = ptr->id.data;
+ BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
}
static void rna_Image_colormanage_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Image *ima = ptr->id.data;
- BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE);
- DEG_id_tag_update(&ima->id, 0);
- DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
- WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
- WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
+ Image *ima = ptr->id.data;
+ BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_COLORMANAGE);
+ DEG_id_tag_update(&ima->id, 0);
+ DEG_id_tag_update(&ima->id, ID_RECALC_EDITORS);
+ WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
+ WM_main_add_notifier(NC_IMAGE | NA_EDITED, &ima->id);
}
static void rna_Image_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Image *ima = ptr->id.data;
- ImBuf *ibuf;
- void *lock;
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
- ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (ibuf) {
- ImageUser iuser = {NULL};
- iuser.scene = scene;
- BKE_image_signal(bmain, ima, &iuser, IMA_SIGNAL_FREE);
- }
+ if (ibuf) {
+ ImageUser iuser = {NULL};
+ iuser.scene = scene;
+ BKE_image_signal(bmain, ima, &iuser, IMA_SIGNAL_FREE);
+ }
- BKE_image_release_ibuf(ima, ibuf, lock);
+ BKE_image_release_ibuf(ima, ibuf, lock);
}
static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ImageUser *iuser = ptr->data;
- ID *id = ptr->id.data;
+ ImageUser *iuser = ptr->data;
+ ID *id = ptr->id.data;
- BKE_image_user_frame_calc(iuser, scene->r.cfra);
+ BKE_image_user_frame_calc(iuser, scene->r.cfra);
- if (id) {
- if (GS(id->name) == ID_NT) {
- /* Special update for nodetrees to find parent datablock. */
- ED_node_tag_update_nodetree(bmain, (bNodeTree *)id, NULL);
- }
- else {
- /* Update material or texture for render preview. */
- DEG_id_tag_update(id, 0);
- DEG_id_tag_update(id, ID_RECALC_EDITORS);
- }
- }
+ if (id) {
+ if (GS(id->name) == ID_NT) {
+ /* Special update for nodetrees to find parent datablock. */
+ ED_node_tag_update_nodetree(bmain, (bNodeTree *)id, NULL);
+ }
+ else {
+ /* Update material or texture for render preview. */
+ DEG_id_tag_update(id, 0);
+ DEG_id_tag_update(id, ID_RECALC_EDITORS);
+ }
+ }
}
static void rna_ImageUser_relations_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_ImageUser_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
+ rna_ImageUser_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
}
static char *rna_ImageUser_path(PointerRNA *ptr)
{
- if (ptr->id.data) {
- /* ImageUser *iuser = ptr->data; */
+ if (ptr->id.data) {
+ /* ImageUser *iuser = ptr->data; */
- switch (GS(((ID *)ptr->id.data)->name)) {
- case ID_OB:
- case ID_TE:
- {
- return BLI_strdup("image_user");
- }
- case ID_NT:
- {
- return rna_Node_ImageUser_path(ptr);
- }
- default:
- break;
- }
- }
+ switch (GS(((ID *)ptr->id.data)->name)) {
+ case ID_OB:
+ case ID_TE: {
+ return BLI_strdup("image_user");
+ }
+ case ID_NT: {
+ return rna_Node_ImageUser_path(ptr);
+ }
+ default:
+ break;
+ }
+ }
- return BLI_strdup("");
+ return BLI_strdup("");
}
-static const EnumPropertyItem *rna_Image_source_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Image_source_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- Image *ima = (Image *)ptr->data;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ Image *ima = (Image *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- if (ima->source == IMA_SRC_VIEWER) {
- RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_VIEWER);
- }
- else {
- RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_FILE);
- RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_SEQUENCE);
- RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_MOVIE);
- RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_GENERATED);
- }
+ if (ima->source == IMA_SRC_VIEWER) {
+ RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_VIEWER);
+ }
+ else {
+ RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_FILE);
+ RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_SEQUENCE);
+ RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_MOVIE);
+ RNA_enum_items_add_value(&item, &totitem, image_source_items, IMA_SRC_GENERATED);
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static int rna_Image_file_format_get(PointerRNA *ptr)
{
- Image *image = (Image *)ptr->data;
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
- int imtype = BKE_image_ftype_to_imtype(ibuf ? ibuf->ftype : 0, ibuf ? &ibuf->foptions : NULL);
+ Image *image = (Image *)ptr->data;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
+ int imtype = BKE_image_ftype_to_imtype(ibuf ? ibuf->ftype : 0, ibuf ? &ibuf->foptions : NULL);
- BKE_image_release_ibuf(image, ibuf, NULL);
+ BKE_image_release_ibuf(image, ibuf, NULL);
- return imtype;
+ return imtype;
}
static void rna_Image_file_format_set(PointerRNA *ptr, int value)
{
- Image *image = (Image *)ptr->data;
- if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
- ImbFormatOptions options;
- int ftype = BKE_image_imtype_to_ftype(value, &options);
- BKE_image_file_format_set(image, ftype, &options);
- }
+ Image *image = (Image *)ptr->data;
+ if (BKE_imtype_is_movie(value) == 0) { /* should be able to throw an error here */
+ ImbFormatOptions options;
+ int ftype = BKE_image_imtype_to_ftype(value, &options);
+ BKE_image_file_format_set(image, ftype, &options);
+ }
}
static bool rna_Image_has_data_get(PointerRNA *ptr)
{
- Image *image = (Image *)ptr->data;
+ Image *image = (Image *)ptr->data;
- return BKE_image_has_loaded_ibuf(image);
+ return BKE_image_has_loaded_ibuf(image);
}
static void rna_Image_size_get(PointerRNA *ptr, int *values)
{
- Image *im = (Image *)ptr->data;
- ImBuf *ibuf;
- void *lock;
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
- ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf) {
- values[0] = ibuf->x;
- values[1] = ibuf->y;
- }
- else {
- values[0] = 0;
- values[1] = 0;
- }
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf) {
+ values[0] = ibuf->x;
+ values[1] = ibuf->y;
+ }
+ else {
+ values[0] = 0;
+ values[1] = 0;
+ }
- BKE_image_release_ibuf(im, ibuf, lock);
+ BKE_image_release_ibuf(im, ibuf, lock);
}
static void rna_Image_resolution_get(PointerRNA *ptr, float *values)
{
- Image *im = (Image *)ptr->data;
- ImBuf *ibuf;
- void *lock;
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
- ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf) {
- values[0] = ibuf->ppm[0];
- values[1] = ibuf->ppm[1];
- }
- else {
- values[0] = 0;
- values[1] = 0;
- }
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf) {
+ values[0] = ibuf->ppm[0];
+ values[1] = ibuf->ppm[1];
+ }
+ else {
+ values[0] = 0;
+ values[1] = 0;
+ }
- BKE_image_release_ibuf(im, ibuf, lock);
+ BKE_image_release_ibuf(im, ibuf, lock);
}
static void rna_Image_resolution_set(PointerRNA *ptr, const float *values)
{
- Image *im = (Image *)ptr->data;
- ImBuf *ibuf;
- void *lock;
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
- ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf) {
- ibuf->ppm[0] = values[0];
- ibuf->ppm[1] = values[1];
- }
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf) {
+ ibuf->ppm[0] = values[0];
+ ibuf->ppm[1] = values[1];
+ }
- BKE_image_release_ibuf(im, ibuf, lock);
+ BKE_image_release_ibuf(im, ibuf, lock);
}
static int rna_Image_bindcode_get(PointerRNA *ptr)
{
- Image *ima = (Image *)ptr->data;
- GPUTexture *tex = ima->gputexture[TEXTARGET_TEXTURE_2D];
- return (tex) ? GPU_texture_opengl_bindcode(tex) : 0;
+ Image *ima = (Image *)ptr->data;
+ GPUTexture *tex = ima->gputexture[TEXTARGET_TEXTURE_2D];
+ return (tex) ? GPU_texture_opengl_bindcode(tex) : 0;
}
static int rna_Image_depth_get(PointerRNA *ptr)
{
- Image *im = (Image *)ptr->data;
- ImBuf *ibuf;
- void *lock;
- int planes;
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
+ int planes;
- ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (!ibuf)
- planes = 0;
- else if (ibuf->rect_float)
- planes = ibuf->planes * 4;
- else
- planes = ibuf->planes;
+ if (!ibuf)
+ planes = 0;
+ else if (ibuf->rect_float)
+ planes = ibuf->planes * 4;
+ else
+ planes = ibuf->planes;
- BKE_image_release_ibuf(im, ibuf, lock);
+ BKE_image_release_ibuf(im, ibuf, lock);
- return planes;
+ return planes;
}
static int rna_Image_frame_duration_get(PointerRNA *ptr)
{
- Image *ima = ptr->id.data;
- int duration = 1;
+ Image *ima = ptr->id.data;
+ int duration = 1;
- if (BKE_image_has_anim(ima)) {
- duration = IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN);
- }
- else {
- /* acquire ensures ima->anim is set, if possible! */
- void *lock;
- ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- BKE_image_release_ibuf(ima, ibuf, lock);
- }
+ if (BKE_image_has_anim(ima)) {
+ duration = IMB_anim_get_duration(((ImageAnim *)ima->anims.first)->anim, IMB_TC_RECORD_RUN);
+ }
+ else {
+ /* acquire ensures ima->anim is set, if possible! */
+ void *lock;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ BKE_image_release_ibuf(ima, ibuf, lock);
+ }
- return duration;
+ return duration;
}
static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
- Image *ima = ptr->id.data;
- ImBuf *ibuf;
- void *lock;
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
- ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (ibuf)
- length[0] = ibuf->x * ibuf->y * ibuf->channels;
- else
- length[0] = 0;
+ if (ibuf)
+ length[0] = ibuf->x * ibuf->y * ibuf->channels;
+ else
+ length[0] = 0;
- BKE_image_release_ibuf(ima, ibuf, lock);
+ BKE_image_release_ibuf(ima, ibuf, lock);
- return length[0];
+ return length[0];
}
static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
{
- Image *ima = ptr->id.data;
- ImBuf *ibuf;
- void *lock;
- int i, size;
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
+ int i, size;
- ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (ibuf) {
- size = ibuf->x * ibuf->y * ibuf->channels;
+ if (ibuf) {
+ size = ibuf->x * ibuf->y * ibuf->channels;
- if (ibuf->rect_float) {
- memcpy(values, ibuf->rect_float, sizeof(float) * size);
- }
- else {
- for (i = 0; i < size; i++)
- values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f);
- }
- }
+ if (ibuf->rect_float) {
+ memcpy(values, ibuf->rect_float, sizeof(float) * size);
+ }
+ else {
+ for (i = 0; i < size; i++)
+ values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f);
+ }
+ }
- BKE_image_release_ibuf(ima, ibuf, lock);
+ BKE_image_release_ibuf(ima, ibuf, lock);
}
static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
{
- Image *ima = ptr->id.data;
- ImBuf *ibuf;
- void *lock;
- int i, size;
+ Image *ima = ptr->id.data;
+ ImBuf *ibuf;
+ void *lock;
+ int i, size;
- ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (ibuf) {
- size = ibuf->x * ibuf->y * ibuf->channels;
+ if (ibuf) {
+ size = ibuf->x * ibuf->y * ibuf->channels;
- if (ibuf->rect_float) {
- memcpy(ibuf->rect_float, values, sizeof(float) * size);
- }
- else {
- for (i = 0; i < size; i++)
- ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]);
- }
+ if (ibuf->rect_float) {
+ memcpy(ibuf->rect_float, values, sizeof(float) * size);
+ }
+ else {
+ for (i = 0; i < size; i++)
+ ((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]);
+ }
- ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID;
- if (!G.background) {
- GPU_free_image(ima);
- }
- WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
- }
+ ibuf->userflags |= IB_BITMAPDIRTY | IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID;
+ if (!G.background) {
+ GPU_free_image(ima);
+ }
+ WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, &ima->id);
+ }
- BKE_image_release_ibuf(ima, ibuf, lock);
+ BKE_image_release_ibuf(ima, ibuf, lock);
}
static int rna_Image_channels_get(PointerRNA *ptr)
{
- Image *im = (Image *)ptr->data;
- ImBuf *ibuf;
- void *lock;
- int channels = 0;
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
+ int channels = 0;
- ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf)
- channels = ibuf->channels;
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf)
+ channels = ibuf->channels;
- BKE_image_release_ibuf(im, ibuf, lock);
+ BKE_image_release_ibuf(im, ibuf, lock);
- return channels;
+ return channels;
}
static bool rna_Image_is_float_get(PointerRNA *ptr)
{
- Image *im = (Image *)ptr->data;
- ImBuf *ibuf;
- void *lock;
- bool is_float = false;
+ Image *im = (Image *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
+ bool is_float = false;
- ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf)
- is_float = ibuf->rect_float != NULL;
+ ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
+ if (ibuf)
+ is_float = ibuf->rect_float != NULL;
- BKE_image_release_ibuf(im, ibuf, lock);
+ BKE_image_release_ibuf(im, ibuf, lock);
- return is_float;
+ return is_float;
}
static PointerRNA rna_Image_packed_file_get(PointerRNA *ptr)
{
- Image *ima = (Image *)ptr->id.data;
+ Image *ima = (Image *)ptr->id.data;
- if (BKE_image_has_packedfile(ima)) {
- ImagePackedFile *imapf = ima->packedfiles.first;
- return rna_pointer_inherit_refine(ptr, &RNA_PackedFile, imapf->packedfile);
- }
- else {
- return PointerRNA_NULL;
- }
+ if (BKE_image_has_packedfile(ima)) {
+ ImagePackedFile *imapf = ima->packedfiles.first;
+ return rna_pointer_inherit_refine(ptr, &RNA_PackedFile, imapf->packedfile);
+ }
+ else {
+ return PointerRNA_NULL;
+ }
}
static void rna_RenderSlot_clear(ID *id, RenderSlot *slot, ImageUser *iuser)
{
- Image *image = (Image *) id;
- int index = BLI_findindex(&image->renderslots, slot);
- BKE_image_clear_renderslot(image, iuser, index);
+ Image *image = (Image *)id;
+ int index = BLI_findindex(&image->renderslots, slot);
+ BKE_image_clear_renderslot(image, iuser, index);
- WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, image);
+ WM_main_add_notifier(NC_IMAGE | ND_DISPLAY, image);
}
static PointerRNA rna_render_slots_active_get(PointerRNA *ptr)
{
- Image *image = (Image *)ptr->id.data;
- RenderSlot *render_slot = BKE_image_get_renderslot(image, image->render_slot);
+ Image *image = (Image *)ptr->id.data;
+ RenderSlot *render_slot = BKE_image_get_renderslot(image, image->render_slot);
- return rna_pointer_inherit_refine(ptr, &RNA_RenderSlot, render_slot);
+ return rna_pointer_inherit_refine(ptr, &RNA_RenderSlot, render_slot);
}
static void rna_render_slots_active_set(PointerRNA *ptr, PointerRNA value)
{
- Image *image = (Image *)ptr->id.data;
- if (value.id.data == image) {
- RenderSlot *slot = (RenderSlot *)value.data;
- int index = BLI_findindex(&image->renderslots, slot);
- if (index != -1) image->render_slot = index;
- }
+ Image *image = (Image *)ptr->id.data;
+ if (value.id.data == image) {
+ RenderSlot *slot = (RenderSlot *)value.data;
+ int index = BLI_findindex(&image->renderslots, slot);
+ if (index != -1)
+ image->render_slot = index;
+ }
}
static int rna_render_slots_active_index_get(PointerRNA *ptr)
{
- Image *image = (Image *)ptr->id.data;
- return image->render_slot;
+ Image *image = (Image *)ptr->id.data;
+ return image->render_slot;
}
static void rna_render_slots_active_index_set(PointerRNA *ptr, int value)
{
- Image *image = (Image *)ptr->id.data;
- int num_slots = BLI_listbase_count(&image->renderslots);
- image->render_slot = value;
- CLAMP(image->render_slot, 0, num_slots - 1);
+ Image *image = (Image *)ptr->id.data;
+ int num_slots = BLI_listbase_count(&image->renderslots);
+ image->render_slot = value;
+ CLAMP(image->render_slot, 0, num_slots - 1);
}
-static void rna_render_slots_active_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_render_slots_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Image *image = (Image *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&image->renderslots) - 1);
+ Image *image = (Image *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&image->renderslots) - 1);
}
#else
static void rna_def_imageuser(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ImageUser", NULL);
- RNA_def_struct_ui_text(srna, "Image User",
- "Parameters defining how an Image data-block is used by another data-block");
- RNA_def_struct_path_func(srna, "rna_ImageUser_path");
-
- prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
- RNA_def_property_ui_text(prop, "Auto Refresh", "Always refresh image on frame changes");
- RNA_def_property_update(prop, 0, "rna_ImageUser_relations_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "framenr");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Current Frame", "Current frame number in image sequence or movie");
-
- /* animation */
- prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cycl", 0);
- RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie");
- RNA_def_property_update(prop, 0, "rna_ImageUser_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "frames");
- RNA_def_property_range(prop, 0, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use");
- RNA_def_property_update(prop, 0, "rna_ImageUser_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation");
- RNA_def_property_update(prop, 0, "rna_ImageUser_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "sfra");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Start Frame",
- "Global starting frame of the movie/sequence, assuming first picture has a #1");
- RNA_def_property_update(prop, 0, "rna_ImageUser_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "layer");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
- RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image");
-
- prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "pass");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
- RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image");
-
- prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "view");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
- RNA_def_property_ui_text(prop, "View", "View in multilayer image");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ImageUser", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "Image User",
+ "Parameters defining how an Image data-block is used by another data-block");
+ RNA_def_struct_path_func(srna, "rna_ImageUser_path");
+
+ prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
+ RNA_def_property_ui_text(prop, "Auto Refresh", "Always refresh image on frame changes");
+ RNA_def_property_update(prop, 0, "rna_ImageUser_relations_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(
+ prop, "Current Frame", "Current frame number in image sequence or movie");
+
+ /* animation */
+ prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cycl", 0);
+ RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie");
+ RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "frames");
+ RNA_def_property_range(prop, 0, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use");
+ RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(
+ prop, "Offset", "Offset the number of the frame to use in the animation");
+ RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "sfra");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_ui_text(
+ prop,
+ "Start Frame",
+ "Global starting frame of the movie/sequence, assuming first picture has a #1");
+ RNA_def_property_update(prop, 0, "rna_ImageUser_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "multilayer_layer", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "layer");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
+ RNA_def_property_ui_text(prop, "Layer", "Layer in multilayer image");
+
+ prop = RNA_def_property(srna, "multilayer_pass", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "pass");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
+ RNA_def_property_ui_text(prop, "Pass", "Pass in multilayer image");
+
+ prop = RNA_def_property(srna, "multilayer_view", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "view");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* image_multi_cb */
+ RNA_def_property_ui_text(prop, "View", "View in multilayer image");
}
/* image.packed_files */
static void rna_def_image_packed_files(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ImagePackedFile", NULL);
- RNA_def_struct_sdna(srna, "ImagePackedFile");
+ srna = RNA_def_struct(brna, "ImagePackedFile", NULL);
+ RNA_def_struct_sdna(srna, "ImagePackedFile");
- prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
- RNA_def_property_ui_text(prop, "Packed File", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
+ RNA_def_property_ui_text(prop, "Packed File", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "filepath");
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "filepath");
+ RNA_def_struct_name_property(srna, prop);
- RNA_api_image_packed_file(srna);
+ RNA_api_image_packed_file(srna);
}
static void rna_def_render_slot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop, *parm;
- FunctionRNA *func;
+ StructRNA *srna;
+ PropertyRNA *prop, *parm;
+ FunctionRNA *func;
- srna = RNA_def_struct(brna, "RenderSlot", NULL);
- RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");
+ srna = RNA_def_struct(brna, "RenderSlot", NULL);
+ RNA_def_struct_ui_text(srna, "Render Slot", "Parameters defining the render slot");
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Name", "Render slot name");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "Render slot name");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
- func = RNA_def_function(srna, "clear", "rna_RenderSlot_clear");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Clear the render slot");
- parm = RNA_def_pointer(func, "iuser", "ImageUser", "ImageUser", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "clear", "rna_RenderSlot_clear");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Clear the render slot");
+ parm = RNA_def_pointer(func, "iuser", "ImageUser", "ImageUser", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_render_slots(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop, *parm;
-
- RNA_def_property_srna(cprop, "RenderSlots");
- srna = RNA_def_struct(brna, "RenderSlots", NULL);
- RNA_def_struct_sdna(srna, "Image");
- RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "render_slot");
- RNA_def_property_int_funcs(prop, "rna_render_slots_active_index_get",
- "rna_render_slots_active_index_set",
- "rna_render_slots_active_index_range");
- RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderSlot");
- RNA_def_property_pointer_funcs(prop, "rna_render_slots_active_get", "rna_render_slots_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- func = RNA_def_function(srna, "new", "BKE_image_add_renderslot");
- RNA_def_function_ui_description(func, "Add a render slot to the image");
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "New name for the render slot");
- parm = RNA_def_pointer(func, "result", "RenderSlot", "", "Newly created render layer");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop, *parm;
+
+ RNA_def_property_srna(cprop, "RenderSlots");
+ srna = RNA_def_struct(brna, "RenderSlots", NULL);
+ RNA_def_struct_sdna(srna, "Image");
+ RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "render_slot");
+ RNA_def_property_int_funcs(prop,
+ "rna_render_slots_active_index_get",
+ "rna_render_slots_active_index_set",
+ "rna_render_slots_active_index_range");
+ RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderSlot");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_render_slots_active_get", "rna_render_slots_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active", "Active render slot of the image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ func = RNA_def_function(srna, "new", "BKE_image_add_renderslot");
+ RNA_def_function_ui_description(func, "Add a render slot to the image");
+ parm = RNA_def_string(func, "name", NULL, 0, "Name", "New name for the render slot");
+ parm = RNA_def_pointer(func, "result", "RenderSlot", "", "Newly created render layer");
+ RNA_def_function_return(func, parm);
}
static void rna_def_image(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static const EnumPropertyItem prop_type_items[] = {
- {IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
- {IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
- {IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
- {IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
- {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem alpha_mode_items[] = {
- {IMA_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "Transparent RGB and alpha pixels are unmodified"},
- {IMA_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "Transparent RGB pixels are multiplied by the alpha channel"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Image", "ID");
- RNA_def_struct_ui_text(srna, "Image", "Image data-block referencing an external or packed image");
- RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
-
- /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
- prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");
-
- prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_image_type_items);
- RNA_def_property_enum_funcs(prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
- RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");
-
- prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, image_source_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf");
- RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "How to generate the image");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "PackedFile");
- RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
- RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image");
-
- prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL);
- RNA_def_property_struct_type(prop, "ImagePackedFile");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images");
-
- prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER);
- RNA_def_property_ui_text(prop, "View as Render", "Apply render part of display transformation when displaying this image on the screen");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_IGNORE_ALPHA);
- RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information from the image or make image fully opaque");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");
-
- prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DEINTERLACE);
- RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
-
- prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_USE_VIEWS);
- RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
-
- prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL);
- RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL);
- RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");
-
- /* generated image (image_generated_change_cb) */
- prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gen_type");
- RNA_def_property_enum_items(prop, rna_enum_image_generated_type_items);
- RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gen_x");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 1, 65536);
- RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gen_y");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 1, 65536);
- RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
- RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gen_color");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_float_sdna(prop, NULL, "aspx");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, 0.1f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.1f, 5000.f, 1, 2);
- RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Image_bindcode_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderSlot");
- RNA_def_property_collection_sdna(prop, NULL, "renderslots", NULL);
- RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image");
- rna_def_render_slots(brna, prop);
-
- /*
- * Image.has_data and Image.depth are temporary,
- * Update import_obj.py when they are replaced (Arystan)
- */
- prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has Data", "True if the image data is loaded into memory");
-
- prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size",
- "Width and height in pixels, zero when image data cant be loaded", 0, 0);
- RNA_def_property_subtype(prop, PROP_PIXEL);
- RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_float_vector(srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);
-
- prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* NOTE about pixels/channels/is_floa:
- * this properties describes how image is stored internally (inside of ImBuf),
- * not how it was saved to disk or how it'll be saved on disk
- */
- prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_multi_array(prop, 1, NULL);
- RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values");
- RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
- RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
-
- prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Float", "True if this image is stored in float buffer");
-
- prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
- RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
- RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
-
- prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_enum_items(prop, alpha_mode_items);
- RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");
-
- /* multiview */
- prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_enum_sdna(prop, NULL, "views_format");
- RNA_def_property_enum_items(prop, rna_enum_views_format_items);
- RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
-
- prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "Stereo3dFormat");
- RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
-
- RNA_api_image(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static const EnumPropertyItem prop_type_items[] = {
+ {IMA_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
+ {IMA_TYPE_MULTILAYER, "MULTILAYER", 0, "Multilayer", ""},
+ {IMA_TYPE_UV_TEST, "UV_TEST", 0, "UV Test", ""},
+ {IMA_TYPE_R_RESULT, "RENDER_RESULT", 0, "Render Result", ""},
+ {IMA_TYPE_COMPOSITE, "COMPOSITING", 0, "Compositing", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem alpha_mode_items[] = {
+ {IMA_ALPHA_STRAIGHT,
+ "STRAIGHT",
+ 0,
+ "Straight",
+ "Transparent RGB and alpha pixels are unmodified"},
+ {IMA_ALPHA_PREMUL,
+ "PREMUL",
+ 0,
+ "Premultiplied",
+ "Transparent RGB pixels are multiplied by the alpha channel"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Image", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Image", "Image data-block referencing an external or packed image");
+ RNA_def_struct_ui_icon(srna, ICON_IMAGE_DATA);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
+
+ /* eek. this is horrible but needed so we can save to a new name without blanking the data :( */
+ prop = RNA_def_property(srna, "filepath_raw", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "File Name", "Image/Movie file name (without data refreshing)");
+
+ prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_image_type_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_Image_file_format_get", "rna_Image_file_format_set", NULL);
+ RNA_def_property_ui_text(prop, "File Format", "Format used for re-saving this file");
+
+ prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, image_source_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Image_source_set", "rna_Image_source_itemf");
+ RNA_def_property_ui_text(prop, "Source", "Where the image comes from");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Type", "How to generate the image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "PackedFile");
+ RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
+ RNA_def_property_pointer_funcs(prop, "rna_Image_packed_file_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Packed File", "First packed file of the image");
+
+ prop = RNA_def_property(srna, "packed_files", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "packedfiles", NULL);
+ RNA_def_property_struct_type(prop, "ImagePackedFile");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Packed Files", "Collection of packed images");
+
+ prop = RNA_def_property(srna, "use_view_as_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_VIEW_AS_RENDER);
+ RNA_def_property_ui_text(
+ prop,
+ "View as Render",
+ "Apply render part of display transformation when displaying this image on the screen");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMA_IGNORE_ALPHA);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Alpha",
+ "Use the alpha channel information from the image or make image fully opaque");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");
+
+ prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_DEINTERLACE);
+ RNA_def_property_ui_text(prop, "Deinterlace", "Deinterlace movie file on load");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_reload_update");
+
+ prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_USE_VIEWS);
+ RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
+
+ prop = RNA_def_property(srna, "is_stereo_3d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_is_stereo_3d_get", NULL);
+ RNA_def_property_ui_text(prop, "Stereo 3D", "Image has left and right views");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_multiview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_is_multiview_get", NULL);
+ RNA_def_property_ui_text(prop, "Multiple Views", "Image has more than one view");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_dirty_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Dirty", "Image has changed and is not saved");
+
+ /* generated image (image_generated_change_cb) */
+ prop = RNA_def_property(srna, "generated_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gen_type");
+ RNA_def_property_enum_items(prop, rna_enum_image_generated_type_items);
+ RNA_def_property_ui_text(prop, "Generated Type", "Generated image type");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "generated_width", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gen_x");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 1, 65536);
+ RNA_def_property_ui_text(prop, "Generated Width", "Generated image width");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "generated_height", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gen_y");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 1, 65536);
+ RNA_def_property_ui_text(prop, "Generated Height", "Generated image height");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_generated_float", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gen_flag", IMA_GEN_FLOAT);
+ RNA_def_property_ui_text(prop, "Float Buffer", "Generate floating point buffer");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "generated_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gen_color");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Color", "Fill color for the generated image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_generated_update");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_float_sdna(prop, NULL, "aspx");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.1f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.1f, 5000.f, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Display Aspect", "Display Aspect for this image, does not affect rendering");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "bindcode", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Image_bindcode_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Bindcode", "OpenGL bindcode");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "render_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderSlot");
+ RNA_def_property_collection_sdna(prop, NULL, "renderslots", NULL);
+ RNA_def_property_ui_text(prop, "Render Slots", "Render slots of the image");
+ rna_def_render_slots(brna, prop);
+
+ /*
+ * Image.has_data and Image.depth are temporary,
+ * Update import_obj.py when they are replaced (Arystan)
+ */
+ prop = RNA_def_property(srna, "has_data", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_has_data_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has Data", "True if the image data is loaded into memory");
+
+ prop = RNA_def_property(srna, "depth", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Image_depth_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Depth", "Image bit depth");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_int_vector(srna,
+ "size",
+ 2,
+ NULL,
+ 0,
+ 0,
+ "Size",
+ "Width and height in pixels, zero when image data cant be loaded",
+ 0,
+ 0);
+ RNA_def_property_subtype(prop, PROP_PIXEL);
+ RNA_def_property_int_funcs(prop, "rna_Image_size_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_float_vector(
+ srna, "resolution", 2, NULL, 0, 0, "Resolution", "X/Y pixels per meter", 0, 0);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_float_funcs(prop, "rna_Image_resolution_get", "rna_Image_resolution_set", NULL);
+
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Image_frame_duration_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Duration", "Duration (in frames) of the image (1 when not a video/sequence)");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* NOTE about pixels/channels/is_floa:
+ * this properties describes how image is stored internally (inside of ImBuf),
+ * not how it was saved to disk or how it'll be saved on disk
+ */
+ prop = RNA_def_property(srna, "pixels", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 1, NULL);
+ RNA_def_property_ui_text(prop, "Pixels", "Image pixels in floating point values");
+ RNA_def_property_dynamic_array_funcs(prop, "rna_Image_pixels_get_length");
+ RNA_def_property_float_funcs(prop, "rna_Image_pixels_get", "rna_Image_pixels_set", NULL);
+
+ prop = RNA_def_property(srna, "channels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Image_channels_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Channels", "Number of channels in pixels buffer");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_float", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Image_is_float_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Float", "True if this image is stored in float buffer");
+
+ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
+
+ prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_enum_items(prop, alpha_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_colormanage_update");
+
+ /* multiview */
+ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_enum_sdna(prop, NULL, "views_format");
+ RNA_def_property_enum_items(prop, rna_enum_views_format_items);
+ RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Image_views_format_update");
+
+ prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Stereo3dFormat");
+ RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
+
+ RNA_api_image(srna);
}
void RNA_def_image(BlenderRNA *brna)
{
- rna_def_render_slot(brna);
- rna_def_image(brna);
- rna_def_imageuser(brna);
- rna_def_image_packed_files(brna);
+ rna_def_render_slot(brna);
+ rna_def_image(brna);
+ rna_def_imageuser(brna);
+ rna_def_image_packed_files(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c
index 25cb6894b4d..b0030a87dfa 100644
--- a/source/blender/makesrna/intern/rna_image_api.c
+++ b/source/blender/makesrna/intern/rna_image_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -37,359 +36,425 @@
#include "RNA_define.h"
#include "RNA_enum_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include <errno.h>
-#include "BKE_image.h"
-#include "BKE_packedFile.h"
-#include "BKE_main.h"
+# include <errno.h>
+# include "BKE_image.h"
+# include "BKE_packedFile.h"
+# include "BKE_main.h"
-#include "IMB_imbuf.h"
-#include "IMB_colormanagement.h"
+# include "IMB_imbuf.h"
+# include "IMB_colormanagement.h"
-#include "DNA_image_types.h"
-#include "DNA_scene_types.h"
+# include "DNA_image_types.h"
+# include "DNA_scene_types.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
static void rna_ImagePackedFile_save(ImagePackedFile *imapf, Main *bmain, ReportList *reports)
{
- if (writePackedFile(reports, BKE_main_blendfile_path(bmain), imapf->filepath, imapf->packedfile, 0) != RET_OK) {
- BKE_reportf(reports, RPT_ERROR, "Could not save packed file to disk as '%s'",
- imapf->filepath);
- }
+ if (writePackedFile(
+ reports, BKE_main_blendfile_path(bmain), imapf->filepath, imapf->packedfile, 0) !=
+ RET_OK) {
+ BKE_reportf(reports, RPT_ERROR, "Could not save packed file to disk as '%s'", imapf->filepath);
+ }
}
-static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports, const char *path, Scene *scene)
+static void rna_Image_save_render(
+ Image *image, bContext *C, ReportList *reports, const char *path, Scene *scene)
{
- ImBuf *ibuf;
+ ImBuf *ibuf;
- if (scene == NULL) {
- scene = CTX_data_scene(C);
- }
+ if (scene == NULL) {
+ scene = CTX_data_scene(C);
+ }
- if (scene) {
- ImageUser iuser = {NULL};
- void *lock;
+ if (scene) {
+ ImageUser iuser = {NULL};
+ void *lock;
- iuser.scene = scene;
- iuser.ok = 1;
+ iuser.scene = scene;
+ iuser.ok = 1;
- ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
+ ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
- if (ibuf == NULL) {
- BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
- }
- else {
- ImBuf *write_ibuf;
+ if (ibuf == NULL) {
+ BKE_report(reports, RPT_ERROR, "Could not acquire buffer from image");
+ }
+ else {
+ ImBuf *write_ibuf;
- write_ibuf = IMB_colormanagement_imbuf_for_write(ibuf, true, true, &scene->view_settings,
- &scene->display_settings, &scene->r.im_format);
+ write_ibuf = IMB_colormanagement_imbuf_for_write(
+ ibuf, true, true, &scene->view_settings, &scene->display_settings, &scene->r.im_format);
- write_ibuf->planes = scene->r.im_format.planes;
- write_ibuf->dither = scene->r.dither_intensity;
+ write_ibuf->planes = scene->r.im_format.planes;
+ write_ibuf->dither = scene->r.dither_intensity;
- if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
- BKE_reportf(reports, RPT_ERROR, "Could not write image: %s, '%s'", strerror(errno), path);
- }
+ if (!BKE_imbuf_write(write_ibuf, path, &scene->r.im_format)) {
+ BKE_reportf(reports, RPT_ERROR, "Could not write image: %s, '%s'", strerror(errno), path);
+ }
- if (write_ibuf != ibuf)
- IMB_freeImBuf(write_ibuf);
- }
+ if (write_ibuf != ibuf)
+ IMB_freeImBuf(write_ibuf);
+ }
- BKE_image_release_ibuf(image, ibuf, lock);
- }
- else {
- BKE_report(reports, RPT_ERROR, "Scene not in context, could not get save parameters");
- }
+ BKE_image_release_ibuf(image, ibuf, lock);
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Scene not in context, could not get save parameters");
+ }
}
static void rna_Image_save(Image *image, Main *bmain, bContext *C, ReportList *reports)
{
- void *lock;
-
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
- if (ibuf) {
- char filename[FILE_MAX];
- BLI_strncpy(filename, image->name, sizeof(filename));
- BLI_path_abs(filename, ID_BLEND_PATH(bmain, &image->id));
-
- /* note, we purposefully ignore packed files here,
- * developers need to explicitly write them via 'packed_files' */
-
- if (IMB_saveiff(ibuf, filename, ibuf->flags)) {
- image->type = IMA_TYPE_IMAGE;
-
- if (image->source == IMA_SRC_GENERATED)
- image->source = IMA_SRC_FILE;
-
- IMB_colormanagement_colorspace_from_ibuf_ftype(&image->colorspace_settings, ibuf);
-
- ibuf->userflags &= ~IB_BITMAPDIRTY;
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Image '%s' could not be saved to '%s'", image->id.name + 2, image->name);
- }
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
- }
-
- BKE_image_release_ibuf(image, ibuf, lock);
- WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image);
+ void *lock;
+
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, &lock);
+ if (ibuf) {
+ char filename[FILE_MAX];
+ BLI_strncpy(filename, image->name, sizeof(filename));
+ BLI_path_abs(filename, ID_BLEND_PATH(bmain, &image->id));
+
+ /* note, we purposefully ignore packed files here,
+ * developers need to explicitly write them via 'packed_files' */
+
+ if (IMB_saveiff(ibuf, filename, ibuf->flags)) {
+ image->type = IMA_TYPE_IMAGE;
+
+ if (image->source == IMA_SRC_GENERATED)
+ image->source = IMA_SRC_FILE;
+
+ IMB_colormanagement_colorspace_from_ibuf_ftype(&image->colorspace_settings, ibuf);
+
+ ibuf->userflags &= ~IB_BITMAPDIRTY;
+ }
+ else {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Image '%s' could not be saved to '%s'",
+ image->id.name + 2,
+ image->name);
+ }
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
+ }
+
+ BKE_image_release_ibuf(image, ibuf, lock);
+ WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image);
}
-static void rna_Image_pack(
- Image *image, Main *bmain, bContext *C, ReportList *reports,
- bool as_png, const char *data, int data_len)
+static void rna_Image_pack(Image *image,
+ Main *bmain,
+ bContext *C,
+ ReportList *reports,
+ bool as_png,
+ const char *data,
+ int data_len)
{
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
-
- if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
- BKE_report(reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG");
- }
- else {
- BKE_image_free_packedfiles(image);
- if (as_png) {
- BKE_image_memorypack(image);
- }
- else if (data) {
- char *data_dup = MEM_mallocN(sizeof(*data_dup) * (size_t)data_len, __func__);
- memcpy(data_dup, data, (size_t)data_len);
- BKE_image_packfiles_from_mem(reports, image, data_dup, (size_t)data_len);
- }
- else {
- BKE_image_packfiles(reports, image, ID_BLEND_PATH(bmain, &image->id));
- }
- }
-
- BKE_image_release_ibuf(image, ibuf, NULL);
- WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image);
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
+
+ if (!as_png && (ibuf && (ibuf->userflags & IB_BITMAPDIRTY))) {
+ BKE_report(reports, RPT_ERROR, "Cannot pack edited image from disk, only as internal PNG");
+ }
+ else {
+ BKE_image_free_packedfiles(image);
+ if (as_png) {
+ BKE_image_memorypack(image);
+ }
+ else if (data) {
+ char *data_dup = MEM_mallocN(sizeof(*data_dup) * (size_t)data_len, __func__);
+ memcpy(data_dup, data, (size_t)data_len);
+ BKE_image_packfiles_from_mem(reports, image, data_dup, (size_t)data_len);
+ }
+ else {
+ BKE_image_packfiles(reports, image, ID_BLEND_PATH(bmain, &image->id));
+ }
+ }
+
+ BKE_image_release_ibuf(image, ibuf, NULL);
+ WM_event_add_notifier(C, NC_IMAGE | NA_EDITED, image);
}
static void rna_Image_unpack(Image *image, Main *bmain, ReportList *reports, int method)
{
- if (!BKE_image_has_packedfile(image)) {
- BKE_report(reports, RPT_ERROR, "Image not packed");
- }
- else if (BKE_image_is_animated(image)) {
- BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
- return;
- }
- else {
- /* reports its own error on failure */
- unpackImage(bmain, reports, image, method);
- }
+ if (!BKE_image_has_packedfile(image)) {
+ BKE_report(reports, RPT_ERROR, "Image not packed");
+ }
+ else if (BKE_image_is_animated(image)) {
+ BKE_report(reports, RPT_ERROR, "Unpacking movies or image sequences not supported");
+ return;
+ }
+ else {
+ /* reports its own error on failure */
+ unpackImage(bmain, reports, image, method);
+ }
}
static void rna_Image_reload(Image *image, Main *bmain)
{
- BKE_image_signal(bmain, image, NULL, IMA_SIGNAL_RELOAD);
- WM_main_add_notifier(NC_IMAGE | NA_EDITED, image);
+ BKE_image_signal(bmain, image, NULL, IMA_SIGNAL_RELOAD);
+ WM_main_add_notifier(NC_IMAGE | NA_EDITED, image);
}
static void rna_Image_update(Image *image, ReportList *reports)
{
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, NULL, NULL);
- if (ibuf == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
- return;
- }
+ if (ibuf == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
+ return;
+ }
- if (ibuf->rect)
- IMB_rect_from_float(ibuf);
+ if (ibuf->rect)
+ IMB_rect_from_float(ibuf);
- ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
+ ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID;
- BKE_image_release_ibuf(image, ibuf, NULL);
+ BKE_image_release_ibuf(image, ibuf, NULL);
}
static void rna_Image_scale(Image *image, ReportList *reports, int width, int height)
{
- if (!BKE_image_scale(image, width, height)) {
- BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
- }
+ if (!BKE_image_scale(image, width, height)) {
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
+ }
}
static int rna_Image_gl_load(Image *image, ReportList *reports, int frame, int filter, int mag)
{
- GPUTexture *tex = image->gputexture[TEXTARGET_TEXTURE_2D];
- int error = GL_NO_ERROR;
-
- if (tex)
- return error;
-
- ImageUser iuser = {NULL};
- iuser.framenr = frame;
- iuser.ok = true;
-
- void *lock;
- ImBuf *ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
-
- /* clean glError buffer */
- while (glGetError() != GL_NO_ERROR) {}
-
- if (ibuf == NULL || ibuf->rect == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
- BKE_image_release_ibuf(image, ibuf, lock);
- return (int)GL_INVALID_OPERATION;
- }
-
- unsigned int bindcode = 0;
- GPU_create_gl_tex(&bindcode, ibuf->rect, ibuf->rect_float, ibuf->x, ibuf->y, GL_TEXTURE_2D,
- (filter != GL_NEAREST && filter != GL_LINEAR), false, image);
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
-
- /* TODO(merwin): validate input (dimensions, filter, mag) before calling OpenGL
- * instead of trusting input & testing for error after */
- error = glGetError();
-
- if (error) {
- glDeleteTextures(1, (GLuint *)&bindcode);
- }
- else {
- image->gputexture[TEXTARGET_TEXTURE_2D] = GPU_texture_from_bindcode(GL_TEXTURE_2D, bindcode);
- }
-
- BKE_image_release_ibuf(image, ibuf, lock);
-
- return error;
+ GPUTexture *tex = image->gputexture[TEXTARGET_TEXTURE_2D];
+ int error = GL_NO_ERROR;
+
+ if (tex)
+ return error;
+
+ ImageUser iuser = {NULL};
+ iuser.framenr = frame;
+ iuser.ok = true;
+
+ void *lock;
+ ImBuf *ibuf = BKE_image_acquire_ibuf(image, &iuser, &lock);
+
+ /* clean glError buffer */
+ while (glGetError() != GL_NO_ERROR) {
+ }
+
+ if (ibuf == NULL || ibuf->rect == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "Image '%s' does not have any image data", image->id.name + 2);
+ BKE_image_release_ibuf(image, ibuf, lock);
+ return (int)GL_INVALID_OPERATION;
+ }
+
+ unsigned int bindcode = 0;
+ GPU_create_gl_tex(&bindcode,
+ ibuf->rect,
+ ibuf->rect_float,
+ ibuf->x,
+ ibuf->y,
+ GL_TEXTURE_2D,
+ (filter != GL_NEAREST && filter != GL_LINEAR),
+ false,
+ image);
+
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, (GLint)filter);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, (GLint)mag);
+
+ /* TODO(merwin): validate input (dimensions, filter, mag) before calling OpenGL
+ * instead of trusting input & testing for error after */
+ error = glGetError();
+
+ if (error) {
+ glDeleteTextures(1, (GLuint *)&bindcode);
+ }
+ else {
+ image->gputexture[TEXTARGET_TEXTURE_2D] = GPU_texture_from_bindcode(GL_TEXTURE_2D, bindcode);
+ }
+
+ BKE_image_release_ibuf(image, ibuf, lock);
+
+ return error;
}
static int rna_Image_gl_touch(Image *image, ReportList *reports, int frame, int filter, int mag)
{
- int error = GL_NO_ERROR;
+ int error = GL_NO_ERROR;
- BKE_image_tag_time(image);
+ BKE_image_tag_time(image);
- if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL)
- error = rna_Image_gl_load(image, reports, frame, filter, mag);
+ if (image->gputexture[TEXTARGET_TEXTURE_2D] == NULL)
+ error = rna_Image_gl_load(image, reports, frame, filter, mag);
- return error;
+ return error;
}
static void rna_Image_gl_free(Image *image)
{
- GPU_free_image(image);
+ GPU_free_image(image);
- /* remove the nocollect flag, image is available for garbage collection again */
- image->flag &= ~IMA_NOCOLLECT;
+ /* remove the nocollect flag, image is available for garbage collection again */
+ image->flag &= ~IMA_NOCOLLECT;
}
static void rna_Image_filepath_from_user(Image *image, ImageUser *image_user, char *filepath)
{
- BKE_image_user_file_path(image_user, image, filepath);
+ BKE_image_user_file_path(image_user, image, filepath);
}
static void rna_Image_buffers_free(Image *image)
{
- BKE_image_free_buffers_ex(image, true);
+ BKE_image_free_buffers_ex(image, true);
}
#else
void RNA_api_image_packed_file(StructRNA *srna)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = RNA_def_function(srna, "save", "rna_ImagePackedFile_save");
- RNA_def_function_ui_description(func, "Save the packed file to its filepath");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ func = RNA_def_function(srna, "save", "rna_ImagePackedFile_save");
+ RNA_def_function_ui_description(func, "Save the packed file to its filepath");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
}
void RNA_api_image(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "save_render", "rna_Image_save_render");
- RNA_def_function_ui_description(func, "Save image to a specific path using a scenes render settings");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "Save path");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from");
-
- func = RNA_def_function(srna, "save", "rna_Image_save");
- RNA_def_function_ui_description(func, "Save image to its source path");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
-
- func = RNA_def_function(srna, "pack", "rna_Image_pack");
- RNA_def_function_ui_description(func, "Pack an image as embedded data into the .blend file");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_boolean(func, "as_png", 0, "as_png", "Pack the image as PNG (needed for generated/dirty images)");
- parm = RNA_def_property(func, "data", PROP_STRING, PROP_BYTESTRING);
- RNA_def_property_ui_text(parm, "data", "Raw data (bytes, exact content of the embedded file)");
- RNA_def_int(func, "data_len", 0, 0, INT_MAX,
- "data_len", "length of given data (mandatory if data is provided)", 0, INT_MAX);
-
- func = RNA_def_function(srna, "unpack", "rna_Image_unpack");
- RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- RNA_def_enum(func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
-
- func = RNA_def_function(srna, "reload", "rna_Image_reload");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Reload the image from its source path");
-
- func = RNA_def_function(srna, "update", "rna_Image_update");
- RNA_def_function_ui_description(func, "Update the display image from the floating point buffer");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
-
- func = RNA_def_function(srna, "scale", "rna_Image_scale");
- RNA_def_function_ui_description(func, "Scale the image in pixels");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "width", 1, 1, 10000, "", "Width", 1, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "height", 1, 1, 10000, "", "Height", 1, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch");
- RNA_def_function_ui_description(func, "Delay the image from being cleaned from the cache due inactivity");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_int(func, "frame", 0, 0, INT_MAX, "Frame",
- "Frame of image sequence or movie", 0, INT_MAX);
- RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
- "The texture minifying function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
- RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
- "The texture magnification function to use if the image wasn't loaded", -INT_MAX, INT_MAX);
- /* return value */
- parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "gl_load", "rna_Image_gl_load");
- RNA_def_function_ui_description(func, "Load the image into OpenGL graphics memory");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_int(func, "frame", 0, 0, INT_MAX, "Frame",
- "Frame of image sequence or movie", 0, INT_MAX);
- RNA_def_int(func, "filter", GL_LINEAR_MIPMAP_NEAREST, -INT_MAX, INT_MAX, "Filter",
- "The texture minifying function", -INT_MAX, INT_MAX);
- RNA_def_int(func, "mag", GL_LINEAR, -INT_MAX, INT_MAX, "Magnification",
- "The texture magnification function", -INT_MAX, INT_MAX);
- /* return value */
- parm = RNA_def_int(func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free");
- RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory");
-
- /* path to an frame specified by image user */
- func = RNA_def_function(srna, "filepath_from_user", "rna_Image_filepath_from_user");
- RNA_def_function_ui_description(func, "Return the absolute path to the filepath of an image frame specified by the image user");
- RNA_def_pointer(func, "image_user", "ImageUser", "", "Image user of the image to get filepath for");
- parm = RNA_def_string_file_path(func, "filepath", NULL, FILE_MAX, "File Path",
- "The resulting filepath from the image and it's user");
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
- RNA_def_function_output(func, parm);
-
- func = RNA_def_function(srna, "buffers_free", "rna_Image_buffers_free");
- RNA_def_function_ui_description(func, "Free the image buffers from memory");
-
- /* TODO, pack/unpack, maybe should be generic functions? */
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "save_render", "rna_Image_save_render");
+ RNA_def_function_ui_description(func,
+ "Save image to a specific path using a scenes render settings");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "Save path");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_pointer(func, "scene", "Scene", "", "Scene to take image parameters from");
+
+ func = RNA_def_function(srna, "save", "rna_Image_save");
+ RNA_def_function_ui_description(func, "Save image to its source path");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+
+ func = RNA_def_function(srna, "pack", "rna_Image_pack");
+ RNA_def_function_ui_description(func, "Pack an image as embedded data into the .blend file");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_boolean(
+ func, "as_png", 0, "as_png", "Pack the image as PNG (needed for generated/dirty images)");
+ parm = RNA_def_property(func, "data", PROP_STRING, PROP_BYTESTRING);
+ RNA_def_property_ui_text(parm, "data", "Raw data (bytes, exact content of the embedded file)");
+ RNA_def_int(func,
+ "data_len",
+ 0,
+ 0,
+ INT_MAX,
+ "data_len",
+ "length of given data (mandatory if data is provided)",
+ 0,
+ INT_MAX);
+
+ func = RNA_def_function(srna, "unpack", "rna_Image_unpack");
+ RNA_def_function_ui_description(func, "Save an image packed in the .blend file to disk");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ RNA_def_enum(
+ func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
+
+ func = RNA_def_function(srna, "reload", "rna_Image_reload");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Reload the image from its source path");
+
+ func = RNA_def_function(srna, "update", "rna_Image_update");
+ RNA_def_function_ui_description(func, "Update the display image from the floating point buffer");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+
+ func = RNA_def_function(srna, "scale", "rna_Image_scale");
+ RNA_def_function_ui_description(func, "Scale the image in pixels");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(func, "width", 1, 1, 10000, "", "Width", 1, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "height", 1, 1, 10000, "", "Height", 1, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "gl_touch", "rna_Image_gl_touch");
+ RNA_def_function_ui_description(
+ func, "Delay the image from being cleaned from the cache due inactivity");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(
+ func, "frame", 0, 0, INT_MAX, "Frame", "Frame of image sequence or movie", 0, INT_MAX);
+ RNA_def_int(func,
+ "filter",
+ GL_LINEAR_MIPMAP_NEAREST,
+ -INT_MAX,
+ INT_MAX,
+ "Filter",
+ "The texture minifying function to use if the image wasn't loaded",
+ -INT_MAX,
+ INT_MAX);
+ RNA_def_int(func,
+ "mag",
+ GL_LINEAR,
+ -INT_MAX,
+ INT_MAX,
+ "Magnification",
+ "The texture magnification function to use if the image wasn't loaded",
+ -INT_MAX,
+ INT_MAX);
+ /* return value */
+ parm = RNA_def_int(
+ func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "gl_load", "rna_Image_gl_load");
+ RNA_def_function_ui_description(func, "Load the image into OpenGL graphics memory");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(
+ func, "frame", 0, 0, INT_MAX, "Frame", "Frame of image sequence or movie", 0, INT_MAX);
+ RNA_def_int(func,
+ "filter",
+ GL_LINEAR_MIPMAP_NEAREST,
+ -INT_MAX,
+ INT_MAX,
+ "Filter",
+ "The texture minifying function",
+ -INT_MAX,
+ INT_MAX);
+ RNA_def_int(func,
+ "mag",
+ GL_LINEAR,
+ -INT_MAX,
+ INT_MAX,
+ "Magnification",
+ "The texture magnification function",
+ -INT_MAX,
+ INT_MAX);
+ /* return value */
+ parm = RNA_def_int(
+ func, "error", 0, -INT_MAX, INT_MAX, "Error", "OpenGL error value", -INT_MAX, INT_MAX);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "gl_free", "rna_Image_gl_free");
+ RNA_def_function_ui_description(func, "Free the image from OpenGL graphics memory");
+
+ /* path to an frame specified by image user */
+ func = RNA_def_function(srna, "filepath_from_user", "rna_Image_filepath_from_user");
+ RNA_def_function_ui_description(
+ func,
+ "Return the absolute path to the filepath of an image frame specified by the image user");
+ RNA_def_pointer(
+ func, "image_user", "ImageUser", "", "Image user of the image to get filepath for");
+ parm = RNA_def_string_file_path(func,
+ "filepath",
+ NULL,
+ FILE_MAX,
+ "File Path",
+ "The resulting filepath from the image and it's user");
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
+ RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(srna, "buffers_free", "rna_Image_buffers_free");
+ RNA_def_function_ui_description(func, "Free the image buffers from memory");
+
+ /* TODO, pack/unpack, maybe should be generic functions? */
}
#endif
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index c5e677f3626..3653f28c880 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -46,76 +46,76 @@ struct ViewLayer;
/* Data structures used during define */
typedef struct ContainerDefRNA {
- void *next, *prev;
+ void *next, *prev;
- ContainerRNA *cont;
- ListBase properties;
+ ContainerRNA *cont;
+ ListBase properties;
} ContainerDefRNA;
typedef struct FunctionDefRNA {
- ContainerDefRNA cont;
+ ContainerDefRNA cont;
- FunctionRNA *func;
- const char *srna;
- const char *call;
- const char *gencall;
+ FunctionRNA *func;
+ const char *srna;
+ const char *call;
+ const char *gencall;
} FunctionDefRNA;
typedef struct PropertyDefRNA {
- struct PropertyDefRNA *next, *prev;
+ struct PropertyDefRNA *next, *prev;
- struct ContainerRNA *cont;
- struct PropertyRNA *prop;
+ struct ContainerRNA *cont;
+ struct PropertyRNA *prop;
- /* struct */
- const char *dnastructname;
- const char *dnastructfromname;
- const char *dnastructfromprop;
+ /* struct */
+ const char *dnastructname;
+ const char *dnastructfromname;
+ const char *dnastructfromprop;
- /* property */
- const char *dnaname;
- const char *dnatype;
- int dnaarraylength;
- int dnapointerlevel;
+ /* property */
+ const char *dnaname;
+ const char *dnatype;
+ int dnaarraylength;
+ int dnapointerlevel;
- /* for finding length of array collections */
- const char *dnalengthstructname;
- const char *dnalengthname;
- int dnalengthfixed;
+ /* for finding length of array collections */
+ const char *dnalengthstructname;
+ const char *dnalengthname;
+ int dnalengthfixed;
- int booleanbit, booleannegative;
+ int booleanbit, booleannegative;
- /* not to be confused with PROP_ENUM_FLAG
- * this only allows one of the flags to be set at a time, clearing all others */
- int enumbitflags;
+ /* not to be confused with PROP_ENUM_FLAG
+ * this only allows one of the flags to be set at a time, clearing all others */
+ int enumbitflags;
} PropertyDefRNA;
typedef struct StructDefRNA {
- ContainerDefRNA cont;
+ ContainerDefRNA cont;
- struct StructRNA *srna;
- const char *filename;
+ struct StructRNA *srna;
+ const char *filename;
- const char *dnaname;
+ const char *dnaname;
- /* for derived structs to find data in some property */
- const char *dnafromname;
- const char *dnafromprop;
+ /* for derived structs to find data in some property */
+ const char *dnafromname;
+ const char *dnafromprop;
- ListBase functions;
+ ListBase functions;
} StructDefRNA;
typedef struct AllocDefRNA {
- struct AllocDefRNA *next, *prev;
- void *mem;
+ struct AllocDefRNA *next, *prev;
+ void *mem;
} AllocDefRNA;
typedef struct BlenderDefRNA {
- struct SDNA *sdna;
- ListBase structs;
- ListBase allocs;
- struct StructRNA *laststruct;
- int error, silent, preprocess, verify, animate;
+ struct SDNA *sdna;
+ ListBase structs;
+ ListBase allocs;
+ struct StructRNA *laststruct;
+ int error, silent, preprocess, verify, animate;
} BlenderDefRNA;
extern BlenderDefRNA DefRNA;
@@ -198,13 +198,20 @@ void RNA_def_mask(struct BlenderRNA *brna);
void rna_def_animdata_common(struct StructRNA *srna);
-bool rna_AnimaData_override_apply(
- struct Main *bmain,
- struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
- struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
- const int len_local, const int len_reference, const int len_storage,
- struct PointerRNA *ptr_item_local, struct PointerRNA *ptr_item_reference, struct PointerRNA *ptr_item_storage,
- struct IDOverrideStaticPropertyOperation *opop);
+bool rna_AnimaData_override_apply(struct Main *bmain,
+ struct PointerRNA *ptr_local,
+ struct PointerRNA *ptr_reference,
+ struct PointerRNA *ptr_storage,
+ struct PropertyRNA *prop_local,
+ struct PropertyRNA *prop_reference,
+ struct PropertyRNA *prop_storage,
+ const int len_local,
+ const int len_reference,
+ const int len_storage,
+ struct PointerRNA *ptr_item_local,
+ struct PointerRNA *ptr_item_reference,
+ struct PointerRNA *ptr_item_storage,
+ struct IDOverrideStaticPropertyOperation *opop);
void rna_def_animviz_common(struct StructRNA *srna);
void rna_def_motionpath_common(struct StructRNA *srna);
@@ -212,13 +219,22 @@ void rna_def_motionpath_common(struct StructRNA *srna);
void rna_def_bone_curved_common(struct StructRNA *srna, bool is_posebone);
void rna_def_texmat_common(struct StructRNA *srna, const char *texspace_editable);
-void rna_def_mtex_common(struct BlenderRNA *brna, struct StructRNA *srna, const char *begin, const char *activeget,
- const char *activeset, const char *activeeditable, const char *structname,
- const char *structname_slots, const char *update, const char *update_index);
+void rna_def_mtex_common(struct BlenderRNA *brna,
+ struct StructRNA *srna,
+ const char *begin,
+ const char *activeget,
+ const char *activeset,
+ const char *activeeditable,
+ const char *structname,
+ const char *structname_slots,
+ const char *update,
+ const char *update_index);
void rna_def_texpaint_slots(struct BlenderRNA *brna, struct StructRNA *srna);
void rna_def_view_layer_common(struct StructRNA *srna, const bool scene);
-void rna_def_actionbone_group_common(struct StructRNA *srna, int update_flag, const char *update_cb);
+void rna_def_actionbone_group_common(struct StructRNA *srna,
+ int update_flag,
+ const char *update_cb);
void rna_ActionGroup_colorset_set(struct PointerRNA *ptr, int value);
bool rna_ActionGroup_is_custom_colorset_get(struct PointerRNA *ptr);
@@ -231,17 +247,30 @@ void rna_ID_fake_user_set(struct PointerRNA *ptr, bool value);
void **rna_ID_instance(PointerRNA *ptr);
struct IDProperty *rna_PropertyGroup_idprops(struct PointerRNA *ptr, bool create);
void rna_PropertyGroup_unregister(struct Main *bmain, struct StructRNA *type);
-struct StructRNA *rna_PropertyGroup_register(struct Main *bmain, struct ReportList *reports, void *data,
- const char *identifier, StructValidateFunc validate,
- StructCallbackFunc call, StructFreeFunc free);
+struct StructRNA *rna_PropertyGroup_register(struct Main *bmain,
+ struct ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free);
struct StructRNA *rna_PropertyGroup_refine(struct PointerRNA *ptr);
void rna_object_vgroup_name_index_get(struct PointerRNA *ptr, char *value, int index);
int rna_object_vgroup_name_index_length(struct PointerRNA *ptr, int index);
void rna_object_vgroup_name_index_set(struct PointerRNA *ptr, const char *value, short *index);
-void rna_object_vgroup_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
-void rna_object_uvlayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
-void rna_object_vcollayer_name_set(struct PointerRNA *ptr, const char *value, char *result, int maxlen);
+void rna_object_vgroup_name_set(struct PointerRNA *ptr,
+ const char *value,
+ char *result,
+ int maxlen);
+void rna_object_uvlayer_name_set(struct PointerRNA *ptr,
+ const char *value,
+ char *result,
+ int maxlen);
+void rna_object_vcollayer_name_set(struct PointerRNA *ptr,
+ const char *value,
+ char *result,
+ int maxlen);
PointerRNA rna_object_shapekey_index_get(struct ID *id, int value);
int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current);
@@ -249,28 +278,43 @@ int rna_object_shapekey_index_set(struct ID *id, PointerRNA value, int current);
void rna_def_freestyle_settings(struct BlenderRNA *brna);
struct PointerRNA rna_FreestyleLineSet_linestyle_get(struct PointerRNA *ptr);
void rna_FreestyleLineSet_linestyle_set(struct PointerRNA *ptr, struct PointerRNA value);
-struct FreestyleLineSet *rna_FreestyleSettings_lineset_add(
- struct ID *id, struct FreestyleSettings *config, struct Main *bmain, const char *name);
-void rna_FreestyleSettings_lineset_remove(
- struct ID *id, struct FreestyleSettings *config, struct ReportList *reports, struct PointerRNA *lineset_ptr);
+struct FreestyleLineSet *rna_FreestyleSettings_lineset_add(struct ID *id,
+ struct FreestyleSettings *config,
+ struct Main *bmain,
+ const char *name);
+void rna_FreestyleSettings_lineset_remove(struct ID *id,
+ struct FreestyleSettings *config,
+ struct ReportList *reports,
+ struct PointerRNA *lineset_ptr);
struct PointerRNA rna_FreestyleSettings_active_lineset_get(struct PointerRNA *ptr);
void rna_FreestyleSettings_active_lineset_index_range(
- struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
+ struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
int rna_FreestyleSettings_active_lineset_index_get(struct PointerRNA *ptr);
void rna_FreestyleSettings_active_lineset_index_set(struct PointerRNA *ptr, int value);
-struct FreestyleModuleConfig *rna_FreestyleSettings_module_add(struct ID *id, struct FreestyleSettings *config);
-void rna_FreestyleSettings_module_remove(
- struct ID *id, struct FreestyleSettings *config, struct ReportList *reports, struct PointerRNA *module_ptr);
-
-void rna_Scene_use_view_map_cache_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
+struct FreestyleModuleConfig *rna_FreestyleSettings_module_add(struct ID *id,
+ struct FreestyleSettings *config);
+void rna_FreestyleSettings_module_remove(struct ID *id,
+ struct FreestyleSettings *config,
+ struct ReportList *reports,
+ struct PointerRNA *module_ptr);
+
+void rna_Scene_use_view_map_cache_update(struct Main *bmain,
+ struct Scene *scene,
+ struct PointerRNA *ptr);
void rna_Scene_glsl_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
void rna_Scene_freestyle_update(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
void rna_ViewLayer_name_set(struct PointerRNA *ptr, const char *value);
-void rna_ViewLayer_material_override_update(struct Main *bmain, struct Scene *activescene, struct PointerRNA *ptr);
-void rna_ViewLayer_pass_update(struct Main *bmain, struct Scene *activescene, struct PointerRNA *ptr);
+void rna_ViewLayer_material_override_update(struct Main *bmain,
+ struct Scene *activescene,
+ struct PointerRNA *ptr);
+void rna_ViewLayer_pass_update(struct Main *bmain,
+ struct Scene *activescene,
+ struct PointerRNA *ptr);
/* named internal so as not to conflict with obj.update() rna func */
-void rna_Object_internal_update_data(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
+void rna_Object_internal_update_data(struct Main *bmain,
+ struct Scene *scene,
+ struct PointerRNA *ptr);
void rna_Mesh_update_draw(struct Main *bmain, struct Scene *scene, struct PointerRNA *ptr);
void rna_TextureSlot_update(struct bContext *C, struct PointerRNA *ptr);
@@ -288,7 +332,8 @@ bool rna_Action_id_poll(struct PointerRNA *ptr, struct PointerRNA value);
bool rna_Action_actedit_assign_poll(struct PointerRNA *ptr, struct PointerRNA value);
/* Grease Pencil datablock polling functions - for filtering GP Object vs Annotation datablocks */
-bool rna_GPencil_datablocks_annotations_poll(struct PointerRNA *ptr, const struct PointerRNA value);
+bool rna_GPencil_datablocks_annotations_poll(struct PointerRNA *ptr,
+ const struct PointerRNA value);
bool rna_GPencil_datablocks_obdata_poll(struct PointerRNA *ptr, const struct PointerRNA value);
char *rna_TextureSlot_path(struct PointerRNA *ptr);
@@ -399,7 +444,8 @@ extern StructRNA RNA_PropertyGroup;
#endif
struct IDProperty *rna_idproperty_check(struct PropertyRNA **prop, struct PointerRNA *ptr);
-struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, struct PointerRNA *ptr);
+struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop,
+ struct PointerRNA *ptr);
/* Override default callbacks. */
/* Default override callbacks for all types. */
@@ -407,30 +453,45 @@ struct PropertyRNA *rna_ensure_property_realdata(struct PropertyRNA **prop, stru
* (like we do for default get/set/etc.)?
* Not obvious though, those are fairly more complicated than basic SDNA access.
*/
-int rna_property_override_diff_default(
- struct Main *bmain,
- struct PointerRNA *ptr_a, struct PointerRNA *ptr_b,
- struct PropertyRNA *prop_a, struct PropertyRNA *prop_b,
- const int len_a, const int len_b,
- const int mode,
- struct IDOverrideStatic *override, const char *rna_path,
- const int flags, bool *r_override_changed);
-
-bool rna_property_override_store_default(
- struct Main *bmain,
- struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
- struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
- const int len_local, const int len_reference, const int len_storage,
- struct IDOverrideStaticPropertyOperation *opop);
-
-bool rna_property_override_apply_default(
- struct Main *bmain,
- struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
- struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
- const int len_dst, const int len_src, const int len_storage,
- struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage,
- struct IDOverrideStaticPropertyOperation *opop);
-
+int rna_property_override_diff_default(struct Main *bmain,
+ struct PointerRNA *ptr_a,
+ struct PointerRNA *ptr_b,
+ struct PropertyRNA *prop_a,
+ struct PropertyRNA *prop_b,
+ const int len_a,
+ const int len_b,
+ const int mode,
+ struct IDOverrideStatic *override,
+ const char *rna_path,
+ const int flags,
+ bool *r_override_changed);
+
+bool rna_property_override_store_default(struct Main *bmain,
+ struct PointerRNA *ptr_local,
+ struct PointerRNA *ptr_reference,
+ struct PointerRNA *ptr_storage,
+ struct PropertyRNA *prop_local,
+ struct PropertyRNA *prop_reference,
+ struct PropertyRNA *prop_storage,
+ const int len_local,
+ const int len_reference,
+ const int len_storage,
+ struct IDOverrideStaticPropertyOperation *opop);
+
+bool rna_property_override_apply_default(struct Main *bmain,
+ struct PointerRNA *ptr_dst,
+ struct PointerRNA *ptr_src,
+ struct PointerRNA *ptr_storage,
+ struct PropertyRNA *prop_dst,
+ struct PropertyRNA *prop_src,
+ struct PropertyRNA *prop_storage,
+ const int len_dst,
+ const int len_src,
+ const int len_storage,
+ struct PointerRNA *ptr_item_dst,
+ struct PointerRNA *ptr_item_src,
+ struct PointerRNA *ptr_item_storage,
+ struct IDOverrideStaticPropertyOperation *opop);
/* Builtin Property Callbacks */
@@ -442,19 +503,29 @@ int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, Point
/* Iterators */
-void rna_iterator_listbase_begin(struct CollectionPropertyIterator *iter, struct ListBase *lb, IteratorSkipFunc skip);
+void rna_iterator_listbase_begin(struct CollectionPropertyIterator *iter,
+ struct ListBase *lb,
+ IteratorSkipFunc skip);
void rna_iterator_listbase_next(struct CollectionPropertyIterator *iter);
void *rna_iterator_listbase_get(struct CollectionPropertyIterator *iter);
void rna_iterator_listbase_end(struct CollectionPropertyIterator *iter);
-PointerRNA rna_listbase_lookup_int(PointerRNA *ptr, StructRNA *type, struct ListBase *lb, int index);
-
-void rna_iterator_array_begin(struct CollectionPropertyIterator *iter, void *ptr, int itemsize, int length,
- bool free_ptr, IteratorSkipFunc skip);
+PointerRNA rna_listbase_lookup_int(PointerRNA *ptr,
+ StructRNA *type,
+ struct ListBase *lb,
+ int index);
+
+void rna_iterator_array_begin(struct CollectionPropertyIterator *iter,
+ void *ptr,
+ int itemsize,
+ int length,
+ bool free_ptr,
+ IteratorSkipFunc skip);
void rna_iterator_array_next(struct CollectionPropertyIterator *iter);
void *rna_iterator_array_get(struct CollectionPropertyIterator *iter);
void *rna_iterator_array_dereference_get(struct CollectionPropertyIterator *iter);
void rna_iterator_array_end(struct CollectionPropertyIterator *iter);
-PointerRNA rna_array_lookup_int(PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index);
+PointerRNA rna_array_lookup_int(
+ PointerRNA *ptr, StructRNA *type, void *data, int itemsize, int length, int index);
/* Duplicated code since we can't link in blenlib */
@@ -476,20 +547,35 @@ PointerRNA rna_pointer_inherit_refine(struct PointerRNA *ptr, struct StructRNA *
int rna_parameter_size(struct PropertyRNA *parm);
-struct Mesh *rna_Main_meshes_new_from_object(
- struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph,
- struct Object *ob, bool apply_modifiers, bool calc_undeformed);
+struct Mesh *rna_Main_meshes_new_from_object(struct Main *bmain,
+ struct ReportList *reports,
+ struct Depsgraph *depsgraph,
+ struct Object *ob,
+ bool apply_modifiers,
+ bool calc_undeformed);
/* XXX, these should not need to be defined here~! */
-struct MTex *rna_mtex_texture_slots_add(struct ID *self, struct bContext *C, struct ReportList *reports);
-struct MTex *rna_mtex_texture_slots_create(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
-void rna_mtex_texture_slots_clear(struct ID *self, struct bContext *C, struct ReportList *reports, int index);
-
-
-int rna_IDMaterials_assign_int(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr);
-
-const char *rna_translate_ui_text(
- const char *text, const char *text_ctxt, struct StructRNA *type, struct PropertyRNA *prop, bool translate);
+struct MTex *rna_mtex_texture_slots_add(struct ID *self,
+ struct bContext *C,
+ struct ReportList *reports);
+struct MTex *rna_mtex_texture_slots_create(struct ID *self,
+ struct bContext *C,
+ struct ReportList *reports,
+ int index);
+void rna_mtex_texture_slots_clear(struct ID *self,
+ struct bContext *C,
+ struct ReportList *reports,
+ int index);
+
+int rna_IDMaterials_assign_int(struct PointerRNA *ptr,
+ int key,
+ const struct PointerRNA *assign_ptr);
+
+const char *rna_translate_ui_text(const char *text,
+ const char *text_ctxt,
+ struct StructRNA *type,
+ struct PropertyRNA *prop,
+ bool translate);
/* Internal functions that cycles uses so we need to declare (tsk tsk) */
void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values);
@@ -504,20 +590,25 @@ void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values);
#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
# define USE_RNA_RANGE_CHECK
# define TYPEOF_MAX(x) \
- _Generic((x), \
- bool: 1, \
- char: CHAR_MAX, signed char: SCHAR_MAX, unsigned char: UCHAR_MAX, \
- signed short: SHRT_MAX, unsigned short: USHRT_MAX, \
- signed int: INT_MAX, unsigned int: UINT_MAX, \
- float: FLT_MAX, double: DBL_MAX)
+ _Generic((x), bool : 1, char \
+ : CHAR_MAX, signed char \
+ : SCHAR_MAX, unsigned char \
+ : UCHAR_MAX, signed short \
+ : SHRT_MAX, unsigned short \
+ : USHRT_MAX, signed int \
+ : INT_MAX, unsigned int \
+ : UINT_MAX, float \
+ : FLT_MAX, double \
+ : DBL_MAX)
# define TYPEOF_MIN(x) \
- _Generic((x), \
- bool: 0, \
- char: CHAR_MIN, signed char: SCHAR_MIN, unsigned char: 0, \
- signed short: SHRT_MIN, unsigned short: 0, \
- signed int: INT_MIN, unsigned int: 0, \
- float: -FLT_MAX, double: -DBL_MAX)
+ _Generic((x), bool : 0, char \
+ : CHAR_MIN, signed char \
+ : SCHAR_MIN, unsigned char : 0, signed short \
+ : SHRT_MIN, unsigned short : 0, signed int \
+ : INT_MIN, unsigned int : 0, float \
+ : -FLT_MAX, double \
+ : -DBL_MAX)
#endif
-#endif /* __RNA_INTERNAL_H__ */
+#endif /* __RNA_INTERNAL_H__ */
diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h
index 11fb7856af2..93409a7d008 100644
--- a/source/blender/makesrna/intern/rna_internal_types.h
+++ b/source/blender/makesrna/intern/rna_internal_types.h
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#ifndef __RNA_INTERNAL_TYPES_H__
#define __RNA_INTERNAL_TYPES_H__
@@ -48,7 +47,9 @@ struct bContext;
/* Function Callbacks */
typedef void (*UpdateFunc)(struct Main *main, struct Scene *scene, struct PointerRNA *ptr);
-typedef void (*ContextPropUpdateFunc)(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop);
+typedef void (*ContextPropUpdateFunc)(struct bContext *C,
+ struct PointerRNA *ptr,
+ struct PropertyRNA *prop);
typedef void (*ContextUpdateFunc)(struct bContext *C, struct PointerRNA *ptr);
typedef int (*EditableFunc)(struct PointerRNA *ptr, const char **r_info);
typedef int (*ItemEditableFunc)(struct PointerRNA *ptr, int index);
@@ -65,52 +66,88 @@ typedef int (*PropIntGetFunc)(struct PointerRNA *ptr);
typedef void (*PropIntSetFunc)(struct PointerRNA *ptr, int value);
typedef void (*PropIntArrayGetFunc)(struct PointerRNA *ptr, int *values);
typedef void (*PropIntArraySetFunc)(struct PointerRNA *ptr, const int *values);
-typedef void (*PropIntRangeFunc)(struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
+typedef void (*PropIntRangeFunc)(
+ struct PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax);
typedef float (*PropFloatGetFunc)(struct PointerRNA *ptr);
typedef void (*PropFloatSetFunc)(struct PointerRNA *ptr, float value);
typedef void (*PropFloatArrayGetFunc)(struct PointerRNA *ptr, float *values);
typedef void (*PropFloatArraySetFunc)(struct PointerRNA *ptr, const float *values);
-typedef void (*PropFloatRangeFunc)(struct PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax);
+typedef void (*PropFloatRangeFunc)(
+ struct PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax);
typedef void (*PropStringGetFunc)(struct PointerRNA *ptr, char *value);
typedef int (*PropStringLengthFunc)(struct PointerRNA *ptr);
typedef void (*PropStringSetFunc)(struct PointerRNA *ptr, const char *value);
typedef int (*PropEnumGetFunc)(struct PointerRNA *ptr);
typedef void (*PropEnumSetFunc)(struct PointerRNA *ptr, int value);
-typedef const EnumPropertyItem *(*PropEnumItemFunc)(
- struct bContext *C, struct PointerRNA *ptr,
- struct PropertyRNA *prop, bool *r_free);
+typedef const EnumPropertyItem *(*PropEnumItemFunc)(struct bContext *C,
+ struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ bool *r_free);
typedef PointerRNA (*PropPointerGetFunc)(struct PointerRNA *ptr);
typedef StructRNA *(*PropPointerTypeFunc)(struct PointerRNA *ptr);
typedef void (*PropPointerSetFunc)(struct PointerRNA *ptr, const PointerRNA value);
typedef bool (*PropPointerPollFunc)(struct PointerRNA *ptr, const PointerRNA value);
-typedef bool (*PropPointerPollFuncPy)(struct PointerRNA *ptr, const PointerRNA value, const PropertyRNA *prop);
-typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter, struct PointerRNA *ptr);
+typedef bool (*PropPointerPollFuncPy)(struct PointerRNA *ptr,
+ const PointerRNA value,
+ const PropertyRNA *prop);
+typedef void (*PropCollectionBeginFunc)(struct CollectionPropertyIterator *iter,
+ struct PointerRNA *ptr);
typedef void (*PropCollectionNextFunc)(struct CollectionPropertyIterator *iter);
typedef void (*PropCollectionEndFunc)(struct CollectionPropertyIterator *iter);
typedef PointerRNA (*PropCollectionGetFunc)(struct CollectionPropertyIterator *iter);
typedef int (*PropCollectionLengthFunc)(struct PointerRNA *ptr);
-typedef int (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr, int key, struct PointerRNA *r_ptr);
-typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr, const char *key, struct PointerRNA *r_ptr);
-typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr, int key, const struct PointerRNA *assign_ptr);
+typedef int (*PropCollectionLookupIntFunc)(struct PointerRNA *ptr,
+ int key,
+ struct PointerRNA *r_ptr);
+typedef int (*PropCollectionLookupStringFunc)(struct PointerRNA *ptr,
+ const char *key,
+ struct PointerRNA *r_ptr);
+typedef int (*PropCollectionAssignIntFunc)(struct PointerRNA *ptr,
+ int key,
+ const struct PointerRNA *assign_ptr);
/* extended versions with PropertyRNA argument */
typedef bool (*PropBooleanGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
typedef void (*PropBooleanSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool value);
-typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, bool *values);
-typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const bool *values);
+typedef void (*PropBooleanArrayGetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ bool *values);
+typedef void (*PropBooleanArraySetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ const bool *values);
typedef int (*PropIntGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
typedef void (*PropIntSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
-typedef void (*PropIntArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *values);
-typedef void (*PropIntArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const int *values);
-typedef void (*PropIntRangeFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int *min, int *max, int *softmin, int *softmax);
+typedef void (*PropIntArrayGetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ int *values);
+typedef void (*PropIntArraySetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ const int *values);
+typedef void (*PropIntRangeFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ int *min,
+ int *max,
+ int *softmin,
+ int *softmax);
typedef float (*PropFloatGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
typedef void (*PropFloatSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, float value);
-typedef void (*PropFloatArrayGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *values);
-typedef void (*PropFloatArraySetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const float *values);
-typedef void (*PropFloatRangeFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, float *min, float *max, float *softmin, float *softmax);
+typedef void (*PropFloatArrayGetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ float *values);
+typedef void (*PropFloatArraySetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ const float *values);
+typedef void (*PropFloatRangeFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ float *min,
+ float *max,
+ float *softmin,
+ float *softmax);
typedef void (*PropStringGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, char *value);
typedef int (*PropStringLengthFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
-typedef void (*PropStringSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, const char *value);
+typedef void (*PropStringSetFuncEx)(struct PointerRNA *ptr,
+ struct PropertyRNA *prop,
+ const char *value);
typedef int (*PropEnumGetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop);
typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *prop, int value);
@@ -126,14 +163,18 @@ typedef void (*PropEnumSetFuncEx)(struct PointerRNA *ptr, struct PropertyRNA *pr
* \note In non-array cases, \a len values are 0.
* \note \a override, \a rna_path and \a r_override_changed may be NULL pointers.
*/
-typedef int (*RNAPropOverrideDiff)(
- struct Main *bmain,
- struct PointerRNA *ptr_a, struct PointerRNA *ptr_b,
- struct PropertyRNA *prop_a, struct PropertyRNA *prop_b,
- const int len_a, const int len_b,
- const int mode,
- struct IDOverrideStatic *override, const char *rna_path,
- const int flags, bool *r_override_changed);
+typedef int (*RNAPropOverrideDiff)(struct Main *bmain,
+ struct PointerRNA *ptr_a,
+ struct PointerRNA *ptr_b,
+ struct PropertyRNA *prop_a,
+ struct PropertyRNA *prop_b,
+ const int len_a,
+ const int len_b,
+ const int mode,
+ struct IDOverrideStatic *override,
+ const char *rna_path,
+ const int flags,
+ bool *r_override_changed);
/**
* Only used for differential override (add, sub, etc.).
@@ -144,12 +185,17 @@ typedef int (*RNAPropOverrideDiff)(
* \note Might change given override operation (e.g. change 'add' one into 'sub'), in case computed storage value
* is out of range (or even change it to basic 'set' operation if nothing else works).
*/
-typedef bool (*RNAPropOverrideStore)(
- struct Main *bmain,
- struct PointerRNA *ptr_local, struct PointerRNA *ptr_reference, struct PointerRNA *ptr_storage,
- struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage,
- const int len_local, const int len_reference, const int len_storage,
- struct IDOverrideStaticPropertyOperation *opop);
+typedef bool (*RNAPropOverrideStore)(struct Main *bmain,
+ struct PointerRNA *ptr_local,
+ struct PointerRNA *ptr_reference,
+ struct PointerRNA *ptr_storage,
+ struct PropertyRNA *prop_local,
+ struct PropertyRNA *prop_reference,
+ struct PropertyRNA *prop_storage,
+ const int len_local,
+ const int len_reference,
+ const int len_storage,
+ struct IDOverrideStaticPropertyOperation *opop);
/**
* Apply given override operation from src to dst (using value from storage as second operand
@@ -158,306 +204,313 @@ typedef bool (*RNAPropOverrideStore)(
* \note Given PropertyRNA are final (in case of IDProps...).
* \note In non-array cases, \a len values are 0.
*/
-typedef bool (*RNAPropOverrideApply)(
- struct Main *bmain,
- struct PointerRNA *ptr_dst, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage,
- struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage,
- const int len_dst, const int len_src, const int len_storage,
- struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage,
- struct IDOverrideStaticPropertyOperation *opop);
+typedef bool (*RNAPropOverrideApply)(struct Main *bmain,
+ struct PointerRNA *ptr_dst,
+ struct PointerRNA *ptr_src,
+ struct PointerRNA *ptr_storage,
+ struct PropertyRNA *prop_dst,
+ struct PropertyRNA *prop_src,
+ struct PropertyRNA *prop_storage,
+ const int len_dst,
+ const int len_src,
+ const int len_storage,
+ struct PointerRNA *ptr_item_dst,
+ struct PointerRNA *ptr_item_src,
+ struct PointerRNA *ptr_item_storage,
+ struct IDOverrideStaticPropertyOperation *opop);
/* Container - generic abstracted container of RNA properties */
typedef struct ContainerRNA {
- void *next, *prev;
+ void *next, *prev;
- struct GHash *prophash;
- ListBase properties;
+ struct GHash *prophash;
+ ListBase properties;
} ContainerRNA;
struct FunctionRNA {
- /* structs are containers of properties */
- ContainerRNA cont;
+ /* structs are containers of properties */
+ ContainerRNA cont;
- /* unique identifier, keep after 'cont' */
- const char *identifier;
- /* various options */
- int flag;
+ /* unique identifier, keep after 'cont' */
+ const char *identifier;
+ /* various options */
+ int flag;
- /* single line description, displayed in the tooltip for example */
- const char *description;
+ /* single line description, displayed in the tooltip for example */
+ const char *description;
- /* callback to execute the function */
- CallFunc call;
+ /* callback to execute the function */
+ CallFunc call;
- /* parameter for the return value
- * note: this is only the C return value, rna functions can have multiple return values */
- PropertyRNA *c_ret;
+ /* parameter for the return value
+ * note: this is only the C return value, rna functions can have multiple return values */
+ PropertyRNA *c_ret;
};
struct PropertyRNA {
- struct PropertyRNA *next, *prev;
-
- /* magic bytes to distinguish with IDProperty */
- int magic;
-
- /* unique identifier */
- const char *identifier;
- /* various options */
- int flag;
- /* various override options */
- int flag_override;
- /* Function parameters flags. */
- short flag_parameter;
- /* Internal ("private") flags. */
- short flag_internal;
- /* The subset of StructRNA.prop_tag_defines values that applies to this property. */
- short tags;
-
- /* user readable name */
- const char *name;
- /* single line description, displayed in the tooltip for example */
- const char *description;
- /* icon ID */
- int icon;
- /* context for translation */
- const char *translation_context;
-
- /* property type as it appears to the outside */
- PropertyType type;
- /* subtype, 'interpretation' of the property */
- PropertySubType subtype;
- /* if non-NULL, overrides arraylength. Must not return 0? */
- PropArrayLengthGetFunc getlength;
- /* dimension of array */
- unsigned int arraydimension;
- /* array lengths lengths for all dimensions (when arraydimension > 0) */
- unsigned int arraylength[RNA_MAX_ARRAY_DIMENSION];
- unsigned int totarraylength;
-
- /* callback for updates on change */
- UpdateFunc update;
- int noteflag;
-
- /* Callback for testing if editable. Its r_info parameter can be used to
- * return info on editable state that might be shown to user. E.g. tooltips
- * of disabled buttons can show reason why button is disabled using this. */
- EditableFunc editable;
- /* callback for testing if array-item editable (if applicable) */
- ItemEditableFunc itemeditable;
-
- /* Override handling callbacks (diff is also used for comparison). */
- RNAPropOverrideDiff override_diff;
- RNAPropOverrideStore override_store;
- RNAPropOverrideApply override_apply;
-
- /* raw access */
- int rawoffset;
- RawPropertyType rawtype;
-
- /* This is used for accessing props/functions of this property
- * any property can have this but should only be used for collections and arrays
- * since python will convert int/bool/pointer's */
- struct StructRNA *srna; /* attributes attached directly to this collection */
-
- /* python handle to hold all callbacks
- * (in a pointer array at the moment, may later be a tuple) */
- void *py_data;
+ struct PropertyRNA *next, *prev;
+
+ /* magic bytes to distinguish with IDProperty */
+ int magic;
+
+ /* unique identifier */
+ const char *identifier;
+ /* various options */
+ int flag;
+ /* various override options */
+ int flag_override;
+ /* Function parameters flags. */
+ short flag_parameter;
+ /* Internal ("private") flags. */
+ short flag_internal;
+ /* The subset of StructRNA.prop_tag_defines values that applies to this property. */
+ short tags;
+
+ /* user readable name */
+ const char *name;
+ /* single line description, displayed in the tooltip for example */
+ const char *description;
+ /* icon ID */
+ int icon;
+ /* context for translation */
+ const char *translation_context;
+
+ /* property type as it appears to the outside */
+ PropertyType type;
+ /* subtype, 'interpretation' of the property */
+ PropertySubType subtype;
+ /* if non-NULL, overrides arraylength. Must not return 0? */
+ PropArrayLengthGetFunc getlength;
+ /* dimension of array */
+ unsigned int arraydimension;
+ /* array lengths lengths for all dimensions (when arraydimension > 0) */
+ unsigned int arraylength[RNA_MAX_ARRAY_DIMENSION];
+ unsigned int totarraylength;
+
+ /* callback for updates on change */
+ UpdateFunc update;
+ int noteflag;
+
+ /* Callback for testing if editable. Its r_info parameter can be used to
+ * return info on editable state that might be shown to user. E.g. tooltips
+ * of disabled buttons can show reason why button is disabled using this. */
+ EditableFunc editable;
+ /* callback for testing if array-item editable (if applicable) */
+ ItemEditableFunc itemeditable;
+
+ /* Override handling callbacks (diff is also used for comparison). */
+ RNAPropOverrideDiff override_diff;
+ RNAPropOverrideStore override_store;
+ RNAPropOverrideApply override_apply;
+
+ /* raw access */
+ int rawoffset;
+ RawPropertyType rawtype;
+
+ /* This is used for accessing props/functions of this property
+ * any property can have this but should only be used for collections and arrays
+ * since python will convert int/bool/pointer's */
+ struct StructRNA *srna; /* attributes attached directly to this collection */
+
+ /* python handle to hold all callbacks
+ * (in a pointer array at the moment, may later be a tuple) */
+ void *py_data;
};
/* internal flags WARNING! 16bits only! */
typedef enum PropertyFlagIntern {
- PROP_INTERN_BUILTIN = (1 << 0),
- PROP_INTERN_RUNTIME = (1 << 1),
- PROP_INTERN_RAW_ACCESS = (1 << 2),
- PROP_INTERN_RAW_ARRAY = (1 << 3),
- PROP_INTERN_FREE_POINTERS = (1 << 4),
+ PROP_INTERN_BUILTIN = (1 << 0),
+ PROP_INTERN_RUNTIME = (1 << 1),
+ PROP_INTERN_RAW_ACCESS = (1 << 2),
+ PROP_INTERN_RAW_ARRAY = (1 << 3),
+ PROP_INTERN_FREE_POINTERS = (1 << 4),
} PropertyFlagIntern;
/* Property Types */
typedef struct BoolPropertyRNA {
- PropertyRNA property;
+ PropertyRNA property;
- PropBooleanGetFunc get;
- PropBooleanSetFunc set;
- PropBooleanArrayGetFunc getarray;
- PropBooleanArraySetFunc setarray;
+ PropBooleanGetFunc get;
+ PropBooleanSetFunc set;
+ PropBooleanArrayGetFunc getarray;
+ PropBooleanArraySetFunc setarray;
- PropBooleanGetFuncEx get_ex;
- PropBooleanSetFuncEx set_ex;
- PropBooleanArrayGetFuncEx getarray_ex;
- PropBooleanArraySetFuncEx setarray_ex;
+ PropBooleanGetFuncEx get_ex;
+ PropBooleanSetFuncEx set_ex;
+ PropBooleanArrayGetFuncEx getarray_ex;
+ PropBooleanArraySetFuncEx setarray_ex;
- bool defaultvalue;
- const bool *defaultarray;
+ bool defaultvalue;
+ const bool *defaultarray;
} BoolPropertyRNA;
typedef struct IntPropertyRNA {
- PropertyRNA property;
-
- PropIntGetFunc get;
- PropIntSetFunc set;
- PropIntArrayGetFunc getarray;
- PropIntArraySetFunc setarray;
- PropIntRangeFunc range;
-
- PropIntGetFuncEx get_ex;
- PropIntSetFuncEx set_ex;
- PropIntArrayGetFuncEx getarray_ex;
- PropIntArraySetFuncEx setarray_ex;
- PropIntRangeFuncEx range_ex;
-
- int softmin, softmax;
- int hardmin, hardmax;
- int step;
-
- int defaultvalue;
- const int *defaultarray;
+ PropertyRNA property;
+
+ PropIntGetFunc get;
+ PropIntSetFunc set;
+ PropIntArrayGetFunc getarray;
+ PropIntArraySetFunc setarray;
+ PropIntRangeFunc range;
+
+ PropIntGetFuncEx get_ex;
+ PropIntSetFuncEx set_ex;
+ PropIntArrayGetFuncEx getarray_ex;
+ PropIntArraySetFuncEx setarray_ex;
+ PropIntRangeFuncEx range_ex;
+
+ int softmin, softmax;
+ int hardmin, hardmax;
+ int step;
+
+ int defaultvalue;
+ const int *defaultarray;
} IntPropertyRNA;
typedef struct FloatPropertyRNA {
- PropertyRNA property;
-
- PropFloatGetFunc get;
- PropFloatSetFunc set;
- PropFloatArrayGetFunc getarray;
- PropFloatArraySetFunc setarray;
- PropFloatRangeFunc range;
-
- PropFloatGetFuncEx get_ex;
- PropFloatSetFuncEx set_ex;
- PropFloatArrayGetFuncEx getarray_ex;
- PropFloatArraySetFuncEx setarray_ex;
- PropFloatRangeFuncEx range_ex;
-
- float softmin, softmax;
- float hardmin, hardmax;
- float step;
- int precision;
-
- float defaultvalue;
- const float *defaultarray;
+ PropertyRNA property;
+
+ PropFloatGetFunc get;
+ PropFloatSetFunc set;
+ PropFloatArrayGetFunc getarray;
+ PropFloatArraySetFunc setarray;
+ PropFloatRangeFunc range;
+
+ PropFloatGetFuncEx get_ex;
+ PropFloatSetFuncEx set_ex;
+ PropFloatArrayGetFuncEx getarray_ex;
+ PropFloatArraySetFuncEx setarray_ex;
+ PropFloatRangeFuncEx range_ex;
+
+ float softmin, softmax;
+ float hardmin, hardmax;
+ float step;
+ int precision;
+
+ float defaultvalue;
+ const float *defaultarray;
} FloatPropertyRNA;
typedef struct StringPropertyRNA {
- PropertyRNA property;
+ PropertyRNA property;
- PropStringGetFunc get;
- PropStringLengthFunc length;
- PropStringSetFunc set;
+ PropStringGetFunc get;
+ PropStringLengthFunc length;
+ PropStringSetFunc set;
- PropStringGetFuncEx get_ex;
- PropStringLengthFuncEx length_ex;
- PropStringSetFuncEx set_ex;
+ PropStringGetFuncEx get_ex;
+ PropStringLengthFuncEx length_ex;
+ PropStringSetFuncEx set_ex;
- int maxlength; /* includes string terminator! */
+ int maxlength; /* includes string terminator! */
- const char *defaultvalue;
+ const char *defaultvalue;
} StringPropertyRNA;
typedef struct EnumPropertyRNA {
- PropertyRNA property;
+ PropertyRNA property;
- PropEnumGetFunc get;
- PropEnumSetFunc set;
- PropEnumItemFunc itemf;
+ PropEnumGetFunc get;
+ PropEnumSetFunc set;
+ PropEnumItemFunc itemf;
- PropEnumGetFuncEx get_ex;
- PropEnumSetFuncEx set_ex;
- void *py_data; /* store py callback here */
+ PropEnumGetFuncEx get_ex;
+ PropEnumSetFuncEx set_ex;
+ void *py_data; /* store py callback here */
- const EnumPropertyItem *item;
- int totitem;
+ const EnumPropertyItem *item;
+ int totitem;
- int defaultvalue;
+ int defaultvalue;
} EnumPropertyRNA;
typedef struct PointerPropertyRNA {
- PropertyRNA property;
+ PropertyRNA property;
- PropPointerGetFunc get;
- PropPointerSetFunc set;
- PropPointerTypeFunc typef;
- PropPointerPollFunc poll; /* unlike operators, 'set' can still run if poll fails, used for filtering display */
+ PropPointerGetFunc get;
+ PropPointerSetFunc set;
+ PropPointerTypeFunc typef;
+ PropPointerPollFunc
+ poll; /* unlike operators, 'set' can still run if poll fails, used for filtering display */
- struct StructRNA *type;
+ struct StructRNA *type;
} PointerPropertyRNA;
typedef struct CollectionPropertyRNA {
- PropertyRNA property;
-
- PropCollectionBeginFunc begin;
- PropCollectionNextFunc next;
- PropCollectionEndFunc end; /* optional */
- PropCollectionGetFunc get;
- PropCollectionLengthFunc length; /* optional */
- PropCollectionLookupIntFunc lookupint; /* optional */
- PropCollectionLookupStringFunc lookupstring; /* optional */
- PropCollectionAssignIntFunc assignint; /* optional */
-
- struct StructRNA *item_type; /* the type of this item */
+ PropertyRNA property;
+
+ PropCollectionBeginFunc begin;
+ PropCollectionNextFunc next;
+ PropCollectionEndFunc end; /* optional */
+ PropCollectionGetFunc get;
+ PropCollectionLengthFunc length; /* optional */
+ PropCollectionLookupIntFunc lookupint; /* optional */
+ PropCollectionLookupStringFunc lookupstring; /* optional */
+ PropCollectionAssignIntFunc assignint; /* optional */
+
+ struct StructRNA *item_type; /* the type of this item */
} CollectionPropertyRNA;
-
/* changes to this struct require updating rna_generate_struct in makesrna.c */
struct StructRNA {
- /* structs are containers of properties */
- ContainerRNA cont;
-
- /* unique identifier, keep after 'cont' */
- const char *identifier;
-
- /* python type, this is a subtype of pyrna_struct_Type but used so each struct can have its own type
- * which is useful for subclassing RNA */
- void *py_type;
- void *blender_type;
-
- /* various options */
- int flag;
- /* Each StructRNA type can define own tags which properties can set
- * (PropertyRNA.tags) for changed behavior based on struct-type. */
- const EnumPropertyItem *prop_tag_defines;
-
- /* user readable name */
- const char *name;
- /* single line description, displayed in the tooltip for example */
- const char *description;
- /* context for translation */
- const char *translation_context;
- /* icon ID */
- int icon;
-
- /* property that defines the name */
- PropertyRNA *nameproperty;
-
- /* property to iterate over properties */
- PropertyRNA *iteratorproperty;
-
- /* struct this is derivedfrom */
- struct StructRNA *base;
-
- /* only use for nested structs, where both the parent and child access
- * the same C Struct but nesting is used for grouping properties.
- * The parent property is used so we know NULL checks are not needed,
- * and that this struct will never exist without its parent */
- struct StructRNA *nested;
-
- /* function to give the more specific type */
- StructRefineFunc refine;
-
- /* function to find path to this struct in an ID */
- StructPathFunc path;
-
- /* function to register/unregister subclasses */
- StructRegisterFunc reg;
- StructUnregisterFunc unreg;
- StructInstanceFunc instance;
-
- /* callback to get id properties */
- IDPropertiesFunc idproperties;
-
- /* functions of this struct */
- ListBase functions;
+ /* structs are containers of properties */
+ ContainerRNA cont;
+
+ /* unique identifier, keep after 'cont' */
+ const char *identifier;
+
+ /* python type, this is a subtype of pyrna_struct_Type but used so each struct can have its own type
+ * which is useful for subclassing RNA */
+ void *py_type;
+ void *blender_type;
+
+ /* various options */
+ int flag;
+ /* Each StructRNA type can define own tags which properties can set
+ * (PropertyRNA.tags) for changed behavior based on struct-type. */
+ const EnumPropertyItem *prop_tag_defines;
+
+ /* user readable name */
+ const char *name;
+ /* single line description, displayed in the tooltip for example */
+ const char *description;
+ /* context for translation */
+ const char *translation_context;
+ /* icon ID */
+ int icon;
+
+ /* property that defines the name */
+ PropertyRNA *nameproperty;
+
+ /* property to iterate over properties */
+ PropertyRNA *iteratorproperty;
+
+ /* struct this is derivedfrom */
+ struct StructRNA *base;
+
+ /* only use for nested structs, where both the parent and child access
+ * the same C Struct but nesting is used for grouping properties.
+ * The parent property is used so we know NULL checks are not needed,
+ * and that this struct will never exist without its parent */
+ struct StructRNA *nested;
+
+ /* function to give the more specific type */
+ StructRefineFunc refine;
+
+ /* function to find path to this struct in an ID */
+ StructPathFunc path;
+
+ /* function to register/unregister subclasses */
+ StructRegisterFunc reg;
+ StructUnregisterFunc unreg;
+ StructInstanceFunc instance;
+
+ /* callback to get id properties */
+ IDPropertiesFunc idproperties;
+
+ /* functions of this struct */
+ ListBase functions;
};
/* Blender RNA
@@ -465,14 +518,14 @@ struct StructRNA {
* Root RNA data structure that lists all struct types. */
struct BlenderRNA {
- ListBase structs;
- /* A map of structs: {StructRNA.identifier -> StructRNA}
- * These are ensured to have unique names (with STRUCT_PUBLIC_NAMESPACE enabled). */
- struct GHash *structs_map;
- /* Needed because types with an empty identifier aren't included in 'structs_map'. */
- unsigned int structs_len;
+ ListBase structs;
+ /* A map of structs: {StructRNA.identifier -> StructRNA}
+ * These are ensured to have unique names (with STRUCT_PUBLIC_NAMESPACE enabled). */
+ struct GHash *structs_map;
+ /* Needed because types with an empty identifier aren't included in 'structs_map'. */
+ unsigned int structs_len;
};
-#define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont))+1))
+#define CONTAINER_RNA_ID(cont) (*(const char **)(((ContainerRNA *)(cont)) + 1))
#endif /* __RNA_INTERNAL_TYPES_H__ */
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index 1d9084bf3f0..b0760b3377d 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -42,119 +42,129 @@
#ifdef RNA_RUNTIME
-#include <stddef.h>
+# include <stddef.h>
-#include "DNA_object_types.h"
+# include "DNA_object_types.h"
-#include "BLI_string_utils.h"
+# include "BLI_string_utils.h"
-#include "BKE_animsys.h"
-#include "BKE_key.h"
-#include "BKE_main.h"
+# include "BKE_animsys.h"
+# include "BKE_key.h"
+# include "BKE_main.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "WM_api.h"
-#include "WM_types.h"
+# include "WM_api.h"
+# include "WM_types.h"
static Key *rna_ShapeKey_find_key(ID *id)
{
- switch (GS(id->name)) {
- case ID_CU: return ((Curve *)id)->key;
- case ID_KE: return (Key *)id;
- case ID_LT: return ((Lattice *)id)->key;
- case ID_ME: return ((Mesh *)id)->key;
- case ID_OB: return BKE_key_from_object((Object *)id);
- default: return NULL;
- }
+ switch (GS(id->name)) {
+ case ID_CU:
+ return ((Curve *)id)->key;
+ case ID_KE:
+ return (Key *)id;
+ case ID_LT:
+ return ((Lattice *)id)->key;
+ case ID_ME:
+ return ((Mesh *)id)->key;
+ case ID_OB:
+ return BKE_key_from_object((Object *)id);
+ default:
+ return NULL;
+ }
}
static void rna_ShapeKey_name_set(PointerRNA *ptr, const char *value)
{
- KeyBlock *kb = ptr->data;
- char oldname[sizeof(kb->name)];
-
- /* make a copy of the old name first */
- BLI_strncpy(oldname, kb->name, sizeof(kb->name));
-
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(kb->name, value, sizeof(kb->name));
-
- /* make sure the name is truly unique */
- if (ptr->id.data) {
- Key *key = rna_ShapeKey_find_key(ptr->id.data);
- BLI_uniquename(&key->block, kb, CTX_DATA_(BLT_I18NCONTEXT_ID_SHAPEKEY, "Key"), '.',
- offsetof(KeyBlock, name), sizeof(kb->name));
- }
-
- /* fix all the animation data which may link to this */
- BKE_animdata_fix_paths_rename_all(NULL, "key_blocks", oldname, kb->name);
+ KeyBlock *kb = ptr->data;
+ char oldname[sizeof(kb->name)];
+
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, kb->name, sizeof(kb->name));
+
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(kb->name, value, sizeof(kb->name));
+
+ /* make sure the name is truly unique */
+ if (ptr->id.data) {
+ Key *key = rna_ShapeKey_find_key(ptr->id.data);
+ BLI_uniquename(&key->block,
+ kb,
+ CTX_DATA_(BLT_I18NCONTEXT_ID_SHAPEKEY, "Key"),
+ '.',
+ offsetof(KeyBlock, name),
+ sizeof(kb->name));
+ }
+
+ /* fix all the animation data which may link to this */
+ BKE_animdata_fix_paths_rename_all(NULL, "key_blocks", oldname, kb->name);
}
static float rna_ShapeKey_frame_get(PointerRNA *ptr)
{
- KeyBlock *kb = (KeyBlock *)ptr->data;
- return kb->pos * 100.0f; /* Because pos is ctime/100... */
+ KeyBlock *kb = (KeyBlock *)ptr->data;
+ return kb->pos * 100.0f; /* Because pos is ctime/100... */
}
static void rna_ShapeKey_value_set(PointerRNA *ptr, float value)
{
- KeyBlock *data = (KeyBlock *)ptr->data;
- CLAMP(value, data->slidermin, data->slidermax);
- data->curval = value;
+ KeyBlock *data = (KeyBlock *)ptr->data;
+ CLAMP(value, data->slidermin, data->slidermax);
+ data->curval = value;
}
-static void rna_ShapeKey_value_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_ShapeKey_value_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- KeyBlock *data = (KeyBlock *)ptr->data;
+ KeyBlock *data = (KeyBlock *)ptr->data;
- *min = data->slidermin;
- *max = data->slidermax;
+ *min = data->slidermin;
+ *max = data->slidermax;
}
/* epsilon for how close one end of shapekey range can get to the other */
-#define SHAPEKEY_SLIDER_TOL 0.001f
+# define SHAPEKEY_SLIDER_TOL 0.001f
-static void rna_ShapeKey_slider_min_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_ShapeKey_slider_min_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- KeyBlock *data = (KeyBlock *)ptr->data;
+ KeyBlock *data = (KeyBlock *)ptr->data;
- *min = -10.0f;
- *max = data->slidermax - SHAPEKEY_SLIDER_TOL;
+ *min = -10.0f;
+ *max = data->slidermax - SHAPEKEY_SLIDER_TOL;
}
static void rna_ShapeKey_slider_min_set(PointerRNA *ptr, float value)
{
- KeyBlock *data = (KeyBlock *)ptr->data;
- float min, max, softmin, softmax;
+ KeyBlock *data = (KeyBlock *)ptr->data;
+ float min, max, softmin, softmax;
- rna_ShapeKey_slider_min_range(ptr, &min, &max, &softmin, &softmax);
- CLAMP(value, min, max);
- data->slidermin = value;
+ rna_ShapeKey_slider_min_range(ptr, &min, &max, &softmin, &softmax);
+ CLAMP(value, min, max);
+ data->slidermin = value;
}
-static void rna_ShapeKey_slider_max_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_ShapeKey_slider_max_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- KeyBlock *data = (KeyBlock *)ptr->data;
+ KeyBlock *data = (KeyBlock *)ptr->data;
- *min = data->slidermin + SHAPEKEY_SLIDER_TOL;
- *max = 10.0f;
+ *min = data->slidermin + SHAPEKEY_SLIDER_TOL;
+ *max = 10.0f;
}
static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value)
{
- KeyBlock *data = (KeyBlock *)ptr->data;
- float min, max, softmin, softmax;
+ KeyBlock *data = (KeyBlock *)ptr->data;
+ float min, max, softmin, softmax;
- rna_ShapeKey_slider_max_range(ptr, &min, &max, &softmin, &softmax);
- CLAMP(value, min, max);
- data->slidermax = value;
+ rna_ShapeKey_slider_max_range(ptr, &min, &max, &softmin, &softmax);
+ CLAMP(value, min, max);
+ data->slidermax = value;
}
-#undef SHAPEKEY_SLIDER_TOL
+# undef SHAPEKEY_SLIDER_TOL
/* ***** Normals accessors for shapekeys. ***** */
/* Note: with this we may recompute several times the same data, should we want to access verts, then polys, then loops
@@ -163,838 +173,879 @@ static void rna_ShapeKey_slider_max_set(PointerRNA *ptr, float value)
static Mesh *rna_KeyBlock_normals_get_mesh(PointerRNA *ptr, ID *id)
{
- Key *key = rna_ShapeKey_find_key((id == NULL && ptr != NULL) ? ptr->id.data : id);
- id = key ? key->from : NULL;
-
- if (id != NULL) {
- switch (GS(id->name)) {
- case ID_ME:
- return (Mesh *)id;
- case ID_OB:
- {
- Object *ob = (Object *)id;
- if (ob->type == OB_MESH) {
- return ob->data;
- }
- }
- default:
- break;
- }
- }
-
- return NULL;
+ Key *key = rna_ShapeKey_find_key((id == NULL && ptr != NULL) ? ptr->id.data : id);
+ id = key ? key->from : NULL;
+
+ if (id != NULL) {
+ switch (GS(id->name)) {
+ case ID_ME:
+ return (Mesh *)id;
+ case ID_OB: {
+ Object *ob = (Object *)id;
+ if (ob->type == OB_MESH) {
+ return ob->data;
+ }
+ }
+ default:
+ break;
+ }
+ }
+
+ return NULL;
}
static int rna_KeyBlock_normals_vert_len(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
- Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
+ Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
- length[0] = me ? me->totvert : 0;
- length[1] = 3;
+ length[0] = me ? me->totvert : 0;
+ length[1] = 3;
- return (length[0] * length[1]);
+ return (length[0] * length[1]);
}
-static void rna_KeyBlock_normals_vert_calc(ID *id, KeyBlock *data, int *normals_len, float **normals)
+static void rna_KeyBlock_normals_vert_calc(ID *id,
+ KeyBlock *data,
+ int *normals_len,
+ float **normals)
{
- Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
+ Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
- *normals_len = (me ? me->totvert : 0) * 3;
+ *normals_len = (me ? me->totvert : 0) * 3;
- if (ELEM(NULL, me, data) || (me->totvert == 0)) {
- *normals = NULL;
- return;
- }
+ if (ELEM(NULL, me, data) || (me->totvert == 0)) {
+ *normals = NULL;
+ return;
+ }
- *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
+ *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
- BKE_keyblock_mesh_calc_normals(data, me, (float (*)[3])(*normals), NULL, NULL);
+ BKE_keyblock_mesh_calc_normals(data, me, (float(*)[3])(*normals), NULL, NULL);
}
static int rna_KeyBlock_normals_poly_len(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
- Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
+ Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
- length[0] = me ? me->totpoly : 0;
- length[1] = 3;
+ length[0] = me ? me->totpoly : 0;
+ length[1] = 3;
- return (length[0] * length[1]);
+ return (length[0] * length[1]);
}
-static void rna_KeyBlock_normals_poly_calc(ID *id, KeyBlock *data, int *normals_len, float **normals)
+static void rna_KeyBlock_normals_poly_calc(ID *id,
+ KeyBlock *data,
+ int *normals_len,
+ float **normals)
{
- Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
+ Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
- *normals_len = (me ? me->totpoly : 0) * 3;
+ *normals_len = (me ? me->totpoly : 0) * 3;
- if (ELEM(NULL, me, data) || (me->totpoly == 0)) {
- *normals = NULL;
- return;
- }
+ if (ELEM(NULL, me, data) || (me->totpoly == 0)) {
+ *normals = NULL;
+ return;
+ }
- *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
+ *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
- BKE_keyblock_mesh_calc_normals(data, me, NULL, (float (*)[3])(*normals), NULL);
+ BKE_keyblock_mesh_calc_normals(data, me, NULL, (float(*)[3])(*normals), NULL);
}
static int rna_KeyBlock_normals_loop_len(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
- Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
+ Mesh *me = rna_KeyBlock_normals_get_mesh(ptr, NULL);
- length[0] = me ? me->totloop : 0;
- length[1] = 3;
+ length[0] = me ? me->totloop : 0;
+ length[1] = 3;
- return (length[0] * length[1]);
+ return (length[0] * length[1]);
}
-static void rna_KeyBlock_normals_loop_calc(ID *id, KeyBlock *data, int *normals_len, float **normals)
+static void rna_KeyBlock_normals_loop_calc(ID *id,
+ KeyBlock *data,
+ int *normals_len,
+ float **normals)
{
- Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
+ Mesh *me = rna_KeyBlock_normals_get_mesh(NULL, id);
- *normals_len = (me ? me->totloop : 0) * 3;
+ *normals_len = (me ? me->totloop : 0) * 3;
- if (ELEM(NULL, me, data) || (me->totloop == 0)) {
- *normals = NULL;
- return;
- }
+ if (ELEM(NULL, me, data) || (me->totloop == 0)) {
+ *normals = NULL;
+ return;
+ }
- *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
+ *normals = MEM_mallocN(sizeof(**normals) * (size_t)(*normals_len), __func__);
- BKE_keyblock_mesh_calc_normals(data, me, NULL, NULL, (float (*)[3])(*normals));
+ BKE_keyblock_mesh_calc_normals(data, me, NULL, NULL, (float(*)[3])(*normals));
}
-
PointerRNA rna_object_shapekey_index_get(ID *id, int value)
{
- Key *key = rna_ShapeKey_find_key(id);
- KeyBlock *kb = NULL;
- PointerRNA ptr;
+ Key *key = rna_ShapeKey_find_key(id);
+ KeyBlock *kb = NULL;
+ PointerRNA ptr;
- if (key && value < key->totkey)
- kb = BLI_findlink(&key->block, value);
+ if (key && value < key->totkey)
+ kb = BLI_findlink(&key->block, value);
- RNA_pointer_create(id, &RNA_ShapeKey, kb, &ptr);
+ RNA_pointer_create(id, &RNA_ShapeKey, kb, &ptr);
- return ptr;
+ return ptr;
}
int rna_object_shapekey_index_set(ID *id, PointerRNA value, int current)
{
- Key *key = rna_ShapeKey_find_key(id);
+ Key *key = rna_ShapeKey_find_key(id);
- if (key) {
- int a = BLI_findindex(&key->block, value.data);
- if (a != -1) return a;
- }
+ if (key) {
+ int a = BLI_findindex(&key->block, value.data);
+ if (a != -1)
+ return a;
+ }
- return current;
+ return current;
}
static PointerRNA rna_ShapeKey_relative_key_get(PointerRNA *ptr)
{
- KeyBlock *kb = (KeyBlock *)ptr->data;
+ KeyBlock *kb = (KeyBlock *)ptr->data;
- return rna_object_shapekey_index_get(ptr->id.data, kb->relative);
+ return rna_object_shapekey_index_get(ptr->id.data, kb->relative);
}
static void rna_ShapeKey_relative_key_set(PointerRNA *ptr, PointerRNA value)
{
- KeyBlock *kb = (KeyBlock *)ptr->data;
+ KeyBlock *kb = (KeyBlock *)ptr->data;
- kb->relative = rna_object_shapekey_index_set(ptr->id.data, value, kb->relative);
+ kb->relative = rna_object_shapekey_index_set(ptr->id.data, value, kb->relative);
}
static void rna_ShapeKeyPoint_co_get(PointerRNA *ptr, float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- values[0] = vec[0];
- values[1] = vec[1];
- values[2] = vec[2];
+ values[0] = vec[0];
+ values[1] = vec[1];
+ values[2] = vec[2];
}
static void rna_ShapeKeyPoint_co_set(PointerRNA *ptr, const float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- vec[0] = values[0];
- vec[1] = values[1];
- vec[2] = values[2];
+ vec[0] = values[0];
+ vec[1] = values[1];
+ vec[2] = values[2];
}
static float rna_ShapeKeyCurvePoint_tilt_get(PointerRNA *ptr)
{
- float *vec = (float *)ptr->data;
- return vec[3];
+ float *vec = (float *)ptr->data;
+ return vec[3];
}
static void rna_ShapeKeyCurvePoint_tilt_set(PointerRNA *ptr, float value)
{
- float *vec = (float *)ptr->data;
- vec[3] = value;
+ float *vec = (float *)ptr->data;
+ vec[3] = value;
}
static float rna_ShapeKeyCurvePoint_radius_get(PointerRNA *ptr)
{
- float *vec = (float *)ptr->data;
- return vec[4];
+ float *vec = (float *)ptr->data;
+ return vec[4];
}
static void rna_ShapeKeyCurvePoint_radius_set(PointerRNA *ptr, float value)
{
- float *vec = (float *)ptr->data;
- CLAMP_MIN(value, 0.0f);
- vec[4] = value;
+ float *vec = (float *)ptr->data;
+ CLAMP_MIN(value, 0.0f);
+ vec[4] = value;
}
static void rna_ShapeKeyBezierPoint_co_get(PointerRNA *ptr, float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- values[0] = vec[0 + 3];
- values[1] = vec[1 + 3];
- values[2] = vec[2 + 3];
+ values[0] = vec[0 + 3];
+ values[1] = vec[1 + 3];
+ values[2] = vec[2 + 3];
}
static void rna_ShapeKeyBezierPoint_co_set(PointerRNA *ptr, const float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- vec[0 + 3] = values[0];
- vec[1 + 3] = values[1];
- vec[2 + 3] = values[2];
+ vec[0 + 3] = values[0];
+ vec[1 + 3] = values[1];
+ vec[2 + 3] = values[2];
}
static void rna_ShapeKeyBezierPoint_handle_1_co_get(PointerRNA *ptr, float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- values[0] = vec[0];
- values[1] = vec[1];
- values[2] = vec[2];
+ values[0] = vec[0];
+ values[1] = vec[1];
+ values[2] = vec[2];
}
static void rna_ShapeKeyBezierPoint_handle_1_co_set(PointerRNA *ptr, const float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- vec[0] = values[0];
- vec[1] = values[1];
- vec[2] = values[2];
+ vec[0] = values[0];
+ vec[1] = values[1];
+ vec[2] = values[2];
}
static void rna_ShapeKeyBezierPoint_handle_2_co_get(PointerRNA *ptr, float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- values[0] = vec[6 + 0];
- values[1] = vec[6 + 1];
- values[2] = vec[6 + 2];
+ values[0] = vec[6 + 0];
+ values[1] = vec[6 + 1];
+ values[2] = vec[6 + 2];
}
static void rna_ShapeKeyBezierPoint_handle_2_co_set(PointerRNA *ptr, const float *values)
{
- float *vec = (float *)ptr->data;
+ float *vec = (float *)ptr->data;
- vec[6 + 0] = values[0];
- vec[6 + 1] = values[1];
- vec[6 + 2] = values[2];
+ vec[6 + 0] = values[0];
+ vec[6 + 1] = values[1];
+ vec[6 + 2] = values[2];
}
static float rna_ShapeKeyBezierPoint_tilt_get(PointerRNA *ptr)
{
- float *vec = (float *)ptr->data;
- return vec[9];
+ float *vec = (float *)ptr->data;
+ return vec[9];
}
static void rna_ShapeKeyBezierPoint_tilt_set(PointerRNA *ptr, float value)
{
- float *vec = (float *)ptr->data;
- vec[9] = value;
+ float *vec = (float *)ptr->data;
+ vec[9] = value;
}
static float rna_ShapeKeyBezierPoint_radius_get(PointerRNA *ptr)
{
- float *vec = (float *)ptr->data;
- return vec[10];
+ float *vec = (float *)ptr->data;
+ return vec[10];
}
static void rna_ShapeKeyBezierPoint_radius_set(PointerRNA *ptr, float value)
{
- float *vec = (float *)ptr->data;
- CLAMP_MIN(value, 0.0f);
- vec[10] = value;
+ float *vec = (float *)ptr->data;
+ CLAMP_MIN(value, 0.0f);
+ vec[10] = value;
}
/* Indexing and iteration of Curve points through sub-curves. */
typedef struct NurbInfo {
- Nurb *nu;
- int nurb_size, nurb_elem_step;
+ Nurb *nu;
+ int nurb_size, nurb_elem_step;
- /* Current index in the Nurb */
- int nurb_index;
+ /* Current index in the Nurb */
+ int nurb_index;
- /* Total index as item and element. */
- int item_index, elem_index;
+ /* Total index as item and element. */
+ int item_index, elem_index;
} NurbInfo;
StructRNA *rna_ShapeKey_curve_point_type(Nurb *nu)
{
- if (nu->bezt) {
- return &RNA_ShapeKeyBezierPoint;
- }
- else {
- return &RNA_ShapeKeyCurvePoint;
- }
+ if (nu->bezt) {
+ return &RNA_ShapeKeyBezierPoint;
+ }
+ else {
+ return &RNA_ShapeKeyCurvePoint;
+ }
}
static void rna_ShapeKey_NurbInfo_init(NurbInfo *r_info, Nurb *nu)
{
- r_info->nu = nu;
-
- if (nu->bezt) {
- r_info->nurb_size = nu->pntsu;
- r_info->nurb_elem_step = KEYELEM_ELEM_LEN_BEZTRIPLE;
- }
- else {
- r_info->nurb_size = nu->pntsu * nu->pntsv;
- r_info->nurb_elem_step = KEYELEM_ELEM_LEN_BPOINT;
- }
+ r_info->nu = nu;
+
+ if (nu->bezt) {
+ r_info->nurb_size = nu->pntsu;
+ r_info->nurb_elem_step = KEYELEM_ELEM_LEN_BEZTRIPLE;
+ }
+ else {
+ r_info->nurb_size = nu->pntsu * nu->pntsv;
+ r_info->nurb_elem_step = KEYELEM_ELEM_LEN_BPOINT;
+ }
}
-static void rna_ShapeKey_NurbInfo_step(NurbInfo *r_info, Nurb *nu, int *p_raw_index, bool input_elem)
+static void rna_ShapeKey_NurbInfo_step(NurbInfo *r_info,
+ Nurb *nu,
+ int *p_raw_index,
+ bool input_elem)
{
- rna_ShapeKey_NurbInfo_init(r_info, nu);
-
- if (input_elem) {
- r_info->nurb_index = MIN2(r_info->nurb_size, *p_raw_index / r_info->nurb_elem_step);
- *p_raw_index -= r_info->nurb_size * r_info->nurb_elem_step;
- }
- else {
- r_info->nurb_index = MIN2(r_info->nurb_size, *p_raw_index);
- *p_raw_index -= r_info->nurb_size;
- }
-
- r_info->item_index += r_info->nurb_index;
- r_info->elem_index += r_info->nurb_index * r_info->nurb_elem_step;
+ rna_ShapeKey_NurbInfo_init(r_info, nu);
+
+ if (input_elem) {
+ r_info->nurb_index = MIN2(r_info->nurb_size, *p_raw_index / r_info->nurb_elem_step);
+ *p_raw_index -= r_info->nurb_size * r_info->nurb_elem_step;
+ }
+ else {
+ r_info->nurb_index = MIN2(r_info->nurb_size, *p_raw_index);
+ *p_raw_index -= r_info->nurb_size;
+ }
+
+ r_info->item_index += r_info->nurb_index;
+ r_info->elem_index += r_info->nurb_index * r_info->nurb_elem_step;
}
-static void rna_ShapeKey_NurbInfo_find_index(Key *key, int raw_index, bool input_elem, NurbInfo *r_info)
+static void rna_ShapeKey_NurbInfo_find_index(Key *key,
+ int raw_index,
+ bool input_elem,
+ NurbInfo *r_info)
{
- Curve *cu = (Curve *)key->from;
+ Curve *cu = (Curve *)key->from;
- memset(r_info, 0, sizeof(*r_info));
+ memset(r_info, 0, sizeof(*r_info));
- for (Nurb *nu = cu->nurb.first; nu && raw_index >= 0; nu = nu->next) {
- rna_ShapeKey_NurbInfo_step(r_info, nu, &raw_index, input_elem);
- }
+ for (Nurb *nu = cu->nurb.first; nu && raw_index >= 0; nu = nu->next) {
+ rna_ShapeKey_NurbInfo_step(r_info, nu, &raw_index, input_elem);
+ }
}
static int rna_ShapeKey_curve_find_index(Key *key, int elem_index)
{
- NurbInfo info;
- rna_ShapeKey_NurbInfo_find_index(key, elem_index, true, &info);
- return info.item_index;
+ NurbInfo info;
+ rna_ShapeKey_NurbInfo_find_index(key, elem_index, true, &info);
+ return info.item_index;
}
typedef struct ShapeKeyCurvePoint {
- StructRNA *type;
- void *data;
+ StructRNA *type;
+ void *data;
} ShapeKeyCurvePoint;
/* Build a mapping array for Curve objects with mixed sub-curve types. */
-static void rna_ShapeKey_data_begin_mixed(CollectionPropertyIterator *iter, Key *key, KeyBlock *kb, Curve *cu)
+static void rna_ShapeKey_data_begin_mixed(CollectionPropertyIterator *iter,
+ Key *key,
+ KeyBlock *kb,
+ Curve *cu)
{
- int point_count = rna_ShapeKey_curve_find_index(key, kb->totelem);
+ int point_count = rna_ShapeKey_curve_find_index(key, kb->totelem);
- ShapeKeyCurvePoint *points = MEM_malloc_arrayN(sizeof(ShapeKeyCurvePoint), point_count, __func__);
+ ShapeKeyCurvePoint *points = MEM_malloc_arrayN(
+ sizeof(ShapeKeyCurvePoint), point_count, __func__);
- char *databuf = kb->data;
- int items_left = point_count;
- NurbInfo info = { NULL };
+ char *databuf = kb->data;
+ int items_left = point_count;
+ NurbInfo info = {NULL};
- for (Nurb *nu = cu->nurb.first; nu && items_left > 0; nu = nu->next) {
- ShapeKeyCurvePoint *nurb_points = points + info.item_index;
- char *nurb_data = databuf + info.elem_index * key->elemsize;
+ for (Nurb *nu = cu->nurb.first; nu && items_left > 0; nu = nu->next) {
+ ShapeKeyCurvePoint *nurb_points = points + info.item_index;
+ char *nurb_data = databuf + info.elem_index * key->elemsize;
- rna_ShapeKey_NurbInfo_step(&info, nu, &items_left, false);
+ rna_ShapeKey_NurbInfo_step(&info, nu, &items_left, false);
- StructRNA *type = rna_ShapeKey_curve_point_type(nu);
+ StructRNA *type = rna_ShapeKey_curve_point_type(nu);
- for (int i = 0; i < info.nurb_index; i++) {
- nurb_points[i].type = type;
- nurb_points[i].data = nurb_data + i * info.nurb_elem_step * key->elemsize;
- }
- }
+ for (int i = 0; i < info.nurb_index; i++) {
+ nurb_points[i].type = type;
+ nurb_points[i].data = nurb_data + i * info.nurb_elem_step * key->elemsize;
+ }
+ }
- rna_iterator_array_begin(iter, points, sizeof(*points), point_count, true, NULL);
+ rna_iterator_array_begin(iter, points, sizeof(*points), point_count, true, NULL);
}
static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Key *key = rna_ShapeKey_find_key(ptr->id.data);
- KeyBlock *kb = (KeyBlock *)ptr->data;
- int tot = kb->totelem, size = key->elemsize;
-
- if (GS(key->from->name) == ID_CU && tot > 0) {
- Curve *cu = (Curve *)key->from;
- StructRNA *type = NULL;
- NurbInfo info = { 0 };
-
- /* Check if all sub-curves have the same type. */
- for (Nurb *nu = cu->nurb.first; nu; nu = nu->next) {
- if (type == NULL) {
- type = rna_ShapeKey_curve_point_type(nu);
- rna_ShapeKey_NurbInfo_init(&info, nu);
- }
- else if (type != rna_ShapeKey_curve_point_type(nu)) {
- type = NULL;
- break;
- }
- }
-
- /* If types are mixed, build a mapping array. */
- if (type == NULL) {
- rna_ShapeKey_data_begin_mixed(iter, key, kb, cu);
- return;
- }
- else {
- tot /= info.nurb_elem_step;
- size *= info.nurb_elem_step;
- }
- }
-
- rna_iterator_array_begin(iter, (void *)kb->data, size, tot, 0, NULL);
+ Key *key = rna_ShapeKey_find_key(ptr->id.data);
+ KeyBlock *kb = (KeyBlock *)ptr->data;
+ int tot = kb->totelem, size = key->elemsize;
+
+ if (GS(key->from->name) == ID_CU && tot > 0) {
+ Curve *cu = (Curve *)key->from;
+ StructRNA *type = NULL;
+ NurbInfo info = {0};
+
+ /* Check if all sub-curves have the same type. */
+ for (Nurb *nu = cu->nurb.first; nu; nu = nu->next) {
+ if (type == NULL) {
+ type = rna_ShapeKey_curve_point_type(nu);
+ rna_ShapeKey_NurbInfo_init(&info, nu);
+ }
+ else if (type != rna_ShapeKey_curve_point_type(nu)) {
+ type = NULL;
+ break;
+ }
+ }
+
+ /* If types are mixed, build a mapping array. */
+ if (type == NULL) {
+ rna_ShapeKey_data_begin_mixed(iter, key, kb, cu);
+ return;
+ }
+ else {
+ tot /= info.nurb_elem_step;
+ size *= info.nurb_elem_step;
+ }
+ }
+
+ rna_iterator_array_begin(iter, (void *)kb->data, size, tot, 0, NULL);
}
static int rna_ShapeKey_data_length(PointerRNA *ptr)
{
- Key *key = rna_ShapeKey_find_key(ptr->id.data);
- KeyBlock *kb = (KeyBlock *)ptr->data;
- int tot = kb->totelem;
+ Key *key = rna_ShapeKey_find_key(ptr->id.data);
+ KeyBlock *kb = (KeyBlock *)ptr->data;
+ int tot = kb->totelem;
- if (GS(key->from->name) == ID_CU) {
- tot = rna_ShapeKey_curve_find_index(key, tot);
- }
+ if (GS(key->from->name) == ID_CU) {
+ tot = rna_ShapeKey_curve_find_index(key, tot);
+ }
- return tot;
+ return tot;
}
static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter)
{
- Key *key = rna_ShapeKey_find_key(iter->parent.id.data);
- void *ptr = rna_iterator_array_get(iter);
- StructRNA *type = &RNA_ShapeKeyPoint;
+ Key *key = rna_ShapeKey_find_key(iter->parent.id.data);
+ void *ptr = rna_iterator_array_get(iter);
+ StructRNA *type = &RNA_ShapeKeyPoint;
- /* If data_begin allocated a mapping array, access it. */
- if (iter->internal.array.free_ptr) {
- ShapeKeyCurvePoint *point = ptr;
+ /* If data_begin allocated a mapping array, access it. */
+ if (iter->internal.array.free_ptr) {
+ ShapeKeyCurvePoint *point = ptr;
- return rna_pointer_inherit_refine(&iter->parent, point->type, point->data);
- }
+ return rna_pointer_inherit_refine(&iter->parent, point->type, point->data);
+ }
- if (GS(key->from->name) == ID_CU) {
- Curve *cu = (Curve *)key->from;
+ if (GS(key->from->name) == ID_CU) {
+ Curve *cu = (Curve *)key->from;
- type = rna_ShapeKey_curve_point_type(cu->nurb.first);
- }
+ type = rna_ShapeKey_curve_point_type(cu->nurb.first);
+ }
- return rna_pointer_inherit_refine(&iter->parent, type, ptr);
+ return rna_pointer_inherit_refine(&iter->parent, type, ptr);
}
int rna_ShapeKey_data_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
{
- Key *key = rna_ShapeKey_find_key(ptr->id.data);
- KeyBlock *kb = (KeyBlock *)ptr->data;
- int elemsize = key->elemsize;
- char *databuf = kb->data;
-
- memset(r_ptr, 0, sizeof(*r_ptr));
-
- if (index < 0) {
- return false;
- }
-
- if (GS(key->from->name) == ID_CU) {
- NurbInfo info;
- rna_ShapeKey_NurbInfo_find_index(key, index, false, &info);
-
- if (info.nu && info.nurb_index < info.nurb_size) {
- StructRNA *type = rna_ShapeKey_curve_point_type(info.nu);
-
- *r_ptr = rna_pointer_inherit_refine(ptr, type, databuf + elemsize * info.elem_index);
- return true;
- }
- }
- else {
- if (index < kb->totelem) {
- *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ShapeKeyPoint, databuf + elemsize * index);
- return true;
- }
- }
-
- return false;
+ Key *key = rna_ShapeKey_find_key(ptr->id.data);
+ KeyBlock *kb = (KeyBlock *)ptr->data;
+ int elemsize = key->elemsize;
+ char *databuf = kb->data;
+
+ memset(r_ptr, 0, sizeof(*r_ptr));
+
+ if (index < 0) {
+ return false;
+ }
+
+ if (GS(key->from->name) == ID_CU) {
+ NurbInfo info;
+ rna_ShapeKey_NurbInfo_find_index(key, index, false, &info);
+
+ if (info.nu && info.nurb_index < info.nurb_size) {
+ StructRNA *type = rna_ShapeKey_curve_point_type(info.nu);
+
+ *r_ptr = rna_pointer_inherit_refine(ptr, type, databuf + elemsize * info.elem_index);
+ return true;
+ }
+ }
+ else {
+ if (index < kb->totelem) {
+ *r_ptr = rna_pointer_inherit_refine(ptr, &RNA_ShapeKeyPoint, databuf + elemsize * index);
+ return true;
+ }
+ }
+
+ return false;
}
static char *rna_ShapeKey_path(PointerRNA *ptr)
{
- KeyBlock *kb = (KeyBlock *)ptr->data;
- ID *id = ptr->id.data;
- char name_esc[sizeof(kb->name) * 2];
+ KeyBlock *kb = (KeyBlock *)ptr->data;
+ ID *id = ptr->id.data;
+ char name_esc[sizeof(kb->name) * 2];
- BLI_strescape(name_esc, kb->name, sizeof(name_esc));
+ BLI_strescape(name_esc, kb->name, sizeof(name_esc));
- if ((id) && (GS(id->name) != ID_KE))
- return BLI_sprintfN("shape_keys.key_blocks[\"%s\"]", name_esc);
- else
- return BLI_sprintfN("key_blocks[\"%s\"]", name_esc);
+ if ((id) && (GS(id->name) != ID_KE))
+ return BLI_sprintfN("shape_keys.key_blocks[\"%s\"]", name_esc);
+ else
+ return BLI_sprintfN("key_blocks[\"%s\"]", name_esc);
}
static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Key *key = ptr->id.data;
- Object *ob;
-
- for (ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (BKE_key_from_object(ob) == key) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
- }
- }
+ Key *key = ptr->id.data;
+ Object *ob;
+
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (BKE_key_from_object(ob) == key) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ }
+ }
}
static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
{
- KeyBlock *kb;
-
- /* sanity checks */
- if (ELEM(NULL, key, point))
- return NULL;
-
- /* we'll need to manually search through the keyblocks and check
- * if the point is somewhere in the middle of each block's data
- */
- for (kb = key->block.first; kb; kb = kb->next) {
- if (kb->data) {
- float *start = (float *)kb->data;
- float *end;
-
- /* easy cases first */
- if ((start == NULL) || (start > point)) {
- /* there's no chance point is in array */
- continue;
- }
- else if (start == point) {
- /* exact match - point is first in array */
- return kb;
- }
-
- /* determine where end of array is
- * - elemsize is in bytes, so use (char *) cast to get array in terms of bytes
- */
- end = (float *)((char *)start + (key->elemsize * kb->totelem));
-
- /* if point's address is less than the end, then it is somewhere between start and end, so in array */
- if (end > point) {
- /* we've found the owner of the point data */
- return kb;
- }
- }
- }
-
- return NULL;
+ KeyBlock *kb;
+
+ /* sanity checks */
+ if (ELEM(NULL, key, point))
+ return NULL;
+
+ /* we'll need to manually search through the keyblocks and check
+ * if the point is somewhere in the middle of each block's data
+ */
+ for (kb = key->block.first; kb; kb = kb->next) {
+ if (kb->data) {
+ float *start = (float *)kb->data;
+ float *end;
+
+ /* easy cases first */
+ if ((start == NULL) || (start > point)) {
+ /* there's no chance point is in array */
+ continue;
+ }
+ else if (start == point) {
+ /* exact match - point is first in array */
+ return kb;
+ }
+
+ /* determine where end of array is
+ * - elemsize is in bytes, so use (char *) cast to get array in terms of bytes
+ */
+ end = (float *)((char *)start + (key->elemsize * kb->totelem));
+
+ /* if point's address is less than the end, then it is somewhere between start and end, so in array */
+ if (end > point) {
+ /* we've found the owner of the point data */
+ return kb;
+ }
+ }
+ }
+
+ return NULL;
}
static int rna_ShapeKeyPoint_get_index(Key *key, KeyBlock *kb, float *point)
{
- /* if we frame the data array and point pointers as (char *), then the difference between
- * them will be in bytes. Thus, dividing through by key->elemsize (number of bytes per point)
- * gives us the offset of point from start of array.
- */
- char *start = (char *)kb->data;
- char *pt = (char *)point;
-
- return (int)(pt - start) / key->elemsize;
+ /* if we frame the data array and point pointers as (char *), then the difference between
+ * them will be in bytes. Thus, dividing through by key->elemsize (number of bytes per point)
+ * gives us the offset of point from start of array.
+ */
+ char *start = (char *)kb->data;
+ char *pt = (char *)point;
+
+ return (int)(pt - start) / key->elemsize;
}
static char *rna_ShapeKeyPoint_path(PointerRNA *ptr)
{
- ID *id = (ID *)ptr->id.data;
- Key *key = rna_ShapeKey_find_key(ptr->id.data);
- KeyBlock *kb;
- float *point = (float *)ptr->data;
+ ID *id = (ID *)ptr->id.data;
+ Key *key = rna_ShapeKey_find_key(ptr->id.data);
+ KeyBlock *kb;
+ float *point = (float *)ptr->data;
- /* if we can get a key block, we can construct a path */
- kb = rna_ShapeKeyData_find_keyblock(key, point);
+ /* if we can get a key block, we can construct a path */
+ kb = rna_ShapeKeyData_find_keyblock(key, point);
- if (kb) {
- char name_esc_kb[sizeof(kb->name) * 2];
- int index;
+ if (kb) {
+ char name_esc_kb[sizeof(kb->name) * 2];
+ int index;
- index = rna_ShapeKeyPoint_get_index(key, kb, point);
+ index = rna_ShapeKeyPoint_get_index(key, kb, point);
- if (ELEM(ptr->type, &RNA_ShapeKeyBezierPoint, &RNA_ShapeKeyCurvePoint)) {
- index = rna_ShapeKey_curve_find_index(key, index);
- }
+ if (ELEM(ptr->type, &RNA_ShapeKeyBezierPoint, &RNA_ShapeKeyCurvePoint)) {
+ index = rna_ShapeKey_curve_find_index(key, index);
+ }
- BLI_strescape(name_esc_kb, kb->name, sizeof(name_esc_kb));
+ BLI_strescape(name_esc_kb, kb->name, sizeof(name_esc_kb));
- if (GS(id->name) == ID_KE)
- return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
- else
- return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
- }
- else
- return NULL; /* XXX: there's really no way to resolve this... */
+ if (GS(id->name) == ID_KE)
+ return BLI_sprintfN("key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
+ else
+ return BLI_sprintfN("shape_keys.key_blocks[\"%s\"].data[%d]", name_esc_kb, index);
+ }
+ else
+ return NULL; /* XXX: there's really no way to resolve this... */
}
#else
const EnumPropertyItem rna_enum_keyblock_type_items[] = {
- {KEY_LINEAR, "KEY_LINEAR", 0, "Linear", ""},
- {KEY_CARDINAL, "KEY_CARDINAL", 0, "Cardinal", ""},
- {KEY_CATMULL_ROM, "KEY_CATMULL_ROM", 0, "Catmull-Rom", ""},
- {KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""},
- {0, NULL, 0, NULL, NULL},
+ {KEY_LINEAR, "KEY_LINEAR", 0, "Linear", ""},
+ {KEY_CARDINAL, "KEY_CARDINAL", 0, "Cardinal", ""},
+ {KEY_CATMULL_ROM, "KEY_CATMULL_ROM", 0, "Catmull-Rom", ""},
+ {KEY_BSPLINE, "KEY_BSPLINE", 0, "BSpline", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const float tilt_limit = DEG2RADF(21600.0f);
static void rna_def_keydata(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShapeKeyPoint", NULL);
- RNA_def_struct_ui_text(srna, "Shape Key Point", "Point in a shape key");
- RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- srna = RNA_def_struct(brna, "ShapeKeyCurvePoint", NULL);
- RNA_def_struct_ui_text(srna, "Shape Key Curve Point", "Point in a shape key for curves");
- /* there's nothing type specific here, so this is fine for now */
- RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyCurvePoint_tilt_get", "rna_ShapeKeyCurvePoint_tilt_set", NULL);
- RNA_def_property_range(prop, -tilt_limit, tilt_limit);
- RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
- RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyCurvePoint_radius_get", "rna_ShapeKeyCurvePoint_radius_set", NULL);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Radius", "Radius for beveling");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- srna = RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL);
- RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for Bezier curves");
- /* there's nothing type specific here, so this is fine for now */
- RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_co_get", "rna_ShapeKeyBezierPoint_co_set", NULL);
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_1_co_get",
- "rna_ShapeKeyBezierPoint_handle_1_co_set", NULL);
- RNA_def_property_ui_text(prop, "Handle 1 Location", "");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_handle_2_co_get",
- "rna_ShapeKeyBezierPoint_handle_2_co_set", NULL);
- RNA_def_property_ui_text(prop, "Handle 2 Location", "");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_tilt_get", "rna_ShapeKeyBezierPoint_tilt_set", NULL);
- RNA_def_property_range(prop, -tilt_limit, tilt_limit);
- RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
- RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_ShapeKeyBezierPoint_radius_get", "rna_ShapeKeyBezierPoint_radius_set", NULL);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Radius", "Radius for beveling");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShapeKeyPoint", NULL);
+ RNA_def_struct_ui_text(srna, "Shape Key Point", "Point in a shape key");
+ RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ srna = RNA_def_struct(brna, "ShapeKeyCurvePoint", NULL);
+ RNA_def_struct_ui_text(srna, "Shape Key Curve Point", "Point in a shape key for curves");
+ /* there's nothing type specific here, so this is fine for now */
+ RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_ShapeKeyPoint_co_get", "rna_ShapeKeyPoint_co_set", NULL);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_funcs(
+ prop, "rna_ShapeKeyCurvePoint_tilt_get", "rna_ShapeKeyCurvePoint_tilt_set", NULL);
+ RNA_def_property_range(prop, -tilt_limit, tilt_limit);
+ RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
+ RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_ShapeKeyCurvePoint_radius_get", "rna_ShapeKeyCurvePoint_radius_set", NULL);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Radius", "Radius for beveling");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ srna = RNA_def_struct(brna, "ShapeKeyBezierPoint", NULL);
+ RNA_def_struct_ui_text(srna, "Shape Key Bezier Point", "Point in a shape key for Bezier curves");
+ /* there's nothing type specific here, so this is fine for now */
+ RNA_def_struct_path_func(srna, "rna_ShapeKeyPoint_path");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(
+ prop, "rna_ShapeKeyBezierPoint_co_get", "rna_ShapeKeyBezierPoint_co_set", NULL);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop,
+ "rna_ShapeKeyBezierPoint_handle_1_co_get",
+ "rna_ShapeKeyBezierPoint_handle_1_co_set",
+ NULL);
+ RNA_def_property_ui_text(prop, "Handle 1 Location", "");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop,
+ "rna_ShapeKeyBezierPoint_handle_2_co_get",
+ "rna_ShapeKeyBezierPoint_handle_2_co_set",
+ NULL);
+ RNA_def_property_ui_text(prop, "Handle 2 Location", "");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_funcs(
+ prop, "rna_ShapeKeyBezierPoint_tilt_get", "rna_ShapeKeyBezierPoint_tilt_set", NULL);
+ RNA_def_property_range(prop, -tilt_limit, tilt_limit);
+ RNA_def_property_ui_range(prop, -tilt_limit, tilt_limit, 10, 3);
+ RNA_def_property_ui_text(prop, "Tilt", "Tilt in 3D View");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_ShapeKeyBezierPoint_radius_get", "rna_ShapeKeyBezierPoint_radius_set", NULL);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Radius", "Radius for beveling");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
}
static void rna_def_keyblock(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop, *parm;
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "ShapeKey", NULL);
- RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys data-block");
- RNA_def_struct_sdna(srna, "KeyBlock");
- RNA_def_struct_path_func(srna, "rna_ShapeKey_path");
- RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Name of Shape Key");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShapeKey_name_set");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
- RNA_def_struct_name_property(srna, prop);
-
- /* keys need to be sorted to edit this */
- prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_sdna(prop, NULL, "pos");
- RNA_def_property_float_funcs(prop, "rna_ShapeKey_frame_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- /* for now, this is editable directly, as users can set this even if they're not animating them
- * (to test results) */
- prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "curval");
- RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
- RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
- RNA_def_property_ui_text(prop, "Interpolation", "Interpolation type for absolute shape keys");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgroup");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex weight group, to blend with basis shape");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ShapeKey");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL | PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_pointer_funcs(prop, "rna_ShapeKey_relative_key_get",
- "rna_ShapeKey_relative_key_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
- RNA_def_property_ui_text(prop, "Mute", "Toggle this shape key");
- RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "slidermin");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_slider_min_set", "rna_ShapeKey_slider_min_range");
- RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider");
-
- prop = RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "slidermax");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_slider_max_set", "rna_ShapeKey_slider_max_range");
- RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider");
-
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
- RNA_def_property_struct_type(prop, "UnknownType");
- RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_ShapeKey_data_begin", NULL, NULL, "rna_ShapeKey_data_get",
- "rna_ShapeKey_data_length", "rna_ShapeKey_data_lookup_int", NULL, NULL);
-
- /* XXX multi-dim dynamic arrays are very badly supported by (py)rna currently, those are defined for the day
- * it works better, for now user will get a 1D tuple...
- */
- func = RNA_def_function(srna, "normals_vertex_get", "rna_KeyBlock_normals_vert_calc");
- RNA_def_function_ui_description(func, "Compute local space vertices' normals for this shape key");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
- RNA_def_property_multi_array(parm, 2, NULL);
- RNA_def_property_range(parm, -1.0f, 1.0f);
- RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_vert_len");
-
- func = RNA_def_function(srna, "normals_polygon_get", "rna_KeyBlock_normals_poly_calc");
- RNA_def_function_ui_description(func, "Compute local space faces' normals for this shape key");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
- RNA_def_property_multi_array(parm, 2, NULL);
- RNA_def_property_range(parm, -1.0f, 1.0f);
- RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_poly_len");
-
- func = RNA_def_function(srna, "normals_split_get", "rna_KeyBlock_normals_loop_calc");
- RNA_def_function_ui_description(func, "Compute local space face corners' normals for this shape key");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
- RNA_def_property_multi_array(parm, 2, NULL);
- RNA_def_property_range(parm, -1.0f, 1.0f);
- RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_loop_len");
+ StructRNA *srna;
+ PropertyRNA *prop, *parm;
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "ShapeKey", NULL);
+ RNA_def_struct_ui_text(srna, "Shape Key", "Shape key in a shape keys data-block");
+ RNA_def_struct_sdna(srna, "KeyBlock");
+ RNA_def_struct_path_func(srna, "rna_ShapeKey_path");
+ RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Name of Shape Key");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShapeKey_name_set");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* keys need to be sorted to edit this */
+ prop = RNA_def_property(srna, "frame", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_sdna(prop, NULL, "pos");
+ RNA_def_property_float_funcs(prop, "rna_ShapeKey_frame_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Frame", "Frame for absolute keys");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ /* for now, this is editable directly, as users can set this even if they're not animating them
+ * (to test results) */
+ prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "curval");
+ RNA_def_property_float_funcs(prop, NULL, "rna_ShapeKey_value_set", "rna_ShapeKey_value_range");
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Value", "Value of shape key at the current frame");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Interpolation type for absolute shape keys");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgroup");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex weight group, to blend with basis shape");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ShapeKey");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL | PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_ShapeKey_relative_key_get", "rna_ShapeKey_relative_key_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Relative Key", "Shape used as a relative key");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYBLOCK_MUTE);
+ RNA_def_property_ui_text(prop, "Mute", "Toggle this shape key");
+ RNA_def_property_ui_icon(prop, ICON_CHECKBOX_HLT, -1);
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "slider_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "slidermin");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_ShapeKey_slider_min_set", "rna_ShapeKey_slider_min_range");
+ RNA_def_property_ui_text(prop, "Slider Min", "Minimum for slider");
+
+ prop = RNA_def_property(srna, "slider_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "slidermax");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_ShapeKey_slider_max_set", "rna_ShapeKey_slider_max_range");
+ RNA_def_property_ui_text(prop, "Slider Max", "Maximum for slider");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "data", "totelem");
+ RNA_def_property_struct_type(prop, "UnknownType");
+ RNA_def_property_ui_text(prop, "Data", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_ShapeKey_data_begin",
+ NULL,
+ NULL,
+ "rna_ShapeKey_data_get",
+ "rna_ShapeKey_data_length",
+ "rna_ShapeKey_data_lookup_int",
+ NULL,
+ NULL);
+
+ /* XXX multi-dim dynamic arrays are very badly supported by (py)rna currently, those are defined for the day
+ * it works better, for now user will get a 1D tuple...
+ */
+ func = RNA_def_function(srna, "normals_vertex_get", "rna_KeyBlock_normals_vert_calc");
+ RNA_def_function_ui_description(func,
+ "Compute local space vertices' normals for this shape key");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
+ RNA_def_property_multi_array(parm, 2, NULL);
+ RNA_def_property_range(parm, -1.0f, 1.0f);
+ RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_vert_len");
+
+ func = RNA_def_function(srna, "normals_polygon_get", "rna_KeyBlock_normals_poly_calc");
+ RNA_def_function_ui_description(func, "Compute local space faces' normals for this shape key");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
+ RNA_def_property_multi_array(parm, 2, NULL);
+ RNA_def_property_range(parm, -1.0f, 1.0f);
+ RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_poly_len");
+
+ func = RNA_def_function(srna, "normals_split_get", "rna_KeyBlock_normals_loop_calc");
+ RNA_def_function_ui_description(func,
+ "Compute local space face corners' normals for this shape key");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_property(func, "normals", PROP_FLOAT, /* PROP_DIRECTION */ PROP_NONE);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
+ RNA_def_property_multi_array(parm, 2, NULL);
+ RNA_def_property_range(parm, -1.0f, 1.0f);
+ RNA_def_property_dynamic_array_funcs(parm, "rna_KeyBlock_normals_loop_len");
}
static void rna_def_key(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Key", "ID");
- RNA_def_struct_ui_text(srna, "Key", "Shape keys data-block containing different shapes of geometric data-blocks");
- RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
-
- prop = RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_sdna(prop, NULL, "refkey");
- RNA_def_property_ui_text(prop, "Reference Key", "");
-
- prop = RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "block", NULL);
- RNA_def_property_struct_type(prop, "ShapeKey");
- RNA_def_property_ui_text(prop, "Key Blocks", "Shape keys");
-
- rna_def_animdata_common(srna);
-
- prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "from");
- RNA_def_property_ui_text(prop, "User", "Data-block using these shape keys");
-
- prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type", KEY_RELATIVE);
- RNA_def_property_ui_text(prop, "Relative",
- "Make shape keys relative, "
- "otherwise play through shapes as a sequence using the evaluation time");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
-
- prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ctime");
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time for absolute shape keys");
- RNA_def_property_update(prop, 0, "rna_Key_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Key", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Key", "Shape keys data-block containing different shapes of geometric data-blocks");
+ RNA_def_struct_ui_icon(srna, ICON_SHAPEKEY_DATA);
+
+ prop = RNA_def_property(srna, "reference_key", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_sdna(prop, NULL, "refkey");
+ RNA_def_property_ui_text(prop, "Reference Key", "");
+
+ prop = RNA_def_property(srna, "key_blocks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "block", NULL);
+ RNA_def_property_struct_type(prop, "ShapeKey");
+ RNA_def_property_ui_text(prop, "Key Blocks", "Shape keys");
+
+ rna_def_animdata_common(srna);
+
+ prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "from");
+ RNA_def_property_ui_text(prop, "User", "Data-block using these shape keys");
+
+ prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type", KEY_RELATIVE);
+ RNA_def_property_ui_text(
+ prop,
+ "Relative",
+ "Make shape keys relative, "
+ "otherwise play through shapes as a sequence using the evaluation time");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
+
+ prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ctime");
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time for absolute shape keys");
+ RNA_def_property_update(prop, 0, "rna_Key_update_data");
}
void RNA_def_key(BlenderRNA *brna)
{
- rna_def_key(brna);
- rna_def_keyblock(brna);
- rna_def_keydata(brna);
+ rna_def_key(brna);
+ rna_def_keyblock(brna);
+ rna_def_keydata(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_lattice.c b/source/blender/makesrna/intern/rna_lattice.c
index 410598082db..fade937b321 100644
--- a/source/blender/makesrna/intern/rna_lattice.c
+++ b/source/blender/makesrna/intern/rna_lattice.c
@@ -33,344 +33,373 @@
#ifdef RNA_RUNTIME
-#include "DNA_object_types.h"
-#include "DNA_scene_types.h"
+# include "DNA_object_types.h"
+# include "DNA_scene_types.h"
-#include "BLI_string.h"
-#include "BKE_lattice.h"
-#include "BKE_main.h"
-#include "BKE_deform.h"
+# include "BLI_string.h"
+# include "BKE_lattice.h"
+# include "BKE_main.h"
+# include "BKE_deform.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "WM_api.h"
-#include "WM_types.h"
-#include "ED_lattice.h"
+# include "WM_api.h"
+# include "WM_types.h"
+# include "ED_lattice.h"
static void rna_LatticePoint_co_get(PointerRNA *ptr, float *values)
{
- Lattice *lt = (Lattice *)ptr->id.data;
- BPoint *bp = (BPoint *)ptr->data;
- int index = bp - lt->def;
- int u, v, w;
+ Lattice *lt = (Lattice *)ptr->id.data;
+ BPoint *bp = (BPoint *)ptr->data;
+ int index = bp - lt->def;
+ int u, v, w;
- BKE_lattice_index_to_uvw(lt, index, &u, &v, &w);
+ BKE_lattice_index_to_uvw(lt, index, &u, &v, &w);
- values[0] = lt->fu + u * lt->du;
- values[1] = lt->fv + v * lt->dv;
- values[2] = lt->fw + w * lt->dw;
+ values[0] = lt->fu + u * lt->du;
+ values[1] = lt->fv + v * lt->dv;
+ values[2] = lt->fw + w * lt->dw;
}
static void rna_LatticePoint_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Lattice *lt = (Lattice *)ptr->id.data;
+ Lattice *lt = (Lattice *)ptr->id.data;
- if (lt->dvert) {
- BPoint *bp = (BPoint *)ptr->data;
- MDeformVert *dvert = lt->dvert + (bp - lt->def);
+ if (lt->dvert) {
+ BPoint *bp = (BPoint *)ptr->data;
+ MDeformVert *dvert = lt->dvert + (bp - lt->def);
- rna_iterator_array_begin(iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
- }
- else
- rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
+ rna_iterator_array_begin(
+ iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
+ }
+ else
+ rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
static void rna_Lattice_points_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Lattice *lt = (Lattice *)ptr->data;
- int tot = lt->pntsu * lt->pntsv * lt->pntsw;
-
- if (lt->editlatt && lt->editlatt->latt->def)
- rna_iterator_array_begin(iter, (void *)lt->editlatt->latt->def, sizeof(BPoint), tot, 0, NULL);
- else if (lt->def)
- rna_iterator_array_begin(iter, (void *)lt->def, sizeof(BPoint), tot, 0, NULL);
- else
- rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
+ Lattice *lt = (Lattice *)ptr->data;
+ int tot = lt->pntsu * lt->pntsv * lt->pntsw;
+
+ if (lt->editlatt && lt->editlatt->latt->def)
+ rna_iterator_array_begin(iter, (void *)lt->editlatt->latt->def, sizeof(BPoint), tot, 0, NULL);
+ else if (lt->def)
+ rna_iterator_array_begin(iter, (void *)lt->def, sizeof(BPoint), tot, 0, NULL);
+ else
+ rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
static void rna_Lattice_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
/* copy settings to editlattice,
* we could split this up differently (one update call per property)
* but for now that's overkill
*/
-static void rna_Lattice_update_data_editlatt(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Lattice_update_data_editlatt(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- Lattice *lt = (Lattice *)ptr->id.data;
-
- if (lt->editlatt) {
- Lattice *lt_em = lt->editlatt->latt;
- lt_em->typeu = lt->typeu;
- lt_em->typev = lt->typev;
- lt_em->typew = lt->typew;
- lt_em->flag = lt->flag;
- BLI_strncpy(lt_em->vgroup, lt->vgroup, sizeof(lt_em->vgroup));
- }
-
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ ID *id = ptr->id.data;
+ Lattice *lt = (Lattice *)ptr->id.data;
+
+ if (lt->editlatt) {
+ Lattice *lt_em = lt->editlatt->latt;
+ lt_em->typeu = lt->typeu;
+ lt_em->typev = lt->typev;
+ lt_em->typew = lt->typew;
+ lt_em->flag = lt->flag;
+ BLI_strncpy(lt_em->vgroup, lt->vgroup, sizeof(lt_em->vgroup));
+ }
+
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
}
static void rna_Lattice_update_size(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Lattice *lt = ptr->id.data;
- Object *ob;
- int newu, newv, neww;
-
- /* we don't modify the actual pnts, but go through opnts instead */
- newu = (lt->opntsu > 0) ? lt->opntsu : lt->pntsu;
- newv = (lt->opntsv > 0) ? lt->opntsv : lt->pntsv;
- neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw;
-
- /* BKE_lattice_resize needs an object, any object will have the same result */
- for (ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (ob->data == lt) {
- BKE_lattice_resize(lt, newu, newv, neww, ob);
- if (lt->editlatt)
- BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, ob);
- break;
- }
- }
-
- /* otherwise without, means old points are not repositioned */
- if (!ob) {
- BKE_lattice_resize(lt, newu, newv, neww, NULL);
- if (lt->editlatt)
- BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, NULL);
- }
-
- rna_Lattice_update_data(bmain, scene, ptr);
+ Lattice *lt = ptr->id.data;
+ Object *ob;
+ int newu, newv, neww;
+
+ /* we don't modify the actual pnts, but go through opnts instead */
+ newu = (lt->opntsu > 0) ? lt->opntsu : lt->pntsu;
+ newv = (lt->opntsv > 0) ? lt->opntsv : lt->pntsv;
+ neww = (lt->opntsw > 0) ? lt->opntsw : lt->pntsw;
+
+ /* BKE_lattice_resize needs an object, any object will have the same result */
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (ob->data == lt) {
+ BKE_lattice_resize(lt, newu, newv, neww, ob);
+ if (lt->editlatt)
+ BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, ob);
+ break;
+ }
+ }
+
+ /* otherwise without, means old points are not repositioned */
+ if (!ob) {
+ BKE_lattice_resize(lt, newu, newv, neww, NULL);
+ if (lt->editlatt)
+ BKE_lattice_resize(lt->editlatt->latt, newu, newv, neww, NULL);
+ }
+
+ rna_Lattice_update_data(bmain, scene, ptr);
}
static void rna_Lattice_use_outside_set(PointerRNA *ptr, bool value)
{
- Lattice *lt = ptr->data;
+ Lattice *lt = ptr->data;
- if (value) lt->flag |= LT_OUTSIDE;
- else lt->flag &= ~LT_OUTSIDE;
+ if (value)
+ lt->flag |= LT_OUTSIDE;
+ else
+ lt->flag &= ~LT_OUTSIDE;
- outside_lattice(lt);
+ outside_lattice(lt);
- if (lt->editlatt) {
- if (value) lt->editlatt->latt->flag |= LT_OUTSIDE;
- else lt->editlatt->latt->flag &= ~LT_OUTSIDE;
+ if (lt->editlatt) {
+ if (value)
+ lt->editlatt->latt->flag |= LT_OUTSIDE;
+ else
+ lt->editlatt->latt->flag &= ~LT_OUTSIDE;
- outside_lattice(lt->editlatt->latt);
- }
+ outside_lattice(lt->editlatt->latt);
+ }
}
static int rna_Lattice_size_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- Lattice *lt = (Lattice *)ptr->data;
+ Lattice *lt = (Lattice *)ptr->data;
- return (lt->key == NULL) ? PROP_EDITABLE : 0;
+ return (lt->key == NULL) ? PROP_EDITABLE : 0;
}
static void rna_Lattice_points_u_set(PointerRNA *ptr, int value)
{
- Lattice *lt = (Lattice *)ptr->data;
+ Lattice *lt = (Lattice *)ptr->data;
- lt->opntsu = CLAMPIS(value, 1, 64);
+ lt->opntsu = CLAMPIS(value, 1, 64);
}
static void rna_Lattice_points_v_set(PointerRNA *ptr, int value)
{
- Lattice *lt = (Lattice *)ptr->data;
+ Lattice *lt = (Lattice *)ptr->data;
- lt->opntsv = CLAMPIS(value, 1, 64);
+ lt->opntsv = CLAMPIS(value, 1, 64);
}
static void rna_Lattice_points_w_set(PointerRNA *ptr, int value)
{
- Lattice *lt = (Lattice *)ptr->data;
+ Lattice *lt = (Lattice *)ptr->data;
- lt->opntsw = CLAMPIS(value, 1, 64);
+ lt->opntsw = CLAMPIS(value, 1, 64);
}
static void rna_Lattice_vg_name_set(PointerRNA *ptr, const char *value)
{
- Lattice *lt = ptr->data;
- BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup));
+ Lattice *lt = ptr->data;
+ BLI_strncpy(lt->vgroup, value, sizeof(lt->vgroup));
- if (lt->editlatt) {
- BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup));
- }
+ if (lt->editlatt) {
+ BLI_strncpy(lt->editlatt->latt->vgroup, value, sizeof(lt->editlatt->latt->vgroup));
+ }
}
/* annoying, but is a consequence of RNA structures... */
static char *rna_LatticePoint_path(PointerRNA *ptr)
{
- Lattice *lt = (Lattice *)ptr->id.data;
- void *point = ptr->data;
- BPoint *points = NULL;
+ Lattice *lt = (Lattice *)ptr->id.data;
+ void *point = ptr->data;
+ BPoint *points = NULL;
- if (lt->editlatt && lt->editlatt->latt->def)
- points = lt->editlatt->latt->def;
- else
- points = lt->def;
+ if (lt->editlatt && lt->editlatt->latt->def)
+ points = lt->editlatt->latt->def;
+ else
+ points = lt->def;
- if (points && point) {
- int tot = lt->pntsu * lt->pntsv * lt->pntsw;
+ if (points && point) {
+ int tot = lt->pntsu * lt->pntsv * lt->pntsw;
- /* only return index if in range */
- if ((point >= (void *)points) && (point < (void *)(points + tot))) {
- int pt_index = (int)((BPoint *)point - points);
+ /* only return index if in range */
+ if ((point >= (void *)points) && (point < (void *)(points + tot))) {
+ int pt_index = (int)((BPoint *)point - points);
- return BLI_sprintfN("points[%d]", pt_index);
- }
- }
+ return BLI_sprintfN("points[%d]", pt_index);
+ }
+ }
- return BLI_strdup("");
+ return BLI_strdup("");
}
static bool rna_Lattice_is_editmode_get(PointerRNA *ptr)
{
- Lattice *lt = (Lattice *)ptr->id.data;
- return (lt->editlatt != NULL);
+ Lattice *lt = (Lattice *)ptr->id.data;
+ return (lt->editlatt != NULL);
}
#else
static void rna_def_latticepoint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LatticePoint", NULL);
- RNA_def_struct_sdna(srna, "BPoint");
- RNA_def_struct_ui_text(srna, "LatticePoint", "Point in the lattice grid");
- RNA_def_struct_path_func(srna, "rna_LatticePoint_path");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
- RNA_def_property_ui_text(prop, "Point selected", "Selection status");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_LatticePoint_co_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Location",
- "Original undeformed location used to calculate the strength of the deform effect "
- "(edit/animate the Deformed Location instead)");
-
- prop = RNA_def_property(srna, "co_deform", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "vec");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Deformed Location", "");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
-
- prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_range(prop, 0.01f, 100.0f);
- RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
-
- prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_LatticePoint_groups_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "VertexGroupElement");
- RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this point is member of");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LatticePoint", NULL);
+ RNA_def_struct_sdna(srna, "BPoint");
+ RNA_def_struct_ui_text(srna, "LatticePoint", "Point in the lattice grid");
+ RNA_def_struct_path_func(srna, "rna_LatticePoint_path");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "f1", 0);
+ RNA_def_property_ui_text(prop, "Point selected", "Selection status");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_LatticePoint_co_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Location",
+ "Original undeformed location used to calculate the strength of the deform effect "
+ "(edit/animate the Deformed Location instead)");
+
+ prop = RNA_def_property(srna, "co_deform", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "vec");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Deformed Location", "");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+
+ prop = RNA_def_property(srna, "weight_softbody", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Softbody goal weight");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data");
+
+ prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_LatticePoint_groups_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "VertexGroupElement");
+ RNA_def_property_ui_text(
+ prop, "Groups", "Weights for the vertex groups this point is member of");
}
static void rna_def_lattice(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Lattice", "ID");
- RNA_def_struct_ui_text(srna, "Lattice", "Lattice data-block defining a grid for deforming other objects");
- RNA_def_struct_ui_icon(srna, ICON_LATTICE_DATA);
-
- prop = RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pntsu");
- RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL);
- RNA_def_property_range(prop, 1, 64);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "U", "Point in U direction (can't be changed when there are shape keys)");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
- RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
-
- prop = RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pntsv");
- RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL);
- RNA_def_property_range(prop, 1, 64);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "V", "Point in V direction (can't be changed when there are shape keys)");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
- RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
-
- prop = RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "pntsw");
- RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL);
- RNA_def_property_range(prop, 1, 64);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "W", "Point in W direction (can't be changed when there are shape keys)");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
- RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
-
- prop = RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typeu");
- RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
- RNA_def_property_ui_text(prop, "Interpolation Type U", "");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
-
- prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typev");
- RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
- RNA_def_property_ui_text(prop, "Interpolation Type V", "");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
-
- prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typew");
- RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
- RNA_def_property_ui_text(prop, "Interpolation Type W", "");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
-
- prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set");
- RNA_def_property_ui_text(prop, "Outside", "Only draw, and take into account, the outer vertices");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgroup");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group to apply the influence of the lattice");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set");
- RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
-
- prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "key");
- RNA_def_property_ui_text(prop, "Shape Keys", "");
-
- prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "LatticePoint");
- RNA_def_property_collection_funcs(prop, "rna_Lattice_points_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
-
- prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Lattice_is_editmode_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
-
- /* pointers */
- rna_def_animdata_common(srna);
-
- RNA_api_lattice(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Lattice", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Lattice", "Lattice data-block defining a grid for deforming other objects");
+ RNA_def_struct_ui_icon(srna, ICON_LATTICE_DATA);
+
+ prop = RNA_def_property(srna, "points_u", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pntsu");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_u_set", NULL);
+ RNA_def_property_range(prop, 1, 64);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "U", "Point in U direction (can't be changed when there are shape keys)");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
+ RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
+
+ prop = RNA_def_property(srna, "points_v", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pntsv");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_v_set", NULL);
+ RNA_def_property_range(prop, 1, 64);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "V", "Point in V direction (can't be changed when there are shape keys)");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
+ RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
+
+ prop = RNA_def_property(srna, "points_w", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "pntsw");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Lattice_points_w_set", NULL);
+ RNA_def_property_range(prop, 1, 64);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "W", "Point in W direction (can't be changed when there are shape keys)");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_size");
+ RNA_def_property_editable_func(prop, "rna_Lattice_size_editable");
+
+ prop = RNA_def_property(srna, "interpolation_type_u", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typeu");
+ RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
+ RNA_def_property_ui_text(prop, "Interpolation Type U", "");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
+
+ prop = RNA_def_property(srna, "interpolation_type_v", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typev");
+ RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
+ RNA_def_property_ui_text(prop, "Interpolation Type V", "");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
+
+ prop = RNA_def_property(srna, "interpolation_type_w", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typew");
+ RNA_def_property_enum_items(prop, rna_enum_keyblock_type_items);
+ RNA_def_property_ui_text(prop, "Interpolation Type W", "");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
+
+ prop = RNA_def_property(srna, "use_outside", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LT_OUTSIDE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Lattice_use_outside_set");
+ RNA_def_property_ui_text(
+ prop, "Outside", "Only draw, and take into account, the outer vertices");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgroup");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group", "Vertex group to apply the influence of the lattice");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Lattice_vg_name_set");
+ RNA_def_property_update(prop, 0, "rna_Lattice_update_data_editlatt");
+
+ prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "key");
+ RNA_def_property_ui_text(prop, "Shape Keys", "");
+
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "LatticePoint");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Lattice_points_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Points", "Points of the lattice");
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Lattice_is_editmode_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+
+ /* pointers */
+ rna_def_animdata_common(srna);
+
+ RNA_api_lattice(srna);
}
void RNA_def_lattice(BlenderRNA *brna)
{
- rna_def_lattice(brna);
- rna_def_latticepoint(brna);
+ rna_def_lattice(brna);
+ rna_def_latticepoint(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_lattice_api.c b/source/blender/makesrna/intern/rna_lattice_api.c
index f3bdb694c50..6aa9dfe803d 100644
--- a/source/blender/makesrna/intern/rna_lattice_api.c
+++ b/source/blender/makesrna/intern/rna_lattice_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -31,35 +30,35 @@
#include "BLI_utildefines.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
static void rna_Lattice_transform(Lattice *lt, float *mat, bool shape_keys)
{
- BKE_lattice_transform(lt, (float (*)[4])mat, shape_keys);
+ BKE_lattice_transform(lt, (float(*)[4])mat, shape_keys);
- DEG_id_tag_update(&lt->id, 0);
+ DEG_id_tag_update(&lt->id, 0);
}
static void rna_Lattice_update_gpu_tag(Lattice *lt)
{
- BKE_lattice_batch_cache_dirty_tag(lt, BKE_LATTICE_BATCH_DIRTY_ALL);
+ BKE_lattice_batch_cache_dirty_tag(lt, BKE_LATTICE_BATCH_DIRTY_ALL);
}
#else
void RNA_api_lattice(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- func = RNA_def_function(srna, "transform", "rna_Lattice_transform");
- RNA_def_function_ui_description(func, "Transform lattice by a matrix");
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
+ func = RNA_def_function(srna, "transform", "rna_Lattice_transform");
+ RNA_def_function_ui_description(func, "Transform lattice by a matrix");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
- RNA_def_function(srna, "update_gpu_tag", "rna_Lattice_update_gpu_tag");
+ RNA_def_function(srna, "update_gpu_tag", "rna_Lattice_update_gpu_tag");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index 527c530f493..a71adec4e5c 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -22,7 +22,6 @@
#include "DNA_layer_types.h"
#include "DNA_view3d_types.h"
-
#include "BLT_translation.h"
#include "ED_object.h"
@@ -41,402 +40,430 @@
#ifdef RNA_RUNTIME
-#ifdef WITH_PYTHON
-# include "BPY_extern.h"
-#endif
+# ifdef WITH_PYTHON
+# include "BPY_extern.h"
+# endif
-#include "DNA_collection_types.h"
-#include "DNA_object_types.h"
+# include "DNA_collection_types.h"
+# include "DNA_object_types.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "BKE_idprop.h"
-#include "BKE_layer.h"
-#include "BKE_node.h"
-#include "BKE_scene.h"
-#include "BKE_mesh.h"
+# include "BKE_idprop.h"
+# include "BKE_layer.h"
+# include "BKE_node.h"
+# include "BKE_scene.h"
+# include "BKE_mesh.h"
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph_query.h"
/***********************************/
-
static PointerRNA rna_ViewLayer_active_layer_collection_get(PointerRNA *ptr)
{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- LayerCollection *lc = view_layer->active_collection;
- return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc);
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ LayerCollection *lc = view_layer->active_collection;
+ return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc);
}
static void rna_ViewLayer_active_layer_collection_set(PointerRNA *ptr, PointerRNA value)
{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- LayerCollection *lc = (LayerCollection *)value.data;
- const int index = BKE_layer_collection_findindex(view_layer, lc);
- if (index != -1) {
- BKE_layer_collection_activate(view_layer, lc);
- }
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ LayerCollection *lc = (LayerCollection *)value.data;
+ const int index = BKE_layer_collection_findindex(view_layer, lc);
+ if (index != -1) {
+ BKE_layer_collection_activate(view_layer, lc);
+ }
}
static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr)
{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Object, view_layer->basact ? view_layer->basact->object : NULL);
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_Object, view_layer->basact ? view_layer->basact->object : NULL);
}
static void rna_LayerObjects_active_object_set(PointerRNA *ptr, PointerRNA value)
{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- if (value.data)
- view_layer->basact = BKE_view_layer_base_find(view_layer, (Object *)value.data);
- else
- view_layer->basact = NULL;
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ if (value.data)
+ view_layer->basact = BKE_view_layer_base_find(view_layer, (Object *)value.data);
+ else
+ view_layer->basact = NULL;
}
static char *rna_ViewLayer_path(PointerRNA *ptr)
{
- ViewLayer *srl = (ViewLayer *)ptr->data;
- char name_esc[sizeof(srl->name) * 2];
+ ViewLayer *srl = (ViewLayer *)ptr->data;
+ char name_esc[sizeof(srl->name) * 2];
- BLI_strescape(name_esc, srl->name, sizeof(name_esc));
- return BLI_sprintfN("view_layers[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, srl->name, sizeof(name_esc));
+ return BLI_sprintfN("view_layers[\"%s\"]", name_esc);
}
static IDProperty *rna_ViewLayer_idprops(PointerRNA *ptr, bool create)
{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
- if (create && !view_layer->id_properties) {
- IDPropertyTemplate val = {0};
- view_layer->id_properties = IDP_New(IDP_GROUP, &val, "ViewLayer ID properties");
- }
+ if (create && !view_layer->id_properties) {
+ IDPropertyTemplate val = {0};
+ view_layer->id_properties = IDP_New(IDP_GROUP, &val, "ViewLayer ID properties");
+ }
- return view_layer->id_properties;
+ return view_layer->id_properties;
}
static void rna_ViewLayer_update_render_passes(ID *id)
{
- Scene *scene = (Scene *)id;
- if (scene->nodetree)
- ntreeCompositUpdateRLayers(scene->nodetree);
+ Scene *scene = (Scene *)id;
+ if (scene->nodetree)
+ ntreeCompositUpdateRLayers(scene->nodetree);
}
static PointerRNA rna_ViewLayer_objects_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- /* we are actually iterating a ObjectBase list */
- Base *base = (Base *)internal->link;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
+ /* we are actually iterating a ObjectBase list */
+ Base *base = (Base *)internal->link;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
}
-static int rna_ViewLayer_objects_selected_skip(CollectionPropertyIterator *iter, void *UNUSED(data))
+static int rna_ViewLayer_objects_selected_skip(CollectionPropertyIterator *iter,
+ void *UNUSED(data))
{
- ListBaseIterator *internal = &iter->internal.listbase;
- Base *base = (Base *)internal->link;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ Base *base = (Base *)internal->link;
- if ((base->flag & BASE_SELECTED) != 0) {
- return 0;
- }
+ if ((base->flag & BASE_SELECTED) != 0) {
+ return 0;
+ }
- return 1;
+ return 1;
};
static PointerRNA rna_ViewLayer_depsgraph_get(PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- if (GS(id->name) == ID_SCE) {
- Scene *scene = (Scene *)id;
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
- return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, depsgraph);
- }
- return PointerRNA_NULL;
+ ID *id = ptr->id.data;
+ if (GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *)id;
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, false);
+ return rna_pointer_inherit_refine(ptr, &RNA_Depsgraph, depsgraph);
+ }
+ return PointerRNA_NULL;
}
static void rna_LayerObjects_selected_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- rna_iterator_listbase_begin(iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip);
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ rna_iterator_listbase_begin(
+ iter, &view_layer->object_bases, rna_ViewLayer_objects_selected_skip);
}
static void rna_ViewLayer_update_tagged(ID *id_ptr, ViewLayer *view_layer, Main *bmain)
{
-#ifdef WITH_PYTHON
- /* Allow drivers to be evaluated */
- BPy_BEGIN_ALLOW_THREADS;
-#endif
-
- Scene *scene = (Scene *)id_ptr;
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
- BKE_scene_graph_update_tagged(depsgraph, bmain);
-
-#ifdef WITH_PYTHON
- BPy_END_ALLOW_THREADS;
-#endif
+# ifdef WITH_PYTHON
+ /* Allow drivers to be evaluated */
+ BPy_BEGIN_ALLOW_THREADS;
+# endif
+
+ Scene *scene = (Scene *)id_ptr;
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+ BKE_scene_graph_update_tagged(depsgraph, bmain);
+
+# ifdef WITH_PYTHON
+ BPy_END_ALLOW_THREADS;
+# endif
}
-static void rna_ObjectBase_select_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_ObjectBase_select_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Base *base = (Base *)ptr->data;
- short mode = (base->flag & BASE_SELECTED) ? BA_SELECT : BA_DESELECT;
- ED_object_base_select(base, mode);
+ Base *base = (Base *)ptr->data;
+ short mode = (base->flag & BASE_SELECTED) ? BA_SELECT : BA_DESELECT;
+ ED_object_base_select(base, mode);
}
static void rna_LayerCollection_name_get(struct PointerRNA *ptr, char *value)
{
- ID *id = (ID *)((LayerCollection *)ptr->data)->collection;
- BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2);
+ ID *id = (ID *)((LayerCollection *)ptr->data)->collection;
+ BLI_strncpy(value, id->name + 2, sizeof(id->name) - 2);
}
int rna_LayerCollection_name_length(PointerRNA *ptr)
{
- ID *id = (ID *)((LayerCollection *)ptr->data)->collection;
- return strlen(id->name + 2);
+ ID *id = (ID *)((LayerCollection *)ptr->data)->collection;
+ return strlen(id->name + 2);
}
static void rna_LayerCollection_exclude_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- LayerCollection *lc = (LayerCollection *)ptr->data;
- ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
+ Scene *scene = (Scene *)ptr->id.data;
+ LayerCollection *lc = (LayerCollection *)ptr->data;
+ ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
- BKE_layer_collection_sync(scene, view_layer);
+ BKE_layer_collection_sync(scene, view_layer);
- DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
static void rna_LayerCollection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- LayerCollection *lc = (LayerCollection *)ptr->data;
- ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
+ Scene *scene = (Scene *)ptr->id.data;
+ LayerCollection *lc = (LayerCollection *)ptr->data;
+ ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
- BKE_layer_collection_sync(scene, view_layer);
+ BKE_layer_collection_sync(scene, view_layer);
- DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
static bool rna_LayerCollection_has_objects(LayerCollection *lc)
{
- return (lc->runtime_flag & LAYER_COLLECTION_HAS_OBJECTS) != 0;
+ return (lc->runtime_flag & LAYER_COLLECTION_HAS_OBJECTS) != 0;
}
static bool rna_LayerCollection_has_selected_objects(LayerCollection *lc, ViewLayer *view_layer)
{
- return BKE_layer_collection_has_selected_objects(view_layer, lc);
+ return BKE_layer_collection_has_selected_objects(view_layer, lc);
}
#else
static void rna_def_layer_collection(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LayerCollection", NULL);
- RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection");
- RNA_def_struct_ui_icon(srna, ICON_GROUP);
-
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "collection->id.name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Name", "Name of this view layer (same as its collection one)");
- RNA_def_property_string_funcs(prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", NULL);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
- RNA_def_property_struct_type(prop, "LayerCollection");
- RNA_def_property_ui_text(prop, "Children", "Child layer collections");
-
- prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Exclude", "Exclude collection from view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update");
-
- prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
-
- prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Indirect Only",
- "Objects in collection only contribute indirectly (through shadows and reflections) "
- "in the view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
-
- prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_RESTRICT_VIEW);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
- RNA_def_property_ui_text(prop, "Disable Viewport", "Disable collection in viewport for this view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");
-
- prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Visible",
- "Whether this collection is visible, take into account the collection parent");
-
- func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
- RNA_def_function_ui_description(func, "");
- RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
-
- func = RNA_def_function(srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects");
- RNA_def_function_ui_description(func, "");
- prop = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to");
- RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
- RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LayerCollection", NULL);
+ RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP);
+
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "collection->id.name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Name", "Name of this view layer (same as its collection one)");
+ RNA_def_property_string_funcs(
+ prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
+ RNA_def_property_struct_type(prop, "LayerCollection");
+ RNA_def_property_ui_text(prop, "Children", "Child layer collections");
+
+ prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Exclude", "Exclude collection from view layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_exclude_update");
+
+ prop = RNA_def_property(srna, "holdout", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_HOLDOUT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Holdout", "Mask out objects in collection from view layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
+
+ prop = RNA_def_property(srna, "indirect_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_INDIRECT_ONLY);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Indirect Only",
+ "Objects in collection only contribute indirectly (through shadows and reflections) "
+ "in the view layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_update");
+
+ prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_RESTRICT_VIEW);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_ui_text(
+ prop, "Disable Viewport", "Disable collection in viewport for this view layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_update");
+
+ prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "runtime_flag", LAYER_COLLECTION_VISIBLE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Visible",
+ "Whether this collection is visible, take into account the collection parent");
+
+ func = RNA_def_function(srna, "has_objects", "rna_LayerCollection_has_objects");
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
+
+ func = RNA_def_function(
+ srna, "has_selected_objects", "rna_LayerCollection_has_selected_objects");
+ RNA_def_function_ui_description(func, "");
+ prop = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "ViewLayer the layer collection belongs to");
+ RNA_def_parameter_flags(prop, 0, PARM_REQUIRED);
+ RNA_def_function_return(func, RNA_def_boolean(func, "result", 0, "", ""));
}
static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "LayerObjects");
- srna = RNA_def_struct(brna, "LayerObjects", NULL);
- RNA_def_struct_sdna(srna, "ViewLayer");
- RNA_def_struct_ui_text(srna, "Layer Objects", "Collections of objects");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_pointer_funcs(prop, "rna_LayerObjects_active_object_get",
- "rna_LayerObjects_active_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer");
- /* Could call: ED_object_base_activate(C, rl->basact);
- * but would be a bad level call and it seems the notifier is enough */
- RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
-
- prop = RNA_def_property(srna, "selected", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_collection_funcs(prop, "rna_LayerObjects_selected_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_ViewLayer_objects_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Selected Objects", "All the selected objects of this layer");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "LayerObjects");
+ srna = RNA_def_struct(brna, "LayerObjects", NULL);
+ RNA_def_struct_sdna(srna, "ViewLayer");
+ RNA_def_struct_ui_text(srna, "Layer Objects", "Collections of objects");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_LayerObjects_active_object_get",
+ "rna_LayerObjects_active_object_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Object", "Active object for this layer");
+ /* Could call: ED_object_base_activate(C, rl->basact);
+ * but would be a bad level call and it seems the notifier is enough */
+ RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
+
+ prop = RNA_def_property(srna, "selected", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_collection_funcs(prop,
+ "rna_LayerObjects_selected_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_ViewLayer_objects_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Selected Objects", "All the selected objects of this layer");
}
static void rna_def_object_base(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ObjectBase", NULL);
- RNA_def_struct_sdna(srna, "Base");
- RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a render layer");
- RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "object");
- RNA_def_property_ui_text(prop, "Object", "Object this base links to");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_SELECTED);
- RNA_def_property_ui_text(prop, "Select", "Object base selection state");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ObjectBase_select_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ObjectBase", NULL);
+ RNA_def_struct_sdna(srna, "Base");
+ RNA_def_struct_ui_text(srna, "Object Base", "An object instance in a render layer");
+ RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object");
+ RNA_def_property_ui_text(prop, "Object", "Object this base links to");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", BASE_SELECTED);
+ RNA_def_property_ui_text(prop, "Select", "Object base selection state");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ObjectBase_select_update");
}
void RNA_def_view_layer(BlenderRNA *brna)
{
- FunctionRNA *func;
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ViewLayer", NULL);
- RNA_def_struct_ui_text(srna, "View Layer", "View layer");
- RNA_def_struct_ui_icon(srna, ICON_RENDER_RESULT);
- RNA_def_struct_path_func(srna, "rna_ViewLayer_path");
- RNA_def_struct_idprops_func(srna, "rna_ViewLayer_idprops");
-
- rna_def_view_layer_common(srna, true);
-
- func = RNA_def_function(srna, "update_render_passes", "rna_ViewLayer_update_render_passes");
- RNA_def_function_ui_description(func, "Requery the enabled render passes from the render engine");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);
-
- prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "LayerCollection");
- RNA_def_property_pointer_sdna(prop, NULL, "layer_collections.first");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Layer Collection",
- "Root of collections hierarchy of this view layer,"
- "its 'collection' pointer property is the same as the scene's master collection");
-
- prop = RNA_def_property(srna, "active_layer_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "LayerCollection");
- RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_active_layer_collection_get",
- "rna_ViewLayer_active_layer_collection_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Active Layer Collection",
- "Active layer collection in this view layer's hierarchy");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_ViewLayer_objects_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Objects", "All the objects in this layer");
- rna_def_layer_objects(brna, prop);
-
- /* layer options */
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_RENDER);
- RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
- prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_FREESTYLE);
- RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
- /* Freestyle */
- rna_def_freestyle_settings(brna);
-
- prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "freestyle_config");
- RNA_def_property_struct_type(prop, "FreestyleSettings");
- RNA_def_property_ui_text(prop, "Freestyle Settings", "");
-
- /* debug update routine */
- func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func,
- "Update data tagged to be updated from previous access to data or operators");
-
- /* Dependency Graph */
- prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Depsgraph");
- RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data");
- RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_depsgraph_get", NULL, NULL, NULL);
-
- /* Nested Data */
- /* *** Non-Animated *** */
- RNA_define_animate_sdna(false);
- rna_def_layer_collection(brna);
- rna_def_object_base(brna);
- RNA_define_animate_sdna(true);
- /* *** Animated *** */
+ FunctionRNA *func;
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ViewLayer", NULL);
+ RNA_def_struct_ui_text(srna, "View Layer", "View layer");
+ RNA_def_struct_ui_icon(srna, ICON_RENDER_RESULT);
+ RNA_def_struct_path_func(srna, "rna_ViewLayer_path");
+ RNA_def_struct_idprops_func(srna, "rna_ViewLayer_idprops");
+
+ rna_def_view_layer_common(srna, true);
+
+ func = RNA_def_function(srna, "update_render_passes", "rna_ViewLayer_update_render_passes");
+ RNA_def_function_ui_description(func,
+ "Requery the enabled render passes from the render engine");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF);
+
+ prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "LayerCollection");
+ RNA_def_property_pointer_sdna(prop, NULL, "layer_collections.first");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Layer Collection",
+ "Root of collections hierarchy of this view layer,"
+ "its 'collection' pointer property is the same as the scene's master collection");
+
+ prop = RNA_def_property(srna, "active_layer_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "LayerCollection");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_ViewLayer_active_layer_collection_get",
+ "rna_ViewLayer_active_layer_collection_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_ui_text(
+ prop, "Active Layer Collection", "Active layer collection in this view layer's hierarchy");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
+
+ prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, "rna_ViewLayer_objects_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Objects", "All the objects in this layer");
+ rna_def_layer_objects(brna, prop);
+
+ /* layer options */
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_RENDER);
+ RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
+
+ prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", VIEW_LAYER_FREESTYLE);
+ RNA_def_property_ui_text(prop, "Freestyle", "Render stylized strokes in this Layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
+
+ /* Freestyle */
+ rna_def_freestyle_settings(brna);
+
+ prop = RNA_def_property(srna, "freestyle_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "freestyle_config");
+ RNA_def_property_struct_type(prop, "FreestyleSettings");
+ RNA_def_property_ui_text(prop, "Freestyle Settings", "");
+
+ /* debug update routine */
+ func = RNA_def_function(srna, "update", "rna_ViewLayer_update_tagged");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(
+ func, "Update data tagged to be updated from previous access to data or operators");
+
+ /* Dependency Graph */
+ prop = RNA_def_property(srna, "depsgraph", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Depsgraph");
+ RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data");
+ RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_depsgraph_get", NULL, NULL, NULL);
+
+ /* Nested Data */
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
+ rna_def_layer_collection(brna);
+ rna_def_object_base(brna);
+ RNA_define_animate_sdna(true);
+ /* *** Animated *** */
}
#endif
diff --git a/source/blender/makesrna/intern/rna_light.c b/source/blender/makesrna/intern/rna_light.c
index 43c9ecef40d..da2b5752a0f 100644
--- a/source/blender/makesrna/intern/rna_light.c
+++ b/source/blender/makesrna/intern/rna_light.c
@@ -36,505 +36,532 @@
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "BKE_context.h"
-#include "BKE_main.h"
-#include "BKE_texture.h"
+# include "BKE_context.h"
+# include "BKE_main.h"
+# include "BKE_texture.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_node.h"
-#include "WM_api.h"
-#include "WM_types.h"
+# include "ED_node.h"
+# include "WM_api.h"
+# include "WM_types.h"
static void rna_Light_buffer_size_set(PointerRNA *ptr, int value)
{
- Light *la = (Light *)ptr->data;
+ Light *la = (Light *)ptr->data;
- CLAMP(value, 128, 10240);
- la->bufsize = value;
- la->bufsize &= (~15); /* round to multiple of 16 */
+ CLAMP(value, 128, 10240);
+ la->bufsize = value;
+ la->bufsize &= (~15); /* round to multiple of 16 */
}
static StructRNA *rna_Light_refine(struct PointerRNA *ptr)
{
- Light *la = (Light *)ptr->data;
-
- switch (la->type) {
- case LA_LOCAL:
- return &RNA_PointLight;
- case LA_SUN:
- return &RNA_SunLight;
- case LA_SPOT:
- return &RNA_SpotLight;
- case LA_AREA:
- return &RNA_AreaLight;
- default:
- return &RNA_Light;
- }
+ Light *la = (Light *)ptr->data;
+
+ switch (la->type) {
+ case LA_LOCAL:
+ return &RNA_PointLight;
+ case LA_SUN:
+ return &RNA_SunLight;
+ case LA_SPOT:
+ return &RNA_SpotLight;
+ case LA_AREA:
+ return &RNA_AreaLight;
+ default:
+ return &RNA_Light;
+ }
}
static void rna_Light_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Light *la = ptr->id.data;
+ Light *la = ptr->id.data;
- DEG_id_tag_update(&la->id, 0);
- WM_main_add_notifier(NC_LAMP | ND_LIGHTING, la);
+ DEG_id_tag_update(&la->id, 0);
+ WM_main_add_notifier(NC_LAMP | ND_LIGHTING, la);
}
static void rna_Light_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Light *la = ptr->id.data;
+ Light *la = ptr->id.data;
- DEG_id_tag_update(&la->id, 0);
- WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, la);
+ DEG_id_tag_update(&la->id, 0);
+ WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, la);
}
static void rna_Light_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- Light *la = (Light *)ptr->data;
+ Light *la = (Light *)ptr->data;
- if (la->use_nodes && la->nodetree == NULL)
- ED_node_shader_default(C, &la->id);
+ if (la->use_nodes && la->nodetree == NULL)
+ ED_node_shader_default(C, &la->id);
- rna_Light_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+ rna_Light_update(CTX_data_main(C), CTX_data_scene(C), ptr);
}
#else
/* Don't define icons here, so they don't show up in the Light UI (properties Editor) - DingTo */
const EnumPropertyItem rna_enum_light_type_items[] = {
- {LA_LOCAL, "POINT", 0, "Point", "Omnidirectional point light source"},
- {LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source"},
- {LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source"},
- {LA_AREA, "AREA", 0, "Area", "Directional area light source"},
- {0, NULL, 0, NULL, NULL},
+ {LA_LOCAL, "POINT", 0, "Point", "Omnidirectional point light source"},
+ {LA_SUN, "SUN", 0, "Sun", "Constant direction parallel ray light source"},
+ {LA_SPOT, "SPOT", 0, "Spot", "Directional cone light source"},
+ {LA_AREA, "AREA", 0, "Area", "Directional area light source"},
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_light(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
-
- srna = RNA_def_struct(brna, "Light", "ID");
- RNA_def_struct_sdna(srna, "Light");
- RNA_def_struct_refine_func(srna, "rna_Light_refine");
- RNA_def_struct_ui_text(srna, "Light", "Light data-block for lighting a scene");
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_LIGHT);
- RNA_def_struct_ui_icon(srna, ICON_LIGHT_DATA);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_light_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of Light");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
- RNA_def_property_ui_text(prop, "Distance",
- "Falloff distance - the light is at half the original intensity at this point");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_color);
- RNA_def_property_ui_text(prop, "Color", "Light color");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "spec_fac");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
- RNA_def_property_ui_text(prop, "Specular Factor", "Specular reflection multiplier");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "use_custom_distance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_CUSTOM_ATTENUATION);
- RNA_def_property_ui_text(prop, "Custom Attenuation", "Use custom attenuation distance instead of global light threshold");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "cutoff_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "att_dist");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.01f, 100.0f, 1.0, 2);
- RNA_def_property_ui_text(prop, "Cutoff Distance", "Distance at which the light influence will be set to 0");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- /* nodes */
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lights");
-
- prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the light");
- RNA_def_property_update(prop, 0, "rna_Light_use_nodes_update");
-
- /* common */
- rna_def_animdata_common(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static float default_color[4] = {1.0f, 1.0f, 1.0f, 1.0f};
+
+ srna = RNA_def_struct(brna, "Light", "ID");
+ RNA_def_struct_sdna(srna, "Light");
+ RNA_def_struct_refine_func(srna, "rna_Light_refine");
+ RNA_def_struct_ui_text(srna, "Light", "Light data-block for lighting a scene");
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_LIGHT);
+ RNA_def_struct_ui_icon(srna, ICON_LIGHT_DATA);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_light_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of Light");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Distance",
+ "Falloff distance - the light is at half the original intensity at this point");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_color);
+ RNA_def_property_ui_text(prop, "Color", "Light color");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "specular_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "spec_fac");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 9999.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
+ RNA_def_property_ui_text(prop, "Specular Factor", "Specular reflection multiplier");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "use_custom_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_CUSTOM_ATTENUATION);
+ RNA_def_property_ui_text(prop,
+ "Custom Attenuation",
+ "Use custom attenuation distance instead of global light threshold");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "cutoff_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "att_dist");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.01f, 100.0f, 1.0, 2);
+ RNA_def_property_ui_text(
+ prop, "Cutoff Distance", "Distance at which the light influence will be set to 0");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ /* nodes */
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based lights");
+
+ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the light");
+ RNA_def_property_update(prop, 0, "rna_Light_use_nodes_update");
+
+ /* common */
+ rna_def_animdata_common(srna);
}
static void rna_def_light_energy(StructRNA *srna, bool distant)
{
- PropertyRNA *prop;
-
- if (distant) {
- /* Distant light strength has no unit defined, it's proportional to
- * Watt/m^2 and is not sensitive to scene unit scale. */
- prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Strength", "Amount of light emitted");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
- }
- else {
- /* Lights with a location have power in Watt, which is sensitive to
- * scene unit scale. */
- prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_POWER);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1000000.0f, 1, 5);
- RNA_def_property_ui_text(prop, "Power", "Amount of light emitted");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
- }
+ PropertyRNA *prop;
+
+ if (distant) {
+ /* Distant light strength has no unit defined, it's proportional to
+ * Watt/m^2 and is not sensitive to scene unit scale. */
+ prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Strength", "Amount of light emitted");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ }
+ else {
+ /* Lights with a location have power in Watt, which is sensitive to
+ * scene unit scale. */
+ prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_POWER);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1000000.0f, 1, 5);
+ RNA_def_property_ui_text(prop, "Power", "Amount of light emitted");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ }
}
static void rna_def_light_falloff(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_fallofftype_items[] = {
- {LA_FALLOFF_CONSTANT, "CONSTANT", 0, "Constant", ""},
- {LA_FALLOFF_INVLINEAR, "INVERSE_LINEAR", 0, "Inverse Linear", ""},
- {LA_FALLOFF_INVSQUARE, "INVERSE_SQUARE", 0, "Inverse Square", ""},
- {LA_FALLOFF_INVCOEFFICIENTS, "INVERSE_COEFFICIENTS", 0, "Inverse Coefficients", ""},
- {LA_FALLOFF_CURVE, "CUSTOM_CURVE", 0, "Custom Curve", ""},
- {LA_FALLOFF_SLIDERS, "LINEAR_QUADRATIC_WEIGHTED", 0, "Lin/Quad Weighted", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_fallofftype_items);
- RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
- RNA_def_property_ui_text(prop, "Falloff Curve", "Custom light falloff curve");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "att1");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attenuation");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "att2");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attenuation");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "constant_coefficient", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "coeff_const");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Constant Coefficient",
- "Constant distance attenuation coefficient");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "linear_coefficient", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "coeff_lin");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Linear Coefficient",
- "Linear distance attenuation coefficient");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "quadratic_coefficient", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "coeff_quad");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Quadratic Coefficient",
- "Quadratic distance attenuation coefficient");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_fallofftype_items[] = {
+ {LA_FALLOFF_CONSTANT, "CONSTANT", 0, "Constant", ""},
+ {LA_FALLOFF_INVLINEAR, "INVERSE_LINEAR", 0, "Inverse Linear", ""},
+ {LA_FALLOFF_INVSQUARE, "INVERSE_SQUARE", 0, "Inverse Square", ""},
+ {LA_FALLOFF_INVCOEFFICIENTS, "INVERSE_COEFFICIENTS", 0, "Inverse Coefficients", ""},
+ {LA_FALLOFF_CURVE, "CUSTOM_CURVE", 0, "Custom Curve", ""},
+ {LA_FALLOFF_SLIDERS, "LINEAR_QUADRATIC_WEIGHTED", 0, "Lin/Quad Weighted", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_fallofftype_items);
+ RNA_def_property_ui_text(prop, "Falloff Type", "Intensity Decay with distance");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
+ RNA_def_property_ui_text(prop, "Falloff Curve", "Custom light falloff curve");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "linear_attenuation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "att1");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Linear Attenuation", "Linear distance attenuation");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "quadratic_attenuation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "att2");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Quadratic Attenuation", "Quadratic distance attenuation");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "constant_coefficient", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "coeff_const");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Constant Coefficient", "Constant distance attenuation coefficient");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "linear_coefficient", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "coeff_lin");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Linear Coefficient", "Linear distance attenuation coefficient");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "quadratic_coefficient", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "coeff_quad");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Quadratic Coefficient", "Quadratic distance attenuation coefficient");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
}
static void rna_def_light_shadow(StructRNA *srna, bool sun)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHADOW);
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "bufsize");
- RNA_def_property_range(prop, 128, 10240);
- RNA_def_property_ui_text(prop, "Shadow Buffer Size",
- "Resolution of the shadow buffer, higher values give crisper shadows "
- "but use more memory");
- RNA_def_property_int_funcs(prop, NULL, "rna_Light_buffer_size_set", NULL);
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "clipsta");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Clip Start",
- "Shadow map clip start, below which objects will not generate shadows");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "clipend");
- RNA_def_property_float_default(prop, 40.0f);
- RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Clip End",
- "Shadow map clip end, beyond which objects will not generate shadows");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bias");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.001f, 9999.0f);
- RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
- RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Bias for reducing self shadowing");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_bleed_bias", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bleedbias");
- RNA_def_property_range(prop, 0.f, 1.f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_exp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bleedexp");
- RNA_def_property_float_default(prop, 2.5f);
- RNA_def_property_range(prop, 1.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Exponent", "Bias for reducing light-bleed on exponential shadow maps");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "soft");
- RNA_def_property_float_default(prop, 3.0f);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "samp");
- RNA_def_property_range(prop, 1, 16);
- RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "shdwr");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Shadow Color", "Color of shadows cast by the light");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "area_size");
- RNA_def_property_float_default(prop, 0.25f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- /* Eevee */
- prop = RNA_def_property(srna, "use_contact_shadow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHAD_CONTACT);
- RNA_def_property_ui_text(prop, "Contact Shadow", "Use screen space raytracing to have correct shadowing "
- "near occluder, or for small features that does not appear "
- "in shadow maps");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "contact_shadow_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "contact_dist");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Contact Shadow Distance", "World space distance in which to search for "
- "screen space occluder");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "contact_shadow_bias", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "contact_bias");
- RNA_def_property_float_default(prop, 0.03f);
- RNA_def_property_range(prop, 0.001f, 9999.0f);
- RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
- RNA_def_property_ui_text(prop, "Contact Shadow Bias", "Bias to avoid self shadowing");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "contact_shadow_soft_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "contact_spread");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_text(prop, "Contact Shadow Soft", "Control how soft the contact shadows will be");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "contact_shadow_thickness", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "contact_thickness");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 9999.0f);
- RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Contact Shadow Thickness", "Pixel thickness used to detect occlusion");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- if (sun) {
- prop = RNA_def_property(srna, "shadow_cascade_max_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "cascade_max_dist");
- RNA_def_property_float_default(prop, 200.0f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Cascade Max Distance", "End distance of the cascaded shadow map (only in perspective view)");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_cascade_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "cascade_count");
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_range(prop, 1, 4);
- RNA_def_property_ui_text(prop, "Cascade Count", "Number of texture used by the cascaded shadow map");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_cascade_exponent", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "cascade_exponent");
- RNA_def_property_float_default(prop, 0.8f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Exponential Distribution", "Higher value increase resolution towards the viewpoint");
- RNA_def_property_update(prop, 0, "rna_Light_update");
-
- prop = RNA_def_property(srna, "shadow_cascade_fade", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "cascade_fade");
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Cascade Fade", "How smooth is the transition between each cascade");
- RNA_def_property_update(prop, 0, "rna_Light_update");
- }
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHADOW);
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "bufsize");
+ RNA_def_property_range(prop, 128, 10240);
+ RNA_def_property_ui_text(prop,
+ "Shadow Buffer Size",
+ "Resolution of the shadow buffer, higher values give crisper shadows "
+ "but use more memory");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Light_buffer_size_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_clip_start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "clipsta");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 9999.0f);
+ RNA_def_property_ui_text(prop,
+ "Shadow Buffer Clip Start",
+ "Shadow map clip start, below which objects will not generate shadows");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_clip_end", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "clipend");
+ RNA_def_property_float_default(prop, 40.0f);
+ RNA_def_property_range(prop, 0.0f, 9999.0f);
+ RNA_def_property_ui_text(prop,
+ "Shadow Buffer Clip End",
+ "Shadow map clip end, beyond which objects will not generate shadows");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_bias", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bias");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.001f, 9999.0f);
+ RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
+ RNA_def_property_ui_text(prop, "Shadow Buffer Bias", "Bias for reducing self shadowing");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_bleed_bias", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bleedbias");
+ RNA_def_property_range(prop, 0.f, 1.f);
+ RNA_def_property_ui_text(
+ prop, "Shadow Buffer Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_exp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bleedexp");
+ RNA_def_property_float_default(prop, 2.5f);
+ RNA_def_property_range(prop, 1.0f, 9999.0f);
+ RNA_def_property_ui_text(
+ prop, "Shadow Buffer Exponent", "Bias for reducing light-bleed on exponential shadow maps");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_soft", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "soft");
+ RNA_def_property_float_default(prop, 3.0f);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Shadow Buffer Soft", "Size of shadow buffer sampling area");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_buffer_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samp");
+ RNA_def_property_range(prop, 1, 16);
+ RNA_def_property_ui_text(prop, "Samples", "Number of shadow buffer samples");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "shdwr");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Shadow Color", "Color of shadows cast by the light");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_soft_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "area_size");
+ RNA_def_property_float_default(prop, 0.25f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Shadow Soft Size", "Light size for ray shadow sampling (Raytraced shadows)");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ /* Eevee */
+ prop = RNA_def_property(srna, "use_contact_shadow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHAD_CONTACT);
+ RNA_def_property_ui_text(prop,
+ "Contact Shadow",
+ "Use screen space raytracing to have correct shadowing "
+ "near occluder, or for small features that does not appear "
+ "in shadow maps");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "contact_shadow_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "contact_dist");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 9999.0f);
+ RNA_def_property_ui_text(prop,
+ "Contact Shadow Distance",
+ "World space distance in which to search for "
+ "screen space occluder");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "contact_shadow_bias", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "contact_bias");
+ RNA_def_property_float_default(prop, 0.03f);
+ RNA_def_property_range(prop, 0.001f, 9999.0f);
+ RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
+ RNA_def_property_ui_text(prop, "Contact Shadow Bias", "Bias to avoid self shadowing");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "contact_shadow_soft_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "contact_spread");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 9999.0f);
+ RNA_def_property_ui_text(
+ prop, "Contact Shadow Soft", "Control how soft the contact shadows will be");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "contact_shadow_thickness", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "contact_thickness");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 9999.0f);
+ RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Contact Shadow Thickness", "Pixel thickness used to detect occlusion");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ if (sun) {
+ prop = RNA_def_property(srna, "shadow_cascade_max_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "cascade_max_dist");
+ RNA_def_property_float_default(prop, 200.0f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop,
+ "Cascade Max Distance",
+ "End distance of the cascaded shadow map (only in perspective view)");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_cascade_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "cascade_count");
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_range(prop, 1, 4);
+ RNA_def_property_ui_text(
+ prop, "Cascade Count", "Number of texture used by the cascaded shadow map");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_cascade_exponent", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "cascade_exponent");
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Exponential Distribution",
+ "Higher value increase resolution towards the viewpoint");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+
+ prop = RNA_def_property(srna, "shadow_cascade_fade", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "cascade_fade");
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Cascade Fade", "How smooth is the transition between each cascade");
+ RNA_def_property_update(prop, 0, "rna_Light_update");
+ }
}
static void rna_def_point_light(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "PointLight", "Light");
- RNA_def_struct_sdna(srna, "Light");
- RNA_def_struct_ui_text(srna, "Point Light", "Omnidirectional point Light");
- RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
+ srna = RNA_def_struct(brna, "PointLight", "Light");
+ RNA_def_struct_sdna(srna, "Light");
+ RNA_def_struct_ui_text(srna, "Point Light", "Omnidirectional point Light");
+ RNA_def_struct_ui_icon(srna, ICON_LIGHT_POINT);
- rna_def_light_energy(srna, false);
- rna_def_light_falloff(srna);
- rna_def_light_shadow(srna, false);
+ rna_def_light_energy(srna, false);
+ rna_def_light_falloff(srna);
+ rna_def_light_shadow(srna, false);
}
static void rna_def_area_light(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_areashape_items[] = {
- {LA_AREA_SQUARE, "SQUARE", 0, "Square", ""},
- {LA_AREA_RECT, "RECTANGLE", 0, "Rectangle", ""},
- {LA_AREA_DISK, "DISK", 0, "Disk", ""},
- {LA_AREA_ELLIPSE, "ELLIPSE", 0, "Ellipse", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "AreaLight", "Light");
- RNA_def_struct_sdna(srna, "Light");
- RNA_def_struct_ui_text(srna, "Area Light", "Directional area Light");
- RNA_def_struct_ui_icon(srna, ICON_LIGHT_AREA);
-
- rna_def_light_energy(srna, false);
- rna_def_light_shadow(srna, false);
- rna_def_light_falloff(srna);
-
- prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "area_shape");
- RNA_def_property_enum_items(prop, prop_areashape_items);
- RNA_def_property_ui_text(prop, "Shape", "Shape of the area Light");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "area_size");
- RNA_def_property_float_default(prop, 0.25f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Size", "Size of the area of the area light, X direction size for rectangle shapes");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "area_sizey");
- RNA_def_property_float_default(prop, 0.25f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
- RNA_def_property_ui_text(prop, "Size Y",
- "Size of the area of the area light in the Y direction for rectangle shapes");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_areashape_items[] = {
+ {LA_AREA_SQUARE, "SQUARE", 0, "Square", ""},
+ {LA_AREA_RECT, "RECTANGLE", 0, "Rectangle", ""},
+ {LA_AREA_DISK, "DISK", 0, "Disk", ""},
+ {LA_AREA_ELLIPSE, "ELLIPSE", 0, "Ellipse", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "AreaLight", "Light");
+ RNA_def_struct_sdna(srna, "Light");
+ RNA_def_struct_ui_text(srna, "Area Light", "Directional area Light");
+ RNA_def_struct_ui_icon(srna, ICON_LIGHT_AREA);
+
+ rna_def_light_energy(srna, false);
+ rna_def_light_shadow(srna, false);
+ rna_def_light_falloff(srna);
+
+ prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "area_shape");
+ RNA_def_property_enum_items(prop, prop_areashape_items);
+ RNA_def_property_ui_text(prop, "Shape", "Shape of the area Light");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "area_size");
+ RNA_def_property_float_default(prop, 0.25f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Size", "Size of the area of the area light, X direction size for rectangle shapes");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "area_sizey");
+ RNA_def_property_float_default(prop, 0.25f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Size Y",
+ "Size of the area of the area light in the Y direction for rectangle shapes");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
}
static void rna_def_spot_light(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpotLight", "Light");
- RNA_def_struct_sdna(srna, "Light");
- RNA_def_struct_ui_text(srna, "Spot Light", "Directional cone Light");
- RNA_def_struct_ui_icon(srna, ICON_LIGHT_SPOT);
-
- rna_def_light_energy(srna, false);
- rna_def_light_falloff(srna);
- rna_def_light_shadow(srna, false);
-
- prop = RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SQUARE);
- RNA_def_property_ui_text(prop, "Square", "Cast a square spot light shape");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spotblend");
- RNA_def_property_float_default(prop, 0.15f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "spotsize");
- RNA_def_property_float_default(prop, DEG2RADF(45.0f));
- RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(180.0f));
- RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
-
- prop = RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHOW_CONE);
- RNA_def_property_ui_text(prop, "Show Cone",
- "Draw transparent cone in 3D view to visualize which objects are contained in it");
- RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpotLight", "Light");
+ RNA_def_struct_sdna(srna, "Light");
+ RNA_def_struct_ui_text(srna, "Spot Light", "Directional cone Light");
+ RNA_def_struct_ui_icon(srna, ICON_LIGHT_SPOT);
+
+ rna_def_light_energy(srna, false);
+ rna_def_light_falloff(srna);
+ rna_def_light_shadow(srna, false);
+
+ prop = RNA_def_property(srna, "use_square", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SQUARE);
+ RNA_def_property_ui_text(prop, "Square", "Cast a square spot light shape");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "spot_blend", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spotblend");
+ RNA_def_property_float_default(prop, 0.15f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Spot Blend", "The softness of the spotlight edge");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "spot_size", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "spotsize");
+ RNA_def_property_float_default(prop, DEG2RADF(45.0f));
+ RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Spot Size", "Angle of the spotlight beam");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
+
+ prop = RNA_def_property(srna, "show_cone", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", LA_SHOW_CONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Cone",
+ "Draw transparent cone in 3D view to visualize which objects are contained in it");
+ RNA_def_property_update(prop, 0, "rna_Light_draw_update");
}
static void rna_def_sun_light(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "SunLight", "Light");
- RNA_def_struct_sdna(srna, "Light");
- RNA_def_struct_ui_text(srna, "Sun Light", "Constant direction parallel ray Light");
- RNA_def_struct_ui_icon(srna, ICON_LIGHT_SUN);
+ srna = RNA_def_struct(brna, "SunLight", "Light");
+ RNA_def_struct_sdna(srna, "Light");
+ RNA_def_struct_ui_text(srna, "Sun Light", "Constant direction parallel ray Light");
+ RNA_def_struct_ui_icon(srna, ICON_LIGHT_SUN);
- rna_def_light_energy(srna, true);
- rna_def_light_shadow(srna, true);
+ rna_def_light_energy(srna, true);
+ rna_def_light_shadow(srna, true);
}
void RNA_def_light(BlenderRNA *brna)
{
- rna_def_light(brna);
- rna_def_point_light(brna);
- rna_def_area_light(brna);
- rna_def_spot_light(brna);
- rna_def_sun_light(brna);
+ rna_def_light(brna);
+ rna_def_point_light(brna);
+ rna_def_area_light(brna);
+ rna_def_spot_light(brna);
+ rna_def_sun_light(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_lightprobe.c b/source/blender/makesrna/intern/rna_lightprobe.c
index 427ce36aa44..125d2ade567 100644
--- a/source/blender/makesrna/intern/rna_lightprobe.c
+++ b/source/blender/makesrna/intern/rna_lightprobe.c
@@ -31,195 +31,211 @@
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "BKE_main.h"
-#include "DEG_depsgraph.h"
+# include "BKE_main.h"
+# include "DEG_depsgraph.h"
-#include "DNA_collection_types.h"
-#include "DNA_object_types.h"
+# include "DNA_collection_types.h"
+# include "DNA_object_types.h"
-#include "WM_api.h"
+# include "WM_api.h"
static void rna_LightProbe_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
}
#else
static EnumPropertyItem parallax_type_items[] = {
- {LIGHTPROBE_SHAPE_ELIPSOID, "ELIPSOID", ICON_NONE, "Sphere", ""},
- {LIGHTPROBE_SHAPE_BOX, "BOX", ICON_NONE, "Box", ""},
- {0, NULL, 0, NULL, NULL},
+ {LIGHTPROBE_SHAPE_ELIPSOID, "ELIPSOID", ICON_NONE, "Sphere", ""},
+ {LIGHTPROBE_SHAPE_BOX, "BOX", ICON_NONE, "Box", ""},
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem lightprobe_type_items[] = {
- {LIGHTPROBE_TYPE_CUBE, "CUBEMAP", ICON_LIGHTPROBE_CUBEMAP, "Reflection Cubemap", "Capture reflections"},
- {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Reflection Plane", ""},
- {LIGHTPROBE_TYPE_GRID, "GRID", ICON_LIGHTPROBE_GRID, "Irradiance Volume", "Volume used for precomputing indirect lighting"},
- {0, NULL, 0, NULL, NULL},
+ {LIGHTPROBE_TYPE_CUBE,
+ "CUBEMAP",
+ ICON_LIGHTPROBE_CUBEMAP,
+ "Reflection Cubemap",
+ "Capture reflections"},
+ {LIGHTPROBE_TYPE_PLANAR, "PLANAR", ICON_LIGHTPROBE_PLANAR, "Reflection Plane", ""},
+ {LIGHTPROBE_TYPE_GRID,
+ "GRID",
+ ICON_LIGHTPROBE_GRID,
+ "Irradiance Volume",
+ "Volume used for precomputing indirect lighting"},
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_lightprobe(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LightProbe", "ID");
- RNA_def_struct_ui_text(srna, "LightProbe", "Light Probe data-block for lighting capture objects");
- RNA_def_struct_ui_icon(srna, ICON_OUTLINER_OB_LIGHTPROBE);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, lightprobe_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of light probe");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "clipsta");
- RNA_def_property_float_default(prop, 0.8f);
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_ui_text(prop, "Clip Start",
- "Probe clip start, below which objects will not appear in reflections");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "clipend");
- RNA_def_property_float_default(prop, 40.0f);
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_ui_text(prop, "Clip End",
- "Probe clip end, beyond which objects will not appear in reflections");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "show_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_CLIP_DIST);
- RNA_def_property_ui_text(prop, "Clipping", "Show the clipping distances in the 3D view");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "influence_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "attenuation_type");
- RNA_def_property_enum_items(prop, parallax_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of influence volume");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "show_influence", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_INFLUENCE);
- RNA_def_property_ui_text(prop, "Influence", "Show the influence volume in the 3D view");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "distinf");
- RNA_def_property_float_default(prop, 2.5f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Influence Distance", "Influence distance of the probe");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe influence decreases");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "use_custom_parallax", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_CUSTOM_PARALLAX);
- RNA_def_property_ui_text(prop, "Use Custom Parallax", "Enable custom settings for the parallax correction volume");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "show_parallax", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_PARALLAX);
- RNA_def_property_ui_text(prop, "Parallax", "Show the parallax correction volume in the 3D view");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "parallax_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, parallax_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of parallax volume");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "parallax_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "distpar");
- RNA_def_property_float_default(prop, 2.5f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Parallax Radius", "Lowest corner of the parallax bounding box");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- /* irradiance grid */
- prop = RNA_def_property(srna, "grid_resolution_x", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Resolution X", "Number of sample along the x axis of the volume");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "grid_resolution_y", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Resolution Y", "Number of sample along the y axis of the volume");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "grid_resolution_z", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Resolution Z", "Number of sample along the z axis of the volume");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "visibility_buffer_bias", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vis_bias");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.001f, 9999.0f);
- RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
- RNA_def_property_ui_text(prop, "Visibility Bias", "Bias for reducing self shadowing");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "vis_bleedbias");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Visibility Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "vis_blur");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Visibility Blur", "Filter size of the visibility blur");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "intensity");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 3.0f, 1.0, 3);
- RNA_def_property_ui_text(prop, "Intensity", "Modify the intensity of the lighting captured by this probe");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "visibility_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "visibility_grp");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Visibility Collection", "Restrict objects visible for this probe");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- prop = RNA_def_property(srna, "invert_visibility_collection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_INVERT_GROUP);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Invert Collection", "Invert visibility collection");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
-
- /* Data preview */
- prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_DATA);
- RNA_def_property_ui_text(prop, "Show Data", "Show captured lighting data into the 3D view for debugging purpose");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
-
- /* common */
- rna_def_animdata_common(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LightProbe", "ID");
+ RNA_def_struct_ui_text(
+ srna, "LightProbe", "Light Probe data-block for lighting capture objects");
+ RNA_def_struct_ui_icon(srna, ICON_OUTLINER_OB_LIGHTPROBE);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, lightprobe_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of light probe");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "clipsta");
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Clip Start", "Probe clip start, below which objects will not appear in reflections");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "clipend");
+ RNA_def_property_float_default(prop, 40.0f);
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Clip End", "Probe clip end, beyond which objects will not appear in reflections");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "show_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_CLIP_DIST);
+ RNA_def_property_ui_text(prop, "Clipping", "Show the clipping distances in the 3D view");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "influence_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "attenuation_type");
+ RNA_def_property_enum_items(prop, parallax_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of influence volume");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "show_influence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_INFLUENCE);
+ RNA_def_property_ui_text(prop, "Influence", "Show the influence volume in the 3D view");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "influence_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "distinf");
+ RNA_def_property_float_default(prop, 2.5f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Influence Distance", "Influence distance of the probe");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Falloff", "Control how fast the probe influence decreases");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "use_custom_parallax", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_CUSTOM_PARALLAX);
+ RNA_def_property_ui_text(
+ prop, "Use Custom Parallax", "Enable custom settings for the parallax correction volume");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "show_parallax", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_PARALLAX);
+ RNA_def_property_ui_text(prop, "Parallax", "Show the parallax correction volume in the 3D view");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "parallax_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, parallax_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of parallax volume");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "parallax_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "distpar");
+ RNA_def_property_float_default(prop, 2.5f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Parallax Radius", "Lowest corner of the parallax bounding box");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ /* irradiance grid */
+ prop = RNA_def_property(srna, "grid_resolution_x", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(
+ prop, "Resolution X", "Number of sample along the x axis of the volume");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "grid_resolution_y", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(
+ prop, "Resolution Y", "Number of sample along the y axis of the volume");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "grid_resolution_z", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(
+ prop, "Resolution Z", "Number of sample along the z axis of the volume");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "visibility_buffer_bias", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vis_bias");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.001f, 9999.0f);
+ RNA_def_property_ui_range(prop, 0.001f, 5.0f, 1.0, 3);
+ RNA_def_property_ui_text(prop, "Visibility Bias", "Bias for reducing self shadowing");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "visibility_bleed_bias", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "vis_bleedbias");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Visibility Bleed Bias", "Bias for reducing light-bleed on variance shadow maps");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ prop = RNA_def_property(srna, "visibility_blur", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "vis_blur");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Visibility Blur", "Filter size of the visibility blur");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "intensity");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 3.0f, 1.0, 3);
+ RNA_def_property_ui_text(
+ prop, "Intensity", "Modify the intensity of the lighting captured by this probe");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "visibility_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "visibility_grp");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Visibility Collection", "Restrict objects visible for this probe");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ prop = RNA_def_property(srna, "invert_visibility_collection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_INVERT_GROUP);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Invert Collection", "Invert visibility collection");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
+
+ /* Data preview */
+ prop = RNA_def_property(srna, "show_data", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LIGHTPROBE_FLAG_SHOW_DATA);
+ RNA_def_property_ui_text(
+ prop, "Show Data", "Show captured lighting data into the 3D view for debugging purpose");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, NULL);
+
+ /* common */
+ rna_def_animdata_common(srna);
}
-
void RNA_def_lightprobe(BlenderRNA *brna)
{
- rna_def_lightprobe(brna);
+ rna_def_lightprobe(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_linestyle.c b/source/blender/makesrna/intern/rna_linestyle.c
index 8e791561694..3a6f283e1dc 100644
--- a/source/blender/makesrna/intern/rna_linestyle.c
+++ b/source/blender/makesrna/intern/rna_linestyle.c
@@ -36,1879 +36,2170 @@
#include "WM_api.h"
const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[] = {
- {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
- {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""},
- {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""},
- {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
- {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
- {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
- {LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
- {LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
- {0, NULL, 0, NULL, NULL},
+ {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
+ {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""},
+ {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""},
+ {LS_MODIFIER_DISTANCE_FROM_CAMERA,
+ "DISTANCE_FROM_CAMERA",
+ ICON_MODIFIER,
+ "Distance from Camera",
+ ""},
+ {LS_MODIFIER_DISTANCE_FROM_OBJECT,
+ "DISTANCE_FROM_OBJECT",
+ ICON_MODIFIER,
+ "Distance from Object",
+ ""},
+ {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
+ {LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
+ {LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[] = {
- {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
- {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""},
- {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""},
- {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
- {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
- {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
- {LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
- {LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
- {0, NULL, 0, NULL, NULL},
+ {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
+ {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""},
+ {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""},
+ {LS_MODIFIER_DISTANCE_FROM_CAMERA,
+ "DISTANCE_FROM_CAMERA",
+ ICON_MODIFIER,
+ "Distance from Camera",
+ ""},
+ {LS_MODIFIER_DISTANCE_FROM_OBJECT,
+ "DISTANCE_FROM_OBJECT",
+ ICON_MODIFIER,
+ "Distance from Object",
+ ""},
+ {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
+ {LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
+ {LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[] = {
- {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
- {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", ""},
- {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""},
- {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""},
- {LS_MODIFIER_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", ICON_MODIFIER, "Distance from Camera", ""},
- {LS_MODIFIER_DISTANCE_FROM_OBJECT, "DISTANCE_FROM_OBJECT", ICON_MODIFIER, "Distance from Object", ""},
- {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
- {LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
- {LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
- {0, NULL, 0, NULL, NULL},
+ {LS_MODIFIER_ALONG_STROKE, "ALONG_STROKE", ICON_MODIFIER, "Along Stroke", ""},
+ {LS_MODIFIER_CALLIGRAPHY, "CALLIGRAPHY", ICON_MODIFIER, "Calligraphy", ""},
+ {LS_MODIFIER_CREASE_ANGLE, "CREASE_ANGLE", ICON_MODIFIER, "Crease Angle", ""},
+ {LS_MODIFIER_CURVATURE_3D, "CURVATURE_3D", ICON_MODIFIER, "Curvature 3D", ""},
+ {LS_MODIFIER_DISTANCE_FROM_CAMERA,
+ "DISTANCE_FROM_CAMERA",
+ ICON_MODIFIER,
+ "Distance from Camera",
+ ""},
+ {LS_MODIFIER_DISTANCE_FROM_OBJECT,
+ "DISTANCE_FROM_OBJECT",
+ ICON_MODIFIER,
+ "Distance from Object",
+ ""},
+ {LS_MODIFIER_MATERIAL, "MATERIAL", ICON_MODIFIER, "Material", ""},
+ {LS_MODIFIER_NOISE, "NOISE", ICON_MODIFIER, "Noise", ""},
+ {LS_MODIFIER_TANGENT, "TANGENT", ICON_MODIFIER, "Tangent", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[] = {
- {LS_MODIFIER_2D_OFFSET, "2D_OFFSET", ICON_MODIFIER, "2D Offset", ""},
- {LS_MODIFIER_2D_TRANSFORM, "2D_TRANSFORM", ICON_MODIFIER, "2D Transform", ""},
- {LS_MODIFIER_BACKBONE_STRETCHER, "BACKBONE_STRETCHER", ICON_MODIFIER, "Backbone Stretcher", ""},
- {LS_MODIFIER_BEZIER_CURVE, "BEZIER_CURVE", ICON_MODIFIER, "Bezier Curve", ""},
- {LS_MODIFIER_BLUEPRINT, "BLUEPRINT", ICON_MODIFIER, "Blueprint", ""},
- {LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lines", ""},
- {LS_MODIFIER_PERLIN_NOISE_1D, "PERLIN_NOISE_1D", ICON_MODIFIER, "Perlin Noise 1D", ""},
- {LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin Noise 2D", ""},
- {LS_MODIFIER_POLYGONIZATION, "POLYGONIZATION", ICON_MODIFIER, "Polygonization", ""},
- {LS_MODIFIER_SAMPLING, "SAMPLING", ICON_MODIFIER, "Sampling", ""},
- {LS_MODIFIER_SIMPLIFICATION, "SIMPLIFICATION", ICON_MODIFIER, "Simplification", ""},
- {LS_MODIFIER_SINUS_DISPLACEMENT, "SINUS_DISPLACEMENT", ICON_MODIFIER, "Sinus Displacement", ""},
- {LS_MODIFIER_SPATIAL_NOISE, "SPATIAL_NOISE", ICON_MODIFIER, "Spatial Noise", ""},
- {LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", ""},
- {0, NULL, 0, NULL, NULL},
+ {LS_MODIFIER_2D_OFFSET, "2D_OFFSET", ICON_MODIFIER, "2D Offset", ""},
+ {LS_MODIFIER_2D_TRANSFORM, "2D_TRANSFORM", ICON_MODIFIER, "2D Transform", ""},
+ {LS_MODIFIER_BACKBONE_STRETCHER,
+ "BACKBONE_STRETCHER",
+ ICON_MODIFIER,
+ "Backbone Stretcher",
+ ""},
+ {LS_MODIFIER_BEZIER_CURVE, "BEZIER_CURVE", ICON_MODIFIER, "Bezier Curve", ""},
+ {LS_MODIFIER_BLUEPRINT, "BLUEPRINT", ICON_MODIFIER, "Blueprint", ""},
+ {LS_MODIFIER_GUIDING_LINES, "GUIDING_LINES", ICON_MODIFIER, "Guiding Lines", ""},
+ {LS_MODIFIER_PERLIN_NOISE_1D, "PERLIN_NOISE_1D", ICON_MODIFIER, "Perlin Noise 1D", ""},
+ {LS_MODIFIER_PERLIN_NOISE_2D, "PERLIN_NOISE_2D", ICON_MODIFIER, "Perlin Noise 2D", ""},
+ {LS_MODIFIER_POLYGONIZATION, "POLYGONIZATION", ICON_MODIFIER, "Polygonization", ""},
+ {LS_MODIFIER_SAMPLING, "SAMPLING", ICON_MODIFIER, "Sampling", ""},
+ {LS_MODIFIER_SIMPLIFICATION, "SIMPLIFICATION", ICON_MODIFIER, "Simplification", ""},
+ {LS_MODIFIER_SINUS_DISPLACEMENT,
+ "SINUS_DISPLACEMENT",
+ ICON_MODIFIER,
+ "Sinus Displacement",
+ ""},
+ {LS_MODIFIER_SPATIAL_NOISE, "SPATIAL_NOISE", ICON_MODIFIER, "Spatial Noise", ""},
+ {LS_MODIFIER_TIP_REMOVER, "TIP_REMOVER", ICON_MODIFIER, "Tip Remover", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_string_utils.h"
+# include "BLI_string_utils.h"
-#include "BKE_linestyle.h"
-#include "BKE_texture.h"
+# include "BKE_linestyle.h"
+# include "BKE_texture.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_node.h"
+# include "ED_node.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
static StructRNA *rna_LineStyle_color_modifier_refine(struct PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- switch (m->type) {
- case LS_MODIFIER_ALONG_STROKE:
- return &RNA_LineStyleColorModifier_AlongStroke;
- case LS_MODIFIER_DISTANCE_FROM_CAMERA:
- return &RNA_LineStyleColorModifier_DistanceFromCamera;
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- return &RNA_LineStyleColorModifier_DistanceFromObject;
- case LS_MODIFIER_MATERIAL:
- return &RNA_LineStyleColorModifier_Material;
- case LS_MODIFIER_TANGENT:
- return &RNA_LineStyleColorModifier_Tangent;
- case LS_MODIFIER_NOISE:
- return &RNA_LineStyleColorModifier_Noise;
- case LS_MODIFIER_CREASE_ANGLE:
- return &RNA_LineStyleColorModifier_CreaseAngle;
- case LS_MODIFIER_CURVATURE_3D:
- return &RNA_LineStyleColorModifier_Curvature_3D;
- default:
- return &RNA_LineStyleColorModifier;
- }
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_ALONG_STROKE:
+ return &RNA_LineStyleColorModifier_AlongStroke;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ return &RNA_LineStyleColorModifier_DistanceFromCamera;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ return &RNA_LineStyleColorModifier_DistanceFromObject;
+ case LS_MODIFIER_MATERIAL:
+ return &RNA_LineStyleColorModifier_Material;
+ case LS_MODIFIER_TANGENT:
+ return &RNA_LineStyleColorModifier_Tangent;
+ case LS_MODIFIER_NOISE:
+ return &RNA_LineStyleColorModifier_Noise;
+ case LS_MODIFIER_CREASE_ANGLE:
+ return &RNA_LineStyleColorModifier_CreaseAngle;
+ case LS_MODIFIER_CURVATURE_3D:
+ return &RNA_LineStyleColorModifier_Curvature_3D;
+ default:
+ return &RNA_LineStyleColorModifier;
+ }
}
static StructRNA *rna_LineStyle_alpha_modifier_refine(struct PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- switch (m->type) {
- case LS_MODIFIER_ALONG_STROKE:
- return &RNA_LineStyleAlphaModifier_AlongStroke;
- case LS_MODIFIER_DISTANCE_FROM_CAMERA:
- return &RNA_LineStyleAlphaModifier_DistanceFromCamera;
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- return &RNA_LineStyleAlphaModifier_DistanceFromObject;
- case LS_MODIFIER_MATERIAL:
- return &RNA_LineStyleAlphaModifier_Material;
- case LS_MODIFIER_TANGENT:
- return &RNA_LineStyleAlphaModifier_Tangent;
- case LS_MODIFIER_NOISE:
- return &RNA_LineStyleAlphaModifier_Noise;
- case LS_MODIFIER_CREASE_ANGLE:
- return &RNA_LineStyleAlphaModifier_CreaseAngle;
- case LS_MODIFIER_CURVATURE_3D:
- return &RNA_LineStyleAlphaModifier_Curvature_3D;
- default:
- return &RNA_LineStyleAlphaModifier;
- }
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_ALONG_STROKE:
+ return &RNA_LineStyleAlphaModifier_AlongStroke;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ return &RNA_LineStyleAlphaModifier_DistanceFromCamera;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ return &RNA_LineStyleAlphaModifier_DistanceFromObject;
+ case LS_MODIFIER_MATERIAL:
+ return &RNA_LineStyleAlphaModifier_Material;
+ case LS_MODIFIER_TANGENT:
+ return &RNA_LineStyleAlphaModifier_Tangent;
+ case LS_MODIFIER_NOISE:
+ return &RNA_LineStyleAlphaModifier_Noise;
+ case LS_MODIFIER_CREASE_ANGLE:
+ return &RNA_LineStyleAlphaModifier_CreaseAngle;
+ case LS_MODIFIER_CURVATURE_3D:
+ return &RNA_LineStyleAlphaModifier_Curvature_3D;
+ default:
+ return &RNA_LineStyleAlphaModifier;
+ }
}
static StructRNA *rna_LineStyle_thickness_modifier_refine(struct PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- switch (m->type) {
- case LS_MODIFIER_ALONG_STROKE:
- return &RNA_LineStyleThicknessModifier_AlongStroke;
- case LS_MODIFIER_DISTANCE_FROM_CAMERA:
- return &RNA_LineStyleThicknessModifier_DistanceFromCamera;
- case LS_MODIFIER_DISTANCE_FROM_OBJECT:
- return &RNA_LineStyleThicknessModifier_DistanceFromObject;
- case LS_MODIFIER_MATERIAL:
- return &RNA_LineStyleThicknessModifier_Material;
- case LS_MODIFIER_CALLIGRAPHY:
- return &RNA_LineStyleThicknessModifier_Calligraphy;
- case LS_MODIFIER_TANGENT:
- return &RNA_LineStyleThicknessModifier_Tangent;
- case LS_MODIFIER_NOISE:
- return &RNA_LineStyleThicknessModifier_Noise;
- case LS_MODIFIER_CREASE_ANGLE:
- return &RNA_LineStyleThicknessModifier_CreaseAngle;
- case LS_MODIFIER_CURVATURE_3D:
- return &RNA_LineStyleThicknessModifier_Curvature_3D;
- default:
- return &RNA_LineStyleThicknessModifier;
- }
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_ALONG_STROKE:
+ return &RNA_LineStyleThicknessModifier_AlongStroke;
+ case LS_MODIFIER_DISTANCE_FROM_CAMERA:
+ return &RNA_LineStyleThicknessModifier_DistanceFromCamera;
+ case LS_MODIFIER_DISTANCE_FROM_OBJECT:
+ return &RNA_LineStyleThicknessModifier_DistanceFromObject;
+ case LS_MODIFIER_MATERIAL:
+ return &RNA_LineStyleThicknessModifier_Material;
+ case LS_MODIFIER_CALLIGRAPHY:
+ return &RNA_LineStyleThicknessModifier_Calligraphy;
+ case LS_MODIFIER_TANGENT:
+ return &RNA_LineStyleThicknessModifier_Tangent;
+ case LS_MODIFIER_NOISE:
+ return &RNA_LineStyleThicknessModifier_Noise;
+ case LS_MODIFIER_CREASE_ANGLE:
+ return &RNA_LineStyleThicknessModifier_CreaseAngle;
+ case LS_MODIFIER_CURVATURE_3D:
+ return &RNA_LineStyleThicknessModifier_Curvature_3D;
+ default:
+ return &RNA_LineStyleThicknessModifier;
+ }
}
static StructRNA *rna_LineStyle_geometry_modifier_refine(struct PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- switch (m->type) {
- case LS_MODIFIER_SAMPLING:
- return &RNA_LineStyleGeometryModifier_Sampling;
- case LS_MODIFIER_BEZIER_CURVE:
- return &RNA_LineStyleGeometryModifier_BezierCurve;
- case LS_MODIFIER_SINUS_DISPLACEMENT:
- return &RNA_LineStyleGeometryModifier_SinusDisplacement;
- case LS_MODIFIER_SPATIAL_NOISE:
- return &RNA_LineStyleGeometryModifier_SpatialNoise;
- case LS_MODIFIER_PERLIN_NOISE_1D:
- return &RNA_LineStyleGeometryModifier_PerlinNoise1D;
- case LS_MODIFIER_PERLIN_NOISE_2D:
- return &RNA_LineStyleGeometryModifier_PerlinNoise2D;
- case LS_MODIFIER_BACKBONE_STRETCHER:
- return &RNA_LineStyleGeometryModifier_BackboneStretcher;
- case LS_MODIFIER_TIP_REMOVER:
- return &RNA_LineStyleGeometryModifier_TipRemover;
- case LS_MODIFIER_POLYGONIZATION:
- return &RNA_LineStyleGeometryModifier_Polygonalization;
- case LS_MODIFIER_GUIDING_LINES:
- return &RNA_LineStyleGeometryModifier_GuidingLines;
- case LS_MODIFIER_BLUEPRINT:
- return &RNA_LineStyleGeometryModifier_Blueprint;
- case LS_MODIFIER_2D_OFFSET:
- return &RNA_LineStyleGeometryModifier_2DOffset;
- case LS_MODIFIER_2D_TRANSFORM:
- return &RNA_LineStyleGeometryModifier_2DTransform;
- case LS_MODIFIER_SIMPLIFICATION:
- return &RNA_LineStyleGeometryModifier_Simplification;
- default:
- return &RNA_LineStyleGeometryModifier;
- }
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ switch (m->type) {
+ case LS_MODIFIER_SAMPLING:
+ return &RNA_LineStyleGeometryModifier_Sampling;
+ case LS_MODIFIER_BEZIER_CURVE:
+ return &RNA_LineStyleGeometryModifier_BezierCurve;
+ case LS_MODIFIER_SINUS_DISPLACEMENT:
+ return &RNA_LineStyleGeometryModifier_SinusDisplacement;
+ case LS_MODIFIER_SPATIAL_NOISE:
+ return &RNA_LineStyleGeometryModifier_SpatialNoise;
+ case LS_MODIFIER_PERLIN_NOISE_1D:
+ return &RNA_LineStyleGeometryModifier_PerlinNoise1D;
+ case LS_MODIFIER_PERLIN_NOISE_2D:
+ return &RNA_LineStyleGeometryModifier_PerlinNoise2D;
+ case LS_MODIFIER_BACKBONE_STRETCHER:
+ return &RNA_LineStyleGeometryModifier_BackboneStretcher;
+ case LS_MODIFIER_TIP_REMOVER:
+ return &RNA_LineStyleGeometryModifier_TipRemover;
+ case LS_MODIFIER_POLYGONIZATION:
+ return &RNA_LineStyleGeometryModifier_Polygonalization;
+ case LS_MODIFIER_GUIDING_LINES:
+ return &RNA_LineStyleGeometryModifier_GuidingLines;
+ case LS_MODIFIER_BLUEPRINT:
+ return &RNA_LineStyleGeometryModifier_Blueprint;
+ case LS_MODIFIER_2D_OFFSET:
+ return &RNA_LineStyleGeometryModifier_2DOffset;
+ case LS_MODIFIER_2D_TRANSFORM:
+ return &RNA_LineStyleGeometryModifier_2DTransform;
+ case LS_MODIFIER_SIMPLIFICATION:
+ return &RNA_LineStyleGeometryModifier_Simplification;
+ default:
+ return &RNA_LineStyleGeometryModifier;
+ }
}
static char *rna_LineStyle_color_modifier_path(PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
- char name_esc[sizeof(m->name) * 2];
- BLI_strescape(name_esc, m->name, sizeof(name_esc));
- return BLI_sprintfN("color_modifiers[\"%s\"]", name_esc);
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+ char name_esc[sizeof(m->name) * 2];
+ BLI_strescape(name_esc, m->name, sizeof(name_esc));
+ return BLI_sprintfN("color_modifiers[\"%s\"]", name_esc);
}
static char *rna_LineStyle_alpha_modifier_path(PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
- char name_esc[sizeof(m->name) * 2];
- BLI_strescape(name_esc, m->name, sizeof(name_esc));
- return BLI_sprintfN("alpha_modifiers[\"%s\"]", name_esc);
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+ char name_esc[sizeof(m->name) * 2];
+ BLI_strescape(name_esc, m->name, sizeof(name_esc));
+ return BLI_sprintfN("alpha_modifiers[\"%s\"]", name_esc);
}
static char *rna_LineStyle_thickness_modifier_path(PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
- char name_esc[sizeof(m->name) * 2];
- BLI_strescape(name_esc, m->name, sizeof(name_esc));
- return BLI_sprintfN("thickness_modifiers[\"%s\"]", name_esc);
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+ char name_esc[sizeof(m->name) * 2];
+ BLI_strescape(name_esc, m->name, sizeof(name_esc));
+ return BLI_sprintfN("thickness_modifiers[\"%s\"]", name_esc);
}
static char *rna_LineStyle_geometry_modifier_path(PointerRNA *ptr)
{
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
- char name_esc[sizeof(m->name) * 2];
- BLI_strescape(name_esc, m->name, sizeof(name_esc));
- return BLI_sprintfN("geometry_modifiers[\"%s\"]", name_esc);
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+ char name_esc[sizeof(m->name) * 2];
+ BLI_strescape(name_esc, m->name, sizeof(name_esc));
+ return BLI_sprintfN("geometry_modifiers[\"%s\"]", name_esc);
}
static void rna_LineStyleColorModifier_name_set(PointerRNA *ptr, const char *value)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- BLI_strncpy_utf8(m->name, value, sizeof(m->name));
- BLI_uniquename(&linestyle->color_modifiers, m, "ColorModifier", '.',
- offsetof(LineStyleModifier, name), sizeof(m->name));
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->color_modifiers,
+ m,
+ "ColorModifier",
+ '.',
+ offsetof(LineStyleModifier, name),
+ sizeof(m->name));
}
static void rna_LineStyleAlphaModifier_name_set(PointerRNA *ptr, const char *value)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- BLI_strncpy_utf8(m->name, value, sizeof(m->name));
- BLI_uniquename(&linestyle->alpha_modifiers, m, "AlphaModifier", '.',
- offsetof(LineStyleModifier, name), sizeof(m->name));
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->alpha_modifiers,
+ m,
+ "AlphaModifier",
+ '.',
+ offsetof(LineStyleModifier, name),
+ sizeof(m->name));
}
static void rna_LineStyleThicknessModifier_name_set(PointerRNA *ptr, const char *value)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- BLI_strncpy_utf8(m->name, value, sizeof(m->name));
- BLI_uniquename(&linestyle->thickness_modifiers, m, "ThicknessModifier", '.',
- offsetof(LineStyleModifier, name), sizeof(m->name));
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->thickness_modifiers,
+ m,
+ "ThicknessModifier",
+ '.',
+ offsetof(LineStyleModifier, name),
+ sizeof(m->name));
}
static void rna_LineStyleGeometryModifier_name_set(PointerRNA *ptr, const char *value)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- LineStyleModifier *m = (LineStyleModifier *)ptr->data;
-
- BLI_strncpy_utf8(m->name, value, sizeof(m->name));
- BLI_uniquename(&linestyle->geometry_modifiers, m, "GeometryModifier", '.',
- offsetof(LineStyleModifier, name), sizeof(m->name));
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ LineStyleModifier *m = (LineStyleModifier *)ptr->data;
+
+ BLI_strncpy_utf8(m->name, value, sizeof(m->name));
+ BLI_uniquename(&linestyle->geometry_modifiers,
+ m,
+ "GeometryModifier",
+ '.',
+ offsetof(LineStyleModifier, name),
+ sizeof(m->name));
}
static void rna_LineStyle_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- rna_iterator_array_begin(iter, (void *)linestyle->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ rna_iterator_array_begin(iter, (void *)linestyle->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
}
static PointerRNA rna_LineStyle_active_texture_get(PointerRNA *ptr)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- Tex *tex;
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ Tex *tex;
- tex = give_current_linestyle_texture(linestyle);
- return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
+ tex = give_current_linestyle_texture(linestyle);
+ return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
}
static void rna_LineStyle_active_texture_set(PointerRNA *ptr, PointerRNA value)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->id.data;
- set_current_linestyle_texture(linestyle, value.data);
+ set_current_linestyle_texture(linestyle, value.data);
}
static void rna_LineStyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- FreestyleLineStyle *linestyle = ptr->id.data;
+ FreestyleLineStyle *linestyle = ptr->id.data;
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
}
static void rna_LineStyle_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->data;
+ FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ptr->data;
- if (linestyle->use_nodes && linestyle->nodetree == NULL)
- BKE_linestyle_default_shader(C, linestyle);
+ if (linestyle->use_nodes && linestyle->nodetree == NULL)
+ BKE_linestyle_default_shader(C, linestyle);
- rna_LineStyle_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+ rna_LineStyle_update(CTX_data_main(C), CTX_data_scene(C), ptr);
}
-static LineStyleModifier *rna_LineStyle_color_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports,
- const char *name, int type)
+static LineStyleModifier *rna_LineStyle_color_modifier_add(FreestyleLineStyle *linestyle,
+ ReportList *reports,
+ const char *name,
+ int type)
{
- LineStyleModifier *modifier = BKE_linestyle_color_modifier_add(linestyle, name, type);
+ LineStyleModifier *modifier = BKE_linestyle_color_modifier_add(linestyle, name, type);
- if (!modifier) {
- BKE_report(reports, RPT_ERROR, "Failed to add the color modifier");
- return NULL;
- }
+ if (!modifier) {
+ BKE_report(reports, RPT_ERROR, "Failed to add the color modifier");
+ return NULL;
+ }
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
- return modifier;
+ return modifier;
}
-static void rna_LineStyle_color_modifier_remove(FreestyleLineStyle *linestyle, ReportList *reports,
+static void rna_LineStyle_color_modifier_remove(FreestyleLineStyle *linestyle,
+ ReportList *reports,
PointerRNA *modifier_ptr)
{
- LineStyleModifier *modifier = modifier_ptr->data;
+ LineStyleModifier *modifier = modifier_ptr->data;
- if (BKE_linestyle_color_modifier_remove(linestyle, modifier) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Color modifier '%s' could not be removed", modifier->name);
- return;
- }
+ if (BKE_linestyle_color_modifier_remove(linestyle, modifier) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Color modifier '%s' could not be removed", modifier->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(modifier_ptr);
+ RNA_POINTER_INVALIDATE(modifier_ptr);
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
}
-static LineStyleModifier *rna_LineStyle_alpha_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports,
- const char *name, int type)
+static LineStyleModifier *rna_LineStyle_alpha_modifier_add(FreestyleLineStyle *linestyle,
+ ReportList *reports,
+ const char *name,
+ int type)
{
- LineStyleModifier *modifier = BKE_linestyle_alpha_modifier_add(linestyle, name, type);
+ LineStyleModifier *modifier = BKE_linestyle_alpha_modifier_add(linestyle, name, type);
- if (!modifier) {
- BKE_report(reports, RPT_ERROR, "Failed to add the alpha modifier");
- return NULL;
- }
+ if (!modifier) {
+ BKE_report(reports, RPT_ERROR, "Failed to add the alpha modifier");
+ return NULL;
+ }
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
- return modifier;
+ return modifier;
}
-static void rna_LineStyle_alpha_modifier_remove(FreestyleLineStyle *linestyle, ReportList *reports,
+static void rna_LineStyle_alpha_modifier_remove(FreestyleLineStyle *linestyle,
+ ReportList *reports,
PointerRNA *modifier_ptr)
{
- LineStyleModifier *modifier = modifier_ptr->data;
+ LineStyleModifier *modifier = modifier_ptr->data;
- if (BKE_linestyle_alpha_modifier_remove(linestyle, modifier) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Alpha modifier '%s' could not be removed", modifier->name);
- return;
- }
+ if (BKE_linestyle_alpha_modifier_remove(linestyle, modifier) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Alpha modifier '%s' could not be removed", modifier->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(modifier_ptr);
+ RNA_POINTER_INVALIDATE(modifier_ptr);
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
}
-static LineStyleModifier *rna_LineStyle_thickness_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports,
- const char *name, int type)
+static LineStyleModifier *rna_LineStyle_thickness_modifier_add(FreestyleLineStyle *linestyle,
+ ReportList *reports,
+ const char *name,
+ int type)
{
- LineStyleModifier *modifier = BKE_linestyle_thickness_modifier_add(linestyle, name, type);
+ LineStyleModifier *modifier = BKE_linestyle_thickness_modifier_add(linestyle, name, type);
- if (!modifier) {
- BKE_report(reports, RPT_ERROR, "Failed to add the thickness modifier");
- return NULL;
- }
+ if (!modifier) {
+ BKE_report(reports, RPT_ERROR, "Failed to add the thickness modifier");
+ return NULL;
+ }
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
- return modifier;
+ return modifier;
}
-static void rna_LineStyle_thickness_modifier_remove(FreestyleLineStyle *linestyle, ReportList *reports,
+static void rna_LineStyle_thickness_modifier_remove(FreestyleLineStyle *linestyle,
+ ReportList *reports,
PointerRNA *modifier_ptr)
{
- LineStyleModifier *modifier = modifier_ptr->data;
+ LineStyleModifier *modifier = modifier_ptr->data;
- if (BKE_linestyle_thickness_modifier_remove(linestyle, modifier) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Thickness modifier '%s' could not be removed", modifier->name);
- return;
- }
+ if (BKE_linestyle_thickness_modifier_remove(linestyle, modifier) == -1) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Thickness modifier '%s' could not be removed", modifier->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(modifier_ptr);
+ RNA_POINTER_INVALIDATE(modifier_ptr);
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
}
-static LineStyleModifier *rna_LineStyle_geometry_modifier_add(FreestyleLineStyle *linestyle, ReportList *reports,
- const char *name, int type)
+static LineStyleModifier *rna_LineStyle_geometry_modifier_add(FreestyleLineStyle *linestyle,
+ ReportList *reports,
+ const char *name,
+ int type)
{
- LineStyleModifier *modifier = BKE_linestyle_geometry_modifier_add(linestyle, name, type);
+ LineStyleModifier *modifier = BKE_linestyle_geometry_modifier_add(linestyle, name, type);
- if (!modifier) {
- BKE_report(reports, RPT_ERROR, "Failed to add the geometry modifier");
- return NULL;
- }
+ if (!modifier) {
+ BKE_report(reports, RPT_ERROR, "Failed to add the geometry modifier");
+ return NULL;
+ }
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
- return modifier;
+ return modifier;
}
-static void rna_LineStyle_geometry_modifier_remove(FreestyleLineStyle *linestyle, ReportList *reports,
+static void rna_LineStyle_geometry_modifier_remove(FreestyleLineStyle *linestyle,
+ ReportList *reports,
PointerRNA *modifier_ptr)
{
- LineStyleModifier *modifier = modifier_ptr->data;
+ LineStyleModifier *modifier = modifier_ptr->data;
- if (BKE_linestyle_geometry_modifier_remove(linestyle, modifier) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Geometry modifier '%s' could not be removed", modifier->name);
- return;
- }
+ if (BKE_linestyle_geometry_modifier_remove(linestyle, modifier) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Geometry modifier '%s' could not be removed", modifier->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(modifier_ptr);
+ RNA_POINTER_INVALIDATE(modifier_ptr);
- DEG_id_tag_update(&linestyle->id, 0);
- WM_main_add_notifier(NC_LINESTYLE, linestyle);
+ DEG_id_tag_update(&linestyle->id, 0);
+ WM_main_add_notifier(NC_LINESTYLE, linestyle);
}
#else
-#include "BLI_math.h"
+# include "BLI_math.h"
static void rna_def_linestyle_mtex(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem texco_items[] = {
- {TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"},
- {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
- {TEXCO_STROKE, "ALONG_STROKE", 0, "Along stroke", "Use stroke length for texture coordinates"},
- {TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_mapping_items[] = {
- {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
- {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
- {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
- {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_x_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_y_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_z_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "LineStyleTextureSlot", "TextureSlot");
- RNA_def_struct_sdna(srna, "MTex");
- RNA_def_struct_ui_text(srna, "LineStyle Texture Slot", "Texture slot for textures in a LineStyle data-block");
-
- prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projx");
- RNA_def_property_enum_items(prop, prop_x_mapping_items);
- RNA_def_property_ui_text(prop, "X Mapping", "");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projy");
- RNA_def_property_enum_items(prop, prop_y_mapping_items);
- RNA_def_property_ui_text(prop, "Y Mapping", "");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projz");
- RNA_def_property_enum_items(prop, prop_z_mapping_items);
- RNA_def_property_ui_text(prop, "Z Mapping", "");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mapping_items);
- RNA_def_property_ui_text(prop, "Mapping", "");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- /* map to */
- prop = RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL);
- RNA_def_property_ui_text(prop, "Diffuse Color", "The texture affects basic color of the stroke");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_map_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA);
- RNA_def_property_ui_text(prop, "Alpha", "The texture affects the alpha value");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texco");
- RNA_def_property_enum_items(prop, texco_items);
- RNA_def_property_ui_text(prop, "Texture Coordinates",
- "Texture coordinates used to map the texture onto the background");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "alphafac");
- RNA_def_property_ui_range(prop, -1, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "diffuse_color_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "colfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color");
- RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem texco_items[] = {
+ {TEXCO_WINDOW, "WINDOW", 0, "Window", "Use screen coordinates as texture coordinates"},
+ {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
+ {TEXCO_STROKE,
+ "ALONG_STROKE",
+ 0,
+ "Along stroke",
+ "Use stroke length for texture coordinates"},
+ {TEXCO_ORCO,
+ "ORCO",
+ 0,
+ "Generated",
+ "Use the original undeformed coordinates of the object"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_mapping_items[] = {
+ {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
+ {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
+ {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
+ {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_x_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_y_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_z_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "LineStyleTextureSlot", "TextureSlot");
+ RNA_def_struct_sdna(srna, "MTex");
+ RNA_def_struct_ui_text(
+ srna, "LineStyle Texture Slot", "Texture slot for textures in a LineStyle data-block");
+
+ prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projx");
+ RNA_def_property_enum_items(prop, prop_x_mapping_items);
+ RNA_def_property_ui_text(prop, "X Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projy");
+ RNA_def_property_enum_items(prop, prop_y_mapping_items);
+ RNA_def_property_ui_text(prop, "Y Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projz");
+ RNA_def_property_enum_items(prop, prop_z_mapping_items);
+ RNA_def_property_ui_text(prop, "Z Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ /* map to */
+ prop = RNA_def_property(srna, "use_map_color_diffuse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_COL);
+ RNA_def_property_ui_text(prop, "Diffuse Color", "The texture affects basic color of the stroke");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_map_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", MAP_ALPHA);
+ RNA_def_property_ui_text(prop, "Alpha", "The texture affects the alpha value");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texco");
+ RNA_def_property_enum_items(prop, texco_items);
+ RNA_def_property_ui_text(prop,
+ "Texture Coordinates",
+ "Texture coordinates used to map the texture onto the background");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "alpha_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "alphafac");
+ RNA_def_property_ui_range(prop, -1, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Alpha Factor", "Amount texture affects alpha");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "diffuse_color_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "colfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Diffuse Color Factor", "Amount texture affects diffuse color");
+ RNA_def_property_update(prop, 0, "rna_LineStyle_update");
}
-static void rna_def_modifier_type_common(
- StructRNA *srna, const EnumPropertyItem *modifier_type_items,
- const char *set_name_func, const bool blend, const bool color)
+static void rna_def_modifier_type_common(StructRNA *srna,
+ const EnumPropertyItem *modifier_type_items,
+ const char *set_name_func,
+ const bool blend,
+ const bool color)
{
- PropertyRNA *prop;
-
- /* TODO: Check this is not already defined somewhere else, e.g. in nodes... */
- static const EnumPropertyItem value_blend_items[] = {
- {LS_VALUE_BLEND, "MIX", 0, "Mix", ""},
- {LS_VALUE_ADD, "ADD", 0, "Add", ""},
- {LS_VALUE_SUB, "SUBTRACT", 0, "Subtract", ""},
- {LS_VALUE_MULT, "MULTIPLY", 0, "Multiply", ""},
- {LS_VALUE_DIV, "DIVIDE", 0, "Divide", ""},
- {LS_VALUE_DIFF, "DIFFERENCE", 0, "Difference", ""},
- {LS_VALUE_MIN, "MINIMUM", 0, "Minimum", ""},
- {LS_VALUE_MAX, "MAXIMUM", 0, "Maximum", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "modifier.type");
- RNA_def_property_enum_items(prop, modifier_type_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Modifier Type", "Type of the modifier");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "modifier.name");
- RNA_def_property_string_funcs(prop, NULL, NULL, set_name_func);
- RNA_def_property_ui_text(prop, "Modifier Name", "Name of the modifier");
- RNA_def_property_update(prop, NC_LINESTYLE, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- if (blend) {
- prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "modifier.blend");
- RNA_def_property_enum_items(prop, (color) ? rna_enum_ramp_blend_items : value_blend_items);
- RNA_def_property_ui_text(prop, "Blend", "Specify how the modifier value is blended into the base value");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "modifier.influence");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Influence", "Influence factor by which the modifier changes the property");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
- }
-
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_ENABLED);
- RNA_def_property_ui_text(prop, "Use", "Enable or disable this modifier during stroke rendering");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_EXPANDED);
- RNA_def_property_ui_text(prop, "Expanded", "True if the modifier tab is expanded");
+ PropertyRNA *prop;
+
+ /* TODO: Check this is not already defined somewhere else, e.g. in nodes... */
+ static const EnumPropertyItem value_blend_items[] = {
+ {LS_VALUE_BLEND, "MIX", 0, "Mix", ""},
+ {LS_VALUE_ADD, "ADD", 0, "Add", ""},
+ {LS_VALUE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {LS_VALUE_MULT, "MULTIPLY", 0, "Multiply", ""},
+ {LS_VALUE_DIV, "DIVIDE", 0, "Divide", ""},
+ {LS_VALUE_DIFF, "DIFFERENCE", 0, "Difference", ""},
+ {LS_VALUE_MIN, "MINIMUM", 0, "Minimum", ""},
+ {LS_VALUE_MAX, "MAXIMUM", 0, "Maximum", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "modifier.type");
+ RNA_def_property_enum_items(prop, modifier_type_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Modifier Type", "Type of the modifier");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "modifier.name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, set_name_func);
+ RNA_def_property_ui_text(prop, "Modifier Name", "Name of the modifier");
+ RNA_def_property_update(prop, NC_LINESTYLE, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ if (blend) {
+ prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "modifier.blend");
+ RNA_def_property_enum_items(prop, (color) ? rna_enum_ramp_blend_items : value_blend_items);
+ RNA_def_property_ui_text(
+ prop, "Blend", "Specify how the modifier value is blended into the base value");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "modifier.influence");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Influence", "Influence factor by which the modifier changes the property");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+ }
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_ENABLED);
+ RNA_def_property_ui_text(prop, "Use", "Enable or disable this modifier during stroke rendering");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "modifier.flags", LS_MODIFIER_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "True if the modifier tab is expanded");
}
static void rna_def_color_modifier(StructRNA *srna)
{
- rna_def_modifier_type_common(srna, rna_enum_linestyle_color_modifier_type_items,
- "rna_LineStyleColorModifier_name_set", true, true);
+ rna_def_modifier_type_common(srna,
+ rna_enum_linestyle_color_modifier_type_items,
+ "rna_LineStyleColorModifier_name_set",
+ true,
+ true);
}
static void rna_def_alpha_modifier(StructRNA *srna)
{
- rna_def_modifier_type_common(srna, rna_enum_linestyle_alpha_modifier_type_items,
- "rna_LineStyleAlphaModifier_name_set", true, false);
+ rna_def_modifier_type_common(srna,
+ rna_enum_linestyle_alpha_modifier_type_items,
+ "rna_LineStyleAlphaModifier_name_set",
+ true,
+ false);
}
static void rna_def_thickness_modifier(StructRNA *srna)
{
- rna_def_modifier_type_common(srna, rna_enum_linestyle_thickness_modifier_type_items,
- "rna_LineStyleThicknessModifier_name_set", true, false);
+ rna_def_modifier_type_common(srna,
+ rna_enum_linestyle_thickness_modifier_type_items,
+ "rna_LineStyleThicknessModifier_name_set",
+ true,
+ false);
}
static void rna_def_geometry_modifier(StructRNA *srna)
{
- rna_def_modifier_type_common(srna, rna_enum_linestyle_geometry_modifier_type_items,
- "rna_LineStyleGeometryModifier_name_set", false, false);
+ rna_def_modifier_type_common(srna,
+ rna_enum_linestyle_geometry_modifier_type_items,
+ "rna_LineStyleGeometryModifier_name_set",
+ false,
+ false);
}
static void rna_def_modifier_color_ramp_common(StructRNA *srna, int range)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "color_ramp");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Color Ramp", "Color ramp used to change line color");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- if (range) {
- prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "range_min");
- RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the input range the mapping is applied");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "range_max");
- RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the input range the mapping is applied");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
- }
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "color_ramp");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Color Ramp", "Color ramp used to change line color");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ if (range) {
+ prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "range_min");
+ RNA_def_property_ui_text(
+ prop, "Range Min", "Lower bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "range_max");
+ RNA_def_property_ui_text(
+ prop, "Range Max", "Upper bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+ }
}
static void rna_def_modifier_curve_common(StructRNA *srna, bool range, bool value)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem mapping_items[] = {
- {0, "LINEAR", 0, "Linear", "Use linear mapping"},
- {LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, mapping_items);
- RNA_def_property_ui_text(prop, "Mapping", "Select the mapping type");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_INVERT);
- RNA_def_property_ui_text(prop, "Invert", "Invert the fade-out direction of the linear mapping");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve", "Curve used for the curve mapping");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- if (range) {
- prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "range_min");
- RNA_def_property_ui_text(prop, "Range Min", "Lower bound of the input range the mapping is applied");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "range_max");
- RNA_def_property_ui_text(prop, "Range Max", "Upper bound of the input range the mapping is applied");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
- }
-
- if (value) {
- prop = RNA_def_property(srna, "value_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "value_min");
- RNA_def_property_ui_text(prop, "Value Min", "Minimum output value of the mapping");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "value_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "value_max");
- RNA_def_property_ui_text(prop, "Value Max", "Maximum output value of the mapping");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
- }
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mapping_items[] = {
+ {0, "LINEAR", 0, "Linear", "Use linear mapping"},
+ {LS_MODIFIER_USE_CURVE, "CURVE", 0, "Curve", "Use curve mapping"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "Select the mapping type");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_INVERT);
+ RNA_def_property_ui_text(prop, "Invert", "Invert the fade-out direction of the linear mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve", "Curve used for the curve mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ if (range) {
+ prop = RNA_def_property(srna, "range_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "range_min");
+ RNA_def_property_ui_text(
+ prop, "Range Min", "Lower bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "range_max", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "range_max");
+ RNA_def_property_ui_text(
+ prop, "Range Max", "Upper bound of the input range the mapping is applied");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+ }
+
+ if (value) {
+ prop = RNA_def_property(srna, "value_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "value_min");
+ RNA_def_property_ui_text(prop, "Value Min", "Minimum output value of the mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "value_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "value_max");
+ RNA_def_property_ui_text(prop, "Value Max", "Maximum output value of the mapping");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+ }
}
static void rna_def_modifier_material_common(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem mat_attr_items[] = {
- {LS_MODIFIER_MATERIAL_LINE, "LINE", 0, "Line Color", ""},
- {LS_MODIFIER_MATERIAL_LINE_R, "LINE_R", 0, "Line Color Red", ""},
- {LS_MODIFIER_MATERIAL_LINE_G, "LINE_G", 0, "Line Color Green", ""},
- {LS_MODIFIER_MATERIAL_LINE_B, "LINE_B", 0, "Line Color Blue", ""},
- {LS_MODIFIER_MATERIAL_LINE_A, "LINE_A", 0, "Line Color Alpha", ""},
- {LS_MODIFIER_MATERIAL_DIFF, "DIFF", 0, "Diffuse Color", ""},
- {LS_MODIFIER_MATERIAL_DIFF_R, "DIFF_R", 0, "Diffuse Color Red", ""},
- {LS_MODIFIER_MATERIAL_DIFF_G, "DIFF_G", 0, "Diffuse Color Green", ""},
- {LS_MODIFIER_MATERIAL_DIFF_B, "DIFF_B", 0, "Diffuse Color Blue", ""},
- {LS_MODIFIER_MATERIAL_SPEC, "SPEC", 0, "Specular Color", ""},
- {LS_MODIFIER_MATERIAL_SPEC_R, "SPEC_R", 0, "Specular Color Red", ""},
- {LS_MODIFIER_MATERIAL_SPEC_G, "SPEC_G", 0, "Specular Color Green", ""},
- {LS_MODIFIER_MATERIAL_SPEC_B, "SPEC_B", 0, "Specular Color Blue", ""},
- {LS_MODIFIER_MATERIAL_SPEC_HARD, "SPEC_HARD", 0, "Specular Hardness", ""},
- {LS_MODIFIER_MATERIAL_ALPHA, "ALPHA", 0, "Alpha Transparency", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "material_attribute", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mat_attr");
- RNA_def_property_enum_items(prop, mat_attr_items);
- RNA_def_property_ui_text(prop, "Material Attribute", "Specify which material attribute is used");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mat_attr_items[] = {
+ {LS_MODIFIER_MATERIAL_LINE, "LINE", 0, "Line Color", ""},
+ {LS_MODIFIER_MATERIAL_LINE_R, "LINE_R", 0, "Line Color Red", ""},
+ {LS_MODIFIER_MATERIAL_LINE_G, "LINE_G", 0, "Line Color Green", ""},
+ {LS_MODIFIER_MATERIAL_LINE_B, "LINE_B", 0, "Line Color Blue", ""},
+ {LS_MODIFIER_MATERIAL_LINE_A, "LINE_A", 0, "Line Color Alpha", ""},
+ {LS_MODIFIER_MATERIAL_DIFF, "DIFF", 0, "Diffuse Color", ""},
+ {LS_MODIFIER_MATERIAL_DIFF_R, "DIFF_R", 0, "Diffuse Color Red", ""},
+ {LS_MODIFIER_MATERIAL_DIFF_G, "DIFF_G", 0, "Diffuse Color Green", ""},
+ {LS_MODIFIER_MATERIAL_DIFF_B, "DIFF_B", 0, "Diffuse Color Blue", ""},
+ {LS_MODIFIER_MATERIAL_SPEC, "SPEC", 0, "Specular Color", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_R, "SPEC_R", 0, "Specular Color Red", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_G, "SPEC_G", 0, "Specular Color Green", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_B, "SPEC_B", 0, "Specular Color Blue", ""},
+ {LS_MODIFIER_MATERIAL_SPEC_HARD, "SPEC_HARD", 0, "Specular Hardness", ""},
+ {LS_MODIFIER_MATERIAL_ALPHA, "ALPHA", 0, "Alpha Transparency", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "material_attribute", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mat_attr");
+ RNA_def_property_enum_items(prop, mat_attr_items);
+ RNA_def_property_ui_text(prop, "Material Attribute", "Specify which material attribute is used");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
}
static void rna_def_linestyle_modifiers(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem blueprint_shape_items[] = {
- {LS_MODIFIER_BLUEPRINT_CIRCLES, "CIRCLES", 0, "Circles", "Draw a blueprint using circular contour strokes"},
- {LS_MODIFIER_BLUEPRINT_ELLIPSES, "ELLIPSES", 0, "Ellipses", "Draw a blueprint using elliptic contour strokes"},
- {LS_MODIFIER_BLUEPRINT_SQUARES, "SQUARES", 0, "Squares", "Draw a blueprint using square contour strokes"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem transform_pivot_items[] = {
- {LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER, "CENTER", 0, "Stroke Center", ""},
- {LS_MODIFIER_2D_TRANSFORM_PIVOT_START, "START", 0, "Stroke Start", ""},
- {LS_MODIFIER_2D_TRANSFORM_PIVOT_END, "END", 0, "Stroke End", ""},
- {LS_MODIFIER_2D_TRANSFORM_PIVOT_PARAM, "PARAM", 0, "Stroke Point Parameter", ""},
- {LS_MODIFIER_2D_TRANSFORM_PIVOT_ABSOLUTE, "ABSOLUTE", 0, "Absolute 2D Point", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "LineStyleModifier", NULL);
- RNA_def_struct_ui_text(srna, "Line Style Modifier", "Base type to define modifiers");
-
- /* line color modifiers */
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier", "LineStyleModifier");
- RNA_def_struct_sdna(srna, "LineStyleModifier");
- RNA_def_struct_refine_func(srna, "rna_LineStyle_color_modifier_refine");
- RNA_def_struct_path_func(srna, "rna_LineStyle_color_modifier_path");
- RNA_def_struct_ui_text(srna, "Line Style Color Modifier", "Base type to define line color modifiers");
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_AlongStroke", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Along Stroke", "Change line color along stroke");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, false);
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromCamera", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line color based on the distance from the camera");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, true);
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_DistanceFromObject", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Distance from Object", "Change line color based on the distance from an object");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, true);
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "target");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_Material", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Material", "Change line color based on a material attribute");
- rna_def_color_modifier(srna);
- rna_def_modifier_material_common(srna);
- rna_def_modifier_color_ramp_common(srna, false);
-
- prop = RNA_def_property(srna, "use_ramp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_USE_RAMP);
- RNA_def_property_ui_text(prop, "Ramp", "Use color ramp to map the BW average into an RGB color");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_Tangent", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Tangent", "Change line color based on the direction of a stroke");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, false);
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_Noise", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Noise", "Change line color based on random noise");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, false);
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_ui_text(prop, "Period", "Period of the noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "seed");
- RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_CreaseAngle", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Crease Angle", "Change line color based on the underlying crease angle");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, false);
-
- prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "min_angle");
- RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to modify thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "max_angle");
- RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle to modify thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleColorModifier_Curvature_3D", "LineStyleColorModifier");
- RNA_def_struct_ui_text(srna, "Curvature 3D",
- "Change line color based on the radial curvature of 3D mesh surfaces");
- rna_def_color_modifier(srna);
- rna_def_modifier_color_ramp_common(srna, false);
-
- prop = RNA_def_property(srna, "curvature_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_curvature");
- RNA_def_property_ui_text(prop, "Min Curvature", "Minimum Curvature");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "curvature_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_curvature");
- RNA_def_property_ui_text(prop, "Max Curvature", "Maximum Curvature");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- /* alpha transparency modifiers */
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier", "LineStyleModifier");
- RNA_def_struct_sdna(srna, "LineStyleModifier");
- RNA_def_struct_refine_func(srna, "rna_LineStyle_alpha_modifier_refine");
- RNA_def_struct_path_func(srna, "rna_LineStyle_alpha_modifier_path");
- RNA_def_struct_ui_text(srna, "Line Style Alpha Modifier", "Base type to define alpha transparency modifiers");
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_AlongStroke", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Along Stroke", "Change alpha transparency along stroke");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromCamera", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Distance from Camera",
- "Change alpha transparency based on the distance from the camera");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, true, false);
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_DistanceFromObject", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Distance from Object",
- "Change alpha transparency based on the distance from an object");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, true, false);
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "target");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Material", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Material", "Change alpha transparency based on a material attribute");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_material_common(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Tangent", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Tangent", "Alpha transparency based on the direction of the stroke");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Noise", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Noise", "Alpha transparency based on random noise");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_ui_text(prop, "Period", "Period of the noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "seed");
- RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_CreaseAngle", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Crease Angle",
- "Alpha transparency based on the angle between two adjacent faces");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "min_angle");
- RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to modify thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "max_angle");
- RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle to modify thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Curvature_3D", "LineStyleAlphaModifier");
- RNA_def_struct_ui_text(srna, "Curvature 3D",
- "Alpha transparency based on the radial curvature of 3D mesh surfaces");
- rna_def_alpha_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- prop = RNA_def_property(srna, "curvature_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_curvature");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min Curvature", "Minimum Curvature");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "curvature_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_curvature");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Curvature", "Maximum Curvature");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- /* line thickness modifiers */
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier", "LineStyleModifier");
- RNA_def_struct_sdna(srna, "LineStyleModifier");
- RNA_def_struct_refine_func(srna, "rna_LineStyle_thickness_modifier_refine");
- RNA_def_struct_path_func(srna, "rna_LineStyle_thickness_modifier_path");
- RNA_def_struct_ui_text(srna, "Line Style Thickness Modifier", "Base type to define line thickness modifiers");
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Tangent", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Tangent", "Thickness based on the direction of the stroke");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min Thickness",
- "Minimum thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_AlongStroke", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Along Stroke", "Change line thickness along stroke");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_curve_common(srna, false, true);
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromCamera", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Distance from Camera", "Change line thickness based on the distance from the camera");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_curve_common(srna, true, true);
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_DistanceFromObject", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Distance from Object", "Change line thickness based on the distance from an object");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_curve_common(srna, true, true);
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "target");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Material", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Material", "Change line thickness based on a material attribute");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_material_common(srna);
- rna_def_modifier_curve_common(srna, false, true);
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Calligraphy", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Calligraphy",
- "Change line thickness so that stroke looks like made with a calligraphic pen");
- rna_def_thickness_modifier(srna);
-
- prop = RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "orientation");
- RNA_def_property_ui_text(prop, "Orientation", "Angle of the main direction");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min Thickness",
- "Minimum thickness in the direction perpendicular to the main direction");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness in the main direction");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Noise", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Noise", "Line thickness based on random noise");
- rna_def_thickness_modifier(srna);
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_ui_text(prop, "Period", "Period of the noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "seed");
- RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_asymmetric", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_THICKNESS_ASYMMETRIC);
- RNA_def_property_ui_text(prop, "Asymmetric", "Allow thickness to be assigned asymmetrically");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Curvature_3D", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Curvature 3D",
- "Line thickness based on the radial curvature of 3D mesh surfaces");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "curvature_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_curvature");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min Curvature", "Minimum Curvature");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "curvature_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_curvature");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Curvature", "Maximum Curvature");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleThicknessModifier_CreaseAngle", "LineStyleThicknessModifier");
- RNA_def_struct_ui_text(srna, "Crease Angle",
- "Line thickness based on the angle between two adjacent faces");
- rna_def_thickness_modifier(srna);
- rna_def_modifier_curve_common(srna, false, false);
-
- prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "min_angle");
- RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to modify thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "max_angle");
- RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle to modify thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- /* geometry modifiers */
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier", "LineStyleModifier");
- RNA_def_struct_sdna(srna, "LineStyleModifier");
- RNA_def_struct_refine_func(srna, "rna_LineStyle_geometry_modifier_refine");
- RNA_def_struct_path_func(srna, "rna_LineStyle_geometry_modifier_path");
- RNA_def_struct_ui_text(srna, "Line Style Geometry Modifier", "Base type to define stroke geometry modifiers");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Sampling", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Sampling",
- "Specify a new sampling value that determines the resolution of stroke polylines");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "sampling", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sampling");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Sampling", "New sampling value to be used for subsequent modifiers");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_BezierCurve", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Bezier Curve",
- "Replace stroke backbone geometry by a Bezier curve approximation of the "
- "original backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "error");
- RNA_def_property_ui_text(prop, "Error",
- "Maximum distance allowed between the new Bezier curve and the "
- "original backbone geometry");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_SinusDisplacement", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Sinus Displacement", "Add sinus displacement to stroke backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "wavelength");
- RNA_def_property_ui_text(prop, "Wavelength", "Wavelength of the sinus displacement");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the sinus displacement");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "phase");
- RNA_def_property_ui_text(prop, "Phase", "Phase of the sinus displacement");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_SpatialNoise", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Spatial Noise", "Add spatial noise to stroke backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the spatial noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_ui_text(prop, "Scale", "Scale of the spatial noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "octaves");
- RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the spatial noise)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_SMOOTH);
- RNA_def_property_ui_text(prop, "Smooth", "If true, the spatial noise is smooth");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_pure_random", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_PURERANDOM);
- RNA_def_property_ui_text(prop, "Pure Random", "If true, the spatial noise does not show any coherence");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise1D", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Perlin Noise 1D", "Add one-dimensional Perlin noise to stroke backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frequency");
- RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "octaves");
- RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "seed");
- RNA_def_property_ui_text(prop, "Seed",
- "Seed for random number generation (if negative, time is used as a seed instead)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_PerlinNoise2D", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Perlin Noise 2D", "Add two-dimensional Perlin noise to stroke backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frequency");
- RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "octaves");
- RNA_def_property_ui_text(prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "seed");
- RNA_def_property_ui_text(prop, "Seed",
- "Seed for random number generation (if negative, time is used as a seed instead)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_BackboneStretcher", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Backbone Stretcher", "Stretch the beginning and the end of stroke backbone");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "backbone_length");
- RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_TipRemover", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Tip Remover",
- "Remove a piece of stroke at the beginning and the end of stroke backbone");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "tip_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tip_length");
- RNA_def_property_ui_text(prop, "Tip Length", "Length of tips to be removed");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Polygonalization", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Polygonalization", "Modify the stroke geometry so that it looks more 'polygonal'");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "error");
- RNA_def_property_ui_text(prop, "Error",
- "Maximum distance between the original stroke and its polygonal approximation");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_GuidingLines", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Guiding Lines",
- "Modify the stroke geometry so that it corresponds to its main direction line");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset",
- "Displacement that is applied to the main direction line along its normal");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Blueprint", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Blueprint",
- "Produce a blueprint using circular, elliptic, and square contour strokes");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, blueprint_shape_items);
- RNA_def_property_ui_text(prop, "Shape", "Select the shape of blueprint contour strokes");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "rounds");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in contour strokes");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "backbone_length");
- RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "random_radius", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "random_radius");
- RNA_def_property_ui_text(prop, "Random Radius", "Randomness of the radius");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "random_center", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "random_center");
- RNA_def_property_ui_text(prop, "Random Center", "Randomness of the center");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "random_backbone", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "random_backbone");
- RNA_def_property_ui_text(prop, "Random Backbone", "Randomness of the backbone stretching");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DOffset", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "2D Offset", "Add two-dimensional offsets to stroke backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "start");
- RNA_def_property_ui_text(prop, "Start", "Displacement that is applied from the beginning of the stroke");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "end");
- RNA_def_property_ui_text(prop, "End", "Displacement that is applied from the end of the stroke");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_ui_text(prop, "X", "Displacement that is applied to the X coordinates of stroke vertices");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "y");
- RNA_def_property_ui_text(prop, "Y", "Displacement that is applied to the Y coordinates of stroke vertices");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DTransform", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "2D Transform",
- "Apply two-dimensional scaling and rotation to stroke backbone geometry");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "pivot");
- RNA_def_property_enum_items(prop, transform_pivot_items);
- RNA_def_property_ui_text(prop, "Pivot", "Pivot of scaling and rotation operations");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale_x");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Scale X", "Scaling factor that is applied along the X axis");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale_y");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Scale Y", "Scaling factor that is applied along the Y axis");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation angle");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "pivot_u", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pivot_u");
- RNA_def_property_range(prop, 0.f, 1.f);
- RNA_def_property_ui_text(prop, "Stroke Point Parameter",
- "Pivot in terms of the stroke point parameter u (0 <= u <= 1)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pivot_x");
- RNA_def_property_ui_text(prop, "Pivot X", "2D X coordinate of the absolute pivot");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pivot_y");
- RNA_def_property_ui_text(prop, "Pivot Y", "2D Y coordinate of the absolute pivot");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Simplification", "LineStyleGeometryModifier");
- RNA_def_struct_ui_text(srna, "Simplification", "Simplify the stroke set");
- rna_def_geometry_modifier(srna);
-
- prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tolerance");
- RNA_def_property_ui_text(prop, "Tolerance", "Distance below which segments will be merged");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem blueprint_shape_items[] = {
+ {LS_MODIFIER_BLUEPRINT_CIRCLES,
+ "CIRCLES",
+ 0,
+ "Circles",
+ "Draw a blueprint using circular contour strokes"},
+ {LS_MODIFIER_BLUEPRINT_ELLIPSES,
+ "ELLIPSES",
+ 0,
+ "Ellipses",
+ "Draw a blueprint using elliptic contour strokes"},
+ {LS_MODIFIER_BLUEPRINT_SQUARES,
+ "SQUARES",
+ 0,
+ "Squares",
+ "Draw a blueprint using square contour strokes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem transform_pivot_items[] = {
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_CENTER, "CENTER", 0, "Stroke Center", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_START, "START", 0, "Stroke Start", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_END, "END", 0, "Stroke End", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_PARAM, "PARAM", 0, "Stroke Point Parameter", ""},
+ {LS_MODIFIER_2D_TRANSFORM_PIVOT_ABSOLUTE, "ABSOLUTE", 0, "Absolute 2D Point", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "LineStyleModifier", NULL);
+ RNA_def_struct_ui_text(srna, "Line Style Modifier", "Base type to define modifiers");
+
+ /* line color modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_color_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_color_modifier_path");
+ RNA_def_struct_ui_text(
+ srna, "Line Style Color Modifier", "Base type to define line color modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_AlongStroke", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Along Stroke", "Change line color along stroke");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, false);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleColorModifier_DistanceFromCamera", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(
+ srna, "Distance from Camera", "Change line color based on the distance from the camera");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, true);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleColorModifier_DistanceFromObject", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(
+ srna, "Distance from Object", "Change line color based on the distance from an object");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, true);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_Material", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Material", "Change line color based on a material attribute");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_material_common(srna);
+ rna_def_modifier_color_ramp_common(srna, false);
+
+ prop = RNA_def_property(srna, "use_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_USE_RAMP);
+ RNA_def_property_ui_text(prop, "Ramp", "Use color ramp to map the BW average into an RGB color");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_Tangent", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Tangent", "Change line color based on the direction of a stroke");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, false);
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_Noise", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(srna, "Noise", "Change line color based on random noise");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, false);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_ui_text(prop, "Period", "Period of the noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_CreaseAngle", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(
+ srna, "Crease Angle", "Change line color based on the underlying crease angle");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, false);
+
+ prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "min_angle");
+ RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to modify thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "max_angle");
+ RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle to modify thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleColorModifier_Curvature_3D", "LineStyleColorModifier");
+ RNA_def_struct_ui_text(
+ srna, "Curvature 3D", "Change line color based on the radial curvature of 3D mesh surfaces");
+ rna_def_color_modifier(srna);
+ rna_def_modifier_color_ramp_common(srna, false);
+
+ prop = RNA_def_property(srna, "curvature_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_curvature");
+ RNA_def_property_ui_text(prop, "Min Curvature", "Minimum Curvature");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "curvature_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_curvature");
+ RNA_def_property_ui_text(prop, "Max Curvature", "Maximum Curvature");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ /* alpha transparency modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_alpha_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_alpha_modifier_path");
+ RNA_def_struct_ui_text(
+ srna, "Line Style Alpha Modifier", "Base type to define alpha transparency modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_AlongStroke", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna, "Along Stroke", "Change alpha transparency along stroke");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleAlphaModifier_DistanceFromCamera", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna,
+ "Distance from Camera",
+ "Change alpha transparency based on the distance from the camera");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, true, false);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleAlphaModifier_DistanceFromObject", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna,
+ "Distance from Object",
+ "Change alpha transparency based on the distance from an object");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, true, false);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Material", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(
+ srna, "Material", "Change alpha transparency based on a material attribute");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_material_common(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Tangent", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(
+ srna, "Tangent", "Alpha transparency based on the direction of the stroke");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Noise", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna, "Noise", "Alpha transparency based on random noise");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_ui_text(prop, "Period", "Period of the noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_CreaseAngle", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(
+ srna, "Crease Angle", "Alpha transparency based on the angle between two adjacent faces");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "min_angle");
+ RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to modify thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "max_angle");
+ RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle to modify thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifier_Curvature_3D", "LineStyleAlphaModifier");
+ RNA_def_struct_ui_text(srna,
+ "Curvature 3D",
+ "Alpha transparency based on the radial curvature of 3D mesh surfaces");
+ rna_def_alpha_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ prop = RNA_def_property(srna, "curvature_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_curvature");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min Curvature", "Minimum Curvature");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "curvature_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_curvature");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Curvature", "Maximum Curvature");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ /* line thickness modifiers */
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_thickness_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_thickness_modifier_path");
+ RNA_def_struct_ui_text(
+ srna, "Line Style Thickness Modifier", "Base type to define line thickness modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Tangent", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Tangent", "Thickness based on the direction of the stroke");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleThicknessModifier_AlongStroke", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Along Stroke", "Change line thickness along stroke");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, true);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleThicknessModifier_DistanceFromCamera", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(
+ srna, "Distance from Camera", "Change line thickness based on the distance from the camera");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, true, true);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleThicknessModifier_DistanceFromObject", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(
+ srna, "Distance from Object", "Change line thickness based on the distance from an object");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, true, true);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Target", "Target object from which the distance is measured");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Material", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Material", "Change line thickness based on a material attribute");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_material_common(srna);
+ rna_def_modifier_curve_common(srna, false, true);
+
+ srna = RNA_def_struct(
+ brna, "LineStyleThicknessModifier_Calligraphy", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Calligraphy",
+ "Change line thickness so that stroke looks like made with a calligraphic pen");
+ rna_def_thickness_modifier(srna);
+
+ prop = RNA_def_property(srna, "orientation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "orientation");
+ RNA_def_property_ui_text(prop, "Orientation", "Angle of the main direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Min Thickness",
+ "Minimum thickness in the direction perpendicular to the main direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness in the main direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifier_Noise", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(srna, "Noise", "Line thickness based on random noise");
+ rna_def_thickness_modifier(srna);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_ui_text(prop, "Period", "Period of the noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(prop, "Seed", "Seed for the noise generation");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_asymmetric", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_THICKNESS_ASYMMETRIC);
+ RNA_def_property_ui_text(prop, "Asymmetric", "Allow thickness to be assigned asymmetrically");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleThicknessModifier_Curvature_3D", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(
+ srna, "Curvature 3D", "Line thickness based on the radial curvature of 3D mesh surfaces");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "curvature_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_curvature");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min Curvature", "Minimum Curvature");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "curvature_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_curvature");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Curvature", "Maximum Curvature");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleThicknessModifier_CreaseAngle", "LineStyleThicknessModifier");
+ RNA_def_struct_ui_text(
+ srna, "Crease Angle", "Line thickness based on the angle between two adjacent faces");
+ rna_def_thickness_modifier(srna);
+ rna_def_modifier_curve_common(srna, false, false);
+
+ prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "min_angle");
+ RNA_def_property_ui_text(prop, "Min Angle", "Minimum angle to modify thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "max_angle");
+ RNA_def_property_ui_text(prop, "Max Angle", "Maximum angle to modify thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Min Thickness", "Minimum thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Thickness", "Maximum thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ /* geometry modifiers */
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier", "LineStyleModifier");
+ RNA_def_struct_sdna(srna, "LineStyleModifier");
+ RNA_def_struct_refine_func(srna, "rna_LineStyle_geometry_modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_LineStyle_geometry_modifier_path");
+ RNA_def_struct_ui_text(
+ srna, "Line Style Geometry Modifier", "Base type to define stroke geometry modifiers");
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Sampling", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Sampling",
+ "Specify a new sampling value that determines the resolution of stroke polylines");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "sampling", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sampling");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(
+ prop, "Sampling", "New sampling value to be used for subsequent modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_BezierCurve", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna,
+ "Bezier Curve",
+ "Replace stroke backbone geometry by a Bezier curve approximation of the "
+ "original backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_ui_text(prop,
+ "Error",
+ "Maximum distance allowed between the new Bezier curve and the "
+ "original backbone geometry");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_SinusDisplacement", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna, "Sinus Displacement", "Add sinus displacement to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "wavelength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "wavelength");
+ RNA_def_property_ui_text(prop, "Wavelength", "Wavelength of the sinus displacement");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the sinus displacement");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phase");
+ RNA_def_property_ui_text(prop, "Phase", "Phase of the sinus displacement");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_SpatialNoise", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Spatial Noise", "Add spatial noise to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the spatial noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(prop, "Scale", "Scale of the spatial noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "octaves");
+ RNA_def_property_ui_text(
+ prop, "Octaves", "Number of octaves (i.e., the amount of detail of the spatial noise)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_SMOOTH);
+ RNA_def_property_ui_text(prop, "Smooth", "If true, the spatial noise is smooth");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_pure_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", LS_MODIFIER_SPATIAL_NOISE_PURERANDOM);
+ RNA_def_property_ui_text(
+ prop, "Pure Random", "If true, the spatial noise does not show any coherence");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_PerlinNoise1D", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna, "Perlin Noise 1D", "Add one-dimensional Perlin noise to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frequency");
+ RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "octaves");
+ RNA_def_property_ui_text(
+ prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(
+ prop,
+ "Seed",
+ "Seed for random number generation (if negative, time is used as a seed instead)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_PerlinNoise2D", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna, "Perlin Noise 2D", "Add two-dimensional Perlin noise to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frequency");
+ RNA_def_property_ui_text(prop, "Frequency", "Frequency of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of the Perlin noise");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "octaves", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "octaves");
+ RNA_def_property_ui_text(
+ prop, "Octaves", "Number of octaves (i.e., the amount of detail of the Perlin noise)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Angle", "Displacement direction");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_ui_text(
+ prop,
+ "Seed",
+ "Seed for random number generation (if negative, time is used as a seed instead)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_BackboneStretcher", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna, "Backbone Stretcher", "Stretch the beginning and the end of stroke backbone");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "backbone_length");
+ RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_TipRemover", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Tip Remover",
+ "Remove a piece of stroke at the beginning and the end of stroke backbone");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "tip_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tip_length");
+ RNA_def_property_ui_text(prop, "Tip Length", "Length of tips to be removed");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_Polygonalization", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna, "Polygonalization", "Modify the stroke geometry so that it looks more 'polygonal'");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_ui_text(
+ prop,
+ "Error",
+ "Maximum distance between the original stroke and its polygonal approximation");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_GuidingLines", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Guiding Lines",
+ "Modify the stroke geometry so that it corresponds to its main direction line");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(
+ prop, "Offset", "Displacement that is applied to the main direction line along its normal");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_Blueprint", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Blueprint",
+ "Produce a blueprint using circular, elliptic, and square contour strokes");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, blueprint_shape_items);
+ RNA_def_property_ui_text(prop, "Shape", "Select the shape of blueprint contour strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "rounds");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in contour strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "backbone_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "backbone_length");
+ RNA_def_property_ui_text(prop, "Backbone Length", "Amount of backbone stretching");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "random_radius", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_radius");
+ RNA_def_property_ui_text(prop, "Random Radius", "Randomness of the radius");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "random_center", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_center");
+ RNA_def_property_ui_text(prop, "Random Center", "Randomness of the center");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "random_backbone", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "random_backbone");
+ RNA_def_property_ui_text(prop, "Random Backbone", "Randomness of the backbone stretching");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifier_2DOffset", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(
+ srna, "2D Offset", "Add two-dimensional offsets to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "start");
+ RNA_def_property_ui_text(
+ prop, "Start", "Displacement that is applied from the beginning of the stroke");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "end");
+ RNA_def_property_ui_text(prop, "End", "Displacement that is applied from the end of the stroke");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_ui_text(
+ prop, "X", "Displacement that is applied to the X coordinates of stroke vertices");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "y");
+ RNA_def_property_ui_text(
+ prop, "Y", "Displacement that is applied to the Y coordinates of stroke vertices");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_2DTransform", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna,
+ "2D Transform",
+ "Apply two-dimensional scaling and rotation to stroke backbone geometry");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "pivot", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "pivot");
+ RNA_def_property_enum_items(prop, transform_pivot_items);
+ RNA_def_property_ui_text(prop, "Pivot", "Pivot of scaling and rotation operations");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale_x");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Scale X", "Scaling factor that is applied along the X axis");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale_y");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Scale Y", "Scaling factor that is applied along the Y axis");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation angle");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "pivot_u", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pivot_u");
+ RNA_def_property_range(prop, 0.f, 1.f);
+ RNA_def_property_ui_text(prop,
+ "Stroke Point Parameter",
+ "Pivot in terms of the stroke point parameter u (0 <= u <= 1)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "pivot_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pivot_x");
+ RNA_def_property_ui_text(prop, "Pivot X", "2D X coordinate of the absolute pivot");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "pivot_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pivot_y");
+ RNA_def_property_ui_text(prop, "Pivot Y", "2D Y coordinate of the absolute pivot");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ srna = RNA_def_struct(
+ brna, "LineStyleGeometryModifier_Simplification", "LineStyleGeometryModifier");
+ RNA_def_struct_ui_text(srna, "Simplification", "Simplify the stroke set");
+ rna_def_geometry_modifier(srna);
+
+ prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tolerance");
+ RNA_def_property_ui_text(prop, "Tolerance", "Distance below which segments will be merged");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
}
static void rna_def_freestyle_color_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "LineStyleColorModifiers");
- srna = RNA_def_struct(brna, "LineStyleColorModifiers", NULL);
- RNA_def_struct_sdna(srna, "FreestyleLineStyle");
- RNA_def_struct_ui_text(srna, "Color Modifiers", "Color modifiers for changing line colors");
-
- func = RNA_def_function(srna, "new", "rna_LineStyle_color_modifier_add");
- RNA_def_function_ui_description(func, "Add a color modifier to line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "name", "ColorModifier", 0, "", "New name for the color modifier (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_linestyle_color_modifier_type_items, 0, "", "Color modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "modifier", "LineStyleColorModifier", "", "Newly added color modifier");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_LineStyle_color_modifier_remove");
- RNA_def_function_ui_description(func, "Remove a color modifier from line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "modifier", "LineStyleColorModifier", "", "Color modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "LineStyleColorModifiers");
+ srna = RNA_def_struct(brna, "LineStyleColorModifiers", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleLineStyle");
+ RNA_def_struct_ui_text(srna, "Color Modifiers", "Color modifiers for changing line colors");
+
+ func = RNA_def_function(srna, "new", "rna_LineStyle_color_modifier_add");
+ RNA_def_function_ui_description(func, "Add a color modifier to line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(
+ func, "name", "ColorModifier", 0, "", "New name for the color modifier (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_linestyle_color_modifier_type_items,
+ 0,
+ "",
+ "Color modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleColorModifier", "", "Newly added color modifier");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_LineStyle_color_modifier_remove");
+ RNA_def_function_ui_description(func, "Remove a color modifier from line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleColorModifier", "", "Color modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_freestyle_alpha_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "LineStyleAlphaModifiers");
- srna = RNA_def_struct(brna, "LineStyleAlphaModifiers", NULL);
- RNA_def_struct_sdna(srna, "FreestyleLineStyle");
- RNA_def_struct_ui_text(srna, "Alpha Modifiers", "Alpha modifiers for changing line alphas");
-
- func = RNA_def_function(srna, "new", "rna_LineStyle_alpha_modifier_add");
- RNA_def_function_ui_description(func, "Add a alpha modifier to line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "name", "AlphaModifier", 0, "", "New name for the alpha modifier (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_linestyle_alpha_modifier_type_items, 0, "", "Alpha modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "modifier", "LineStyleAlphaModifier", "", "Newly added alpha modifier");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_LineStyle_alpha_modifier_remove");
- RNA_def_function_ui_description(func, "Remove a alpha modifier from line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "modifier", "LineStyleAlphaModifier", "", "Alpha modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "LineStyleAlphaModifiers");
+ srna = RNA_def_struct(brna, "LineStyleAlphaModifiers", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleLineStyle");
+ RNA_def_struct_ui_text(srna, "Alpha Modifiers", "Alpha modifiers for changing line alphas");
+
+ func = RNA_def_function(srna, "new", "rna_LineStyle_alpha_modifier_add");
+ RNA_def_function_ui_description(func, "Add a alpha modifier to line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(
+ func, "name", "AlphaModifier", 0, "", "New name for the alpha modifier (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_linestyle_alpha_modifier_type_items,
+ 0,
+ "",
+ "Alpha modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleAlphaModifier", "", "Newly added alpha modifier");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_LineStyle_alpha_modifier_remove");
+ RNA_def_function_ui_description(func, "Remove a alpha modifier from line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleAlphaModifier", "", "Alpha modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_freestyle_thickness_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "LineStyleThicknessModifiers");
- srna = RNA_def_struct(brna, "LineStyleThicknessModifiers", NULL);
- RNA_def_struct_sdna(srna, "FreestyleLineStyle");
- RNA_def_struct_ui_text(srna, "Thickness Modifiers", "Thickness modifiers for changing line thickness");
-
- func = RNA_def_function(srna, "new", "rna_LineStyle_thickness_modifier_add");
- RNA_def_function_ui_description(func, "Add a thickness modifier to line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "name", "ThicknessModifier", 0, "", "New name for the thickness modifier (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_linestyle_thickness_modifier_type_items, 0,
- "", "Thickness modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "modifier", "LineStyleThicknessModifier", "", "Newly added thickness modifier");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_LineStyle_thickness_modifier_remove");
- RNA_def_function_ui_description(func, "Remove a thickness modifier from line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "modifier", "LineStyleThicknessModifier", "", "Thickness modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "LineStyleThicknessModifiers");
+ srna = RNA_def_struct(brna, "LineStyleThicknessModifiers", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleLineStyle");
+ RNA_def_struct_ui_text(
+ srna, "Thickness Modifiers", "Thickness modifiers for changing line thickness");
+
+ func = RNA_def_function(srna, "new", "rna_LineStyle_thickness_modifier_add");
+ RNA_def_function_ui_description(func, "Add a thickness modifier to line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func,
+ "name",
+ "ThicknessModifier",
+ 0,
+ "",
+ "New name for the thickness modifier (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_linestyle_thickness_modifier_type_items,
+ 0,
+ "",
+ "Thickness modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleThicknessModifier", "", "Newly added thickness modifier");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_LineStyle_thickness_modifier_remove");
+ RNA_def_function_ui_description(func, "Remove a thickness modifier from line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleThicknessModifier", "", "Thickness modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_freestyle_geometry_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "LineStyleGeometryModifiers");
- srna = RNA_def_struct(brna, "LineStyleGeometryModifiers", NULL);
- RNA_def_struct_sdna(srna, "FreestyleLineStyle");
- RNA_def_struct_ui_text(srna, "Geometry Modifiers", "Geometry modifiers for changing line geometries");
-
- func = RNA_def_function(srna, "new", "rna_LineStyle_geometry_modifier_add");
- RNA_def_function_ui_description(func, "Add a geometry modifier to line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "name", "GeometryModifier", 0, "", "New name for the geometry modifier (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_linestyle_geometry_modifier_type_items, 0,
- "", "Geometry modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "modifier", "LineStyleGeometryModifier", "", "Newly added geometry modifier");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_LineStyle_geometry_modifier_remove");
- RNA_def_function_ui_description(func, "Remove a geometry modifier from line style");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "modifier", "LineStyleGeometryModifier", "", "Geometry modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "LineStyleGeometryModifiers");
+ srna = RNA_def_struct(brna, "LineStyleGeometryModifiers", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleLineStyle");
+ RNA_def_struct_ui_text(
+ srna, "Geometry Modifiers", "Geometry modifiers for changing line geometries");
+
+ func = RNA_def_function(srna, "new", "rna_LineStyle_geometry_modifier_add");
+ RNA_def_function_ui_description(func, "Add a geometry modifier to line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(
+ func, "name", "GeometryModifier", 0, "", "New name for the geometry modifier (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_linestyle_geometry_modifier_type_items,
+ 0,
+ "",
+ "Geometry modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleGeometryModifier", "", "Newly added geometry modifier");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_LineStyle_geometry_modifier_remove");
+ RNA_def_function_ui_description(func, "Remove a geometry modifier from line style");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "modifier", "LineStyleGeometryModifier", "", "Geometry modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_linestyle(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem panel_items[] = {
- {LS_PANEL_STROKES, "STROKES", 0, "Strokes", "Show the panel for stroke construction"},
- {LS_PANEL_COLOR, "COLOR", 0, "Color", "Show the panel for line color options"},
- {LS_PANEL_ALPHA, "ALPHA", 0, "Alpha", "Show the panel for alpha transparency options"},
- {LS_PANEL_THICKNESS, "THICKNESS", 0, "Thickness", "Show the panel for line thickness options"},
- {LS_PANEL_GEOMETRY, "GEOMETRY", 0, "Geometry", "Show the panel for stroke geometry options"},
- {LS_PANEL_TEXTURE, "TEXTURE", 0, "Texture", "Show the panel for stroke texture options"},
-#if 0 /* hidden for now */
- {LS_PANEL_MISC, "MISC", 0, "Misc", "Show the panel for miscellaneous options"},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem chaining_items[] = {
- {LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"},
- {LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining with a multiple touch"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem cap_items[] = {
- {LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"},
- {LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"},
- {LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and extended)"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem thickness_position_items[] = {
- {LS_THICKNESS_CENTER, "CENTER", 0, "Center", "Silhouettes and border edges are centered along stroke geometry"},
- {LS_THICKNESS_INSIDE, "INSIDE", 0, "Inside", "Silhouettes and border edges are drawn inside of stroke geometry"},
- {LS_THICKNESS_OUTSIDE, "OUTSIDE", 0, "Outside", "Silhouettes and border edges are drawn outside of stroke geometry"},
- {LS_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative", "Silhouettes and border edges are shifted by a user-defined ratio"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem sort_key_items[] = {
- {LS_SORT_KEY_DISTANCE_FROM_CAMERA, "DISTANCE_FROM_CAMERA", 0, "Distance from Camera", "Sort by distance from camera (closer lines lie on top of further lines)"},
- {LS_SORT_KEY_2D_LENGTH, "2D_LENGTH", 0, "2D Length", "Sort by curvilinear 2D length (longer lines lie on top of shorter lines)"},
- {LS_SORT_KEY_PROJECTED_X, "PROJECTED_X", 0, "Projected X", "Sort by the projected X value in the image coordinate system"},
- {LS_SORT_KEY_PROJECTED_Y, "PROJECTED_Y", 0, "Projected Y", "Sort by the projected Y value in the image coordinate system"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem sort_order_items[] = {
- {0, "DEFAULT", 0, "Default", "Default order of the sort key"},
- {LS_REVERSE_ORDER, "REVERSE", 0, "Reverse", "Reverse order"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem integration_type_items[] = {
- {LS_INTEGRATION_MEAN, "MEAN", 0, "Mean", "The value computed for the chain is the mean of the values obtained for chain vertices"},
- {LS_INTEGRATION_MIN, "MIN", 0, "Min", "The value computed for the chain is the minimum of the values obtained for chain vertices"},
- {LS_INTEGRATION_MAX, "MAX", 0, "Max", "The value computed for the chain is the maximum of the values obtained for chain vertices"},
- {LS_INTEGRATION_FIRST, "FIRST", 0, "First", "The value computed for the chain is the value obtained for the first chain vertex"},
- {LS_INTEGRATION_LAST, "LAST", 0, "Last", "The value computed for the chain is the value obtained for the last chain vertex"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FreestyleLineStyle", "ID");
- RNA_def_struct_ui_text(srna, "Freestyle Line Style", "Freestyle line style, reusable by multiple line sets");
- RNA_def_struct_ui_icon(srna, ICON_LINE_DATA);
-
- rna_def_mtex_common(brna, srna, "rna_LineStyle_mtex_begin", "rna_LineStyle_active_texture_get",
- "rna_LineStyle_active_texture_set", NULL, "LineStyleTextureSlot", "LineStyleTextureSlots",
- "rna_LineStyle_update", "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "panel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "panel");
- RNA_def_property_enum_items(prop, panel_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Panel", "Select the property panel to be shown");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Base line color, possibly modified by line color modifiers");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Alpha Transparency",
- "Base alpha transparency, possibly modified by alpha transparency modifiers");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "thickness");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Thickness", "Base line thickness, possibly modified by line thickness modifiers");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_position", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "thickness_position");
- RNA_def_property_enum_items(prop, thickness_position_items);
- RNA_def_property_ui_text(prop, "Thickness Position",
- "Thickness position of silhouettes and border edges (applicable when plain chaining is used with the Same Object option)");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "thickness_ratio", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "thickness_ratio");
- RNA_def_property_range(prop, 0.f, 1.f);
- RNA_def_property_ui_text(prop, "Thickness Ratio",
- "A number between 0 (inside) and 1 (outside) specifying the relative position of "
- "stroke thickness");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "color_modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "color_modifiers", NULL);
- RNA_def_property_struct_type(prop, "LineStyleColorModifier");
- RNA_def_property_ui_text(prop, "Color Modifiers", "List of line color modifiers");
- rna_def_freestyle_color_modifiers(brna, prop);
-
- prop = RNA_def_property(srna, "alpha_modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "alpha_modifiers", NULL);
- RNA_def_property_struct_type(prop, "LineStyleAlphaModifier");
- RNA_def_property_ui_text(prop, "Alpha Modifiers", "List of alpha transparency modifiers");
- rna_def_freestyle_alpha_modifiers(brna, prop);
-
- prop = RNA_def_property(srna, "thickness_modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "thickness_modifiers", NULL);
- RNA_def_property_struct_type(prop, "LineStyleThicknessModifier");
- RNA_def_property_ui_text(prop, "Thickness Modifiers", "List of line thickness modifiers");
- rna_def_freestyle_thickness_modifiers(brna, prop);
-
- prop = RNA_def_property(srna, "geometry_modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "geometry_modifiers", NULL);
- RNA_def_property_struct_type(prop, "LineStyleGeometryModifier");
- RNA_def_property_ui_text(prop, "Geometry Modifiers", "List of stroke geometry modifiers");
- rna_def_freestyle_geometry_modifiers(brna, prop);
-
- prop = RNA_def_property(srna, "use_chaining", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_CHAINING);
- RNA_def_property_ui_text(prop, "Chaining", "Enable chaining of feature edges");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "chaining", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "chaining");
- RNA_def_property_enum_items(prop, chaining_items);
- RNA_def_property_ui_text(prop, "Chaining Method", "Select the way how feature edges are jointed to form chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "rounds");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in a sketchy multiple touch");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_same_object", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SAME_OBJECT);
- RNA_def_property_ui_text(prop, "Same Object", "If true, only feature edges of the same object are joined");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_split_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_LENGTH);
- RNA_def_property_ui_text(prop, "Use Split Length", "Enable chain splitting by curvilinear 2D length");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "split_length");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Split Length", "Curvilinear 2D length for chain splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_angle_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_ANGLE);
- RNA_def_property_ui_text(prop, "Use Min 2D Angle",
- "Split chains at points with angles smaller than the minimum 2D angle");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "min_angle");
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_text(prop, "Min 2D Angle", "Minimum 2D angle for splitting chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_angle_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_ANGLE);
- RNA_def_property_ui_text(prop, "Use Max 2D Angle",
- "Split chains at points with angles larger than the maximum 2D angle");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "max_angle");
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_text(prop, "Max 2D Angle", "Maximum 2D angle for splitting chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_length_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_LENGTH);
- RNA_def_property_ui_text(prop, "Use Min 2D Length", "Enable the selection of chains by a minimum 2D length");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "length_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min_length");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Min 2D Length", "Minimum curvilinear 2D length for the selection of chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_length_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_LENGTH);
- RNA_def_property_ui_text(prop, "Use Max 2D Length", "Enable the selection of chains by a maximum 2D length");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "length_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max_length");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max 2D Length", "Maximum curvilinear 2D length for the selection of chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_chain_count", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_CHAIN_COUNT);
- RNA_def_property_ui_text(prop, "Use Chain Count", "Enable the selection of first N chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "chain_count");
- RNA_def_property_ui_text(prop, "Chain Count", "Chain count for the selection of first N chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_split_pattern", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_PATTERN);
- RNA_def_property_ui_text(prop, "Use Split Pattern", "Enable chain splitting by dashed line patterns");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_dash1", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "split_dash1");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Split Dash 1", "Length of the 1st dash for splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_gap1", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "split_gap1");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Split Gap 1", "Length of the 1st gap for splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_dash2", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "split_dash2");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Split Dash 2", "Length of the 2nd dash for splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_gap2", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "split_gap2");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Split Gap 2", "Length of the 2nd gap for splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_dash3", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "split_dash3");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Split Dash 3", "Length of the 3rd dash for splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "split_gap3", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "split_gap3");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Split Gap 3", "Length of the 3rd gap for splitting");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY);
- RNA_def_property_ui_text(prop, "Material Boundary", "If true, chains of feature edges are split at material boundaries");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_sorting", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_SORTING);
- RNA_def_property_ui_text(prop, "Sorting", "Arrange the stacking order of strokes");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "sort_key", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sort_key");
- RNA_def_property_enum_items(prop, sort_key_items);
- RNA_def_property_ui_text(prop, "Sort Key", "Select the sort key to determine the stacking order of chains");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "sort_order", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, sort_order_items);
- RNA_def_property_ui_text(prop, "Sort Order", "Select the sort order");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "integration_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "integration_type");
- RNA_def_property_enum_items(prop, integration_type_items);
- RNA_def_property_ui_text(prop, "Integration Type", "Select the way how the sort key is computed for each chain");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE);
- RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed line");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "caps", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "caps");
- RNA_def_property_enum_items(prop, cap_items);
- RNA_def_property_ui_text(prop, "Caps", "Select the shape of both ends of strokes");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "dash1", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "dash1");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Dash 1", "Length of the 1st dash for dashed lines");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "gap1", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "gap1");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Gap 1", "Length of the 1st gap for dashed lines");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "dash2", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "dash2");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Dash 2", "Length of the 2nd dash for dashed lines");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "gap2", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "gap2");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Gap 2", "Length of the 2nd gap for dashed lines");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "dash3", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "dash3");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Dash 3", "Length of the 3rd dash for dashed lines");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "gap3", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "gap3");
- RNA_def_property_range(prop, 0, USHRT_MAX);
- RNA_def_property_ui_text(prop, "Gap 3", "Length of the 3rd gap for dashed lines");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_TEXTURE);
- RNA_def_property_ui_text(prop, "Use Textures", "Enable or disable textured strokes");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- prop = RNA_def_property(srna, "texture_spacing", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "texstep");
- RNA_def_property_range(prop, 0.01f, 100.0f);
- RNA_def_property_ui_text(prop, "Texture spacing", "Spacing for textures along stroke length");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
-
- /* anim */
- rna_def_animdata_common(srna);
-
- /* nodes */
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based shaders");
-
- prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes for the line style");
- RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_use_nodes_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem panel_items[] = {
+ {LS_PANEL_STROKES, "STROKES", 0, "Strokes", "Show the panel for stroke construction"},
+ {LS_PANEL_COLOR, "COLOR", 0, "Color", "Show the panel for line color options"},
+ {LS_PANEL_ALPHA, "ALPHA", 0, "Alpha", "Show the panel for alpha transparency options"},
+ {LS_PANEL_THICKNESS, "THICKNESS", 0, "Thickness", "Show the panel for line thickness options"},
+ {LS_PANEL_GEOMETRY, "GEOMETRY", 0, "Geometry", "Show the panel for stroke geometry options"},
+ {LS_PANEL_TEXTURE, "TEXTURE", 0, "Texture", "Show the panel for stroke texture options"},
+# if 0 /* hidden for now */
+ {LS_PANEL_MISC, "MISC", 0, "Misc", "Show the panel for miscellaneous options"},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem chaining_items[] = {
+ {LS_CHAINING_PLAIN, "PLAIN", 0, "Plain", "Plain chaining"},
+ {LS_CHAINING_SKETCHY, "SKETCHY", 0, "Sketchy", "Sketchy chaining with a multiple touch"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem cap_items[] = {
+ {LS_CAPS_BUTT, "BUTT", 0, "Butt", "Butt cap (flat)"},
+ {LS_CAPS_ROUND, "ROUND", 0, "Round", "Round cap (half-circle)"},
+ {LS_CAPS_SQUARE, "SQUARE", 0, "Square", "Square cap (flat and extended)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem thickness_position_items[] = {
+ {LS_THICKNESS_CENTER,
+ "CENTER",
+ 0,
+ "Center",
+ "Silhouettes and border edges are centered along stroke geometry"},
+ {LS_THICKNESS_INSIDE,
+ "INSIDE",
+ 0,
+ "Inside",
+ "Silhouettes and border edges are drawn inside of stroke geometry"},
+ {LS_THICKNESS_OUTSIDE,
+ "OUTSIDE",
+ 0,
+ "Outside",
+ "Silhouettes and border edges are drawn outside of stroke geometry"},
+ {LS_THICKNESS_RELATIVE,
+ "RELATIVE",
+ 0,
+ "Relative",
+ "Silhouettes and border edges are shifted by a user-defined ratio"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem sort_key_items[] = {
+ {LS_SORT_KEY_DISTANCE_FROM_CAMERA,
+ "DISTANCE_FROM_CAMERA",
+ 0,
+ "Distance from Camera",
+ "Sort by distance from camera (closer lines lie on top of further lines)"},
+ {LS_SORT_KEY_2D_LENGTH,
+ "2D_LENGTH",
+ 0,
+ "2D Length",
+ "Sort by curvilinear 2D length (longer lines lie on top of shorter lines)"},
+ {LS_SORT_KEY_PROJECTED_X,
+ "PROJECTED_X",
+ 0,
+ "Projected X",
+ "Sort by the projected X value in the image coordinate system"},
+ {LS_SORT_KEY_PROJECTED_Y,
+ "PROJECTED_Y",
+ 0,
+ "Projected Y",
+ "Sort by the projected Y value in the image coordinate system"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem sort_order_items[] = {
+ {0, "DEFAULT", 0, "Default", "Default order of the sort key"},
+ {LS_REVERSE_ORDER, "REVERSE", 0, "Reverse", "Reverse order"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem integration_type_items[] = {
+ {LS_INTEGRATION_MEAN,
+ "MEAN",
+ 0,
+ "Mean",
+ "The value computed for the chain is the mean of the values obtained for chain vertices"},
+ {LS_INTEGRATION_MIN,
+ "MIN",
+ 0,
+ "Min",
+ "The value computed for the chain is the minimum of the values obtained for chain "
+ "vertices"},
+ {LS_INTEGRATION_MAX,
+ "MAX",
+ 0,
+ "Max",
+ "The value computed for the chain is the maximum of the values obtained for chain "
+ "vertices"},
+ {LS_INTEGRATION_FIRST,
+ "FIRST",
+ 0,
+ "First",
+ "The value computed for the chain is the value obtained for the first chain vertex"},
+ {LS_INTEGRATION_LAST,
+ "LAST",
+ 0,
+ "Last",
+ "The value computed for the chain is the value obtained for the last chain vertex"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FreestyleLineStyle", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Freestyle Line Style", "Freestyle line style, reusable by multiple line sets");
+ RNA_def_struct_ui_icon(srna, ICON_LINE_DATA);
+
+ rna_def_mtex_common(brna,
+ srna,
+ "rna_LineStyle_mtex_begin",
+ "rna_LineStyle_active_texture_get",
+ "rna_LineStyle_active_texture_set",
+ NULL,
+ "LineStyleTextureSlot",
+ "LineStyleTextureSlots",
+ "rna_LineStyle_update",
+ "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "panel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "panel");
+ RNA_def_property_enum_items(prop, panel_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Panel", "Select the property panel to be shown");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Color", "Base line color, possibly modified by line color modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Alpha Transparency",
+ "Base alpha transparency, possibly modified by alpha transparency modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "thickness");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(
+ prop, "Thickness", "Base line thickness, possibly modified by line thickness modifiers");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_position", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "thickness_position");
+ RNA_def_property_enum_items(prop, thickness_position_items);
+ RNA_def_property_ui_text(prop,
+ "Thickness Position",
+ "Thickness position of silhouettes and border edges (applicable when "
+ "plain chaining is used with the Same Object option)");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "thickness_ratio", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "thickness_ratio");
+ RNA_def_property_range(prop, 0.f, 1.f);
+ RNA_def_property_ui_text(
+ prop,
+ "Thickness Ratio",
+ "A number between 0 (inside) and 1 (outside) specifying the relative position of "
+ "stroke thickness");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "color_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "color_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleColorModifier");
+ RNA_def_property_ui_text(prop, "Color Modifiers", "List of line color modifiers");
+ rna_def_freestyle_color_modifiers(brna, prop);
+
+ prop = RNA_def_property(srna, "alpha_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "alpha_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleAlphaModifier");
+ RNA_def_property_ui_text(prop, "Alpha Modifiers", "List of alpha transparency modifiers");
+ rna_def_freestyle_alpha_modifiers(brna, prop);
+
+ prop = RNA_def_property(srna, "thickness_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "thickness_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleThicknessModifier");
+ RNA_def_property_ui_text(prop, "Thickness Modifiers", "List of line thickness modifiers");
+ rna_def_freestyle_thickness_modifiers(brna, prop);
+
+ prop = RNA_def_property(srna, "geometry_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "geometry_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "LineStyleGeometryModifier");
+ RNA_def_property_ui_text(prop, "Geometry Modifiers", "List of stroke geometry modifiers");
+ rna_def_freestyle_geometry_modifiers(brna, prop);
+
+ prop = RNA_def_property(srna, "use_chaining", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_CHAINING);
+ RNA_def_property_ui_text(prop, "Chaining", "Enable chaining of feature edges");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "chaining", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "chaining");
+ RNA_def_property_enum_items(prop, chaining_items);
+ RNA_def_property_ui_text(
+ prop, "Chaining Method", "Select the way how feature edges are jointed to form chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "rounds", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "rounds");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Rounds", "Number of rounds in a sketchy multiple touch");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_same_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SAME_OBJECT);
+ RNA_def_property_ui_text(
+ prop, "Same Object", "If true, only feature edges of the same object are joined");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_split_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_LENGTH);
+ RNA_def_property_ui_text(
+ prop, "Use Split Length", "Enable chain splitting by curvilinear 2D length");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "split_length");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Split Length", "Curvilinear 2D length for chain splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_angle_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_ANGLE);
+ RNA_def_property_ui_text(prop,
+ "Use Min 2D Angle",
+ "Split chains at points with angles smaller than the minimum 2D angle");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "min_angle");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Min 2D Angle", "Minimum 2D angle for splitting chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_angle_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_ANGLE);
+ RNA_def_property_ui_text(prop,
+ "Use Max 2D Angle",
+ "Split chains at points with angles larger than the maximum 2D angle");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "angle_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "max_angle");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Max 2D Angle", "Maximum 2D angle for splitting chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_length_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MIN_2D_LENGTH);
+ RNA_def_property_ui_text(
+ prop, "Use Min 2D Length", "Enable the selection of chains by a minimum 2D length");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "length_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min_length");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(
+ prop, "Min 2D Length", "Minimum curvilinear 2D length for the selection of chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_length_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MAX_2D_LENGTH);
+ RNA_def_property_ui_text(
+ prop, "Use Max 2D Length", "Enable the selection of chains by a maximum 2D length");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "length_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max_length");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(
+ prop, "Max 2D Length", "Maximum curvilinear 2D length for the selection of chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_chain_count", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_CHAIN_COUNT);
+ RNA_def_property_ui_text(prop, "Use Chain Count", "Enable the selection of first N chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "chain_count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "chain_count");
+ RNA_def_property_ui_text(prop, "Chain Count", "Chain count for the selection of first N chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_split_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_SPLIT_PATTERN);
+ RNA_def_property_ui_text(
+ prop, "Use Split Pattern", "Enable chain splitting by dashed line patterns");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_dash1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_dash1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Dash 1", "Length of the 1st dash for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_gap1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_gap1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Gap 1", "Length of the 1st gap for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_dash2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_dash2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Dash 2", "Length of the 2nd dash for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_gap2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_gap2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Gap 2", "Length of the 2nd gap for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_dash3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_dash3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Dash 3", "Length of the 3rd dash for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "split_gap3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "split_gap3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Split Gap 3", "Length of the 3rd gap for splitting");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop,
+ "Material Boundary",
+ "If true, chains of feature edges are split at material boundaries");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_sorting", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", LS_NO_SORTING);
+ RNA_def_property_ui_text(prop, "Sorting", "Arrange the stacking order of strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "sort_key", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sort_key");
+ RNA_def_property_enum_items(prop, sort_key_items);
+ RNA_def_property_ui_text(
+ prop, "Sort Key", "Select the sort key to determine the stacking order of chains");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "sort_order", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, sort_order_items);
+ RNA_def_property_ui_text(prop, "Sort Order", "Select the sort order");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "integration_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "integration_type");
+ RNA_def_property_enum_items(prop, integration_type_items);
+ RNA_def_property_ui_text(
+ prop, "Integration Type", "Select the way how the sort key is computed for each chain");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_dashed_line", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_DASHED_LINE);
+ RNA_def_property_ui_text(prop, "Dashed Line", "Enable or disable dashed line");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "caps", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "caps");
+ RNA_def_property_enum_items(prop, cap_items);
+ RNA_def_property_ui_text(prop, "Caps", "Select the shape of both ends of strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "dash1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "dash1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Dash 1", "Length of the 1st dash for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "gap1", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "gap1");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Gap 1", "Length of the 1st gap for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "dash2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "dash2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Dash 2", "Length of the 2nd dash for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "gap2", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "gap2");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Gap 2", "Length of the 2nd gap for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "dash3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "dash3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Dash 3", "Length of the 3rd dash for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "gap3", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "gap3");
+ RNA_def_property_range(prop, 0, USHRT_MAX);
+ RNA_def_property_ui_text(prop, "Gap 3", "Length of the 3rd gap for dashed lines");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LS_TEXTURE);
+ RNA_def_property_ui_text(prop, "Use Textures", "Enable or disable textured strokes");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ prop = RNA_def_property(srna, "texture_spacing", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "texstep");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(prop, "Texture spacing", "Spacing for textures along stroke length");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_update");
+
+ /* anim */
+ rna_def_animdata_common(srna);
+
+ /* nodes */
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based shaders");
+
+ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes for the line style");
+ RNA_def_property_update(prop, NC_LINESTYLE, "rna_LineStyle_use_nodes_update");
}
void RNA_def_linestyle(BlenderRNA *brna)
{
- rna_def_linestyle_modifiers(brna);
- rna_def_linestyle(brna);
- rna_def_linestyle_mtex(brna);
+ rna_def_linestyle_modifiers(brna);
+ rna_def_linestyle(brna);
+ rna_def_linestyle_mtex(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index b157349062c..6d82ded02bd 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -31,70 +31,71 @@
#ifdef RNA_RUNTIME
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_global.h"
+# include "BKE_main.h"
+# include "BKE_mesh.h"
+# include "BKE_global.h"
/* all the list begin functions are added manually here, Main is not in SDNA */
static bool rna_Main_use_autopack_get(PointerRNA *UNUSED(ptr))
{
- if (G.fileflags & G_FILE_AUTOPACK)
- return 1;
+ if (G.fileflags & G_FILE_AUTOPACK)
+ return 1;
- return 0;
+ return 0;
}
static void rna_Main_use_autopack_set(PointerRNA *UNUSED(ptr), bool value)
{
- if (value)
- G.fileflags |= G_FILE_AUTOPACK;
- else
- G.fileflags &= ~G_FILE_AUTOPACK;
+ if (value)
+ G.fileflags |= G_FILE_AUTOPACK;
+ else
+ G.fileflags &= ~G_FILE_AUTOPACK;
}
static bool rna_Main_is_saved_get(PointerRNA *UNUSED(ptr))
{
- return G.relbase_valid;
+ return G.relbase_valid;
}
static bool rna_Main_is_dirty_get(PointerRNA *ptr)
{
- /* XXX, not totally nice to do it this way, should store in main ? */
- Main *bmain = (Main *)ptr->data;
- wmWindowManager *wm;
- if ((wm = bmain->wm.first)) {
- return !wm->file_saved;
- }
-
- return true;
+ /* XXX, not totally nice to do it this way, should store in main ? */
+ Main *bmain = (Main *)ptr->data;
+ wmWindowManager *wm;
+ if ((wm = bmain->wm.first)) {
+ return !wm->file_saved;
+ }
+
+ return true;
}
static void rna_Main_filepath_get(PointerRNA *ptr, char *value)
{
- Main *bmain = (Main *)ptr->data;
- BLI_strncpy(value, bmain->name, sizeof(bmain->name));
+ Main *bmain = (Main *)ptr->data;
+ BLI_strncpy(value, bmain->name, sizeof(bmain->name));
}
static int rna_Main_filepath_length(PointerRNA *ptr)
{
- Main *bmain = (Main *)ptr->data;
- return strlen(bmain->name);
+ Main *bmain = (Main *)ptr->data;
+ return strlen(bmain->name);
}
-#if 0
+# if 0
static void rna_Main_filepath_set(PointerRNA *ptr, const char *value)
{
- Main *bmain = (Main *)ptr->data;
- BLI_strncpy(bmain->name, value, sizeof(bmain->name));
+ Main *bmain = (Main *)ptr->data;
+ BLI_strncpy(bmain->name, value, sizeof(bmain->name));
}
-#endif
+# endif
-#define RNA_MAIN_LISTBASE_FUNCS_DEF(_listbase_name) \
- static void rna_Main_##_listbase_name##_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) \
- { \
- rna_iterator_listbase_begin(iter, &((Main *)ptr->data)->_listbase_name, NULL); \
- }
+# define RNA_MAIN_LISTBASE_FUNCS_DEF(_listbase_name) \
+ static void rna_Main_##_listbase_name##_begin(CollectionPropertyIterator *iter, \
+ PointerRNA *ptr) \
+ { \
+ rna_iterator_listbase_begin(iter, &((Main *)ptr->data)->_listbase_name, NULL); \
+ }
RNA_MAIN_LISTBASE_FUNCS_DEF(actions)
RNA_MAIN_LISTBASE_FUNCS_DEF(armatures)
@@ -132,148 +133,332 @@ RNA_MAIN_LISTBASE_FUNCS_DEF(wm)
RNA_MAIN_LISTBASE_FUNCS_DEF(workspaces)
RNA_MAIN_LISTBASE_FUNCS_DEF(worlds)
-#undef RNA_MAIN_LISTBASE_FUNCS_DEF
+# undef RNA_MAIN_LISTBASE_FUNCS_DEF
static void rna_Main_version_get(PointerRNA *ptr, int *value)
{
- Main *bmain = (Main *)ptr->data;
- value[0] = bmain->versionfile / 100;
- value[1] = bmain->versionfile % 100;
- value[2] = bmain->subversionfile;
+ Main *bmain = (Main *)ptr->data;
+ value[0] = bmain->versionfile / 100;
+ value[1] = bmain->versionfile % 100;
+ value[2] = bmain->subversionfile;
}
-#ifdef UNIT_TEST
+# ifdef UNIT_TEST
static PointerRNA rna_Test_test_get(PointerRNA *ptr)
{
- PointerRNA ret = *ptr;
- ret.type = &RNA_Test;
+ PointerRNA ret = *ptr;
+ ret.type = &RNA_Test;
- return ret;
+ return ret;
}
-#endif
+# endif
#else
/* local convenience types */
-typedef void (CollectionDefFunc)(struct BlenderRNA *brna, struct PropertyRNA *cprop);
+typedef void(CollectionDefFunc)(struct BlenderRNA *brna, struct PropertyRNA *cprop);
typedef struct MainCollectionDef {
- const char *identifier;
- const char *type;
- const char *iter_begin;
- const char *name;
- const char *description;
- CollectionDefFunc *func;
+ const char *identifier;
+ const char *type;
+ const char *iter_begin;
+ const char *name;
+ const char *description;
+ CollectionDefFunc *func;
} MainCollectionDef;
void RNA_def_main(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- CollectionDefFunc *func;
-
- /* plural must match idtypes in readblenentry.c */
- MainCollectionDef lists[] = {
- {"cameras", "Camera", "rna_Main_cameras_begin", "Cameras", "Camera data-blocks", RNA_def_main_cameras},
- {"scenes", "Scene", "rna_Main_scenes_begin", "Scenes", "Scene data-blocks", RNA_def_main_scenes},
- {"objects", "Object", "rna_Main_objects_begin", "Objects", "Object data-blocks", RNA_def_main_objects},
- {"materials", "Material", "rna_Main_materials_begin", "Materials", "Material data-blocks", RNA_def_main_materials},
- {"node_groups", "NodeTree", "rna_Main_nodetrees_begin", "Node Groups", "Node group data-blocks", RNA_def_main_node_groups},
- {"meshes", "Mesh", "rna_Main_meshes_begin", "Meshes", "Mesh data-blocks", RNA_def_main_meshes},
- {"lights", "Light", "rna_Main_lights_begin", "Lights", "Light data-blocks", RNA_def_main_lights},
- {"libraries", "Library", "rna_Main_libraries_begin", "Libraries", "Library data-blocks", RNA_def_main_libraries},
- {"screens", "Screen", "rna_Main_screens_begin", "Screens", "Screen data-blocks", RNA_def_main_screens},
- {"window_managers", "WindowManager", "rna_Main_wm_begin", "Window Managers", "Window manager data-blocks", RNA_def_main_window_managers},
- {"images", "Image", "rna_Main_images_begin", "Images", "Image data-blocks", RNA_def_main_images},
- {"lattices", "Lattice", "rna_Main_lattices_begin", "Lattices", "Lattice data-blocks", RNA_def_main_lattices},
- {"curves", "Curve", "rna_Main_curves_begin", "Curves", "Curve data-blocks", RNA_def_main_curves},
- {"metaballs", "MetaBall", "rna_Main_metaballs_begin", "Metaballs", "Metaball data-blocks", RNA_def_main_metaballs},
- {"fonts", "VectorFont", "rna_Main_fonts_begin", "Vector Fonts", "Vector font data-blocks", RNA_def_main_fonts},
- {"textures", "Texture", "rna_Main_textures_begin", "Textures", "Texture data-blocks", RNA_def_main_textures},
- {"brushes", "Brush", "rna_Main_brushes_begin", "Brushes", "Brush data-blocks", RNA_def_main_brushes},
- {"worlds", "World", "rna_Main_worlds_begin", "Worlds", "World data-blocks", RNA_def_main_worlds},
- {"collections", "Collection", "rna_Main_collections_begin", "Collections", "Collection data-blocks", RNA_def_main_collections},
- {"shape_keys", "Key", "rna_Main_shapekeys_begin", "Shape Keys", "Shape Key data-blocks", NULL},
- {"texts", "Text", "rna_Main_texts_begin", "Texts", "Text data-blocks", RNA_def_main_texts},
- {"speakers", "Speaker", "rna_Main_speakers_begin", "Speakers", "Speaker data-blocks", RNA_def_main_speakers},
- {"sounds", "Sound", "rna_Main_sounds_begin", "Sounds", "Sound data-blocks", RNA_def_main_sounds},
- {"armatures", "Armature", "rna_Main_armatures_begin", "Armatures", "Armature data-blocks", RNA_def_main_armatures},
- {"actions", "Action", "rna_Main_actions_begin", "Actions", "Action data-blocks", RNA_def_main_actions},
- {"particles", "ParticleSettings", "rna_Main_particles_begin", "Particles", "Particle data-blocks", RNA_def_main_particles},
- {"palettes", "Palette", "rna_Main_palettes_begin", "Palettes", "Palette data-blocks", RNA_def_main_palettes},
- {"grease_pencils", "GreasePencil", "rna_Main_gpencils_begin", "Grease Pencil", "Grease Pencil data-blocks", RNA_def_main_gpencil},
- {"movieclips", "MovieClip", "rna_Main_movieclips_begin", "Movie Clips", "Movie Clip data-blocks", RNA_def_main_movieclips},
- {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks data-blocks", RNA_def_main_masks},
- {"linestyles", "FreestyleLineStyle", "rna_Main_linestyles_begin", "Line Styles", "Line Style data-blocks", RNA_def_main_linestyles},
- {"cache_files", "CacheFile", "rna_Main_cachefiles_begin", "Cache Files", "Cache Files data-blocks", RNA_def_main_cachefiles},
- {"paint_curves", "PaintCurve", "rna_Main_paintcurves_begin", "Paint Curves", "Paint Curves data-blocks", RNA_def_main_paintcurves},
- {"workspaces", "WorkSpace", "rna_Main_workspaces_begin", "Workspaces", "Workspace data-blocks", RNA_def_main_workspaces},
- {"lightprobes", "LightProbe", "rna_Main_lightprobes_begin", "LightProbes", "LightProbe data-blocks", RNA_def_main_lightprobes},
- {NULL, NULL, NULL, NULL, NULL, NULL},
- };
-
- int i;
-
- srna = RNA_def_struct(brna, "BlendData", NULL);
- RNA_def_struct_ui_text(srna, "Blendfile Data",
- "Main data structure representing a .blend file and all its data-blocks");
- RNA_def_struct_ui_icon(srna, ICON_BLENDER);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_maxlength(prop, FILE_MAX);
- RNA_def_property_string_funcs(prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");
-
- prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL);
- RNA_def_property_ui_text(prop, "File Has Unsaved Changes", "Have recent edits been saved to disk");
-
- prop = RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL);
- RNA_def_property_ui_text(prop, "File is Saved", "Has the current session been saved to disk as a .blend file");
-
- prop = RNA_def_property(srna, "use_autopack", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Main_use_autopack_get", "rna_Main_use_autopack_set");
- RNA_def_property_ui_text(prop, "Use Autopack", "Automatically pack all external data into .blend file");
-
- prop = RNA_def_int_vector(srna, "version", 3, NULL, 0, INT_MAX,
- "Version", "Version of Blender the .blend was saved with", 0, INT_MAX);
- RNA_def_property_int_funcs(prop, "rna_Main_version_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_THICK_WRAP);
-
- for (i = 0; lists[i].name; i++) {
- prop = RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, lists[i].type);
- RNA_def_property_collection_funcs(prop, lists[i].iter_begin, "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
-
- /* collection functions */
- func = lists[i].func;
- if (func)
- func(brna, prop);
- }
-
- RNA_api_main(srna);
-
-#ifdef UNIT_TEST
-
- RNA_define_verify_sdna(0);
-
- prop = RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Test");
- RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL, NULL);
-
- RNA_define_verify_sdna(1);
-
-#endif
+ StructRNA *srna;
+ PropertyRNA *prop;
+ CollectionDefFunc *func;
+
+ /* plural must match idtypes in readblenentry.c */
+ MainCollectionDef lists[] = {
+ {"cameras",
+ "Camera",
+ "rna_Main_cameras_begin",
+ "Cameras",
+ "Camera data-blocks",
+ RNA_def_main_cameras},
+ {"scenes",
+ "Scene",
+ "rna_Main_scenes_begin",
+ "Scenes",
+ "Scene data-blocks",
+ RNA_def_main_scenes},
+ {"objects",
+ "Object",
+ "rna_Main_objects_begin",
+ "Objects",
+ "Object data-blocks",
+ RNA_def_main_objects},
+ {"materials",
+ "Material",
+ "rna_Main_materials_begin",
+ "Materials",
+ "Material data-blocks",
+ RNA_def_main_materials},
+ {"node_groups",
+ "NodeTree",
+ "rna_Main_nodetrees_begin",
+ "Node Groups",
+ "Node group data-blocks",
+ RNA_def_main_node_groups},
+ {"meshes",
+ "Mesh",
+ "rna_Main_meshes_begin",
+ "Meshes",
+ "Mesh data-blocks",
+ RNA_def_main_meshes},
+ {"lights",
+ "Light",
+ "rna_Main_lights_begin",
+ "Lights",
+ "Light data-blocks",
+ RNA_def_main_lights},
+ {"libraries",
+ "Library",
+ "rna_Main_libraries_begin",
+ "Libraries",
+ "Library data-blocks",
+ RNA_def_main_libraries},
+ {"screens",
+ "Screen",
+ "rna_Main_screens_begin",
+ "Screens",
+ "Screen data-blocks",
+ RNA_def_main_screens},
+ {"window_managers",
+ "WindowManager",
+ "rna_Main_wm_begin",
+ "Window Managers",
+ "Window manager data-blocks",
+ RNA_def_main_window_managers},
+ {"images",
+ "Image",
+ "rna_Main_images_begin",
+ "Images",
+ "Image data-blocks",
+ RNA_def_main_images},
+ {"lattices",
+ "Lattice",
+ "rna_Main_lattices_begin",
+ "Lattices",
+ "Lattice data-blocks",
+ RNA_def_main_lattices},
+ {"curves",
+ "Curve",
+ "rna_Main_curves_begin",
+ "Curves",
+ "Curve data-blocks",
+ RNA_def_main_curves},
+ {"metaballs",
+ "MetaBall",
+ "rna_Main_metaballs_begin",
+ "Metaballs",
+ "Metaball data-blocks",
+ RNA_def_main_metaballs},
+ {"fonts",
+ "VectorFont",
+ "rna_Main_fonts_begin",
+ "Vector Fonts",
+ "Vector font data-blocks",
+ RNA_def_main_fonts},
+ {"textures",
+ "Texture",
+ "rna_Main_textures_begin",
+ "Textures",
+ "Texture data-blocks",
+ RNA_def_main_textures},
+ {"brushes",
+ "Brush",
+ "rna_Main_brushes_begin",
+ "Brushes",
+ "Brush data-blocks",
+ RNA_def_main_brushes},
+ {"worlds",
+ "World",
+ "rna_Main_worlds_begin",
+ "Worlds",
+ "World data-blocks",
+ RNA_def_main_worlds},
+ {"collections",
+ "Collection",
+ "rna_Main_collections_begin",
+ "Collections",
+ "Collection data-blocks",
+ RNA_def_main_collections},
+ {"shape_keys",
+ "Key",
+ "rna_Main_shapekeys_begin",
+ "Shape Keys",
+ "Shape Key data-blocks",
+ NULL},
+ {"texts", "Text", "rna_Main_texts_begin", "Texts", "Text data-blocks", RNA_def_main_texts},
+ {"speakers",
+ "Speaker",
+ "rna_Main_speakers_begin",
+ "Speakers",
+ "Speaker data-blocks",
+ RNA_def_main_speakers},
+ {"sounds",
+ "Sound",
+ "rna_Main_sounds_begin",
+ "Sounds",
+ "Sound data-blocks",
+ RNA_def_main_sounds},
+ {"armatures",
+ "Armature",
+ "rna_Main_armatures_begin",
+ "Armatures",
+ "Armature data-blocks",
+ RNA_def_main_armatures},
+ {"actions",
+ "Action",
+ "rna_Main_actions_begin",
+ "Actions",
+ "Action data-blocks",
+ RNA_def_main_actions},
+ {"particles",
+ "ParticleSettings",
+ "rna_Main_particles_begin",
+ "Particles",
+ "Particle data-blocks",
+ RNA_def_main_particles},
+ {"palettes",
+ "Palette",
+ "rna_Main_palettes_begin",
+ "Palettes",
+ "Palette data-blocks",
+ RNA_def_main_palettes},
+ {"grease_pencils",
+ "GreasePencil",
+ "rna_Main_gpencils_begin",
+ "Grease Pencil",
+ "Grease Pencil data-blocks",
+ RNA_def_main_gpencil},
+ {"movieclips",
+ "MovieClip",
+ "rna_Main_movieclips_begin",
+ "Movie Clips",
+ "Movie Clip data-blocks",
+ RNA_def_main_movieclips},
+ {"masks", "Mask", "rna_Main_masks_begin", "Masks", "Masks data-blocks", RNA_def_main_masks},
+ {"linestyles",
+ "FreestyleLineStyle",
+ "rna_Main_linestyles_begin",
+ "Line Styles",
+ "Line Style data-blocks",
+ RNA_def_main_linestyles},
+ {"cache_files",
+ "CacheFile",
+ "rna_Main_cachefiles_begin",
+ "Cache Files",
+ "Cache Files data-blocks",
+ RNA_def_main_cachefiles},
+ {"paint_curves",
+ "PaintCurve",
+ "rna_Main_paintcurves_begin",
+ "Paint Curves",
+ "Paint Curves data-blocks",
+ RNA_def_main_paintcurves},
+ {"workspaces",
+ "WorkSpace",
+ "rna_Main_workspaces_begin",
+ "Workspaces",
+ "Workspace data-blocks",
+ RNA_def_main_workspaces},
+ {"lightprobes",
+ "LightProbe",
+ "rna_Main_lightprobes_begin",
+ "LightProbes",
+ "LightProbe data-blocks",
+ RNA_def_main_lightprobes},
+ {NULL, NULL, NULL, NULL, NULL, NULL},
+ };
+
+ int i;
+
+ srna = RNA_def_struct(brna, "BlendData", NULL);
+ RNA_def_struct_ui_text(srna,
+ "Blendfile Data",
+ "Main data structure representing a .blend file and all its data-blocks");
+ RNA_def_struct_ui_icon(srna, ICON_BLENDER);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_maxlength(prop, FILE_MAX);
+ RNA_def_property_string_funcs(
+ prop, "rna_Main_filepath_get", "rna_Main_filepath_length", "rna_Main_filepath_set");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Filename", "Path to the .blend file");
+
+ prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Main_is_dirty_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "File Has Unsaved Changes", "Have recent edits been saved to disk");
+
+ prop = RNA_def_property(srna, "is_saved", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Main_is_saved_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "File is Saved", "Has the current session been saved to disk as a .blend file");
+
+ prop = RNA_def_property(srna, "use_autopack", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Main_use_autopack_get", "rna_Main_use_autopack_set");
+ RNA_def_property_ui_text(
+ prop, "Use Autopack", "Automatically pack all external data into .blend file");
+
+ prop = RNA_def_int_vector(srna,
+ "version",
+ 3,
+ NULL,
+ 0,
+ INT_MAX,
+ "Version",
+ "Version of Blender the .blend was saved with",
+ 0,
+ INT_MAX);
+ RNA_def_property_int_funcs(prop, "rna_Main_version_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_THICK_WRAP);
+
+ for (i = 0; lists[i].name; i++) {
+ prop = RNA_def_property(srna, lists[i].identifier, PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, lists[i].type);
+ RNA_def_property_collection_funcs(prop,
+ lists[i].iter_begin,
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, lists[i].name, lists[i].description);
+
+ /* collection functions */
+ func = lists[i].func;
+ if (func)
+ func(brna, prop);
+ }
+
+ RNA_api_main(srna);
+
+# ifdef UNIT_TEST
+
+ RNA_define_verify_sdna(0);
+
+ prop = RNA_def_property(srna, "test", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Test");
+ RNA_def_property_pointer_funcs(prop, "rna_Test_test_get", NULL, NULL, NULL);
+
+ RNA_define_verify_sdna(1);
+
+# endif
}
#endif
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 34e759325d1..6ac36ef097e 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
@@ -41,575 +40,613 @@
#ifdef RNA_RUNTIME
-#include "BKE_action.h"
-#include "BKE_armature.h"
-#include "BKE_brush.h"
-#include "BKE_camera.h"
-#include "BKE_collection.h"
-#include "BKE_curve.h"
-#include "BKE_displist.h"
-#include "BKE_font.h"
-#include "BKE_gpencil.h"
-#include "BKE_icons.h"
-#include "BKE_idcode.h"
-#include "BKE_image.h"
-#include "BKE_light.h"
-#include "BKE_lattice.h"
-#include "BKE_library_remap.h"
-#include "BKE_lightprobe.h"
-#include "BKE_linestyle.h"
-#include "BKE_mask.h"
-#include "BKE_material.h"
-#include "BKE_mball.h"
-#include "BKE_mesh.h"
-#include "BKE_movieclip.h"
-#include "BKE_node.h"
-#include "BKE_object.h"
-#include "BKE_paint.h"
-#include "BKE_particle.h"
-#include "BKE_scene.h"
-#include "BKE_sound.h"
-#include "BKE_speaker.h"
-#include "BKE_text.h"
-#include "BKE_texture.h"
-#include "BKE_workspace.h"
-#include "BKE_world.h"
-
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
-
-#include "DNA_armature_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_light_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_speaker_types.h"
-#include "DNA_sound_types.h"
-#include "DNA_lightprobe_types.h"
-#include "DNA_text_types.h"
-#include "DNA_texture_types.h"
-#include "DNA_collection_types.h"
-#include "DNA_brush_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_meta_types.h"
-#include "DNA_world_types.h"
-#include "DNA_particle_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_node_types.h"
-#include "DNA_movieclip_types.h"
-#include "DNA_mask_types.h"
-#include "DNA_gpencil_types.h"
-
-#include "ED_screen.h"
-
-#include "BLT_translation.h"
-
-#ifdef WITH_PYTHON
-# include "BPY_extern.h"
-#endif
-
-#include "WM_api.h"
-#include "WM_types.h"
-
+# include "BKE_action.h"
+# include "BKE_armature.h"
+# include "BKE_brush.h"
+# include "BKE_camera.h"
+# include "BKE_collection.h"
+# include "BKE_curve.h"
+# include "BKE_displist.h"
+# include "BKE_font.h"
+# include "BKE_gpencil.h"
+# include "BKE_icons.h"
+# include "BKE_idcode.h"
+# include "BKE_image.h"
+# include "BKE_light.h"
+# include "BKE_lattice.h"
+# include "BKE_library_remap.h"
+# include "BKE_lightprobe.h"
+# include "BKE_linestyle.h"
+# include "BKE_mask.h"
+# include "BKE_material.h"
+# include "BKE_mball.h"
+# include "BKE_mesh.h"
+# include "BKE_movieclip.h"
+# include "BKE_node.h"
+# include "BKE_object.h"
+# include "BKE_paint.h"
+# include "BKE_particle.h"
+# include "BKE_scene.h"
+# include "BKE_sound.h"
+# include "BKE_speaker.h"
+# include "BKE_text.h"
+# include "BKE_texture.h"
+# include "BKE_workspace.h"
+# include "BKE_world.h"
+
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph_query.h"
+
+# include "DNA_armature_types.h"
+# include "DNA_camera_types.h"
+# include "DNA_curve_types.h"
+# include "DNA_light_types.h"
+# include "DNA_material_types.h"
+# include "DNA_mesh_types.h"
+# include "DNA_speaker_types.h"
+# include "DNA_sound_types.h"
+# include "DNA_lightprobe_types.h"
+# include "DNA_text_types.h"
+# include "DNA_texture_types.h"
+# include "DNA_collection_types.h"
+# include "DNA_brush_types.h"
+# include "DNA_lattice_types.h"
+# include "DNA_meta_types.h"
+# include "DNA_world_types.h"
+# include "DNA_particle_types.h"
+# include "DNA_vfont_types.h"
+# include "DNA_node_types.h"
+# include "DNA_movieclip_types.h"
+# include "DNA_mask_types.h"
+# include "DNA_gpencil_types.h"
+
+# include "ED_screen.h"
+
+# include "BLT_translation.h"
+
+# ifdef WITH_PYTHON
+# include "BPY_extern.h"
+# endif
+
+# include "WM_api.h"
+# include "WM_types.h"
static void rna_idname_validate(const char *name, char *r_name)
{
- BLI_strncpy(r_name, name, MAX_ID_NAME - 2);
- BLI_utf8_invalid_strip(r_name, strlen(r_name));
-}
-
-
-static void rna_Main_ID_remove(
- Main *bmain, ReportList *reports, PointerRNA *id_ptr,
- bool do_unlink, bool do_id_user, bool do_ui_user)
-{
- ID *id = id_ptr->data;
- if (do_unlink) {
- BKE_id_delete(bmain, id);
- RNA_POINTER_INVALIDATE(id_ptr);
- /* Force full redraw, mandatory to avoid crashes when running this from UI... */
- WM_main_add_notifier(NC_WINDOW, NULL);
- }
- else if (ID_REAL_USERS(id) <= 0) {
- const int flag = (do_id_user ? 0 : LIB_ID_FREE_NO_USER_REFCOUNT) |
- (do_ui_user ? 0 : LIB_ID_FREE_NO_UI_USER);
- /* Still using ID flags here, this is in-between commit anyway... */
- BKE_id_free_ex(bmain, id, flag, true);
- RNA_POINTER_INVALIDATE(id_ptr);
- }
- else {
- BKE_reportf(reports, RPT_ERROR,
- "%s '%s' must have zero users to be removed, found %d (try with do_unlink=True parameter)",
- BKE_idcode_to_name(GS(id->name)), id->name + 2, ID_REAL_USERS(id));
- }
+ BLI_strncpy(r_name, name, MAX_ID_NAME - 2);
+ BLI_utf8_invalid_strip(r_name, strlen(r_name));
+}
+
+static void rna_Main_ID_remove(Main *bmain,
+ ReportList *reports,
+ PointerRNA *id_ptr,
+ bool do_unlink,
+ bool do_id_user,
+ bool do_ui_user)
+{
+ ID *id = id_ptr->data;
+ if (do_unlink) {
+ BKE_id_delete(bmain, id);
+ RNA_POINTER_INVALIDATE(id_ptr);
+ /* Force full redraw, mandatory to avoid crashes when running this from UI... */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ }
+ else if (ID_REAL_USERS(id) <= 0) {
+ const int flag = (do_id_user ? 0 : LIB_ID_FREE_NO_USER_REFCOUNT) |
+ (do_ui_user ? 0 : LIB_ID_FREE_NO_UI_USER);
+ /* Still using ID flags here, this is in-between commit anyway... */
+ BKE_id_free_ex(bmain, id, flag, true);
+ RNA_POINTER_INVALIDATE(id_ptr);
+ }
+ else {
+ BKE_reportf(
+ reports,
+ RPT_ERROR,
+ "%s '%s' must have zero users to be removed, found %d (try with do_unlink=True parameter)",
+ BKE_idcode_to_name(GS(id->name)),
+ id->name + 2,
+ ID_REAL_USERS(id));
+ }
}
-
static Camera *rna_Main_cameras_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- ID *id = BKE_camera_add(bmain, safe_name);
- id_us_min(id);
- return (Camera *)id;
+ ID *id = BKE_camera_add(bmain, safe_name);
+ id_us_min(id);
+ return (Camera *)id;
}
static Scene *rna_Main_scenes_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- return BKE_scene_add(bmain, safe_name);
+ return BKE_scene_add(bmain, safe_name);
}
-static void rna_Main_scenes_remove(Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink)
+static void rna_Main_scenes_remove(
+ Main *bmain, bContext *C, ReportList *reports, PointerRNA *scene_ptr, bool do_unlink)
{
- /* don't call BKE_id_free(...) directly */
- Scene *scene = scene_ptr->data;
- Scene *scene_new;
+ /* don't call BKE_id_free(...) directly */
+ Scene *scene = scene_ptr->data;
+ Scene *scene_new;
- if ((scene_new = scene->id.prev) ||
- (scene_new = scene->id.next))
- {
- if (do_unlink) {
- wmWindow *win = CTX_wm_window(C);
+ if ((scene_new = scene->id.prev) || (scene_new = scene->id.next)) {
+ if (do_unlink) {
+ wmWindow *win = CTX_wm_window(C);
- if (WM_window_get_active_scene(win) == scene) {
+ if (WM_window_get_active_scene(win) == scene) {
-#ifdef WITH_PYTHON
- BPy_BEGIN_ALLOW_THREADS;
-#endif
-
- WM_window_set_active_scene(bmain, C, win, scene_new);
+# ifdef WITH_PYTHON
+ BPy_BEGIN_ALLOW_THREADS;
+# endif
-#ifdef WITH_PYTHON
- BPy_END_ALLOW_THREADS;
-#endif
+ WM_window_set_active_scene(bmain, C, win, scene_new);
- }
- }
- rna_Main_ID_remove(bmain, reports, scene_ptr, do_unlink, true, true);
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2);
- }
+# ifdef WITH_PYTHON
+ BPy_END_ALLOW_THREADS;
+# endif
+ }
+ }
+ rna_Main_ID_remove(bmain, reports, scene_ptr, do_unlink, true, true);
+ }
+ else {
+ BKE_reportf(
+ reports, RPT_ERROR, "Scene '%s' is the last, cannot be removed", scene->id.name + 2);
+ }
}
static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char *name, ID *data)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
-
- Object *ob;
- int type = OB_EMPTY;
- if (data) {
- /* keep in sync with OB_DATA_SUPPORT_ID() macro */
- switch (GS(data->name)) {
- case ID_ME:
- type = OB_MESH;
- break;
- case ID_CU:
- type = BKE_curve_type_get((Curve *)data);
- break;
- case ID_MB:
- type = OB_MBALL;
- break;
- case ID_LA:
- type = OB_LAMP;
- break;
- case ID_SPK:
- type = OB_SPEAKER;
- break;
- case ID_CA:
- type = OB_CAMERA;
- break;
- case ID_LT:
- type = OB_LATTICE;
- break;
- case ID_GD:
- type = OB_GPENCIL;
- break;
- case ID_AR:
- type = OB_ARMATURE;
- break;
- default:
- {
- const char *idname;
- if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0)
- idname = "UNKNOWN";
-
- BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
- return NULL;
- }
- }
-
- id_us_plus(data);
- }
-
- ob = BKE_object_add_only_object(bmain, type, safe_name);
-
- ob->data = data;
- test_object_materials(bmain, ob, ob->data);
-
- return ob;
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
+
+ Object *ob;
+ int type = OB_EMPTY;
+ if (data) {
+ /* keep in sync with OB_DATA_SUPPORT_ID() macro */
+ switch (GS(data->name)) {
+ case ID_ME:
+ type = OB_MESH;
+ break;
+ case ID_CU:
+ type = BKE_curve_type_get((Curve *)data);
+ break;
+ case ID_MB:
+ type = OB_MBALL;
+ break;
+ case ID_LA:
+ type = OB_LAMP;
+ break;
+ case ID_SPK:
+ type = OB_SPEAKER;
+ break;
+ case ID_CA:
+ type = OB_CAMERA;
+ break;
+ case ID_LT:
+ type = OB_LATTICE;
+ break;
+ case ID_GD:
+ type = OB_GPENCIL;
+ break;
+ case ID_AR:
+ type = OB_ARMATURE;
+ break;
+ default: {
+ const char *idname;
+ if (RNA_enum_id_from_value(rna_enum_id_type_items, GS(data->name), &idname) == 0)
+ idname = "UNKNOWN";
+
+ BKE_reportf(reports, RPT_ERROR, "ID type '%s' is not valid for an object", idname);
+ return NULL;
+ }
+ }
+
+ id_us_plus(data);
+ }
+
+ ob = BKE_object_add_only_object(bmain, type, safe_name);
+
+ ob->data = data;
+ test_object_materials(bmain, ob, ob->data);
+
+ return ob;
}
static Material *rna_Main_materials_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- ID *id = (ID *)BKE_material_add(bmain, safe_name);
- id_us_min(id);
- return (Material *)id;
+ ID *id = (ID *)BKE_material_add(bmain, safe_name);
+ id_us_min(id);
+ return (Material *)id;
}
static void rna_Main_materials_gpencil_data(Main *UNUSED(bmain), PointerRNA *id_ptr)
{
- ID *id = id_ptr->data;
- Material *ma = (Material *)id;
- BKE_material_init_gpencil_settings(ma);
+ ID *id = id_ptr->data;
+ Material *ma = (Material *)id;
+ BKE_material_init_gpencil_settings(ma);
}
-static const EnumPropertyItem *rna_Main_nodetree_type_itemf(bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Main_nodetree_type_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- return rna_node_tree_type_itemf(NULL, NULL, r_free);
+ return rna_node_tree_type_itemf(NULL, NULL, r_free);
}
static struct bNodeTree *rna_Main_nodetree_new(Main *bmain, const char *name, int type)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
- if (typeinfo) {
- bNodeTree *ntree = ntreeAddTree(bmain, safe_name, typeinfo->idname);
+ bNodeTreeType *typeinfo = rna_node_tree_type_from_enum(type);
+ if (typeinfo) {
+ bNodeTree *ntree = ntreeAddTree(bmain, safe_name, typeinfo->idname);
- id_us_min(&ntree->id);
- return ntree;
- }
- else {
- return NULL;
- }
+ id_us_min(&ntree->id);
+ return ntree;
+ }
+ else {
+ return NULL;
+ }
}
static Mesh *rna_Main_meshes_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Mesh *me = BKE_mesh_add(bmain, safe_name);
- id_us_min(&me->id);
- return me;
+ Mesh *me = BKE_mesh_add(bmain, safe_name);
+ id_us_min(&me->id);
+ return me;
}
/* copied from Mesh_getFromObject and adapted to RNA interface */
-Mesh *rna_Main_meshes_new_from_object(
- Main *bmain, ReportList *reports, Depsgraph *depsgraph,
- Object *ob, bool apply_modifiers, bool calc_undeformed)
-{
- Scene *sce = DEG_get_evaluated_scene(depsgraph);
-
- switch (ob->type) {
- case OB_FONT:
- case OB_CURVE:
- case OB_SURF:
- case OB_MBALL:
- case OB_MESH:
- break;
- default:
- BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
- return NULL;
- }
-
- return BKE_mesh_new_from_object(depsgraph, bmain, sce, ob, apply_modifiers, calc_undeformed);
+Mesh *rna_Main_meshes_new_from_object(Main *bmain,
+ ReportList *reports,
+ Depsgraph *depsgraph,
+ Object *ob,
+ bool apply_modifiers,
+ bool calc_undeformed)
+{
+ Scene *sce = DEG_get_evaluated_scene(depsgraph);
+
+ switch (ob->type) {
+ case OB_FONT:
+ case OB_CURVE:
+ case OB_SURF:
+ case OB_MBALL:
+ case OB_MESH:
+ break;
+ default:
+ BKE_report(reports, RPT_ERROR, "Object does not have geometry data");
+ return NULL;
+ }
+
+ return BKE_mesh_new_from_object(depsgraph, bmain, sce, ob, apply_modifiers, calc_undeformed);
}
static Light *rna_Main_lights_new(Main *bmain, const char *name, int type)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Light *lamp = BKE_light_add(bmain, safe_name);
- lamp->type = type;
- id_us_min(&lamp->id);
- return lamp;
+ Light *lamp = BKE_light_add(bmain, safe_name);
+ lamp->type = type;
+ id_us_min(&lamp->id);
+ return lamp;
}
-static Image *rna_Main_images_new(Main *bmain, const char *name, int width, int height, bool alpha, bool float_buffer, bool stereo3d)
+static Image *rna_Main_images_new(Main *bmain,
+ const char *name,
+ int width,
+ int height,
+ bool alpha,
+ bool float_buffer,
+ bool stereo3d)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- float color[4] = {0.0, 0.0, 0.0, 1.0};
- Image *image = BKE_image_add_generated(bmain, width, height, safe_name, alpha ? 32 : 24, float_buffer, 0, color, stereo3d);
- id_us_min(&image->id);
- return image;
+ float color[4] = {0.0, 0.0, 0.0, 1.0};
+ Image *image = BKE_image_add_generated(
+ bmain, width, height, safe_name, alpha ? 32 : 24, float_buffer, 0, color, stereo3d);
+ id_us_min(&image->id);
+ return image;
}
-static Image *rna_Main_images_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing)
+static Image *rna_Main_images_load(Main *bmain,
+ ReportList *reports,
+ const char *filepath,
+ bool check_existing)
{
- Image *ima;
+ Image *ima;
- errno = 0;
- if (check_existing) {
- ima = BKE_image_load_exists(bmain, filepath);
- }
- else {
- ima = BKE_image_load(bmain, filepath);
- }
+ errno = 0;
+ if (check_existing) {
+ ima = BKE_image_load_exists(bmain, filepath);
+ }
+ else {
+ ima = BKE_image_load(bmain, filepath);
+ }
- if (!ima) {
- BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
- errno ? strerror(errno) : TIP_("unsupported image format"));
- }
+ if (!ima) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Cannot read '%s': %s",
+ filepath,
+ errno ? strerror(errno) : TIP_("unsupported image format"));
+ }
- id_us_min((ID *)ima);
- return ima;
+ id_us_min((ID *)ima);
+ return ima;
}
static Lattice *rna_Main_lattices_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Lattice *lt = BKE_lattice_add(bmain, safe_name);
- id_us_min(&lt->id);
- return lt;
+ Lattice *lt = BKE_lattice_add(bmain, safe_name);
+ id_us_min(&lt->id);
+ return lt;
}
static Curve *rna_Main_curves_new(Main *bmain, const char *name, int type)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Curve *cu = BKE_curve_add(bmain, safe_name, type);
- id_us_min(&cu->id);
- return cu;
+ Curve *cu = BKE_curve_add(bmain, safe_name, type);
+ id_us_min(&cu->id);
+ return cu;
}
static MetaBall *rna_Main_metaballs_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- MetaBall *mb = BKE_mball_add(bmain, safe_name);
- id_us_min(&mb->id);
- return mb;
+ MetaBall *mb = BKE_mball_add(bmain, safe_name);
+ id_us_min(&mb->id);
+ return mb;
}
-static VFont *rna_Main_fonts_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing)
+static VFont *rna_Main_fonts_load(Main *bmain,
+ ReportList *reports,
+ const char *filepath,
+ bool check_existing)
{
- VFont *font;
- errno = 0;
+ VFont *font;
+ errno = 0;
- if (check_existing) {
- font = BKE_vfont_load_exists(bmain, filepath);
- }
- else {
- font = BKE_vfont_load(bmain, filepath);
- }
+ if (check_existing) {
+ font = BKE_vfont_load_exists(bmain, filepath);
+ }
+ else {
+ font = BKE_vfont_load(bmain, filepath);
+ }
- if (!font)
- BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
- errno ? strerror(errno) : TIP_("unsupported font format"));
-
- id_us_min((ID *)font);
- return font;
+ if (!font)
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Cannot read '%s': %s",
+ filepath,
+ errno ? strerror(errno) : TIP_("unsupported font format"));
+ id_us_min((ID *)font);
+ return font;
}
static Tex *rna_Main_textures_new(Main *bmain, const char *name, int type)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Tex *tex = BKE_texture_add(bmain, safe_name);
- BKE_texture_type_set(tex, type);
- id_us_min(&tex->id);
- return tex;
+ Tex *tex = BKE_texture_add(bmain, safe_name);
+ BKE_texture_type_set(tex, type);
+ id_us_min(&tex->id);
+ return tex;
}
static Brush *rna_Main_brushes_new(Main *bmain, const char *name, int mode)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Brush *brush = BKE_brush_add(bmain, safe_name, mode);
- id_us_min(&brush->id);
- return brush;
+ Brush *brush = BKE_brush_add(bmain, safe_name, mode);
+ id_us_min(&brush->id);
+ return brush;
}
static void rna_Main_brush_gpencil_data(Main *UNUSED(bmain), PointerRNA *id_ptr)
{
- ID *id = id_ptr->data;
- Brush *brush = (Brush *)id;
- BKE_brush_init_gpencil_settings(brush);
+ ID *id = id_ptr->data;
+ Brush *brush = (Brush *)id;
+ BKE_brush_init_gpencil_settings(brush);
}
-
static World *rna_Main_worlds_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- World *world = BKE_world_add(bmain, safe_name);
- id_us_min(&world->id);
- return world;
+ World *world = BKE_world_add(bmain, safe_name);
+ id_us_min(&world->id);
+ return world;
}
static Collection *rna_Main_collections_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- return BKE_collection_add(bmain, NULL, safe_name);
+ return BKE_collection_add(bmain, NULL, safe_name);
}
static Speaker *rna_Main_speakers_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Speaker *speaker = BKE_speaker_add(bmain, safe_name);
- id_us_min(&speaker->id);
- return speaker;
+ Speaker *speaker = BKE_speaker_add(bmain, safe_name);
+ id_us_min(&speaker->id);
+ return speaker;
}
static bSound *rna_Main_sounds_load(Main *bmain, const char *name, bool check_existing)
{
- bSound *sound;
+ bSound *sound;
- if (check_existing) {
- sound = BKE_sound_new_file_exists(bmain, name);
- }
- else {
- sound = BKE_sound_new_file(bmain, name);
- }
+ if (check_existing) {
+ sound = BKE_sound_new_file_exists(bmain, name);
+ }
+ else {
+ sound = BKE_sound_new_file(bmain, name);
+ }
- id_us_min(&sound->id);
- return sound;
+ id_us_min(&sound->id);
+ return sound;
}
static Text *rna_Main_texts_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- return BKE_text_add(bmain, safe_name);
+ return BKE_text_add(bmain, safe_name);
}
-static Text *rna_Main_texts_load(Main *bmain, ReportList *reports, const char *filepath, bool is_internal)
+static Text *rna_Main_texts_load(Main *bmain,
+ ReportList *reports,
+ const char *filepath,
+ bool is_internal)
{
- Text *txt;
+ Text *txt;
- errno = 0;
- txt = BKE_text_load_ex(bmain, filepath, BKE_main_blendfile_path(bmain), is_internal);
+ errno = 0;
+ txt = BKE_text_load_ex(bmain, filepath, BKE_main_blendfile_path(bmain), is_internal);
- if (!txt)
- BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
- errno ? strerror(errno) : TIP_("unable to load text"));
+ if (!txt)
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Cannot read '%s': %s",
+ filepath,
+ errno ? strerror(errno) : TIP_("unable to load text"));
- return txt;
+ return txt;
}
static bArmature *rna_Main_armatures_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- bArmature *arm = BKE_armature_add(bmain, safe_name);
- id_us_min(&arm->id);
- return arm;
+ bArmature *arm = BKE_armature_add(bmain, safe_name);
+ id_us_min(&arm->id);
+ return arm;
}
static bAction *rna_Main_actions_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- bAction *act = BKE_action_add(bmain, safe_name);
- id_fake_user_clear(&act->id);
- return act;
+ bAction *act = BKE_action_add(bmain, safe_name);
+ id_fake_user_clear(&act->id);
+ return act;
}
static ParticleSettings *rna_Main_particles_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- ParticleSettings *part = BKE_particlesettings_add(bmain, safe_name);
- id_us_min(&part->id);
- return part;
+ ParticleSettings *part = BKE_particlesettings_add(bmain, safe_name);
+ id_us_min(&part->id);
+ return part;
}
static Palette *rna_Main_palettes_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- Palette *palette = BKE_palette_add(bmain, safe_name);
- id_us_min(&palette->id);
- return (Palette *)palette;
+ Palette *palette = BKE_palette_add(bmain, safe_name);
+ id_us_min(&palette->id);
+ return (Palette *)palette;
}
-static MovieClip *rna_Main_movieclip_load(Main *bmain, ReportList *reports, const char *filepath, bool check_existing)
+static MovieClip *rna_Main_movieclip_load(Main *bmain,
+ ReportList *reports,
+ const char *filepath,
+ bool check_existing)
{
- MovieClip *clip;
+ MovieClip *clip;
- errno = 0;
+ errno = 0;
- if (check_existing) {
- clip = BKE_movieclip_file_add_exists(bmain, filepath);
- }
- else {
- clip = BKE_movieclip_file_add(bmain, filepath);
- }
+ if (check_existing) {
+ clip = BKE_movieclip_file_add_exists(bmain, filepath);
+ }
+ else {
+ clip = BKE_movieclip_file_add(bmain, filepath);
+ }
- if (clip != NULL) {
- DEG_relations_tag_update(bmain);
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Cannot read '%s': %s", filepath,
- errno ? strerror(errno) : TIP_("unable to load movie clip"));
- }
+ if (clip != NULL) {
+ DEG_relations_tag_update(bmain);
+ }
+ else {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Cannot read '%s': %s",
+ filepath,
+ errno ? strerror(errno) : TIP_("unable to load movie clip"));
+ }
- id_us_min((ID *)clip);
- return clip;
+ id_us_min((ID *)clip);
+ return clip;
}
static Mask *rna_Main_mask_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- return BKE_mask_new(bmain, safe_name);
+ return BKE_mask_new(bmain, safe_name);
}
static FreestyleLineStyle *rna_Main_linestyles_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- FreestyleLineStyle *linestyle = BKE_linestyle_new(bmain, safe_name);
- id_us_min(&linestyle->id);
- return linestyle;
+ FreestyleLineStyle *linestyle = BKE_linestyle_new(bmain, safe_name);
+ id_us_min(&linestyle->id);
+ return linestyle;
}
static LightProbe *rna_Main_lightprobe_new(Main *bmain, const char *name)
{
- char safe_name[MAX_ID_NAME - 2];
- rna_idname_validate(name, safe_name);
+ char safe_name[MAX_ID_NAME - 2];
+ rna_idname_validate(name, safe_name);
- LightProbe *probe = BKE_lightprobe_add(bmain, safe_name);
- id_us_min(&probe->id);
- return probe;
+ LightProbe *probe = BKE_lightprobe_add(bmain, safe_name);
+ id_us_min(&probe->id);
+ return probe;
}
/* tag functions, all the same */
-#define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \
- static void rna_Main_##_func_name##_tag(Main *bmain, bool value) { \
- BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \
- } \
+# define RNA_MAIN_ID_TAG_FUNCS_DEF(_func_name, _listbase_name, _id_type) \
+ static void rna_Main_##_func_name##_tag(Main *bmain, bool value) \
+ { \
+ BKE_main_id_tag_listbase(&bmain->_listbase_name, LIB_TAG_DOIT, value); \
+ }
RNA_MAIN_ID_TAG_FUNCS_DEF(cameras, cameras, ID_CA)
RNA_MAIN_ID_TAG_FUNCS_DEF(scenes, scenes, ID_SCE)
@@ -647,1213 +684,1375 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(paintcurves, paintcurves, ID_PC)
RNA_MAIN_ID_TAG_FUNCS_DEF(workspaces, workspaces, ID_WS)
RNA_MAIN_ID_TAG_FUNCS_DEF(lightprobes, lightprobes, ID_LP)
-#undef RNA_MAIN_ID_TAG_FUNCS_DEF
+# undef RNA_MAIN_ID_TAG_FUNCS_DEF
#else
void RNA_api_main(StructRNA *UNUSED(srna))
{
-#if 0
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* maybe we want to add functions in 'bpy.data' still?
- * for now they are all in collections bpy.data.images.new(...) */
- func = RNA_def_function(srna, "add_image", "rna_Main_add_image");
- RNA_def_function_ui_description(func, "Add a new image");
- parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to load image from");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "image", "Image", "", "New image");
- RNA_def_function_return(func, parm);
-#endif
+# if 0
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* maybe we want to add functions in 'bpy.data' still?
+ * for now they are all in collections bpy.data.images.new(...) */
+ func = RNA_def_function(srna, "add_image", "rna_Main_add_image");
+ RNA_def_function_ui_description(func, "Add a new image");
+ parm = RNA_def_string_file_path(func, "filepath", NULL, 0, "", "File path to load image from");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "image", "Image", "", "New image");
+ RNA_def_function_return(func, parm);
+# endif
}
void RNA_def_main_cameras(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataCameras");
- srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
-
- func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
- RNA_def_function_ui_description(func, "Add a new camera to the main database");
- parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
- parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this camera before deleting it "
- "(WARNING: will also delete objects instancing that camera data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this camera");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this camera");
-
- func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataCameras");
+ srna = RNA_def_struct(brna, "BlendDataCameras", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Cameras", "Collection of cameras");
+
+ func = RNA_def_function(srna, "new", "rna_Main_cameras_new");
+ RNA_def_function_ui_description(func, "Add a new camera to the main database");
+ parm = RNA_def_string(func, "name", "Camera", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "camera", "Camera", "", "New camera data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a camera from the current blendfile");
+ parm = RNA_def_pointer(func, "camera", "Camera", "", "Camera to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this camera before deleting it "
+ "(WARNING: will also delete objects instancing that camera data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this camera");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this camera");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_cameras_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_scenes(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataScenes");
- srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
-
- func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
- RNA_def_function_ui_description(func, "Add a new scene to the main database");
- parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this scene before deleting it");
-
- func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataScenes");
+ srna = RNA_def_struct(brna, "BlendDataScenes", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Scenes", "Collection of scenes");
+
+ func = RNA_def_function(srna, "new", "rna_Main_scenes_new");
+ RNA_def_function_ui_description(func, "Add a new scene to the main database");
+ parm = RNA_def_string(func, "name", "Scene", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "New scene data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_scenes_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a scene from the current blendfile");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this scene before deleting it");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_scenes_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_objects(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataObjects");
- srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
-
- func = RNA_def_function(srna, "new", "rna_Main_objects_new");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new object to the main database");
- parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* return type */
- parm = RNA_def_pointer(func, "object", "Object", "", "New object data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this object before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this object");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this object");
-
- func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataObjects");
+ srna = RNA_def_struct(brna, "BlendDataObjects", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Objects", "Collection of objects");
+
+ func = RNA_def_function(srna, "new", "rna_Main_objects_new");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new object to the main database");
+ parm = RNA_def_string(func, "name", "Object", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "object_data", "ID", "", "Object data or None for an empty object");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* return type */
+ parm = RNA_def_pointer(func, "object", "Object", "", "New object data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_ui_description(func, "Remove a object from the current blendfile");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this object before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this object");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this object");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_objects_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_materials(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataMaterials");
- srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
-
- func = RNA_def_function(srna, "new", "rna_Main_materials_new");
- RNA_def_function_ui_description(func, "Add a new material to the main database");
- parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "material", "Material", "", "New material data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "create_gpencil_data", "rna_Main_materials_gpencil_data");
- RNA_def_function_ui_description(func, "Add grease pencil material settings");
- parm = RNA_def_pointer(func, "material", "Material", "", "Material");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
- parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this material before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this material");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this material");
-
- func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataMaterials");
+ srna = RNA_def_struct(brna, "BlendDataMaterials", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Materials", "Collection of materials");
+
+ func = RNA_def_function(srna, "new", "rna_Main_materials_new");
+ RNA_def_function_ui_description(func, "Add a new material to the main database");
+ parm = RNA_def_string(func, "name", "Material", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "material", "Material", "", "New material data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "create_gpencil_data", "rna_Main_materials_gpencil_data");
+ RNA_def_function_ui_description(func, "Add grease pencil material settings");
+ parm = RNA_def_pointer(func, "material", "Material", "", "Material");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a material from the current blendfile");
+ parm = RNA_def_pointer(func, "material", "Material", "", "Material to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this material before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this material");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this material");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_materials_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_node_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem dummy_items[] = {
- {0, "DUMMY", 0, "", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_property_srna(cprop, "BlendDataNodeTrees");
- srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
-
- func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
- RNA_def_function_ui_description(func, "Add a new node tree to the main database");
- parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", dummy_items, 0, "Type", "The type of node_group to add");
- RNA_def_property_enum_funcs(parm, NULL, NULL, "rna_Main_nodetree_type_itemf");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
- parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this node tree before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this node tree");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this node tree");
-
- func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem dummy_items[] = {
+ {0, "DUMMY", 0, "", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_property_srna(cprop, "BlendDataNodeTrees");
+ srna = RNA_def_struct(brna, "BlendDataNodeTrees", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Node Trees", "Collection of node trees");
+
+ func = RNA_def_function(srna, "new", "rna_Main_nodetree_new");
+ RNA_def_function_ui_description(func, "Add a new node tree to the main database");
+ parm = RNA_def_string(func, "name", "NodeGroup", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", dummy_items, 0, "Type", "The type of node_group to add");
+ RNA_def_property_enum_funcs(parm, NULL, NULL, "rna_Main_nodetree_type_itemf");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "tree", "NodeTree", "", "New node tree data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a node tree from the current blendfile");
+ parm = RNA_def_pointer(func, "tree", "NodeTree", "", "Node tree to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this node tree before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this node tree");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this node tree");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_node_groups_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_meshes(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataMeshes");
- srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
-
- func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
- RNA_def_function_ui_description(func, "Add a new mesh to the main database");
- parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object");
- RNA_def_function_ui_description(func, "Add a new mesh created from object with modifiers applied");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph within which to evaluate modifiers");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates");
- parm = RNA_def_pointer(func, "mesh", "Mesh", "",
- "Mesh created from object, remove it if it is only used for export");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
- parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this mesh before deleting it "
- "(WARNING: will also delete objects instancing that mesh data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this mesh data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this mesh data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataMeshes");
+ srna = RNA_def_struct(brna, "BlendDataMeshes", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Meshes", "Collection of meshes");
+
+ func = RNA_def_function(srna, "new", "rna_Main_meshes_new");
+ RNA_def_function_ui_description(func, "Add a new mesh to the main database");
+ parm = RNA_def_string(func, "name", "Mesh", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "mesh", "Mesh", "", "New mesh data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_from_object", "rna_Main_meshes_new_from_object");
+ RNA_def_function_ui_description(func,
+ "Add a new mesh created from object with modifiers applied");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func,
+ "depsgraph",
+ "Depsgraph",
+ "Dependency Graph",
+ "Evaluated dependency graph within which to evaluate modifiers");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object to create mesh from");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "calc_undeformed",
+ false,
+ "Calculate Undeformed",
+ "Calculate undeformed vertex coordinates");
+ parm = RNA_def_pointer(func,
+ "mesh",
+ "Mesh",
+ "",
+ "Mesh created from object, remove it if it is only used for export");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a mesh from the current blendfile");
+ parm = RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this mesh before deleting it "
+ "(WARNING: will also delete objects instancing that mesh data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this mesh data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this mesh data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_meshes_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_lights(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataLights");
- srna = RNA_def_struct(brna, "BlendDataLights", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Lights", "Collection of lights");
-
- func = RNA_def_function(srna, "new", "rna_Main_lights_new");
- RNA_def_function_ui_description(func, "Add a new light to the main database");
- parm = RNA_def_string(func, "name", "Light", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_light_type_items, 0, "Type", "The type of texture to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "light", "Light", "", "New light data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a light from the current blendfile");
- parm = RNA_def_pointer(func, "light", "Light", "", "Light to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this Light before deleting it "
- "(WARNING: will also delete objects instancing that light data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this light data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this light data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_lights_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataLights");
+ srna = RNA_def_struct(brna, "BlendDataLights", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Lights", "Collection of lights");
+
+ func = RNA_def_function(srna, "new", "rna_Main_lights_new");
+ RNA_def_function_ui_description(func, "Add a new light to the main database");
+ parm = RNA_def_string(func, "name", "Light", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(
+ func, "type", rna_enum_light_type_items, 0, "Type", "The type of texture to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "light", "Light", "", "New light data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a light from the current blendfile");
+ parm = RNA_def_pointer(func, "light", "Light", "", "Light to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this Light before deleting it "
+ "(WARNING: will also delete objects instancing that light data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this light data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this light data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_lights_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_libraries(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "BlendDataLibraries");
- srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
+ RNA_def_property_srna(cprop, "BlendDataLibraries");
+ srna = RNA_def_struct(brna, "BlendDataLibraries", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Libraries", "Collection of libraries");
- func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "tag", "rna_Main_libraries_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_screens(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "BlendDataScreens");
- srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
+ RNA_def_property_srna(cprop, "BlendDataScreens");
+ srna = RNA_def_struct(brna, "BlendDataScreens", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Screens", "Collection of screens");
- func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "tag", "rna_Main_screens_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_window_managers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "BlendDataWindowManagers");
- srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
+ RNA_def_property_srna(cprop, "BlendDataWindowManagers");
+ srna = RNA_def_struct(brna, "BlendDataWindowManagers", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Window Managers", "Collection of window managers");
- func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "tag", "rna_Main_window_managers_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_images(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataImages");
- srna = RNA_def_struct(brna, "BlendDataImages", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
-
- func = RNA_def_function(srna, "new", "rna_Main_images_new");
- RNA_def_function_ui_description(func, "Add a new image to the main database");
- parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 1, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 1, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
- RNA_def_boolean(func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
- RNA_def_boolean(func, "stereo3d", 0, "Stereo 3D", "Create left and right views");
- /* return type */
- parm = RNA_def_pointer(func, "image", "Image", "", "New image data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "load", "rna_Main_images_load");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Load a new image into the main database");
- parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the file to load");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded");
- /* return type */
- parm = RNA_def_pointer(func, "image", "Image", "", "New image data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
- parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this image before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this image");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this image");
-
- func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataImages");
+ srna = RNA_def_struct(brna, "BlendDataImages", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Images", "Collection of images");
+
+ func = RNA_def_function(srna, "new", "rna_Main_images_new");
+ RNA_def_function_ui_description(func, "Add a new image to the main database");
+ parm = RNA_def_string(func, "name", "Image", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "width", 1024, 1, INT_MAX, "", "Width of the image", 1, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "height", 1024, 1, INT_MAX, "", "Height of the image", 1, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "alpha", 0, "Alpha", "Use alpha channel");
+ RNA_def_boolean(
+ func, "float_buffer", 0, "Float Buffer", "Create an image with floating point color");
+ RNA_def_boolean(func, "stereo3d", 0, "Stereo 3D", "Create left and right views");
+ /* return type */
+ parm = RNA_def_pointer(func, "image", "Image", "", "New image data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "load", "rna_Main_images_load");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Load a new image into the main database");
+ parm = RNA_def_string_file_path(
+ func, "filepath", "File Path", 0, "", "path of the file to load");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "check_existing",
+ false,
+ "",
+ "Using existing data-block if this file is already loaded");
+ /* return type */
+ parm = RNA_def_pointer(func, "image", "Image", "", "New image data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an image from the current blendfile");
+ parm = RNA_def_pointer(func, "image", "Image", "", "Image to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this image before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this image");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this image");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_images_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_lattices(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataLattices");
- srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
-
- func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
- RNA_def_function_ui_description(func, "Add a new lattice to the main database");
- parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
- parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this lattice before deleting it "
- "(WARNING: will also delete objects instancing that lattice data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this lattice data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this lattice data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataLattices");
+ srna = RNA_def_struct(brna, "BlendDataLattices", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Lattices", "Collection of lattices");
+
+ func = RNA_def_function(srna, "new", "rna_Main_lattices_new");
+ RNA_def_function_ui_description(func, "Add a new lattice to the main database");
+ parm = RNA_def_string(func, "name", "Lattice", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "lattice", "Lattice", "", "New lattices data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a lattice from the current blendfile");
+ parm = RNA_def_pointer(func, "lattice", "Lattice", "", "Lattice to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this lattice before deleting it "
+ "(WARNING: will also delete objects instancing that lattice data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this lattice data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this lattice data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_lattices_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_curves(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataCurves");
- srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
-
- func = RNA_def_function(srna, "new", "rna_Main_curves_new");
- RNA_def_function_ui_description(func, "Add a new curve to the main database");
- parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_object_type_curve_items, 0, "Type", "The type of curve to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
- parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this curve before deleting it "
- "(WARNING: will also delete objects instancing that curve data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this curve data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this curve data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataCurves");
+ srna = RNA_def_struct(brna, "BlendDataCurves", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Curves", "Collection of curves");
+
+ func = RNA_def_function(srna, "new", "rna_Main_curves_new");
+ RNA_def_function_ui_description(func, "Add a new curve to the main database");
+ parm = RNA_def_string(func, "name", "Curve", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(
+ func, "type", rna_enum_object_type_curve_items, 0, "Type", "The type of curve to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "curve", "Curve", "", "New curve data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a curve from the current blendfile");
+ parm = RNA_def_pointer(func, "curve", "Curve", "", "Curve to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this curve before deleting it "
+ "(WARNING: will also delete objects instancing that curve data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this curve data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this curve data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_curves_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_metaballs(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataMetaBalls");
- srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
-
- func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
- RNA_def_function_ui_description(func, "Add a new metaball to the main database");
- parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
- parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this metaball before deleting it "
- "(WARNING: will also delete objects instancing that metaball data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this metaball data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this metaball data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataMetaBalls");
+ srna = RNA_def_struct(brna, "BlendDataMetaBalls", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Metaballs", "Collection of metaballs");
+
+ func = RNA_def_function(srna, "new", "rna_Main_metaballs_new");
+ RNA_def_function_ui_description(func, "Add a new metaball to the main database");
+ parm = RNA_def_string(func, "name", "MetaBall", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "New metaball data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a metaball from the current blendfile");
+ parm = RNA_def_pointer(func, "metaball", "MetaBall", "", "Metaball to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this metaball before deleting it "
+ "(WARNING: will also delete objects instancing that metaball data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this metaball data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this metaball data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_metaballs_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataFonts");
- srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
-
- func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Load a new font into the main database");
- parm = RNA_def_string_file_path(func, "filepath", "File Path", 0, "", "path of the font to load");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded");
- /* return type */
- parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
- parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this font before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this font");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this font");
-
- func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataFonts");
+ srna = RNA_def_struct(brna, "BlendDataFonts", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Fonts", "Collection of fonts");
+
+ func = RNA_def_function(srna, "load", "rna_Main_fonts_load");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Load a new font into the main database");
+ parm = RNA_def_string_file_path(
+ func, "filepath", "File Path", 0, "", "path of the font to load");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "check_existing",
+ false,
+ "",
+ "Using existing data-block if this file is already loaded");
+ /* return type */
+ parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "New font data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a font from the current blendfile");
+ parm = RNA_def_pointer(func, "vfont", "VectorFont", "", "Font to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this font before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this font");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this font");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_fonts_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataTextures");
- srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Textures", "Collection of textures");
-
- func = RNA_def_function(srna, "new", "rna_Main_textures_new");
- RNA_def_function_ui_description(func, "Add a new texture to the main database");
- parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_texture_type_items, 0, "Type", "The type of texture to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
- parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this texture before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this texture");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this texture");
-
- func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataTextures");
+ srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Textures", "Collection of textures");
+
+ func = RNA_def_function(srna, "new", "rna_Main_textures_new");
+ RNA_def_function_ui_description(func, "Add a new texture to the main database");
+ parm = RNA_def_string(func, "name", "Texture", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(
+ func, "type", rna_enum_texture_type_items, 0, "Type", "The type of texture to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "texture", "Texture", "", "New texture data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a texture from the current blendfile");
+ parm = RNA_def_pointer(func, "texture", "Texture", "", "Texture to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this texture before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this texture");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this texture");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_textures_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataBrushes");
- srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
-
- func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
- RNA_def_function_ui_description(func, "Add a new brush to the main database");
- parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "mode", rna_enum_object_mode_items, OB_MODE_TEXTURE_PAINT, "", "Paint Mode for the new brush");
- /* return type */
- parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
- parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this brush before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this brush");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this brush");
-
- func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "create_gpencil_data", "rna_Main_brush_gpencil_data");
- RNA_def_function_ui_description(func, "Add grease pencil brush settings");
- parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataBrushes");
+ srna = RNA_def_struct(brna, "BlendDataBrushes", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Brushes", "Collection of brushes");
+
+ func = RNA_def_function(srna, "new", "rna_Main_brushes_new");
+ RNA_def_function_ui_description(func, "Add a new brush to the main database");
+ parm = RNA_def_string(func, "name", "Brush", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "mode",
+ rna_enum_object_mode_items,
+ OB_MODE_TEXTURE_PAINT,
+ "",
+ "Paint Mode for the new brush");
+ /* return type */
+ parm = RNA_def_pointer(func, "brush", "Brush", "", "New brush data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a brush from the current blendfile");
+ parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this brush before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this brush");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this brush");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_brushes_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "create_gpencil_data", "rna_Main_brush_gpencil_data");
+ RNA_def_function_ui_description(func, "Add grease pencil brush settings");
+ parm = RNA_def_pointer(func, "brush", "Brush", "", "Brush");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
}
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataWorlds");
- srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
-
- func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
- RNA_def_function_ui_description(func, "Add a new world to the main database");
- parm = RNA_def_string(func, "name", "World", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "world", "World", "", "New world data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
- parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this world before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this world");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this world");
-
- func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataWorlds");
+ srna = RNA_def_struct(brna, "BlendDataWorlds", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Worlds", "Collection of worlds");
+
+ func = RNA_def_function(srna, "new", "rna_Main_worlds_new");
+ RNA_def_function_ui_description(func, "Add a new world to the main database");
+ parm = RNA_def_string(func, "name", "World", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "world", "World", "", "New world data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a world from the current blendfile");
+ parm = RNA_def_pointer(func, "world", "World", "", "World to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this world before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this world");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this world");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_worlds_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_collections(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataCollections");
- srna = RNA_def_struct(brna, "BlendDataCollections", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Collections", "Collection of collections");
-
- func = RNA_def_function(srna, "new", "rna_Main_collections_new");
- RNA_def_function_ui_description(func, "Add a new collection to the main database");
- parm = RNA_def_string(func, "name", "Collection", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "collection", "Collection", "", "New collection data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_ui_description(func, "Remove a collection from the current blendfile");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "collection", "Collection", "", "Collection to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this collection before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this collection");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this collection");
-
- func = RNA_def_function(srna, "tag", "rna_Main_collections_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataCollections");
+ srna = RNA_def_struct(brna, "BlendDataCollections", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Collections", "Collection of collections");
+
+ func = RNA_def_function(srna, "new", "rna_Main_collections_new");
+ RNA_def_function_ui_description(func, "Add a new collection to the main database");
+ parm = RNA_def_string(func, "name", "Collection", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "collection", "Collection", "", "New collection data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_ui_description(func, "Remove a collection from the current blendfile");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "collection", "Collection", "", "Collection to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this collection before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this collection");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this collection");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_collections_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataSpeakers");
- srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
-
- func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
- RNA_def_function_ui_description(func, "Add a new speaker to the main database");
- parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
- parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this speaker before deleting it "
- "(WARNING: will also delete objects instancing that speaker data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this speaker data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this speaker data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataSpeakers");
+ srna = RNA_def_struct(brna, "BlendDataSpeakers", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Speakers", "Collection of speakers");
+
+ func = RNA_def_function(srna, "new", "rna_Main_speakers_new");
+ RNA_def_function_ui_description(func, "Add a new speaker to the main database");
+ parm = RNA_def_string(func, "name", "Speaker", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "speaker", "Speaker", "", "New speaker data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a speaker from the current blendfile");
+ parm = RNA_def_pointer(func, "speaker", "Speaker", "", "Speaker to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this speaker before deleting it "
+ "(WARNING: will also delete objects instancing that speaker data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this speaker data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this speaker data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_speakers_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataTexts");
- srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
-
- func = RNA_def_function(srna, "new", "rna_Main_texts_new");
- RNA_def_function_ui_description(func, "Add a new text to the main database");
- parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "text", "Text", "", "New text data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this text before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this text");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this text");
-
- /* load func */
- func = RNA_def_function(srna, "load", "rna_Main_texts_load");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
- parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "internal", 0, "Make internal", "Make text file internal after loading");
- /* return type */
- parm = RNA_def_pointer(func, "text", "Text", "", "New text data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataTexts");
+ srna = RNA_def_struct(brna, "BlendDataTexts", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Texts", "Collection of texts");
+
+ func = RNA_def_function(srna, "new", "rna_Main_texts_new");
+ RNA_def_function_ui_description(func, "Add a new text to the main database");
+ parm = RNA_def_string(func, "name", "Text", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "text", "Text", "", "New text data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_ui_description(func, "Remove a text from the current blendfile");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "text", "Text", "", "Text to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this text before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this text");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this text");
+
+ /* load func */
+ func = RNA_def_function(srna, "load", "rna_Main_texts_load");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new text to the main database from a file");
+ parm = RNA_def_string_file_path(
+ func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(
+ func, "internal", 0, "Make internal", "Make text file internal after loading");
+ /* return type */
+ parm = RNA_def_pointer(func, "text", "Text", "", "New text data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "tag", "rna_Main_texts_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataSounds");
- srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
-
- /* load func */
- func = RNA_def_function(srna, "load", "rna_Main_sounds_load");
- RNA_def_function_ui_description(func, "Add a new sound to the main database from a file");
- parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded");
- /* return type */
- parm = RNA_def_pointer(func, "sound", "Sound", "", "New text data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a sound from the current blendfile");
- parm = RNA_def_pointer(func, "sound", "Sound", "", "Sound to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this sound before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this sound");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this sound");
-
- func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataSounds");
+ srna = RNA_def_struct(brna, "BlendDataSounds", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Sounds", "Collection of sounds");
+
+ /* load func */
+ func = RNA_def_function(srna, "load", "rna_Main_sounds_load");
+ RNA_def_function_ui_description(func, "Add a new sound to the main database from a file");
+ parm = RNA_def_string_file_path(
+ func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "check_existing",
+ false,
+ "",
+ "Using existing data-block if this file is already loaded");
+ /* return type */
+ parm = RNA_def_pointer(func, "sound", "Sound", "", "New text data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a sound from the current blendfile");
+ parm = RNA_def_pointer(func, "sound", "Sound", "", "Sound to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this sound before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this sound");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this sound");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_sounds_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_armatures(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataArmatures");
- srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
-
- func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
- RNA_def_function_ui_description(func, "Add a new armature to the main database");
- parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
- parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this armature before deleting it "
- "(WARNING: will also delete objects instancing that armature data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this armature data");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this armature data");
-
- func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataArmatures");
+ srna = RNA_def_struct(brna, "BlendDataArmatures", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Armatures", "Collection of armatures");
+
+ func = RNA_def_function(srna, "new", "rna_Main_armatures_new");
+ RNA_def_function_ui_description(func, "Add a new armature to the main database");
+ parm = RNA_def_string(func, "name", "Armature", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "armature", "Armature", "", "New armature data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a armature from the current blendfile");
+ parm = RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this armature before deleting it "
+ "(WARNING: will also delete objects instancing that armature data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this armature data");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this armature data");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_armatures_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_actions(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataActions");
- srna = RNA_def_struct(brna, "BlendDataActions", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
-
- func = RNA_def_function(srna, "new", "rna_Main_actions_new");
- RNA_def_function_ui_description(func, "Add a new action to the main database");
- parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "action", "Action", "", "New action data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
- parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this action before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this action");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this action");
-
- func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataActions");
+ srna = RNA_def_struct(brna, "BlendDataActions", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Actions", "Collection of actions");
+
+ func = RNA_def_function(srna, "new", "rna_Main_actions_new");
+ RNA_def_function_ui_description(func, "Add a new action to the main database");
+ parm = RNA_def_string(func, "name", "Action", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "action", "Action", "", "New action data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a action from the current blendfile");
+ parm = RNA_def_pointer(func, "action", "Action", "", "Action to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this action before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this action");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this action");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_actions_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_particles(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataParticles");
- srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
-
- func = RNA_def_function(srna, "new", "rna_Main_particles_new");
- RNA_def_function_ui_description(func, "Add a new particle settings instance to the main database");
- parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "New particle settings data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a particle settings instance from the current blendfile");
- parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of those particle settings before deleting them");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this particle settings");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this particle settings");
-
- func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataParticles");
+ srna = RNA_def_struct(brna, "BlendDataParticles", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Particle Settings", "Collection of particle settings");
+
+ func = RNA_def_function(srna, "new", "rna_Main_particles_new");
+ RNA_def_function_ui_description(func,
+ "Add a new particle settings instance to the main database");
+ parm = RNA_def_string(func, "name", "ParticleSettings", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(
+ func, "particle", "ParticleSettings", "", "New particle settings data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(
+ func, "Remove a particle settings instance from the current blendfile");
+ parm = RNA_def_pointer(func, "particle", "ParticleSettings", "", "Particle Settings to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of those particle settings before deleting them");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this particle settings");
+ RNA_def_boolean(func,
+ "do_ui_user",
+ true,
+ "",
+ "Make sure interface does not reference this particle settings");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_particles_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_palettes(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataPalettes");
- srna = RNA_def_struct(brna, "BlendDataPalettes", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Palettes", "Collection of palettes");
-
- func = RNA_def_function(srna, "new", "rna_Main_palettes_new");
- RNA_def_function_ui_description(func, "Add a new palette to the main database");
- parm = RNA_def_string(func, "name", "Palette", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "palette", "Palette", "", "New palette data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a palette from the current blendfile");
- parm = RNA_def_pointer(func, "palette", "Palette", "", "Palette to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this palette before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this palette");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this palette");
-
- func = RNA_def_function(srna, "tag", "rna_Main_palettes_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataPalettes");
+ srna = RNA_def_struct(brna, "BlendDataPalettes", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Palettes", "Collection of palettes");
+
+ func = RNA_def_function(srna, "new", "rna_Main_palettes_new");
+ RNA_def_function_ui_description(func, "Add a new palette to the main database");
+ parm = RNA_def_string(func, "name", "Palette", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "palette", "Palette", "", "New palette data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a palette from the current blendfile");
+ parm = RNA_def_pointer(func, "palette", "Palette", "", "Palette to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this palette before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this palette");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this palette");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_palettes_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_cachefiles(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "BlendDataCacheFiles");
- srna = RNA_def_struct(brna, "BlendDataCacheFiles", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Cache Files", "Collection of cache files");
+ RNA_def_property_srna(cprop, "BlendDataCacheFiles");
+ srna = RNA_def_struct(brna, "BlendDataCacheFiles", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Cache Files", "Collection of cache files");
- func = RNA_def_function(srna, "tag", "rna_Main_cachefiles_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "tag", "rna_Main_cachefiles_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_paintcurves(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "BlendDataPaintCurves");
- srna = RNA_def_struct(brna, "BlendDataPaintCurves", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Paint Curves", "Collection of paint curves");
+ RNA_def_property_srna(cprop, "BlendDataPaintCurves");
+ srna = RNA_def_struct(brna, "BlendDataPaintCurves", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Paint Curves", "Collection of paint curves");
- func = RNA_def_function(srna, "tag", "rna_Main_paintcurves_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "tag", "rna_Main_paintcurves_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_gpencil(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataGreasePencils");
- srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
-
- func = RNA_def_function(srna, "tag", "rna_Main_gpencils_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "new", "BKE_gpencil_data_addnew");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_MAIN);
- parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "New grease pencil data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a grease pencil instance from the current blendfile");
- parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this grease pencil before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this grease pencil");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this grease pencil");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataGreasePencils");
+ srna = RNA_def_struct(brna, "BlendDataGreasePencils", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Grease Pencils", "Collection of grease pencils");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_gpencils_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "new", "BKE_gpencil_data_addnew");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_MAIN);
+ parm = RNA_def_string(func, "name", "GreasePencil", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(
+ func, "grease_pencil", "GreasePencil", "", "New grease pencil data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func,
+ "Remove a grease pencil instance from the current blendfile");
+ parm = RNA_def_pointer(func, "grease_pencil", "GreasePencil", "", "Grease Pencil to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this grease pencil before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this grease pencil");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this grease pencil");
}
void RNA_def_main_movieclips(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataMovieClips");
- srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
-
- func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
- parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this movie clip before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this movie clip");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this movie clip");
-
- /* load func */
- func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(
- func, "Add a new movie clip to the main database from a file "
- "(while ``check_existing`` is disabled for consistency with other load functions, "
- "behavior with multiple movie-clips using the same file may incorrectly generate proxies)");
- parm = RNA_def_string_file_path(func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "check_existing", false, "", "Using existing data-block if this file is already loaded");
- /* return type */
- parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip data-block");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataMovieClips");
+ srna = RNA_def_struct(brna, "BlendDataMovieClips", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Movie Clips", "Collection of movie clips");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_movieclips_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a movie clip from the current blendfile.");
+ parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this movie clip before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this movie clip");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this movie clip");
+
+ /* load func */
+ func = RNA_def_function(srna, "load", "rna_Main_movieclip_load");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(
+ func,
+ "Add a new movie clip to the main database from a file "
+ "(while ``check_existing`` is disabled for consistency with other load functions, "
+ "behavior with multiple movie-clips using the same file may incorrectly generate proxies)");
+ parm = RNA_def_string_file_path(
+ func, "filepath", "Path", FILE_MAX, "", "path for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "check_existing",
+ false,
+ "",
+ "Using existing data-block if this file is already loaded");
+ /* return type */
+ parm = RNA_def_pointer(func, "clip", "MovieClip", "", "New movie clip data-block");
+ RNA_def_function_return(func, parm);
}
void RNA_def_main_masks(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataMasks");
- srna = RNA_def_struct(brna, "BlendDataMasks", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
-
- func = RNA_def_function(srna, "tag", "rna_Main_masks_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* new func */
- func = RNA_def_function(srna, "new", "rna_Main_mask_new");
- RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
- parm = RNA_def_string(func, "name", NULL, MAX_ID_NAME - 2, "Mask", "Name of new mask data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask data-block");
- RNA_def_function_return(func, parm);
-
- /* remove func */
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
- parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this mask before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this mask");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this mask");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataMasks");
+ srna = RNA_def_struct(brna, "BlendDataMasks", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Masks", "Collection of masks");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_masks_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* new func */
+ func = RNA_def_function(srna, "new", "rna_Main_mask_new");
+ RNA_def_function_ui_description(func, "Add a new mask with a given name to the main database");
+ parm = RNA_def_string(
+ func, "name", NULL, MAX_ID_NAME - 2, "Mask", "Name of new mask data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "mask", "Mask", "", "New mask data-block");
+ RNA_def_function_return(func, parm);
+
+ /* remove func */
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a masks from the current blendfile.");
+ parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this mask before deleting it");
+ RNA_def_boolean(
+ func, "do_id_user", true, "", "Decrement user counter of all datablocks used by this mask");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this mask");
}
void RNA_def_main_linestyles(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataLineStyles");
- srna = RNA_def_struct(brna, "BlendDataLineStyles", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles");
-
- func = RNA_def_function(srna, "tag", "rna_Main_linestyle_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "new", "rna_Main_linestyles_new");
- RNA_def_function_ui_description(func, "Add a new line style instance to the main database");
- parm = RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "New line style data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a line style instance from the current blendfile");
- parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "Line style to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this line style before deleting it");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this line style");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this line style");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataLineStyles");
+ srna = RNA_def_struct(brna, "BlendDataLineStyles", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Line Styles", "Collection of line styles");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_linestyle_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "new", "rna_Main_linestyles_new");
+ RNA_def_function_ui_description(func, "Add a new line style instance to the main database");
+ parm = RNA_def_string(func, "name", "FreestyleLineStyle", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "New line style data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a line style instance from the current blendfile");
+ parm = RNA_def_pointer(func, "linestyle", "FreestyleLineStyle", "", "Line style to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(
+ func, "do_unlink", true, "", "Unlink all usages of this line style before deleting it");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this line style");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this line style");
}
void RNA_def_main_workspaces(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "BlendDataWorkSpaces");
- srna = RNA_def_struct(brna, "BlendDataWorkSpaces", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Workspaces", "Collection of workspaces");
+ RNA_def_property_srna(cprop, "BlendDataWorkSpaces");
+ srna = RNA_def_struct(brna, "BlendDataWorkSpaces", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Workspaces", "Collection of workspaces");
- func = RNA_def_function(srna, "tag", "rna_Main_workspaces_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "tag", "rna_Main_workspaces_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_def_main_lightprobes(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BlendDataProbes");
- srna = RNA_def_struct(brna, "BlendDataProbes", NULL);
- RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Light Probes", "Collection of light probes");
-
- func = RNA_def_function(srna, "new", "rna_Main_lightprobe_new");
- RNA_def_function_ui_description(func, "Add a new probe to the main database");
- parm = RNA_def_string(func, "name", "Probe", 0, "", "New name for the data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "New light probe data-block");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a probe from the current blendfile");
- parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "Probe to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "",
- "Unlink all usages of this probe before deleting it "
- "(WARNING: will also delete objects instancing that light probe data)");
- RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this light probe");
- RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this light probe");
-
- func = RNA_def_function(srna, "tag", "rna_Main_lightprobes_tag");
- parm = RNA_def_boolean(func, "value", 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BlendDataProbes");
+ srna = RNA_def_struct(brna, "BlendDataProbes", NULL);
+ RNA_def_struct_sdna(srna, "Main");
+ RNA_def_struct_ui_text(srna, "Main Light Probes", "Collection of light probes");
+
+ func = RNA_def_function(srna, "new", "rna_Main_lightprobe_new");
+ RNA_def_function_ui_description(func, "Add a new probe to the main database");
+ parm = RNA_def_string(func, "name", "Probe", 0, "", "New name for the data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "New light probe data-block");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a probe from the current blendfile");
+ parm = RNA_def_pointer(func, "lightprobe", "LightProbe", "", "Probe to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_boolean(func,
+ "do_unlink",
+ true,
+ "",
+ "Unlink all usages of this probe before deleting it "
+ "(WARNING: will also delete objects instancing that light probe data)");
+ RNA_def_boolean(func,
+ "do_id_user",
+ true,
+ "",
+ "Decrement user counter of all datablocks used by this light probe");
+ RNA_def_boolean(
+ func, "do_ui_user", true, "", "Make sure interface does not reference this light probe");
+
+ func = RNA_def_function(srna, "tag", "rna_Main_lightprobes_tag");
+ parm = RNA_def_boolean(func, "value", 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c
index 4f5c35b742b..c5b2f70366e 100644
--- a/source/blender/makesrna/intern/rna_mask.c
+++ b/source/blender/makesrna/intern/rna_mask.c
@@ -18,14 +18,13 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <limits.h>
#include "MEM_guardedalloc.h"
#include "DNA_mask_types.h"
-#include "DNA_object_types.h" /* SELECT */
+#include "DNA_object_types.h" /* SELECT */
#include "DNA_scene_types.h"
#include "BLT_translation.h"
@@ -45,1039 +44,1108 @@
#ifdef RNA_RUNTIME
-#include "BLI_math.h"
+# include "BLI_math.h"
-#include "DNA_movieclip_types.h"
+# include "DNA_movieclip_types.h"
-#include "BKE_mask.h"
+# include "BKE_mask.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "WM_api.h"
+# include "WM_api.h"
static void rna_Mask_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Mask *mask = ptr->id.data;
+ Mask *mask = ptr->id.data;
- WM_main_add_notifier(NC_MASK | ND_DATA, mask);
- DEG_id_tag_update( &mask->id, 0);
+ WM_main_add_notifier(NC_MASK | ND_DATA, mask);
+ DEG_id_tag_update(&mask->id, 0);
}
static void rna_Mask_update_parent(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- MaskParent *parent = ptr->data;
-
- if (parent->id) {
- if (GS(parent->id->name) == ID_MC) {
- MovieClip *clip = (MovieClip *) parent->id;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, parent->parent);
-
- if (object) {
- int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra);
-
- if (parent->type == MASK_PARENT_POINT_TRACK) {
- MovieTrackingTrack *track = BKE_tracking_track_get_named(tracking, object, parent->sub_parent);
-
- if (track) {
- MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_framenr);
- float marker_pos_ofs[2], parmask_pos[2];
- MovieClipUser user = {0};
-
- BKE_movieclip_user_set_frame(&user, scene->r.cfra);
-
- add_v2_v2v2(marker_pos_ofs, marker->pos, track->offset);
-
- BKE_mask_coord_from_movieclip(clip, &user, parmask_pos, marker_pos_ofs);
-
- copy_v2_v2(parent->parent_orig, parmask_pos);
- }
- }
- else /* if (parent->type == MASK_PARENT_PLANE_TRACK) */ {
- MovieTrackingPlaneTrack *plane_track = BKE_tracking_plane_track_get_named(tracking, object, parent->sub_parent);
- if (plane_track) {
- MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track, clip_framenr);
-
- memcpy(parent->parent_corners_orig, plane_marker->corners, sizeof(parent->parent_corners_orig));
- zero_v2(parent->parent_orig);
- }
- }
- }
- }
- }
-
- rna_Mask_update_data(bmain, scene, ptr);
+ MaskParent *parent = ptr->data;
+
+ if (parent->id) {
+ if (GS(parent->id->name) == ID_MC) {
+ MovieClip *clip = (MovieClip *)parent->id;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingObject *object = BKE_tracking_object_get_named(tracking, parent->parent);
+
+ if (object) {
+ int clip_framenr = BKE_movieclip_remap_scene_to_clip_frame(clip, scene->r.cfra);
+
+ if (parent->type == MASK_PARENT_POINT_TRACK) {
+ MovieTrackingTrack *track = BKE_tracking_track_get_named(
+ tracking, object, parent->sub_parent);
+
+ if (track) {
+ MovieTrackingMarker *marker = BKE_tracking_marker_get(track, clip_framenr);
+ float marker_pos_ofs[2], parmask_pos[2];
+ MovieClipUser user = {0};
+
+ BKE_movieclip_user_set_frame(&user, scene->r.cfra);
+
+ add_v2_v2v2(marker_pos_ofs, marker->pos, track->offset);
+
+ BKE_mask_coord_from_movieclip(clip, &user, parmask_pos, marker_pos_ofs);
+
+ copy_v2_v2(parent->parent_orig, parmask_pos);
+ }
+ }
+ else /* if (parent->type == MASK_PARENT_PLANE_TRACK) */ {
+ MovieTrackingPlaneTrack *plane_track = BKE_tracking_plane_track_get_named(
+ tracking, object, parent->sub_parent);
+ if (plane_track) {
+ MovieTrackingPlaneMarker *plane_marker = BKE_tracking_plane_marker_get(plane_track,
+ clip_framenr);
+
+ memcpy(parent->parent_corners_orig,
+ plane_marker->corners,
+ sizeof(parent->parent_corners_orig));
+ zero_v2(parent->parent_orig);
+ }
+ }
+ }
+ }
+ }
+
+ rna_Mask_update_data(bmain, scene, ptr);
}
/* note: this function exists only to avoid id refcounting */
static void rna_MaskParent_id_set(PointerRNA *ptr, PointerRNA value)
{
- MaskParent *mpar = (MaskParent *) ptr->data;
+ MaskParent *mpar = (MaskParent *)ptr->data;
- mpar->id = value.data;
+ mpar->id = value.data;
}
static StructRNA *rna_MaskParent_id_typef(PointerRNA *ptr)
{
- MaskParent *mpar = (MaskParent *) ptr->data;
+ MaskParent *mpar = (MaskParent *)ptr->data;
- return ID_code_to_RNA_type(mpar->id_type);
+ return ID_code_to_RNA_type(mpar->id_type);
}
static void rna_MaskParent_id_type_set(PointerRNA *ptr, int value)
{
- MaskParent *mpar = (MaskParent *) ptr->data;
+ MaskParent *mpar = (MaskParent *)ptr->data;
- /* change ID-type to the new type */
- mpar->id_type = value;
+ /* change ID-type to the new type */
+ mpar->id_type = value;
- /* clear the id-block if the type is invalid */
- if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type))
- mpar->id = NULL;
+ /* clear the id-block if the type is invalid */
+ if ((mpar->id) && (GS(mpar->id->name) != mpar->id_type))
+ mpar->id = NULL;
}
static void rna_Mask_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mask *mask = (Mask *)ptr->id.data;
+ Mask *mask = (Mask *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &mask->masklayers, NULL);
+ rna_iterator_listbase_begin(iter, &mask->masklayers, NULL);
}
static int rna_Mask_layer_active_index_get(PointerRNA *ptr)
{
- Mask *mask = (Mask *)ptr->id.data;
+ Mask *mask = (Mask *)ptr->id.data;
- return mask->masklay_act;
+ return mask->masklay_act;
}
static void rna_Mask_layer_active_index_set(PointerRNA *ptr, int value)
{
- Mask *mask = (Mask *)ptr->id.data;
+ Mask *mask = (Mask *)ptr->id.data;
- mask->masklay_act = value;
+ mask->masklay_act = value;
}
-static void rna_Mask_layer_active_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_Mask_layer_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- Mask *mask = (Mask *)ptr->id.data;
+ Mask *mask = (Mask *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, mask->masklay_tot - 1);
+ *min = 0;
+ *max = max_ii(0, mask->masklay_tot - 1);
- *softmin = *min;
- *softmax = *max;
+ *softmin = *min;
+ *softmax = *max;
}
static char *rna_MaskLayer_path(PointerRNA *ptr)
{
- MaskLayer *masklay = (MaskLayer *)ptr->data;
- char name_esc[sizeof(masklay->name) * 2];
- BLI_strescape(name_esc, masklay->name, sizeof(name_esc));
- return BLI_sprintfN("layers[\"%s\"]", name_esc);
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
+ char name_esc[sizeof(masklay->name) * 2];
+ BLI_strescape(name_esc, masklay->name, sizeof(name_esc));
+ return BLI_sprintfN("layers[\"%s\"]", name_esc);
}
static PointerRNA rna_Mask_layer_active_get(PointerRNA *ptr)
{
- Mask *mask = (Mask *)ptr->id.data;
- MaskLayer *masklay = BKE_mask_layer_active(mask);
+ Mask *mask = (Mask *)ptr->id.data;
+ MaskLayer *masklay = BKE_mask_layer_active(mask);
- return rna_pointer_inherit_refine(ptr, &RNA_MaskLayer, masklay);
+ return rna_pointer_inherit_refine(ptr, &RNA_MaskLayer, masklay);
}
static void rna_Mask_layer_active_set(PointerRNA *ptr, PointerRNA value)
{
- Mask *mask = (Mask *)ptr->id.data;
- MaskLayer *masklay = (MaskLayer *)value.data;
+ Mask *mask = (Mask *)ptr->id.data;
+ MaskLayer *masklay = (MaskLayer *)value.data;
- BKE_mask_layer_active_set(mask, masklay);
+ BKE_mask_layer_active_set(mask, masklay);
}
static void rna_MaskLayer_splines_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MaskLayer *masklay = (MaskLayer *)ptr->data;
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
- rna_iterator_listbase_begin(iter, &masklay->splines, NULL);
+ rna_iterator_listbase_begin(iter, &masklay->splines, NULL);
}
static void rna_MaskLayer_name_set(PointerRNA *ptr, const char *value)
{
- Mask *mask = (Mask *)ptr->id.data;
- MaskLayer *masklay = (MaskLayer *)ptr->data;
- char oldname[sizeof(masklay->name)], newname[sizeof(masklay->name)];
+ Mask *mask = (Mask *)ptr->id.data;
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
+ char oldname[sizeof(masklay->name)], newname[sizeof(masklay->name)];
- /* need to be on the stack */
- BLI_strncpy(oldname, masklay->name, sizeof(masklay->name));
- BLI_strncpy_utf8(newname, value, sizeof(masklay->name));
+ /* need to be on the stack */
+ BLI_strncpy(oldname, masklay->name, sizeof(masklay->name));
+ BLI_strncpy_utf8(newname, value, sizeof(masklay->name));
- BKE_mask_layer_rename(mask, masklay, oldname, newname);
+ BKE_mask_layer_rename(mask, masklay, oldname, newname);
}
static PointerRNA rna_MaskLayer_active_spline_get(PointerRNA *ptr)
{
- MaskLayer *masklay = (MaskLayer *)ptr->data;
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, masklay->act_spline);
+ return rna_pointer_inherit_refine(ptr, &RNA_MaskSpline, masklay->act_spline);
}
static void rna_MaskLayer_active_spline_set(PointerRNA *ptr, PointerRNA value)
{
- MaskLayer *masklay = (MaskLayer *)ptr->data;
- MaskSpline *spline = (MaskSpline *)value.data;
- int index = BLI_findindex(&masklay->splines, spline);
-
- if (index != -1)
- masklay->act_spline = spline;
- else
- masklay->act_spline = NULL;
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
+ MaskSpline *spline = (MaskSpline *)value.data;
+ int index = BLI_findindex(&masklay->splines, spline);
+
+ if (index != -1)
+ masklay->act_spline = spline;
+ else
+ masklay->act_spline = NULL;
}
static PointerRNA rna_MaskLayer_active_spline_point_get(PointerRNA *ptr)
{
- MaskLayer *masklay = (MaskLayer *)ptr->data;
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, masklay->act_point);
+ return rna_pointer_inherit_refine(ptr, &RNA_MaskSplinePoint, masklay->act_point);
}
static void rna_MaskLayer_active_spline_point_set(PointerRNA *ptr, PointerRNA value)
{
- MaskLayer *masklay = (MaskLayer *)ptr->data;
- MaskSpline *spline;
- MaskSplinePoint *point = (MaskSplinePoint *)value.data;
+ MaskLayer *masklay = (MaskLayer *)ptr->data;
+ MaskSpline *spline;
+ MaskSplinePoint *point = (MaskSplinePoint *)value.data;
- masklay->act_point = NULL;
+ masklay->act_point = NULL;
- for (spline = masklay->splines.first; spline; spline = spline->next) {
- if (point >= spline->points && point < spline->points + spline->tot_point) {
- masklay->act_point = point;
+ for (spline = masklay->splines.first; spline; spline = spline->next) {
+ if (point >= spline->points && point < spline->points + spline->tot_point) {
+ masklay->act_point = point;
- break;
- }
- }
+ break;
+ }
+ }
}
static void rna_MaskSplinePoint_handle1_get(PointerRNA *ptr, float *values)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- copy_v2_v2(values, bezt->vec[0]);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ copy_v2_v2(values, bezt->vec[0]);
}
static void rna_MaskSplinePoint_handle1_set(PointerRNA *ptr, const float *values)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- copy_v2_v2(bezt->vec[0], values);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ copy_v2_v2(bezt->vec[0], values);
}
static void rna_MaskSplinePoint_handle2_get(PointerRNA *ptr, float *values)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- copy_v2_v2(values, bezt->vec[2]);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ copy_v2_v2(values, bezt->vec[2]);
}
static void rna_MaskSplinePoint_handle2_set(PointerRNA *ptr, const float *values)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- copy_v2_v2(bezt->vec[2], values);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ copy_v2_v2(bezt->vec[2], values);
}
static void rna_MaskSplinePoint_ctrlpoint_get(PointerRNA *ptr, float *values)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- copy_v2_v2(values, bezt->vec[1]);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ copy_v2_v2(values, bezt->vec[1]);
}
static void rna_MaskSplinePoint_ctrlpoint_set(PointerRNA *ptr, const float *values)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- copy_v2_v2(bezt->vec[1], values);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ copy_v2_v2(bezt->vec[1], values);
}
static int rna_MaskSplinePoint_handle_type_get(PointerRNA *ptr)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
- return bezt->h1;
+ return bezt->h1;
}
static MaskSpline *mask_spline_from_point(Mask *mask, MaskSplinePoint *point)
{
- MaskLayer *mask_layer;
- for (mask_layer = mask->masklayers.first;
- mask_layer;
- mask_layer = mask_layer->next)
- {
- MaskSpline *spline;
- for (spline = mask_layer->splines.first;
- spline;
- spline = spline->next)
- {
- if (point >= spline->points && point < spline->points + spline->tot_point) {
- return spline;
- }
- }
- }
- return NULL;
+ MaskLayer *mask_layer;
+ for (mask_layer = mask->masklayers.first; mask_layer; mask_layer = mask_layer->next) {
+ MaskSpline *spline;
+ for (spline = mask_layer->splines.first; spline; spline = spline->next) {
+ if (point >= spline->points && point < spline->points + spline->tot_point) {
+ return spline;
+ }
+ }
+ }
+ return NULL;
}
static void mask_point_check_stick(MaskSplinePoint *point)
{
- BezTriple *bezt = &point->bezt;
- if (bezt->h1 == HD_ALIGN && bezt->h2 == HD_ALIGN) {
- float vec[3];
- sub_v3_v3v3(vec, bezt->vec[0], bezt->vec[1]);
- add_v3_v3v3(bezt->vec[2], bezt->vec[1], vec);
- }
+ BezTriple *bezt = &point->bezt;
+ if (bezt->h1 == HD_ALIGN && bezt->h2 == HD_ALIGN) {
+ float vec[3];
+ sub_v3_v3v3(vec, bezt->vec[0], bezt->vec[1]);
+ add_v3_v3v3(bezt->vec[2], bezt->vec[1], vec);
+ }
}
static void rna_MaskSplinePoint_handle_type_set(PointerRNA *ptr, int value)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- MaskSpline *spline = mask_spline_from_point((Mask *) ptr->id.data, point);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ MaskSpline *spline = mask_spline_from_point((Mask *)ptr->id.data, point);
- bezt->h1 = bezt->h2 = value;
- mask_point_check_stick(point);
- BKE_mask_calc_handle_point(spline, point);
+ bezt->h1 = bezt->h2 = value;
+ mask_point_check_stick(point);
+ BKE_mask_calc_handle_point(spline, point);
}
static int rna_MaskSplinePoint_handle_left_type_get(PointerRNA *ptr)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
- return bezt->h1;
+ return bezt->h1;
}
static void rna_MaskSplinePoint_handle_left_type_set(PointerRNA *ptr, int value)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- MaskSpline *spline = mask_spline_from_point((Mask *) ptr->id.data, point);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ MaskSpline *spline = mask_spline_from_point((Mask *)ptr->id.data, point);
- bezt->h1 = value;
- mask_point_check_stick(point);
- BKE_mask_calc_handle_point(spline, point);
+ bezt->h1 = value;
+ mask_point_check_stick(point);
+ BKE_mask_calc_handle_point(spline, point);
}
static int rna_MaskSplinePoint_handle_right_type_get(PointerRNA *ptr)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
- return bezt->h2;
+ return bezt->h2;
}
static void rna_MaskSplinePoint_handle_right_type_set(PointerRNA *ptr, int value)
{
- MaskSplinePoint *point = (MaskSplinePoint *) ptr->data;
- BezTriple *bezt = &point->bezt;
- MaskSpline *spline = mask_spline_from_point((Mask *) ptr->id.data, point);
+ MaskSplinePoint *point = (MaskSplinePoint *)ptr->data;
+ BezTriple *bezt = &point->bezt;
+ MaskSpline *spline = mask_spline_from_point((Mask *)ptr->id.data, point);
- bezt->h2 = value;
- mask_point_check_stick(point);
- BKE_mask_calc_handle_point(spline, point);
+ bezt->h2 = value;
+ mask_point_check_stick(point);
+ BKE_mask_calc_handle_point(spline, point);
}
/* ** API ** */
static MaskLayer *rna_Mask_layers_new(Mask *mask, const char *name)
{
- MaskLayer *masklay = BKE_mask_layer_new(mask, name);
+ MaskLayer *masklay = BKE_mask_layer_new(mask, name);
- WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
+ WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
- return masklay;
+ return masklay;
}
static void rna_Mask_layers_remove(Mask *mask, ReportList *reports, PointerRNA *masklay_ptr)
{
- MaskLayer *masklay = masklay_ptr->data;
- if (BLI_findindex(&mask->masklayers, masklay) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Mask layer '%s' not found in mask '%s'", masklay->name, mask->id.name + 2);
- return;
- }
-
- BKE_mask_layer_remove(mask, masklay);
- RNA_POINTER_INVALIDATE(masklay_ptr);
-
- WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
+ MaskLayer *masklay = masklay_ptr->data;
+ if (BLI_findindex(&mask->masklayers, masklay) == -1) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Mask layer '%s' not found in mask '%s'",
+ masklay->name,
+ mask->id.name + 2);
+ return;
+ }
+
+ BKE_mask_layer_remove(mask, masklay);
+ RNA_POINTER_INVALIDATE(masklay_ptr);
+
+ WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
}
static void rna_Mask_layers_clear(Mask *mask)
{
- BKE_mask_layer_free_list(&mask->masklayers);
+ BKE_mask_layer_free_list(&mask->masklayers);
- WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
+ WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
}
static MaskSpline *rna_MaskLayer_spline_new(ID *id, MaskLayer *mask_layer)
{
- Mask *mask = (Mask *) id;
- MaskSpline *new_spline;
+ Mask *mask = (Mask *)id;
+ MaskSpline *new_spline;
- new_spline = BKE_mask_spline_add(mask_layer);
+ new_spline = BKE_mask_spline_add(mask_layer);
- WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
+ WM_main_add_notifier(NC_MASK | NA_EDITED, mask);
- return new_spline;
+ return new_spline;
}
-static void rna_MaskLayer_spline_remove(ID *id, MaskLayer *mask_layer, ReportList *reports, PointerRNA *spline_ptr)
+static void rna_MaskLayer_spline_remove(ID *id,
+ MaskLayer *mask_layer,
+ ReportList *reports,
+ PointerRNA *spline_ptr)
{
- Mask *mask = (Mask *) id;
- MaskSpline *spline = spline_ptr->data;
+ Mask *mask = (Mask *)id;
+ MaskSpline *spline = spline_ptr->data;
- if (BKE_mask_spline_remove(mask_layer, spline) == false) {
- BKE_reportf(reports, RPT_ERROR, "Mask layer '%s' does not contain spline given", mask_layer->name);
- return;
- }
+ if (BKE_mask_spline_remove(mask_layer, spline) == false) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Mask layer '%s' does not contain spline given", mask_layer->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(spline_ptr);
+ RNA_POINTER_INVALIDATE(spline_ptr);
- DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(&mask->id, ID_RECALC_GEOMETRY);
}
static void rna_Mask_start_frame_set(PointerRNA *ptr, int value)
{
- Mask *data = (Mask *)ptr->data;
- /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
- CLAMP(value, MINFRAME, MAXFRAME);
- data->sfra = value;
-
- if (data->sfra >= data->efra) {
- data->efra = MIN2(data->sfra, MAXFRAME);
- }
+ Mask *data = (Mask *)ptr->data;
+ /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
+ CLAMP(value, MINFRAME, MAXFRAME);
+ data->sfra = value;
+
+ if (data->sfra >= data->efra) {
+ data->efra = MIN2(data->sfra, MAXFRAME);
+ }
}
static void rna_Mask_end_frame_set(PointerRNA *ptr, int value)
{
- Mask *data = (Mask *)ptr->data;
- CLAMP(value, MINFRAME, MAXFRAME);
- data->efra = value;
+ Mask *data = (Mask *)ptr->data;
+ CLAMP(value, MINFRAME, MAXFRAME);
+ data->efra = value;
- if (data->sfra >= data->efra) {
- data->sfra = MAX2(data->efra, MINFRAME);
- }
+ if (data->sfra >= data->efra) {
+ data->sfra = MAX2(data->efra, MINFRAME);
+ }
}
static void rna_MaskSpline_points_add(ID *id, MaskSpline *spline, int count)
{
- Mask *mask = (Mask *) id;
- MaskLayer *layer;
- int active_point_index = -1;
- int i, spline_shape_index;
-
- if (count <= 0) {
- return;
- }
-
- for (layer = mask->masklayers.first; layer; layer = layer->next) {
- if (BLI_findindex(&layer->splines, spline) != -1) {
- break;
- }
- }
-
- if (!layer) {
- /* Shall not happen actually */
- BLI_assert(!"No layer found for the spline");
- return;
- }
-
- if (layer->act_spline == spline) {
- active_point_index = layer->act_point - spline->points;
- }
-
- spline->points = MEM_recallocN(spline->points, sizeof(MaskSplinePoint) * (spline->tot_point + count));
- spline->tot_point += count;
-
- if (active_point_index >= 0) {
- layer->act_point = spline->points + active_point_index;
- }
-
- spline_shape_index = BKE_mask_layer_shape_spline_to_index(layer, spline);
-
- for (i = 0; i < count; i++) {
- int point_index = spline->tot_point - count + i;
- MaskSplinePoint *new_point = spline->points + point_index;
- new_point->bezt.h1 = new_point->bezt.h2 = HD_ALIGN;
- BKE_mask_calc_handle_point_auto(spline, new_point, true);
- BKE_mask_parent_init(&new_point->parent);
-
- /* Not efficient, but there's no other way for now */
- BKE_mask_layer_shape_changed_add(layer, spline_shape_index + point_index, true, true);
- }
-
- WM_main_add_notifier(NC_MASK | ND_DATA, mask);
- DEG_id_tag_update(&mask->id, 0);
+ Mask *mask = (Mask *)id;
+ MaskLayer *layer;
+ int active_point_index = -1;
+ int i, spline_shape_index;
+
+ if (count <= 0) {
+ return;
+ }
+
+ for (layer = mask->masklayers.first; layer; layer = layer->next) {
+ if (BLI_findindex(&layer->splines, spline) != -1) {
+ break;
+ }
+ }
+
+ if (!layer) {
+ /* Shall not happen actually */
+ BLI_assert(!"No layer found for the spline");
+ return;
+ }
+
+ if (layer->act_spline == spline) {
+ active_point_index = layer->act_point - spline->points;
+ }
+
+ spline->points = MEM_recallocN(spline->points,
+ sizeof(MaskSplinePoint) * (spline->tot_point + count));
+ spline->tot_point += count;
+
+ if (active_point_index >= 0) {
+ layer->act_point = spline->points + active_point_index;
+ }
+
+ spline_shape_index = BKE_mask_layer_shape_spline_to_index(layer, spline);
+
+ for (i = 0; i < count; i++) {
+ int point_index = spline->tot_point - count + i;
+ MaskSplinePoint *new_point = spline->points + point_index;
+ new_point->bezt.h1 = new_point->bezt.h2 = HD_ALIGN;
+ BKE_mask_calc_handle_point_auto(spline, new_point, true);
+ BKE_mask_parent_init(&new_point->parent);
+
+ /* Not efficient, but there's no other way for now */
+ BKE_mask_layer_shape_changed_add(layer, spline_shape_index + point_index, true, true);
+ }
+
+ WM_main_add_notifier(NC_MASK | ND_DATA, mask);
+ DEG_id_tag_update(&mask->id, 0);
}
-static void rna_MaskSpline_point_remove(ID *id, MaskSpline *spline, ReportList *reports, PointerRNA *point_ptr)
+static void rna_MaskSpline_point_remove(ID *id,
+ MaskSpline *spline,
+ ReportList *reports,
+ PointerRNA *point_ptr)
{
- Mask *mask = (Mask *) id;
- MaskSplinePoint *point = point_ptr->data;
- MaskSplinePoint *new_point_array;
- MaskLayer *layer;
- int active_point_index = -1;
- int point_index;
-
- for (layer = mask->masklayers.first; layer; layer = layer->next) {
- if (BLI_findindex(&layer->splines, spline) != -1) {
- break;
- }
- }
-
- if (!layer) {
- /* Shall not happen actually */
- BKE_report(reports, RPT_ERROR, "Mask layer not found for given spline");
- return;
- }
-
- if (point < spline->points || point >= spline->points + spline->tot_point) {
- BKE_report(reports, RPT_ERROR, "Point is not found in given spline");
- return;
- }
-
- if (layer->act_spline == spline) {
- active_point_index = layer->act_point - spline->points;
- }
-
- point_index = point - spline->points;
-
- new_point_array = MEM_mallocN(sizeof(MaskSplinePoint) * (spline->tot_point - 1), "remove mask point");
-
- memcpy(new_point_array, spline->points, sizeof(MaskSplinePoint) * point_index);
- memcpy(new_point_array + point_index, spline->points + point_index + 1,
- sizeof(MaskSplinePoint) * (spline->tot_point - point_index - 1));
-
- MEM_freeN(spline->points);
- spline->points = new_point_array;
- spline->tot_point--;
-
- if (active_point_index >= 0) {
- if (active_point_index == point_index) {
- layer->act_point = NULL;
- }
- else if (active_point_index < point_index) {
- layer->act_point = spline->points + active_point_index;
- }
- else {
- layer->act_point = spline->points + active_point_index - 1;
- }
- }
-
- BKE_mask_layer_shape_changed_remove(layer, BKE_mask_layer_shape_spline_to_index(layer, spline) + point_index, 1);
-
- WM_main_add_notifier(NC_MASK | ND_DATA, mask);
- DEG_id_tag_update(&mask->id, 0);
-
- RNA_POINTER_INVALIDATE(point_ptr);
+ Mask *mask = (Mask *)id;
+ MaskSplinePoint *point = point_ptr->data;
+ MaskSplinePoint *new_point_array;
+ MaskLayer *layer;
+ int active_point_index = -1;
+ int point_index;
+
+ for (layer = mask->masklayers.first; layer; layer = layer->next) {
+ if (BLI_findindex(&layer->splines, spline) != -1) {
+ break;
+ }
+ }
+
+ if (!layer) {
+ /* Shall not happen actually */
+ BKE_report(reports, RPT_ERROR, "Mask layer not found for given spline");
+ return;
+ }
+
+ if (point < spline->points || point >= spline->points + spline->tot_point) {
+ BKE_report(reports, RPT_ERROR, "Point is not found in given spline");
+ return;
+ }
+
+ if (layer->act_spline == spline) {
+ active_point_index = layer->act_point - spline->points;
+ }
+
+ point_index = point - spline->points;
+
+ new_point_array = MEM_mallocN(sizeof(MaskSplinePoint) * (spline->tot_point - 1),
+ "remove mask point");
+
+ memcpy(new_point_array, spline->points, sizeof(MaskSplinePoint) * point_index);
+ memcpy(new_point_array + point_index,
+ spline->points + point_index + 1,
+ sizeof(MaskSplinePoint) * (spline->tot_point - point_index - 1));
+
+ MEM_freeN(spline->points);
+ spline->points = new_point_array;
+ spline->tot_point--;
+
+ if (active_point_index >= 0) {
+ if (active_point_index == point_index) {
+ layer->act_point = NULL;
+ }
+ else if (active_point_index < point_index) {
+ layer->act_point = spline->points + active_point_index;
+ }
+ else {
+ layer->act_point = spline->points + active_point_index - 1;
+ }
+ }
+
+ BKE_mask_layer_shape_changed_remove(
+ layer, BKE_mask_layer_shape_spline_to_index(layer, spline) + point_index, 1);
+
+ WM_main_add_notifier(NC_MASK | ND_DATA, mask);
+ DEG_id_tag_update(&mask->id, 0);
+
+ RNA_POINTER_INVALIDATE(point_ptr);
}
#else
static void rna_def_maskParent(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem mask_id_type_items[] = {
- {ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem parent_type_items[] = {
- {MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
- {MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MaskParent", NULL);
- RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
-
- /* Target Properties - ID-block to Drive */
- prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- // RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
- /* note: custom set function is ONLY to avoid rna setting a user for this. */
- RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskParent_id_set", "rna_MaskParent_id_typef", NULL);
- RNA_def_property_ui_text(prop, "ID", "ID-block to which masking element would be parented to or to it's property");
- RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
-
- prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "id_type");
- RNA_def_property_enum_items(prop, mask_id_type_items);
- RNA_def_property_enum_default(prop, ID_MC);
- RNA_def_property_enum_funcs(prop, NULL, "rna_MaskParent_id_type_set", NULL);
- //RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
- RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
- RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
-
- /* type */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, parent_type_items);
- RNA_def_property_ui_text(prop, "Parent Type", "Parent Type");
- RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
-
- /* parent */
- prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Parent", "Name of parent object in specified data-block to which parenting happens");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
-
- /* sub_parent */
- prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Sub Parent", "Name of parent sub-object in specified data-block to which parenting happens");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mask_id_type_items[] = {
+ {ID_MC, "MOVIECLIP", ICON_SEQUENCE, "Movie Clip", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem parent_type_items[] = {
+ {MASK_PARENT_POINT_TRACK, "POINT_TRACK", 0, "Point Track", ""},
+ {MASK_PARENT_PLANE_TRACK, "PLANE_TRACK", 0, "Plane Track", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MaskParent", NULL);
+ RNA_def_struct_ui_text(srna, "Mask Parent", "Parenting settings for masking element");
+
+ /* Target Properties - ID-block to Drive */
+ prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ // RNA_def_property_editable_func(prop, "rna_maskSpline_id_editable");
+ /* note: custom set function is ONLY to avoid rna setting a user for this. */
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_MaskParent_id_set", "rna_MaskParent_id_typef", NULL);
+ RNA_def_property_ui_text(
+ prop, "ID", "ID-block to which masking element would be parented to or to it's property");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
+
+ prop = RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "id_type");
+ RNA_def_property_enum_items(prop, mask_id_type_items);
+ RNA_def_property_enum_default(prop, ID_MC);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_MaskParent_id_type_set", NULL);
+ //RNA_def_property_editable_func(prop, "rna_MaskParent_id_type_editable");
+ RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
+
+ /* type */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, parent_type_items);
+ RNA_def_property_ui_text(prop, "Parent Type", "Parent Type");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
+
+ /* parent */
+ prop = RNA_def_property(srna, "parent", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Parent", "Name of parent object in specified data-block to which parenting happens");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
+
+ /* sub_parent */
+ prop = RNA_def_property(srna, "sub_parent", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Sub Parent",
+ "Name of parent sub-object in specified data-block to which parenting happens");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_update(prop, 0, "rna_Mask_update_parent");
}
static void rna_def_maskSplinePointUW(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MaskSplinePointUW", NULL);
- RNA_def_struct_ui_text(srna, "Mask Spline UW Point", "Single point in spline segment defining feather");
-
- /* u */
- prop = RNA_def_property(srna, "u", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "u");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "U", "U coordinate of point along spline segment");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* weight */
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "w");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Weight", "Weight of feather point");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* select */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select", "Selection status");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MaskSplinePointUW", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Mask Spline UW Point", "Single point in spline segment defining feather");
+
+ /* u */
+ prop = RNA_def_property(srna, "u", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "u");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "U", "U coordinate of point along spline segment");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* weight */
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "w");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Weight", "Weight of feather point");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* select */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Selection status");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
}
static void rna_def_maskSplinePoint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem handle_type_items[] = {
- {HD_AUTO, "AUTO", 0, "Auto", ""},
- {HD_VECT, "VECTOR", 0, "Vector", ""},
- {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
- {HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
- {HD_FREE, "FREE", 0, "Free", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- rna_def_maskSplinePointUW(brna);
-
- srna = RNA_def_struct(brna, "MaskSplinePoint", NULL);
- RNA_def_struct_ui_text(srna, "Mask Spline Point", "Single point in spline used for defining mask");
-
- /* Vector values */
- prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", NULL);
- RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", NULL);
- RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", NULL);
- RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* handle_type */
- prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", NULL);
- RNA_def_property_enum_items(prop, handle_type_items);
- RNA_def_property_ui_text(prop, "Handle Type", "Handle type");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* handle_type */
- prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, "rna_MaskSplinePoint_handle_left_type_get", "rna_MaskSplinePoint_handle_left_type_set", NULL);
- RNA_def_property_enum_items(prop, handle_type_items);
- RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle type");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* handle_right */
- prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, "rna_MaskSplinePoint_handle_right_type_get", "rna_MaskSplinePoint_handle_right_type_set", NULL);
- RNA_def_property_enum_items(prop, handle_type_items);
- RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle type");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* weight */
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bezt.weight");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Weight", "Weight of the point");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* select */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bezt.f1", SELECT);
- RNA_def_property_ui_text(prop, "Select", "Selection status");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* parent */
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaskParent");
-
- /* feather points */
- prop = RNA_def_property(srna, "feather_points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaskSplinePointUW");
- RNA_def_property_collection_sdna(prop, NULL, "uw", "tot_uw");
- RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem handle_type_items[] = {
+ {HD_AUTO, "AUTO", 0, "Auto", ""},
+ {HD_VECT, "VECTOR", 0, "Vector", ""},
+ {HD_ALIGN, "ALIGNED", 0, "Aligned Single", ""},
+ {HD_ALIGN_DOUBLESIDE, "ALIGNED_DOUBLESIDE", 0, "Aligned", ""},
+ {HD_FREE, "FREE", 0, "Free", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ rna_def_maskSplinePointUW(brna);
+
+ srna = RNA_def_struct(brna, "MaskSplinePoint", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Mask Spline Point", "Single point in spline used for defining mask");
+
+ /* Vector values */
+ prop = RNA_def_property(srna, "handle_left", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_MaskSplinePoint_handle1_get", "rna_MaskSplinePoint_handle1_set", NULL);
+ RNA_def_property_ui_text(prop, "Handle 1", "Coordinates of the first handle");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_MaskSplinePoint_ctrlpoint_get", "rna_MaskSplinePoint_ctrlpoint_set", NULL);
+ RNA_def_property_ui_text(prop, "Control Point", "Coordinates of the control point");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ prop = RNA_def_property(srna, "handle_right", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_MaskSplinePoint_handle2_get", "rna_MaskSplinePoint_handle2_set", NULL);
+ RNA_def_property_ui_text(prop, "Handle 2", "Coordinates of the second handle");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* handle_type */
+ prop = RNA_def_property(srna, "handle_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(
+ prop, "rna_MaskSplinePoint_handle_type_get", "rna_MaskSplinePoint_handle_type_set", NULL);
+ RNA_def_property_enum_items(prop, handle_type_items);
+ RNA_def_property_ui_text(prop, "Handle Type", "Handle type");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* handle_type */
+ prop = RNA_def_property(srna, "handle_left_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop,
+ "rna_MaskSplinePoint_handle_left_type_get",
+ "rna_MaskSplinePoint_handle_left_type_set",
+ NULL);
+ RNA_def_property_enum_items(prop, handle_type_items);
+ RNA_def_property_ui_text(prop, "Handle 1 Type", "Handle type");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* handle_right */
+ prop = RNA_def_property(srna, "handle_right_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop,
+ "rna_MaskSplinePoint_handle_right_type_get",
+ "rna_MaskSplinePoint_handle_right_type_set",
+ NULL);
+ RNA_def_property_enum_items(prop, handle_type_items);
+ RNA_def_property_ui_text(prop, "Handle 2 Type", "Handle type");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* weight */
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bezt.weight");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Weight", "Weight of the point");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* select */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bezt.f1", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Selection status");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* parent */
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MaskParent");
+
+ /* feather points */
+ prop = RNA_def_property(srna, "feather_points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MaskSplinePointUW");
+ RNA_def_property_collection_sdna(prop, NULL, "uw", "tot_uw");
+ RNA_def_property_ui_text(prop, "Feather Points", "Points defining feather");
}
static void rna_def_mask_splines(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "MaskSplines", NULL);
- RNA_def_struct_sdna(srna, "MaskLayer");
- RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
-
- /* Create new spline */
- func = RNA_def_function(srna, "new", "rna_MaskLayer_spline_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new spline to the layer");
- parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The newly created spline");
- RNA_def_function_return(func, parm);
-
- /* Remove the spline */
- func = RNA_def_function(srna, "remove", "rna_MaskLayer_spline_remove");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Remove a spline from a layer");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* active spline */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaskSpline");
- RNA_def_property_pointer_funcs(prop, "rna_MaskLayer_active_spline_get", "rna_MaskLayer_active_spline_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
-
- /* active point */
- prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaskSplinePoint");
- RNA_def_property_pointer_funcs(prop, "rna_MaskLayer_active_spline_point_get", "rna_MaskLayer_active_spline_point_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "MaskSplines", NULL);
+ RNA_def_struct_sdna(srna, "MaskLayer");
+ RNA_def_struct_ui_text(srna, "Mask Splines", "Collection of masking splines");
+
+ /* Create new spline */
+ func = RNA_def_function(srna, "new", "rna_MaskLayer_spline_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new spline to the layer");
+ parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The newly created spline");
+ RNA_def_function_return(func, parm);
+
+ /* Remove the spline */
+ func = RNA_def_function(srna, "remove", "rna_MaskLayer_spline_remove");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Remove a spline from a layer");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "spline", "MaskSpline", "", "The spline to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* active spline */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MaskSpline");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_MaskLayer_active_spline_get", "rna_MaskLayer_active_spline_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
+
+ /* active point */
+ prop = RNA_def_property(srna, "active_point", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MaskSplinePoint");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_MaskLayer_active_spline_point_get",
+ "rna_MaskLayer_active_spline_point_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Spline", "Active spline of masking layer");
}
static void rna_def_maskSplinePoints(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "MaskSplinePoints", NULL);
- RNA_def_struct_sdna(srna, "MaskSpline");
- RNA_def_struct_ui_text(srna, "Mask Spline Points", "Collection of masking spline points");
-
- /* Create new point */
- func = RNA_def_function(srna, "add", "rna_MaskSpline_points_add");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a number of point to this spline");
- parm = RNA_def_int(func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* Remove the point */
- func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Remove a point from a spline");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "MaskSplinePoints", NULL);
+ RNA_def_struct_sdna(srna, "MaskSpline");
+ RNA_def_struct_ui_text(srna, "Mask Spline Points", "Collection of masking spline points");
+
+ /* Create new point */
+ func = RNA_def_function(srna, "add", "rna_MaskSpline_points_add");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a number of point to this spline");
+ parm = RNA_def_int(
+ func, "count", 1, 0, INT_MAX, "Number", "Number of points to add to the spline", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* Remove the point */
+ func = RNA_def_function(srna, "remove", "rna_MaskSpline_point_remove");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Remove a point from a spline");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "point", "MaskSplinePoint", "", "The point to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_maskSpline(BlenderRNA *brna)
{
- static const EnumPropertyItem spline_interpolation_items[] = {
- {MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
- {MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem spline_offset_mode_items[] = {
- {MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"},
- {MASK_SPLINE_OFFSET_SMOOTH, "SMOOTH", 0, "Smooth", "Calculate feather offset as a second curve"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_maskSplinePoint(brna);
-
- srna = RNA_def_struct(brna, "MaskSpline", NULL);
- RNA_def_struct_ui_text(srna, "Mask spline", "Single spline used for defining mask shape");
-
- /* offset mode */
- prop = RNA_def_property(srna, "offset_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "offset_mode");
- RNA_def_property_enum_items(prop, spline_offset_mode_items);
- RNA_def_property_ui_text(prop, "Feather Offset", "The method used for calculating the feather offset");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* weight interpolation */
- prop = RNA_def_property(srna, "weight_interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "weight_interp");
- RNA_def_property_enum_items(prop, spline_interpolation_items);
- RNA_def_property_ui_text(prop, "Weight Interpolation", "The type of weight interpolation for spline");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
-
- /* cyclic */
- prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
-
- /* fill */
- prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_SPLINE_NOFILL);
- RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
-
- /* self-intersection check */
- prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_NOINTERSECT);
- RNA_def_property_ui_text(prop, "Self Intersection Check", "Prevent feather from self-intersections");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
-
- prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaskSplinePoint");
- RNA_def_property_collection_sdna(prop, NULL, "points", "tot_point");
- RNA_def_property_ui_text(prop, "Points", "Collection of points");
- RNA_def_property_srna(prop, "MaskSplinePoints");
+ static const EnumPropertyItem spline_interpolation_items[] = {
+ {MASK_SPLINE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
+ {MASK_SPLINE_INTERP_EASE, "EASE", 0, "Ease", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem spline_offset_mode_items[] = {
+ {MASK_SPLINE_OFFSET_EVEN, "EVEN", 0, "Even", "Calculate even feather offset"},
+ {MASK_SPLINE_OFFSET_SMOOTH,
+ "SMOOTH",
+ 0,
+ "Smooth",
+ "Calculate feather offset as a second curve"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_maskSplinePoint(brna);
+
+ srna = RNA_def_struct(brna, "MaskSpline", NULL);
+ RNA_def_struct_ui_text(srna, "Mask spline", "Single spline used for defining mask shape");
+
+ /* offset mode */
+ prop = RNA_def_property(srna, "offset_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "offset_mode");
+ RNA_def_property_enum_items(prop, spline_offset_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Feather Offset", "The method used for calculating the feather offset");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* weight interpolation */
+ prop = RNA_def_property(srna, "weight_interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "weight_interp");
+ RNA_def_property_enum_items(prop, spline_interpolation_items);
+ RNA_def_property_ui_text(
+ prop, "Weight Interpolation", "The type of weight interpolation for spline");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+ /* cyclic */
+ prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_CYCLIC);
+ RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
+
+ /* fill */
+ prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_SPLINE_NOFILL);
+ RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
+
+ /* self-intersection check */
+ prop = RNA_def_property(srna, "use_self_intersection_check", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_NOINTERSECT);
+ RNA_def_property_ui_text(
+ prop, "Self Intersection Check", "Prevent feather from self-intersections");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, "rna_Mask_update_data");
+
+ prop = RNA_def_property(srna, "points", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MaskSplinePoint");
+ RNA_def_property_collection_sdna(prop, NULL, "points", "tot_point");
+ RNA_def_property_ui_text(prop, "Points", "Collection of points");
+ RNA_def_property_srna(prop, "MaskSplinePoints");
}
static void rna_def_mask_layer(BlenderRNA *brna)
{
- static const EnumPropertyItem masklay_blend_mode_items[] = {
- {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
- {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
- {MASK_BLEND_ADD, "ADD", 0, "Add", ""},
- {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
- {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
- {MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
- {MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
- {MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
- {MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_maskSpline(brna);
- rna_def_mask_splines(brna);
- rna_def_maskSplinePoints(brna);
-
- srna = RNA_def_struct(brna, "MaskLayer", NULL);
- RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
- RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
-
- /* name */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskLayer_name_set");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
- RNA_def_struct_name_property(srna, prop);
-
- /* splines */
- prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_MaskLayer_splines_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MaskSpline");
- RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
- RNA_def_property_srna(prop, "MaskSplines");
-
- /* restrict */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_VIEW);
- RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
- RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_SELECT);
- RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
- RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_RENDER);
- RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
-
- /* select (for dopesheet)*/
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_SELECT);
- RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
-// RNA_def_property_update(prop, NC_SCREEN | ND_MASK, NULL);
-
- /* render settings */
- prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
-
- /* weight interpolation */
- prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "blend");
- RNA_def_property_enum_items(prop, masklay_blend_mode_items);
- RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
- RNA_def_property_update(prop, 0, "rna_Mask_update_data");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MASK_BLENDFLAG_INVERT);
- RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "falloff");
- RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
- RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
-
- /* filling options */
- prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_DISCRETE);
- RNA_def_property_ui_text(prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "use_fill_overlap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_OVERLAP);
- RNA_def_property_ui_text(prop, "Calculate Overlap", "Calculate self intersections and overlap before filling");
- RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+ static const EnumPropertyItem masklay_blend_mode_items[] = {
+ {MASK_BLEND_MERGE_ADD, "MERGE_ADD", 0, "Merge Add", ""},
+ {MASK_BLEND_MERGE_SUBTRACT, "MERGE_SUBTRACT", 0, "Merge Subtract", ""},
+ {MASK_BLEND_ADD, "ADD", 0, "Add", ""},
+ {MASK_BLEND_SUBTRACT, "SUBTRACT", 0, "Subtract", ""},
+ {MASK_BLEND_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
+ {MASK_BLEND_DARKEN, "DARKEN", 0, "Darken", ""},
+ {MASK_BLEND_MUL, "MUL", 0, "Multiply", ""},
+ {MASK_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
+ {MASK_BLEND_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_maskSpline(brna);
+ rna_def_mask_splines(brna);
+ rna_def_maskSplinePoints(brna);
+
+ srna = RNA_def_struct(brna, "MaskLayer", NULL);
+ RNA_def_struct_ui_text(srna, "Mask Layer", "Single layer used for masking pixels");
+ RNA_def_struct_path_func(srna, "rna_MaskLayer_path");
+
+ /* name */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique name of layer");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskLayer_name_set");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* splines */
+ prop = RNA_def_property(srna, "splines", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_MaskLayer_splines_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MaskSpline");
+ RNA_def_property_ui_text(prop, "Splines", "Collection of splines which defines this layer");
+ RNA_def_property_srna(prop, "MaskSplines");
+
+ /* restrict */
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_VIEW);
+ RNA_def_property_ui_text(prop, "Restrict View", "Restrict visibility in the viewport");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
+ RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_SELECT);
+ RNA_def_property_ui_text(prop, "Restrict Select", "Restrict selection in the viewport");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
+ RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", MASK_RESTRICT_RENDER);
+ RNA_def_property_ui_text(prop, "Restrict Render", "Restrict renderability");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
+ /* select (for dopesheet)*/
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet");
+ // RNA_def_property_update(prop, NC_SCREEN | ND_MASK, NULL);
+
+ /* render settings */
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Opacity", "Render Opacity");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
+ /* weight interpolation */
+ prop = RNA_def_property(srna, "blend", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blend");
+ RNA_def_property_enum_items(prop, masklay_blend_mode_items);
+ RNA_def_property_ui_text(prop, "Blend", "Method of blending mask layers");
+ RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MASK_BLENDFLAG_INVERT);
+ RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "falloff");
+ RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
+ RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
+ /* filling options */
+ prop = RNA_def_property(srna, "use_fill_holes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_DISCRETE);
+ RNA_def_property_ui_text(
+ prop, "Calculate Holes", "Calculate holes when filling overlapping curves");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "use_fill_overlap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_FILL_OVERLAP);
+ RNA_def_property_ui_text(
+ prop, "Calculate Overlap", "Calculate self intersections and overlap before filling");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
}
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MaskLayers");
- srna = RNA_def_struct(brna, "MaskLayers", NULL);
- RNA_def_struct_sdna(srna, "Mask");
- RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
-
- func = RNA_def_function(srna, "new", "rna_Mask_layers_new");
- RNA_def_function_ui_description(func, "Add layer to this mask");
- RNA_def_string(func, "name", NULL, 0, "Name", "Name of new layer");
- parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove layer from this mask");
- parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* clear all layers */
- func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
- RNA_def_function_ui_description(func, "Remove all mask layers");
-
- /* active layer */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MaskLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MaskLayers");
+ srna = RNA_def_struct(brna, "MaskLayers", NULL);
+ RNA_def_struct_sdna(srna, "Mask");
+ RNA_def_struct_ui_text(srna, "Mask Layers", "Collection of layers used by mask");
+
+ func = RNA_def_function(srna, "new", "rna_Mask_layers_new");
+ RNA_def_function_ui_description(func, "Add layer to this mask");
+ RNA_def_string(func, "name", NULL, 0, "Name", "Name of new layer");
+ parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "New mask layer");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Mask_layers_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove layer from this mask");
+ parm = RNA_def_pointer(func, "layer", "MaskLayer", "", "Shape to be removed");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* clear all layers */
+ func = RNA_def_function(srna, "clear", "rna_Mask_layers_clear");
+ RNA_def_function_ui_description(func, "Remove all mask layers");
+
+ /* active layer */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MaskLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Mask_layer_active_get", "rna_Mask_layer_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Shape", "Active layer in this mask");
}
static void rna_def_mask(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_mask_layer(brna);
-
- srna = RNA_def_struct(brna, "Mask", "ID");
- RNA_def_struct_ui_text(srna, "Mask", "Mask data-block defining mask for compositing");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
-
- /* mask layers */
- prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_Mask_layers_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end", "rna_iterator_listbase_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MaskLayer");
- RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
- rna_def_masklayers(brna, prop);
-
- /* active masklay index */
- prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "masklay_act");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_Mask_layer_active_index_get", "rna_Mask_layer_active_index_set", "rna_Mask_layer_active_index_range");
- RNA_def_property_ui_text(prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
- RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
-
- /* frame range */
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "sfra");
- RNA_def_property_int_funcs(prop, NULL, "rna_Mask_start_frame_set", NULL);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
- RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "efra");
- RNA_def_property_int_funcs(prop, NULL, "rna_Mask_end_frame_set", NULL);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
- RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
-
- /* pointers */
- rna_def_animdata_common(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_mask_layer(brna);
+
+ srna = RNA_def_struct(brna, "Mask", "ID");
+ RNA_def_struct_ui_text(srna, "Mask", "Mask data-block defining mask for compositing");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
+
+ /* mask layers */
+ prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mask_layers_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MaskLayer");
+ RNA_def_property_ui_text(prop, "Layers", "Collection of layers which defines this mask");
+ rna_def_masklayers(brna, prop);
+
+ /* active masklay index */
+ prop = RNA_def_property(srna, "active_layer_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "masklay_act");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_Mask_layer_active_index_get",
+ "rna_Mask_layer_active_index_set",
+ "rna_Mask_layer_active_index_range");
+ RNA_def_property_ui_text(
+ prop, "Active Shape Index", "Index of active layer in list of all mask's layers");
+ RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
+
+ /* frame range */
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "sfra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Mask_start_frame_set", NULL);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Start Frame", "First frame of the mask (used for sequencer)");
+ RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "efra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Mask_end_frame_set", NULL);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "End Frame", "Final frame of the mask (used for sequencer)");
+ RNA_def_property_update(prop, NC_MASK | ND_DRAW, NULL);
+
+ /* pointers */
+ rna_def_animdata_common(srna);
}
void RNA_def_mask(BlenderRNA *brna)
{
- rna_def_maskParent(brna);
- rna_def_mask(brna);
+ rna_def_maskParent(brna);
+ rna_def_mask(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_material.c b/source/blender/makesrna/intern/rna_material.c
index a57f47a8090..8fb26e47913 100644
--- a/source/blender/makesrna/intern/rna_material.c
+++ b/source/blender/makesrna/intern/rna_material.c
@@ -33,875 +33,969 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_ramp_blend_items[] = {
- {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
- {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
- {MA_RAMP_BURN, "BURN", 0, "Burn", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
- {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
- {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""},
- {MA_RAMP_ADD, "ADD", 0, "Add", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
- {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
- {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
- {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
- {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
- {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
- {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
- {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
- {0, NULL, 0, NULL, NULL},
+ {MA_RAMP_BLEND, "MIX", 0, "Mix", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MA_RAMP_DARK, "DARKEN", 0, "Darken", ""},
+ {MA_RAMP_MULT, "MULTIPLY", 0, "Multiply", ""},
+ {MA_RAMP_BURN, "BURN", 0, "Burn", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MA_RAMP_LIGHT, "LIGHTEN", 0, "Lighten", ""},
+ {MA_RAMP_SCREEN, "SCREEN", 0, "Screen", ""},
+ {MA_RAMP_DODGE, "DODGE", 0, "Dodge", ""},
+ {MA_RAMP_ADD, "ADD", 0, "Add", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MA_RAMP_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {MA_RAMP_SOFT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {MA_RAMP_LINEAR, "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MA_RAMP_DIFF, "DIFFERENCE", 0, "Difference", ""},
+ {MA_RAMP_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {MA_RAMP_DIV, "DIVIDE", 0, "Divide", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MA_RAMP_HUE, "HUE", 0, "Hue", ""},
+ {MA_RAMP_SAT, "SATURATION", 0, "Saturation", ""},
+ {MA_RAMP_COLOR, "COLOR", 0, "Color", ""},
+ {MA_RAMP_VAL, "VALUE", 0, "Value", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
+# include "DNA_node_types.h"
+# include "DNA_object_types.h"
+# include "DNA_screen_types.h"
+# include "DNA_space_types.h"
-#include "BKE_colorband.h"
-#include "BKE_context.h"
-#include "BKE_main.h"
-#include "BKE_gpencil.h"
-#include "BKE_material.h"
-#include "BKE_texture.h"
-#include "BKE_node.h"
-#include "BKE_paint.h"
-#include "BKE_scene.h"
-#include "BKE_workspace.h"
+# include "BKE_colorband.h"
+# include "BKE_context.h"
+# include "BKE_main.h"
+# include "BKE_gpencil.h"
+# include "BKE_material.h"
+# include "BKE_texture.h"
+# include "BKE_node.h"
+# include "BKE_paint.h"
+# include "BKE_scene.h"
+# include "BKE_workspace.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "ED_node.h"
-#include "ED_image.h"
-#include "ED_screen.h"
-#include "ED_gpencil.h"
+# include "ED_node.h"
+# include "ED_image.h"
+# include "ED_screen.h"
+# include "ED_gpencil.h"
static void rna_Material_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Material *ma = ptr->id.data;
+ Material *ma = ptr->id.data;
- DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
}
-static void rna_Material_update_previews(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Material_update_previews(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Material *ma = ptr->id.data;
+ Material *ma = ptr->id.data;
- if (ma->nodetree)
- BKE_node_preview_clear_tree(ma->nodetree);
+ if (ma->nodetree)
+ BKE_node_preview_clear_tree(ma->nodetree);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_PREVIEW, ma);
}
static void rna_MaterialGpencil_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Material *ma = ptr->id.data;
+ Material *ma = ptr->id.data;
- rna_Material_update(bmain, scene, ptr);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
+ rna_Material_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
}
static void rna_MaterialGpencil_nopreview_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Material *ma = ptr->id.data;
+ Material *ma = ptr->id.data;
- rna_Material_update(bmain, scene, ptr);
- WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
+ rna_Material_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_GPENCIL | ND_DATA, ma);
}
static void rna_Material_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Material *ma = ptr->id.data;
+ Material *ma = ptr->id.data;
- DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, ma);
}
static void rna_Material_texpaint_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Material *ma = (Material *)ptr->data;
- rna_iterator_array_begin(iter, (void *)ma->texpaintslot, sizeof(TexPaintSlot), ma->tot_slots, 0, NULL);
+ Material *ma = (Material *)ptr->data;
+ rna_iterator_array_begin(
+ iter, (void *)ma->texpaintslot, sizeof(TexPaintSlot), ma->tot_slots, 0, NULL);
}
-
-static void rna_Material_active_paint_texture_index_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Material_active_paint_texture_index_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- bScreen *sc;
- Material *ma = ptr->id.data;
-
- if (ma->use_nodes && ma->nodetree) {
- struct bNode *node;
- int index = 0;
- for (node = ma->nodetree->nodes.first; node; node = node->next) {
- if (node->typeinfo->nclass == NODE_CLASS_TEXTURE && node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) {
- if (index++ == ma->paint_active_slot) {
- break;
- }
- }
- }
- if (node)
- nodeSetActive(ma->nodetree, node);
- }
-
- if (ma->texpaintslot) {
- Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
- for (sc = bmain->screens.first; sc; sc = sc->id.next) {
- wmWindow *win = ED_screen_window_find(sc, bmain->wm.first);
- if (win == NULL) {
- continue;
- }
-
- Object *obedit = NULL;
- {
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
- }
-
- ScrArea *sa;
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- SpaceLink *sl;
- for (sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_IMAGE) {
- SpaceImage *sima = (SpaceImage *)sl;
- if (!sima->pin) {
- ED_space_image_set(bmain, sima, obedit, image, true);
- }
- }
- }
- }
- }
- }
-
- DEG_id_tag_update(&ma->id, 0);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
+ bScreen *sc;
+ Material *ma = ptr->id.data;
+
+ if (ma->use_nodes && ma->nodetree) {
+ struct bNode *node;
+ int index = 0;
+ for (node = ma->nodetree->nodes.first; node; node = node->next) {
+ if (node->typeinfo->nclass == NODE_CLASS_TEXTURE &&
+ node->typeinfo->type == SH_NODE_TEX_IMAGE && node->id) {
+ if (index++ == ma->paint_active_slot) {
+ break;
+ }
+ }
+ }
+ if (node)
+ nodeSetActive(ma->nodetree, node);
+ }
+
+ if (ma->texpaintslot) {
+ Image *image = ma->texpaintslot[ma->paint_active_slot].ima;
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
+ wmWindow *win = ED_screen_window_find(sc, bmain->wm.first);
+ if (win == NULL) {
+ continue;
+ }
+
+ Object *obedit = NULL;
+ {
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ }
+
+ ScrArea *sa;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ SpaceLink *sl;
+ for (sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)sl;
+ if (!sima->pin) {
+ ED_space_image_set(bmain, sima, obedit, image, true);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ DEG_id_tag_update(&ma->id, 0);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING, ma);
}
static void rna_Material_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- Material *ma = (Material *)ptr->data;
- Main *bmain = CTX_data_main(C);
+ Material *ma = (Material *)ptr->data;
+ Main *bmain = CTX_data_main(C);
- if (ma->use_nodes && ma->nodetree == NULL)
- ED_node_shader_default(C, &ma->id);
+ if (ma->use_nodes && ma->nodetree == NULL)
+ ED_node_shader_default(C, &ma->id);
- DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- rna_Material_draw_update(bmain, CTX_data_scene(C), ptr);
+ DEG_id_tag_update(&ma->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ rna_Material_draw_update(bmain, CTX_data_scene(C), ptr);
}
MTex *rna_mtex_texture_slots_add(ID *self_id, struct bContext *C, ReportList *reports)
{
- MTex *mtex = BKE_texture_mtex_add_id(self_id, -1);
- if (mtex == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX);
- return NULL;
- }
+ MTex *mtex = BKE_texture_mtex_add_id(self_id, -1);
+ if (mtex == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "Maximum number of textures added %d", MAX_MTEX);
+ return NULL;
+ }
- /* for redraw only */
- WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
+ /* for redraw only */
+ WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
- return mtex;
+ return mtex;
}
-MTex *rna_mtex_texture_slots_create(ID *self_id, struct bContext *C, ReportList *reports, int index)
+MTex *rna_mtex_texture_slots_create(ID *self_id,
+ struct bContext *C,
+ ReportList *reports,
+ int index)
{
- MTex *mtex;
+ MTex *mtex;
- if (index < 0 || index >= MAX_MTEX) {
- BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
- return NULL;
- }
+ if (index < 0 || index >= MAX_MTEX) {
+ BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
+ return NULL;
+ }
- mtex = BKE_texture_mtex_add_id(self_id, index);
+ mtex = BKE_texture_mtex_add_id(self_id, index);
- /* for redraw only */
- WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
+ /* for redraw only */
+ WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
- return mtex;
+ return mtex;
}
void rna_mtex_texture_slots_clear(ID *self_id, struct bContext *C, ReportList *reports, int index)
{
- MTex **mtex_ar;
- short act;
-
- give_active_mtex(self_id, &mtex_ar, &act);
-
- if (mtex_ar == NULL) {
- BKE_report(reports, RPT_ERROR, "Mtex not found for this type");
- return;
- }
-
- if (index < 0 || index >= MAX_MTEX) {
- BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
- return;
- }
-
- if (mtex_ar[index]) {
- id_us_min((ID *)mtex_ar[index]->tex);
- MEM_freeN(mtex_ar[index]);
- mtex_ar[index] = NULL;
- DEG_id_tag_update(self_id, 0);
- }
-
- /* for redraw only */
- WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
+ MTex **mtex_ar;
+ short act;
+
+ give_active_mtex(self_id, &mtex_ar, &act);
+
+ if (mtex_ar == NULL) {
+ BKE_report(reports, RPT_ERROR, "Mtex not found for this type");
+ return;
+ }
+
+ if (index < 0 || index >= MAX_MTEX) {
+ BKE_reportf(reports, RPT_ERROR, "Index %d is invalid", index);
+ return;
+ }
+
+ if (mtex_ar[index]) {
+ id_us_min((ID *)mtex_ar[index]->tex);
+ MEM_freeN(mtex_ar[index]);
+ mtex_ar[index] = NULL;
+ DEG_id_tag_update(self_id, 0);
+ }
+
+ /* for redraw only */
+ WM_event_add_notifier(C, NC_TEXTURE, CTX_data_scene(C));
}
static void rna_TexPaintSlot_uv_layer_get(PointerRNA *ptr, char *value)
{
- TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
-
- if (data->uvname != NULL) {
- BLI_strncpy_utf8(value, data->uvname, 64);
- }
- else {
- value[0] = '\0';
- }
+ TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
+
+ if (data->uvname != NULL) {
+ BLI_strncpy_utf8(value, data->uvname, 64);
+ }
+ else {
+ value[0] = '\0';
+ }
}
static int rna_TexPaintSlot_uv_layer_length(PointerRNA *ptr)
{
- TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
- return data->uvname == NULL ? 0 : strlen(data->uvname);
+ TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
+ return data->uvname == NULL ? 0 : strlen(data->uvname);
}
static void rna_TexPaintSlot_uv_layer_set(PointerRNA *ptr, const char *value)
{
- TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
+ TexPaintSlot *data = (TexPaintSlot *)(ptr->data);
- if (data->uvname != NULL) {
- BLI_strncpy_utf8(data->uvname, value, 64);
- }
+ if (data->uvname != NULL) {
+ BLI_strncpy_utf8(data->uvname, value, 64);
+ }
}
static bool rna_is_grease_pencil_get(PointerRNA *ptr)
{
- Material *ma = (Material *)ptr->data;
- if (ma->gp_style != NULL)
- return true;
+ Material *ma = (Material *)ptr->data;
+ if (ma->gp_style != NULL)
+ return true;
- return false;
+ return false;
}
static void rna_gpcolordata_uv_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- /* update all uv strokes of this color */
- Material *ma = ptr->id.data;
- ED_gpencil_update_color_uv(bmain, ma);
+ /* update all uv strokes of this color */
+ Material *ma = ptr->id.data;
+ ED_gpencil_update_color_uv(bmain, ma);
- rna_MaterialGpencil_update(bmain, scene, ptr);
+ rna_MaterialGpencil_update(bmain, scene, ptr);
}
static char *rna_GpencilColorData_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("grease_pencil");
+ return BLI_strdup("grease_pencil");
}
static int rna_GpencilColorData_is_stroke_visible_get(PointerRNA *ptr)
{
- MaterialGPencilStyle *pcolor = ptr->data;
- return (pcolor->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH);
+ MaterialGPencilStyle *pcolor = ptr->data;
+ return (pcolor->stroke_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH);
}
static int rna_GpencilColorData_is_fill_visible_get(PointerRNA *ptr)
{
- MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
- return ((pcolor->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (pcolor->fill_style > 0));
+ MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
+ return ((pcolor->fill_rgba[3] > GPENCIL_ALPHA_OPACITY_THRESH) || (pcolor->fill_style > 0));
}
static void rna_GpencilColorData_stroke_image_set(PointerRNA *ptr, PointerRNA value)
{
- MaterialGPencilStyle *pcolor = ptr->data;
- ID *id = value.data;
+ MaterialGPencilStyle *pcolor = ptr->data;
+ ID *id = value.data;
- id_us_plus(id);
- pcolor->sima = (struct Image *)id;
+ id_us_plus(id);
+ pcolor->sima = (struct Image *)id;
}
static void rna_GpencilColorData_fill_image_set(PointerRNA *ptr, PointerRNA value)
{
- MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
- ID *id = value.data;
+ MaterialGPencilStyle *pcolor = (MaterialGPencilStyle *)ptr->data;
+ ID *id = value.data;
- id_us_plus(id);
- pcolor->ima = (struct Image *)id;
+ id_us_plus(id);
+ pcolor->ima = (struct Image *)id;
}
#else
static void rna_def_material_display(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "specr");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "roughness");
- RNA_def_property_float_default(prop, 0.25f);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Roughness", "Roughness of the material");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "spec");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Specular", "How intense (bright) the specular reflection is");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "metallic", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "metallic");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Metallic", "Amount of mirror reflection for raytrace");
- RNA_def_property_update(prop, 0, "rna_Material_update");
-
- /* Freestyle line color */
- prop = RNA_def_property(srna, "line_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "line_col");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Line Color", "Line color used for Freestyle line rendering");
- RNA_def_property_update(prop, 0, "rna_Material_update");
-
- prop = RNA_def_property(srna, "line_priority", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "line_priority");
- RNA_def_property_range(prop, 0, 32767);
- RNA_def_property_ui_text(prop, "Line Priority",
- "The line color of a higher priority is used at material boundaries");
- RNA_def_property_update(prop, 0, "rna_Material_update");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Diffuse Color", "Diffuse color of the material");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "specr");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Specular Color", "Specular color of the material");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "roughness", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "roughness");
+ RNA_def_property_float_default(prop, 0.25f);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Roughness", "Roughness of the material");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "specular_intensity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "spec");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Specular", "How intense (bright) the specular reflection is");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "metallic", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "metallic");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Metallic", "Amount of mirror reflection for raytrace");
+ RNA_def_property_update(prop, 0, "rna_Material_update");
+
+ /* Freestyle line color */
+ prop = RNA_def_property(srna, "line_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "line_col");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Line Color", "Line color used for Freestyle line rendering");
+ RNA_def_property_update(prop, 0, "rna_Material_update");
+
+ prop = RNA_def_property(srna, "line_priority", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "line_priority");
+ RNA_def_property_range(prop, 0, 32767);
+ RNA_def_property_ui_text(
+ prop, "Line Priority", "The line color of a higher priority is used at material boundaries");
+ RNA_def_property_update(prop, 0, "rna_Material_update");
}
static void rna_def_material_greasepencil(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* mode type styles */
- static EnumPropertyItem gpcolordata_mode_types_items[] = {
- {GP_STYLE_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line"},
- {GP_STYLE_MODE_DOTS, "DOTS", 0, "Dots", "Draw strokes using separated dots"},
- {GP_STYLE_MODE_BOX, "BOX", 0, "Boxes", "Draw strokes using separated rectangle boxes"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* stroke styles */
- static EnumPropertyItem stroke_style_items[] = {
- {GP_STYLE_STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color"},
- {GP_STYLE_STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* fill styles */
- static EnumPropertyItem fill_style_items[] = {
- {GP_STYLE_FILL_STYLE_SOLID, "SOLID", 0, "Solid", "Fill area with solid color"},
- {GP_STYLE_FILL_STYLE_GRADIENT, "GRADIENT", 0, "Gradient", "Fill area with gradient color"},
- {GP_STYLE_FILL_STYLE_CHESSBOARD, "CHESSBOARD", 0, "Checker Board", "Fill area with chessboard pattern"},
- {GP_STYLE_FILL_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Fill area with image texture"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem fill_gradient_items[] = {
- {GP_STYLE_GRADIENT_LINEAR, "LINEAR", 0, "Linear", "Fill area with gradient color"},
- {GP_STYLE_GRADIENT_RADIAL, "RADIAL", 0, "Radial", "Fill area with radial gradient"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MaterialGPencilStyle", NULL);
- RNA_def_struct_sdna(srna, "MaterialGPencilStyle");
- RNA_def_struct_ui_text(srna, "Grease Pencil Color", "");
- RNA_def_struct_path_func(srna, "rna_GpencilColorData_path");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "stroke_rgba");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Color", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Fill Drawing Color */
- prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "fill_rgba");
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Secondary Drawing Color */
- prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "mix_rgba");
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Mix Color", "Color for mixing with primary filling color");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Mix factor */
- prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mix_factor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Mix", "Mix Adjustment Factor");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Scale factor for uv coordinates */
- prop = RNA_def_property(srna, "pattern_scale", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "gradient_scale");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Scale", "Scale Factor for UV coordinates");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Shift factor to move pattern filling in 2d space */
- prop = RNA_def_property(srna, "pattern_shift", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "gradient_shift");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Shift", "Shift filling pattern in 2d space");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Gradient angle */
- prop = RNA_def_property(srna, "pattern_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "gradient_angle");
- RNA_def_property_ui_text(prop, "Angle", "Pattern Orientation Angle");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Gradient radius */
- prop = RNA_def_property(srna, "pattern_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "gradient_radius");
- RNA_def_property_range(prop, 0.0001f, 10.0f);
- RNA_def_property_ui_text(prop, "Radius", "Pattern Radius");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Box size */
- prop = RNA_def_property(srna, "pattern_gridsize", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pattern_gridsize");
- RNA_def_property_range(prop, 0.0001f, 10.0f);
- RNA_def_property_ui_text(prop, "Size", "Box Size");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Texture angle */
- prop = RNA_def_property(srna, "texture_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "texture_angle");
- RNA_def_property_ui_text(prop, "Angle", "Texture Orientation Angle");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Scale factor for texture */
- prop = RNA_def_property(srna, "texture_scale", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "texture_scale");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Scale", "Scale Factor for Texture");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Shift factor to move texture in 2d space */
- prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_float_sdna(prop, NULL, "texture_offset");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Offset", "Shift Texture in 2d Space");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Texture opacity size */
- prop = RNA_def_property(srna, "texture_opacity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "texture_opacity");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Opacity", "Texture Opacity");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* texture pixsize factor (used for UV along the stroke) */
- prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "texture_pixsize");
- RNA_def_property_range(prop, 1, 5000);
- RNA_def_property_ui_text(prop, "UV Factor", "Texture Pixel Size factor along the stroke");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_gpcolordata_uv_update");
-
- /* Flags */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_HIDE);
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
- RNA_def_property_ui_text(prop, "Hide", "Set color Visibility");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_LOCKED);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_ui_text(prop, "Locked", "Protect color from further editing and/or frame changes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
-
- prop = RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_ONIONSKIN);
- RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
- RNA_def_property_ui_text(prop, "Show in Ghosts", "Display strokes using this color when showing onion skins");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
-
- prop = RNA_def_property(srna, "texture_clamp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_TEX_CLAMP);
- RNA_def_property_ui_text(prop, "Clamp", "Do not repeat texture and clamp to one instance only");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- prop = RNA_def_property(srna, "texture_mix", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_TEX_MIX);
- RNA_def_property_ui_text(prop, "Mix Texture", "Mix texture image with filling colors");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- prop = RNA_def_property(srna, "flip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_FLIP_FILL);
- RNA_def_property_ui_text(prop, "Flip", "Flip filling colors");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- prop = RNA_def_property(srna, "use_stroke_pattern", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_PATTERN);
- RNA_def_property_ui_text(prop, "Pattern", "Use Stroke Texture as a pattern to apply color");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- prop = RNA_def_property(srna, "use_fill_pattern", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_PATTERN);
- RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to apply color");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_SHOW);
- RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_SHOW);
- RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* keep Dots and Boxes aligned to screen and not to drawing path */
- prop = RNA_def_property(srna, "use_follow_path", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_STYLE_COLOR_LOCK_DOTS);
- RNA_def_property_ui_text(prop, "Follow Path",
- "Keep Dots and Boxes aligned to drawing path");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
-
- /* pass index for future compositing and editing tools */
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "index");
- RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Color Index\" pass");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
-
- /* mode type */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, gpcolordata_mode_types_items);
- RNA_def_property_ui_text(prop, "Mode Type", "Select draw mode for stroke");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* stroke style */
- prop = RNA_def_property(srna, "stroke_style", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "stroke_style");
- RNA_def_property_enum_items(prop, stroke_style_items);
- RNA_def_property_ui_text(prop, "Stroke Style", "Select style used to draw strokes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* stroke image texture */
- prop = RNA_def_property(srna, "stroke_image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "sima");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_stroke_image_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* fill style */
- prop = RNA_def_property(srna, "fill_style", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "fill_style");
- RNA_def_property_enum_items(prop, fill_style_items);
- RNA_def_property_ui_text(prop, "Fill Style", "Select style used to fill strokes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* gradient type */
- prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gradient_type");
- RNA_def_property_enum_items(prop, fill_gradient_items);
- RNA_def_property_ui_text(prop, "Gradient Type", "Select type of gradient used to fill strokes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* fill image texture */
- prop = RNA_def_property(srna, "fill_image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ima");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_fill_image_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
-
- /* Read-only state props (for simpler UI code) */
- prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_stroke_visible_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
-
- prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_fill_visible_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* mode type styles */
+ static EnumPropertyItem gpcolordata_mode_types_items[] = {
+ {GP_STYLE_MODE_LINE, "LINE", 0, "Line", "Draw strokes using a continuous line"},
+ {GP_STYLE_MODE_DOTS, "DOTS", 0, "Dots", "Draw strokes using separated dots"},
+ {GP_STYLE_MODE_BOX, "BOX", 0, "Boxes", "Draw strokes using separated rectangle boxes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* stroke styles */
+ static EnumPropertyItem stroke_style_items[] = {
+ {GP_STYLE_STROKE_STYLE_SOLID, "SOLID", 0, "Solid", "Draw strokes with solid color"},
+ {GP_STYLE_STROKE_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Draw strokes using texture"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* fill styles */
+ static EnumPropertyItem fill_style_items[] = {
+ {GP_STYLE_FILL_STYLE_SOLID, "SOLID", 0, "Solid", "Fill area with solid color"},
+ {GP_STYLE_FILL_STYLE_GRADIENT, "GRADIENT", 0, "Gradient", "Fill area with gradient color"},
+ {GP_STYLE_FILL_STYLE_CHESSBOARD,
+ "CHESSBOARD",
+ 0,
+ "Checker Board",
+ "Fill area with chessboard pattern"},
+ {GP_STYLE_FILL_STYLE_TEXTURE, "TEXTURE", 0, "Texture", "Fill area with image texture"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem fill_gradient_items[] = {
+ {GP_STYLE_GRADIENT_LINEAR, "LINEAR", 0, "Linear", "Fill area with gradient color"},
+ {GP_STYLE_GRADIENT_RADIAL, "RADIAL", 0, "Radial", "Fill area with radial gradient"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MaterialGPencilStyle", NULL);
+ RNA_def_struct_sdna(srna, "MaterialGPencilStyle");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Color", "");
+ RNA_def_struct_path_func(srna, "rna_GpencilColorData_path");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "stroke_rgba");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Color", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Fill Drawing Color */
+ prop = RNA_def_property(srna, "fill_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "fill_rgba");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Fill Color", "Color for filling region bounded by each stroke");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Secondary Drawing Color */
+ prop = RNA_def_property(srna, "mix_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "mix_rgba");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Mix Color", "Color for mixing with primary filling color");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Mix factor */
+ prop = RNA_def_property(srna, "mix_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mix_factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Mix", "Mix Adjustment Factor");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Scale factor for uv coordinates */
+ prop = RNA_def_property(srna, "pattern_scale", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_scale");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Scale", "Scale Factor for UV coordinates");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Shift factor to move pattern filling in 2d space */
+ prop = RNA_def_property(srna, "pattern_shift", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_shift");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Shift", "Shift filling pattern in 2d space");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Gradient angle */
+ prop = RNA_def_property(srna, "pattern_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_angle");
+ RNA_def_property_ui_text(prop, "Angle", "Pattern Orientation Angle");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Gradient radius */
+ prop = RNA_def_property(srna, "pattern_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gradient_radius");
+ RNA_def_property_range(prop, 0.0001f, 10.0f);
+ RNA_def_property_ui_text(prop, "Radius", "Pattern Radius");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Box size */
+ prop = RNA_def_property(srna, "pattern_gridsize", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pattern_gridsize");
+ RNA_def_property_range(prop, 0.0001f, 10.0f);
+ RNA_def_property_ui_text(prop, "Size", "Box Size");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Texture angle */
+ prop = RNA_def_property(srna, "texture_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "texture_angle");
+ RNA_def_property_ui_text(prop, "Angle", "Texture Orientation Angle");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Scale factor for texture */
+ prop = RNA_def_property(srna, "texture_scale", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "texture_scale");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Scale", "Scale Factor for Texture");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Shift factor to move texture in 2d space */
+ prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_float_sdna(prop, NULL, "texture_offset");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Offset", "Shift Texture in 2d Space");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Texture opacity size */
+ prop = RNA_def_property(srna, "texture_opacity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "texture_opacity");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Opacity", "Texture Opacity");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* texture pixsize factor (used for UV along the stroke) */
+ prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "texture_pixsize");
+ RNA_def_property_range(prop, 1, 5000);
+ RNA_def_property_ui_text(prop, "UV Factor", "Texture Pixel Size factor along the stroke");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_gpcolordata_uv_update");
+
+ /* Flags */
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_HIDE);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_ui_text(prop, "Hide", "Set color Visibility");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_LOCKED);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_ui_text(
+ prop, "Locked", "Protect color from further editing and/or frame changes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
+
+ prop = RNA_def_property(srna, "ghost", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_ONIONSKIN);
+ RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
+ RNA_def_property_ui_text(
+ prop, "Show in Ghosts", "Display strokes using this color when showing onion skins");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
+
+ prop = RNA_def_property(srna, "texture_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_TEX_CLAMP);
+ RNA_def_property_ui_text(prop, "Clamp", "Do not repeat texture and clamp to one instance only");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "texture_mix", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_TEX_MIX);
+ RNA_def_property_ui_text(prop, "Mix Texture", "Mix texture image with filling colors");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "flip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_COLOR_FLIP_FILL);
+ RNA_def_property_ui_text(prop, "Flip", "Flip filling colors");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "use_stroke_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_PATTERN);
+ RNA_def_property_ui_text(prop, "Pattern", "Use Stroke Texture as a pattern to apply color");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "use_fill_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_PATTERN);
+ RNA_def_property_ui_text(prop, "Pattern", "Use Fill Texture as a pattern to apply color");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "show_stroke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_STROKE_SHOW);
+ RNA_def_property_ui_text(prop, "Show Stroke", "Show stroke lines of this material");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ prop = RNA_def_property(srna, "show_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_STYLE_FILL_SHOW);
+ RNA_def_property_ui_text(prop, "Show Fill", "Show stroke fills of this material");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* keep Dots and Boxes aligned to screen and not to drawing path */
+ prop = RNA_def_property(srna, "use_follow_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GP_STYLE_COLOR_LOCK_DOTS);
+ RNA_def_property_ui_text(prop, "Follow Path", "Keep Dots and Boxes aligned to drawing path");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
+
+ /* pass index for future compositing and editing tools */
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Color Index\" pass");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_nopreview_update");
+
+ /* mode type */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, gpcolordata_mode_types_items);
+ RNA_def_property_ui_text(prop, "Mode Type", "Select draw mode for stroke");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* stroke style */
+ prop = RNA_def_property(srna, "stroke_style", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "stroke_style");
+ RNA_def_property_enum_items(prop, stroke_style_items);
+ RNA_def_property_ui_text(prop, "Stroke Style", "Select style used to draw strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* stroke image texture */
+ prop = RNA_def_property(srna, "stroke_image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "sima");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_stroke_image_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* fill style */
+ prop = RNA_def_property(srna, "fill_style", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "fill_style");
+ RNA_def_property_enum_items(prop, fill_style_items);
+ RNA_def_property_ui_text(prop, "Fill Style", "Select style used to fill strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* gradient type */
+ prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gradient_type");
+ RNA_def_property_enum_items(prop, fill_gradient_items);
+ RNA_def_property_ui_text(prop, "Gradient Type", "Select type of gradient used to fill strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* fill image texture */
+ prop = RNA_def_property(srna, "fill_image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ima");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_GpencilColorData_fill_image_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_SHADING, "rna_MaterialGpencil_update");
+
+ /* Read-only state props (for simpler UI code) */
+ prop = RNA_def_property(srna, "is_stroke_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_stroke_visible_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Is Stroke Visible", "True when opacity of stroke is set high enough to be visible");
+
+ prop = RNA_def_property(srna, "is_fill_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_GpencilColorData_is_fill_visible_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Is Fill Visible", "True when opacity of fill is set high enough to be visible");
}
void RNA_def_material(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* Render Preview Types */
- static const EnumPropertyItem preview_type_items[] = {
- {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"},
- {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"},
- {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"},
- {MA_HAIR, "HAIR", ICON_HAIR, "Hair", "Hair strands"},
- {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader Ball"},
- {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"},
- {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem prop_eevee_blend_items[] = {
- {MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
- {MA_BM_ADD, "ADD", 0, "Additive", "Render surface and blend the result with additive blending"},
- {MA_BM_MULTIPLY, "MULTIPLY", 0, "Multiply", "Render surface and blend the result with multiplicative blending"},
- {MA_BM_CLIP, "CLIP", 0, "Alpha Clip", "Use the alpha threshold to clip the visibility (binary visibility)"},
- {MA_BM_HASHED, "HASHED", 0, "Alpha Hashed", "Use noise to dither the binary visibility (works well with multi-samples)"},
- {MA_BM_BLEND, "BLEND", 0, "Alpha Blend", "Render polygon transparent, depending on alpha channel of the texture"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem prop_eevee_blend_shadow_items[] = {
- {MA_BS_NONE, "NONE", 0, "None", "Material will cast no shadow"},
- {MA_BS_SOLID, "OPAQUE", 0, "Opaque", "Material will cast shadows without transparency"},
- {MA_BS_CLIP, "CLIP", 0, "Alpha Clip", "Use the alpha threshold to clip the visibility (binary visibility)"},
- {MA_BS_HASHED, "HASHED", 0, "Alpha Hashed", "Use noise to dither the binary visibility and use filtering to reduce the noise"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Material", "ID");
- RNA_def_struct_ui_text(srna, "Material",
- "Material data-block to define the appearance of geometric objects for rendering");
- RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
-
- /* Blending (only Eevee for now) */
- prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_eevee_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, "shadow_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "blend_shadow");
- RNA_def_property_enum_items(prop, prop_eevee_blend_shadow_items);
- RNA_def_property_ui_text(prop, "Shadow Mode", "Shadow mapping method");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Clip Threshold", "A pixel is rendered only if its alpha value is above this threshold");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "blend_flag", MA_BL_HIDE_BACKFACE);
- RNA_def_property_ui_text(prop, "Show Backface", "Limit transparency to a single layer "
- "(avoids transparency sorting problems)");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MA_BL_SS_REFRACTION);
- RNA_def_property_ui_text(prop, "Screen Space Refraction", "Use raytraced screen space refractions");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MA_BL_TRANSLUCENCY);
- RNA_def_property_ui_text(prop, "Subsurface Translucency", "Add translucency effect to subsurface");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- prop = RNA_def_property(srna, "refraction_depth", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "refract_depth");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Refraction Depth", "Approximate the thickness of the object to compute two refraction "
- "event (0 is disabled)");
- RNA_def_property_update(prop, 0, "rna_Material_draw_update");
-
- /* For Preview Render */
- prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "pr_type");
- RNA_def_property_enum_items(prop, preview_type_items);
- RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
- RNA_def_property_update(prop, 0, "rna_Material_update_previews");
-
- prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pr_flag", MA_PREVIEW_WORLD);
- RNA_def_property_ui_text(prop, "Preview World", "Use the current world background to light the preview render");
- RNA_def_property_update(prop, 0, "rna_Material_update_previews");
-
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "index");
- RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Material Index\" render pass");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Material_update");
-
- /* nodetree */
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
-
- prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
- RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update");
-
- /* common */
- rna_def_animdata_common(srna);
- rna_def_texpaint_slots(brna, srna);
-
- rna_def_material_display(srna);
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gp_style");
- RNA_def_property_ui_text(prop, "Grease Pencil Settings", "Grease pencil color settings for material");
-
- prop = RNA_def_property(srna, "is_grease_pencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_is_grease_pencil_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Grease Pencil", "True if this material has grease pencil data");
-
- rna_def_material_greasepencil(brna);
-
-
- RNA_api_material(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* Render Preview Types */
+ static const EnumPropertyItem preview_type_items[] = {
+ {MA_FLAT, "FLAT", ICON_MATPLANE, "Flat", "Flat XY plane"},
+ {MA_SPHERE, "SPHERE", ICON_MATSPHERE, "Sphere", "Sphere"},
+ {MA_CUBE, "CUBE", ICON_MATCUBE, "Cube", "Cube"},
+ {MA_HAIR, "HAIR", ICON_HAIR, "Hair", "Hair strands"},
+ {MA_SHADERBALL, "SHADERBALL", ICON_MATSHADERBALL, "Shader Ball", "Shader Ball"},
+ {MA_CLOTH, "CLOTH", ICON_MATCLOTH, "Cloth", "Cloth"},
+ {MA_FLUID, "FLUID", ICON_MATFLUID, "Fluid", "Fluid"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_eevee_blend_items[] = {
+ {MA_BM_SOLID, "OPAQUE", 0, "Opaque", "Render surface without transparency"},
+ {MA_BM_ADD,
+ "ADD",
+ 0,
+ "Additive",
+ "Render surface and blend the result with additive blending"},
+ {MA_BM_MULTIPLY,
+ "MULTIPLY",
+ 0,
+ "Multiply",
+ "Render surface and blend the result with multiplicative blending"},
+ {MA_BM_CLIP,
+ "CLIP",
+ 0,
+ "Alpha Clip",
+ "Use the alpha threshold to clip the visibility (binary visibility)"},
+ {MA_BM_HASHED,
+ "HASHED",
+ 0,
+ "Alpha Hashed",
+ "Use noise to dither the binary visibility (works well with multi-samples)"},
+ {MA_BM_BLEND,
+ "BLEND",
+ 0,
+ "Alpha Blend",
+ "Render polygon transparent, depending on alpha channel of the texture"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_eevee_blend_shadow_items[] = {
+ {MA_BS_NONE, "NONE", 0, "None", "Material will cast no shadow"},
+ {MA_BS_SOLID, "OPAQUE", 0, "Opaque", "Material will cast shadows without transparency"},
+ {MA_BS_CLIP,
+ "CLIP",
+ 0,
+ "Alpha Clip",
+ "Use the alpha threshold to clip the visibility (binary visibility)"},
+ {MA_BS_HASHED,
+ "HASHED",
+ 0,
+ "Alpha Hashed",
+ "Use noise to dither the binary visibility and use filtering to reduce the noise"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Material", "ID");
+ RNA_def_struct_ui_text(
+ srna,
+ "Material",
+ "Material data-block to define the appearance of geometric objects for rendering");
+ RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
+
+ /* Blending (only Eevee for now) */
+ prop = RNA_def_property(srna, "blend_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_eevee_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, "shadow_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blend_shadow");
+ RNA_def_property_enum_items(prop, prop_eevee_blend_shadow_items);
+ RNA_def_property_ui_text(prop, "Shadow Mode", "Shadow mapping method");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "alpha_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop,
+ "Clip Threshold",
+ "A pixel is rendered only if its alpha value is above this threshold");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "show_transparent_back", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "blend_flag", MA_BL_HIDE_BACKFACE);
+ RNA_def_property_ui_text(prop,
+ "Show Backface",
+ "Limit transparency to a single layer "
+ "(avoids transparency sorting problems)");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "use_screen_refraction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MA_BL_SS_REFRACTION);
+ RNA_def_property_ui_text(
+ prop, "Screen Space Refraction", "Use raytraced screen space refractions");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "use_sss_translucency", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "blend_flag", MA_BL_TRANSLUCENCY);
+ RNA_def_property_ui_text(
+ prop, "Subsurface Translucency", "Add translucency effect to subsurface");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ prop = RNA_def_property(srna, "refraction_depth", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "refract_depth");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop,
+ "Refraction Depth",
+ "Approximate the thickness of the object to compute two refraction "
+ "event (0 is disabled)");
+ RNA_def_property_update(prop, 0, "rna_Material_draw_update");
+
+ /* For Preview Render */
+ prop = RNA_def_property(srna, "preview_render_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "pr_type");
+ RNA_def_property_enum_items(prop, preview_type_items);
+ RNA_def_property_ui_text(prop, "Preview Render Type", "Type of preview render");
+ RNA_def_property_update(prop, 0, "rna_Material_update_previews");
+
+ prop = RNA_def_property(srna, "use_preview_world", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pr_flag", MA_PREVIEW_WORLD);
+ RNA_def_property_ui_text(
+ prop, "Preview World", "Use the current world background to light the preview render");
+ RNA_def_property_update(prop, 0, "rna_Material_update_previews");
+
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_ui_text(
+ prop, "Pass Index", "Index number for the \"Material Index\" render pass");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Material_update");
+
+ /* nodetree */
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based materials");
+
+ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the material");
+ RNA_def_property_update(prop, 0, "rna_Material_use_nodes_update");
+
+ /* common */
+ rna_def_animdata_common(srna);
+ rna_def_texpaint_slots(brna, srna);
+
+ rna_def_material_display(srna);
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gp_style");
+ RNA_def_property_ui_text(
+ prop, "Grease Pencil Settings", "Grease pencil color settings for material");
+
+ prop = RNA_def_property(srna, "is_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_is_grease_pencil_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Is Grease Pencil", "True if this material has grease pencil data");
+
+ rna_def_material_greasepencil(brna);
+
+ RNA_api_material(srna);
}
-
-static void rna_def_texture_slots(BlenderRNA *brna, PropertyRNA *cprop, const char *structname,
+static void rna_def_texture_slots(BlenderRNA *brna,
+ PropertyRNA *cprop,
+ const char *structname,
const char *structname_slots)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, structname_slots);
- srna = RNA_def_struct(brna, structname_slots, NULL);
- RNA_def_struct_sdna(srna, "ID");
- RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
-
- /* functions */
- func = RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, structname_slots);
+ srna = RNA_def_struct(brna, structname_slots, NULL);
+ RNA_def_struct_sdna(srna, "ID");
+ RNA_def_struct_ui_text(srna, "Texture Slots", "Collection of texture slots");
+
+ /* functions */
+ func = RNA_def_function(srna, "add", "rna_mtex_texture_slots_add");
+ RNA_def_function_flag(func,
+ FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "create", "rna_mtex_texture_slots_create");
+ RNA_def_function_flag(func,
+ FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "index", 0, 0, INT_MAX, "Index", "Slot index to initialize", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "mtex", structname, "", "The newly initialized mtex");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "clear", "rna_mtex_texture_slots_clear");
+ RNA_def_function_flag(func,
+ FUNC_USE_SELF_ID | FUNC_NO_SELF | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Slot index to clear", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
-void rna_def_mtex_common(BlenderRNA *brna, StructRNA *srna, const char *begin,
- const char *activeget, const char *activeset, const char *activeeditable,
- const char *structname, const char *structname_slots, const char *update, const char *update_index)
+void rna_def_mtex_common(BlenderRNA *brna,
+ StructRNA *srna,
+ const char *begin,
+ const char *activeget,
+ const char *activeset,
+ const char *activeeditable,
+ const char *structname,
+ const char *structname_slots,
+ const char *update,
+ const char *update_index)
{
- PropertyRNA *prop;
-
- /* mtex */
- prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, structname);
- RNA_def_property_collection_funcs(prop, begin, "rna_iterator_array_next", "rna_iterator_array_end",
- "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Textures", "Texture slots defining the mapping and influence of textures");
- rna_def_texture_slots(brna, prop, structname, structname_slots);
-
- prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Texture");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- if (activeeditable)
- RNA_def_property_editable_func(prop, activeeditable);
- RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update);
-
- prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "texact");
- RNA_def_property_range(prop, 0, MAX_MTEX - 1);
- RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update_index);
+ PropertyRNA *prop;
+
+ /* mtex */
+ prop = RNA_def_property(srna, "texture_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, structname);
+ RNA_def_property_collection_funcs(prop,
+ begin,
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_dereference_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Textures", "Texture slots defining the mapping and influence of textures");
+ rna_def_texture_slots(brna, prop, structname, structname_slots);
+
+ prop = RNA_def_property(srna, "active_texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Texture");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ if (activeeditable)
+ RNA_def_property_editable_func(prop, activeeditable);
+ RNA_def_property_pointer_funcs(prop, activeget, activeset, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Texture", "Active texture slot being displayed");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update);
+
+ prop = RNA_def_property(srna, "active_texture_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "texact");
+ RNA_def_property_range(prop, 0, MAX_MTEX - 1);
+ RNA_def_property_ui_text(prop, "Active Texture Index", "Index of active texture slot");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, update_index);
}
static void rna_def_tex_slot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TexPaintSlot", NULL);
- RNA_def_struct_ui_text(srna, "Texture Paint Slot",
- "Slot that contains information about texture painting");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_maxlength(prop, 64); /* else it uses the pointer size! */
- RNA_def_property_string_sdna(prop, NULL, "uvname");
- RNA_def_property_string_funcs(prop, "rna_TexPaintSlot_uv_layer_get", "rna_TexPaintSlot_uv_layer_length",
- "rna_TexPaintSlot_uv_layer_set");
- RNA_def_property_ui_text(prop, "UV Map", "Name of UV map");
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Material_update");
-
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "valid", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Valid", "Slot has a valid image and UV map");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TexPaintSlot", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Texture Paint Slot", "Slot that contains information about texture painting");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_maxlength(prop, 64); /* else it uses the pointer size! */
+ RNA_def_property_string_sdna(prop, NULL, "uvname");
+ RNA_def_property_string_funcs(prop,
+ "rna_TexPaintSlot_uv_layer_get",
+ "rna_TexPaintSlot_uv_layer_length",
+ "rna_TexPaintSlot_uv_layer_set");
+ RNA_def_property_ui_text(prop, "UV Map", "Name of UV map");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Material_update");
+
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "valid", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Valid", "Slot has a valid image and UV map");
}
-
void rna_def_texpaint_slots(BlenderRNA *brna, StructRNA *srna)
{
- PropertyRNA *prop;
-
- rna_def_tex_slot(brna);
-
- /* mtex */
- prop = RNA_def_property(srna, "texture_paint_images", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "texpaintslot", NULL);
- RNA_def_property_collection_funcs(prop, "rna_Material_texpaint_begin", "rna_iterator_array_next", "rna_iterator_array_end",
- "rna_iterator_array_dereference_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_ui_text(prop, "Texture Slot Images", "Texture images used for texture painting");
-
- prop = RNA_def_property(srna, "texture_paint_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_Material_texpaint_begin", "rna_iterator_array_next", "rna_iterator_array_end",
- "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "TexPaintSlot");
- RNA_def_property_ui_text(prop, "Texture Slots", "Texture slots defining the mapping and influence of textures");
-
- prop = RNA_def_property(srna, "paint_active_slot", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Active Paint Texture Index", "Index of active texture paint slot");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_Material_active_paint_texture_index_update");
-
- prop = RNA_def_property(srna, "paint_clone_slot", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Clone Paint Texture Index", "Index of clone texture paint slot");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, NULL);
+ PropertyRNA *prop;
+
+ rna_def_tex_slot(brna);
+
+ /* mtex */
+ prop = RNA_def_property(srna, "texture_paint_images", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "texpaintslot", NULL);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Material_texpaint_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_dereference_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_ui_text(
+ prop, "Texture Slot Images", "Texture images used for texture painting");
+
+ prop = RNA_def_property(srna, "texture_paint_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Material_texpaint_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "TexPaintSlot");
+ RNA_def_property_ui_text(
+ prop, "Texture Slots", "Texture slots defining the mapping and influence of textures");
+
+ prop = RNA_def_property(srna, "paint_active_slot", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Active Paint Texture Index", "Index of active texture paint slot");
+ RNA_def_property_update(
+ prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_Material_active_paint_texture_index_update");
+
+ prop = RNA_def_property(srna, "paint_clone_slot", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Clone Paint Texture Index", "Index of clone texture paint slot");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, NULL);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_material_api.c b/source/blender/makesrna/intern/rna_material_api.c
index 6a8021e16eb..9f03b5f1a27 100644
--- a/source/blender/makesrna/intern/rna_material_api.c
+++ b/source/blender/makesrna/intern/rna_material_api.c
@@ -30,7 +30,7 @@
#include "DNA_material_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
@@ -38,8 +38,8 @@
void RNA_api_material(StructRNA *UNUSED(srna))
{
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
}
#endif
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index ce1f4202f16..a4ad07af6b7 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -6,7 +6,7 @@
*
* 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
+ * 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
@@ -47,154 +47,154 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_mesh_delimit_mode_items[] = {
- {BMO_DELIM_NORMAL, "NORMAL", 0, "Regular", "Delimit by face directions"},
- {BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"},
- {BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"},
- {BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"},
- {BMO_DELIM_UV, "UV", 0, "UVs", "Delimit by UV coordinates"},
- {0, NULL, 0, NULL, NULL},
+ {BMO_DELIM_NORMAL, "NORMAL", 0, "Regular", "Delimit by face directions"},
+ {BMO_DELIM_MATERIAL, "MATERIAL", 0, "Material", "Delimit by face material"},
+ {BMO_DELIM_SEAM, "SEAM", 0, "Seam", "Delimit by edge seams"},
+ {BMO_DELIM_SHARP, "SHARP", 0, "Sharp", "Delimit by sharp edges"},
+ {BMO_DELIM_UV, "UV", 0, "UVs", "Delimit by UV coordinates"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "DNA_scene_types.h"
+# include "DNA_scene_types.h"
-#include "BLI_math.h"
+# include "BLI_math.h"
-#include "BKE_customdata.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_mesh_runtime.h"
-#include "BKE_report.h"
+# include "BKE_customdata.h"
+# include "BKE_main.h"
+# include "BKE_mesh.h"
+# include "BKE_mesh_runtime.h"
+# include "BKE_report.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_mesh.h" /* XXX Bad level call */
+# include "ED_mesh.h" /* XXX Bad level call */
-#include "WM_api.h"
-
-#include "rna_mesh_utils.h"
+# include "WM_api.h"
+# include "rna_mesh_utils.h"
/* -------------------------------------------------------------------- */
/* Generic helpers */
static Mesh *rna_mesh(PointerRNA *ptr)
{
- Mesh *me = (Mesh *)ptr->id.data;
- return me;
+ Mesh *me = (Mesh *)ptr->id.data;
+ return me;
}
static CustomData *rna_mesh_vdata_helper(Mesh *me)
{
- return (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->vdata : &me->vdata;
}
static CustomData *rna_mesh_edata_helper(Mesh *me)
{
- return (me->edit_mesh) ? &me->edit_mesh->bm->edata : &me->edata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->edata : &me->edata;
}
static CustomData *rna_mesh_pdata_helper(Mesh *me)
{
- return (me->edit_mesh) ? &me->edit_mesh->bm->pdata : &me->pdata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->pdata : &me->pdata;
}
static CustomData *rna_mesh_ldata_helper(Mesh *me)
{
- return (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
+ return (me->edit_mesh) ? &me->edit_mesh->bm->ldata : &me->ldata;
}
static CustomData *rna_mesh_fdata_helper(Mesh *me)
{
- return (me->edit_mesh) ? NULL : &me->fdata;
+ return (me->edit_mesh) ? NULL : &me->fdata;
}
static CustomData *rna_mesh_vdata(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return rna_mesh_vdata_helper(me);
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_vdata_helper(me);
}
-#if 0
+# if 0
static CustomData *rna_mesh_edata(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return rna_mesh_edata_helper(me);
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_edata_helper(me);
}
-#endif
+# endif
static CustomData *rna_mesh_pdata(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return rna_mesh_pdata_helper(me);
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_pdata_helper(me);
}
static CustomData *rna_mesh_ldata(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return rna_mesh_ldata_helper(me);
+ Mesh *me = rna_mesh(ptr);
+ return rna_mesh_ldata_helper(me);
}
-
/* -------------------------------------------------------------------- */
/* Generic CustomData Layer Functions */
static void rna_cd_layer_name_set(CustomData *cdata, CustomDataLayer *cdl, const char *value)
{
- BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
- CustomData_set_layer_unique_name(cdata, cdl - cdata->layers);
+ BLI_strncpy_utf8(cdl->name, value, sizeof(cdl->name));
+ CustomData_set_layer_unique_name(cdata, cdl - cdata->layers);
}
/* avoid using where possible!, ideally the type is known */
static CustomData *rna_cd_from_layer(PointerRNA *ptr, CustomDataLayer *cdl)
{
- /* find out where we come from by */
- Mesh *me = ptr->id.data;
- CustomData *cd;
+ /* find out where we come from by */
+ Mesh *me = ptr->id.data;
+ CustomData *cd;
- /* rely on negative values wrapping */
-#define TEST_CDL(cmd) if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) return cd
+ /* rely on negative values wrapping */
+# define TEST_CDL(cmd) \
+ if ((void)(cd = cmd(me)), ARRAY_HAS_ITEM(cdl, cd->layers, cd->totlayer)) \
+ return cd
- TEST_CDL(rna_mesh_vdata_helper);
- TEST_CDL(rna_mesh_edata_helper);
- TEST_CDL(rna_mesh_pdata_helper);
- TEST_CDL(rna_mesh_ldata_helper);
- TEST_CDL(rna_mesh_fdata_helper);
+ TEST_CDL(rna_mesh_vdata_helper);
+ TEST_CDL(rna_mesh_edata_helper);
+ TEST_CDL(rna_mesh_pdata_helper);
+ TEST_CDL(rna_mesh_ldata_helper);
+ TEST_CDL(rna_mesh_fdata_helper);
-#undef TEST_CDL
+# undef TEST_CDL
- /* should _never_ happen */
- return NULL;
+ /* should _never_ happen */
+ return NULL;
}
static void rna_MeshVertexLayer_name_set(PointerRNA *ptr, const char *value)
{
- rna_cd_layer_name_set(rna_mesh_vdata(ptr), (CustomDataLayer *)ptr->data, value);
+ rna_cd_layer_name_set(rna_mesh_vdata(ptr), (CustomDataLayer *)ptr->data, value);
}
-#if 0
+# if 0
static void rna_MeshEdgeLayer_name_set(PointerRNA *ptr, const char *value)
{
- rna_cd_layer_name_set(rna_mesh_edata(ptr), (CustomDataLayer *)ptr->data, value);
+ rna_cd_layer_name_set(rna_mesh_edata(ptr), (CustomDataLayer *)ptr->data, value);
}
-#endif
+# endif
static void rna_MeshPolyLayer_name_set(PointerRNA *ptr, const char *value)
{
- rna_cd_layer_name_set(rna_mesh_pdata(ptr), (CustomDataLayer *)ptr->data, value);
+ rna_cd_layer_name_set(rna_mesh_pdata(ptr), (CustomDataLayer *)ptr->data, value);
}
static void rna_MeshLoopLayer_name_set(PointerRNA *ptr, const char *value)
{
- rna_cd_layer_name_set(rna_mesh_ldata(ptr), (CustomDataLayer *)ptr->data, value);
+ rna_cd_layer_name_set(rna_mesh_ldata(ptr), (CustomDataLayer *)ptr->data, value);
}
/* only for layers shared between types */
static void rna_MeshAnyLayer_name_set(PointerRNA *ptr, const char *value)
{
- CustomData *cd = rna_cd_from_layer(ptr, (CustomDataLayer *)ptr->data);
- rna_cd_layer_name_set(cd, (CustomDataLayer *)ptr->data, value);
+ CustomData *cd = rna_cd_from_layer(ptr, (CustomDataLayer *)ptr->data);
+ rna_cd_layer_name_set(cd, (CustomDataLayer *)ptr->data, value);
}
static bool rna_Mesh_has_custom_normals_get(PointerRNA *ptr)
{
- Mesh *me = ptr->data;
- return BKE_mesh_has_custom_loop_normals(me);
+ Mesh *me = ptr->data;
+ return BKE_mesh_has_custom_loop_normals(me);
}
/* -------------------------------------------------------------------- */
@@ -202,451 +202,453 @@ static bool rna_Mesh_has_custom_normals_get(PointerRNA *ptr)
static void rna_Mesh_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- /* cheating way for importers to avoid slow updates */
- if (id->us > 0) {
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
- }
+ /* cheating way for importers to avoid slow updates */
+ if (id->us > 0) {
+ DEG_id_tag_update(id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ }
}
static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
- rna_Mesh_update_data(bmain, scene, ptr);
+ rna_Mesh_update_data(bmain, scene, ptr);
}
-
static void rna_Mesh_update_data_edit_active_color(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL);
- rna_Mesh_update_data(bmain, scene, ptr);
+ rna_Mesh_update_data(bmain, scene, ptr);
}
static void rna_Mesh_update_select(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- /* cheating way for importers to avoid slow updates */
- if (id->us > 0) {
- WM_main_add_notifier(NC_GEOM | ND_SELECT, id);
- }
+ ID *id = ptr->id.data;
+ /* cheating way for importers to avoid slow updates */
+ if (id->us > 0) {
+ WM_main_add_notifier(NC_GEOM | ND_SELECT, id);
+ }
}
void rna_Mesh_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- /* cheating way for importers to avoid slow updates */
- if (id->us > 0) {
- WM_main_add_notifier(NC_GEOM | ND_DATA, id);
- }
+ ID *id = ptr->id.data;
+ /* cheating way for importers to avoid slow updates */
+ if (id->us > 0) {
+ WM_main_add_notifier(NC_GEOM | ND_DATA, id);
+ }
}
-
static void rna_Mesh_update_vertmask(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Mesh *me = ptr->data;
- if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
- me->editflag &= ~ME_EDIT_PAINT_FACE_SEL;
- }
+ Mesh *me = ptr->data;
+ if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
+ me->editflag &= ~ME_EDIT_PAINT_FACE_SEL;
+ }
- BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
- rna_Mesh_update_draw(bmain, scene, ptr);
+ rna_Mesh_update_draw(bmain, scene, ptr);
}
static void rna_Mesh_update_facemask(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Mesh *me = ptr->data;
- if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
- me->editflag &= ~ME_EDIT_PAINT_VERT_SEL;
- }
+ Mesh *me = ptr->data;
+ if ((me->editflag & ME_EDIT_PAINT_VERT_SEL) && (me->editflag & ME_EDIT_PAINT_FACE_SEL)) {
+ me->editflag &= ~ME_EDIT_PAINT_VERT_SEL;
+ }
- BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(me, BKE_MESH_BATCH_DIRTY_ALL);
- rna_Mesh_update_draw(bmain, scene, ptr);
+ rna_Mesh_update_draw(bmain, scene, ptr);
}
-
/* -------------------------------------------------------------------- */
/* Property get/set Callbacks */
static void rna_MeshVertex_normal_get(PointerRNA *ptr, float *value)
{
- MVert *mvert = (MVert *)ptr->data;
- normal_short_to_float_v3(value, mvert->no);
+ MVert *mvert = (MVert *)ptr->data;
+ normal_short_to_float_v3(value, mvert->no);
}
static void rna_MeshVertex_normal_set(PointerRNA *ptr, const float *value)
{
- MVert *mvert = (MVert *)ptr->data;
- float no[3];
+ MVert *mvert = (MVert *)ptr->data;
+ float no[3];
- copy_v3_v3(no, value);
- normalize_v3(no);
- normal_float_to_short_v3(mvert->no, no);
+ copy_v3_v3(no, value);
+ normalize_v3(no);
+ normal_float_to_short_v3(mvert->no, no);
}
static float rna_MeshVertex_bevel_weight_get(PointerRNA *ptr)
{
- MVert *mvert = (MVert *)ptr->data;
- return mvert->bweight / 255.0f;
+ MVert *mvert = (MVert *)ptr->data;
+ return mvert->bweight / 255.0f;
}
static void rna_MeshVertex_bevel_weight_set(PointerRNA *ptr, float value)
{
- MVert *mvert = (MVert *)ptr->data;
- mvert->bweight = round_fl_to_uchar_clamp(value * 255.0f);
+ MVert *mvert = (MVert *)ptr->data;
+ mvert->bweight = round_fl_to_uchar_clamp(value * 255.0f);
}
static float rna_MEdge_bevel_weight_get(PointerRNA *ptr)
{
- MEdge *medge = (MEdge *)ptr->data;
- return medge->bweight / 255.0f;
+ MEdge *medge = (MEdge *)ptr->data;
+ return medge->bweight / 255.0f;
}
static void rna_MEdge_bevel_weight_set(PointerRNA *ptr, float value)
{
- MEdge *medge = (MEdge *)ptr->data;
- medge->bweight = round_fl_to_uchar_clamp(value * 255.0f);
+ MEdge *medge = (MEdge *)ptr->data;
+ medge->bweight = round_fl_to_uchar_clamp(value * 255.0f);
}
static float rna_MEdge_crease_get(PointerRNA *ptr)
{
- MEdge *medge = (MEdge *)ptr->data;
- return medge->crease / 255.0f;
+ MEdge *medge = (MEdge *)ptr->data;
+ return medge->crease / 255.0f;
}
static void rna_MEdge_crease_set(PointerRNA *ptr, float value)
{
- MEdge *medge = (MEdge *)ptr->data;
- medge->crease = round_fl_to_uchar_clamp(value * 255.0f);
+ MEdge *medge = (MEdge *)ptr->data;
+ medge->crease = round_fl_to_uchar_clamp(value * 255.0f);
}
static void rna_MeshLoop_normal_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- MLoop *ml = (MLoop *)ptr->data;
- const float (*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
+ Mesh *me = rna_mesh(ptr);
+ MLoop *ml = (MLoop *)ptr->data;
+ const float(*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
- if (!vec) {
- zero_v3(values);
- }
- else {
- copy_v3_v3(values, (const float *)vec);
- }
+ if (!vec) {
+ zero_v3(values);
+ }
+ else {
+ copy_v3_v3(values, (const float *)vec);
+ }
}
static void rna_MeshLoop_normal_set(PointerRNA *ptr, const float *values)
{
- Mesh *me = rna_mesh(ptr);
- MLoop *ml = (MLoop *)ptr->data;
- float (*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
+ Mesh *me = rna_mesh(ptr);
+ MLoop *ml = (MLoop *)ptr->data;
+ float(*vec)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
- if (vec) {
- normalize_v3_v3(*vec, values);
- }
+ if (vec) {
+ normalize_v3_v3(*vec, values);
+ }
}
static void rna_MeshLoop_tangent_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- MLoop *ml = (MLoop *)ptr->data;
- const float (*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
+ Mesh *me = rna_mesh(ptr);
+ MLoop *ml = (MLoop *)ptr->data;
+ const float(*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
- if (!vec) {
- zero_v3(values);
- }
- else {
- copy_v3_v3(values, (const float *)vec);
- }
+ if (!vec) {
+ zero_v3(values);
+ }
+ else {
+ copy_v3_v3(values, (const float *)vec);
+ }
}
static float rna_MeshLoop_bitangent_sign_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MLoop *ml = (MLoop *)ptr->data;
- const float (*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
+ Mesh *me = rna_mesh(ptr);
+ MLoop *ml = (MLoop *)ptr->data;
+ const float(*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
- return (vec) ? (*vec)[3] : 0.0f;
+ return (vec) ? (*vec)[3] : 0.0f;
}
static void rna_MeshLoop_bitangent_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- MLoop *ml = (MLoop *)ptr->data;
- const float (*nor)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
- const float (*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
+ Mesh *me = rna_mesh(ptr);
+ MLoop *ml = (MLoop *)ptr->data;
+ const float(*nor)[3] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_NORMAL);
+ const float(*vec)[4] = CustomData_get(&me->ldata, (int)(ml - me->mloop), CD_MLOOPTANGENT);
- if (nor && vec) {
- cross_v3_v3v3(values, (const float *)nor, (const float *)vec);
- mul_v3_fl(values, (*vec)[3]);
- }
- else {
- zero_v3(values);
- }
+ if (nor && vec) {
+ cross_v3_v3v3(values, (const float *)nor, (const float *)vec);
+ mul_v3_fl(values, (*vec)[3]);
+ }
+ else {
+ zero_v3(values);
+ }
}
static void rna_MeshPolygon_normal_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mp = (MPoly *)ptr->data;
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp = (MPoly *)ptr->data;
- BKE_mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values);
+ BKE_mesh_calc_poly_normal(mp, me->mloop + mp->loopstart, me->mvert, values);
}
static void rna_MeshPolygon_center_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mp = (MPoly *)ptr->data;
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp = (MPoly *)ptr->data;
- BKE_mesh_calc_poly_center(mp, me->mloop + mp->loopstart, me->mvert, values);
+ BKE_mesh_calc_poly_center(mp, me->mloop + mp->loopstart, me->mvert, values);
}
static float rna_MeshPolygon_area_get(PointerRNA *ptr)
{
- Mesh *me = (Mesh *)ptr->id.data;
- MPoly *mp = (MPoly *)ptr->data;
+ Mesh *me = (Mesh *)ptr->id.data;
+ MPoly *mp = (MPoly *)ptr->data;
- return BKE_mesh_calc_poly_area(mp, me->mloop + mp->loopstart, me->mvert);
+ return BKE_mesh_calc_poly_area(mp, me->mloop + mp->loopstart, me->mvert);
}
static void rna_MeshPolygon_flip(ID *id, MPoly *mp)
{
- Mesh *me = (Mesh *)id;
+ Mesh *me = (Mesh *)id;
- BKE_mesh_polygon_flip(mp, me->mloop, &me->ldata);
- BKE_mesh_tessface_clear(me);
- BKE_mesh_runtime_clear_geometry(me);
+ BKE_mesh_polygon_flip(mp, me->mloop, &me->ldata);
+ BKE_mesh_tessface_clear(me);
+ BKE_mesh_runtime_clear_geometry(me);
}
static void rna_MeshLoopTriangle_verts_get(PointerRNA *ptr, int *values)
{
- Mesh *me = rna_mesh(ptr);
- MLoopTri *lt = (MLoopTri *)ptr->data;
- values[0] = me->mloop[lt->tri[0]].v;
- values[1] = me->mloop[lt->tri[1]].v;
- values[2] = me->mloop[lt->tri[2]].v;
+ Mesh *me = rna_mesh(ptr);
+ MLoopTri *lt = (MLoopTri *)ptr->data;
+ values[0] = me->mloop[lt->tri[0]].v;
+ values[1] = me->mloop[lt->tri[1]].v;
+ values[2] = me->mloop[lt->tri[2]].v;
}
-
static void rna_MeshLoopTriangle_normal_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- MLoopTri *lt = (MLoopTri *)ptr->data;
- unsigned int v1 = me->mloop[lt->tri[0]].v;
- unsigned int v2 = me->mloop[lt->tri[1]].v;
- unsigned int v3 = me->mloop[lt->tri[2]].v;
+ Mesh *me = rna_mesh(ptr);
+ MLoopTri *lt = (MLoopTri *)ptr->data;
+ unsigned int v1 = me->mloop[lt->tri[0]].v;
+ unsigned int v2 = me->mloop[lt->tri[1]].v;
+ unsigned int v3 = me->mloop[lt->tri[2]].v;
- normal_tri_v3(values, me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
+ normal_tri_v3(values, me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
}
static void rna_MeshLoopTriangle_split_normals_get(PointerRNA *ptr, float *values)
{
- Mesh *me = rna_mesh(ptr);
- const float (*lnors)[3] = CustomData_get_layer(&me->ldata, CD_NORMAL);
+ Mesh *me = rna_mesh(ptr);
+ const float(*lnors)[3] = CustomData_get_layer(&me->ldata, CD_NORMAL);
- if (!lnors) {
- zero_v3(values + 0);
- zero_v3(values + 3);
- zero_v3(values + 6);
- }
- else {
- MLoopTri *lt = (MLoopTri *)ptr->data;
- copy_v3_v3(values + 0, lnors[lt->tri[0]]);
- copy_v3_v3(values + 3, lnors[lt->tri[1]]);
- copy_v3_v3(values + 6, lnors[lt->tri[2]]);
- }
+ if (!lnors) {
+ zero_v3(values + 0);
+ zero_v3(values + 3);
+ zero_v3(values + 6);
+ }
+ else {
+ MLoopTri *lt = (MLoopTri *)ptr->data;
+ copy_v3_v3(values + 0, lnors[lt->tri[0]]);
+ copy_v3_v3(values + 3, lnors[lt->tri[1]]);
+ copy_v3_v3(values + 6, lnors[lt->tri[2]]);
+ }
}
static float rna_MeshLoopTriangle_area_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MLoopTri *lt = (MLoopTri *)ptr->data;
- unsigned int v1 = me->mloop[lt->tri[0]].v;
- unsigned int v2 = me->mloop[lt->tri[1]].v;
- unsigned int v3 = me->mloop[lt->tri[2]].v;
+ Mesh *me = rna_mesh(ptr);
+ MLoopTri *lt = (MLoopTri *)ptr->data;
+ unsigned int v1 = me->mloop[lt->tri[0]].v;
+ unsigned int v2 = me->mloop[lt->tri[1]].v;
+ unsigned int v3 = me->mloop[lt->tri[2]].v;
- return area_tri_v3(me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
+ return area_tri_v3(me->mvert[v1].co, me->mvert[v2].co, me->mvert[v3].co);
}
static void rna_MeshLoopColor_color_get(PointerRNA *ptr, float *values)
{
- MLoopCol *mlcol = (MLoopCol *)ptr->data;
+ MLoopCol *mlcol = (MLoopCol *)ptr->data;
- values[0] = mlcol->r / 255.0f;
- values[1] = mlcol->g / 255.0f;
- values[2] = mlcol->b / 255.0f;
- values[3] = mlcol->a / 255.0f;
+ values[0] = mlcol->r / 255.0f;
+ values[1] = mlcol->g / 255.0f;
+ values[2] = mlcol->b / 255.0f;
+ values[3] = mlcol->a / 255.0f;
}
static void rna_MeshLoopColor_color_set(PointerRNA *ptr, const float *values)
{
- MLoopCol *mlcol = (MLoopCol *)ptr->data;
+ MLoopCol *mlcol = (MLoopCol *)ptr->data;
- mlcol->r = round_fl_to_uchar_clamp(values[0] * 255.0f);
- mlcol->g = round_fl_to_uchar_clamp(values[1] * 255.0f);
- mlcol->b = round_fl_to_uchar_clamp(values[2] * 255.0f);
- mlcol->a = round_fl_to_uchar_clamp(values[3] * 255.0f);
+ mlcol->r = round_fl_to_uchar_clamp(values[0] * 255.0f);
+ mlcol->g = round_fl_to_uchar_clamp(values[1] * 255.0f);
+ mlcol->b = round_fl_to_uchar_clamp(values[2] * 255.0f);
+ mlcol->a = round_fl_to_uchar_clamp(values[3] * 255.0f);
}
static int rna_Mesh_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- Mesh *me = (Mesh *)ptr->data;
- return (me->texflag & ME_AUTOSPACE) ? 0 : PROP_EDITABLE;
+ Mesh *me = (Mesh *)ptr->data;
+ return (me->texflag & ME_AUTOSPACE) ? 0 : PROP_EDITABLE;
}
static void rna_Mesh_texspace_size_get(PointerRNA *ptr, float values[3])
{
- Mesh *me = (Mesh *)ptr->data;
+ Mesh *me = (Mesh *)ptr->data;
- if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
- BKE_mesh_texspace_calc(me);
- }
+ if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
+ BKE_mesh_texspace_calc(me);
+ }
- copy_v3_v3(values, me->size);
+ copy_v3_v3(values, me->size);
}
static void rna_Mesh_texspace_loc_get(PointerRNA *ptr, float values[3])
{
- Mesh *me = (Mesh *)ptr->data;
+ Mesh *me = (Mesh *)ptr->data;
- if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
- BKE_mesh_texspace_calc(me);
- }
+ if (me->bb == NULL || (me->bb->flag & BOUNDBOX_DIRTY)) {
+ BKE_mesh_texspace_calc(me);
+ }
- copy_v3_v3(values, me->loc);
+ copy_v3_v3(values, me->loc);
}
static void rna_MeshVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
+ Mesh *me = rna_mesh(ptr);
- if (me->dvert) {
- MVert *mvert = (MVert *)ptr->data;
- MDeformVert *dvert = me->dvert + (mvert - me->mvert);
+ if (me->dvert) {
+ MVert *mvert = (MVert *)ptr->data;
+ MDeformVert *dvert = me->dvert + (mvert - me->mvert);
- rna_iterator_array_begin(iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
- }
- else
- rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
+ rna_iterator_array_begin(
+ iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
+ }
+ else
+ rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
static void rna_MeshVertex_undeformed_co_get(PointerRNA *ptr, float values[3])
{
- Mesh *me = rna_mesh(ptr);
- MVert *mvert = (MVert *)ptr->data;
- float (*orco)[3] = CustomData_get_layer(&me->vdata, CD_ORCO);
+ Mesh *me = rna_mesh(ptr);
+ MVert *mvert = (MVert *)ptr->data;
+ float(*orco)[3] = CustomData_get_layer(&me->vdata, CD_ORCO);
- if (orco) {
- /* orco is normalized to 0..1, we do inverse to match mvert->co */
- float loc[3], size[3];
+ if (orco) {
+ /* orco is normalized to 0..1, we do inverse to match mvert->co */
+ float loc[3], size[3];
- BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, NULL, size);
- madd_v3_v3v3v3(values, loc, orco[(mvert - me->mvert)], size);
- }
- else
- copy_v3_v3(values, mvert->co);
+ BKE_mesh_texspace_get(me->texcomesh ? me->texcomesh : me, loc, NULL, size);
+ madd_v3_v3v3v3(values, loc, orco[(mvert - me->mvert)], size);
+ }
+ else
+ copy_v3_v3(values, mvert->co);
}
static int rna_CustomDataLayer_active_get(PointerRNA *ptr, CustomData *data, int type, bool render)
{
- int n = ((CustomDataLayer *)ptr->data) - data->layers;
+ int n = ((CustomDataLayer *)ptr->data) - data->layers;
- if (render) return (n == CustomData_get_render_layer_index(data, type));
- else return (n == CustomData_get_active_layer_index(data, type));
+ if (render)
+ return (n == CustomData_get_render_layer_index(data, type));
+ else
+ return (n == CustomData_get_active_layer_index(data, type));
}
static int rna_CustomDataLayer_clone_get(PointerRNA *ptr, CustomData *data, int type)
{
- int n = ((CustomDataLayer *)ptr->data) - data->layers;
+ int n = ((CustomDataLayer *)ptr->data) - data->layers;
- return (n == CustomData_get_clone_layer_index(data, type));
+ return (n == CustomData_get_clone_layer_index(data, type));
}
-static void rna_CustomDataLayer_active_set(PointerRNA *ptr, CustomData *data, int value, int type, int render)
+static void rna_CustomDataLayer_active_set(
+ PointerRNA *ptr, CustomData *data, int value, int type, int render)
{
- Mesh *me = ptr->id.data;
- int n = (((CustomDataLayer *)ptr->data) - data->layers) - CustomData_get_layer_index(data, type);
+ Mesh *me = ptr->id.data;
+ int n = (((CustomDataLayer *)ptr->data) - data->layers) - CustomData_get_layer_index(data, type);
- if (value == 0)
- return;
+ if (value == 0)
+ return;
- if (render) CustomData_set_layer_render(data, type, n);
- else CustomData_set_layer_active(data, type, n);
+ if (render)
+ CustomData_set_layer_render(data, type, n);
+ else
+ CustomData_set_layer_active(data, type, n);
- BKE_mesh_update_customdata_pointers(me, true);
+ BKE_mesh_update_customdata_pointers(me, true);
}
static void rna_CustomDataLayer_clone_set(PointerRNA *ptr, CustomData *data, int value, int type)
{
- int n = ((CustomDataLayer *)ptr->data) - data->layers;
+ int n = ((CustomDataLayer *)ptr->data) - data->layers;
- if (value == 0)
- return;
+ if (value == 0)
+ return;
- CustomData_set_layer_clone_index(data, type, n);
+ CustomData_set_layer_clone_index(data, type, n);
}
static bool rna_MEdge_freestyle_edge_mark_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MEdge *medge = (MEdge *)ptr->data;
- FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
+ Mesh *me = rna_mesh(ptr);
+ MEdge *medge = (MEdge *)ptr->data;
+ FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
- return fed && (fed->flag & FREESTYLE_EDGE_MARK) != 0;
+ return fed && (fed->flag & FREESTYLE_EDGE_MARK) != 0;
}
static void rna_MEdge_freestyle_edge_mark_set(PointerRNA *ptr, bool value)
{
- Mesh *me = rna_mesh(ptr);
- MEdge *medge = (MEdge *)ptr->data;
- FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
+ Mesh *me = rna_mesh(ptr);
+ MEdge *medge = (MEdge *)ptr->data;
+ FreestyleEdge *fed = CustomData_get(&me->edata, (int)(medge - me->medge), CD_FREESTYLE_EDGE);
- if (!fed) {
- fed = CustomData_add_layer(&me->edata, CD_FREESTYLE_EDGE, CD_CALLOC, NULL, me->totedge);
- }
- if (value) {
- fed->flag |= FREESTYLE_EDGE_MARK;
- }
- else {
- fed->flag &= ~FREESTYLE_EDGE_MARK;
- }
+ if (!fed) {
+ fed = CustomData_add_layer(&me->edata, CD_FREESTYLE_EDGE, CD_CALLOC, NULL, me->totedge);
+ }
+ if (value) {
+ fed->flag |= FREESTYLE_EDGE_MARK;
+ }
+ else {
+ fed->flag &= ~FREESTYLE_EDGE_MARK;
+ }
}
static bool rna_MPoly_freestyle_face_mark_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mpoly = (MPoly *)ptr->data;
- FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mpoly = (MPoly *)ptr->data;
+ FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
- return ffa && (ffa->flag & FREESTYLE_FACE_MARK) != 0;
+ return ffa && (ffa->flag & FREESTYLE_FACE_MARK) != 0;
}
static void rna_MPoly_freestyle_face_mark_set(PointerRNA *ptr, int value)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mpoly = (MPoly *)ptr->data;
- FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mpoly = (MPoly *)ptr->data;
+ FreestyleFace *ffa = CustomData_get(&me->pdata, (int)(mpoly - me->mpoly), CD_FREESTYLE_FACE);
- if (!ffa) {
- ffa = CustomData_add_layer(&me->pdata, CD_FREESTYLE_FACE, CD_CALLOC, NULL, me->totpoly);
- }
- if (value) {
- ffa->flag |= FREESTYLE_FACE_MARK;
- }
- else {
- ffa->flag &= ~FREESTYLE_FACE_MARK;
- }
+ if (!ffa) {
+ ffa = CustomData_add_layer(&me->pdata, CD_FREESTYLE_FACE, CD_CALLOC, NULL, me->totpoly);
+ }
+ if (value) {
+ ffa->flag |= FREESTYLE_FACE_MARK;
+ }
+ else {
+ ffa->flag &= ~FREESTYLE_FACE_MARK;
+ }
}
/* Generic UV rename! */
static void rna_MeshUVLayer_name_set(PointerRNA *ptr, const char *name)
{
- char buf[MAX_CUSTOMDATA_LAYER_NAME];
- BLI_strncpy_utf8(buf, name, MAX_CUSTOMDATA_LAYER_NAME);
- BKE_mesh_uv_cdlayer_rename(rna_mesh(ptr), ((CustomDataLayer *)ptr->data)->name, buf, true);
+ char buf[MAX_CUSTOMDATA_LAYER_NAME];
+ BLI_strncpy_utf8(buf, name, MAX_CUSTOMDATA_LAYER_NAME);
+ BKE_mesh_uv_cdlayer_rename(rna_mesh(ptr), ((CustomDataLayer *)ptr->data)->name, buf, true);
}
/* uv_layers */
@@ -654,183 +656,212 @@ static void rna_MeshUVLayer_name_set(PointerRNA *ptr, const char *name)
DEFINE_CUSTOMDATA_LAYER_COLLECTION(uv_layer, ldata, CD_MLOOPUV)
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, active, MeshUVLoopLayer)
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, clone, MeshUVLoopLayer)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
+ uv_layer, ldata, CD_MLOOPUV, stencil, MeshUVLoopLayer)
DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(uv_layer, ldata, CD_MLOOPUV, render, MeshUVLoopLayer)
/* MeshUVLoopLayer */
static char *rna_MeshUVLoopLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("uv_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("uv_layers[\"%s\"]", name_esc);
}
static void rna_MeshUVLoopLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MLoopUV), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(
+ iter, layer->data, sizeof(MLoopUV), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
}
static int rna_MeshUVLoopLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return (me->edit_mesh) ? 0 : me->totloop;
+ Mesh *me = rna_mesh(ptr);
+ return (me->edit_mesh) ? 0 : me->totloop;
}
static bool rna_MeshUVLoopLayer_active_render_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 1);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 1);
}
static bool rna_MeshUVLoopLayer_active_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 0);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV, 0);
}
static bool rna_MeshUVLoopLayer_clone_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_clone_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV);
+ return rna_CustomDataLayer_clone_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPUV);
}
static void rna_MeshUVLoopLayer_active_render_set(PointerRNA *ptr, bool value)
{
- rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 1);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 1);
}
static void rna_MeshUVLoopLayer_active_set(PointerRNA *ptr, bool value)
{
- rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 0);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV, 0);
}
static void rna_MeshUVLoopLayer_clone_set(PointerRNA *ptr, bool value)
{
- rna_CustomDataLayer_clone_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV);
+ rna_CustomDataLayer_clone_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPUV);
}
/* vertex_color_layers */
DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_color, ldata, CD_MLOOPCOL)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(vertex_color, ldata, CD_MLOOPCOL, active, MeshLoopColorLayer)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(vertex_color, ldata, CD_MLOOPCOL, render, MeshLoopColorLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
+ vertex_color, ldata, CD_MLOOPCOL, active, MeshLoopColorLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
+ vertex_color, ldata, CD_MLOOPCOL, render, MeshLoopColorLayer)
static void rna_MeshLoopColorLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MLoopCol), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(
+ iter, layer->data, sizeof(MLoopCol), (me->edit_mesh) ? 0 : me->totloop, 0, NULL);
}
static int rna_MeshLoopColorLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return (me->edit_mesh) ? 0 : me->totloop;
+ Mesh *me = rna_mesh(ptr);
+ return (me->edit_mesh) ? 0 : me->totloop;
}
static bool rna_MeshLoopColorLayer_active_render_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 1);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 1);
}
static bool rna_MeshLoopColorLayer_active_get(PointerRNA *ptr)
{
- return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 0);
+ return rna_CustomDataLayer_active_get(ptr, rna_mesh_ldata(ptr), CD_MLOOPCOL, 0);
}
static void rna_MeshLoopColorLayer_active_render_set(PointerRNA *ptr, bool value)
{
- rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 1);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 1);
}
static void rna_MeshLoopColorLayer_active_set(PointerRNA *ptr, bool value)
{
- rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 0);
+ rna_CustomDataLayer_active_set(ptr, rna_mesh_ldata(ptr), value, CD_MLOOPCOL, 0);
}
static int rna_float_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- CustomDataLayer *layer = (CustomDataLayer *)data;
- return (layer->type != CD_PROP_FLT);
+ CustomDataLayer *layer = (CustomDataLayer *)data;
+ return (layer->type != CD_PROP_FLT);
}
static void rna_Mesh_vertex_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CustomData *vdata = rna_mesh_vdata(ptr);
- rna_iterator_array_begin(iter, (void *)vdata->layers, sizeof(CustomDataLayer), vdata->totlayer, 0,
- rna_float_layer_check);
+ CustomData *vdata = rna_mesh_vdata(ptr);
+ rna_iterator_array_begin(iter,
+ (void *)vdata->layers,
+ sizeof(CustomDataLayer),
+ vdata->totlayer,
+ 0,
+ rna_float_layer_check);
}
static void rna_Mesh_polygon_float_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CustomData *pdata = rna_mesh_pdata(ptr);
- rna_iterator_array_begin(iter, (void *)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
- rna_float_layer_check);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ rna_iterator_array_begin(iter,
+ (void *)pdata->layers,
+ sizeof(CustomDataLayer),
+ pdata->totlayer,
+ 0,
+ rna_float_layer_check);
}
static int rna_Mesh_vertex_float_layers_length(PointerRNA *ptr)
{
- return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_FLT);
+ return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_FLT);
}
static int rna_Mesh_polygon_float_layers_length(PointerRNA *ptr)
{
- return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLT);
+ return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_FLT);
}
static int rna_int_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- CustomDataLayer *layer = (CustomDataLayer *)data;
- return (layer->type != CD_PROP_INT);
+ CustomDataLayer *layer = (CustomDataLayer *)data;
+ return (layer->type != CD_PROP_INT);
}
static void rna_Mesh_vertex_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CustomData *vdata = rna_mesh_vdata(ptr);
- rna_iterator_array_begin(iter, (void *)vdata->layers, sizeof(CustomDataLayer), vdata->totlayer, 0,
- rna_int_layer_check);
+ CustomData *vdata = rna_mesh_vdata(ptr);
+ rna_iterator_array_begin(iter,
+ (void *)vdata->layers,
+ sizeof(CustomDataLayer),
+ vdata->totlayer,
+ 0,
+ rna_int_layer_check);
}
static void rna_Mesh_polygon_int_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CustomData *pdata = rna_mesh_pdata(ptr);
- rna_iterator_array_begin(iter, (void *)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
- rna_int_layer_check);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ rna_iterator_array_begin(iter,
+ (void *)pdata->layers,
+ sizeof(CustomDataLayer),
+ pdata->totlayer,
+ 0,
+ rna_int_layer_check);
}
static int rna_Mesh_vertex_int_layers_length(PointerRNA *ptr)
{
- return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_INT);
+ return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_INT);
}
static int rna_Mesh_polygon_int_layers_length(PointerRNA *ptr)
{
- return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT);
+ return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_INT);
}
static int rna_string_layer_check(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- CustomDataLayer *layer = (CustomDataLayer *)data;
- return (layer->type != CD_PROP_STR);
+ CustomDataLayer *layer = (CustomDataLayer *)data;
+ return (layer->type != CD_PROP_STR);
}
static void rna_Mesh_vertex_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CustomData *vdata = rna_mesh_vdata(ptr);
- rna_iterator_array_begin(iter, (void *)vdata->layers, sizeof(CustomDataLayer), vdata->totlayer, 0,
- rna_string_layer_check);
+ CustomData *vdata = rna_mesh_vdata(ptr);
+ rna_iterator_array_begin(iter,
+ (void *)vdata->layers,
+ sizeof(CustomDataLayer),
+ vdata->totlayer,
+ 0,
+ rna_string_layer_check);
}
static void rna_Mesh_polygon_string_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- CustomData *pdata = rna_mesh_pdata(ptr);
- rna_iterator_array_begin(iter, (void *)pdata->layers, sizeof(CustomDataLayer), pdata->totlayer, 0,
- rna_string_layer_check);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ rna_iterator_array_begin(iter,
+ (void *)pdata->layers,
+ sizeof(CustomDataLayer),
+ pdata->totlayer,
+ 0,
+ rna_string_layer_check);
}
static int rna_Mesh_vertex_string_layers_length(PointerRNA *ptr)
{
- return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_STR);
+ return CustomData_number_of_layers(rna_mesh_vdata(ptr), CD_PROP_STR);
}
static int rna_Mesh_polygon_string_layers_length(PointerRNA *ptr)
{
- return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_STR);
+ return CustomData_number_of_layers(rna_mesh_pdata(ptr), CD_PROP_STR);
}
/* Skin vertices */
@@ -838,29 +869,29 @@ DEFINE_CUSTOMDATA_LAYER_COLLECTION(skin_vertice, vdata, CD_MVERT_SKIN)
static char *rna_MeshSkinVertexLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("skin_vertices[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("skin_vertices[\"%s\"]", name_esc);
}
static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collection, int type);
static char *rna_MeshSkinVertex_path(PointerRNA *ptr)
{
- return rna_VertCustomData_data_path(ptr, "skin_vertices", CD_MVERT_SKIN);
+ return rna_VertCustomData_data_path(ptr, "skin_vertices", CD_MVERT_SKIN);
}
static void rna_MeshSkinVertexLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MVertSkin), me->totvert, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MVertSkin), me->totvert, 0, NULL);
}
static int rna_MeshSkinVertexLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totvert;
+ Mesh *me = rna_mesh(ptr);
+ return me->totvert;
}
/* End skin vertices */
@@ -870,28 +901,28 @@ DEFINE_CUSTOMDATA_LAYER_COLLECTION(vertex_paint_mask, vdata, CD_PAINT_MASK)
static char *rna_MeshPaintMaskLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("vertex_paint_masks[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("vertex_paint_masks[\"%s\"]", name_esc);
}
static char *rna_MeshPaintMask_path(PointerRNA *ptr)
{
- return rna_VertCustomData_data_path(ptr, "vertex_paint_masks", CD_PAINT_MASK);
+ return rna_VertCustomData_data_path(ptr, "vertex_paint_masks", CD_PAINT_MASK);
}
static void rna_MeshPaintMaskLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
}
static int rna_MeshPaintMaskLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totvert;
+ Mesh *me = rna_mesh(ptr);
+ return me->totvert;
}
/* End paint mask */
@@ -899,1994 +930,2220 @@ static int rna_MeshPaintMaskLayer_data_length(PointerRNA *ptr)
/* Face maps */
DEFINE_CUSTOMDATA_LAYER_COLLECTION(face_map, pdata, CD_FACEMAP)
-DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(face_map, pdata, CD_FACEMAP, active, MeshFaceMapLayer)
+DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(
+ face_map, pdata, CD_FACEMAP, active, MeshFaceMapLayer)
static char *rna_MeshFaceMapLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("face_maps[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("face_maps[\"%s\"]", name_esc);
}
static void rna_MeshFaceMapLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(int), me->totpoly, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(int), me->totpoly, 0, NULL);
}
static int rna_MeshFaceMapLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totpoly;
+ Mesh *me = rna_mesh(ptr);
+ return me->totpoly;
}
static PointerRNA rna_Mesh_face_map_new(struct Mesh *me, ReportList *reports, const char *name)
{
- if (BKE_mesh_ensure_facemap_customdata(me) == false) {
- BKE_report(reports, RPT_ERROR, "Currently only single face-map layers are supported");
- return PointerRNA_NULL;
- }
+ if (BKE_mesh_ensure_facemap_customdata(me) == false) {
+ BKE_report(reports, RPT_ERROR, "Currently only single face-map layers are supported");
+ return PointerRNA_NULL;
+ }
- CustomData *pdata = rna_mesh_pdata_helper(me);
+ CustomData *pdata = rna_mesh_pdata_helper(me);
- int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
- BLI_assert(index != -1);
- CustomDataLayer *cdl = &pdata->layers[index];
- rna_cd_layer_name_set(pdata, cdl, name);
+ int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
+ BLI_assert(index != -1);
+ CustomDataLayer *cdl = &pdata->layers[index];
+ rna_cd_layer_name_set(pdata, cdl, name);
- PointerRNA ptr;
- RNA_pointer_create(&me->id, &RNA_MeshFaceMapLayer, cdl, &ptr);
- return ptr;
+ PointerRNA ptr;
+ RNA_pointer_create(&me->id, &RNA_MeshFaceMapLayer, cdl, &ptr);
+ return ptr;
}
-static void rna_Mesh_face_map_remove(struct Mesh *me, ReportList *reports, struct CustomDataLayer *layer)
+static void rna_Mesh_face_map_remove(struct Mesh *me,
+ ReportList *reports,
+ struct CustomDataLayer *layer)
{
- /* just for sanity check */
- {
- CustomData *pdata = rna_mesh_pdata_helper(me);
- int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
- if (index != -1) {
- CustomDataLayer *layer_test = &pdata->layers[index];
- if (layer != layer_test) {
- /* don't show name, its likely freed memory */
- BKE_report(reports, RPT_ERROR, "FaceMap not in mesh");
- return;
- }
- }
- }
+ /* just for sanity check */
+ {
+ CustomData *pdata = rna_mesh_pdata_helper(me);
+ int index = CustomData_get_layer_index(pdata, CD_FACEMAP);
+ if (index != -1) {
+ CustomDataLayer *layer_test = &pdata->layers[index];
+ if (layer != layer_test) {
+ /* don't show name, its likely freed memory */
+ BKE_report(reports, RPT_ERROR, "FaceMap not in mesh");
+ return;
+ }
+ }
+ }
- if (BKE_mesh_clear_facemap_customdata(me) == false) {
- BKE_report(reports, RPT_ERROR, "Error removing face-map");
- }
+ if (BKE_mesh_clear_facemap_customdata(me) == false) {
+ BKE_report(reports, RPT_ERROR, "Error removing face-map");
+ }
}
/* End face maps */
-
/* poly.vertices - this is faked loop access for convenience */
static int rna_MeshPoly_vertices_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
- MPoly *mp = (MPoly *)ptr->data;
- /* note, raw access uses dummy item, this _could_ crash, watch out for this, mface uses it but it cant work here */
- return (length[0] = mp->totloop);
+ MPoly *mp = (MPoly *)ptr->data;
+ /* note, raw access uses dummy item, this _could_ crash, watch out for this, mface uses it but it cant work here */
+ return (length[0] = mp->totloop);
}
static void rna_MeshPoly_vertices_get(PointerRNA *ptr, int *values)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mp = (MPoly *)ptr->data;
- MLoop *ml = &me->mloop[mp->loopstart];
- unsigned int i;
- for (i = mp->totloop; i > 0; i--, values++, ml++) {
- *values = ml->v;
- }
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp = (MPoly *)ptr->data;
+ MLoop *ml = &me->mloop[mp->loopstart];
+ unsigned int i;
+ for (i = mp->totloop; i > 0; i--, values++, ml++) {
+ *values = ml->v;
+ }
}
static void rna_MeshPoly_vertices_set(PointerRNA *ptr, const int *values)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mp = (MPoly *)ptr->data;
- MLoop *ml = &me->mloop[mp->loopstart];
- unsigned int i;
- for (i = mp->totloop; i > 0; i--, values++, ml++) {
- ml->v = *values;
- }
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mp = (MPoly *)ptr->data;
+ MLoop *ml = &me->mloop[mp->loopstart];
+ unsigned int i;
+ for (i = mp->totloop; i > 0; i--, values++, ml++) {
+ ml->v = *values;
+ }
}
/* disabling, some importers don't know the total material count when assigning materials */
-#if 0
+# if 0
static void rna_MeshPoly_material_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- Mesh *me = rna_mesh(ptr);
- *min = 0;
- *max = max_ii(0, me->totcol - 1);
+ Mesh *me = rna_mesh(ptr);
+ *min = 0;
+ *max = max_ii(0, me->totcol - 1);
}
-#endif
+# endif
static int rna_MeshVertex_index_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MVert *vert = (MVert *)ptr->data;
- return (int)(vert - me->mvert);
+ Mesh *me = rna_mesh(ptr);
+ MVert *vert = (MVert *)ptr->data;
+ return (int)(vert - me->mvert);
}
static int rna_MeshEdge_index_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MEdge *edge = (MEdge *)ptr->data;
- return (int)(edge - me->medge);
+ Mesh *me = rna_mesh(ptr);
+ MEdge *edge = (MEdge *)ptr->data;
+ return (int)(edge - me->medge);
}
static int rna_MeshLoopTriangle_index_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MLoopTri *ltri = (MLoopTri *)ptr->data;
- return (int)(ltri - me->runtime.looptris.array);
+ Mesh *me = rna_mesh(ptr);
+ MLoopTri *ltri = (MLoopTri *)ptr->data;
+ return (int)(ltri - me->runtime.looptris.array);
}
static int rna_MeshLoopTriangle_material_index_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MLoopTri *ltri = (MLoopTri *)ptr->data;
- return me->mpoly[ltri->poly].mat_nr;
+ Mesh *me = rna_mesh(ptr);
+ MLoopTri *ltri = (MLoopTri *)ptr->data;
+ return me->mpoly[ltri->poly].mat_nr;
}
static bool rna_MeshLoopTriangle_use_smooth_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MLoopTri *ltri = (MLoopTri *)ptr->data;
- return me->mpoly[ltri->poly].flag & ME_SMOOTH;
+ Mesh *me = rna_mesh(ptr);
+ MLoopTri *ltri = (MLoopTri *)ptr->data;
+ return me->mpoly[ltri->poly].flag & ME_SMOOTH;
}
static int rna_MeshPolygon_index_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MPoly *mpoly = (MPoly *)ptr->data;
- return (int)(mpoly - me->mpoly);
+ Mesh *me = rna_mesh(ptr);
+ MPoly *mpoly = (MPoly *)ptr->data;
+ return (int)(mpoly - me->mpoly);
}
static int rna_MeshLoop_index_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- MLoop *mloop = (MLoop *)ptr->data;
- return (int)(mloop - me->mloop);
+ Mesh *me = rna_mesh(ptr);
+ MLoop *mloop = (MLoop *)ptr->data;
+ return (int)(mloop - me->mloop);
}
/* path construction */
static char *rna_VertexGroupElement_path(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr); /* XXX not always! */
- MDeformWeight *dw = (MDeformWeight *)ptr->data;
- MDeformVert *dvert;
- int a, b;
+ Mesh *me = rna_mesh(ptr); /* XXX not always! */
+ MDeformWeight *dw = (MDeformWeight *)ptr->data;
+ MDeformVert *dvert;
+ int a, b;
- for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++)
- for (b = 0; b < dvert->totweight; b++)
- if (dw == &dvert->dw[b])
- return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
+ for (a = 0, dvert = me->dvert; a < me->totvert; a++, dvert++)
+ for (b = 0; b < dvert->totweight; b++)
+ if (dw == &dvert->dw[b])
+ return BLI_sprintfN("vertices[%d].groups[%d]", a, b);
- return NULL;
+ return NULL;
}
static char *rna_MeshPolygon_path(PointerRNA *ptr)
{
- return BLI_sprintfN("polygons[%d]", (int)((MPoly *)ptr->data - rna_mesh(ptr)->mpoly));
+ return BLI_sprintfN("polygons[%d]", (int)((MPoly *)ptr->data - rna_mesh(ptr)->mpoly));
}
static char *rna_MeshLoopTriangle_path(PointerRNA *ptr)
{
- return BLI_sprintfN("loop_triangles[%d]", (int)((MLoopTri *)ptr->data - rna_mesh(ptr)->runtime.looptris.array));
+ return BLI_sprintfN("loop_triangles[%d]",
+ (int)((MLoopTri *)ptr->data - rna_mesh(ptr)->runtime.looptris.array));
}
static char *rna_MeshEdge_path(PointerRNA *ptr)
{
- return BLI_sprintfN("edges[%d]", (int)((MEdge *)ptr->data - rna_mesh(ptr)->medge));
+ return BLI_sprintfN("edges[%d]", (int)((MEdge *)ptr->data - rna_mesh(ptr)->medge));
}
static char *rna_MeshLoop_path(PointerRNA *ptr)
{
- return BLI_sprintfN("loops[%d]", (int)((MLoop *)ptr->data - rna_mesh(ptr)->mloop));
+ return BLI_sprintfN("loops[%d]", (int)((MLoop *)ptr->data - rna_mesh(ptr)->mloop));
}
-
static char *rna_MeshVertex_path(PointerRNA *ptr)
{
- return BLI_sprintfN("vertices[%d]", (int)((MVert *)ptr->data - rna_mesh(ptr)->mvert));
+ return BLI_sprintfN("vertices[%d]", (int)((MVert *)ptr->data - rna_mesh(ptr)->mvert));
}
static char *rna_VertCustomData_data_path(PointerRNA *ptr, const char *collection, int type)
{
- CustomDataLayer *cdl;
- Mesh *me = rna_mesh(ptr);
- CustomData *vdata = rna_mesh_vdata(ptr);
- int a, b, totvert = (me->edit_mesh) ? 0 : me->totvert;
+ CustomDataLayer *cdl;
+ Mesh *me = rna_mesh(ptr);
+ CustomData *vdata = rna_mesh_vdata(ptr);
+ int a, b, totvert = (me->edit_mesh) ? 0 : me->totvert;
- for (cdl = vdata->layers, a = 0; a < vdata->totlayer; cdl++, a++) {
- if (cdl->type == type) {
- b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
- if (b >= 0 && b < totvert) {
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
- }
- }
- }
+ for (cdl = vdata->layers, a = 0; a < vdata->totlayer; cdl++, a++) {
+ if (cdl->type == type) {
+ b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
+ if (b >= 0 && b < totvert) {
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
static char *rna_PolyCustomData_data_path(PointerRNA *ptr, const char *collection, int type)
{
- CustomDataLayer *cdl;
- Mesh *me = rna_mesh(ptr);
- CustomData *pdata = rna_mesh_pdata(ptr);
- int a, b, totpoly = (me->edit_mesh) ? 0 : me->totpoly;
+ CustomDataLayer *cdl;
+ Mesh *me = rna_mesh(ptr);
+ CustomData *pdata = rna_mesh_pdata(ptr);
+ int a, b, totpoly = (me->edit_mesh) ? 0 : me->totpoly;
- for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
- if (cdl->type == type) {
- b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
- if (b >= 0 && b < totpoly) {
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
- }
- }
- }
+ for (cdl = pdata->layers, a = 0; a < pdata->totlayer; cdl++, a++) {
+ if (cdl->type == type) {
+ b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
+ if (b >= 0 && b < totpoly) {
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
static char *rna_LoopCustomData_data_path(PointerRNA *ptr, const char *collection, int type)
{
- CustomDataLayer *cdl;
- Mesh *me = rna_mesh(ptr);
- CustomData *ldata = rna_mesh_ldata(ptr);
- int a, b, totloop = (me->edit_mesh) ? 0 : me->totloop;
+ CustomDataLayer *cdl;
+ Mesh *me = rna_mesh(ptr);
+ CustomData *ldata = rna_mesh_ldata(ptr);
+ int a, b, totloop = (me->edit_mesh) ? 0 : me->totloop;
- for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
- if (cdl->type == type) {
- b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
- if (b >= 0 && b < totloop) {
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
- }
- }
- }
+ for (cdl = ldata->layers, a = 0; a < ldata->totlayer; cdl++, a++) {
+ if (cdl->type == type) {
+ b = ((char *)ptr->data - ((char *)cdl->data)) / CustomData_sizeof(type);
+ if (b >= 0 && b < totloop) {
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("%s[\"%s\"].data[%d]", collection, name_esc, b);
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
static char *rna_MeshUVLoop_path(PointerRNA *ptr)
{
- return rna_LoopCustomData_data_path(ptr, "uv_layers", CD_MLOOPUV);
+ return rna_LoopCustomData_data_path(ptr, "uv_layers", CD_MLOOPUV);
}
static char *rna_MeshLoopColorLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("vertex_colors[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("vertex_colors[\"%s\"]", name_esc);
}
static char *rna_MeshColor_path(PointerRNA *ptr)
{
- return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL);
+ return rna_LoopCustomData_data_path(ptr, "vertex_colors", CD_MLOOPCOL);
}
/**** Float Property Layer API ****/
static char *rna_MeshVertexFloatPropertyLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("vertex_float_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("vertex_float_layers[\"%s\"]", name_esc);
}
static char *rna_MeshPolygonFloatPropertyLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("polygon_float_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("polygon_float_layers[\"%s\"]", name_esc);
}
static char *rna_MeshVertexFloatProperty_path(PointerRNA *ptr)
{
- return rna_VertCustomData_data_path(ptr, "vertex_layers_float", CD_PROP_FLT);
+ return rna_VertCustomData_data_path(ptr, "vertex_layers_float", CD_PROP_FLT);
}
static char *rna_MeshPolygonFloatProperty_path(PointerRNA *ptr)
{
- return rna_PolyCustomData_data_path(ptr, "polygon_layers_float", CD_PROP_FLT);
+ return rna_PolyCustomData_data_path(ptr, "polygon_layers_float", CD_PROP_FLT);
}
-static void rna_MeshVertexFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshVertexFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totvert, 0, NULL);
}
-static void rna_MeshPolygonFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshPolygonFloatPropertyLayer_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totpoly, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MFloatProperty), me->totpoly, 0, NULL);
}
static int rna_MeshVertexFloatPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totvert;
+ Mesh *me = rna_mesh(ptr);
+ return me->totvert;
}
static int rna_MeshPolygonFloatPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totpoly;
+ Mesh *me = rna_mesh(ptr);
+ return me->totpoly;
}
/**** Int Property Layer API ****/
static char *rna_MeshVertexIntPropertyLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("vertex_int_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("vertex_int_layers[\"%s\"]", name_esc);
}
static char *rna_MeshPolygonIntPropertyLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("polygon_int_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("polygon_int_layers[\"%s\"]", name_esc);
}
static char *rna_MeshVertexIntProperty_path(PointerRNA *ptr)
{
- return rna_VertCustomData_data_path(ptr, "vertex_layers_int", CD_PROP_INT);
+ return rna_VertCustomData_data_path(ptr, "vertex_layers_int", CD_PROP_INT);
}
static char *rna_MeshPolygonIntProperty_path(PointerRNA *ptr)
{
- return rna_PolyCustomData_data_path(ptr, "polygon_layers_int", CD_PROP_INT);
+ return rna_PolyCustomData_data_path(ptr, "polygon_layers_int", CD_PROP_INT);
}
-static void rna_MeshVertexIntPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshVertexIntPropertyLayer_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totvert, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totvert, 0, NULL);
}
-static void rna_MeshPolygonIntPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshPolygonIntPropertyLayer_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totpoly, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MIntProperty), me->totpoly, 0, NULL);
}
static int rna_MeshVertexIntPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totvert;
+ Mesh *me = rna_mesh(ptr);
+ return me->totvert;
}
static int rna_MeshPolygonIntPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totpoly;
+ Mesh *me = rna_mesh(ptr);
+ return me->totpoly;
}
/**** String Property Layer API ****/
static char *rna_MeshVertexStringPropertyLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("vertex_string_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("vertex_string_layers[\"%s\"]", name_esc);
}
static char *rna_MeshPolygonStringPropertyLayer_path(PointerRNA *ptr)
{
- CustomDataLayer *cdl = ptr->data;
- char name_esc[sizeof(cdl->name) * 2];
- BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
- return BLI_sprintfN("polygon_string_layers[\"%s\"]", name_esc);
+ CustomDataLayer *cdl = ptr->data;
+ char name_esc[sizeof(cdl->name) * 2];
+ BLI_strescape(name_esc, cdl->name, sizeof(name_esc));
+ return BLI_sprintfN("polygon_string_layers[\"%s\"]", name_esc);
}
static char *rna_MeshVertexStringProperty_path(PointerRNA *ptr)
{
- return rna_VertCustomData_data_path(ptr, "vertex_layers_string", CD_PROP_STR);
+ return rna_VertCustomData_data_path(ptr, "vertex_layers_string", CD_PROP_STR);
}
static char *rna_MeshPolygonStringProperty_path(PointerRNA *ptr)
{
- return rna_PolyCustomData_data_path(ptr, "polygon_layers_string", CD_PROP_STR);
+ return rna_PolyCustomData_data_path(ptr, "polygon_layers_string", CD_PROP_STR);
}
-static void rna_MeshVertexStringPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshVertexStringPropertyLayer_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totvert, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totvert, 0, NULL);
}
-static void rna_MeshPolygonStringPropertyLayer_data_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_MeshPolygonStringPropertyLayer_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
- rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totpoly, 0, NULL);
+ Mesh *me = rna_mesh(ptr);
+ CustomDataLayer *layer = (CustomDataLayer *)ptr->data;
+ rna_iterator_array_begin(iter, layer->data, sizeof(MStringProperty), me->totpoly, 0, NULL);
}
static int rna_MeshVertexStringPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totvert;
+ Mesh *me = rna_mesh(ptr);
+ return me->totvert;
}
static int rna_MeshPolygonStringPropertyLayer_data_length(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->totpoly;
+ Mesh *me = rna_mesh(ptr);
+ return me->totpoly;
}
/* XXX, we dont have proper byte string support yet, so for now use the (bytes + 1)
* bmesh API exposes correct python/bytestring access */
void rna_MeshStringProperty_s_get(PointerRNA *ptr, char *value)
{
- MStringProperty *ms = (MStringProperty *)ptr->data;
- BLI_strncpy(value, ms->s, (int)ms->s_len + 1);
+ MStringProperty *ms = (MStringProperty *)ptr->data;
+ BLI_strncpy(value, ms->s, (int)ms->s_len + 1);
}
int rna_MeshStringProperty_s_length(PointerRNA *ptr)
{
- MStringProperty *ms = (MStringProperty *)ptr->data;
- return (int)ms->s_len + 1;
+ MStringProperty *ms = (MStringProperty *)ptr->data;
+ return (int)ms->s_len + 1;
}
void rna_MeshStringProperty_s_set(PointerRNA *ptr, const char *value)
{
- MStringProperty *ms = (MStringProperty *)ptr->data;
- BLI_strncpy(ms->s, value, sizeof(ms->s));
+ MStringProperty *ms = (MStringProperty *)ptr->data;
+ BLI_strncpy(ms->s, value, sizeof(ms->s));
}
static char *rna_MeshFaceMap_path(PointerRNA *ptr)
{
- return rna_PolyCustomData_data_path(ptr, "face_maps", CD_FACEMAP);
+ return rna_PolyCustomData_data_path(ptr, "face_maps", CD_FACEMAP);
}
/***************************************/
static int rna_Mesh_tot_vert_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->edit_mesh ? me->edit_mesh->bm->totvertsel : 0;
+ Mesh *me = rna_mesh(ptr);
+ return me->edit_mesh ? me->edit_mesh->bm->totvertsel : 0;
}
static int rna_Mesh_tot_edge_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->edit_mesh ? me->edit_mesh->bm->totedgesel : 0;
+ Mesh *me = rna_mesh(ptr);
+ return me->edit_mesh ? me->edit_mesh->bm->totedgesel : 0;
}
static int rna_Mesh_tot_face_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0;
+ Mesh *me = rna_mesh(ptr);
+ return me->edit_mesh ? me->edit_mesh->bm->totfacesel : 0;
}
static PointerRNA rna_Mesh_vertex_color_new(struct Mesh *me, const char *name, const bool do_init)
{
- PointerRNA ptr;
- CustomData *ldata;
- CustomDataLayer *cdl = NULL;
- int index = ED_mesh_color_add(me, name, false, do_init);
-
- if (index != -1) {
- ldata = rna_mesh_ldata_helper(me);
- cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, index)];
- }
-
- RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr);
- return ptr;
-}
-
-static void rna_Mesh_vertex_color_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
-{
- if (ED_mesh_color_remove_named(me, layer->name) == false) {
- BKE_reportf(reports, RPT_ERROR, "Vertex color '%s' not found", layer->name);
- }
-}
-
-#define DEFINE_CUSTOMDATA_PROPERTY_API(elemname, datatype, cd_prop_type, cdata, countvar, layertype) \
-static PointerRNA rna_Mesh_##elemname##_##datatype##_property_new(struct Mesh *me, const char *name) \
-{ \
- PointerRNA ptr; \
- CustomDataLayer *cdl = NULL; \
- int index; \
- \
- CustomData_add_layer_named(&me->cdata, cd_prop_type, CD_DEFAULT, NULL, me->countvar, name); \
- index = CustomData_get_named_layer_index(&me->cdata, cd_prop_type, name); \
- \
- cdl = (index == -1) ? NULL : &(me->cdata.layers[index]); \
- \
- RNA_pointer_create(&me->id, &RNA_##layertype, cdl, &ptr); \
- return ptr; \
-}
-
-DEFINE_CUSTOMDATA_PROPERTY_API(vertex, float, CD_PROP_FLT, vdata, totvert, MeshVertexFloatPropertyLayer)
-DEFINE_CUSTOMDATA_PROPERTY_API(vertex, int, CD_PROP_INT, vdata, totvert, MeshVertexIntPropertyLayer)
-DEFINE_CUSTOMDATA_PROPERTY_API(vertex, string, CD_PROP_STR, vdata, totvert, MeshVertexStringPropertyLayer)
-DEFINE_CUSTOMDATA_PROPERTY_API(polygon, float, CD_PROP_FLT, pdata, totpoly, MeshPolygonFloatPropertyLayer)
-DEFINE_CUSTOMDATA_PROPERTY_API(polygon, int, CD_PROP_INT, pdata, totpoly, MeshPolygonIntPropertyLayer)
-DEFINE_CUSTOMDATA_PROPERTY_API(polygon, string, CD_PROP_STR, pdata, totpoly, MeshPolygonStringPropertyLayer)
-#undef DEFINE_CUSTOMDATA_PROPERTY_API
+ PointerRNA ptr;
+ CustomData *ldata;
+ CustomDataLayer *cdl = NULL;
+ int index = ED_mesh_color_add(me, name, false, do_init);
+
+ if (index != -1) {
+ ldata = rna_mesh_ldata_helper(me);
+ cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPCOL, index)];
+ }
+
+ RNA_pointer_create(&me->id, &RNA_MeshLoopColorLayer, cdl, &ptr);
+ return ptr;
+}
+
+static void rna_Mesh_vertex_color_remove(struct Mesh *me,
+ ReportList *reports,
+ CustomDataLayer *layer)
+{
+ if (ED_mesh_color_remove_named(me, layer->name) == false) {
+ BKE_reportf(reports, RPT_ERROR, "Vertex color '%s' not found", layer->name);
+ }
+}
+
+# define DEFINE_CUSTOMDATA_PROPERTY_API( \
+ elemname, datatype, cd_prop_type, cdata, countvar, layertype) \
+ static PointerRNA rna_Mesh_##elemname##_##datatype##_property_new(struct Mesh *me, \
+ const char *name) \
+ { \
+ PointerRNA ptr; \
+ CustomDataLayer *cdl = NULL; \
+ int index; \
+\
+ CustomData_add_layer_named(&me->cdata, cd_prop_type, CD_DEFAULT, NULL, me->countvar, name); \
+ index = CustomData_get_named_layer_index(&me->cdata, cd_prop_type, name); \
+\
+ cdl = (index == -1) ? NULL : &(me->cdata.layers[index]); \
+\
+ RNA_pointer_create(&me->id, &RNA_##layertype, cdl, &ptr); \
+ return ptr; \
+ }
+
+DEFINE_CUSTOMDATA_PROPERTY_API(
+ vertex, float, CD_PROP_FLT, vdata, totvert, MeshVertexFloatPropertyLayer)
+DEFINE_CUSTOMDATA_PROPERTY_API(
+ vertex, int, CD_PROP_INT, vdata, totvert, MeshVertexIntPropertyLayer)
+DEFINE_CUSTOMDATA_PROPERTY_API(
+ vertex, string, CD_PROP_STR, vdata, totvert, MeshVertexStringPropertyLayer)
+DEFINE_CUSTOMDATA_PROPERTY_API(
+ polygon, float, CD_PROP_FLT, pdata, totpoly, MeshPolygonFloatPropertyLayer)
+DEFINE_CUSTOMDATA_PROPERTY_API(
+ polygon, int, CD_PROP_INT, pdata, totpoly, MeshPolygonIntPropertyLayer)
+DEFINE_CUSTOMDATA_PROPERTY_API(
+ polygon, string, CD_PROP_STR, pdata, totpoly, MeshPolygonStringPropertyLayer)
+# undef DEFINE_CUSTOMDATA_PROPERTY_API
static PointerRNA rna_Mesh_uv_layers_new(struct Mesh *me, const char *name, const bool do_init)
{
- PointerRNA ptr;
- CustomData *ldata;
- CustomDataLayer *cdl = NULL;
- int index = ED_mesh_uv_texture_add(me, name, false, do_init);
+ PointerRNA ptr;
+ CustomData *ldata;
+ CustomDataLayer *cdl = NULL;
+ int index = ED_mesh_uv_texture_add(me, name, false, do_init);
- if (index != -1) {
- ldata = rna_mesh_ldata_helper(me);
- cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPUV, index)];
- }
+ if (index != -1) {
+ ldata = rna_mesh_ldata_helper(me);
+ cdl = &ldata->layers[CustomData_get_layer_index_n(ldata, CD_MLOOPUV, index)];
+ }
- RNA_pointer_create(&me->id, &RNA_MeshUVLoopLayer, cdl, &ptr);
- return ptr;
+ RNA_pointer_create(&me->id, &RNA_MeshUVLoopLayer, cdl, &ptr);
+ return ptr;
}
static void rna_Mesh_uv_layers_remove(struct Mesh *me, ReportList *reports, CustomDataLayer *layer)
{
- if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) {
- BKE_reportf(reports, RPT_ERROR, "Texture layer '%s' not found", layer->name);
- }
+ if (ED_mesh_uv_texture_remove_named(me, layer->name) == false) {
+ BKE_reportf(reports, RPT_ERROR, "Texture layer '%s' not found", layer->name);
+ }
}
static bool rna_Mesh_is_editmode_get(PointerRNA *ptr)
{
- Mesh *me = rna_mesh(ptr);
- return (me->edit_mesh != NULL);
+ Mesh *me = rna_mesh(ptr);
+ return (me->edit_mesh != NULL);
}
/* only to quiet warnings */
static void UNUSED_FUNCTION(rna_mesh_unused)(void)
{
- /* unused functions made by macros */
- (void)rna_Mesh_skin_vertice_index_range;
- (void)rna_Mesh_vertex_paint_mask_index_range;
- (void)rna_Mesh_uv_layer_render_get;
- (void)rna_Mesh_uv_layer_render_index_get;
- (void)rna_Mesh_uv_layer_render_index_set;
- (void)rna_Mesh_uv_layer_render_set;
- (void)rna_Mesh_vertex_color_render_get;
- (void)rna_Mesh_vertex_color_render_index_get;
- (void)rna_Mesh_vertex_color_render_index_set;
- (void)rna_Mesh_vertex_color_render_set;
- (void)rna_Mesh_face_map_index_range;
- (void)rna_Mesh_face_map_active_index_set;
- (void)rna_Mesh_face_map_active_index_get;
- (void)rna_Mesh_face_map_active_set;
- /* end unused function block */
+ /* unused functions made by macros */
+ (void)rna_Mesh_skin_vertice_index_range;
+ (void)rna_Mesh_vertex_paint_mask_index_range;
+ (void)rna_Mesh_uv_layer_render_get;
+ (void)rna_Mesh_uv_layer_render_index_get;
+ (void)rna_Mesh_uv_layer_render_index_set;
+ (void)rna_Mesh_uv_layer_render_set;
+ (void)rna_Mesh_vertex_color_render_get;
+ (void)rna_Mesh_vertex_color_render_index_get;
+ (void)rna_Mesh_vertex_color_render_index_set;
+ (void)rna_Mesh_vertex_color_render_set;
+ (void)rna_Mesh_face_map_index_range;
+ (void)rna_Mesh_face_map_active_index_set;
+ (void)rna_Mesh_face_map_active_index_get;
+ (void)rna_Mesh_face_map_active_set;
+ /* end unused function block */
}
#else
static void rna_def_mvert_group(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "VertexGroupElement", NULL);
- RNA_def_struct_sdna(srna, "MDeformWeight");
- RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path");
- RNA_def_struct_ui_text(srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
- RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
+ srna = RNA_def_struct(brna, "VertexGroupElement", NULL);
+ RNA_def_struct_sdna(srna, "MDeformWeight");
+ RNA_def_struct_path_func(srna, "rna_VertexGroupElement_path");
+ RNA_def_struct_ui_text(
+ srna, "Vertex Group Element", "Weight value of a vertex in a vertex group");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
- /* we can't point to actual group, it is in the object and so
- * there is no unique group to point to, hence the index */
- prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "def_nr");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Group Index", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ /* we can't point to actual group, it is in the object and so
+ * there is no unique group to point to, hence the index */
+ prop = RNA_def_property(srna, "group", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "def_nr");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Group Index", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_weight");
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Vertex Weight");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_weight");
}
static void rna_def_mvert(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshVertex", NULL);
- RNA_def_struct_sdna(srna, "MVert");
- RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh data-block");
- RNA_def_struct_path_func(srna, "rna_MeshVertex_path");
- RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
- /* RNA_def_property_float_sdna(prop, NULL, "no"); */
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_float_funcs(prop, "rna_MeshVertex_normal_get", "rna_MeshVertex_normal_set", NULL);
- RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
- RNA_def_property_ui_text(prop, "Hide", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
- RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_MeshVertex_groups_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "VertexGroupElement");
- RNA_def_property_ui_text(prop, "Groups", "Weights for the vertex groups this vertex is member of");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index of this vertex");
-
- prop = RNA_def_property(srna, "undeformed_co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Undeformed Location",
- "For meshes with modifiers applied, the coordinate of the vertex with no deforming "
- "modifiers applied, as used for generated texture coordinates");
- RNA_def_property_float_funcs(prop, "rna_MeshVertex_undeformed_co_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshVertex", NULL);
+ RNA_def_struct_sdna(srna, "MVert");
+ RNA_def_struct_ui_text(srna, "Mesh Vertex", "Vertex in a Mesh data-block");
+ RNA_def_struct_path_func(srna, "rna_MeshVertex_path");
+ RNA_def_struct_ui_icon(srna, ICON_VERTEXSEL);
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+ /* RNA_def_property_float_sdna(prop, NULL, "no"); */
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_float_funcs(
+ prop, "rna_MeshVertex_normal_get", "rna_MeshVertex_normal_set", NULL);
+ RNA_def_property_ui_text(prop, "Normal", "Vertex Normal");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
+ RNA_def_property_ui_text(prop, "Hide", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_MeshVertex_bevel_weight_get", "rna_MeshVertex_bevel_weight_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Bevel Weight", "Weight used by the Bevel modifier 'Only Vertices' option");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_MeshVertex_groups_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "VertexGroupElement");
+ RNA_def_property_ui_text(
+ prop, "Groups", "Weights for the vertex groups this vertex is member of");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshVertex_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this vertex");
+
+ prop = RNA_def_property(srna, "undeformed_co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Undeformed Location",
+ "For meshes with modifiers applied, the coordinate of the vertex with no deforming "
+ "modifiers applied, as used for generated texture coordinates");
+ RNA_def_property_float_funcs(prop, "rna_MeshVertex_undeformed_co_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_medge(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshEdge", NULL);
- RNA_def_struct_sdna(srna, "MEdge");
- RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh data-block");
- RNA_def_struct_path_func(srna, "rna_MeshEdge_path");
- RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
-
- prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "v1");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
- /* XXX allows creating invalid meshes */
-
- prop = RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_MEdge_crease_get", "rna_MEdge_crease_set", NULL);
- RNA_def_property_ui_text(prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
- RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
- RNA_def_property_ui_text(prop, "Hide", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SEAM);
- RNA_def_property_ui_text(prop, "Seam", "Seam edge for UV unwrapping");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SHARP);
- RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the Edge Split modifier");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_LOOSEEDGE);
- RNA_def_property_ui_text(prop, "Loose", "Loose edge");
-
- prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_MEdge_freestyle_edge_mark_get", "rna_MEdge_freestyle_edge_mark_set");
- RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "Edge mark for Freestyle line rendering");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshEdge_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index of this edge");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshEdge", NULL);
+ RNA_def_struct_sdna(srna, "MEdge");
+ RNA_def_struct_ui_text(srna, "Mesh Edge", "Edge in a Mesh data-block");
+ RNA_def_struct_path_func(srna, "rna_MeshEdge_path");
+ RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
+
+ prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "v1");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
+ /* XXX allows creating invalid meshes */
+
+ prop = RNA_def_property(srna, "crease", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(prop, "rna_MEdge_crease_get", "rna_MEdge_crease_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Crease", "Weight used by the Subdivision Surface modifier for creasing");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "bevel_weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_MEdge_bevel_weight_get", "rna_MEdge_bevel_weight_set", NULL);
+ RNA_def_property_ui_text(prop, "Bevel Weight", "Weight used by the Bevel modifier");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
+ RNA_def_property_ui_text(prop, "Hide", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "use_seam", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SEAM);
+ RNA_def_property_ui_text(prop, "Seam", "Seam edge for UV unwrapping");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SHARP);
+ RNA_def_property_ui_text(prop, "Sharp", "Sharp edge for the Edge Split modifier");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "is_loose", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_LOOSEEDGE);
+ RNA_def_property_ui_text(prop, "Loose", "Loose edge");
+
+ prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_MEdge_freestyle_edge_mark_get", "rna_MEdge_freestyle_edge_mark_set");
+ RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "Edge mark for Freestyle line rendering");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshEdge_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this edge");
}
static void rna_def_mlooptri(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- const int splitnor_dim[] = {3, 3};
-
- srna = RNA_def_struct(brna, "MeshLoopTriangle", NULL);
- RNA_def_struct_sdna(srna, "MLoopTri");
- RNA_def_struct_ui_text(srna, "Mesh Loop Triangle", "Tessellated triangle in a Mesh data-block");
- RNA_def_struct_path_func(srna, "rna_MeshLoopTriangle_path");
- RNA_def_struct_ui_icon(srna, ICON_FACESEL);
-
- prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_array(prop, 3);
- RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_verts_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Vertices", "Indices of triangle vertices");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "loops", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "tri");
- RNA_def_property_ui_text(prop, "Loops", "Indices of mesh loops that make up the triangle");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "polygon_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "poly");
- RNA_def_property_ui_text(prop, "Polygon", "Index of mesh polygon that the triangle is a part of");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_normal_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Triangle Normal", "Local space unit length normal vector for this triangle");
-
- prop = RNA_def_property(srna, "split_normals", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_multi_array(prop, 2, splitnor_dim);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_split_normals_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Split Normals",
- "Local space unit length split normals vectors of the vertices of this triangle "
- "(must be computed beforehand using calc_normals_split or calc_tangents)");
-
- prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_area_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Triangle Area", "Area of this triangle");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index of this loop triangle");
-
- prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_material_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Material Index", "");
-
- prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_MeshLoopTriangle_use_smooth_get", NULL);
- RNA_def_property_ui_text(prop, "Smooth", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ const int splitnor_dim[] = {3, 3};
+
+ srna = RNA_def_struct(brna, "MeshLoopTriangle", NULL);
+ RNA_def_struct_sdna(srna, "MLoopTri");
+ RNA_def_struct_ui_text(srna, "Mesh Loop Triangle", "Tessellated triangle in a Mesh data-block");
+ RNA_def_struct_path_func(srna, "rna_MeshLoopTriangle_path");
+ RNA_def_struct_ui_icon(srna, ICON_FACESEL);
+
+ prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_verts_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Vertices", "Indices of triangle vertices");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "loops", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "tri");
+ RNA_def_property_ui_text(prop, "Loops", "Indices of mesh loops that make up the triangle");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "polygon_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "poly");
+ RNA_def_property_ui_text(
+ prop, "Polygon", "Index of mesh polygon that the triangle is a part of");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_normal_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Triangle Normal", "Local space unit length normal vector for this triangle");
+
+ prop = RNA_def_property(srna, "split_normals", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_multi_array(prop, 2, splitnor_dim);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_split_normals_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Split Normals",
+ "Local space unit length split normals vectors of the vertices of this triangle "
+ "(must be computed beforehand using calc_normals_split or calc_tangents)");
+
+ prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoopTriangle_area_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Triangle Area", "Area of this triangle");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this loop triangle");
+
+ prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshLoopTriangle_material_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Material Index", "");
+
+ prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshLoopTriangle_use_smooth_get", NULL);
+ RNA_def_property_ui_text(prop, "Smooth", "");
}
static void rna_def_mloop(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshLoop", NULL);
- RNA_def_struct_sdna(srna, "MLoop");
- RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh data-block");
- RNA_def_struct_path_func(srna, "rna_MeshLoop_path");
- RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
-
- prop = RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "v");
- RNA_def_property_ui_text(prop, "Vertex", "Vertex index");
-
- prop = RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "e");
- RNA_def_property_ui_text(prop, "Edge", "Edge index");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index of this loop");
-
- prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_float_funcs(prop, "rna_MeshLoop_normal_get", "rna_MeshLoop_normal_set", NULL);
- RNA_def_property_ui_text(prop, "Normal",
- "Local space unit length split normal vector of this vertex for this polygon "
- "(must be computed beforehand using calc_normals_split or calc_tangents)");
-
- prop = RNA_def_property(srna, "tangent", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshLoop_tangent_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Tangent",
- "Local space unit length tangent vector of this vertex for this polygon "
- "(must be computed beforehand using calc_tangents)");
-
- prop = RNA_def_property(srna, "bitangent_sign", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_sign_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Bitangent Sign",
- "Sign of the bitangent vector of this vertex for this polygon (must be computed "
- "beforehand using calc_tangents, bitangent = bitangent_sign * cross(normal, tangent))");
-
- prop = RNA_def_property(srna, "bitangent", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Bitangent",
- "Bitangent vector of this vertex for this polygon (must be computed beforehand using "
- "calc_tangents, *use it only if really needed*, slower access than bitangent_sign)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshLoop", NULL);
+ RNA_def_struct_sdna(srna, "MLoop");
+ RNA_def_struct_ui_text(srna, "Mesh Loop", "Loop in a Mesh data-block");
+ RNA_def_struct_path_func(srna, "rna_MeshLoop_path");
+ RNA_def_struct_ui_icon(srna, ICON_EDGESEL);
+
+ prop = RNA_def_property(srna, "vertex_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "v");
+ RNA_def_property_ui_text(prop, "Vertex", "Vertex index");
+
+ prop = RNA_def_property(srna, "edge_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "e");
+ RNA_def_property_ui_text(prop, "Edge", "Edge index");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshLoop_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this loop");
+
+ prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoop_normal_get", "rna_MeshLoop_normal_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Normal",
+ "Local space unit length split normal vector of this vertex for this polygon "
+ "(must be computed beforehand using calc_normals_split or calc_tangents)");
+
+ prop = RNA_def_property(srna, "tangent", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoop_tangent_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Tangent",
+ "Local space unit length tangent vector of this vertex for this polygon "
+ "(must be computed beforehand using calc_tangents)");
+
+ prop = RNA_def_property(srna, "bitangent_sign", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_sign_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Bitangent Sign",
+ "Sign of the bitangent vector of this vertex for this polygon (must be computed "
+ "beforehand using calc_tangents, bitangent = bitangent_sign * cross(normal, tangent))");
+
+ prop = RNA_def_property(srna, "bitangent", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshLoop_bitangent_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Bitangent",
+ "Bitangent vector of this vertex for this polygon (must be computed beforehand using "
+ "calc_tangents, *use it only if really needed*, slower access than bitangent_sign)");
}
static void rna_def_mpolygon(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "MeshPolygon", NULL);
- RNA_def_struct_sdna(srna, "MPoly");
- RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh data-block");
- RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
- RNA_def_struct_ui_icon(srna, ICON_FACESEL);
-
- /* Faked, actually access to loop vertex values, don't this way because manually setting up
- * vertex/edge per loop is very low level.
- * Instead we setup poly sizes, assign indices, then calc edges automatic when creating
- * meshes from rna/py. */
- prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
- /* Eek, this is still used in some cases but in fact we don't want to use it at all here. */
- RNA_def_property_array(prop, 3);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_MeshPoly_vertices_get_length");
- RNA_def_property_int_funcs(prop, "rna_MeshPoly_vertices_get", "rna_MeshPoly_vertices_set", NULL);
- RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
-
- /* these are both very low level access */
- prop = RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "loopstart");
- RNA_def_property_ui_text(prop, "Loop Start", "Index of the first loop of this polygon");
- /* also low level */
- prop = RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "totloop");
- RNA_def_property_ui_text(prop, "Loop Total", "Number of loops used by this polygon");
-
- prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "mat_nr");
- RNA_def_property_ui_text(prop, "Material Index", "");
-#if 0
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range");
-#endif
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL);
- RNA_def_property_ui_text(prop, "Select", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
- RNA_def_property_ui_text(prop, "Hide", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
-
- prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
- RNA_def_property_ui_text(prop, "Smooth", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_MPoly_freestyle_face_mark_get", "rna_MPoly_freestyle_face_mark_set");
- RNA_def_property_ui_text(prop, "Freestyle Face Mark", "Face mark for Freestyle line rendering");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Polygon Normal", "Local space unit length normal vector for this polygon");
-
- prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshPolygon_center_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Polygon Center", "Center of this polygon");
-
- prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this polygon");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index of this polygon");
-
- func = RNA_def_function(srna, "flip", "rna_MeshPolygon_flip");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Invert winding of this polygon (flip its normal)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "MeshPolygon", NULL);
+ RNA_def_struct_sdna(srna, "MPoly");
+ RNA_def_struct_ui_text(srna, "Mesh Polygon", "Polygon in a Mesh data-block");
+ RNA_def_struct_path_func(srna, "rna_MeshPolygon_path");
+ RNA_def_struct_ui_icon(srna, ICON_FACESEL);
+
+ /* Faked, actually access to loop vertex values, don't this way because manually setting up
+ * vertex/edge per loop is very low level.
+ * Instead we setup poly sizes, assign indices, then calc edges automatic when creating
+ * meshes from rna/py. */
+ prop = RNA_def_property(srna, "vertices", PROP_INT, PROP_UNSIGNED);
+ /* Eek, this is still used in some cases but in fact we don't want to use it at all here. */
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_MeshPoly_vertices_get_length");
+ RNA_def_property_int_funcs(prop, "rna_MeshPoly_vertices_get", "rna_MeshPoly_vertices_set", NULL);
+ RNA_def_property_ui_text(prop, "Vertices", "Vertex indices");
+
+ /* these are both very low level access */
+ prop = RNA_def_property(srna, "loop_start", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "loopstart");
+ RNA_def_property_ui_text(prop, "Loop Start", "Index of the first loop of this polygon");
+ /* also low level */
+ prop = RNA_def_property(srna, "loop_total", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "totloop");
+ RNA_def_property_ui_text(prop, "Loop Total", "Number of loops used by this polygon");
+
+ prop = RNA_def_property(srna, "material_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "mat_nr");
+ RNA_def_property_ui_text(prop, "Material Index", "");
+# if 0
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MeshPoly_material_index_range");
+# endif
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_FACE_SEL);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_HIDE);
+ RNA_def_property_ui_text(prop, "Hide", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_select");
+
+ prop = RNA_def_property(srna, "use_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_SMOOTH);
+ RNA_def_property_ui_text(prop, "Smooth", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "use_freestyle_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_MPoly_freestyle_face_mark_get", "rna_MPoly_freestyle_face_mark_set");
+ RNA_def_property_ui_text(prop, "Freestyle Face Mark", "Face mark for Freestyle line rendering");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshPolygon_normal_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Polygon Normal", "Local space unit length normal vector for this polygon");
+
+ prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshPolygon_center_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Polygon Center", "Center of this polygon");
+
+ prop = RNA_def_property(srna, "area", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MeshPolygon_area_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Polygon Area", "Read only area of this polygon");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_MeshPolygon_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index of this polygon");
+
+ func = RNA_def_function(srna, "flip", "rna_MeshPolygon_flip");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Invert winding of this polygon (flip its normal)");
}
/* mesh.loop_uvs */
static void rna_def_mloopuv(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshUVLoopLayer", NULL);
- RNA_def_struct_sdna(srna, "CustomDataLayer");
- RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path");
-
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshUVLoop");
- RNA_def_property_collection_funcs(prop, "rna_MeshUVLoopLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshUVLoopLayer_data_length", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_set");
- RNA_def_property_ui_text(prop, "Name", "Name of UV map");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_MeshUVLoopLayer_active_get", "rna_MeshUVLoopLayer_active_set");
- RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
- RNA_def_property_boolean_funcs(prop, "rna_MeshUVLoopLayer_active_render_get",
- "rna_MeshUVLoopLayer_active_render_set");
- RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
- RNA_def_property_boolean_funcs(prop, "rna_MeshUVLoopLayer_clone_get", "rna_MeshUVLoopLayer_clone_set");
- RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- srna = RNA_def_struct(brna, "MeshUVLoop", NULL);
- RNA_def_struct_sdna(srna, "MLoopUV");
- RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path");
-
- prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_PINNED);
- RNA_def_property_ui_text(prop, "UV Pinned", "");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL);
- RNA_def_property_ui_text(prop, "UV Select", "");
-
- prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL);
- RNA_def_property_ui_text(prop, "UV Edge Select", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshUVLoopLayer", NULL);
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshUVLoopLayer_path");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshUVLoop");
+ RNA_def_property_collection_funcs(prop,
+ "rna_MeshUVLoopLayer_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_MeshUVLoopLayer_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshUVLayer_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of UV map");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_MeshUVLoopLayer_active_get", "rna_MeshUVLoopLayer_active_set");
+ RNA_def_property_ui_text(prop, "Active", "Set the map as active for display and editing");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_MeshUVLoopLayer_active_render_get", "rna_MeshUVLoopLayer_active_render_set");
+ RNA_def_property_ui_text(prop, "Active Render", "Set the map as active for rendering");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "active_clone", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "active_clone", 0);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_MeshUVLoopLayer_clone_get", "rna_MeshUVLoopLayer_clone_set");
+ RNA_def_property_ui_text(prop, "Active Clone", "Set the map as active for cloning");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ srna = RNA_def_struct(brna, "MeshUVLoop", NULL);
+ RNA_def_struct_sdna(srna, "MLoopUV");
+ RNA_def_struct_path_func(srna, "rna_MeshUVLoop_path");
+
+ prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "pin_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_PINNED);
+ RNA_def_property_ui_text(prop, "UV Pinned", "");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_VERTSEL);
+ RNA_def_property_ui_text(prop, "UV Select", "");
+
+ prop = RNA_def_property(srna, "select_edge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MLOOPUV_EDGESEL);
+ RNA_def_property_ui_text(prop, "UV Edge Select", "");
}
static void rna_def_mloopcol(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshLoopColorLayer", NULL);
- RNA_def_struct_ui_text(srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh data-block");
- RNA_def_struct_sdna(srna, "CustomDataLayer");
- RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path");
- RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
- RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_get", "rna_MeshLoopColorLayer_active_set");
- RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
- RNA_def_property_boolean_funcs(prop, "rna_MeshLoopColorLayer_active_render_get",
- "rna_MeshLoopColorLayer_active_render_set");
- RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshLoopColor");
- RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshLoopColorLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshLoopColorLayer_data_length", NULL, NULL, NULL);
-
-
- srna = RNA_def_struct(brna, "MeshLoopColor", NULL);
- RNA_def_struct_sdna(srna, "MLoopCol");
- RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in a Mesh");
- RNA_def_struct_path_func(srna, "rna_MeshColor_path");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_funcs(prop, "rna_MeshLoopColor_color_get", "rna_MeshLoopColor_color_set", NULL);
- RNA_def_property_ui_text(prop, "Color", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshLoopColorLayer", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Mesh Vertex Color Layer", "Layer of vertex colors in a Mesh data-block");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshLoopColorLayer_path");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VCOL);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshLoopLayer_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of Vertex color layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_MeshLoopColorLayer_active_get", "rna_MeshLoopColorLayer_active_set");
+ RNA_def_property_ui_text(prop, "Active", "Sets the layer as active for display and editing");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "active_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "active_rnd", 0);
+ RNA_def_property_boolean_funcs(prop,
+ "rna_MeshLoopColorLayer_active_render_get",
+ "rna_MeshLoopColorLayer_active_render_set");
+ RNA_def_property_ui_text(prop, "Active Render", "Sets the layer as active for rendering");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshLoopColor");
+ RNA_def_property_ui_text(prop, "Data", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_MeshLoopColorLayer_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_MeshLoopColorLayer_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ srna = RNA_def_struct(brna, "MeshLoopColor", NULL);
+ RNA_def_struct_sdna(srna, "MLoopCol");
+ RNA_def_struct_ui_text(srna, "Mesh Vertex Color", "Vertex loop colors in a Mesh");
+ RNA_def_struct_path_func(srna, "rna_MeshColor_path");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_funcs(
+ prop, "rna_MeshLoopColor_color_get", "rna_MeshLoopColor_color_set", NULL);
+ RNA_def_property_ui_text(prop, "Color", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
static void rna_def_mproperties(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* Float */
-#define MESH_FLOAT_PROPERTY_LAYER(elemname) \
- srna = RNA_def_struct(brna, "Mesh" elemname "FloatPropertyLayer", NULL); \
- RNA_def_struct_sdna(srna, "CustomDataLayer"); \
- RNA_def_struct_ui_text(srna, "Mesh " elemname " Float Property Layer", "User defined layer of floating point number values"); \
- RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatPropertyLayer_path"); \
- \
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
- RNA_def_struct_name_property(srna, prop); \
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
- RNA_def_property_ui_text(prop, "Name", ""); \
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
- \
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
- RNA_def_property_struct_type(prop, "Mesh" elemname "FloatProperty"); \
- RNA_def_property_ui_text(prop, "Data", ""); \
- RNA_def_property_collection_funcs(prop, "rna_Mesh" elemname "FloatPropertyLayer_data_begin", "rna_iterator_array_next", \
- "rna_iterator_array_end", "rna_iterator_array_get", \
- "rna_Mesh" elemname "FloatPropertyLayer_data_length", NULL, NULL, NULL); \
- \
- srna = RNA_def_struct(brna, "Mesh" elemname "FloatProperty", NULL); \
- RNA_def_struct_sdna(srna, "MFloatProperty"); \
- RNA_def_struct_ui_text(srna, "Mesh " elemname " Float Property", \
- "User defined floating point number value in a float properties layer"); \
- RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatProperty_path"); \
- \
- prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); \
- RNA_def_property_float_sdna(prop, NULL, "f"); \
- RNA_def_property_ui_text(prop, "Value", ""); \
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- /* Int */
-#define MESH_INT_PROPERTY_LAYER(elemname) \
- srna = RNA_def_struct(brna, "Mesh" elemname "IntPropertyLayer", NULL); \
- RNA_def_struct_sdna(srna, "CustomDataLayer"); \
- RNA_def_struct_ui_text(srna, "Mesh " elemname " Int Property Layer", "User defined layer of integer number values"); \
- RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntPropertyLayer_path"); \
- \
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
- RNA_def_struct_name_property(srna, prop); \
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
- RNA_def_property_ui_text(prop, "Name", ""); \
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
- \
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
- RNA_def_property_struct_type(prop, "Mesh" elemname "IntProperty"); \
- RNA_def_property_ui_text(prop, "Data", ""); \
- RNA_def_property_collection_funcs(prop, "rna_Mesh" elemname "IntPropertyLayer_data_begin", "rna_iterator_array_next", \
- "rna_iterator_array_end", "rna_iterator_array_get", \
- "rna_Mesh" elemname "IntPropertyLayer_data_length", NULL, NULL, NULL); \
- \
- srna = RNA_def_struct(brna, "Mesh" elemname "IntProperty", NULL); \
- RNA_def_struct_sdna(srna, "MIntProperty"); \
- RNA_def_struct_ui_text(srna, "Mesh " elemname " Int Property", \
- "User defined integer number value in an integer properties layer"); \
- RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntProperty_path"); \
- \
- prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); \
- RNA_def_property_int_sdna(prop, NULL, "i"); \
- RNA_def_property_ui_text(prop, "Value", ""); \
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
-
- /* String */
-#define MESH_STRING_PROPERTY_LAYER(elemname) \
- srna = RNA_def_struct(brna, "Mesh" elemname "StringPropertyLayer", NULL); \
- RNA_def_struct_sdna(srna, "CustomDataLayer"); \
- RNA_def_struct_ui_text(srna, "Mesh " elemname " String Property Layer", "User defined layer of string text values"); \
- RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringPropertyLayer_path"); \
- \
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
- RNA_def_struct_name_property(srna, prop); \
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
- RNA_def_property_ui_text(prop, "Name", ""); \
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
- \
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
- RNA_def_property_struct_type(prop, "Mesh" elemname "StringProperty"); \
- RNA_def_property_ui_text(prop, "Data", ""); \
- RNA_def_property_collection_funcs(prop, "rna_Mesh" elemname "StringPropertyLayer_data_begin", "rna_iterator_array_next", \
- "rna_iterator_array_end", "rna_iterator_array_get", \
- "rna_Mesh" elemname "StringPropertyLayer_data_length", NULL, NULL, NULL); \
- \
- srna = RNA_def_struct(brna, "Mesh" elemname "StringProperty", NULL); \
- RNA_def_struct_sdna(srna, "MStringProperty"); \
- RNA_def_struct_ui_text(srna, "Mesh " elemname " String Property", \
- "User defined string text value in a string properties layer"); \
- RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringProperty_path"); \
- \
- /* low level mesh data access, treat as bytes */ \
- prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); \
- RNA_def_property_string_sdna(prop, NULL, "s"); \
- RNA_def_property_string_funcs(prop, "rna_MeshStringProperty_s_get", "rna_MeshStringProperty_s_length", "rna_MeshStringProperty_s_set"); \
- RNA_def_property_ui_text(prop, "Value", ""); \
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
-
- MESH_FLOAT_PROPERTY_LAYER("Vertex")
- MESH_FLOAT_PROPERTY_LAYER("Polygon")
- MESH_INT_PROPERTY_LAYER("Vertex")
- MESH_INT_PROPERTY_LAYER("Polygon")
- MESH_STRING_PROPERTY_LAYER("Vertex")
- MESH_STRING_PROPERTY_LAYER("Polygon")
-#undef MESH_PROPERTY_LAYER
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* Float */
+# define MESH_FLOAT_PROPERTY_LAYER(elemname) \
+ srna = RNA_def_struct(brna, "Mesh" elemname "FloatPropertyLayer", NULL); \
+ RNA_def_struct_sdna(srna, "CustomDataLayer"); \
+ RNA_def_struct_ui_text(srna, \
+ "Mesh " elemname " Float Property Layer", \
+ "User defined layer of floating point number values"); \
+ RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatPropertyLayer_path"); \
+\
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
+ RNA_def_struct_name_property(srna, prop); \
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
+ RNA_def_property_ui_text(prop, "Name", ""); \
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
+\
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
+ RNA_def_property_struct_type(prop, "Mesh" elemname "FloatProperty"); \
+ RNA_def_property_ui_text(prop, "Data", ""); \
+ RNA_def_property_collection_funcs(prop, \
+ "rna_Mesh" elemname "FloatPropertyLayer_data_begin", \
+ "rna_iterator_array_next", \
+ "rna_iterator_array_end", \
+ "rna_iterator_array_get", \
+ "rna_Mesh" elemname "FloatPropertyLayer_data_length", \
+ NULL, \
+ NULL, \
+ NULL); \
+\
+ srna = RNA_def_struct(brna, "Mesh" elemname "FloatProperty", NULL); \
+ RNA_def_struct_sdna(srna, "MFloatProperty"); \
+ RNA_def_struct_ui_text( \
+ srna, \
+ "Mesh " elemname " Float Property", \
+ "User defined floating point number value in a float properties layer"); \
+ RNA_def_struct_path_func(srna, "rna_Mesh" elemname "FloatProperty_path"); \
+\
+ prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE); \
+ RNA_def_property_float_sdna(prop, NULL, "f"); \
+ RNA_def_property_ui_text(prop, "Value", ""); \
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ /* Int */
+# define MESH_INT_PROPERTY_LAYER(elemname) \
+ srna = RNA_def_struct(brna, "Mesh" elemname "IntPropertyLayer", NULL); \
+ RNA_def_struct_sdna(srna, "CustomDataLayer"); \
+ RNA_def_struct_ui_text(srna, \
+ "Mesh " elemname " Int Property Layer", \
+ "User defined layer of integer number values"); \
+ RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntPropertyLayer_path"); \
+\
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
+ RNA_def_struct_name_property(srna, prop); \
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
+ RNA_def_property_ui_text(prop, "Name", ""); \
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
+\
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
+ RNA_def_property_struct_type(prop, "Mesh" elemname "IntProperty"); \
+ RNA_def_property_ui_text(prop, "Data", ""); \
+ RNA_def_property_collection_funcs(prop, \
+ "rna_Mesh" elemname "IntPropertyLayer_data_begin", \
+ "rna_iterator_array_next", \
+ "rna_iterator_array_end", \
+ "rna_iterator_array_get", \
+ "rna_Mesh" elemname "IntPropertyLayer_data_length", \
+ NULL, \
+ NULL, \
+ NULL); \
+\
+ srna = RNA_def_struct(brna, "Mesh" elemname "IntProperty", NULL); \
+ RNA_def_struct_sdna(srna, "MIntProperty"); \
+ RNA_def_struct_ui_text(srna, \
+ "Mesh " elemname " Int Property", \
+ "User defined integer number value in an integer properties layer"); \
+ RNA_def_struct_path_func(srna, "rna_Mesh" elemname "IntProperty_path"); \
+\
+ prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE); \
+ RNA_def_property_int_sdna(prop, NULL, "i"); \
+ RNA_def_property_ui_text(prop, "Value", ""); \
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ /* String */
+# define MESH_STRING_PROPERTY_LAYER(elemname) \
+ srna = RNA_def_struct(brna, "Mesh" elemname "StringPropertyLayer", NULL); \
+ RNA_def_struct_sdna(srna, "CustomDataLayer"); \
+ RNA_def_struct_ui_text(srna, \
+ "Mesh " elemname " String Property Layer", \
+ "User defined layer of string text values"); \
+ RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringPropertyLayer_path"); \
+\
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); \
+ RNA_def_struct_name_property(srna, prop); \
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshAnyLayer_name_set"); \
+ RNA_def_property_ui_text(prop, "Name", ""); \
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data"); \
+\
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE); \
+ RNA_def_property_struct_type(prop, "Mesh" elemname "StringProperty"); \
+ RNA_def_property_ui_text(prop, "Data", ""); \
+ RNA_def_property_collection_funcs(prop, \
+ "rna_Mesh" elemname "StringPropertyLayer_data_begin", \
+ "rna_iterator_array_next", \
+ "rna_iterator_array_end", \
+ "rna_iterator_array_get", \
+ "rna_Mesh" elemname "StringPropertyLayer_data_length", \
+ NULL, \
+ NULL, \
+ NULL); \
+\
+ srna = RNA_def_struct(brna, "Mesh" elemname "StringProperty", NULL); \
+ RNA_def_struct_sdna(srna, "MStringProperty"); \
+ RNA_def_struct_ui_text(srna, \
+ "Mesh " elemname " String Property", \
+ "User defined string text value in a string properties layer"); \
+ RNA_def_struct_path_func(srna, "rna_Mesh" elemname "StringProperty_path"); \
+\
+ /* low level mesh data access, treat as bytes */ \
+ prop = RNA_def_property(srna, "value", PROP_STRING, PROP_BYTESTRING); \
+ RNA_def_property_string_sdna(prop, NULL, "s"); \
+ RNA_def_property_string_funcs(prop, \
+ "rna_MeshStringProperty_s_get", \
+ "rna_MeshStringProperty_s_length", \
+ "rna_MeshStringProperty_s_set"); \
+ RNA_def_property_ui_text(prop, "Value", ""); \
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ MESH_FLOAT_PROPERTY_LAYER("Vertex")
+ MESH_FLOAT_PROPERTY_LAYER("Polygon")
+ MESH_INT_PROPERTY_LAYER("Vertex")
+ MESH_INT_PROPERTY_LAYER("Polygon")
+ MESH_STRING_PROPERTY_LAYER("Vertex")
+ MESH_STRING_PROPERTY_LAYER("Polygon")
+# undef MESH_PROPERTY_LAYER
}
void rna_def_texmat_common(StructRNA *srna, const char *texspace_editable)
{
- PropertyRNA *prop;
-
- /* texture space */
- prop = RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space",
- "Adjust active object's texture space automatically when transforming object");
-
- prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
- RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", NULL, NULL);
- RNA_def_property_editable_func(prop, texspace_editable);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
- RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", NULL, NULL);
- RNA_def_property_editable_func(prop, texspace_editable);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- /* not supported yet */
-#if 0
- prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
- RNA_def_property_editable_func(prop, texspace_editable);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-#endif
-
- /* materials */
- prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_ui_text(prop, "Materials", "");
- RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+ PropertyRNA *prop;
+
+ /* texture space */
+ prop = RNA_def_property(srna, "auto_texspace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Texture Space",
+ "Adjust active object's texture space automatically when transforming object");
+
+ prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
+ RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", NULL, NULL);
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
+ RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_size_get", NULL, NULL);
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ /* not supported yet */
+# if 0
+ prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+# endif
+
+ /* materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
}
-
/* scene.objects */
/* mesh.vertices */
static void rna_def_mesh_vertices(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-/* PropertyRNA *prop; */
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MeshVertices");
- srna = RNA_def_struct(brna, "MeshVertices", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
-
- func = RNA_def_function(srna, "add", "ED_mesh_vertices_add");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-#if 0 /* BMESH_TODO Remove until BMesh merge */
- func = RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);
-#endif
+ StructRNA *srna;
+ /* PropertyRNA *prop; */
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MeshVertices");
+ srna = RNA_def_struct(brna, "MeshVertices", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Vertices", "Collection of mesh vertices");
+
+ func = RNA_def_function(srna, "add", "ED_mesh_vertices_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to add", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+# if 0 /* BMESH_TODO Remove until BMesh merge */
+ func = RNA_def_function(srna, "remove", "ED_mesh_vertices_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of vertices to remove", 0, INT_MAX);
+# endif
}
/* mesh.edges */
static void rna_def_mesh_edges(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-/* PropertyRNA *prop; */
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MeshEdges");
- srna = RNA_def_struct(brna, "MeshEdges", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
-
- func = RNA_def_function(srna, "add", "ED_mesh_edges_add");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-#if 0 /* BMESH_TODO Remove until BMesh merge */
- func = RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX);
-#endif
+ StructRNA *srna;
+ /* PropertyRNA *prop; */
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MeshEdges");
+ srna = RNA_def_struct(brna, "MeshEdges", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Edges", "Collection of mesh edges");
+
+ func = RNA_def_function(srna, "add", "ED_mesh_edges_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to add", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+# if 0 /* BMESH_TODO Remove until BMesh merge */
+ func = RNA_def_function(srna, "remove", "ED_mesh_edges_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of edges to remove", 0, INT_MAX);
+# endif
}
/* mesh.loop_triangles */
static void rna_def_mesh_looptris(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- RNA_def_property_srna(cprop, "MeshLoopTriangle");
- srna = RNA_def_struct(brna, "MeshLoopTriangles", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Mesh Loop Triangles", "Tessellation of mesh polygons into triangles");
+ RNA_def_property_srna(cprop, "MeshLoopTriangle");
+ srna = RNA_def_struct(brna, "MeshLoopTriangles", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(
+ srna, "Mesh Loop Triangles", "Tessellation of mesh polygons into triangles");
}
/* mesh.loops */
static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- /*PropertyRNA *prop;*/
+ /*PropertyRNA *prop;*/
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "MeshLoops");
- srna = RNA_def_struct(brna, "MeshLoops", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
+ RNA_def_property_srna(cprop, "MeshLoops");
+ srna = RNA_def_struct(brna, "MeshLoops", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Loops", "Collection of mesh loops");
- func = RNA_def_function(srna, "add", "ED_mesh_loops_add");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "add", "ED_mesh_loops_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of loops to add", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
/* mesh.polygons */
static void rna_def_mesh_polygons(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- PropertyRNA *prop;
+ PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "MeshPolygons");
- srna = RNA_def_struct(brna, "MeshPolygons", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygons");
+ RNA_def_property_srna(cprop, "MeshPolygons");
+ srna = RNA_def_struct(brna, "MeshPolygons", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh Polygons", "Collection of mesh polygons");
- prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "act_face");
- RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
+ prop = RNA_def_property(srna, "active", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "act_face");
+ RNA_def_property_ui_text(prop, "Active Polygon", "The active polygon for this mesh");
- func = RNA_def_function(srna, "add", "ED_mesh_polys_add");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_int(func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "add", "ED_mesh_polys_add");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_int(
+ func, "count", 0, 0, INT_MAX, "Count", "Number of polygons to add", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
-
static void rna_def_loop_colors(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "LoopColors");
- srna = RNA_def_struct(brna, "LoopColors", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
-
- func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
- RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
- RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
- RNA_def_boolean(func, "do_init", true, "",
- "Whether new layer's data should be initialized by copying current active one");
- parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
- RNA_def_function_ui_description(func, "Remove a vertex color layer");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The layer to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_vertex_color_active_get",
- "rna_Mesh_vertex_color_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_vertex_color_active_index_get",
- "rna_Mesh_vertex_color_active_index_set", "rna_Mesh_vertex_color_index_range");
- RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "LoopColors");
+ srna = RNA_def_struct(brna, "LoopColors", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Loop Colors", "Collection of vertex colors");
+
+ func = RNA_def_function(srna, "new", "rna_Mesh_vertex_color_new");
+ RNA_def_function_ui_description(func, "Add a vertex color layer to Mesh");
+ RNA_def_string(func, "name", "Col", 0, "", "Vertex color name");
+ RNA_def_boolean(func,
+ "do_init",
+ true,
+ "",
+ "Whether new layer's data should be initialized by copying current active one");
+ parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Mesh_vertex_color_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex color layer");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "layer", "MeshLoopColorLayer", "", "The layer to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Mesh_vertex_color_active_get", "rna_Mesh_vertex_color_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Vertex Color Layer", "Active vertex color layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_Mesh_vertex_color_active_index_get",
+ "rna_Mesh_vertex_color_active_index_set",
+ "rna_Mesh_vertex_color_index_range");
+ RNA_def_property_ui_text(prop, "Active Vertex Color Index", "Active vertex color index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data_edit_active_color");
}
static void rna_def_uv_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "UVLoopLayers");
- srna = RNA_def_struct(brna, "UVLoopLayers", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop layers");
-
- func = RNA_def_function(srna, "new", "rna_Mesh_uv_layers_new");
- RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
- RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
- RNA_def_boolean(func, "do_init", true, "",
- "Whether new layer's data should be initialized by copying current active one, "
- "or if none is active, with a default UVmap");
- parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
- RNA_def_function_ui_description(func, "Remove a vertex color layer");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The layer to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_active_get",
- "rna_Mesh_uv_layer_active_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_active_index_get",
- "rna_Mesh_uv_layer_active_index_set", "rna_Mesh_uv_layer_index_range");
- RNA_def_property_ui_text(prop, "Active UV loop layer Index", "Active UV loop layer index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "UVLoopLayers");
+ srna = RNA_def_struct(brna, "UVLoopLayers", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "UV Loop Layers", "Collection of uv loop layers");
+
+ func = RNA_def_function(srna, "new", "rna_Mesh_uv_layers_new");
+ RNA_def_function_ui_description(func, "Add a UV map layer to Mesh");
+ RNA_def_string(func, "name", "UVMap", 0, "", "UV map name");
+ RNA_def_boolean(func,
+ "do_init",
+ true,
+ "",
+ "Whether new layer's data should be initialized by copying current active one, "
+ "or if none is active, with a default UVmap");
+ parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Mesh_uv_layers_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex color layer");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "layer", "MeshUVLoopLayer", "", "The layer to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Mesh_uv_layer_active_get", "rna_Mesh_uv_layer_active_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active UV loop layer", "Active UV loop layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_Mesh_uv_layer_active_index_get",
+ "rna_Mesh_uv_layer_active_index_set",
+ "rna_Mesh_uv_layer_index_range");
+ RNA_def_property_ui_text(prop, "Active UV loop layer Index", "Active UV loop layer index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
/* mesh float layers */
static void rna_def_vertex_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "VertexFloatProperties");
- srna = RNA_def_struct(brna, "VertexFloatProperties", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Vertex Float Properties", "Collection of float properties");
+ RNA_def_property_srna(cprop, "VertexFloatProperties");
+ srna = RNA_def_struct(brna, "VertexFloatProperties", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Vertex Float Properties", "Collection of float properties");
- func = RNA_def_function(srna, "new", "rna_Mesh_vertex_float_property_new");
- RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
- RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
- parm = RNA_def_pointer(func, "layer", "MeshVertexFloatPropertyLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_Mesh_vertex_float_property_new");
+ RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
+ RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
+ parm = RNA_def_pointer(
+ func, "layer", "MeshVertexFloatPropertyLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
/* mesh int layers */
static void rna_def_vertex_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "VertexIntProperties");
- srna = RNA_def_struct(brna, "VertexIntProperties", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Vertex Int Properties", "Collection of int properties");
+ RNA_def_property_srna(cprop, "VertexIntProperties");
+ srna = RNA_def_struct(brna, "VertexIntProperties", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Vertex Int Properties", "Collection of int properties");
- func = RNA_def_function(srna, "new", "rna_Mesh_vertex_int_property_new");
- RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
- RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
- parm = RNA_def_pointer(func, "layer", "MeshVertexIntPropertyLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_Mesh_vertex_int_property_new");
+ RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
+ RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
+ parm = RNA_def_pointer(
+ func, "layer", "MeshVertexIntPropertyLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
/* mesh string layers */
static void rna_def_vertex_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "VertexStringProperties");
- srna = RNA_def_struct(brna, "VertexStringProperties", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Vertex String Properties", "Collection of string properties");
+ RNA_def_property_srna(cprop, "VertexStringProperties");
+ srna = RNA_def_struct(brna, "VertexStringProperties", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Vertex String Properties", "Collection of string properties");
- func = RNA_def_function(srna, "new", "rna_Mesh_vertex_string_property_new");
- RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
- RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
- parm = RNA_def_pointer(func, "layer", "MeshVertexStringPropertyLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_Mesh_vertex_string_property_new");
+ RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
+ RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
+ parm = RNA_def_pointer(
+ func, "layer", "MeshVertexStringPropertyLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
/* mesh float layers */
static void rna_def_polygon_float_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "PolygonFloatProperties");
- srna = RNA_def_struct(brna, "PolygonFloatProperties", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Polygon Float Properties", "Collection of float properties");
+ RNA_def_property_srna(cprop, "PolygonFloatProperties");
+ srna = RNA_def_struct(brna, "PolygonFloatProperties", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Polygon Float Properties", "Collection of float properties");
- func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_new");
- RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
- RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
- parm = RNA_def_pointer(func, "layer", "MeshPolygonFloatPropertyLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_Mesh_polygon_float_property_new");
+ RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
+ RNA_def_string(func, "name", "Float Prop", 0, "", "Float property name");
+ parm = RNA_def_pointer(
+ func, "layer", "MeshPolygonFloatPropertyLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
/* mesh int layers */
static void rna_def_polygon_int_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "PolygonIntProperties");
- srna = RNA_def_struct(brna, "PolygonIntProperties", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Polygon Int Properties", "Collection of int properties");
+ RNA_def_property_srna(cprop, "PolygonIntProperties");
+ srna = RNA_def_struct(brna, "PolygonIntProperties", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Polygon Int Properties", "Collection of int properties");
- func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new");
- RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
- RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
- parm = RNA_def_pointer(func, "layer", "MeshPolygonIntPropertyLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_Mesh_polygon_int_property_new");
+ RNA_def_function_ui_description(func, "Add a integer property layer to Mesh");
+ RNA_def_string(func, "name", "Int Prop", 0, "", "Int property name");
+ parm = RNA_def_pointer(
+ func, "layer", "MeshPolygonIntPropertyLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
/* mesh string layers */
static void rna_def_polygon_string_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "PolygonStringProperties");
- srna = RNA_def_struct(brna, "PolygonStringProperties", NULL);
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Polygon String Properties", "Collection of string properties");
+ RNA_def_property_srna(cprop, "PolygonStringProperties");
+ srna = RNA_def_struct(brna, "PolygonStringProperties", NULL);
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Polygon String Properties", "Collection of string properties");
- func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_new");
- RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
- RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
- parm = RNA_def_pointer(func, "layer", "MeshPolygonStringPropertyLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_Mesh_polygon_string_property_new");
+ RNA_def_function_ui_description(func, "Add a string property layer to Mesh");
+ RNA_def_string(func, "name", "String Prop", 0, "", "String property name");
+ parm = RNA_def_pointer(
+ func, "layer", "MeshPolygonStringPropertyLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
static void rna_def_skin_vertices(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshSkinVertexLayer", NULL);
- RNA_def_struct_ui_text(srna, "Mesh Skin Vertex Layer", "Per-vertex skin data for use with the Skin modifier");
- RNA_def_struct_sdna(srna, "CustomDataLayer");
- RNA_def_struct_path_func(srna, "rna_MeshSkinVertexLayer_path");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
- RNA_def_property_ui_text(prop, "Name", "Name of skin layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshSkinVertex");
- RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshSkinVertexLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshSkinVertexLayer_data_length", NULL, NULL, NULL);
-
- /* SkinVertex struct */
- srna = RNA_def_struct(brna, "MeshSkinVertex", NULL);
- RNA_def_struct_sdna(srna, "MVertSkin");
- RNA_def_struct_ui_text(srna, "Skin Vertex", "Per-vertex skin data for use with the Skin modifier");
- RNA_def_struct_path_func(srna, "rna_MeshSkinVertex_path");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_range(prop, 0.001, 100.0, 1, 3);
- RNA_def_property_ui_text(prop, "Radius", "Radius of the skin");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- /* Flags */
-
- prop = RNA_def_property(srna, "use_root", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_ROOT);
- RNA_def_property_ui_text(prop, "Root",
- "Vertex is a root for rotation calculations and armature generation, "
- "setting this flag does not clear other roots in the same mesh island");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "use_loose", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_LOOSE);
- RNA_def_property_ui_text(prop, "Loose", "If vertex has multiple adjacent edges, it is hulled to them directly");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshSkinVertexLayer", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Mesh Skin Vertex Layer", "Per-vertex skin data for use with the Skin modifier");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshSkinVertexLayer_path");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshVertexLayer_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of skin layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshSkinVertex");
+ RNA_def_property_ui_text(prop, "Data", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_MeshSkinVertexLayer_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_MeshSkinVertexLayer_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ /* SkinVertex struct */
+ srna = RNA_def_struct(brna, "MeshSkinVertex", NULL);
+ RNA_def_struct_sdna(srna, "MVertSkin");
+ RNA_def_struct_ui_text(
+ srna, "Skin Vertex", "Per-vertex skin data for use with the Skin modifier");
+ RNA_def_struct_path_func(srna, "rna_MeshSkinVertex_path");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, 0.001, 100.0, 1, 3);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the skin");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ /* Flags */
+
+ prop = RNA_def_property(srna, "use_root", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_ROOT);
+ RNA_def_property_ui_text(prop,
+ "Root",
+ "Vertex is a root for rotation calculations and armature generation, "
+ "setting this flag does not clear other roots in the same mesh island");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "use_loose", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MVERT_SKIN_LOOSE);
+ RNA_def_property_ui_text(
+ prop, "Loose", "If vertex has multiple adjacent edges, it is hulled to them directly");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
static void rna_def_paint_mask(BlenderRNA *brna, PropertyRNA *UNUSED(cprop))
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MeshPaintMaskLayer", NULL);
- RNA_def_struct_ui_text(srna, "Mesh Paint Mask Layer", "Per-vertex paint mask data");
- RNA_def_struct_sdna(srna, "CustomDataLayer");
- RNA_def_struct_path_func(srna, "rna_MeshPaintMaskLayer_path");
+ srna = RNA_def_struct(brna, "MeshPaintMaskLayer", NULL);
+ RNA_def_struct_ui_text(srna, "Mesh Paint Mask Layer", "Per-vertex paint mask data");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshPaintMaskLayer_path");
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshPaintMaskProperty");
- RNA_def_property_ui_text(prop, "Data", "");
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshPaintMaskProperty");
+ RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshPaintMaskLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshPaintMaskLayer_data_length", NULL, NULL, NULL);
+ RNA_def_property_collection_funcs(prop,
+ "rna_MeshPaintMaskLayer_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_MeshPaintMaskLayer_data_length",
+ NULL,
+ NULL,
+ NULL);
- srna = RNA_def_struct(brna, "MeshPaintMaskProperty", NULL);
- RNA_def_struct_sdna(srna, "MFloatProperty");
- RNA_def_struct_ui_text(srna, "Mesh Paint Mask Property",
- "Floating point paint mask value");
- RNA_def_struct_path_func(srna, "rna_MeshPaintMask_path");
+ srna = RNA_def_struct(brna, "MeshPaintMaskProperty", NULL);
+ RNA_def_struct_sdna(srna, "MFloatProperty");
+ RNA_def_struct_ui_text(srna, "Mesh Paint Mask Property", "Floating point paint mask value");
+ RNA_def_struct_path_func(srna, "rna_MeshPaintMask_path");
- prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f");
- RNA_def_property_ui_text(prop, "Value", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ prop = RNA_def_property(srna, "value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f");
+ RNA_def_property_ui_text(prop, "Value", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
static void rna_def_face_map(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshFaceMapLayer", NULL);
- RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
- RNA_def_struct_sdna(srna, "CustomDataLayer");
- RNA_def_struct_path_func(srna, "rna_MeshFaceMapLayer_path");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshPolyLayer_name_set");
- RNA_def_property_ui_text(prop, "Name", "Name of face-map layer");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshFaceMap");
- RNA_def_property_ui_text(prop, "Data", "");
- RNA_def_property_collection_funcs(prop, "rna_MeshFaceMapLayer_data_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_MeshFaceMapLayer_data_length", NULL, NULL, NULL);
-
- /* FaceMap struct */
- srna = RNA_def_struct(brna, "MeshFaceMap", NULL);
- RNA_def_struct_sdna(srna, "MIntProperty");
- RNA_def_struct_ui_text(srna, "Int Property", "");
- RNA_def_struct_path_func(srna, "rna_MeshFaceMap_path");
-
- prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "i");
- RNA_def_property_ui_text(prop, "Value", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshFaceMapLayer", NULL);
+ RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
+ RNA_def_struct_sdna(srna, "CustomDataLayer");
+ RNA_def_struct_path_func(srna, "rna_MeshFaceMapLayer_path");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshPolyLayer_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Name of face-map layer");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "data", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshFaceMap");
+ RNA_def_property_ui_text(prop, "Data", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_MeshFaceMapLayer_data_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_MeshFaceMapLayer_data_length",
+ NULL,
+ NULL,
+ NULL);
+
+ /* FaceMap struct */
+ srna = RNA_def_struct(brna, "MeshFaceMap", NULL);
+ RNA_def_struct_sdna(srna, "MIntProperty");
+ RNA_def_struct_ui_text(srna, "Int Property", "");
+ RNA_def_struct_path_func(srna, "rna_MeshFaceMap_path");
+
+ prop = RNA_def_property(srna, "value", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "i");
+ RNA_def_property_ui_text(prop, "Value", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
}
static void rna_def_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "MeshFaceMapLayers");
- srna = RNA_def_struct(brna, "MeshFaceMapLayers", NULL);
- RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
- RNA_def_struct_sdna(srna, "Mesh");
- RNA_def_struct_ui_text(srna, "Mesh FaceMaps", "Collection of mesh face-maps");
-
- /* add this since we only ever have one layer anyway, don't bother with active_index */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_face_map_active_get",
- NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active FaceMap Layer", "");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "new", "rna_Mesh_face_map_new");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
- RNA_def_string(func, "name", "Face Map", 0, "", "Face map name");
- parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The newly created layer");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Mesh_face_map_remove");
- RNA_def_function_ui_description(func, "Remove a face map layer");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The layer to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "MeshFaceMapLayers");
+ srna = RNA_def_struct(brna, "MeshFaceMapLayers", NULL);
+ RNA_def_struct_ui_text(srna, "Mesh Face Map Layer", "Per-face map index");
+ RNA_def_struct_sdna(srna, "Mesh");
+ RNA_def_struct_ui_text(srna, "Mesh FaceMaps", "Collection of mesh face-maps");
+
+ /* add this since we only ever have one layer anyway, don't bother with active_index */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
+ RNA_def_property_pointer_funcs(prop, "rna_Mesh_face_map_active_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active FaceMap Layer", "");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "new", "rna_Mesh_face_map_new");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a float property layer to Mesh");
+ RNA_def_string(func, "name", "Face Map", 0, "", "Face map name");
+ parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The newly created layer");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Mesh_face_map_remove");
+ RNA_def_function_ui_description(func, "Remove a face map layer");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "layer", "MeshFaceMapLayer", "", "The layer to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
}
static void rna_def_mesh(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Mesh", "ID");
- RNA_def_struct_ui_text(srna, "Mesh", "Mesh data-block defining geometric surfaces");
- RNA_def_struct_ui_icon(srna, ICON_MESH_DATA);
-
- prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
- RNA_def_property_struct_type(prop, "MeshVertex");
- RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
- rna_def_mesh_vertices(brna, prop);
-
- prop = RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
- RNA_def_property_struct_type(prop, "MeshEdge");
- RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
- rna_def_mesh_edges(brna, prop);
-
- prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
- RNA_def_property_struct_type(prop, "MeshLoop");
- RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corners)");
- rna_def_mesh_loops(brna, prop);
-
- prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mpoly", "totpoly");
- RNA_def_property_struct_type(prop, "MeshPolygon");
- RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh");
- rna_def_mesh_polygons(brna, prop);
-
- prop = RNA_def_property(srna, "loop_triangles", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "runtime.looptris.array", "runtime.looptris.len");
- RNA_def_property_struct_type(prop, "MeshLoopTriangle");
- RNA_def_property_ui_text(prop, "Loop Triangles", "Tessellation of mesh polygons into triangles");
- rna_def_mesh_looptris(brna, prop);
-
- /* TODO, should this be allowed to be its self? */
- prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Texture Mesh",
- "Use another mesh for texture indices (vertex indices must be aligned)");
-
- /* UV loop layers */
- prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_uv_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_uv_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
- RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
- rna_def_uv_layers(brna, prop);
-
- prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_clone_get",
- "rna_Mesh_uv_layer_clone_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Clone UV loop layer", "UV loop layer to be used as cloning source");
-
- prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_clone_index_get",
- "rna_Mesh_uv_layer_clone_index_set", "rna_Mesh_uv_layer_index_range");
- RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV loop layer index");
-
- prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Mesh_uv_layer_stencil_get",
- "rna_Mesh_uv_layer_stencil_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask UV loop layer", "UV loop layer to mask the painted area");
-
- prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_uv_layer_stencil_index_get",
- "rna_Mesh_uv_layer_stencil_index_set", "rna_Mesh_uv_layer_index_range");
- RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop layer index");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- /* Vertex colors */
-
- prop = RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_colors_begin", NULL, NULL, NULL,
- "rna_Mesh_vertex_colors_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
- RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors");
- rna_def_loop_colors(brna, prop);
-
- /* TODO, edge customdata layers (bmesh py api can access already) */
- prop = RNA_def_property(srna, "vertex_layers_float", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_float_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_vertex_float_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshVertexFloatPropertyLayer");
- RNA_def_property_ui_text(prop, "Float Property Layers", "");
- rna_def_vertex_float_layers(brna, prop);
-
- prop = RNA_def_property(srna, "vertex_layers_int", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_int_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_vertex_int_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshVertexIntPropertyLayer");
- RNA_def_property_ui_text(prop, "Int Property Layers", "");
- rna_def_vertex_int_layers(brna, prop);
-
- prop = RNA_def_property(srna, "vertex_layers_string", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_string_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_vertex_string_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshVertexStringPropertyLayer");
- RNA_def_property_ui_text(prop, "String Property Layers", "");
- rna_def_vertex_string_layers(brna, prop);
-
- prop = RNA_def_property(srna, "polygon_layers_float", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_float_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_polygon_float_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshPolygonFloatPropertyLayer");
- RNA_def_property_ui_text(prop, "Float Property Layers", "");
- rna_def_polygon_float_layers(brna, prop);
-
- prop = RNA_def_property(srna, "polygon_layers_int", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_int_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_polygon_int_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshPolygonIntPropertyLayer");
- RNA_def_property_ui_text(prop, "Int Property Layers", "");
- rna_def_polygon_int_layers(brna, prop);
-
- prop = RNA_def_property(srna, "polygon_layers_string", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_polygon_string_layers_begin", NULL, NULL, NULL,
- "rna_Mesh_polygon_string_layers_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshPolygonStringPropertyLayer");
- RNA_def_property_ui_text(prop, "String Property Layers", "");
- rna_def_polygon_string_layers(brna, prop);
-
- /* face-maps */
- prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_face_maps_begin", NULL, NULL, NULL,
- "rna_Mesh_face_maps_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
- RNA_def_property_ui_text(prop, "FaceMap", "");
- rna_def_face_maps(brna, prop);
-
- /* Skin vertices */
- prop = RNA_def_property(srna, "skin_vertices", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_skin_vertices_begin", NULL, NULL, NULL,
- "rna_Mesh_skin_vertices_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshSkinVertexLayer");
- RNA_def_property_ui_text(prop, "Skin Vertices", "All skin vertices");
- rna_def_skin_vertices(brna, prop);
- /* End skin vertices */
-
- /* Paint mask */
- prop = RNA_def_property(srna, "vertex_paint_masks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
- RNA_def_property_collection_funcs(prop, "rna_Mesh_vertex_paint_masks_begin", NULL, NULL, NULL,
- "rna_Mesh_vertex_paint_masks_length", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MeshPaintMaskLayer");
- RNA_def_property_ui_text(prop, "Vertex Paint Mask", "Vertex paint mask");
- rna_def_paint_mask(brna, prop);
- /* End paint mask */
-
- prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
- RNA_def_property_ui_text(prop, "Auto Smooth",
- "Auto smooth (based on smooth/sharp faces/edges and angle between faces), "
- "or use custom split normals data if available");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "smoothresh");
- RNA_def_property_float_default(prop, DEG2RADF(180.0f));
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_text(prop, "Auto Smooth Angle",
- "Maximum angle between face normals that will be considered as smooth "
- "(unused if custom split normals data are available)");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- RNA_define_verify_sdna(false);
- prop = RNA_def_property(srna, "has_custom_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "", 0);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has Custom Normals",
- "True if there are custom split normals data in this mesh");
- RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL);
- RNA_define_verify_sdna(true);
-
- prop = RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED);
- RNA_def_property_ui_text(prop, "Double Sided", "Display the mesh with double or single sided lighting (OpenGL only)");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
- prop = RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Texture Space Mesh", "Derive texture coordinates from another mesh");
-
- prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "key");
- RNA_def_property_ui_text(prop, "Shape Keys", "");
-
- /* texture space */
- prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space",
- "Adjust active object's texture space automatically when transforming object");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
-
-#if 0
- prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
- RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-#endif
-
- /* not supported yet */
-#if 0
- prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
- RNA_def_property_editable_func(prop, texspace_editable);
- RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-#endif
-
- /* editflag */
- prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
- RNA_def_property_ui_text(prop, "X Mirror", "X Axis mirror editing");
- RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
-
-#if 0
- prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Y);
- RNA_def_property_ui_text(prop, "Y Mirror", "Y Axis mirror editing");
-
- prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Z);
- RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing");
-#endif
-
- prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO);
- RNA_def_property_ui_text(prop, "Topology Mirror",
- "Use topology based mirroring "
- "(for when both sides of mesh have matching, unique topology)");
-
- prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_FACE_SEL);
- RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
- RNA_def_property_ui_icon(prop, ICON_FACESEL, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_facemask");
-
- prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_VERT_SEL);
- RNA_def_property_ui_text(prop, "Vertex Selection", "Vertex selection masking for painting (weight paint only)");
- RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask");
-
-
-
- /* customdata flags */
- prop = RNA_def_property(srna, "use_customdata_vertex_bevel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_VERT_BWEIGHT);
- RNA_def_property_ui_text(prop, "Store Vertex Bevel Weight", "");
-
- prop = RNA_def_property(srna, "use_customdata_edge_bevel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_BWEIGHT);
- RNA_def_property_ui_text(prop, "Store Edge Bevel Weight", "");
-
- prop = RNA_def_property(srna, "use_customdata_edge_crease", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_CREASE);
- RNA_def_property_ui_text(prop, "Store Edge Crease", "");
-
-
- /* readonly editmesh info - use for extrude menu */
- prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Selected Vert Total", "Selected vertex count in editmode");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_tot_edge_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Selected Edge Total", "Selected edge count in editmode");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Mesh_tot_face_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Mesh_is_editmode_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
-
- /* pointers */
- rna_def_animdata_common(srna);
- rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
-
- RNA_api_mesh(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Mesh", "ID");
+ RNA_def_struct_ui_text(srna, "Mesh", "Mesh data-block defining geometric surfaces");
+ RNA_def_struct_ui_icon(srna, ICON_MESH_DATA);
+
+ prop = RNA_def_property(srna, "vertices", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mvert", "totvert");
+ RNA_def_property_struct_type(prop, "MeshVertex");
+ RNA_def_property_ui_text(prop, "Vertices", "Vertices of the mesh");
+ rna_def_mesh_vertices(brna, prop);
+
+ prop = RNA_def_property(srna, "edges", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "medge", "totedge");
+ RNA_def_property_struct_type(prop, "MeshEdge");
+ RNA_def_property_ui_text(prop, "Edges", "Edges of the mesh");
+ rna_def_mesh_edges(brna, prop);
+
+ prop = RNA_def_property(srna, "loops", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mloop", "totloop");
+ RNA_def_property_struct_type(prop, "MeshLoop");
+ RNA_def_property_ui_text(prop, "Loops", "Loops of the mesh (polygon corners)");
+ rna_def_mesh_loops(brna, prop);
+
+ prop = RNA_def_property(srna, "polygons", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mpoly", "totpoly");
+ RNA_def_property_struct_type(prop, "MeshPolygon");
+ RNA_def_property_ui_text(prop, "Polygons", "Polygons of the mesh");
+ rna_def_mesh_polygons(brna, prop);
+
+ prop = RNA_def_property(srna, "loop_triangles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "runtime.looptris.array", "runtime.looptris.len");
+ RNA_def_property_struct_type(prop, "MeshLoopTriangle");
+ RNA_def_property_ui_text(prop, "Loop Triangles", "Tessellation of mesh polygons into triangles");
+ rna_def_mesh_looptris(brna, prop);
+
+ /* TODO, should this be allowed to be its self? */
+ prop = RNA_def_property(srna, "texture_mesh", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(
+ prop,
+ "Texture Mesh",
+ "Use another mesh for texture indices (vertex indices must be aligned)");
+
+ /* UV loop layers */
+ prop = RNA_def_property(srna, "uv_layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_uv_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_uv_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_ui_text(prop, "UV Loop Layers", "All UV loop layers");
+ rna_def_uv_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "uv_layer_clone", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Mesh_uv_layer_clone_get", "rna_Mesh_uv_layer_clone_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Clone UV loop layer", "UV loop layer to be used as cloning source");
+
+ prop = RNA_def_property(srna, "uv_layer_clone_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_Mesh_uv_layer_clone_index_get",
+ "rna_Mesh_uv_layer_clone_index_set",
+ "rna_Mesh_uv_layer_index_range");
+ RNA_def_property_ui_text(prop, "Clone UV loop layer Index", "Clone UV loop layer index");
+
+ prop = RNA_def_property(srna, "uv_layer_stencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MeshUVLoopLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Mesh_uv_layer_stencil_get", "rna_Mesh_uv_layer_stencil_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask UV loop layer", "UV loop layer to mask the painted area");
+
+ prop = RNA_def_property(srna, "uv_layer_stencil_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_Mesh_uv_layer_stencil_index_get",
+ "rna_Mesh_uv_layer_stencil_index_set",
+ "rna_Mesh_uv_layer_index_range");
+ RNA_def_property_ui_text(prop, "Mask UV loop layer Index", "Mask UV loop layer index");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ /* Vertex colors */
+
+ prop = RNA_def_property(srna, "vertex_colors", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "ldata.layers", "ldata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_vertex_colors_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_vertex_colors_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshLoopColorLayer");
+ RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors");
+ rna_def_loop_colors(brna, prop);
+
+ /* TODO, edge customdata layers (bmesh py api can access already) */
+ prop = RNA_def_property(srna, "vertex_layers_float", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_vertex_float_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_vertex_float_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshVertexFloatPropertyLayer");
+ RNA_def_property_ui_text(prop, "Float Property Layers", "");
+ rna_def_vertex_float_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "vertex_layers_int", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_vertex_int_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_vertex_int_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshVertexIntPropertyLayer");
+ RNA_def_property_ui_text(prop, "Int Property Layers", "");
+ rna_def_vertex_int_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "vertex_layers_string", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_vertex_string_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_vertex_string_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshVertexStringPropertyLayer");
+ RNA_def_property_ui_text(prop, "String Property Layers", "");
+ rna_def_vertex_string_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "polygon_layers_float", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_polygon_float_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_polygon_float_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshPolygonFloatPropertyLayer");
+ RNA_def_property_ui_text(prop, "Float Property Layers", "");
+ rna_def_polygon_float_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "polygon_layers_int", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_polygon_int_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_polygon_int_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshPolygonIntPropertyLayer");
+ RNA_def_property_ui_text(prop, "Int Property Layers", "");
+ rna_def_polygon_int_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "polygon_layers_string", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_polygon_string_layers_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_polygon_string_layers_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshPolygonStringPropertyLayer");
+ RNA_def_property_ui_text(prop, "String Property Layers", "");
+ rna_def_polygon_string_layers(brna, prop);
+
+ /* face-maps */
+ prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "pdata.layers", "pdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_face_maps_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_face_maps_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshFaceMapLayer");
+ RNA_def_property_ui_text(prop, "FaceMap", "");
+ rna_def_face_maps(brna, prop);
+
+ /* Skin vertices */
+ prop = RNA_def_property(srna, "skin_vertices", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_skin_vertices_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_skin_vertices_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshSkinVertexLayer");
+ RNA_def_property_ui_text(prop, "Skin Vertices", "All skin vertices");
+ rna_def_skin_vertices(brna, prop);
+ /* End skin vertices */
+
+ /* Paint mask */
+ prop = RNA_def_property(srna, "vertex_paint_masks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "vdata.layers", "vdata.totlayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Mesh_vertex_paint_masks_begin",
+ NULL,
+ NULL,
+ NULL,
+ "rna_Mesh_vertex_paint_masks_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MeshPaintMaskLayer");
+ RNA_def_property_ui_text(prop, "Vertex Paint Mask", "Vertex paint mask");
+ rna_def_paint_mask(brna, prop);
+ /* End paint mask */
+
+ prop = RNA_def_property(srna, "use_auto_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_AUTOSMOOTH);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Smooth",
+ "Auto smooth (based on smooth/sharp faces/edges and angle between faces), "
+ "or use custom split normals data if available");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "smoothresh");
+ RNA_def_property_float_default(prop, DEG2RADF(180.0f));
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop,
+ "Auto Smooth Angle",
+ "Maximum angle between face normals that will be considered as smooth "
+ "(unused if custom split normals data are available)");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ RNA_define_verify_sdna(false);
+ prop = RNA_def_property(srna, "has_custom_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "", 0);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Has Custom Normals", "True if there are custom split normals data in this mesh");
+ RNA_def_property_boolean_funcs(prop, "rna_Mesh_has_custom_normals_get", NULL);
+ RNA_define_verify_sdna(true);
+
+ prop = RNA_def_property(srna, "show_double_sided", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_TWOSIDED);
+ RNA_def_property_ui_text(
+ prop, "Double Sided", "Display the mesh with double or single sided lighting (OpenGL only)");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+ prop = RNA_def_property(srna, "texco_mesh", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "texcomesh");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Texture Space Mesh", "Derive texture coordinates from another mesh");
+
+ prop = RNA_def_property(srna, "shape_keys", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "key");
+ RNA_def_property_ui_text(prop, "Shape Keys", "");
+
+ /* texture space */
+ prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "texflag", ME_AUTOSPACE);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Texture Space",
+ "Adjust active object's texture space automatically when transforming object");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_data");
+
+# if 0
+ prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
+ RNA_def_property_editable_func(prop, "rna_Mesh_texspace_editable");
+ RNA_def_property_float_funcs(prop, "rna_Mesh_texspace_loc_get", "rna_Mesh_texspace_loc_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+# endif
+
+ /* not supported yet */
+# if 0
+ prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+ RNA_def_property_editable_func(prop, texspace_editable);
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+# endif
+
+ /* editflag */
+ prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_X);
+ RNA_def_property_ui_text(prop, "X Mirror", "X Axis mirror editing");
+ RNA_def_property_update(prop, 0, "rna_Mesh_update_draw");
+
+# if 0
+ prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Y);
+ RNA_def_property_ui_text(prop, "Y Mirror", "Y Axis mirror editing");
+
+ prop = RNA_def_property(srna, "use_mirror_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_Z);
+ RNA_def_property_ui_text(prop, "Z Mirror", "Z Axis mirror editing");
+# endif
+
+ prop = RNA_def_property(srna, "use_mirror_topology", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_MIRROR_TOPO);
+ RNA_def_property_ui_text(prop,
+ "Topology Mirror",
+ "Use topology based mirroring "
+ "(for when both sides of mesh have matching, unique topology)");
+
+ prop = RNA_def_property(srna, "use_paint_mask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_FACE_SEL);
+ RNA_def_property_ui_text(prop, "Paint Mask", "Face selection masking for painting");
+ RNA_def_property_ui_icon(prop, ICON_FACESEL, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_facemask");
+
+ prop = RNA_def_property(srna, "use_paint_mask_vertex", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "editflag", ME_EDIT_PAINT_VERT_SEL);
+ RNA_def_property_ui_text(
+ prop, "Vertex Selection", "Vertex selection masking for painting (weight paint only)");
+ RNA_def_property_ui_icon(prop, ICON_VERTEXSEL, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_Mesh_update_vertmask");
+
+ /* customdata flags */
+ prop = RNA_def_property(srna, "use_customdata_vertex_bevel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_VERT_BWEIGHT);
+ RNA_def_property_ui_text(prop, "Store Vertex Bevel Weight", "");
+
+ prop = RNA_def_property(srna, "use_customdata_edge_bevel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_BWEIGHT);
+ RNA_def_property_ui_text(prop, "Store Edge Bevel Weight", "");
+
+ prop = RNA_def_property(srna, "use_customdata_edge_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cd_flag", ME_CDFLAG_EDGE_CREASE);
+ RNA_def_property_ui_text(prop, "Store Edge Crease", "");
+
+ /* readonly editmesh info - use for extrude menu */
+ prop = RNA_def_property(srna, "total_vert_sel", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_tot_vert_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Selected Vert Total", "Selected vertex count in editmode");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "total_edge_sel", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_tot_edge_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Selected Edge Total", "Selected edge count in editmode");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "total_face_sel", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop, "rna_Mesh_tot_face_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Selected Face Total", "Selected face count in editmode");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Mesh_is_editmode_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+
+ /* pointers */
+ rna_def_animdata_common(srna);
+ rna_def_texmat_common(srna, "rna_Mesh_texspace_editable");
+
+ RNA_api_mesh(srna);
}
void RNA_def_mesh(BlenderRNA *brna)
{
- rna_def_mesh(brna);
- rna_def_mvert(brna);
- rna_def_mvert_group(brna);
- rna_def_medge(brna);
- rna_def_mlooptri(brna);
- rna_def_mloop(brna);
- rna_def_mpolygon(brna);
- rna_def_mloopuv(brna);
- rna_def_mloopcol(brna);
- rna_def_mproperties(brna);
- rna_def_face_map(brna);
+ rna_def_mesh(brna);
+ rna_def_mvert(brna);
+ rna_def_mvert_group(brna);
+ rna_def_medge(brna);
+ rna_def_mlooptri(brna);
+ rna_def_mloop(brna);
+ rna_def_mpolygon(brna);
+ rna_def_mloopuv(brna);
+ rna_def_mloopcol(brna);
+ rna_def_mproperties(brna);
+ rna_def_face_map(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index 7bedd110947..9a8487ad659 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -33,275 +32,317 @@
#include "BLI_utildefines.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "DNA_mesh_types.h"
+# include "DNA_mesh_types.h"
-#include "BKE_mesh.h"
-#include "BKE_mesh_tangent.h"
-#include "BKE_mesh_mapping.h"
-#include "BKE_mesh_runtime.h"
-#include "ED_mesh.h"
+# include "BKE_mesh.h"
+# include "BKE_mesh_tangent.h"
+# include "BKE_mesh_mapping.h"
+# include "BKE_mesh_runtime.h"
+# include "ED_mesh.h"
static const char *rna_Mesh_unit_test_compare(struct Mesh *mesh, struct Mesh *mesh2)
{
- const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON * 60);
+ const char *ret = BKE_mesh_cmp(mesh, mesh2, FLT_EPSILON * 60);
- if (!ret)
- ret = "Same";
+ if (!ret)
+ ret = "Same";
- return ret;
+ return ret;
}
static void rna_Mesh_create_normals_split(Mesh *mesh)
{
- if (!CustomData_has_layer(&mesh->ldata, CD_NORMAL)) {
- CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CALLOC, NULL, mesh->totloop);
- CustomData_set_layer_flag(&mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
- }
+ if (!CustomData_has_layer(&mesh->ldata, CD_NORMAL)) {
+ CustomData_add_layer(&mesh->ldata, CD_NORMAL, CD_CALLOC, NULL, mesh->totloop);
+ CustomData_set_layer_flag(&mesh->ldata, CD_NORMAL, CD_FLAG_TEMPORARY);
+ }
}
static void rna_Mesh_free_normals_split(Mesh *mesh)
{
- CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop);
+ CustomData_free_layers(&mesh->ldata, CD_NORMAL, mesh->totloop);
}
static void rna_Mesh_calc_tangents(Mesh *mesh, ReportList *reports, const char *uvmap)
{
- float (*r_looptangents)[4];
-
- if (CustomData_has_layer(&mesh->ldata, CD_MLOOPTANGENT)) {
- r_looptangents = CustomData_get_layer(&mesh->ldata, CD_MLOOPTANGENT);
- memset(r_looptangents, 0, sizeof(float[4]) * mesh->totloop);
- }
- else {
- r_looptangents = CustomData_add_layer(&mesh->ldata, CD_MLOOPTANGENT, CD_CALLOC, NULL, mesh->totloop);
- CustomData_set_layer_flag(&mesh->ldata, CD_MLOOPTANGENT, CD_FLAG_TEMPORARY);
- }
-
- /* Compute loop normals if needed. */
- if (!CustomData_has_layer(&mesh->ldata, CD_NORMAL)) {
- BKE_mesh_calc_normals_split(mesh);
- }
-
- BKE_mesh_calc_loop_tangent_single(mesh, uvmap, r_looptangents, reports);
+ float(*r_looptangents)[4];
+
+ if (CustomData_has_layer(&mesh->ldata, CD_MLOOPTANGENT)) {
+ r_looptangents = CustomData_get_layer(&mesh->ldata, CD_MLOOPTANGENT);
+ memset(r_looptangents, 0, sizeof(float[4]) * mesh->totloop);
+ }
+ else {
+ r_looptangents = CustomData_add_layer(
+ &mesh->ldata, CD_MLOOPTANGENT, CD_CALLOC, NULL, mesh->totloop);
+ CustomData_set_layer_flag(&mesh->ldata, CD_MLOOPTANGENT, CD_FLAG_TEMPORARY);
+ }
+
+ /* Compute loop normals if needed. */
+ if (!CustomData_has_layer(&mesh->ldata, CD_NORMAL)) {
+ BKE_mesh_calc_normals_split(mesh);
+ }
+
+ BKE_mesh_calc_loop_tangent_single(mesh, uvmap, r_looptangents, reports);
}
static void rna_Mesh_free_tangents(Mesh *mesh)
{
- CustomData_free_layers(&mesh->ldata, CD_MLOOPTANGENT, mesh->totloop);
+ CustomData_free_layers(&mesh->ldata, CD_MLOOPTANGENT, mesh->totloop);
}
static void rna_Mesh_calc_looptri(Mesh *mesh)
{
- BKE_mesh_runtime_looptri_ensure(mesh);
+ BKE_mesh_runtime_looptri_ensure(mesh);
}
-static void rna_Mesh_calc_smooth_groups(Mesh *mesh, bool use_bitflags, int *r_poly_group_len,
- int **r_poly_group, int *r_group_total)
+static void rna_Mesh_calc_smooth_groups(
+ Mesh *mesh, bool use_bitflags, int *r_poly_group_len, int **r_poly_group, int *r_group_total)
{
- *r_poly_group_len = mesh->totpoly;
- *r_poly_group = BKE_mesh_calc_smoothgroups(
- mesh->medge, mesh->totedge,
- mesh->mpoly, mesh->totpoly,
- mesh->mloop, mesh->totloop,
- r_group_total, use_bitflags);
+ *r_poly_group_len = mesh->totpoly;
+ *r_poly_group = BKE_mesh_calc_smoothgroups(mesh->medge,
+ mesh->totedge,
+ mesh->mpoly,
+ mesh->totpoly,
+ mesh->mloop,
+ mesh->totloop,
+ r_group_total,
+ use_bitflags);
}
-static void rna_Mesh_normals_split_custom_do(Mesh *mesh, float (*custom_loopnors)[3], const bool use_vertices)
+static void rna_Mesh_normals_split_custom_do(Mesh *mesh,
+ float (*custom_loopnors)[3],
+ const bool use_vertices)
{
- if (use_vertices) {
- BKE_mesh_set_custom_normals_from_vertices(mesh, custom_loopnors);
- }
- else {
- BKE_mesh_set_custom_normals(mesh, custom_loopnors);
- }
+ if (use_vertices) {
+ BKE_mesh_set_custom_normals_from_vertices(mesh, custom_loopnors);
+ }
+ else {
+ BKE_mesh_set_custom_normals(mesh, custom_loopnors);
+ }
}
-static void rna_Mesh_normals_split_custom_set(Mesh *mesh, ReportList *reports, int normals_len, float *normals)
+static void rna_Mesh_normals_split_custom_set(Mesh *mesh,
+ ReportList *reports,
+ int normals_len,
+ float *normals)
{
- float (*loopnors)[3] = (float (*)[3])normals;
- const int numloops = mesh->totloop;
+ float(*loopnors)[3] = (float(*)[3])normals;
+ const int numloops = mesh->totloop;
- if (normals_len != numloops * 3) {
- BKE_reportf(reports, RPT_ERROR,
- "Number of custom normals is not number of loops (%f / %d)",
- (float)normals_len / 3.0f, numloops);
- return;
- }
+ if (normals_len != numloops * 3) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Number of custom normals is not number of loops (%f / %d)",
+ (float)normals_len / 3.0f,
+ numloops);
+ return;
+ }
- rna_Mesh_normals_split_custom_do(mesh, loopnors, false);
+ rna_Mesh_normals_split_custom_do(mesh, loopnors, false);
- DEG_id_tag_update(&mesh->id, 0);
+ DEG_id_tag_update(&mesh->id, 0);
}
-static void rna_Mesh_normals_split_custom_set_from_vertices(
- Mesh *mesh, ReportList *reports, int normals_len, float *normals)
+static void rna_Mesh_normals_split_custom_set_from_vertices(Mesh *mesh,
+ ReportList *reports,
+ int normals_len,
+ float *normals)
{
- float (*vertnors)[3] = (float (*)[3])normals;
- const int numverts = mesh->totvert;
+ float(*vertnors)[3] = (float(*)[3])normals;
+ const int numverts = mesh->totvert;
- if (normals_len != numverts * 3) {
- BKE_reportf(reports, RPT_ERROR,
- "Number of custom normals is not number of vertices (%f / %d)",
- (float)normals_len / 3.0f, numverts);
- return;
- }
+ if (normals_len != numverts * 3) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Number of custom normals is not number of vertices (%f / %d)",
+ (float)normals_len / 3.0f,
+ numverts);
+ return;
+ }
- rna_Mesh_normals_split_custom_do(mesh, vertnors, true);
+ rna_Mesh_normals_split_custom_do(mesh, vertnors, true);
- DEG_id_tag_update(&mesh->id, 0);
+ DEG_id_tag_update(&mesh->id, 0);
}
static void rna_Mesh_transform(Mesh *mesh, float *mat, bool shape_keys)
{
- BKE_mesh_transform(mesh, (float (*)[4])mat, shape_keys);
+ BKE_mesh_transform(mesh, (float(*)[4])mat, shape_keys);
- DEG_id_tag_update(&mesh->id, 0);
+ DEG_id_tag_update(&mesh->id, 0);
}
static void rna_Mesh_flip_normals(Mesh *mesh)
{
- BKE_mesh_polygons_flip(mesh->mpoly, mesh->mloop, &mesh->ldata, mesh->totpoly);
- BKE_mesh_tessface_clear(mesh);
- BKE_mesh_calc_normals(mesh);
- BKE_mesh_runtime_clear_geometry(mesh);
+ BKE_mesh_polygons_flip(mesh->mpoly, mesh->mloop, &mesh->ldata, mesh->totpoly);
+ BKE_mesh_tessface_clear(mesh);
+ BKE_mesh_calc_normals(mesh);
+ BKE_mesh_runtime_clear_geometry(mesh);
- DEG_id_tag_update(&mesh->id, 0);
+ DEG_id_tag_update(&mesh->id, 0);
}
static void rna_Mesh_split_faces(Mesh *mesh, bool free_loop_normals)
{
- BKE_mesh_split_faces(mesh, free_loop_normals != 0);
+ BKE_mesh_split_faces(mesh, free_loop_normals != 0);
}
static void rna_Mesh_update_gpu_tag(Mesh *mesh)
{
- BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL);
+ BKE_mesh_batch_cache_dirty_tag(mesh, BKE_MESH_BATCH_DIRTY_ALL);
}
static void rna_Mesh_count_selected_items(Mesh *mesh, int r_count[3])
{
- BKE_mesh_count_selected_items(mesh, r_count);
+ BKE_mesh_count_selected_items(mesh, r_count);
}
-
#else
void RNA_api_mesh(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
- const int normals_array_dim[] = {1, 3};
-
- func = RNA_def_function(srna, "transform", "rna_Mesh_transform");
- RNA_def_function_ui_description(func, "Transform mesh vertices by a matrix "
- "(Warning: inverts normals if matrix is negative)");
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
-
- func = RNA_def_function(srna, "flip_normals", "rna_Mesh_flip_normals");
- RNA_def_function_ui_description(func, "Invert winding of all polygons "
- "(clears tessellation, does not handle custom normals)");
-
- func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
- RNA_def_function_ui_description(func, "Calculate vertex normals");
-
- func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split");
- RNA_def_function_ui_description(func, "Empty split vertex normals");
-
- func = RNA_def_function(srna, "calc_normals_split", "BKE_mesh_calc_normals_split");
- RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges");
-
- func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split");
- RNA_def_function_ui_description(func, "Free split vertex normals");
-
- func = RNA_def_function(srna, "split_faces", "rna_Mesh_split_faces");
- RNA_def_function_ui_description(func, "Split faces based on the edge angle");
- RNA_def_boolean(func, "free_loop_normals", 1, "Free Loop Notmals",
- "Free loop normals custom data layer");
-
- func = RNA_def_function(srna, "calc_tangents", "rna_Mesh_calc_tangents");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func,
- "Compute tangents and bitangent signs, to be used together with the split normals "
- "to get a complete tangent space for normal mapping "
- "(split normals are also computed if not yet present)");
- parm = RNA_def_string(func, "uvmap", NULL, MAX_CUSTOMDATA_LAYER_NAME, "",
- "Name of the UV map to use for tangent space computation");
-
- func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents");
- RNA_def_function_ui_description(func, "Free tangents");
-
- func = RNA_def_function(srna, "calc_loop_triangles", "rna_Mesh_calc_looptri");
- RNA_def_function_ui_description(func, "Calculate loop triangle tessellation (supports editmode too)");
-
- func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups");
- RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges");
- RNA_def_boolean(func, "use_bitflags", false, "", "Produce bitflags groups instead of simple numeric values");
- /* return values */
- parm = RNA_def_int_array(func, "poly_groups", 1, NULL, 0, 0, "", "Smooth Groups", 0, 0);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
- parm = RNA_def_int(func, "groups", 0, 0, INT_MAX, "groups", "Total number of groups", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
-
- func = RNA_def_function(srna, "normals_split_custom_set", "rna_Mesh_normals_split_custom_set");
- RNA_def_function_ui_description(func,
- "Define custom split normals of this mesh "
- "(use zero-vectors to keep auto ones)");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
- RNA_def_property_multi_array(parm, 2, normals_array_dim);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "normals_split_custom_set_from_vertices",
- "rna_Mesh_normals_split_custom_set_from_vertices");
- RNA_def_function_ui_description(func,
- "Define custom split normals of this mesh, from vertices' normals "
- "(use zero-vectors to keep auto ones)");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
- RNA_def_property_multi_array(parm, 2, normals_array_dim);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "update", "ED_mesh_update");
- RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
- RNA_def_boolean(func, "calc_edges_loose", 0, "Calculate Loose Edges", "Calculate the loose state of each edge");
- RNA_def_boolean(func, "calc_loop_triangles", 0, "Calculate Triangules", "Force recalculation of triangle tessellation");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- RNA_def_function(srna, "update_gpu_tag", "rna_Mesh_update_gpu_tag");
-
- func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
- RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
- /* return value */
- parm = RNA_def_string(func, "result", "nothing", 64, "Return value", "String description of result of comparison");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "validate", "BKE_mesh_validate");
- RNA_def_function_ui_description(func, "Validate geometry, return True when the mesh has had "
- "invalid geometry corrected/removed");
- RNA_def_boolean(func, "verbose", false, "Verbose", "Output information about the errors found");
- RNA_def_boolean(func, "clean_customdata", true, "Clean Custom Data",
- "Remove temp/cached custom-data layers, like e.g. normals...");
- parm = RNA_def_boolean(func, "result", 0, "Result", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "validate_material_indices", "BKE_mesh_validate_material_indices");
- RNA_def_function_ui_description(func, "Validate material indices of polygons, return True when the mesh has had "
- "invalid indices corrected (to default 0)");
- parm = RNA_def_boolean(func, "result", 0, "Result", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "count_selected_items", "rna_Mesh_count_selected_items ");
- RNA_def_function_ui_description(func, "Return the number of selected items (vert, edge, face)");
- parm = RNA_def_int_vector(func, "result", 3, NULL, 0, INT_MAX, "Result", NULL, 0, INT_MAX);
- RNA_def_function_output(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ const int normals_array_dim[] = {1, 3};
+
+ func = RNA_def_function(srna, "transform", "rna_Mesh_transform");
+ RNA_def_function_ui_description(func,
+ "Transform mesh vertices by a matrix "
+ "(Warning: inverts normals if matrix is negative)");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "shape_keys", 0, "", "Transform Shape Keys");
+
+ func = RNA_def_function(srna, "flip_normals", "rna_Mesh_flip_normals");
+ RNA_def_function_ui_description(func,
+ "Invert winding of all polygons "
+ "(clears tessellation, does not handle custom normals)");
+
+ func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
+ RNA_def_function_ui_description(func, "Calculate vertex normals");
+
+ func = RNA_def_function(srna, "create_normals_split", "rna_Mesh_create_normals_split");
+ RNA_def_function_ui_description(func, "Empty split vertex normals");
+
+ func = RNA_def_function(srna, "calc_normals_split", "BKE_mesh_calc_normals_split");
+ RNA_def_function_ui_description(func,
+ "Calculate split vertex normals, which preserve sharp edges");
+
+ func = RNA_def_function(srna, "free_normals_split", "rna_Mesh_free_normals_split");
+ RNA_def_function_ui_description(func, "Free split vertex normals");
+
+ func = RNA_def_function(srna, "split_faces", "rna_Mesh_split_faces");
+ RNA_def_function_ui_description(func, "Split faces based on the edge angle");
+ RNA_def_boolean(
+ func, "free_loop_normals", 1, "Free Loop Notmals", "Free loop normals custom data layer");
+
+ func = RNA_def_function(srna, "calc_tangents", "rna_Mesh_calc_tangents");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(
+ func,
+ "Compute tangents and bitangent signs, to be used together with the split normals "
+ "to get a complete tangent space for normal mapping "
+ "(split normals are also computed if not yet present)");
+ parm = RNA_def_string(func,
+ "uvmap",
+ NULL,
+ MAX_CUSTOMDATA_LAYER_NAME,
+ "",
+ "Name of the UV map to use for tangent space computation");
+
+ func = RNA_def_function(srna, "free_tangents", "rna_Mesh_free_tangents");
+ RNA_def_function_ui_description(func, "Free tangents");
+
+ func = RNA_def_function(srna, "calc_loop_triangles", "rna_Mesh_calc_looptri");
+ RNA_def_function_ui_description(func,
+ "Calculate loop triangle tessellation (supports editmode too)");
+
+ func = RNA_def_function(srna, "calc_smooth_groups", "rna_Mesh_calc_smooth_groups");
+ RNA_def_function_ui_description(func, "Calculate smooth groups from sharp edges");
+ RNA_def_boolean(
+ func, "use_bitflags", false, "", "Produce bitflags groups instead of simple numeric values");
+ /* return values */
+ parm = RNA_def_int_array(func, "poly_groups", 1, NULL, 0, 0, "", "Smooth Groups", 0, 0);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_OUTPUT);
+ parm = RNA_def_int(
+ func, "groups", 0, 0, INT_MAX, "groups", "Total number of groups", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
+
+ func = RNA_def_function(srna, "normals_split_custom_set", "rna_Mesh_normals_split_custom_set");
+ RNA_def_function_ui_description(func,
+ "Define custom split normals of this mesh "
+ "(use zero-vectors to keep auto ones)");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
+ RNA_def_property_multi_array(parm, 2, normals_array_dim);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+
+ func = RNA_def_function(srna,
+ "normals_split_custom_set_from_vertices",
+ "rna_Mesh_normals_split_custom_set_from_vertices");
+ RNA_def_function_ui_description(
+ func,
+ "Define custom split normals of this mesh, from vertices' normals "
+ "(use zero-vectors to keep auto ones)");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
+ RNA_def_property_multi_array(parm, 2, normals_array_dim);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "update", "ED_mesh_update");
+ RNA_def_boolean(func, "calc_edges", 0, "Calculate Edges", "Force recalculation of edges");
+ RNA_def_boolean(func,
+ "calc_edges_loose",
+ 0,
+ "Calculate Loose Edges",
+ "Calculate the loose state of each edge");
+ RNA_def_boolean(func,
+ "calc_loop_triangles",
+ 0,
+ "Calculate Triangules",
+ "Force recalculation of triangle tessellation");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ RNA_def_function(srna, "update_gpu_tag", "rna_Mesh_update_gpu_tag");
+
+ func = RNA_def_function(srna, "unit_test_compare", "rna_Mesh_unit_test_compare");
+ RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to compare to");
+ /* return value */
+ parm = RNA_def_string(
+ func, "result", "nothing", 64, "Return value", "String description of result of comparison");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "validate", "BKE_mesh_validate");
+ RNA_def_function_ui_description(func,
+ "Validate geometry, return True when the mesh has had "
+ "invalid geometry corrected/removed");
+ RNA_def_boolean(func, "verbose", false, "Verbose", "Output information about the errors found");
+ RNA_def_boolean(func,
+ "clean_customdata",
+ true,
+ "Clean Custom Data",
+ "Remove temp/cached custom-data layers, like e.g. normals...");
+ parm = RNA_def_boolean(func, "result", 0, "Result", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "validate_material_indices", "BKE_mesh_validate_material_indices");
+ RNA_def_function_ui_description(
+ func,
+ "Validate material indices of polygons, return True when the mesh has had "
+ "invalid indices corrected (to default 0)");
+ parm = RNA_def_boolean(func, "result", 0, "Result", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "count_selected_items", "rna_Mesh_count_selected_items ");
+ RNA_def_function_ui_description(func, "Return the number of selected items (vert, edge, face)");
+ parm = RNA_def_int_vector(func, "result", 3, NULL, 0, INT_MAX, "Result", NULL, 0, INT_MAX);
+ RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_mesh_utils.h b/source/blender/makesrna/intern/rna_mesh_utils.h
index 898d904da96..ff148408728 100644
--- a/source/blender/makesrna/intern/rna_mesh_utils.h
+++ b/source/blender/makesrna/intern/rna_mesh_utils.h
@@ -24,103 +24,103 @@
/* Macros to help reduce code clutter in rna_mesh.c */
/* Define the accessors for a basic CustomDataLayer collection */
-#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, layer_type) \
- /* check */ \
- static int rna_##collection_name##_check( \
- CollectionPropertyIterator *UNUSED(iter), void *data) \
- { \
- CustomDataLayer *layer = (CustomDataLayer *)data; \
- return (layer->type != layer_type); \
- } \
- /* begin */ \
- static void rna_Mesh_##collection_name##s_begin(CollectionPropertyIterator *iter, \
- PointerRNA *ptr) \
- { \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- if (data) { \
- rna_iterator_array_begin(iter, \
- (void *)data->layers, sizeof(CustomDataLayer), \
- data->totlayer, 0, \
- rna_##collection_name##_check); \
- } \
- else { \
- rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); \
- } \
- } \
- /* length */ \
- static int rna_Mesh_##collection_name##s_length(PointerRNA *ptr) \
- { \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- return data ? CustomData_number_of_layers(data, layer_type) : 0; \
- } \
- /* index range */ \
- static void rna_Mesh_##collection_name##_index_range( \
- PointerRNA *ptr, int *min, int *max, \
- int *UNUSED(softmin), int *UNUSED(softmax)) \
- { \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- *min = 0; \
- *max = data ? CustomData_number_of_layers(data, layer_type) - 1 : 0; \
- *max = MAX2(0, *max); \
- }
+#define DEFINE_CUSTOMDATA_LAYER_COLLECTION(collection_name, customdata_type, layer_type) \
+ /* check */ \
+ static int rna_##collection_name##_check(CollectionPropertyIterator *UNUSED(iter), void *data) \
+ { \
+ CustomDataLayer *layer = (CustomDataLayer *)data; \
+ return (layer->type != layer_type); \
+ } \
+ /* begin */ \
+ static void rna_Mesh_##collection_name##s_begin(CollectionPropertyIterator *iter, \
+ PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ if (data) { \
+ rna_iterator_array_begin(iter, \
+ (void *)data->layers, \
+ sizeof(CustomDataLayer), \
+ data->totlayer, \
+ 0, \
+ rna_##collection_name##_check); \
+ } \
+ else { \
+ rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL); \
+ } \
+ } \
+ /* length */ \
+ static int rna_Mesh_##collection_name##s_length(PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ return data ? CustomData_number_of_layers(data, layer_type) : 0; \
+ } \
+ /* index range */ \
+ static void rna_Mesh_##collection_name##_index_range( \
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax)) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ *min = 0; \
+ *max = data ? CustomData_number_of_layers(data, layer_type) - 1 : 0; \
+ *max = MAX2(0, *max); \
+ }
/* Define the accessors for special CustomDataLayers in the collection
* (active, render, clone, stencil, etc) */
-#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM(collection_name, customdata_type, \
- layer_type, active_type, layer_rna_type) \
- \
- static PointerRNA rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \
- { \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- CustomDataLayer *layer; \
- if (data) { \
- int index = CustomData_get_##active_type##_layer_index(data, layer_type); \
- layer = (index == -1) ? NULL : &data->layers[index]; \
- } \
- else { \
- layer = NULL; \
- } \
- return rna_pointer_inherit_refine(ptr, &RNA_##layer_rna_type, layer); \
- } \
- \
- static void rna_Mesh_##collection_name##_##active_type##_set(PointerRNA *ptr, \
- PointerRNA value) \
- { \
- Mesh *me = rna_mesh(ptr); \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- int a; \
- if (data) { \
- CustomDataLayer *layer; \
- int layer_index = CustomData_get_layer_index(data, layer_type); \
- for (layer = data->layers + layer_index, a = 0; layer_index + a < data->totlayer; layer++, a++) { \
- if (value.data == layer) { \
- CustomData_set_layer_##active_type(data, layer_type, a); \
- BKE_mesh_update_customdata_pointers(me, true); \
- return; \
- } \
- } \
- } \
- } \
- \
- static int rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) \
- { \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- if (data) { \
- return CustomData_get_##active_type##_layer(data, layer_type); \
- } \
- else { \
- return 0; \
- } \
- } \
- \
- static void rna_Mesh_##collection_name##_##active_type##_index_set(PointerRNA *ptr, int value) \
- { \
- Mesh *me = rna_mesh(ptr); \
- CustomData *data = rna_mesh_##customdata_type(ptr); \
- if (data) { \
- CustomData_set_layer_##active_type(data, layer_type, value); \
- BKE_mesh_update_customdata_pointers(me, true); \
- } \
- }
+#define DEFINE_CUSTOMDATA_LAYER_COLLECTION_ACTIVEITEM( \
+ collection_name, customdata_type, layer_type, active_type, layer_rna_type) \
+\
+ static PointerRNA rna_Mesh_##collection_name##_##active_type##_get(PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ CustomDataLayer *layer; \
+ if (data) { \
+ int index = CustomData_get_##active_type##_layer_index(data, layer_type); \
+ layer = (index == -1) ? NULL : &data->layers[index]; \
+ } \
+ else { \
+ layer = NULL; \
+ } \
+ return rna_pointer_inherit_refine(ptr, &RNA_##layer_rna_type, layer); \
+ } \
+\
+ static void rna_Mesh_##collection_name##_##active_type##_set(PointerRNA *ptr, PointerRNA value) \
+ { \
+ Mesh *me = rna_mesh(ptr); \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ int a; \
+ if (data) { \
+ CustomDataLayer *layer; \
+ int layer_index = CustomData_get_layer_index(data, layer_type); \
+ for (layer = data->layers + layer_index, a = 0; layer_index + a < data->totlayer; \
+ layer++, a++) { \
+ if (value.data == layer) { \
+ CustomData_set_layer_##active_type(data, layer_type, a); \
+ BKE_mesh_update_customdata_pointers(me, true); \
+ return; \
+ } \
+ } \
+ } \
+ } \
+\
+ static int rna_Mesh_##collection_name##_##active_type##_index_get(PointerRNA *ptr) \
+ { \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ if (data) { \
+ return CustomData_get_##active_type##_layer(data, layer_type); \
+ } \
+ else { \
+ return 0; \
+ } \
+ } \
+\
+ static void rna_Mesh_##collection_name##_##active_type##_index_set(PointerRNA *ptr, int value) \
+ { \
+ Mesh *me = rna_mesh(ptr); \
+ CustomData *data = rna_mesh_##customdata_type(ptr); \
+ if (data) { \
+ CustomData_set_layer_##active_type(data, layer_type, value); \
+ BKE_mesh_update_customdata_pointers(me, true); \
+ } \
+ }
#endif /* __RNA_MESH_UTILS_H__ */
diff --git a/source/blender/makesrna/intern/rna_meta.c b/source/blender/makesrna/intern/rna_meta.c
index 0f4cd4759bc..234929bdb36 100644
--- a/source/blender/makesrna/intern/rna_meta.c
+++ b/source/blender/makesrna/intern/rna_meta.c
@@ -33,363 +33,376 @@
#ifdef RNA_RUNTIME
-#include "BLI_math.h"
+# include "BLI_math.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
+# include "DNA_scene_types.h"
+# include "DNA_object_types.h"
-#include "BKE_mball.h"
-#include "BKE_main.h"
-#include "BKE_scene.h"
+# include "BKE_mball.h"
+# include "BKE_main.h"
+# include "BKE_scene.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "WM_types.h"
-#include "WM_api.h"
+# include "WM_types.h"
+# include "WM_api.h"
static int rna_Meta_texspace_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- MetaBall *mb = (MetaBall *)ptr->data;
- return (mb->texflag & MB_AUTOSPACE) ? 0 : PROP_EDITABLE;
+ MetaBall *mb = (MetaBall *)ptr->data;
+ return (mb->texflag & MB_AUTOSPACE) ? 0 : PROP_EDITABLE;
}
static void rna_Meta_texspace_loc_get(PointerRNA *ptr, float *values)
{
- MetaBall *mb = (MetaBall *)ptr->data;
+ MetaBall *mb = (MetaBall *)ptr->data;
- /* tex_space_mball() needs object.. ugh */
+ /* tex_space_mball() needs object.. ugh */
- copy_v3_v3(values, mb->loc);
+ copy_v3_v3(values, mb->loc);
}
static void rna_Meta_texspace_loc_set(PointerRNA *ptr, const float *values)
{
- MetaBall *mb = (MetaBall *)ptr->data;
+ MetaBall *mb = (MetaBall *)ptr->data;
- copy_v3_v3(mb->loc, values);
+ copy_v3_v3(mb->loc, values);
}
static void rna_Meta_texspace_size_get(PointerRNA *ptr, float *values)
{
- MetaBall *mb = (MetaBall *)ptr->data;
+ MetaBall *mb = (MetaBall *)ptr->data;
- /* tex_space_mball() needs object.. ugh */
+ /* tex_space_mball() needs object.. ugh */
- copy_v3_v3(values, mb->size);
+ copy_v3_v3(values, mb->size);
}
static void rna_Meta_texspace_size_set(PointerRNA *ptr, const float *values)
{
- MetaBall *mb = (MetaBall *)ptr->data;
+ MetaBall *mb = (MetaBall *)ptr->data;
- copy_v3_v3(mb->size, values);
+ copy_v3_v3(mb->size, values);
}
-
static void rna_MetaBall_update_data(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- MetaBall *mb = ptr->id.data;
- Object *ob;
-
- /* cheating way for importers to avoid slow updates */
- if (mb->id.us > 0) {
- for (ob = bmain->objects.first; ob; ob = ob->id.next)
- if (ob->data == mb)
- BKE_mball_properties_copy(scene, ob);
-
- DEG_id_tag_update(&mb->id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, mb);
- }
+ MetaBall *mb = ptr->id.data;
+ Object *ob;
+
+ /* cheating way for importers to avoid slow updates */
+ if (mb->id.us > 0) {
+ for (ob = bmain->objects.first; ob; ob = ob->id.next)
+ if (ob->data == mb)
+ BKE_mball_properties_copy(scene, ob);
+
+ DEG_id_tag_update(&mb->id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, mb);
+ }
}
static void rna_MetaBall_update_rotation(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- MetaElem *ml = ptr->data;
- normalize_qt(ml->quat);
- rna_MetaBall_update_data(bmain, scene, ptr);
+ MetaElem *ml = ptr->data;
+ normalize_qt(ml->quat);
+ rna_MetaBall_update_data(bmain, scene, ptr);
}
static MetaElem *rna_MetaBall_elements_new(MetaBall *mb, int type)
{
- MetaElem *ml = BKE_mball_element_add(mb, type);
+ MetaElem *ml = BKE_mball_element_add(mb, type);
- /* cheating way for importers to avoid slow updates */
- if (mb->id.us > 0) {
- DEG_id_tag_update(&mb->id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, &mb->id);
- }
+ /* cheating way for importers to avoid slow updates */
+ if (mb->id.us > 0) {
+ DEG_id_tag_update(&mb->id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, &mb->id);
+ }
- return ml;
+ return ml;
}
static void rna_MetaBall_elements_remove(MetaBall *mb, ReportList *reports, PointerRNA *ml_ptr)
{
- MetaElem *ml = ml_ptr->data;
-
- if (BLI_remlink_safe(&mb->elems, ml) == false) {
- BKE_reportf(reports, RPT_ERROR, "Metaball '%s' does not contain spline given", mb->id.name + 2);
- return;
- }
-
- MEM_freeN(ml);
- RNA_POINTER_INVALIDATE(ml_ptr);
-
- /* cheating way for importers to avoid slow updates */
- if (mb->id.us > 0) {
- DEG_id_tag_update(&mb->id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, &mb->id);
- }
+ MetaElem *ml = ml_ptr->data;
+
+ if (BLI_remlink_safe(&mb->elems, ml) == false) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Metaball '%s' does not contain spline given", mb->id.name + 2);
+ return;
+ }
+
+ MEM_freeN(ml);
+ RNA_POINTER_INVALIDATE(ml_ptr);
+
+ /* cheating way for importers to avoid slow updates */
+ if (mb->id.us > 0) {
+ DEG_id_tag_update(&mb->id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, &mb->id);
+ }
}
static void rna_MetaBall_elements_clear(MetaBall *mb)
{
- BLI_freelistN(&mb->elems);
+ BLI_freelistN(&mb->elems);
- /* cheating way for importers to avoid slow updates */
- if (mb->id.us > 0) {
- DEG_id_tag_update(&mb->id, 0);
- WM_main_add_notifier(NC_GEOM | ND_DATA, &mb->id);
- }
+ /* cheating way for importers to avoid slow updates */
+ if (mb->id.us > 0) {
+ DEG_id_tag_update(&mb->id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, &mb->id);
+ }
}
static bool rna_Meta_is_editmode_get(PointerRNA *ptr)
{
- MetaBall *mb = ptr->id.data;
- return (mb->editelems != NULL);
+ MetaBall *mb = ptr->id.data;
+ return (mb->editelems != NULL);
}
static char *rna_MetaElement_path(PointerRNA *ptr)
{
- MetaBall *mb = ptr->id.data;
- MetaElem *ml = ptr->data;
- int index = -1;
-
- if (mb->editelems)
- index = BLI_findindex(mb->editelems, ml);
- if (index == -1)
- index = BLI_findindex(&mb->elems, ml);
- if (index == -1)
- return NULL;
-
- return BLI_sprintfN("elements[%d]", index);
+ MetaBall *mb = ptr->id.data;
+ MetaElem *ml = ptr->data;
+ int index = -1;
+
+ if (mb->editelems)
+ index = BLI_findindex(mb->editelems, ml);
+ if (index == -1)
+ index = BLI_findindex(&mb->elems, ml);
+ if (index == -1)
+ return NULL;
+
+ return BLI_sprintfN("elements[%d]", index);
}
#else
static void rna_def_metaelement(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MetaElement", NULL);
- RNA_def_struct_sdna(srna, "MetaElem");
- RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a Metaball data-block");
- RNA_def_struct_path_func(srna, "rna_MetaElement_path");
- RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_META);
-
- /* enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_metaelem_type_items);
- RNA_def_property_ui_text(prop, "Type", "Metaball types");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- /* number values */
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "quat");
- RNA_def_property_ui_text(prop, "Rotation", "Normalized quaternion rotation");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_rotation");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED | PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "rad");
- RNA_def_property_ui_text(prop, "Radius", "");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "expx");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_ui_text(prop, "Size X", "Size of element, use of components depends on element type");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "expy");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_ui_text(prop, "Size Y", "Size of element, use of components depends on element type");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "expz");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_ui_text(prop, "Size Z", "Size of element, use of components depends on element type");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "s");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- /* flags */
- prop = RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE);
- RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE);
- RNA_def_property_ui_text(prop, "Hide", "Hide element");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MetaElement", NULL);
+ RNA_def_struct_sdna(srna, "MetaElem");
+ RNA_def_struct_ui_text(srna, "Meta Element", "Blobby element in a Metaball data-block");
+ RNA_def_struct_path_func(srna, "rna_MetaElement_path");
+ RNA_def_struct_ui_icon(srna, ICON_OUTLINER_DATA_META);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_metaelem_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Metaball types");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ /* number values */
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "quat");
+ RNA_def_property_ui_text(prop, "Rotation", "Normalized quaternion rotation");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_rotation");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_UNSIGNED | PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "rad");
+ RNA_def_property_ui_text(prop, "Radius", "");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "expx");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_text(
+ prop, "Size X", "Size of element, use of components depends on element type");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "expy");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_text(
+ prop, "Size Y", "Size of element, use of components depends on element type");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "size_z", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "expz");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_text(
+ prop, "Size Z", "Size of element, use of components depends on element type");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "s");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Stiffness", "Stiffness defines how much of the element to fill");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_negative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_NEGATIVE);
+ RNA_def_property_ui_text(prop, "Negative", "Set metaball as negative one");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MB_HIDE);
+ RNA_def_property_ui_text(prop, "Hide", "Hide element");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
}
/* mball.elements */
static void rna_def_metaball_elements(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MetaBallElements");
- srna = RNA_def_struct(brna, "MetaBallElements", NULL);
- RNA_def_struct_sdna(srna, "MetaBall");
- RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements");
-
- func = RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
- RNA_def_function_ui_description(func, "Add a new element to the metaball");
- RNA_def_enum(func, "type", rna_enum_metaelem_type_items, MB_BALL, "", "type for the new meta-element");
- parm = RNA_def_pointer(func, "element", "MetaElement", "", "The newly created meta-element");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
- RNA_def_function_ui_description(func, "Remove an element from the metaball");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
- RNA_def_function_ui_description(func, "Remove all elements from the metaball");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
- RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MetaBallElements");
+ srna = RNA_def_struct(brna, "MetaBallElements", NULL);
+ RNA_def_struct_sdna(srna, "MetaBall");
+ RNA_def_struct_ui_text(srna, "Meta Elements", "Collection of metaball elements");
+
+ func = RNA_def_function(srna, "new", "rna_MetaBall_elements_new");
+ RNA_def_function_ui_description(func, "Add a new element to the metaball");
+ RNA_def_enum(
+ func, "type", rna_enum_metaelem_type_items, MB_BALL, "", "type for the new meta-element");
+ parm = RNA_def_pointer(func, "element", "MetaElement", "", "The newly created meta-element");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_MetaBall_elements_remove");
+ RNA_def_function_ui_description(func, "Remove an element from the metaball");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "element", "MetaElement", "", "The element to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_MetaBall_elements_clear");
+ RNA_def_function_ui_description(func, "Remove all elements from the metaball");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "lastelem");
+ RNA_def_property_ui_text(prop, "Active Element", "Last selected element");
}
static void rna_def_metaball(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static const EnumPropertyItem prop_update_items[] = {
- {MB_UPDATE_ALWAYS, "UPDATE_ALWAYS", 0, "Always", "While editing, update metaball always"},
- {MB_UPDATE_HALFRES, "HALFRES", 0, "Half", "While editing, update metaball in half resolution"},
- {MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"},
- {MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MetaBall", "ID");
- RNA_def_struct_ui_text(srna, "MetaBall", "Metaball data-block to defined blobby surfaces");
- RNA_def_struct_ui_icon(srna, ICON_META_DATA);
-
- prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
- RNA_def_property_struct_type(prop, "MetaElement");
- RNA_def_property_ui_text(prop, "Elements", "Meta elements");
- rna_def_metaball_elements(brna, prop);
-
- /* enums */
- prop = RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_update_items);
- RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- /* number values */
- prop = RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "wiresize");
- RNA_def_property_range(prop, 0.005f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.05f, 1000.0f, 2.5f, 3);
- RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "rendersize");
- RNA_def_property_range(prop, 0.005f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.025f, 1000.0f, 2.5f, 3);
- RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "thresh");
- RNA_def_property_range(prop, 0.0f, 5.0f);
- RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- /* texture space */
- prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "texflag", MB_AUTOSPACE);
- RNA_def_property_ui_text(prop, "Auto Texture Space",
- "Adjust active object's texture space automatically when transforming object");
-
- prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
- RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 3);
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
- RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
- RNA_def_property_float_funcs(prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", NULL);
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-
- /* not supported yet */
-#if 0
- prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
- RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
- RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
-#endif
-
- /* materials */
- prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_ui_text(prop, "Materials", "");
- RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
-
- prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Meta_is_editmode_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
-
- /* anim */
- rna_def_animdata_common(srna);
-
- RNA_api_meta(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static const EnumPropertyItem prop_update_items[] = {
+ {MB_UPDATE_ALWAYS, "UPDATE_ALWAYS", 0, "Always", "While editing, update metaball always"},
+ {MB_UPDATE_HALFRES,
+ "HALFRES",
+ 0,
+ "Half",
+ "While editing, update metaball in half resolution"},
+ {MB_UPDATE_FAST, "FAST", 0, "Fast", "While editing, update metaball without polygonization"},
+ {MB_UPDATE_NEVER, "NEVER", 0, "Never", "While editing, don't update metaball at all"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MetaBall", "ID");
+ RNA_def_struct_ui_text(srna, "MetaBall", "Metaball data-block to defined blobby surfaces");
+ RNA_def_struct_ui_icon(srna, ICON_META_DATA);
+
+ prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "elems", NULL);
+ RNA_def_property_struct_type(prop, "MetaElement");
+ RNA_def_property_ui_text(prop, "Elements", "Meta elements");
+ rna_def_metaball_elements(brna, prop);
+
+ /* enums */
+ prop = RNA_def_property(srna, "update_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_update_items);
+ RNA_def_property_ui_text(prop, "Update", "Metaball edit update behavior");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ /* number values */
+ prop = RNA_def_property(srna, "resolution", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "wiresize");
+ RNA_def_property_range(prop, 0.005f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.05f, 1000.0f, 2.5f, 3);
+ RNA_def_property_ui_text(prop, "Wire Size", "Polygonization resolution in the 3D viewport");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "render_resolution", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "rendersize");
+ RNA_def_property_range(prop, 0.005f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.025f, 1000.0f, 2.5f, 3);
+ RNA_def_property_ui_text(prop, "Render Size", "Polygonization resolution in rendering");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "thresh");
+ RNA_def_property_range(prop, 0.0f, 5.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Influence of meta elements");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ /* texture space */
+ prop = RNA_def_property(srna, "use_auto_texspace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "texflag", MB_AUTOSPACE);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Texture Space",
+ "Adjust active object's texture space automatically when transforming object");
+
+ prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Texture Space Location", "Texture space location");
+ RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
+ RNA_def_property_float_funcs(
+ prop, "rna_Meta_texspace_loc_get", "rna_Meta_texspace_loc_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ prop = RNA_def_property(srna, "texspace_size", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Texture Space Size", "Texture space size");
+ RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
+ RNA_def_property_float_funcs(
+ prop, "rna_Meta_texspace_size_get", "rna_Meta_texspace_size_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+
+ /* not supported yet */
+# if 0
+ prop = RNA_def_property(srna, "texspace_rot", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Texture Space Rotation", "Texture space rotation");
+ RNA_def_property_editable_func(prop, "rna_Meta_texspace_editable");
+ RNA_def_property_update(prop, 0, "rna_MetaBall_update_data");
+# endif
+
+ /* materials */
+ prop = RNA_def_property(srna, "materials", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_ui_text(prop, "Materials", "");
+ RNA_def_property_srna(prop, "IDMaterials"); /* see rna_ID.c */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "rna_IDMaterials_assign_int");
+
+ prop = RNA_def_property(srna, "is_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Meta_is_editmode_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Editmode", "True when used in editmode");
+
+ /* anim */
+ rna_def_animdata_common(srna);
+
+ RNA_api_meta(srna);
}
void RNA_def_meta(BlenderRNA *brna)
{
- rna_def_metaelement(brna);
- rna_def_metaball(brna);
+ rna_def_metaelement(brna);
+ rna_def_metaball(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_meta_api.c b/source/blender/makesrna/intern/rna_meta_api.c
index 2cc4bb5adec..2678ed30024 100644
--- a/source/blender/makesrna/intern/rna_meta_api.c
+++ b/source/blender/makesrna/intern/rna_meta_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -33,33 +32,33 @@
#include "BKE_mball.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
static void rna_Meta_transform(struct MetaBall *mb, float *mat)
{
- BKE_mball_transform(mb, (float (*)[4])mat, true);
+ BKE_mball_transform(mb, (float(*)[4])mat, true);
- DEG_id_tag_update(&mb->id, 0);
+ DEG_id_tag_update(&mb->id, 0);
}
static void rna_Mball_update_gpu_tag(MetaBall *mb)
{
- BKE_mball_batch_cache_dirty_tag(mb, BKE_MBALL_BATCH_DIRTY_ALL);
+ BKE_mball_batch_cache_dirty_tag(mb, BKE_MBALL_BATCH_DIRTY_ALL);
}
#else
void RNA_api_meta(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- func = RNA_def_function(srna, "transform", "rna_Meta_transform");
- RNA_def_function_ui_description(func, "Transform meta elements by a matrix");
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "transform", "rna_Meta_transform");
+ RNA_def_function_ui_description(func, "Transform meta elements by a matrix");
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function(srna, "update_gpu_tag", "rna_Mball_update_gpu_tag");
+ RNA_def_function(srna, "update_gpu_tag", "rna_Mball_update_gpu_tag");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 18ab5565d22..860c2c3ba89 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <float.h>
#include <limits.h>
#include <stdlib.h>
@@ -57,438 +56,581 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_object_modifier_type_items[] = {
- {0, "", 0, N_("Modify"), ""},
- {eModifierType_DataTransfer, "DATA_TRANSFER", ICON_MOD_DATA_TRANSFER, "Data Transfer", ""},
- {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
- {eModifierType_MeshSequenceCache, "MESH_SEQUENCE_CACHE", ICON_MOD_MESHDEFORM, "Mesh Sequence Cache", ""},
- {eModifierType_NormalEdit, "NORMAL_EDIT", ICON_MOD_NORMALEDIT, "Normal Edit", ""},
- {eModifierType_WeightedNormal, "WEIGHTED_NORMAL", ICON_MOD_NORMALEDIT, "Weighted Normal", ""},
- {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
- {eModifierType_UVWarp, "UV_WARP", ICON_MOD_UVPROJECT, "UV Warp", ""},
- {eModifierType_WeightVGEdit, "VERTEX_WEIGHT_EDIT", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Edit", ""},
- {eModifierType_WeightVGMix, "VERTEX_WEIGHT_MIX", ICON_MOD_VERTEX_WEIGHT, "Vertex Weight Mix", ""},
- {eModifierType_WeightVGProximity, "VERTEX_WEIGHT_PROXIMITY", ICON_MOD_VERTEX_WEIGHT,
- "Vertex Weight Proximity", ""},
- {0, "", 0, N_("Generate"), ""},
- {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
- {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
- {eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
- {eModifierType_Build, "BUILD", ICON_MOD_BUILD, "Build", ""},
- {eModifierType_Decimate, "DECIMATE", ICON_MOD_DECIM, "Decimate", ""},
- {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
- {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
- {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
- {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
- {eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, "Remesh", ""},
- {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
- {eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
- {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
- {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
- {eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
- {eModifierType_Wireframe, "WIREFRAME", ICON_MOD_WIREFRAME, "Wireframe", "Generate a wireframe on the edges of a mesh"},
- {0, "", 0, N_("Deform"), ""},
- {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
- {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
- {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
- {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
- {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
- {eModifierType_LaplacianDeform, "LAPLACIANDEFORM", ICON_MOD_MESHDEFORM, "Laplacian Deform", ""},
- {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
- {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
- {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
- {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
- {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
- {eModifierType_CorrectiveSmooth, "CORRECTIVE_SMOOTH", ICON_MOD_SMOOTH, "Smooth Corrective", ""},
- {eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Smooth Laplacian", ""},
- {eModifierType_SurfaceDeform, "SURFACE_DEFORM", ICON_MOD_MESHDEFORM, "Surface Deform", ""},
- {eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""},
- {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
- {0, "", 0, N_("Simulate"), ""},
- {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
- {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
- {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""},
- {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
- {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
- {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""},
- {eModifierType_ParticleInstance, "PARTICLE_INSTANCE", ICON_MOD_PARTICLE_INSTANCE, "Particle Instance", ""},
- {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
- {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
- {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
- {eModifierType_Surface, "SURFACE", ICON_MODIFIER, "Surface", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "", 0, N_("Modify"), ""},
+ {eModifierType_DataTransfer, "DATA_TRANSFER", ICON_MOD_DATA_TRANSFER, "Data Transfer", ""},
+ {eModifierType_MeshCache, "MESH_CACHE", ICON_MOD_MESHDEFORM, "Mesh Cache", ""},
+ {eModifierType_MeshSequenceCache,
+ "MESH_SEQUENCE_CACHE",
+ ICON_MOD_MESHDEFORM,
+ "Mesh Sequence Cache",
+ ""},
+ {eModifierType_NormalEdit, "NORMAL_EDIT", ICON_MOD_NORMALEDIT, "Normal Edit", ""},
+ {eModifierType_WeightedNormal, "WEIGHTED_NORMAL", ICON_MOD_NORMALEDIT, "Weighted Normal", ""},
+ {eModifierType_UVProject, "UV_PROJECT", ICON_MOD_UVPROJECT, "UV Project", ""},
+ {eModifierType_UVWarp, "UV_WARP", ICON_MOD_UVPROJECT, "UV Warp", ""},
+ {eModifierType_WeightVGEdit,
+ "VERTEX_WEIGHT_EDIT",
+ ICON_MOD_VERTEX_WEIGHT,
+ "Vertex Weight Edit",
+ ""},
+ {eModifierType_WeightVGMix,
+ "VERTEX_WEIGHT_MIX",
+ ICON_MOD_VERTEX_WEIGHT,
+ "Vertex Weight Mix",
+ ""},
+ {eModifierType_WeightVGProximity,
+ "VERTEX_WEIGHT_PROXIMITY",
+ ICON_MOD_VERTEX_WEIGHT,
+ "Vertex Weight Proximity",
+ ""},
+ {0, "", 0, N_("Generate"), ""},
+ {eModifierType_Array, "ARRAY", ICON_MOD_ARRAY, "Array", ""},
+ {eModifierType_Bevel, "BEVEL", ICON_MOD_BEVEL, "Bevel", ""},
+ {eModifierType_Boolean, "BOOLEAN", ICON_MOD_BOOLEAN, "Boolean", ""},
+ {eModifierType_Build, "BUILD", ICON_MOD_BUILD, "Build", ""},
+ {eModifierType_Decimate, "DECIMATE", ICON_MOD_DECIM, "Decimate", ""},
+ {eModifierType_EdgeSplit, "EDGE_SPLIT", ICON_MOD_EDGESPLIT, "Edge Split", ""},
+ {eModifierType_Mask, "MASK", ICON_MOD_MASK, "Mask", ""},
+ {eModifierType_Mirror, "MIRROR", ICON_MOD_MIRROR, "Mirror", ""},
+ {eModifierType_Multires, "MULTIRES", ICON_MOD_MULTIRES, "Multiresolution", ""},
+ {eModifierType_Remesh, "REMESH", ICON_MOD_REMESH, "Remesh", ""},
+ {eModifierType_Screw, "SCREW", ICON_MOD_SCREW, "Screw", ""},
+ {eModifierType_Skin, "SKIN", ICON_MOD_SKIN, "Skin", ""},
+ {eModifierType_Solidify, "SOLIDIFY", ICON_MOD_SOLIDIFY, "Solidify", ""},
+ {eModifierType_Subsurf, "SUBSURF", ICON_MOD_SUBSURF, "Subdivision Surface", ""},
+ {eModifierType_Triangulate, "TRIANGULATE", ICON_MOD_TRIANGULATE, "Triangulate", ""},
+ {eModifierType_Wireframe,
+ "WIREFRAME",
+ ICON_MOD_WIREFRAME,
+ "Wireframe",
+ "Generate a wireframe on the edges of a mesh"},
+ {0, "", 0, N_("Deform"), ""},
+ {eModifierType_Armature, "ARMATURE", ICON_MOD_ARMATURE, "Armature", ""},
+ {eModifierType_Cast, "CAST", ICON_MOD_CAST, "Cast", ""},
+ {eModifierType_Curve, "CURVE", ICON_MOD_CURVE, "Curve", ""},
+ {eModifierType_Displace, "DISPLACE", ICON_MOD_DISPLACE, "Displace", ""},
+ {eModifierType_Hook, "HOOK", ICON_HOOK, "Hook", ""},
+ {eModifierType_LaplacianDeform,
+ "LAPLACIANDEFORM",
+ ICON_MOD_MESHDEFORM,
+ "Laplacian Deform",
+ ""},
+ {eModifierType_Lattice, "LATTICE", ICON_MOD_LATTICE, "Lattice", ""},
+ {eModifierType_MeshDeform, "MESH_DEFORM", ICON_MOD_MESHDEFORM, "Mesh Deform", ""},
+ {eModifierType_Shrinkwrap, "SHRINKWRAP", ICON_MOD_SHRINKWRAP, "Shrinkwrap", ""},
+ {eModifierType_SimpleDeform, "SIMPLE_DEFORM", ICON_MOD_SIMPLEDEFORM, "Simple Deform", ""},
+ {eModifierType_Smooth, "SMOOTH", ICON_MOD_SMOOTH, "Smooth", ""},
+ {eModifierType_CorrectiveSmooth,
+ "CORRECTIVE_SMOOTH",
+ ICON_MOD_SMOOTH,
+ "Smooth Corrective",
+ ""},
+ {eModifierType_LaplacianSmooth, "LAPLACIANSMOOTH", ICON_MOD_SMOOTH, "Smooth Laplacian", ""},
+ {eModifierType_SurfaceDeform, "SURFACE_DEFORM", ICON_MOD_MESHDEFORM, "Surface Deform", ""},
+ {eModifierType_Warp, "WARP", ICON_MOD_WARP, "Warp", ""},
+ {eModifierType_Wave, "WAVE", ICON_MOD_WAVE, "Wave", ""},
+ {0, "", 0, N_("Simulate"), ""},
+ {eModifierType_Cloth, "CLOTH", ICON_MOD_CLOTH, "Cloth", ""},
+ {eModifierType_Collision, "COLLISION", ICON_MOD_PHYSICS, "Collision", ""},
+ {eModifierType_DynamicPaint, "DYNAMIC_PAINT", ICON_MOD_DYNAMICPAINT, "Dynamic Paint", ""},
+ {eModifierType_Explode, "EXPLODE", ICON_MOD_EXPLODE, "Explode", ""},
+ {eModifierType_Fluidsim, "FLUID_SIMULATION", ICON_MOD_FLUIDSIM, "Fluid Simulation", ""},
+ {eModifierType_Ocean, "OCEAN", ICON_MOD_OCEAN, "Ocean", ""},
+ {eModifierType_ParticleInstance,
+ "PARTICLE_INSTANCE",
+ ICON_MOD_PARTICLE_INSTANCE,
+ "Particle Instance",
+ ""},
+ {eModifierType_ParticleSystem, "PARTICLE_SYSTEM", ICON_MOD_PARTICLES, "Particle System", ""},
+ {eModifierType_Smoke, "SMOKE", ICON_MOD_SMOKE, "Smoke", ""},
+ {eModifierType_Softbody, "SOFT_BODY", ICON_MOD_SOFT, "Soft Body", ""},
+ {eModifierType_Surface, "SURFACE", ICON_MODIFIER, "Surface", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[] = {
- {MOD_TRIANGULATE_QUAD_BEAUTY, "BEAUTY", 0, "Beauty ", "Split the quads in nice triangles, slower method"},
- {MOD_TRIANGULATE_QUAD_FIXED, "FIXED", 0, "Fixed", "Split the quads on the first and third vertices"},
- {MOD_TRIANGULATE_QUAD_ALTERNATE, "FIXED_ALTERNATE", 0, "Fixed Alternate",
- "Split the quads on the 2nd and 4th vertices"},
- {MOD_TRIANGULATE_QUAD_SHORTEDGE, "SHORTEST_DIAGONAL", 0, "Shortest Diagonal",
- "Split the quads based on the distance between the vertices"},
- {0, NULL, 0, NULL, NULL},
+ {MOD_TRIANGULATE_QUAD_BEAUTY,
+ "BEAUTY",
+ 0,
+ "Beauty ",
+ "Split the quads in nice triangles, slower method"},
+ {MOD_TRIANGULATE_QUAD_FIXED,
+ "FIXED",
+ 0,
+ "Fixed",
+ "Split the quads on the first and third vertices"},
+ {MOD_TRIANGULATE_QUAD_ALTERNATE,
+ "FIXED_ALTERNATE",
+ 0,
+ "Fixed Alternate",
+ "Split the quads on the 2nd and 4th vertices"},
+ {MOD_TRIANGULATE_QUAD_SHORTEDGE,
+ "SHORTEST_DIAGONAL",
+ 0,
+ "Shortest Diagonal",
+ "Split the quads based on the distance between the vertices"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[] = {
- {MOD_TRIANGULATE_NGON_BEAUTY, "BEAUTY", 0, "Beauty", "Arrange the new triangles evenly (slow)"},
- {MOD_TRIANGULATE_NGON_EARCLIP, "CLIP", 0, "Clip", "Split the polygons with an ear clipping algorithm"},
- {0, NULL, 0, NULL, NULL},
+ {MOD_TRIANGULATE_NGON_BEAUTY,
+ "BEAUTY",
+ 0,
+ "Beauty",
+ "Arrange the new triangles evenly (slow)"},
+ {MOD_TRIANGULATE_NGON_EARCLIP,
+ "CLIP",
+ 0,
+ "Clip",
+ "Split the polygons with an ear clipping algorithm"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_modifier_shrinkwrap_mode_items[] = {
- {MOD_SHRINKWRAP_ON_SURFACE, "ON_SURFACE", 0, "On Surface",
- "The point is constrained to the surface of the target object, "
- "with distance offset towards the original point location"},
- {MOD_SHRINKWRAP_INSIDE, "INSIDE", 0, "Inside",
- "The point is constrained to be inside the target object"},
- {MOD_SHRINKWRAP_OUTSIDE, "OUTSIDE", 0, "Outside",
- "The point is constrained to be outside the target object"},
- {MOD_SHRINKWRAP_OUTSIDE_SURFACE, "OUTSIDE_SURFACE", 0, "Outside Surface",
- "The point is constrained to the surface of the target object, "
- "with distance offset always to the outside, towards or away from the original location"},
- {MOD_SHRINKWRAP_ABOVE_SURFACE, "ABOVE_SURFACE", 0, "Above Surface",
- "The point is constrained to the surface of the target object, "
- "with distance offset applied exactly along the target normal"},
- {0, NULL, 0, NULL, NULL},
+ {MOD_SHRINKWRAP_ON_SURFACE,
+ "ON_SURFACE",
+ 0,
+ "On Surface",
+ "The point is constrained to the surface of the target object, "
+ "with distance offset towards the original point location"},
+ {MOD_SHRINKWRAP_INSIDE,
+ "INSIDE",
+ 0,
+ "Inside",
+ "The point is constrained to be inside the target object"},
+ {MOD_SHRINKWRAP_OUTSIDE,
+ "OUTSIDE",
+ 0,
+ "Outside",
+ "The point is constrained to be outside the target object"},
+ {MOD_SHRINKWRAP_OUTSIDE_SURFACE,
+ "OUTSIDE_SURFACE",
+ 0,
+ "Outside Surface",
+ "The point is constrained to the surface of the target object, "
+ "with distance offset always to the outside, towards or away from the original location"},
+ {MOD_SHRINKWRAP_ABOVE_SURFACE,
+ "ABOVE_SURFACE",
+ 0,
+ "Above Surface",
+ "The point is constrained to the surface of the target object, "
+ "with distance offset applied exactly along the target normal"},
+ {0, NULL, 0, NULL, NULL},
};
-
#ifndef RNA_RUNTIME
/* use eWarp_Falloff_*** & eHook_Falloff_***, they're in sync */
static const EnumPropertyItem modifier_warp_falloff_items[] = {
- {eWarp_Falloff_None, "NONE", 0, "No Falloff", ""},
- {eWarp_Falloff_Curve, "CURVE", 0, "Curve", ""},
- {eWarp_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
- {eWarp_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
- {eWarp_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
- {eWarp_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", ""},
- {eWarp_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
- {eWarp_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
- {eWarp_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
- {0, NULL, 0, NULL, NULL},
+ {eWarp_Falloff_None, "NONE", 0, "No Falloff", ""},
+ {eWarp_Falloff_Curve, "CURVE", 0, "Curve", ""},
+ {eWarp_Falloff_Smooth, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
+ {eWarp_Falloff_Sphere, "SPHERE", ICON_SPHERECURVE, "Sphere", ""},
+ {eWarp_Falloff_Root, "ROOT", ICON_ROOTCURVE, "Root", ""},
+ {eWarp_Falloff_InvSquare, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", ""},
+ {eWarp_Falloff_Sharp, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
+ {eWarp_Falloff_Linear, "LINEAR", ICON_LINCURVE, "Linear", ""},
+ {eWarp_Falloff_Const, "CONSTANT", ICON_NOCURVE, "Constant", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
/* ***** Data Transfer ***** */
const EnumPropertyItem rna_enum_dt_method_vertex_items[] = {
- {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
- "Copy from identical topology meshes"},
- {MREMAP_MODE_VERT_NEAREST, "NEAREST", 0, "Nearest vertex",
- "Copy from closest vertex"},
- {MREMAP_MODE_VERT_EDGE_NEAREST, "EDGE_NEAREST", 0, "Nearest Edge Vertex",
- "Copy from closest vertex of closest edge"},
- {MREMAP_MODE_VERT_EDGEINTERP_NEAREST, "EDGEINTERP_NEAREST", 0, "Nearest Edge Interpolated",
- "Copy from interpolated values of vertices from closest point on closest edge"},
- {MREMAP_MODE_VERT_POLY_NEAREST, "POLY_NEAREST", 0, "Nearest Face Vertex",
- "Copy from closest vertex of closest face"},
- {MREMAP_MODE_VERT_POLYINTERP_NEAREST, "POLYINTERP_NEAREST", 0, "Nearest Face Interpolated",
- "Copy from interpolated values of vertices from closest point on closest face"},
- {MREMAP_MODE_VERT_POLYINTERP_VNORPROJ, "POLYINTERP_VNORPROJ", 0, "Projected Face Interpolated",
- "Copy from interpolated values of vertices from point on closest face hit by normal-projection"},
- {0, NULL, 0, NULL, NULL},
+ {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"},
+ {MREMAP_MODE_VERT_NEAREST, "NEAREST", 0, "Nearest vertex", "Copy from closest vertex"},
+ {MREMAP_MODE_VERT_EDGE_NEAREST,
+ "EDGE_NEAREST",
+ 0,
+ "Nearest Edge Vertex",
+ "Copy from closest vertex of closest edge"},
+ {MREMAP_MODE_VERT_EDGEINTERP_NEAREST,
+ "EDGEINTERP_NEAREST",
+ 0,
+ "Nearest Edge Interpolated",
+ "Copy from interpolated values of vertices from closest point on closest edge"},
+ {MREMAP_MODE_VERT_POLY_NEAREST,
+ "POLY_NEAREST",
+ 0,
+ "Nearest Face Vertex",
+ "Copy from closest vertex of closest face"},
+ {MREMAP_MODE_VERT_POLYINTERP_NEAREST,
+ "POLYINTERP_NEAREST",
+ 0,
+ "Nearest Face Interpolated",
+ "Copy from interpolated values of vertices from closest point on closest face"},
+ {MREMAP_MODE_VERT_POLYINTERP_VNORPROJ,
+ "POLYINTERP_VNORPROJ",
+ 0,
+ "Projected Face Interpolated",
+ "Copy from interpolated values of vertices from point on closest face hit by "
+ "normal-projection"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_method_edge_items[] = {
- {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
- "Copy from identical topology meshes"},
- {MREMAP_MODE_EDGE_VERT_NEAREST, "VERT_NEAREST", 0, "Nearest Vertices",
- "Copy from most similar edge (edge which vertices are the closest of destination edge's ones)"},
- {MREMAP_MODE_EDGE_NEAREST, "NEAREST", 0, "Nearest Edge",
- "Copy from closest edge (using midpoints)"},
- {MREMAP_MODE_EDGE_POLY_NEAREST, "POLY_NEAREST", 0, "Nearest Face Edge",
- "Copy from closest edge of closest face (using midpoints)"},
- {MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ, "EDGEINTERP_VNORPROJ", 0, "Projected Edge Interpolated",
- "Interpolate all source edges hit by the projection of destination one along its own normal (from vertices)"},
- {0, NULL, 0, NULL, NULL},
+ {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"},
+ {MREMAP_MODE_EDGE_VERT_NEAREST,
+ "VERT_NEAREST",
+ 0,
+ "Nearest Vertices",
+ "Copy from most similar edge (edge which vertices are the closest of destination edge's "
+ "ones)"},
+ {MREMAP_MODE_EDGE_NEAREST,
+ "NEAREST",
+ 0,
+ "Nearest Edge",
+ "Copy from closest edge (using midpoints)"},
+ {MREMAP_MODE_EDGE_POLY_NEAREST,
+ "POLY_NEAREST",
+ 0,
+ "Nearest Face Edge",
+ "Copy from closest edge of closest face (using midpoints)"},
+ {MREMAP_MODE_EDGE_EDGEINTERP_VNORPROJ,
+ "EDGEINTERP_VNORPROJ",
+ 0,
+ "Projected Edge Interpolated",
+ "Interpolate all source edges hit by the projection of destination one along its own normal "
+ "(from vertices)"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_method_loop_items[] = {
- {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
- "Copy from identical topology meshes"},
- {MREMAP_MODE_LOOP_NEAREST_LOOPNOR, "NEAREST_NORMAL", 0, "Nearest Corner And Best Matching Normal",
- "Copy from nearest corner which has the best matching normal"},
- {MREMAP_MODE_LOOP_NEAREST_POLYNOR, "NEAREST_POLYNOR", 0, "Nearest Corner And Best Matching Face Normal",
- "Copy from nearest corner which has the face with the best matching normal to destination corner's face one"},
- {MREMAP_MODE_LOOP_POLY_NEAREST, "NEAREST_POLY", 0, "Nearest Corner Of Nearest Face",
- "Copy from nearest corner of nearest polygon"},
- {MREMAP_MODE_LOOP_POLYINTERP_NEAREST, "POLYINTERP_NEAREST", 0, "Nearest Face Interpolated",
- "Copy from interpolated corners of the nearest source polygon"},
- {MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ, "POLYINTERP_LNORPROJ", 0, "Projected Face Interpolated",
- "Copy from interpolated corners of the source polygon hit by corner normal projection"},
- {0, NULL, 0, NULL, NULL},
+ {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"},
+ {MREMAP_MODE_LOOP_NEAREST_LOOPNOR,
+ "NEAREST_NORMAL",
+ 0,
+ "Nearest Corner And Best Matching Normal",
+ "Copy from nearest corner which has the best matching normal"},
+ {MREMAP_MODE_LOOP_NEAREST_POLYNOR,
+ "NEAREST_POLYNOR",
+ 0,
+ "Nearest Corner And Best Matching Face Normal",
+ "Copy from nearest corner which has the face with the best matching normal to destination "
+ "corner's face one"},
+ {MREMAP_MODE_LOOP_POLY_NEAREST,
+ "NEAREST_POLY",
+ 0,
+ "Nearest Corner Of Nearest Face",
+ "Copy from nearest corner of nearest polygon"},
+ {MREMAP_MODE_LOOP_POLYINTERP_NEAREST,
+ "POLYINTERP_NEAREST",
+ 0,
+ "Nearest Face Interpolated",
+ "Copy from interpolated corners of the nearest source polygon"},
+ {MREMAP_MODE_LOOP_POLYINTERP_LNORPROJ,
+ "POLYINTERP_LNORPROJ",
+ 0,
+ "Projected Face Interpolated",
+ "Copy from interpolated corners of the source polygon hit by corner normal projection"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_method_poly_items[] = {
- {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology",
- "Copy from identical topology meshes"},
- {MREMAP_MODE_POLY_NEAREST, "NEAREST", 0, "Nearest Face",
- "Copy from nearest polygon (using center points)"},
- {MREMAP_MODE_POLY_NOR, "NORMAL", 0, "Best Normal-Matching",
- "Copy from source polygon which normal is the closest to destination one"},
- {MREMAP_MODE_POLY_POLYINTERP_PNORPROJ, "POLYINTERP_PNORPROJ", 0, "Projected Face Interpolated",
- "Interpolate all source polygons intersected by the projection of destination one along its own normal"},
- {0, NULL, 0, NULL, NULL},
+ {MREMAP_MODE_TOPOLOGY, "TOPOLOGY", 0, "Topology", "Copy from identical topology meshes"},
+ {MREMAP_MODE_POLY_NEAREST,
+ "NEAREST",
+ 0,
+ "Nearest Face",
+ "Copy from nearest polygon (using center points)"},
+ {MREMAP_MODE_POLY_NOR,
+ "NORMAL",
+ 0,
+ "Best Normal-Matching",
+ "Copy from source polygon which normal is the closest to destination one"},
+ {MREMAP_MODE_POLY_POLYINTERP_PNORPROJ,
+ "POLYINTERP_PNORPROJ",
+ 0,
+ "Projected Face Interpolated",
+ "Interpolate all source polygons intersected by the projection of destination one along its "
+ "own normal"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_mix_mode_items[] = {
- {CDT_MIX_TRANSFER, "REPLACE", 0, "Replace",
- "Overwrite all elements' data"},
- {CDT_MIX_REPLACE_ABOVE_THRESHOLD, "ABOVE_THRESHOLD", 0, "Above Threshold",
- "Only replace destination elements where data is above given threshold (exact behavior depends on data type)"},
- {CDT_MIX_REPLACE_BELOW_THRESHOLD, "BELOW_THRESHOLD", 0, "Below Threshold",
- "Only replace destination elements where data is below given threshold (exact behavior depends on data type)"},
- {CDT_MIX_MIX, "MIX", 0, "Mix",
- "Mix source value into destination one, using given threshold as factor"},
- {CDT_MIX_ADD, "ADD", 0, "Add",
- "Add source value to destination one, using given threshold as factor"},
- {CDT_MIX_SUB, "SUB", 0, "Subtract",
- "Subtract source value to destination one, using given threshold as factor"},
- {CDT_MIX_MUL, "MUL", 0, "Multiply",
- "Multiply source value to destination one, using given threshold as factor"},
- /* etc. etc. */
- {0, NULL, 0, NULL, NULL},
+ {CDT_MIX_TRANSFER, "REPLACE", 0, "Replace", "Overwrite all elements' data"},
+ {CDT_MIX_REPLACE_ABOVE_THRESHOLD,
+ "ABOVE_THRESHOLD",
+ 0,
+ "Above Threshold",
+ "Only replace destination elements where data is above given threshold (exact behavior "
+ "depends on data type)"},
+ {CDT_MIX_REPLACE_BELOW_THRESHOLD,
+ "BELOW_THRESHOLD",
+ 0,
+ "Below Threshold",
+ "Only replace destination elements where data is below given threshold (exact behavior "
+ "depends on data type)"},
+ {CDT_MIX_MIX,
+ "MIX",
+ 0,
+ "Mix",
+ "Mix source value into destination one, using given threshold as factor"},
+ {CDT_MIX_ADD,
+ "ADD",
+ 0,
+ "Add",
+ "Add source value to destination one, using given threshold as factor"},
+ {CDT_MIX_SUB,
+ "SUB",
+ 0,
+ "Subtract",
+ "Subtract source value to destination one, using given threshold as factor"},
+ {CDT_MIX_MUL,
+ "MUL",
+ 0,
+ "Multiply",
+ "Multiply source value to destination one, using given threshold as factor"},
+ /* etc. etc. */
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_layers_select_src_items[] = {
- {DT_LAYERS_ACTIVE_SRC, "ACTIVE", 0, "Active Layer",
- "Only transfer active data layer"},
- {DT_LAYERS_ALL_SRC, "ALL", 0, "All Layers",
- "Transfer all data layers"},
- {DT_LAYERS_VGROUP_SRC_BONE_SELECT, "BONE_SELECT", 0, "Selected Pose Bones",
- "Transfer all vertex groups used by selected pose bones"},
- {DT_LAYERS_VGROUP_SRC_BONE_DEFORM, "BONE_DEFORM", 0, "Deform Pose Bones",
- "Transfer all vertex groups used by deform bones"},
- {0, NULL, 0, NULL, NULL},
+ {DT_LAYERS_ACTIVE_SRC, "ACTIVE", 0, "Active Layer", "Only transfer active data layer"},
+ {DT_LAYERS_ALL_SRC, "ALL", 0, "All Layers", "Transfer all data layers"},
+ {DT_LAYERS_VGROUP_SRC_BONE_SELECT,
+ "BONE_SELECT",
+ 0,
+ "Selected Pose Bones",
+ "Transfer all vertex groups used by selected pose bones"},
+ {DT_LAYERS_VGROUP_SRC_BONE_DEFORM,
+ "BONE_DEFORM",
+ 0,
+ "Deform Pose Bones",
+ "Transfer all vertex groups used by deform bones"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_dt_layers_select_dst_items[] = {
- {DT_LAYERS_ACTIVE_DST, "ACTIVE", 0, "Active Layer",
- "Affect active data layer of all targets"},
- {DT_LAYERS_NAME_DST, "NAME", 0, "By Name",
- "Match target data layers to affect by name"},
- {DT_LAYERS_INDEX_DST, "INDEX", 0, "By Order",
- "Match target data layers to affect by order (indices)"},
- {0, NULL, 0, NULL, NULL},
+ {DT_LAYERS_ACTIVE_DST, "ACTIVE", 0, "Active Layer", "Affect active data layer of all targets"},
+ {DT_LAYERS_NAME_DST, "NAME", 0, "By Name", "Match target data layers to affect by name"},
+ {DT_LAYERS_INDEX_DST,
+ "INDEX",
+ 0,
+ "By Order",
+ "Match target data layers to affect by order (indices)"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_axis_xy_items[] = {
- {0, "X", 0, "X", ""},
- {1, "Y", 0, "Y", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "X", 0, "X", ""},
+ {1, "Y", 0, "Y", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_axis_xyz_items[] = {
- {0, "X", 0, "X", ""},
- {1, "Y", 0, "Y", ""},
- {2, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "X", 0, "X", ""},
+ {1, "Y", 0, "Y", ""},
+ {2, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_axis_flag_xyz_items[] = {
- {(1 << 0), "X", 0, "X", ""},
- {(1 << 1), "Y", 0, "Y", ""},
- {(1 << 2), "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
+ {(1 << 0), "X", 0, "X", ""},
+ {(1 << 1), "Y", 0, "Y", ""},
+ {(1 << 2), "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "DNA_particle_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_smoke_types.h"
+# include "DNA_particle_types.h"
+# include "DNA_curve_types.h"
+# include "DNA_smoke_types.h"
-#include "BKE_cachefile.h"
-#include "BKE_context.h"
-#include "BKE_mesh_runtime.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_particle.h"
+# include "BKE_cachefile.h"
+# include "BKE_context.h"
+# include "BKE_mesh_runtime.h"
+# include "BKE_modifier.h"
+# include "BKE_object.h"
+# include "BKE_particle.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph_query.h"
-#ifdef WITH_ALEMBIC
-# include "ABC_alembic.h"
-#endif
+# ifdef WITH_ALEMBIC
+# include "ABC_alembic.h"
+# endif
static void rna_UVProject_projectors_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data;
- rna_iterator_array_begin(iter, (void *)uvp->projectors, sizeof(Object *), uvp->num_projectors, 0, NULL);
+ UVProjectModifierData *uvp = (UVProjectModifierData *)ptr->data;
+ rna_iterator_array_begin(
+ iter, (void *)uvp->projectors, sizeof(Object *), uvp->num_projectors, 0, NULL);
}
static StructRNA *rna_Modifier_refine(struct PointerRNA *ptr)
{
- ModifierData *md = (ModifierData *)ptr->data;
-
- switch ((ModifierType)md->type) {
- case eModifierType_Subsurf:
- return &RNA_SubsurfModifier;
- case eModifierType_Lattice:
- return &RNA_LatticeModifier;
- case eModifierType_Curve:
- return &RNA_CurveModifier;
- case eModifierType_Build:
- return &RNA_BuildModifier;
- case eModifierType_Mirror:
- return &RNA_MirrorModifier;
- case eModifierType_Decimate:
- return &RNA_DecimateModifier;
- case eModifierType_Wave:
- return &RNA_WaveModifier;
- case eModifierType_Armature:
- return &RNA_ArmatureModifier;
- case eModifierType_Hook:
- return &RNA_HookModifier;
- case eModifierType_Softbody:
- return &RNA_SoftBodyModifier;
- case eModifierType_Boolean:
- return &RNA_BooleanModifier;
- case eModifierType_Array:
- return &RNA_ArrayModifier;
- case eModifierType_EdgeSplit:
- return &RNA_EdgeSplitModifier;
- case eModifierType_Displace:
- return &RNA_DisplaceModifier;
- case eModifierType_UVProject:
- return &RNA_UVProjectModifier;
- case eModifierType_Smooth:
- return &RNA_SmoothModifier;
- case eModifierType_Cast:
- return &RNA_CastModifier;
- case eModifierType_MeshDeform:
- return &RNA_MeshDeformModifier;
- case eModifierType_ParticleSystem:
- return &RNA_ParticleSystemModifier;
- case eModifierType_ParticleInstance:
- return &RNA_ParticleInstanceModifier;
- case eModifierType_Explode:
- return &RNA_ExplodeModifier;
- case eModifierType_Cloth:
- return &RNA_ClothModifier;
- case eModifierType_Collision:
- return &RNA_CollisionModifier;
- case eModifierType_Bevel:
- return &RNA_BevelModifier;
- case eModifierType_Shrinkwrap:
- return &RNA_ShrinkwrapModifier;
- case eModifierType_Fluidsim:
- return &RNA_FluidSimulationModifier;
- case eModifierType_Mask:
- return &RNA_MaskModifier;
- case eModifierType_SimpleDeform:
- return &RNA_SimpleDeformModifier;
- case eModifierType_Multires:
- return &RNA_MultiresModifier;
- case eModifierType_Surface:
- return &RNA_SurfaceModifier;
- case eModifierType_Smoke:
- return &RNA_SmokeModifier;
- case eModifierType_Solidify:
- return &RNA_SolidifyModifier;
- case eModifierType_Screw:
- return &RNA_ScrewModifier;
- case eModifierType_Ocean:
- return &RNA_OceanModifier;
- case eModifierType_Warp:
- return &RNA_WarpModifier;
- case eModifierType_WeightVGEdit:
- return &RNA_VertexWeightEditModifier;
- case eModifierType_WeightVGMix:
- return &RNA_VertexWeightMixModifier;
- case eModifierType_WeightVGProximity:
- return &RNA_VertexWeightProximityModifier;
- case eModifierType_DynamicPaint:
- return &RNA_DynamicPaintModifier;
- case eModifierType_Remesh:
- return &RNA_RemeshModifier;
- case eModifierType_Skin:
- return &RNA_SkinModifier;
- case eModifierType_LaplacianSmooth:
- return &RNA_LaplacianSmoothModifier;
- case eModifierType_Triangulate:
- return &RNA_TriangulateModifier;
- case eModifierType_UVWarp:
- return &RNA_UVWarpModifier;
- case eModifierType_MeshCache:
- return &RNA_MeshCacheModifier;
- case eModifierType_LaplacianDeform:
- return &RNA_LaplacianDeformModifier;
- case eModifierType_Wireframe:
- return &RNA_WireframeModifier;
- case eModifierType_DataTransfer:
- return &RNA_DataTransferModifier;
- case eModifierType_NormalEdit:
- return &RNA_NormalEditModifier;
- case eModifierType_CorrectiveSmooth:
- return &RNA_CorrectiveSmoothModifier;
- case eModifierType_MeshSequenceCache:
- return &RNA_MeshSequenceCacheModifier;
- case eModifierType_SurfaceDeform:
- return &RNA_SurfaceDeformModifier;
- case eModifierType_WeightedNormal:
- return &RNA_WeightedNormalModifier;
- /* Default */
- case eModifierType_None:
- case eModifierType_ShapeKey:
- case NUM_MODIFIER_TYPES:
- return &RNA_Modifier;
- }
-
- return &RNA_Modifier;
+ ModifierData *md = (ModifierData *)ptr->data;
+
+ switch ((ModifierType)md->type) {
+ case eModifierType_Subsurf:
+ return &RNA_SubsurfModifier;
+ case eModifierType_Lattice:
+ return &RNA_LatticeModifier;
+ case eModifierType_Curve:
+ return &RNA_CurveModifier;
+ case eModifierType_Build:
+ return &RNA_BuildModifier;
+ case eModifierType_Mirror:
+ return &RNA_MirrorModifier;
+ case eModifierType_Decimate:
+ return &RNA_DecimateModifier;
+ case eModifierType_Wave:
+ return &RNA_WaveModifier;
+ case eModifierType_Armature:
+ return &RNA_ArmatureModifier;
+ case eModifierType_Hook:
+ return &RNA_HookModifier;
+ case eModifierType_Softbody:
+ return &RNA_SoftBodyModifier;
+ case eModifierType_Boolean:
+ return &RNA_BooleanModifier;
+ case eModifierType_Array:
+ return &RNA_ArrayModifier;
+ case eModifierType_EdgeSplit:
+ return &RNA_EdgeSplitModifier;
+ case eModifierType_Displace:
+ return &RNA_DisplaceModifier;
+ case eModifierType_UVProject:
+ return &RNA_UVProjectModifier;
+ case eModifierType_Smooth:
+ return &RNA_SmoothModifier;
+ case eModifierType_Cast:
+ return &RNA_CastModifier;
+ case eModifierType_MeshDeform:
+ return &RNA_MeshDeformModifier;
+ case eModifierType_ParticleSystem:
+ return &RNA_ParticleSystemModifier;
+ case eModifierType_ParticleInstance:
+ return &RNA_ParticleInstanceModifier;
+ case eModifierType_Explode:
+ return &RNA_ExplodeModifier;
+ case eModifierType_Cloth:
+ return &RNA_ClothModifier;
+ case eModifierType_Collision:
+ return &RNA_CollisionModifier;
+ case eModifierType_Bevel:
+ return &RNA_BevelModifier;
+ case eModifierType_Shrinkwrap:
+ return &RNA_ShrinkwrapModifier;
+ case eModifierType_Fluidsim:
+ return &RNA_FluidSimulationModifier;
+ case eModifierType_Mask:
+ return &RNA_MaskModifier;
+ case eModifierType_SimpleDeform:
+ return &RNA_SimpleDeformModifier;
+ case eModifierType_Multires:
+ return &RNA_MultiresModifier;
+ case eModifierType_Surface:
+ return &RNA_SurfaceModifier;
+ case eModifierType_Smoke:
+ return &RNA_SmokeModifier;
+ case eModifierType_Solidify:
+ return &RNA_SolidifyModifier;
+ case eModifierType_Screw:
+ return &RNA_ScrewModifier;
+ case eModifierType_Ocean:
+ return &RNA_OceanModifier;
+ case eModifierType_Warp:
+ return &RNA_WarpModifier;
+ case eModifierType_WeightVGEdit:
+ return &RNA_VertexWeightEditModifier;
+ case eModifierType_WeightVGMix:
+ return &RNA_VertexWeightMixModifier;
+ case eModifierType_WeightVGProximity:
+ return &RNA_VertexWeightProximityModifier;
+ case eModifierType_DynamicPaint:
+ return &RNA_DynamicPaintModifier;
+ case eModifierType_Remesh:
+ return &RNA_RemeshModifier;
+ case eModifierType_Skin:
+ return &RNA_SkinModifier;
+ case eModifierType_LaplacianSmooth:
+ return &RNA_LaplacianSmoothModifier;
+ case eModifierType_Triangulate:
+ return &RNA_TriangulateModifier;
+ case eModifierType_UVWarp:
+ return &RNA_UVWarpModifier;
+ case eModifierType_MeshCache:
+ return &RNA_MeshCacheModifier;
+ case eModifierType_LaplacianDeform:
+ return &RNA_LaplacianDeformModifier;
+ case eModifierType_Wireframe:
+ return &RNA_WireframeModifier;
+ case eModifierType_DataTransfer:
+ return &RNA_DataTransferModifier;
+ case eModifierType_NormalEdit:
+ return &RNA_NormalEditModifier;
+ case eModifierType_CorrectiveSmooth:
+ return &RNA_CorrectiveSmoothModifier;
+ case eModifierType_MeshSequenceCache:
+ return &RNA_MeshSequenceCacheModifier;
+ case eModifierType_SurfaceDeform:
+ return &RNA_SurfaceDeformModifier;
+ case eModifierType_WeightedNormal:
+ return &RNA_WeightedNormalModifier;
+ /* Default */
+ case eModifierType_None:
+ case eModifierType_ShapeKey:
+ case NUM_MODIFIER_TYPES:
+ return &RNA_Modifier;
+ }
+
+ return &RNA_Modifier;
}
static void rna_Modifier_name_set(PointerRNA *ptr, const char *value)
{
- ModifierData *md = ptr->data;
- char oldname[sizeof(md->name)];
+ ModifierData *md = ptr->data;
+ char oldname[sizeof(md->name)];
- /* make a copy of the old name first */
- BLI_strncpy(oldname, md->name, sizeof(md->name));
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, md->name, sizeof(md->name));
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(md->name, value, sizeof(md->name));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(md->name, value, sizeof(md->name));
- /* make sure the name is truly unique */
- if (ptr->id.data) {
- Object *ob = ptr->id.data;
- modifier_unique_name(&ob->modifiers, md);
- }
+ /* make sure the name is truly unique */
+ if (ptr->id.data) {
+ Object *ob = ptr->id.data;
+ modifier_unique_name(&ob->modifiers, md);
+ }
- /* fix all the animation data which may link to this */
- BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name);
+ /* fix all the animation data which may link to this */
+ BKE_animdata_fix_paths_rename_all(NULL, "modifiers", oldname, md->name);
}
static char *rna_Modifier_path(PointerRNA *ptr)
{
- ModifierData *md = ptr->data;
- char name_esc[sizeof(md->name) * 2];
+ ModifierData *md = ptr->data;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"]", name_esc);
}
static void rna_Modifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
}
static void rna_Modifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_Modifier_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
+ rna_Modifier_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
}
/* Vertex Groups */
-#define RNA_MOD_VGROUP_NAME_SET(_type, _prop) \
-static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
-{ \
- _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
- rna_object_vgroup_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
-}
+# define RNA_MOD_VGROUP_NAME_SET(_type, _prop) \
+ static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
+ { \
+ _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
+ rna_object_vgroup_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
+ }
RNA_MOD_VGROUP_NAME_SET(Armature, defgrp_name);
RNA_MOD_VGROUP_NAME_SET(Bevel, defgrp_name);
@@ -524,32 +666,32 @@ RNA_MOD_VGROUP_NAME_SET(Wireframe, defgrp_name);
static void rna_ExplodeModifier_vgroup_get(PointerRNA *ptr, char *value)
{
- ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
+ ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, emd->vgroup);
}
static int rna_ExplodeModifier_vgroup_length(PointerRNA *ptr)
{
- ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
+ ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, emd->vgroup);
}
static void rna_ExplodeModifier_vgroup_set(PointerRNA *ptr, const char *value)
{
- ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
+ ExplodeModifierData *emd = (ExplodeModifierData *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &emd->vgroup);
}
-#undef RNA_MOD_VGROUP_NAME_SET
+# undef RNA_MOD_VGROUP_NAME_SET
/* UV layers */
-#define RNA_MOD_UVLAYER_NAME_SET(_type, _prop) \
-static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
-{ \
- _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
- rna_object_uvlayer_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
-}
+# define RNA_MOD_UVLAYER_NAME_SET(_type, _prop) \
+ static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, const char *value) \
+ { \
+ _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
+ rna_object_uvlayer_name_set(ptr, value, tmd->_prop, sizeof(tmd->_prop)); \
+ }
RNA_MOD_UVLAYER_NAME_SET(MappingInfo, uvlayer_name);
RNA_MOD_UVLAYER_NAME_SET(UVProject, uvlayer_name);
@@ -558,28 +700,28 @@ RNA_MOD_UVLAYER_NAME_SET(WeightVGEdit, mask_tex_uvlayer_name);
RNA_MOD_UVLAYER_NAME_SET(WeightVGMix, mask_tex_uvlayer_name);
RNA_MOD_UVLAYER_NAME_SET(WeightVGProximity, mask_tex_uvlayer_name);
-#undef RNA_MOD_UVLAYER_NAME_SET
+# undef RNA_MOD_UVLAYER_NAME_SET
/* Objects */
static void modifier_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
{
- Object *ob = value.data;
-
- if (!self || ob != self) {
- if (!ob || type == OB_EMPTY || ob->type == type) {
- id_lib_extern((ID *)ob);
- *ob_p = ob;
- }
- }
+ Object *ob = value.data;
+
+ if (!self || ob != self) {
+ if (!ob || type == OB_EMPTY || ob->type == type) {
+ id_lib_extern((ID *)ob);
+ *ob_p = ob;
+ }
+ }
}
-#define RNA_MOD_OBJECT_SET(_type, _prop, _obtype) \
-static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
-{ \
- _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
- modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
-}
+# define RNA_MOD_OBJECT_SET(_type, _prop, _obtype) \
+ static void rna_##_type##Modifier_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
+ { \
+ _type##ModifierData *tmd = (_type##ModifierData *)ptr->data; \
+ modifier_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
+ }
RNA_MOD_OBJECT_SET(Armature, object, OB_ARMATURE);
RNA_MOD_OBJECT_SET(Array, start_cap, OB_MESH);
@@ -599,183 +741,181 @@ RNA_MOD_OBJECT_SET(SurfaceDeform, target, OB_MESH);
static void rna_HookModifier_object_set(PointerRNA *ptr, PointerRNA value)
{
- HookModifierData *hmd = ptr->data;
- Object *ob = (Object *)value.data;
+ HookModifierData *hmd = ptr->data;
+ Object *ob = (Object *)value.data;
- hmd->object = ob;
- id_lib_extern((ID *)ob);
- BKE_object_modifier_hook_reset(ob, hmd);
+ hmd->object = ob;
+ id_lib_extern((ID *)ob);
+ BKE_object_modifier_hook_reset(ob, hmd);
}
static PointerRNA rna_UVProjector_object_get(PointerRNA *ptr)
{
- Object **ob = (Object **)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Object, *ob);
+ Object **ob = (Object **)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, *ob);
}
static void rna_UVProjector_object_set(PointerRNA *ptr, PointerRNA value)
{
- Object **ob_p = (Object **)ptr->data;
- Object *ob = (Object *)value.data;
- id_lib_extern((ID *)ob);
- *ob_p = ob;
+ Object **ob_p = (Object **)ptr->data;
+ Object *ob = (Object *)value.data;
+ id_lib_extern((ID *)ob);
+ *ob_p = ob;
}
-#undef RNA_MOD_OBJECT_SET
+# undef RNA_MOD_OBJECT_SET
/* Other rna callbacks */
static void rna_Smoke_set_type(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- SmokeModifierData *smd = (SmokeModifierData *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
-
- /* nothing changed */
- if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
- return;
-
- smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */
- smokeModifier_createType(smd); /* create regarding of selected type */
-
- switch (smd->type) {
- case MOD_SMOKE_TYPE_DOMAIN:
- ob->dt = OB_WIRE;
- break;
- case MOD_SMOKE_TYPE_FLOW:
- case MOD_SMOKE_TYPE_COLL:
- case 0:
- default:
- break;
- }
-
- /* update dependency since a domain - other type switch could have happened */
- rna_Modifier_dependency_update(bmain, scene, ptr);
+ SmokeModifierData *smd = (SmokeModifierData *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+
+ /* nothing changed */
+ if ((smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain)
+ return;
+
+ smokeModifier_free(smd); /* XXX TODO: completely free all 3 pointers */
+ smokeModifier_createType(smd); /* create regarding of selected type */
+
+ switch (smd->type) {
+ case MOD_SMOKE_TYPE_DOMAIN:
+ ob->dt = OB_WIRE;
+ break;
+ case MOD_SMOKE_TYPE_FLOW:
+ case MOD_SMOKE_TYPE_COLL:
+ case 0:
+ default:
+ break;
+ }
+
+ /* update dependency since a domain - other type switch could have happened */
+ rna_Modifier_dependency_update(bmain, scene, ptr);
}
static void rna_MultiresModifier_type_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
- MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
- multires_force_update(ob);
- mmd->simple = value;
+ multires_force_update(ob);
+ mmd->simple = value;
}
-static void rna_MultiresModifier_level_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_MultiresModifier_level_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
+ MultiresModifierData *mmd = (MultiresModifierData *)ptr->data;
- *min = 0;
- *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */
+ *min = 0;
+ *max = max_ii(0, mmd->totlvl); /* intentionally _not_ -1 */
}
static bool rna_MultiresModifier_external_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- Mesh *me = ob->data;
+ Object *ob = (Object *)ptr->id.data;
+ Mesh *me = ob->data;
- return CustomData_external_test(&me->ldata, CD_MDISPS);
+ return CustomData_external_test(&me->ldata, CD_MDISPS);
}
static void rna_MultiresModifier_filepath_get(PointerRNA *ptr, char *value)
{
- Object *ob = (Object *)ptr->id.data;
- CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
+ Object *ob = (Object *)ptr->id.data;
+ CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
- BLI_strncpy(value, (external) ? external->filename : "", sizeof(external->filename));
+ BLI_strncpy(value, (external) ? external->filename : "", sizeof(external->filename));
}
static void rna_MultiresModifier_filepath_set(PointerRNA *ptr, const char *value)
{
- Object *ob = (Object *)ptr->id.data;
- CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
+ Object *ob = (Object *)ptr->id.data;
+ CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
- if (external && !STREQ(external->filename, value)) {
- BLI_strncpy(external->filename, value, sizeof(external->filename));
- multires_force_external_reload(ob);
- }
+ if (external && !STREQ(external->filename, value)) {
+ BLI_strncpy(external->filename, value, sizeof(external->filename));
+ multires_force_external_reload(ob);
+ }
}
static int rna_MultiresModifier_filepath_length(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
+ Object *ob = (Object *)ptr->id.data;
+ CustomDataExternal *external = ((Mesh *)ob->data)->ldata.external;
- return strlen((external) ? external->filename : "");
+ return strlen((external) ? external->filename : "");
}
static int rna_ShrinkwrapModifier_face_cull_get(PointerRNA *ptr)
{
- ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
- return swm->shrinkOpts & MOD_SHRINKWRAP_CULL_TARGET_MASK;
+ ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
+ return swm->shrinkOpts & MOD_SHRINKWRAP_CULL_TARGET_MASK;
}
static void rna_ShrinkwrapModifier_face_cull_set(struct PointerRNA *ptr, int value)
{
- ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
- swm->shrinkOpts = (swm->shrinkOpts & ~MOD_SHRINKWRAP_CULL_TARGET_MASK) | value;
+ ShrinkwrapModifierData *swm = (ShrinkwrapModifierData *)ptr->data;
+ swm->shrinkOpts = (swm->shrinkOpts & ~MOD_SHRINKWRAP_CULL_TARGET_MASK) | value;
}
static bool rna_MeshDeformModifier_is_bound_get(PointerRNA *ptr)
{
- return (((MeshDeformModifierData *)ptr->data)->bindcagecos != NULL);
+ return (((MeshDeformModifierData *)ptr->data)->bindcagecos != NULL);
}
static PointerRNA rna_SoftBodyModifier_settings_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
+ Object *ob = (Object *)ptr->id.data;
+ return rna_pointer_inherit_refine(ptr, &RNA_SoftBodySettings, ob->soft);
}
static PointerRNA rna_SoftBodyModifier_point_cache_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_PointCache, ob->soft->shared->pointcache);
+ Object *ob = (Object *)ptr->id.data;
+ return rna_pointer_inherit_refine(ptr, &RNA_PointCache, ob->soft->shared->pointcache);
}
static PointerRNA rna_CollisionModifier_settings_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
+ Object *ob = (Object *)ptr->id.data;
+ return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
}
static void rna_UVProjectModifier_num_projectors_set(PointerRNA *ptr, int value)
{
- UVProjectModifierData *md = (UVProjectModifierData *)ptr->data;
- int a;
+ UVProjectModifierData *md = (UVProjectModifierData *)ptr->data;
+ int a;
- md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAXPROJECTORS);
- for (a = md->num_projectors; a < MOD_UVPROJECT_MAXPROJECTORS; a++)
- md->projectors[a] = NULL;
+ md->num_projectors = CLAMPIS(value, 1, MOD_UVPROJECT_MAXPROJECTORS);
+ for (a = md->num_projectors; a < MOD_UVPROJECT_MAXPROJECTORS; a++)
+ md->projectors[a] = NULL;
}
static void rna_OceanModifier_init_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- OceanModifierData *omd = (OceanModifierData *)ptr->data;
+ OceanModifierData *omd = (OceanModifierData *)ptr->data;
- BKE_ocean_free_modifier_cache(omd);
- rna_Modifier_update(bmain, scene, ptr);
+ BKE_ocean_free_modifier_cache(omd);
+ rna_Modifier_update(bmain, scene, ptr);
}
static void rna_OceanModifier_ocean_chop_set(PointerRNA *ptr, float value)
{
- OceanModifierData *omd = (OceanModifierData *)ptr->data;
- float old_value = omd->chop_amount;
+ OceanModifierData *omd = (OceanModifierData *)ptr->data;
+ float old_value = omd->chop_amount;
- omd->chop_amount = value;
+ omd->chop_amount = value;
- if ((old_value == 0.0f && value > 0.0f) ||
- (old_value > 0.0f && value == 0.0f))
- {
- BKE_ocean_free_modifier_cache(omd);
- }
+ if ((old_value == 0.0f && value > 0.0f) || (old_value > 0.0f && value == 0.0f)) {
+ BKE_ocean_free_modifier_cache(omd);
+ }
}
static bool rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr)
{
- LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
- return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->vertexco != NULL));
+ LaplacianDeformModifierData *lmd = (LaplacianDeformModifierData *)ptr->data;
+ return ((lmd->flag & MOD_LAPLACIANDEFORM_BIND) && (lmd->vertexco != NULL));
}
/* NOTE: Curve and array modifiers requires curve path to be evaluated,
@@ -788,409 +928,426 @@ static bool rna_LaplacianDeformModifier_is_bind_get(PointerRNA *ptr)
static void rna_CurveModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- CurveModifierData *cmd = (CurveModifierData *)ptr->data;
- rna_Modifier_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
- if (cmd->object != NULL) {
- Curve *curve = cmd->object->data;
- if ((curve->flag & CU_PATH) == 0) {
- DEG_id_tag_update(&curve->id, ID_RECALC_GEOMETRY);
- }
- }
+ CurveModifierData *cmd = (CurveModifierData *)ptr->data;
+ rna_Modifier_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ if (cmd->object != NULL) {
+ Curve *curve = cmd->object->data;
+ if ((curve->flag & CU_PATH) == 0) {
+ DEG_id_tag_update(&curve->id, ID_RECALC_GEOMETRY);
+ }
+ }
}
static void rna_ArrayModifier_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ArrayModifierData *amd = (ArrayModifierData *)ptr->data;
- rna_Modifier_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
- if (amd->curve_ob != NULL) {
- Curve *curve = amd->curve_ob->data;
- if ((curve->flag & CU_PATH) == 0) {
- DEG_id_tag_update(&curve->id, ID_RECALC_GEOMETRY);
- }
- }
+ ArrayModifierData *amd = (ArrayModifierData *)ptr->data;
+ rna_Modifier_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ if (amd->curve_ob != NULL) {
+ Curve *curve = amd->curve_ob->data;
+ if ((curve->flag & CU_PATH) == 0) {
+ DEG_id_tag_update(&curve->id, ID_RECALC_GEOMETRY);
+ }
+ }
}
-
static void rna_DataTransferModifier_use_data_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
-
- if (!(dtmd->flags & MOD_DATATRANSFER_USE_VERT)) {
- dtmd->data_types &= ~DT_TYPE_VERT_ALL;
- }
- if (!(dtmd->flags & MOD_DATATRANSFER_USE_EDGE)) {
- dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
- }
- if (!(dtmd->flags & MOD_DATATRANSFER_USE_LOOP)) {
- dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
- }
- if (!(dtmd->flags & MOD_DATATRANSFER_USE_POLY)) {
- dtmd->data_types &= ~DT_TYPE_POLY_ALL;
- }
-
- rna_Modifier_dependency_update(bmain, scene, ptr);
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+
+ if (!(dtmd->flags & MOD_DATATRANSFER_USE_VERT)) {
+ dtmd->data_types &= ~DT_TYPE_VERT_ALL;
+ }
+ if (!(dtmd->flags & MOD_DATATRANSFER_USE_EDGE)) {
+ dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
+ }
+ if (!(dtmd->flags & MOD_DATATRANSFER_USE_LOOP)) {
+ dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
+ }
+ if (!(dtmd->flags & MOD_DATATRANSFER_USE_POLY)) {
+ dtmd->data_types &= ~DT_TYPE_POLY_ALL;
+ }
+
+ rna_Modifier_dependency_update(bmain, scene, ptr);
}
static void rna_DataTransferModifier_data_types_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- const int item_types = BKE_object_data_transfer_get_dttypes_item_types(dtmd->data_types);
-
- if (item_types & ME_VERT) {
- dtmd->flags |= MOD_DATATRANSFER_USE_VERT;
- }
- if (item_types & ME_EDGE) {
- dtmd->flags |= MOD_DATATRANSFER_USE_EDGE;
- }
- if (item_types & ME_LOOP) {
- dtmd->flags |= MOD_DATATRANSFER_USE_LOOP;
- }
- if (item_types & ME_POLY) {
- dtmd->flags |= MOD_DATATRANSFER_USE_POLY;
- }
-
- rna_Modifier_dependency_update(bmain, scene, ptr);
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ const int item_types = BKE_object_data_transfer_get_dttypes_item_types(dtmd->data_types);
+
+ if (item_types & ME_VERT) {
+ dtmd->flags |= MOD_DATATRANSFER_USE_VERT;
+ }
+ if (item_types & ME_EDGE) {
+ dtmd->flags |= MOD_DATATRANSFER_USE_EDGE;
+ }
+ if (item_types & ME_LOOP) {
+ dtmd->flags |= MOD_DATATRANSFER_USE_LOOP;
+ }
+ if (item_types & ME_POLY) {
+ dtmd->flags |= MOD_DATATRANSFER_USE_POLY;
+ }
+
+ rna_Modifier_dependency_update(bmain, scene, ptr);
}
static void rna_DataTransferModifier_verts_data_types_set(struct PointerRNA *ptr, int value)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- dtmd->data_types &= ~DT_TYPE_VERT_ALL;
- dtmd->data_types |= value;
+ dtmd->data_types &= ~DT_TYPE_VERT_ALL;
+ dtmd->data_types |= value;
}
static void rna_DataTransferModifier_edges_data_types_set(struct PointerRNA *ptr, int value)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
- dtmd->data_types |= value;
+ dtmd->data_types &= ~DT_TYPE_EDGE_ALL;
+ dtmd->data_types |= value;
}
static void rna_DataTransferModifier_loops_data_types_set(struct PointerRNA *ptr, int value)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
- dtmd->data_types |= value;
+ dtmd->data_types &= ~DT_TYPE_LOOP_ALL;
+ dtmd->data_types |= value;
}
static void rna_DataTransferModifier_polys_data_types_set(struct PointerRNA *ptr, int value)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- dtmd->data_types &= ~DT_TYPE_POLY_ALL;
- dtmd->data_types |= value;
+ dtmd->data_types &= ~DT_TYPE_POLY_ALL;
+ dtmd->data_types |= value;
}
-static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
+static const EnumPropertyItem *rna_DataTransferModifier_layers_select_src_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ bool *r_free)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- EnumPropertyItem *item = NULL, tmp_item = {0};
- int totitem = 0;
-
- if (!C) { /* needed for docs and i18n tools */
- return rna_enum_dt_layers_select_src_items;
- }
-
- Depsgraph *depsgraph = CTX_data_depsgraph(C);
-
- /* No active here! */
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
-
- if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_src")) {
- Object *ob_src = dtmd->ob_source;
-
-#if 0 /* XXX Don't think we want this in modifier version... */
- if (BKE_object_pose_armature_get(ob_src)) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_SELECT);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_DEFORM);
- }
-#endif
-
- if (ob_src) {
- bDeformGroup *dg;
- int i;
-
- RNA_enum_item_add_separator(&item, &totitem);
-
- for (i = 0, dg = ob_src->defbase.first; dg; i++, dg = dg->next) {
- tmp_item.value = i;
- tmp_item.identifier = tmp_item.name = dg->name;
- RNA_enum_item_add(&item, &totitem, &tmp_item);
- }
- }
- }
- else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_src")) {
- /* TODO */
- }
- else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_src")) {
- Object *ob_src = dtmd->ob_source;
-
- if (ob_src) {
- Mesh *me_eval;
- int num_data, i;
-
- Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
- Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
-
- CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
- cddata_masks.lmask |= CD_MASK_MLOOPUV;
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
- num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPUV);
-
- RNA_enum_item_add_separator(&item, &totitem);
-
- for (i = 0; i < num_data; i++) {
- tmp_item.value = i;
- tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(&me_eval->ldata, CD_MLOOPUV, i);
- RNA_enum_item_add(&item, &totitem, &tmp_item);
- }
- }
- }
- else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_src")) {
- Object *ob_src = dtmd->ob_source;
-
- if (ob_src) {
- Mesh *me_eval;
- int num_data, i;
-
- Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
- Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
-
- CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
- cddata_masks.lmask |= CD_MASK_MLOOPCOL;
- me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
- num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPCOL);
-
- RNA_enum_item_add_separator(&item, &totitem);
-
- for (i = 0; i < num_data; i++) {
- tmp_item.value = i;
- tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(&me_eval->ldata, CD_MLOOPCOL, i);
- RNA_enum_item_add(&item, &totitem, &tmp_item);
- }
- }
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ EnumPropertyItem *item = NULL, tmp_item = {0};
+ int totitem = 0;
+
+ if (!C) { /* needed for docs and i18n tools */
+ return rna_enum_dt_layers_select_src_items;
+ }
+
+ Depsgraph *depsgraph = CTX_data_depsgraph(C);
+
+ /* No active here! */
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC);
+
+ if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_src")) {
+ Object *ob_src = dtmd->ob_source;
+
+# if 0 /* XXX Don't think we want this in modifier version... */
+ if (BKE_object_pose_armature_get(ob_src)) {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_SELECT);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_src_items, DT_LAYERS_VGROUP_SRC_BONE_DEFORM);
+ }
+# endif
+
+ if (ob_src) {
+ bDeformGroup *dg;
+ int i;
+
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for (i = 0, dg = ob_src->defbase.first; dg; i++, dg = dg->next) {
+ tmp_item.value = i;
+ tmp_item.identifier = tmp_item.name = dg->name;
+ RNA_enum_item_add(&item, &totitem, &tmp_item);
+ }
+ }
+ }
+ else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_src")) {
+ /* TODO */
+ }
+ else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_src")) {
+ Object *ob_src = dtmd->ob_source;
+
+ if (ob_src) {
+ Mesh *me_eval;
+ int num_data, i;
+
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
+
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+ cddata_masks.lmask |= CD_MASK_MLOOPUV;
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
+ num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPUV);
+
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for (i = 0; i < num_data; i++) {
+ tmp_item.value = i;
+ tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(
+ &me_eval->ldata, CD_MLOOPUV, i);
+ RNA_enum_item_add(&item, &totitem, &tmp_item);
+ }
+ }
+ }
+ else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_src")) {
+ Object *ob_src = dtmd->ob_source;
+
+ if (ob_src) {
+ Mesh *me_eval;
+ int num_data, i;
+
+ Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
+ Object *ob_src_eval = DEG_get_evaluated_object(depsgraph, ob_src);
+
+ CustomData_MeshMasks cddata_masks = CD_MASK_BAREMESH;
+ cddata_masks.lmask |= CD_MASK_MLOOPCOL;
+ me_eval = mesh_get_eval_final(depsgraph, scene_eval, ob_src_eval, &cddata_masks);
+ num_data = CustomData_number_of_layers(&me_eval->ldata, CD_MLOOPCOL);
+
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for (i = 0; i < num_data; i++) {
+ tmp_item.value = i;
+ tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(
+ &me_eval->ldata, CD_MLOOPCOL, i);
+ RNA_enum_item_add(&item, &totitem, &tmp_item);
+ }
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
-static const EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *prop, bool *r_free)
+static const EnumPropertyItem *rna_DataTransferModifier_layers_select_dst_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop,
+ bool *r_free)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- EnumPropertyItem *item = NULL, tmp_item = {0};
- int totitem = 0;
-
- if (!C) { /* needed for docs and i18n tools */
- return rna_enum_dt_layers_select_dst_items;
- }
-
- /* No active here! */
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_INDEX_DST);
-
- if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_dst")) {
- /* Only list destination layers if we have a single source! */
- if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_MDEFORMVERT] >= 0) {
- Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
-
- if (ob_dst) {
- bDeformGroup *dg;
- int i;
-
- RNA_enum_item_add_separator(&item, &totitem);
-
- for (i = 0, dg = ob_dst->defbase.first; dg; i++, dg = dg->next) {
- tmp_item.value = i;
- tmp_item.identifier = tmp_item.name = dg->name;
- RNA_enum_item_add(&item, &totitem, &tmp_item);
- }
- }
- }
- }
- else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_dst")) {
- /* TODO */
- }
- else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_dst")) {
- /* Only list destination layers if we have a single source! */
- if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_UV] >= 0) {
- Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
-
- if (ob_dst && ob_dst->data) {
- Mesh *me_dst;
- CustomData *ldata;
- int num_data, i;
-
- me_dst = ob_dst->data;
- ldata = &me_dst->ldata;
- num_data = CustomData_number_of_layers(ldata, CD_MLOOPUV);
-
- RNA_enum_item_add_separator(&item, &totitem);
-
- for (i = 0; i < num_data; i++) {
- tmp_item.value = i;
- tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPUV, i);
- RNA_enum_item_add(&item, &totitem, &tmp_item);
- }
- }
- }
- }
- else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_dst")) {
- /* Only list destination layers if we have a single source! */
- if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_VCOL] >= 0) {
- Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
-
- if (ob_dst && ob_dst->data) {
- Mesh *me_dst;
- CustomData *ldata;
- int num_data, i;
-
- me_dst = ob_dst->data;
- ldata = &me_dst->ldata;
- num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
-
- RNA_enum_item_add_separator(&item, &totitem);
-
- for (i = 0; i < num_data; i++) {
- tmp_item.value = i;
- tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
- RNA_enum_item_add(&item, &totitem, &tmp_item);
- }
- }
- }
- }
-
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ EnumPropertyItem *item = NULL, tmp_item = {0};
+ int totitem = 0;
+
+ if (!C) { /* needed for docs and i18n tools */
+ return rna_enum_dt_layers_select_dst_items;
+ }
+
+ /* No active here! */
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_dt_layers_select_dst_items, DT_LAYERS_INDEX_DST);
+
+ if (STREQ(RNA_property_identifier(prop), "layers_vgroup_select_dst")) {
+ /* Only list destination layers if we have a single source! */
+ if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_MDEFORMVERT] >= 0) {
+ Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
+
+ if (ob_dst) {
+ bDeformGroup *dg;
+ int i;
+
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for (i = 0, dg = ob_dst->defbase.first; dg; i++, dg = dg->next) {
+ tmp_item.value = i;
+ tmp_item.identifier = tmp_item.name = dg->name;
+ RNA_enum_item_add(&item, &totitem, &tmp_item);
+ }
+ }
+ }
+ }
+ else if (STREQ(RNA_property_identifier(prop), "layers_shapekey_select_dst")) {
+ /* TODO */
+ }
+ else if (STREQ(RNA_property_identifier(prop), "layers_uv_select_dst")) {
+ /* Only list destination layers if we have a single source! */
+ if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_UV] >= 0) {
+ Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
+
+ if (ob_dst && ob_dst->data) {
+ Mesh *me_dst;
+ CustomData *ldata;
+ int num_data, i;
+
+ me_dst = ob_dst->data;
+ ldata = &me_dst->ldata;
+ num_data = CustomData_number_of_layers(ldata, CD_MLOOPUV);
+
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for (i = 0; i < num_data; i++) {
+ tmp_item.value = i;
+ tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPUV, i);
+ RNA_enum_item_add(&item, &totitem, &tmp_item);
+ }
+ }
+ }
+ }
+ else if (STREQ(RNA_property_identifier(prop), "layers_vcol_select_dst")) {
+ /* Only list destination layers if we have a single source! */
+ if (dtmd->layers_select_src[DT_MULTILAYER_INDEX_VCOL] >= 0) {
+ Object *ob_dst = CTX_data_active_object(C); /* XXX Is this OK? */
+
+ if (ob_dst && ob_dst->data) {
+ Mesh *me_dst;
+ CustomData *ldata;
+ int num_data, i;
+
+ me_dst = ob_dst->data;
+ ldata = &me_dst->ldata;
+ num_data = CustomData_number_of_layers(ldata, CD_MLOOPCOL);
+
+ RNA_enum_item_add_separator(&item, &totitem);
+
+ for (i = 0; i < num_data; i++) {
+ tmp_item.value = i;
+ tmp_item.identifier = tmp_item.name = CustomData_get_layer_name(ldata, CD_MLOOPCOL, i);
+ RNA_enum_item_add(&item, &totitem, &tmp_item);
+ }
+ }
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
-static const EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_DataTransferModifier_mix_mode_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ DataTransferModifierData *dtmd = (DataTransferModifierData *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- bool support_advanced_mixing, support_threshold;
+ bool support_advanced_mixing, support_threshold;
- if (!C) { /* needed for docs and i18n tools */
- return rna_enum_dt_mix_mode_items;
- }
+ if (!C) { /* needed for docs and i18n tools */
+ return rna_enum_dt_mix_mode_items;
+ }
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_TRANSFER);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_TRANSFER);
- BKE_object_data_transfer_get_dttypes_capacity(dtmd->data_types, &support_advanced_mixing, &support_threshold);
+ BKE_object_data_transfer_get_dttypes_capacity(
+ dtmd->data_types, &support_advanced_mixing, &support_threshold);
- if (support_threshold) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_ABOVE_THRESHOLD);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_BELOW_THRESHOLD);
- }
+ if (support_threshold) {
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_ABOVE_THRESHOLD);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_REPLACE_BELOW_THRESHOLD);
+ }
- if (support_advanced_mixing) {
- RNA_enum_item_add_separator(&item, &totitem);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MIX);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_ADD);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_SUB);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MUL);
- }
+ if (support_advanced_mixing) {
+ RNA_enum_item_add_separator(&item, &totitem);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MIX);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_ADD);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_SUB);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_dt_mix_mode_items, CDT_MIX_MUL);
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static void rna_CorrectiveSmoothModifier_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
+ CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
- MEM_SAFE_FREE(csmd->delta_cache);
+ MEM_SAFE_FREE(csmd->delta_cache);
- rna_Modifier_update(bmain, scene, ptr);
+ rna_Modifier_update(bmain, scene, ptr);
}
-static void rna_CorrectiveSmoothModifier_rest_source_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_CorrectiveSmoothModifier_rest_source_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *ptr)
{
- CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
+ CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
- if (csmd->rest_source != MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) {
- MEM_SAFE_FREE(csmd->bind_coords);
- csmd->bind_coords_num = 0;
- }
+ if (csmd->rest_source != MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND) {
+ MEM_SAFE_FREE(csmd->bind_coords);
+ csmd->bind_coords_num = 0;
+ }
- rna_CorrectiveSmoothModifier_update(bmain, scene, ptr);
+ rna_CorrectiveSmoothModifier_update(bmain, scene, ptr);
}
static bool rna_CorrectiveSmoothModifier_is_bind_get(PointerRNA *ptr)
{
- CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
- return (csmd->bind_coords != NULL);
+ CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)ptr->data;
+ return (csmd->bind_coords != NULL);
}
static bool rna_SurfaceDeformModifier_is_bound_get(PointerRNA *ptr)
{
- return (((SurfaceDeformModifierData *)ptr->data)->verts != NULL);
+ return (((SurfaceDeformModifierData *)ptr->data)->verts != NULL);
}
static void rna_MeshSequenceCache_object_path_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
-#ifdef WITH_ALEMBIC
- MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
-
- mcmd->reader = CacheReader_open_alembic_object(mcmd->cache_file->handle,
- mcmd->reader,
- ob,
- mcmd->object_path);
-#endif
+# ifdef WITH_ALEMBIC
+ MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+
+ mcmd->reader = CacheReader_open_alembic_object(
+ mcmd->cache_file->handle, mcmd->reader, ob, mcmd->object_path);
+# endif
- rna_Modifier_update(bmain, scene, ptr);
+ rna_Modifier_update(bmain, scene, ptr);
}
-static bool rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr, const PointerRNA value)
+static bool rna_ParticleInstanceModifier_particle_system_poll(PointerRNA *ptr,
+ const PointerRNA value)
{
- ParticleInstanceModifierData *psmd = ptr->data;
- ParticleSystem *psys = value.data;
+ ParticleInstanceModifierData *psmd = ptr->data;
+ ParticleSystem *psys = value.data;
- if (!psmd->ob)
- return false;
+ if (!psmd->ob)
+ return false;
- /* make sure psys is in the object */
- return BLI_findindex(&psmd->ob->particlesystem, psys) != -1;
+ /* make sure psys is in the object */
+ return BLI_findindex(&psmd->ob->particlesystem, psys) != -1;
}
static PointerRNA rna_ParticleInstanceModifier_particle_system_get(PointerRNA *ptr)
{
- ParticleInstanceModifierData *psmd = ptr->data;
- ParticleSystem *psys;
- PointerRNA rptr;
+ ParticleInstanceModifierData *psmd = ptr->data;
+ ParticleSystem *psys;
+ PointerRNA rptr;
- if (!psmd->ob)
- return PointerRNA_NULL;
+ if (!psmd->ob)
+ return PointerRNA_NULL;
- psys = BLI_findlink(&psmd->ob->particlesystem, psmd->psys - 1);
- RNA_pointer_create((ID *)psmd->ob, &RNA_ParticleSystem, psys, &rptr);
- return rptr;
+ psys = BLI_findlink(&psmd->ob->particlesystem, psmd->psys - 1);
+ RNA_pointer_create((ID *)psmd->ob, &RNA_ParticleSystem, psys, &rptr);
+ return rptr;
}
-static void rna_ParticleInstanceModifier_particle_system_set(PointerRNA *ptr, const PointerRNA value)
+static void rna_ParticleInstanceModifier_particle_system_set(PointerRNA *ptr,
+ const PointerRNA value)
{
- ParticleInstanceModifierData *psmd = ptr->data;
+ ParticleInstanceModifierData *psmd = ptr->data;
- if (!psmd->ob)
- return;
+ if (!psmd->ob)
+ return;
- psmd->psys = BLI_findindex(&psmd->ob->particlesystem, value.data) + 1;
- CLAMP_MIN(psmd->psys, 1);
+ psmd->psys = BLI_findindex(&psmd->ob->particlesystem, value.data) + 1;
+ CLAMP_MIN(psmd->psys, 1);
}
#else
@@ -1198,4005 +1355,4567 @@ static void rna_ParticleInstanceModifier_particle_system_set(PointerRNA *ptr, co
/* NOTE: *MUST* return subdivision_type property. */
static PropertyRNA *rna_def_property_subdivision_common(StructRNA *srna, const char type[])
{
- static const EnumPropertyItem prop_subdivision_type_items[] = {
- {SUBSURF_TYPE_CATMULL_CLARK, "CATMULL_CLARK", 0, "Catmull-Clark", ""},
- {SUBSURF_TYPE_SIMPLE, "SIMPLE", 0, "Simple", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_uv_smooth_items[] = {
- {SUBSURF_UV_SMOOTH_NONE, "NONE", 0,
- "Sharp", "UVs are not smoothed, boundaries are kept sharp"},
- {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS, "PRESERVE_CORNERS", 0,
- "Smooth, keep corners", "UVs are smoothed, corners on discontinuous boundary are kept sharp"},
-#if 0
- {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS, "PRESERVE_CORNERS_AND_JUNCTIONS", 0,
- "Smooth, keep corners+junctions", "UVs are smoothed, corners on discontinuous boundary and "
- "junctions of 3 or more regions are kept sharp"},
- {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE, "PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE", 0,
- "Smooth, keep corners+junctions+concave", "UVs are smoothed, corners on discontinuous boundary, "
- "junctions of 3 or more regions and darts and concave corners are kept sharp"},
- {SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES, "PRESERVE_BOUNDARIES", 0,
- "Smooth, keep corners", "UVs are smoothed, boundaries are kept sharp"},
- {SUBSURF_UV_SMOOTH_ALL, "PRESERVE_BOUNDARIES", 0,
- "Smooth all", "UVs and boundaries are smoothed"},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "uv_smooth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "uv_smooth");
- RNA_def_property_enum_items(prop, prop_uv_smooth_items);
- RNA_def_property_ui_text(prop, "UV Smooth", "Controls how smoothing is applied to UVs");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "quality");
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_range(prop, 1, 6, 1, -1);
- RNA_def_property_ui_text(prop, "Quality", "Accuracy of vertex positions, lower value is faster but less precise");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, type);
- RNA_def_property_enum_items(prop, prop_subdivision_type_items);
- RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- return prop;
+ static const EnumPropertyItem prop_subdivision_type_items[] = {
+ {SUBSURF_TYPE_CATMULL_CLARK, "CATMULL_CLARK", 0, "Catmull-Clark", ""},
+ {SUBSURF_TYPE_SIMPLE, "SIMPLE", 0, "Simple", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_uv_smooth_items[] = {
+ {SUBSURF_UV_SMOOTH_NONE,
+ "NONE",
+ 0,
+ "Sharp",
+ "UVs are not smoothed, boundaries are kept sharp"},
+ {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS,
+ "PRESERVE_CORNERS",
+ 0,
+ "Smooth, keep corners",
+ "UVs are smoothed, corners on discontinuous boundary are kept sharp"},
+# if 0
+ {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_AND_JUNCTIONS, "PRESERVE_CORNERS_AND_JUNCTIONS", 0,
+ "Smooth, keep corners+junctions", "UVs are smoothed, corners on discontinuous boundary and "
+ "junctions of 3 or more regions are kept sharp"},
+ {SUBSURF_UV_SMOOTH_PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE, "PRESERVE_CORNERS_JUNCTIONS_AND_CONCAVE", 0,
+ "Smooth, keep corners+junctions+concave", "UVs are smoothed, corners on discontinuous boundary, "
+ "junctions of 3 or more regions and darts and concave corners are kept sharp"},
+ {SUBSURF_UV_SMOOTH_PRESERVE_BOUNDARIES, "PRESERVE_BOUNDARIES", 0,
+ "Smooth, keep corners", "UVs are smoothed, boundaries are kept sharp"},
+ {SUBSURF_UV_SMOOTH_ALL, "PRESERVE_BOUNDARIES", 0,
+ "Smooth all", "UVs and boundaries are smoothed"},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "uv_smooth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "uv_smooth");
+ RNA_def_property_enum_items(prop, prop_uv_smooth_items);
+ RNA_def_property_ui_text(prop, "UV Smooth", "Controls how smoothing is applied to UVs");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_range(prop, 1, 6, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Quality", "Accuracy of vertex positions, lower value is faster but less precise");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "subdivision_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, type);
+ RNA_def_property_enum_items(prop, prop_subdivision_type_items);
+ RNA_def_property_ui_text(prop, "Subdivision Type", "Select type of subdivision algorithm");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ return prop;
}
static void rna_def_modifier_subsurf(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier");
- RNA_def_struct_sdna(srna, "SubsurfModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
-
- rna_def_property_subdivision_common(srna, "subdivType");
-
- /* see CCGSUBSURF_LEVEL_MAX for max limit */
- prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "levels");
- RNA_def_property_range(prop, 0, 11);
- RNA_def_property_ui_range(prop, 0, 6, 1, -1);
- RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "renderLevels");
- RNA_def_property_range(prop, 0, 11);
- RNA_def_property_ui_range(prop, 0, 6, 1, -1);
- RNA_def_property_ui_text(prop, "Render Levels", "Number of subdivisions to perform when rendering");
-
- prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges);
- RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_creases", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_UseCrease);
- RNA_def_property_ui_text(prop, "Use Creases", "Use mesh edge crease information to sharpen edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SubsurfModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Subsurf Modifier", "Subdivision surface modifier");
+ RNA_def_struct_sdna(srna, "SubsurfModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SUBSURF);
+
+ rna_def_property_subdivision_common(srna, "subdivType");
+
+ /* see CCGSUBSURF_LEVEL_MAX for max limit */
+ prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "levels");
+ RNA_def_property_range(prop, 0, 11);
+ RNA_def_property_ui_range(prop, 0, 6, 1, -1);
+ RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to perform");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "renderLevels");
+ RNA_def_property_range(prop, 0, 11);
+ RNA_def_property_ui_range(prop, 0, 6, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Render Levels", "Number of subdivisions to perform when rendering");
+
+ prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_ControlEdges);
+ RNA_def_property_ui_text(
+ prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_creases", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", eSubsurfModifierFlag_UseCrease);
+ RNA_def_property_ui_text(
+ prop, "Use Creases", "Use mesh edge crease information to sharpen edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_generic_map_info(StructRNA *srna)
{
- static const EnumPropertyItem prop_texture_coordinates_items[] = {
- {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use the local coordinate system for the texture coordinates"},
- {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use the global coordinate system for the texture coordinates"},
- {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object",
- "Use the linked object's local coordinate system for the texture coordinates"},
- {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Texture", "");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texmapping");
- RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
- RNA_def_property_ui_text(prop, "Texture Coordinates", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
- RNA_def_property_ui_text(prop, "UV Map", "UV map name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfoModifier_uvlayer_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "map_object");
- RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Object to set the texture coordinates");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+ static const EnumPropertyItem prop_texture_coordinates_items[] = {
+ {MOD_DISP_MAP_LOCAL,
+ "LOCAL",
+ 0,
+ "Local",
+ "Use the local coordinate system for the texture coordinates"},
+ {MOD_DISP_MAP_GLOBAL,
+ "GLOBAL",
+ 0,
+ "Global",
+ "Use the global coordinate system for the texture coordinates"},
+ {MOD_DISP_MAP_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use the linked object's local coordinate system for the texture coordinates"},
+ {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use UV coordinates for the texture coordinates"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Texture", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texmapping");
+ RNA_def_property_enum_items(prop, prop_texture_coordinates_items);
+ RNA_def_property_ui_text(prop, "Texture Coordinates", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
+ RNA_def_property_ui_text(prop, "UV Map", "UV map name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MappingInfoModifier_uvlayer_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "texture_coords_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "map_object");
+ RNA_def_property_ui_text(
+ prop, "Texture Coordinate Object", "Object to set the texture coordinates");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
}
static void rna_def_modifier_warp(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "WarpModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Warp Modifier", "Warp modifier");
- RNA_def_struct_sdna(srna, "WarpModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_WARP);
-
- prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "From", "Object to transform from");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "To", "Object to transform to");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100, 100, 10, 2);
- RNA_def_property_ui_text(prop, "Strength", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_warp_falloff_items);
- RNA_def_property_ui_text(prop, "Falloff Type", "");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
- RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
- RNA_def_property_ui_text(prop, "Falloff Curve", "Custom falloff curve");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WARP_VOLUME_PRESERVE);
- RNA_def_property_ui_text(prop, "Preserve Volume", "Preserve volume when rotations are used");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WarpModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- rna_def_modifier_generic_map_info(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "WarpModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Warp Modifier", "Warp modifier");
+ RNA_def_struct_sdna(srna, "WarpModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_WARP);
+
+ prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "From", "Object to transform from");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "To", "Object to transform to");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100, 100, 10, 2);
+ RNA_def_property_ui_text(prop, "Strength", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_warp_falloff_items);
+ RNA_def_property_ui_text(prop, "Falloff Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_UNSIGNED | PROP_DISTANCE);
+ RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
+ RNA_def_property_ui_text(prop, "Falloff Curve", "Custom falloff curve");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WARP_VOLUME_PRESERVE);
+ RNA_def_property_ui_text(prop, "Preserve Volume", "Preserve volume when rotations are used");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the deform");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WarpModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ rna_def_modifier_generic_map_info(srna);
}
static void rna_def_modifier_multires(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MultiresModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier");
- RNA_def_struct_sdna(srna, "MultiresModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
-
- prop = rna_def_property_subdivision_common(srna, "simple");
- RNA_def_property_enum_funcs(prop, NULL, "rna_MultiresModifier_type_set", NULL);
-
- prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "lvl");
- RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "sculptlvl");
- RNA_def_property_ui_text(prop, "Sculpt Levels", "Number of subdivisions to use in sculpt mode");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "renderlvl");
- RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
-
- prop = RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "totlvl");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Total Levels", "Number of subdivisions for which displacements are stored");
-
- prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
- RNA_def_property_ui_text(prop, "External",
- "Store multires displacements outside the .blend file, to save memory");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_funcs(prop, "rna_MultiresModifier_filepath_get", "rna_MultiresModifier_filepath_length",
- "rna_MultiresModifier_filepath_set");
- RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges);
- RNA_def_property_ui_text(prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_creases", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_UseCrease);
- RNA_def_property_ui_text(prop, "Use Creases", "Use mesh edge crease information to sharpen edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MultiresModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Multires Modifier", "Multiresolution mesh modifier");
+ RNA_def_struct_sdna(srna, "MultiresModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MULTIRES);
+
+ prop = rna_def_property_subdivision_common(srna, "simple");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_MultiresModifier_type_set", NULL);
+
+ prop = RNA_def_property(srna, "levels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "lvl");
+ RNA_def_property_ui_text(prop, "Levels", "Number of subdivisions to use in the viewport");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "sculpt_levels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "sculptlvl");
+ RNA_def_property_ui_text(prop, "Sculpt Levels", "Number of subdivisions to use in sculpt mode");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "render_levels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "renderlvl");
+ RNA_def_property_ui_text(prop, "Render Levels", "The subdivision level visible at render time");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_MultiresModifier_level_range");
+
+ prop = RNA_def_property(srna, "total_levels", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "totlvl");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Total Levels", "Number of subdivisions for which displacements are stored");
+
+ prop = RNA_def_property(srna, "is_external", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_MultiresModifier_external_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "External", "Store multires displacements outside the .blend file, to save memory");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_funcs(prop,
+ "rna_MultiresModifier_filepath_get",
+ "rna_MultiresModifier_filepath_length",
+ "rna_MultiresModifier_filepath_set");
+ RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_only_control_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_ControlEdges);
+ RNA_def_property_ui_text(
+ prop, "Optimal Display", "Skip drawing/rendering of interior subdivided edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_creases", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", eMultiresModifierFlag_UseCrease);
+ RNA_def_property_ui_text(
+ prop, "Use Creases", "Use mesh edge crease information to sharpen edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_lattice(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LatticeModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier");
- RNA_def_struct_sdna(srna, "LatticeModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_LatticeModifier_object_set", NULL, "rna_Lattice_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 10, 2);
- RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LatticeModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Lattice Modifier", "Lattice deformation modifier");
+ RNA_def_struct_sdna(srna, "LatticeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_LATTICE);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Lattice object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_LatticeModifier_object_set", NULL, "rna_Lattice_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LatticeModifier_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 2);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of modifier effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_curve(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_deform_axis_items[] = {
- {MOD_CURVE_POSX, "POS_X", 0, "X", ""},
- {MOD_CURVE_POSY, "POS_Y", 0, "Y", ""},
- {MOD_CURVE_POSZ, "POS_Z", 0, "Z", ""},
- {MOD_CURVE_NEGX, "NEG_X", 0, "-X", ""},
- {MOD_CURVE_NEGY, "NEG_Y", 0, "-Y", ""},
- {MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier");
- RNA_def_struct_sdna(srna, "CurveModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Curve object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_CurveModifier_object_set", NULL, "rna_Curve_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_CurveModifier_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CurveModifier_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "defaxis");
- RNA_def_property_enum_items(prop, prop_deform_axis_items);
- RNA_def_property_ui_text(prop, "Deform Axis", "The axis that the curve deforms along");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_deform_axis_items[] = {
+ {MOD_CURVE_POSX, "POS_X", 0, "X", ""},
+ {MOD_CURVE_POSY, "POS_Y", 0, "Y", ""},
+ {MOD_CURVE_POSZ, "POS_Z", 0, "Z", ""},
+ {MOD_CURVE_NEGX, "NEG_X", 0, "-X", ""},
+ {MOD_CURVE_NEGY, "NEG_Y", 0, "-Y", ""},
+ {MOD_CURVE_NEGZ, "NEG_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CurveModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Curve Modifier", "Curve deformation modifier");
+ RNA_def_struct_sdna(srna, "CurveModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_CURVE);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Curve object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_CurveModifier_object_set", NULL, "rna_Curve_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_CurveModifier_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CurveModifier_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "defaxis");
+ RNA_def_property_enum_items(prop, prop_deform_axis_items);
+ RNA_def_property_ui_text(prop, "Deform Axis", "The axis that the curve deforms along");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_build(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BuildModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier");
- RNA_def_struct_sdna(srna, "BuildModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
-
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "start");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "length");
- RNA_def_property_range(prop, 1, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_REVERSE);
- RNA_def_property_ui_text(prop, "Reversed", "Deconstruct the mesh instead of building it");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_RANDOMIZE);
- RNA_def_property_ui_text(prop, "Randomize", "Randomize the faces or edges during build");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BuildModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Build Modifier", "Build effect modifier");
+ RNA_def_struct_sdna(srna, "BuildModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BUILD);
+
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "start");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Start", "Start frame of the effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "frame_duration", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "length");
+ RNA_def_property_range(prop, 1, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Length", "Total time the build effect requires");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_REVERSE);
+ RNA_def_property_ui_text(prop, "Reversed", "Deconstruct the mesh instead of building it");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_random_order", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_BUILD_FLAG_RANDOMIZE);
+ RNA_def_property_ui_text(prop, "Randomize", "Randomize the faces or edges during build");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Seed", "Seed for random if used");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_mirror(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MirrorModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier");
- RNA_def_struct_sdna(srna, "MirrorModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
-
- prop = RNA_def_property(srna, "use_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Mirror Axis", "Enable axis mirror");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_bisect_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_AXIS_X);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Bisect Axis", "Cuts the mesh across the mirror plane");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_bisect_flip_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_FLIP_AXIS_X);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Bisect Flip Axis", "Flips the direction of the slice");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
- RNA_def_property_ui_text(prop, "Clip", "Prevent vertices from going through the mirror during transform");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP);
- RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE);
- RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U);
- RNA_def_property_ui_text(prop, "Mirror U", "Mirror the U texture coordinate around the flip offset point");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V);
- RNA_def_property_ui_text(prop, "Mirror V", "Mirror the V texture coordinate around the flip offset point");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mirror_offset_u", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_offset[0]");
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_range(prop, -1, 1, 2, 4);
- RNA_def_property_ui_text(prop, "Flip U Offset", "Amount to offset mirrored UVs flipping point from the 0.5 on the U axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mirror_offset_v", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_offset[1]");
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_range(prop, -1, 1, 2, 4);
- RNA_def_property_ui_text(prop, "Flip V Offset", "Amount to offset mirrored UVs flipping point from the 0.5 point on the V axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset_u", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_offset_copy[0]");
- RNA_def_property_range(prop, -10000.0f, 10000.0f);
- RNA_def_property_ui_range(prop, -1, 1, 2, 4);
- RNA_def_property_ui_text(prop, "U Offset", "Mirrored UV offset on the U axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset_v", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_offset_copy[1]");
- RNA_def_property_range(prop, -10000.0f, 10000.0f);
- RNA_def_property_ui_range(prop, -1, 1, 2, 4);
- RNA_def_property_ui_text(prop, "V Offset", "Mirrored UV offset on the V axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "tolerance");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
- RNA_def_property_ui_text(prop, "Merge Limit", "Distance within which mirrored vertices are merged");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
- RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MirrorModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Mirror Modifier", "Mirroring modifier");
+ RNA_def_struct_sdna(srna, "MirrorModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MIRROR);
+
+ prop = RNA_def_property(srna, "use_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_AXIS_X);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Mirror Axis", "Enable axis mirror");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_bisect_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_AXIS_X);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bisect Axis", "Cuts the mesh across the mirror plane");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_bisect_flip_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_BISECT_FLIP_AXIS_X);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bisect Flip Axis", "Flips the direction of the slice");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_CLIPPING);
+ RNA_def_property_ui_text(
+ prop, "Clip", "Prevent vertices from going through the mirror during transform");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_mirror_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_VGROUP);
+ RNA_def_property_ui_text(prop, "Mirror Vertex Groups", "Mirror vertex groups (e.g. .R->.L)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_mirror_merge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MOD_MIR_NO_MERGE);
+ RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices within the merge threshold");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_mirror_u", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_U);
+ RNA_def_property_ui_text(
+ prop, "Mirror U", "Mirror the U texture coordinate around the flip offset point");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_mirror_v", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MIR_MIRROR_V);
+ RNA_def_property_ui_text(
+ prop, "Mirror V", "Mirror the V texture coordinate around the flip offset point");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mirror_offset_u", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_offset[0]");
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_range(prop, -1, 1, 2, 4);
+ RNA_def_property_ui_text(
+ prop,
+ "Flip U Offset",
+ "Amount to offset mirrored UVs flipping point from the 0.5 on the U axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mirror_offset_v", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_offset[1]");
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_range(prop, -1, 1, 2, 4);
+ RNA_def_property_ui_text(
+ prop,
+ "Flip V Offset",
+ "Amount to offset mirrored UVs flipping point from the 0.5 point on the V axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset_u", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_offset_copy[0]");
+ RNA_def_property_range(prop, -10000.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, -1, 1, 2, 4);
+ RNA_def_property_ui_text(prop, "U Offset", "Mirrored UV offset on the U axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset_v", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_offset_copy[1]");
+ RNA_def_property_range(prop, -10000.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, -1, 1, 2, 4);
+ RNA_def_property_ui_text(prop, "V Offset", "Mirrored UV offset on the V axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "tolerance");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
+ RNA_def_property_ui_text(
+ prop, "Merge Limit", "Distance within which mirrored vertices are merged");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
+ RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
}
static void rna_def_modifier_decimate(BlenderRNA *brna)
{
- static const EnumPropertyItem modifier_decim_mode_items[] = {
- {MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
- {MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
- {MOD_DECIM_MODE_DISSOLVE, "DISSOLVE", 0, "Planar", "Dissolve geometry to form planar polygons"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Note, keep in sync with operator 'MESH_OT_decimate' */
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "DecimateModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier");
- RNA_def_struct_sdna(srna, "DecimateModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
-
- prop = RNA_def_property(srna, "decimate_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, modifier_decim_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* (mode == MOD_DECIM_MODE_COLLAPSE) */
- prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "percent");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_range(prop, 0, 1, 1, 4);
- RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to (collapse only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "iter");
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* (mode == MOD_DECIM_MODE_DISSOLVE) */
- prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_range(prop, 0, DEG2RAD(180));
- RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 10, 2);
- RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* (mode == MOD_DECIM_MODE_COLLAPSE) */
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name (collapse only)");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DecimateModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence (collapse only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_collapse_triangulate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE);
- RNA_def_property_ui_text(prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_symmetry", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_SYMMETRY);
- RNA_def_property_ui_text(prop, "Symmetry", "Maintain symmetry on an axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "symmetry_axis");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Axis", "Axis of symmetry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "defgrp_factor");
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_range(prop, 0, 10, 1, 4);
- RNA_def_property_ui_text(prop, "Factor", "Vertex group strength");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
- /* end collapse-only option */
-
- /* (mode == MOD_DECIM_MODE_DISSOLVE) */
- prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS);
- RNA_def_property_ui_text(prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "delimit", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
- RNA_def_property_enum_items(prop, rna_enum_mesh_delimit_mode_items);
- RNA_def_property_ui_text(prop, "Delimit", "Limit merging geometry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* end dissolve-only option */
-
-
-
- /* all modes use this */
- prop = RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Face Count", "The current number of faces in the decimated mesh");
+ static const EnumPropertyItem modifier_decim_mode_items[] = {
+ {MOD_DECIM_MODE_COLLAPSE, "COLLAPSE", 0, "Collapse", "Use edge collapsing"},
+ {MOD_DECIM_MODE_UNSUBDIV, "UNSUBDIV", 0, "Un-Subdivide", "Use un-subdivide face reduction"},
+ {MOD_DECIM_MODE_DISSOLVE,
+ "DISSOLVE",
+ 0,
+ "Planar",
+ "Dissolve geometry to form planar polygons"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Note, keep in sync with operator 'MESH_OT_decimate' */
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "DecimateModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Decimate Modifier", "Decimation modifier");
+ RNA_def_struct_sdna(srna, "DecimateModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DECIM);
+
+ prop = RNA_def_property(srna, "decimate_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, modifier_decim_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* (mode == MOD_DECIM_MODE_COLLAPSE) */
+ prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "percent");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 1, 4);
+ RNA_def_property_ui_text(prop, "Ratio", "Ratio of triangles to reduce to (collapse only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* (mode == MOD_DECIM_MODE_UNSUBDIV) */
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Iterations", "Number of times reduce the geometry (unsubdivide only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* (mode == MOD_DECIM_MODE_DISSOLVE) */
+ prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_range(prop, 0, DEG2RAD(180));
+ RNA_def_property_ui_range(prop, 0, DEG2RAD(180), 10, 2);
+ RNA_def_property_ui_text(prop, "Angle Limit", "Only dissolve angles below this (planar only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* (mode == MOD_DECIM_MODE_COLLAPSE) */
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name (collapse only)");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DecimateModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence (collapse only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_collapse_triangulate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_TRIANGULATE);
+ RNA_def_property_ui_text(
+ prop, "Triangulate", "Keep triangulated faces resulting from decimation (collapse only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_symmetry", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_SYMMETRY);
+ RNA_def_property_ui_text(prop, "Symmetry", "Maintain symmetry on an axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "symmetry_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "symmetry_axis");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Axis of symmetry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "defgrp_factor");
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_range(prop, 0, 10, 1, 4);
+ RNA_def_property_ui_text(prop, "Factor", "Vertex group strength");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ /* end collapse-only option */
+
+ /* (mode == MOD_DECIM_MODE_DISSOLVE) */
+ prop = RNA_def_property(srna, "use_dissolve_boundaries", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_DECIM_FLAG_ALL_BOUNDARY_VERTS);
+ RNA_def_property_ui_text(
+ prop, "All Boundaries", "Dissolve all vertices inbetween face boundaries (planar only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "delimit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
+ RNA_def_property_enum_items(prop, rna_enum_mesh_delimit_mode_items);
+ RNA_def_property_ui_text(prop, "Delimit", "Limit merging geometry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* end dissolve-only option */
+
+ /* all modes use this */
+ prop = RNA_def_property(srna, "face_count", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Face Count", "The current number of faces in the decimated mesh");
}
static void rna_def_modifier_wave(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "WaveModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier");
- RNA_def_struct_sdna(srna, "WaveModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
-
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
- RNA_def_property_ui_text(prop, "X", "X axis motion");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_Y);
- RNA_def_property_ui_text(prop, "Y", "Y axis motion");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_CYCL);
- RNA_def_property_ui_text(prop, "Cyclic", "Cyclic wave effect");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM);
- RNA_def_property_ui_text(prop, "Normals", "Displace along normals");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_X);
- RNA_def_property_ui_text(prop, "X Normal", "Enable displacement along the X normal");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Y);
- RNA_def_property_ui_text(prop, "Y Normal", "Enable displacement along the Y normal");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Z);
- RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "timeoffs");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Time Offset",
- "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "lifetime");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Lifetime", "Lifetime of the wave in frames, zero means infinite");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "damp");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Damping Time", "Number of frames in which the wave damps out after it dies");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "falloff");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 100, 2);
- RNA_def_property_ui_text(prop, "Falloff Radius", "Distance after which it fades out");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "startx");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100, 100, 100, 2);
- RNA_def_property_ui_text(prop, "Start Position X", "X coordinate of the start position");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "starty");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100, 100, 100, 2);
- RNA_def_property_ui_text(prop, "Start Position Y", "Y coordinate of the start position");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "objectcenter");
- RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the wave");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1, 1, 10, 2);
- RNA_def_property_ui_text(prop, "Speed", "Speed of the wave, towards the starting point when negative");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -2, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Height", "Height of the wave");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 5, 10, 2);
- RNA_def_property_ui_text(prop, "Width", "Distance between the waves");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "narrow");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 10, 10, 2);
- RNA_def_property_ui_text(prop, "Narrowness",
- "Distance between the top and the base of a wave, the higher the value, "
- "the more narrow the wave");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- rna_def_modifier_generic_map_info(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "WaveModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Wave Modifier", "Wave effect modifier");
+ RNA_def_struct_sdna(srna, "WaveModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_WAVE);
+
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_X);
+ RNA_def_property_ui_text(prop, "X", "X axis motion");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_Y);
+ RNA_def_property_ui_text(prop, "Y", "Y axis motion");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_CYCL);
+ RNA_def_property_ui_text(prop, "Cyclic", "Cyclic wave effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM);
+ RNA_def_property_ui_text(prop, "Normals", "Displace along normals");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_X);
+ RNA_def_property_ui_text(prop, "X Normal", "Enable displacement along the X normal");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Y);
+ RNA_def_property_ui_text(prop, "Y Normal", "Enable displacement along the Y normal");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WAVE_NORM_Z);
+ RNA_def_property_ui_text(prop, "Z Normal", "Enable displacement along the Z normal");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "time_offset", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "timeoffs");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_ui_text(
+ prop,
+ "Time Offset",
+ "Either the starting frame (for positive speed) or ending frame (for negative speed.)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "lifetime");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_ui_text(
+ prop, "Lifetime", "Lifetime of the wave in frames, zero means infinite");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "damping_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "damp");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_ui_text(
+ prop, "Damping Time", "Number of frames in which the wave damps out after it dies");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "falloff");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 100, 2);
+ RNA_def_property_ui_text(prop, "Falloff Radius", "Distance after which it fades out");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "start_position_x", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "startx");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100, 100, 100, 2);
+ RNA_def_property_ui_text(prop, "Start Position X", "X coordinate of the start position");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "start_position_y", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "starty");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100, 100, 100, 2);
+ RNA_def_property_ui_text(prop, "Start Position Y", "Y coordinate of the start position");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "start_position_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "objectcenter");
+ RNA_def_property_ui_text(prop, "Start Position Object", "Object which defines the wave center");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modulating the wave");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WaveModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1, 1, 10, 2);
+ RNA_def_property_ui_text(
+ prop, "Speed", "Speed of the wave, towards the starting point when negative");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -2, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Height", "Height of the wave");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 5, 10, 2);
+ RNA_def_property_ui_text(prop, "Width", "Distance between the waves");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "narrowness", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "narrow");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 10, 10, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Narrowness",
+ "Distance between the top and the base of a wave, the higher the value, "
+ "the more narrow the wave");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ rna_def_modifier_generic_map_info(srna);
}
static void rna_def_modifier_armature(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ArmatureModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier");
- RNA_def_struct_sdna(srna, "ArmatureModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
- RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
- RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
- RNA_def_property_ui_text(prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
- RNA_def_property_ui_text(prop, "Multi Modifier",
- "Use same input as previous modifier, and mix results using overall vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ArmatureModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Armature Modifier", "Armature deformation modifier");
+ RNA_def_struct_sdna(srna, "ArmatureModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARMATURE);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Armature object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ArmatureModifier_object_set", NULL, "rna_Armature_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_bone_envelopes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_ENVELOPE);
+ RNA_def_property_ui_text(prop, "Use Bone Envelopes", "Bind Bone envelopes to armature modifier");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_vertex_groups", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_VGROUP);
+ RNA_def_property_ui_text(prop, "Use Vertex Groups", "Bind vertex groups to armature modifier");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_deform_preserve_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_QUATERNION);
+ RNA_def_property_ui_text(
+ prop, "Preserve Volume", "Deform rotation interpolation with quaternions");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_multi_modifier", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "multi", 0);
+ RNA_def_property_ui_text(
+ prop,
+ "Multi Modifier",
+ "Use same input as previous modifier, and mix results using overall vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ArmatureModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deformflag", ARM_DEF_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_hook(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "HookModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Hook Modifier", "Hook modifier to modify the location of vertices");
- RNA_def_struct_sdna(srna, "HookModifierData");
- RNA_def_struct_ui_icon(srna, ICON_HOOK);
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "force");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_warp_falloff_items); /* share the enum */
- RNA_def_property_ui_text(prop, "Falloff Type", "");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "falloff");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 100, 2);
- RNA_def_property_ui_text(prop, "Radius", "If not zero, the distance from the hook where influence ends");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
- RNA_def_property_ui_text(prop, "Falloff Curve", "Custom falloff curve");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cent");
- RNA_def_property_ui_text(prop, "Hook Center", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "parentinv");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Matrix", "Reverse the transformation between this object and its target");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Parent Object for hook, also recalculates and clears offset");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_HookModifier_object_set", NULL, NULL);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "subtarget");
- RNA_def_property_ui_text(prop, "Sub-Target",
- "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_falloff_uniform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_HOOK_UNIFORM_SPACE);
- RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "HookModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "Hook Modifier", "Hook modifier to modify the location of vertices");
+ RNA_def_struct_sdna(srna, "HookModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_HOOK);
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "force");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Strength", "Relative force of the hook");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_warp_falloff_items); /* share the enum */
+ RNA_def_property_ui_text(prop, "Falloff Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "falloff");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 100, 2);
+ RNA_def_property_ui_text(
+ prop, "Radius", "If not zero, the distance from the hook where influence ends");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curfalloff");
+ RNA_def_property_ui_text(prop, "Falloff Curve", "Custom falloff curve");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cent");
+ RNA_def_property_ui_text(prop, "Hook Center", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "matrix_inverse", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "parentinv");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ prop, "Matrix", "Reverse the transformation between this object and its target");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Object", "Parent Object for hook, also recalculates and clears offset");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_HookModifier_object_set", NULL, NULL);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "subtarget", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "subtarget");
+ RNA_def_property_ui_text(
+ prop,
+ "Sub-Target",
+ "Name of Parent Bone for hook (if applicable), also recalculates and clears offset");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_falloff_uniform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_HOOK_UNIFORM_SPACE);
+ RNA_def_property_ui_text(prop, "Uniform Falloff", "Compensate for non-uniform object scale");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_HookModifier_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_softbody(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier");
- RNA_def_struct_sdna(srna, "SoftbodyModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
-
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "SoftBodySettings");
- RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Soft Body Settings", "");
-
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PointCache");
- RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Soft Body Point Cache", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SoftBodyModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Soft Body Modifier", "Soft body simulation modifier");
+ RNA_def_struct_sdna(srna, "SoftbodyModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SOFT);
+
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "SoftBodySettings");
+ RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_settings_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Soft Body Settings", "");
+
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_pointer_funcs(prop, "rna_SoftBodyModifier_point_cache_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Soft Body Point Cache", "");
}
static void rna_def_modifier_boolean(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_operation_items[] = {
- {eBooleanModifierOp_Intersect, "INTERSECT", 0, "Intersect",
- "Keep the part of the mesh that intersects with the other selected object"},
- {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
- {eBooleanModifierOp_Difference, "DIFFERENCE", 0, "Difference", "Combine two meshes in a subtractive way"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier");
- RNA_def_struct_sdna(srna, "BooleanModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_operation_items);
- RNA_def_property_enum_default(prop, eBooleanModifierOp_Difference);
- RNA_def_property_ui_text(prop, "Operation", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "double_threshold");
- RNA_def_property_range(prop, 0, 1.0f);
- RNA_def_property_ui_range(prop, 0, 1, 0.0001, 6);
- RNA_def_property_ui_text(prop, "Overlap Threshold", "Threshold for checking overlapping geometry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* BMesh debugging options, only used when G_DEBUG is set */
-
- /* BMesh intersection options */
- static const EnumPropertyItem debug_items[] = {
- {eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""},
- {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "No Dissolve", ""},
- {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions, "NO_CONNECT_REGIONS", 0, "No Connect Regions", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "debug_options", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, debug_items);
- RNA_def_property_enum_sdna(prop, NULL, "bm_flag");
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Debug", "Debugging options, only when started with '-d'");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_operation_items[] = {
+ {eBooleanModifierOp_Intersect,
+ "INTERSECT",
+ 0,
+ "Intersect",
+ "Keep the part of the mesh that intersects with the other selected object"},
+ {eBooleanModifierOp_Union, "UNION", 0, "Union", "Combine two meshes in an additive way"},
+ {eBooleanModifierOp_Difference,
+ "DIFFERENCE",
+ 0,
+ "Difference",
+ "Combine two meshes in a subtractive way"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "BooleanModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Boolean Modifier", "Boolean operations modifier");
+ RNA_def_struct_sdna(srna, "BooleanModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BOOLEAN);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Mesh object to use for Boolean operation");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_BooleanModifier_object_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_operation_items);
+ RNA_def_property_enum_default(prop, eBooleanModifierOp_Difference);
+ RNA_def_property_ui_text(prop, "Operation", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "double_threshold");
+ RNA_def_property_range(prop, 0, 1.0f);
+ RNA_def_property_ui_range(prop, 0, 1, 0.0001, 6);
+ RNA_def_property_ui_text(
+ prop, "Overlap Threshold", "Threshold for checking overlapping geometry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* BMesh debugging options, only used when G_DEBUG is set */
+
+ /* BMesh intersection options */
+ static const EnumPropertyItem debug_items[] = {
+ {eBooleanModifierBMeshFlag_BMesh_Separate, "SEPARATE", 0, "Separate", ""},
+ {eBooleanModifierBMeshFlag_BMesh_NoDissolve, "NO_DISSOLVE", 0, "No Dissolve", ""},
+ {eBooleanModifierBMeshFlag_BMesh_NoConnectRegions,
+ "NO_CONNECT_REGIONS",
+ 0,
+ "No Connect Regions",
+ ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "debug_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, debug_items);
+ RNA_def_property_enum_sdna(prop, NULL, "bm_flag");
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Debug", "Debugging options, only when started with '-d'");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_array(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_fit_type_items[] = {
- {MOD_ARR_FIXEDCOUNT, "FIXED_COUNT", 0, "Fixed Count", "Duplicate the object a certain number of times"},
- {MOD_ARR_FITLENGTH, "FIT_LENGTH", 0, "Fit Length",
- "Duplicate the object as many times as fits in a certain length"},
- {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier");
- RNA_def_struct_sdna(srna, "ArrayModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
-
- /* Length parameters */
- prop = RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_fit_type_items);
- RNA_def_property_ui_text(prop, "Fit Type", "Array length calculation method");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
- RNA_def_property_ui_text(prop, "Count", "Number of duplicates to make");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "length");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
- RNA_def_property_ui_text(prop, "Length", "Length to fit array within");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_ob");
- RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_curve_ob_set", NULL, "rna_Curve_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_ArrayModifier_dependency_update");
-
- /* Offset parameters */
- prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
- RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Constant Offset Displacement", "Value for the distance between arrayed items");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
- RNA_def_property_ui_text(prop, "Relative Offset", "Add an offset relative to the object's bounding box");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* PROP_TRANSLATION causes units to be used which we don't want */
- prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_ui_text(prop, "Relative Offset Displacement",
- "The size of the geometry will determine the distance between arrayed items");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Vertex merging parameters */
- prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGE);
- RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in adjacent duplicates");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
- RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "merge_dist");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 1, 4);
- RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Offset object */
- prop = RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_OBJ);
- RNA_def_property_ui_text(prop, "Object Offset", "Add another object's transformation to the total offset");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
- RNA_def_property_ui_text(prop, "Object Offset",
- "Use the location and rotation of another object to determine the distance and "
- "rotational change between arrayed items");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- /* Caps */
- prop = RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ArrayModifier_end_cap_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "offset_u", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_offset[0]");
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_range(prop, -1, 1, 2, 4);
- RNA_def_property_ui_text(prop, "U Offset", "Amount to offset array UVs on the U axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset_v", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "uv_offset[1]");
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_range(prop, -1, 1, 2, 4);
- RNA_def_property_ui_text(prop, "V Offset", "Amount to offset array UVs on the V axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_fit_type_items[] = {
+ {MOD_ARR_FIXEDCOUNT,
+ "FIXED_COUNT",
+ 0,
+ "Fixed Count",
+ "Duplicate the object a certain number of times"},
+ {MOD_ARR_FITLENGTH,
+ "FIT_LENGTH",
+ 0,
+ "Fit Length",
+ "Duplicate the object as many times as fits in a certain length"},
+ {MOD_ARR_FITCURVE, "FIT_CURVE", 0, "Fit Curve", "Fit the duplicated objects to a curve"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ArrayModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Array Modifier", "Array duplication modifier");
+ RNA_def_struct_sdna(srna, "ArrayModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_ARRAY);
+
+ /* Length parameters */
+ prop = RNA_def_property(srna, "fit_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_fit_type_items);
+ RNA_def_property_ui_text(prop, "Fit Type", "Array length calculation method");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_range(prop, 1, 1000, 1, -1);
+ RNA_def_property_ui_text(prop, "Count", "Number of duplicates to make");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "fit_length", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "length");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
+ RNA_def_property_ui_text(prop, "Length", "Length to fit array within");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_ob");
+ RNA_def_property_ui_text(prop, "Curve", "Curve object to fit array length to");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ArrayModifier_curve_ob_set", NULL, "rna_Curve_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_ArrayModifier_dependency_update");
+
+ /* Offset parameters */
+ prop = RNA_def_property(srna, "use_constant_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_CONST);
+ RNA_def_property_ui_text(prop, "Constant Offset", "Add a constant offset");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "constant_offset_displace", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(
+ prop, "Constant Offset Displacement", "Value for the distance between arrayed items");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_RELATIVE);
+ RNA_def_property_ui_text(
+ prop, "Relative Offset", "Add an offset relative to the object's bounding box");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* PROP_TRANSLATION causes units to be used which we don't want */
+ prop = RNA_def_property(srna, "relative_offset_displace", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_ui_text(
+ prop,
+ "Relative Offset Displacement",
+ "The size of the geometry will determine the distance between arrayed items");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Vertex merging parameters */
+ prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGE);
+ RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in adjacent duplicates");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_merge_vertices_cap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_ARR_MERGEFINAL);
+ RNA_def_property_ui_text(prop, "Merge Vertices", "Merge vertices in first and last duplicates");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "merge_dist");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 1, 4);
+ RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Offset object */
+ prop = RNA_def_property(srna, "use_object_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "offset_type", MOD_ARR_OFF_OBJ);
+ RNA_def_property_ui_text(
+ prop, "Object Offset", "Add another object's transformation to the total offset");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "offset_ob");
+ RNA_def_property_ui_text(
+ prop,
+ "Object Offset",
+ "Use the location and rotation of another object to determine the distance and "
+ "rotational change between arrayed items");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ /* Caps */
+ prop = RNA_def_property(srna, "start_cap", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Start Cap", "Mesh object to use as a start cap");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ArrayModifier_start_cap_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "end_cap", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "End Cap", "Mesh object to use as an end cap");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ArrayModifier_end_cap_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "offset_u", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_offset[0]");
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_range(prop, -1, 1, 2, 4);
+ RNA_def_property_ui_text(prop, "U Offset", "Amount to offset array UVs on the U axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset_v", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "uv_offset[1]");
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_range(prop, -1, 1, 2, 4);
+ RNA_def_property_ui_text(prop, "V Offset", "Amount to offset array UVs on the V axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_edgesplit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges");
- RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
-
- prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
- RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMANGLE);
- RNA_def_property_ui_text(prop, "Use Edge Angle", "Split edges with high angle between faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
- RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are marked as sharp");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "EdgeSplitModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "EdgeSplit Modifier", "Edge splitting modifier to create sharp edges");
+ RNA_def_struct_sdna(srna, "EdgeSplitModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_EDGESPLIT);
+
+ prop = RNA_def_property(srna, "split_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
+ RNA_def_property_ui_text(prop, "Split Angle", "Angle above which to split edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_edge_angle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMANGLE);
+ RNA_def_property_ui_text(prop, "Use Edge Angle", "Split edges with high angle between faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_edge_sharp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_EDGESPLIT_FROMFLAG);
+ RNA_def_property_ui_text(prop, "Use Sharp Edges", "Split edges that are marked as sharp");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_displace(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_direction_items[] = {
- {MOD_DISP_DIR_X, "X", 0, "X", "Use the texture's intensity value to displace in the X direction"},
- {MOD_DISP_DIR_Y, "Y", 0, "Y", "Use the texture's intensity value to displace in the Y direction"},
- {MOD_DISP_DIR_Z, "Z", 0, "Z", "Use the texture's intensity value to displace in the Z direction"},
- {MOD_DISP_DIR_NOR, "NORMAL", 0, "Normal",
- "Use the texture's intensity value to displace along the vertex normal"},
- {MOD_DISP_DIR_CLNOR, "CUSTOM_NORMAL", 0, "Custom Normal",
- "Use the texture's intensity value to displace along the (averaged) custom normal (falls back to vertex)"},
- {MOD_DISP_DIR_RGB_XYZ, "RGB_TO_XYZ", 0, "RGB to XYZ",
- "Use the texture's RGB values to displace the mesh in the XYZ direction"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_space_items[] = {
- {MOD_DISP_SPACE_LOCAL, "LOCAL", 0, "Local", "Direction is defined in local coordinates"},
- {MOD_DISP_SPACE_GLOBAL, "GLOBAL", 0, "Global", "Direction is defined in global coordinates"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier");
- RNA_def_struct_sdna(srna, "DisplaceModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "midlevel");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100, 100, 10, 3);
- RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_direction_items);
- RNA_def_property_ui_text(prop, "Direction", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_space_items);
- RNA_def_property_ui_text(prop, "Space", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- rna_def_modifier_generic_map_info(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_direction_items[] = {
+ {MOD_DISP_DIR_X,
+ "X",
+ 0,
+ "X",
+ "Use the texture's intensity value to displace in the X direction"},
+ {MOD_DISP_DIR_Y,
+ "Y",
+ 0,
+ "Y",
+ "Use the texture's intensity value to displace in the Y direction"},
+ {MOD_DISP_DIR_Z,
+ "Z",
+ 0,
+ "Z",
+ "Use the texture's intensity value to displace in the Z direction"},
+ {MOD_DISP_DIR_NOR,
+ "NORMAL",
+ 0,
+ "Normal",
+ "Use the texture's intensity value to displace along the vertex normal"},
+ {MOD_DISP_DIR_CLNOR,
+ "CUSTOM_NORMAL",
+ 0,
+ "Custom Normal",
+ "Use the texture's intensity value to displace along the (averaged) custom normal (falls "
+ "back to vertex)"},
+ {MOD_DISP_DIR_RGB_XYZ,
+ "RGB_TO_XYZ",
+ 0,
+ "RGB to XYZ",
+ "Use the texture's RGB values to displace the mesh in the XYZ direction"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_space_items[] = {
+ {MOD_DISP_SPACE_LOCAL, "LOCAL", 0, "Local", "Direction is defined in local coordinates"},
+ {MOD_DISP_SPACE_GLOBAL, "GLOBAL", 0, "Global", "Direction is defined in global coordinates"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "DisplaceModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Displace Modifier", "Displacement modifier");
+ RNA_def_struct_sdna(srna, "DisplaceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DISPLACE);
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DisplaceModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mid_level", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "midlevel");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Midlevel", "Material value that gives no displacement");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100, 100, 10, 3);
+ RNA_def_property_ui_text(prop, "Strength", "Amount to displace geometry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_direction_items);
+ RNA_def_property_ui_text(prop, "Direction", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_space_items);
+ RNA_def_property_ui_text(prop, "Space", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ rna_def_modifier_generic_map_info(srna);
}
static void rna_def_modifier_uvproject(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "UVProjectModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
- RNA_def_struct_sdna(srna, "UVProjectModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
- RNA_def_property_ui_text(prop, "UV Map", "UV map name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "num_projectors");
- RNA_def_property_ui_text(prop, "Number of Projectors", "Number of projectors to use");
- RNA_def_property_int_funcs(prop, NULL, "rna_UVProjectModifier_num_projectors_set", NULL);
- RNA_def_property_range(prop, 1, MOD_UVPROJECT_MAXPROJECTORS);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "UVProjector");
- RNA_def_property_collection_funcs(prop, "rna_UVProject_projectors_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Projectors", "");
-
- prop = RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "aspectx");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 1, FLT_MAX);
- RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
- RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "aspecty");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 1, FLT_MAX);
- RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
- RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scalex");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
- RNA_def_property_ui_text(prop, "Horizontal Scale", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scaley");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
- RNA_def_property_ui_text(prop, "Vertical Scale", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- srna = RNA_def_struct(brna, "UVProjector", NULL);
- RNA_def_struct_ui_text(srna, "UVProjector", "UV projector used by the UV project modifier");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_pointer_funcs(prop, "rna_UVProjector_object_get", "rna_UVProjector_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Object", "Object to use as projector transform");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "UVProjectModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "UV Project Modifier", "UV projection modifier to set UVs from a projector");
+ RNA_def_struct_sdna(srna, "UVProjectModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
+ RNA_def_property_ui_text(prop, "UV Map", "UV map name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVProjectModifier_uvlayer_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "projector_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "num_projectors");
+ RNA_def_property_ui_text(prop, "Number of Projectors", "Number of projectors to use");
+ RNA_def_property_int_funcs(prop, NULL, "rna_UVProjectModifier_num_projectors_set", NULL);
+ RNA_def_property_range(prop, 1, MOD_UVPROJECT_MAXPROJECTORS);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "projectors", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "UVProjector");
+ RNA_def_property_collection_funcs(prop,
+ "rna_UVProject_projectors_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Projectors", "");
+
+ prop = RNA_def_property(srna, "aspect_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "aspectx");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 1, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
+ RNA_def_property_ui_text(prop, "Horizontal Aspect Ratio", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "aspect_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "aspecty");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 1, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1, 1000, 1, 3);
+ RNA_def_property_ui_text(prop, "Vertical Aspect Ratio", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scalex");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
+ RNA_def_property_ui_text(prop, "Horizontal Scale", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scaley");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1000, 1, 3);
+ RNA_def_property_ui_text(prop, "Vertical Scale", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ srna = RNA_def_struct(brna, "UVProjector", NULL);
+ RNA_def_struct_ui_text(srna, "UVProjector", "UV projector used by the UV project modifier");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_UVProjector_object_get", "rna_UVProjector_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(prop, "Object", "Object to use as projector transform");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
}
static void rna_def_modifier_smooth(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SmoothModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier");
- RNA_def_struct_sdna(srna, "SmoothModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
-
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X);
- RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Y);
- RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Z);
- RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "fac");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -10, 10, 1, 3);
- RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "repeat");
- RNA_def_property_ui_range(prop, 0, 30, 1, -1);
- RNA_def_property_ui_text(prop, "Repeat", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SmoothModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Smooth Modifier", "Smoothing effect modifier");
+ RNA_def_struct_sdna(srna, "SmoothModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
+
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_X);
+ RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Y);
+ RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SMOOTH_Z);
+ RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fac");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -10, 10, 1, 3);
+ RNA_def_property_ui_text(prop, "Factor", "Strength of modifier effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "repeat");
+ RNA_def_property_ui_range(prop, 0, 30, 1, -1);
+ RNA_def_property_ui_text(prop, "Repeat", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmoothModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
-
static void rna_def_modifier_correctivesmooth(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem modifier_smooth_type_items[] = {
- {MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE, "SIMPLE", 0, "Simple",
- "Use the average of adjacent edge-vertices"},
- {MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT, "LENGTH_WEIGHTED", 0, "Length Weight",
- "Use the average of adjacent edge-vertices weighted by their length"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem modifier_rest_source_items[] = {
- {MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO, "ORCO", 0, "Original Coords",
- "Use base mesh vert coords as the rest position"},
- {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND, "BIND", 0, "Bind Coords",
- "Use bind vert coords for rest position"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CorrectiveSmoothModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Corrective Smooth Modifier", "Correct distortion caused by deformation");
- RNA_def_struct_sdna(srna, "CorrectiveSmoothModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "lambda");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3);
- RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "repeat");
- RNA_def_property_ui_range(prop, 0, 200, 1, -1);
- RNA_def_property_ui_text(prop, "Repeat", "");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
-
- prop = RNA_def_property(srna, "rest_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "rest_source");
- RNA_def_property_enum_items(prop, modifier_rest_source_items);
- RNA_def_property_ui_text(prop, "Rest Source", "Select the source of rest positions");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_rest_source_update");
-
- prop = RNA_def_property(srna, "smooth_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "smooth_type");
- RNA_def_property_enum_items(prop, modifier_smooth_type_items);
- RNA_def_property_ui_text(prop, "Smooth Type", "Method used for smoothing");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CorrectiveSmoothModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
-
- prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Bind current shape", "");
- RNA_def_property_boolean_funcs(prop, "rna_CorrectiveSmoothModifier_is_bind_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_only_smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_ONLY_SMOOTH);
- RNA_def_property_ui_text(prop, "Only Smooth",
- "Apply smoothing without reconstructing the surface");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_pin_boundary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_PIN_BOUNDARY);
- RNA_def_property_ui_text(prop, "Pin Boundaries",
- "Excludes boundary vertices from being smoothed");
- RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem modifier_smooth_type_items[] = {
+ {MOD_CORRECTIVESMOOTH_SMOOTH_SIMPLE,
+ "SIMPLE",
+ 0,
+ "Simple",
+ "Use the average of adjacent edge-vertices"},
+ {MOD_CORRECTIVESMOOTH_SMOOTH_LENGTH_WEIGHT,
+ "LENGTH_WEIGHTED",
+ 0,
+ "Length Weight",
+ "Use the average of adjacent edge-vertices weighted by their length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem modifier_rest_source_items[] = {
+ {MOD_CORRECTIVESMOOTH_RESTSOURCE_ORCO,
+ "ORCO",
+ 0,
+ "Original Coords",
+ "Use base mesh vert coords as the rest position"},
+ {MOD_CORRECTIVESMOOTH_RESTSOURCE_BIND,
+ "BIND",
+ 0,
+ "Bind Coords",
+ "Use bind vert coords for rest position"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CorrectiveSmoothModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "Corrective Smooth Modifier", "Correct distortion caused by deformation");
+ RNA_def_struct_sdna(srna, "CorrectiveSmoothModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "lambda");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 5, 3);
+ RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "repeat");
+ RNA_def_property_ui_range(prop, 0, 200, 1, -1);
+ RNA_def_property_ui_text(prop, "Repeat", "");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
+
+ prop = RNA_def_property(srna, "rest_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rest_source");
+ RNA_def_property_enum_items(prop, modifier_rest_source_items);
+ RNA_def_property_ui_text(prop, "Rest Source", "Select the source of rest positions");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_rest_source_update");
+
+ prop = RNA_def_property(srna, "smooth_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "smooth_type");
+ RNA_def_property_enum_items(prop, modifier_smooth_type_items);
+ RNA_def_property_ui_text(prop, "Smooth Type", "Method used for smoothing");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CorrectiveSmoothModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
+
+ prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Bind current shape", "");
+ RNA_def_property_boolean_funcs(prop, "rna_CorrectiveSmoothModifier_is_bind_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_only_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_ONLY_SMOOTH);
+ RNA_def_property_ui_text(
+ prop, "Only Smooth", "Apply smoothing without reconstructing the surface");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_pin_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CORRECTIVESMOOTH_PIN_BOUNDARY);
+ RNA_def_property_ui_text(
+ prop, "Pin Boundaries", "Excludes boundary vertices from being smoothed");
+ RNA_def_property_update(prop, 0, "rna_CorrectiveSmoothModifier_update");
}
-
static void rna_def_modifier_laplaciansmooth(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LaplacianSmoothModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Laplacian Smooth Modifier", "Smoothing effect modifier");
- RNA_def_struct_sdna(srna, "LaplacianSmoothModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
-
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_X);
- RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Y);
- RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Z);
- RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
- RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normalized", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_NORMALIZED);
- RNA_def_property_ui_text(prop, "Normalized", "Improve and stabilize the enhanced shape");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "lambda");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
- RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "lambda_border");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
- RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "repeat");
- RNA_def_property_ui_range(prop, 0, 200, 1, -1);
- RNA_def_property_ui_text(prop, "Repeat", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of Vertex Group which determines influence of modifier per point");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianSmoothModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LaplacianSmoothModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Laplacian Smooth Modifier", "Smoothing effect modifier");
+ RNA_def_struct_sdna(srna, "LaplacianSmoothModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SMOOTH);
+
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_X);
+ RNA_def_property_ui_text(prop, "X", "Smooth object along X axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Y);
+ RNA_def_property_ui_text(prop, "Y", "Smooth object along Y axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_Z);
+ RNA_def_property_ui_text(prop, "Z", "Smooth object along Z axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_volume_preserve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_PRESERVE_VOLUME);
+ RNA_def_property_ui_text(prop, "Preserve Volume", "Apply volume preservation after smooth");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normalized", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_LAPLACIANSMOOTH_NORMALIZED);
+ RNA_def_property_ui_text(prop, "Normalized", "Improve and stabilize the enhanced shape");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "lambda_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lambda");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
+ RNA_def_property_ui_text(prop, "Lambda Factor", "Smooth factor effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "lambda_border", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lambda_border");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1000.0, 1000.0, 5, 3);
+ RNA_def_property_ui_text(prop, "Lambda Border", "Lambda factor in border");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "repeat");
+ RNA_def_property_ui_range(prop, 0, 200, 1, -1);
+ RNA_def_property_ui_text(prop, "Repeat", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop,
+ "Vertex Group",
+ "Name of Vertex Group which determines influence of modifier per point");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianSmoothModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_cast(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_cast_type_items[] = {
- {MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""},
- {MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
- {MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CastModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
- RNA_def_struct_sdna(srna, "CastModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
-
- prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_cast_type_items);
- RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object",
- "Control object: if available, its location determines the center of the effect");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
- RNA_def_property_ui_text(prop, "X", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Y);
- RNA_def_property_ui_text(prop, "Y", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Z);
- RNA_def_property_ui_text(prop, "Z", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
- RNA_def_property_ui_text(prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
- RNA_def_property_ui_text(prop, "Use transform", "Use object transform to control projection shape");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "fac");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -10, 10, 5, 2);
- RNA_def_property_ui_text(prop, "Factor", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 5, 2);
- RNA_def_property_ui_text(prop, "Radius",
- "Only deform vertices within this distance from the center of the effect "
- "(leave as 0 for infinite.)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 5, 2);
- RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_cast_type_items[] = {
+ {MOD_CAST_TYPE_SPHERE, "SPHERE", 0, "Sphere", ""},
+ {MOD_CAST_TYPE_CYLINDER, "CYLINDER", 0, "Cylinder", ""},
+ {MOD_CAST_TYPE_CUBOID, "CUBOID", 0, "Cuboid", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CastModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Cast Modifier", "Modifier to cast to other shapes");
+ RNA_def_struct_sdna(srna, "CastModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_CAST);
+
+ prop = RNA_def_property(srna, "cast_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_cast_type_items);
+ RNA_def_property_ui_text(prop, "Cast Type", "Target object shape");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Object",
+ "Control object: if available, its location determines the center of the effect");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_CastModifier_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_X);
+ RNA_def_property_ui_text(prop, "X", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Y);
+ RNA_def_property_ui_text(prop, "Y", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_Z);
+ RNA_def_property_ui_text(prop, "Z", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_radius_as_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_SIZE_FROM_RADIUS);
+ RNA_def_property_ui_text(
+ prop, "From Radius", "Use radius as size of projection shape (0 = auto)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_transform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_CAST_USE_OB_TRANSFORM);
+ RNA_def_property_ui_text(
+ prop, "Use transform", "Use object transform to control projection shape");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fac");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -10, 10, 5, 2);
+ RNA_def_property_ui_text(prop, "Factor", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 5, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Radius",
+ "Only deform vertices within this distance from the center of the effect "
+ "(leave as 0 for infinite.)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 5, 2);
+ RNA_def_property_ui_text(prop, "Size", "Size of projection shape (leave as 0 for auto)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_CastModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_meshdeform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-#if 0
- static const EnumPropertyItem prop_mode_items[] = {
- {0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"},
- {1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"},
- {0, NULL, 0, NULL, NULL},
- };
-#endif
-
- srna = RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes");
- RNA_def_struct_sdna(srna, "MeshDeformModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_MeshDeformModifier_object_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_MeshDeformModifier_is_bound_get", NULL);
- RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to control cage");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gridsize");
- RNA_def_property_range(prop, 2, 10);
- RNA_def_property_ui_text(prop, "Precision", "The grid size for binding");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
- RNA_def_property_ui_text(prop, "Dynamic",
- "Recompute binding dynamically on top of other deformers "
- "(slower and more memory consuming)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-#if 0
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Method of binding vertices are bound to cage mesh");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-#endif
+ StructRNA *srna;
+ PropertyRNA *prop;
+# if 0
+ static const EnumPropertyItem prop_mode_items[] = {
+ {0, "VOLUME", 0, "Volume", "Bind to volume inside cage mesh"},
+ {1, "SURFACE", 0, "Surface", "Bind to surface of cage mesh"},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif
+
+ srna = RNA_def_struct(brna, "MeshDeformModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "MeshDeform Modifier", "Mesh deformation modifier to deform with other meshes");
+ RNA_def_struct_sdna(srna, "MeshDeformModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Mesh object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_MeshDeformModifier_object_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_MeshDeformModifier_is_bound_get", NULL);
+ RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to control cage");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MeshDeformModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "precision", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gridsize");
+ RNA_def_property_range(prop, 2, 10);
+ RNA_def_property_ui_text(prop, "Precision", "The grid size for binding");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_dynamic_bind", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MDEF_DYNAMIC_BIND);
+ RNA_def_property_ui_text(prop,
+ "Dynamic",
+ "Recompute binding dynamically on top of other deformers "
+ "(slower and more memory consuming)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+# if 0
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Method of binding vertices are bound to cage mesh");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+# endif
}
static void rna_def_modifier_particlesystem(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "ParticleSystem Modifier", "Particle system simulation modifier");
- RNA_def_struct_sdna(srna, "ParticleSystemModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
-
- prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "psys");
- RNA_def_property_ui_text(prop, "Particle System", "Particle System that this modifier controls");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ParticleSystemModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "ParticleSystem Modifier", "Particle system simulation modifier");
+ RNA_def_struct_sdna(srna, "ParticleSystemModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
+
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "psys");
+ RNA_def_property_ui_text(prop, "Particle System", "Particle System that this modifier controls");
}
static void rna_def_modifier_particleinstance(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem particleinstance_space[] = {
- {eParticleInstanceSpace_Local, "LOCAL", 0, "Local", "Use offset from the particle object in the instance object"},
- {eParticleInstanceSpace_World, "WORLD", 0, "World", "Use world space offset in the instance object"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier");
- RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
- RNA_def_property_ui_text(prop, "Object", "Object that has the particle system");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "particle_system_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "psys");
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Particle System Number", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_pointer_funcs(prop, "rna_ParticleInstanceModifier_particle_system_get", "rna_ParticleInstanceModifier_particle_system_set",
- NULL, "rna_ParticleInstanceModifier_particle_system_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Particle System", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "axis");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "space");
- RNA_def_property_enum_items(prop, particleinstance_space);
- RNA_def_property_ui_text(prop, "Space", "Space to use for copying mesh data");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
- RNA_def_property_ui_text(prop, "Regular", "Create instances from normal particles");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Children);
- RNA_def_property_ui_text(prop, "Children", "Create instances from child particles");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Path);
- RNA_def_property_ui_text(prop, "Path", "Create instances along particle paths");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Unborn);
- RNA_def_property_ui_text(prop, "Unborn", "Show instances when particles are unborn");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Alive);
- RNA_def_property_ui_text(prop, "Alive", "Show instances when particles are alive");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Dead);
- RNA_def_property_ui_text(prop, "Dead", "Show instances when particles are dead");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_preserve_shape", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_KeepShape);
- RNA_def_property_ui_text(prop, "Keep Shape", "Don't stretch the object");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_UseSize);
- RNA_def_property_ui_text(prop, "Size", "Use particle size to scale the instances");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "position");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Position", "Position along path");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "random_position");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Rotation", "Rotation around path");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "random_rotation");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation around path");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "particle_amount", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Particle Amount", "Amount of particles to use for instancing");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "particle_offset", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Particle Offset", "Relative offset of particles to use for instancing, to avoid overlap of multiple instances");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "index_layer_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "index_layer_name");
- RNA_def_property_ui_text(prop, "Index Layer Name", "Custom data layer name for the index");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "value_layer_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "value_layer_name");
- RNA_def_property_ui_text(prop, "Value Layer Name", "Custom data layer name for the randomized value");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem particleinstance_space[] = {
+ {eParticleInstanceSpace_Local,
+ "LOCAL",
+ 0,
+ "Local",
+ "Use offset from the particle object in the instance object"},
+ {eParticleInstanceSpace_World,
+ "WORLD",
+ 0,
+ "World",
+ "Use world space offset in the instance object"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ParticleInstanceModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "ParticleInstance Modifier", "Particle system instancing modifier");
+ RNA_def_struct_sdna(srna, "ParticleInstanceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PARTICLES);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
+ RNA_def_property_ui_text(prop, "Object", "Object that has the particle system");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "particle_system_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "psys");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Particle System Number", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_ParticleInstanceModifier_particle_system_get",
+ "rna_ParticleInstanceModifier_particle_system_set",
+ NULL,
+ "rna_ParticleInstanceModifier_particle_system_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Particle System", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "axis");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Pole axis for rotation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "space");
+ RNA_def_property_enum_items(prop, particleinstance_space);
+ RNA_def_property_ui_text(prop, "Space", "Space to use for copying mesh data");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Parents);
+ RNA_def_property_ui_text(prop, "Regular", "Create instances from normal particles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Children);
+ RNA_def_property_ui_text(prop, "Children", "Create instances from child particles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Path);
+ RNA_def_property_ui_text(prop, "Path", "Create instances along particle paths");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Unborn);
+ RNA_def_property_ui_text(prop, "Unborn", "Show instances when particles are unborn");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Alive);
+ RNA_def_property_ui_text(prop, "Alive", "Show instances when particles are alive");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_Dead);
+ RNA_def_property_ui_text(prop, "Dead", "Show instances when particles are dead");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_preserve_shape", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_KeepShape);
+ RNA_def_property_ui_text(prop, "Keep Shape", "Don't stretch the object");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eParticleInstanceFlag_UseSize);
+ RNA_def_property_ui_text(prop, "Size", "Use particle size to scale the instances");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "position");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Position", "Position along path");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "random_position", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "random_position");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Random Position", "Randomize position along path");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Rotation", "Rotation around path");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "random_rotation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "random_rotation");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Random Rotation", "Randomize rotation around path");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "particle_amount", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Particle Amount", "Amount of particles to use for instancing");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "particle_offset", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop,
+ "Particle Offset",
+ "Relative offset of particles to use for instancing, to avoid overlap "
+ "of multiple instances");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "index_layer_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "index_layer_name");
+ RNA_def_property_ui_text(prop, "Index Layer Name", "Custom data layer name for the index");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "value_layer_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "value_layer_name");
+ RNA_def_property_ui_text(
+ prop, "Value Layer Name", "Custom data layer name for the randomized value");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_explode(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ExplodeModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Explode Modifier", "Explosion effect modifier based on a particle system");
- RNA_def_struct_sdna(srna, "ExplodeModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ExplodeModifier_vgroup_get", "rna_ExplodeModifier_vgroup_length",
- "rna_ExplodeModifier_vgroup_set");
- RNA_def_property_ui_text(prop, "Vertex Group", "");
-
- prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Protect", "Clean vertex group edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_EdgeCut);
- RNA_def_property_ui_text(prop, "Cut Edges", "Cut face edges for nicer shrapnel");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Unborn);
- RNA_def_property_ui_text(prop, "Unborn", "Show mesh when particles are unborn");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Alive);
- RNA_def_property_ui_text(prop, "Alive", "Show mesh when particles are alive");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Dead);
- RNA_def_property_ui_text(prop, "Dead", "Show mesh when particles are dead");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_PaSize);
- RNA_def_property_ui_text(prop, "Size", "Use particle size for the shrapnel");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvname");
- RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
- RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ExplodeModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "Explode Modifier", "Explosion effect modifier based on a particle system");
+ RNA_def_struct_sdna(srna, "ExplodeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_EXPLODE);
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ExplodeModifier_vgroup_get",
+ "rna_ExplodeModifier_vgroup_length",
+ "rna_ExplodeModifier_vgroup_set");
+ RNA_def_property_ui_text(prop, "Vertex Group", "");
+
+ prop = RNA_def_property(srna, "protect", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Protect", "Clean vertex group edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_edge_cut", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_EdgeCut);
+ RNA_def_property_ui_text(prop, "Cut Edges", "Cut face edges for nicer shrapnel");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Unborn);
+ RNA_def_property_ui_text(prop, "Unborn", "Show mesh when particles are unborn");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_alive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Alive);
+ RNA_def_property_ui_text(prop, "Alive", "Show mesh when particles are alive");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_dead", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_Dead);
+ RNA_def_property_ui_text(prop, "Dead", "Show mesh when particles are dead");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", eExplodeFlag_PaSize);
+ RNA_def_property_ui_text(prop, "Size", "Use particle size for the shrapnel");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "particle_uv", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvname");
+ RNA_def_property_string_maxlength(prop, MAX_CUSTOMDATA_LAYER_NAME);
+ RNA_def_property_ui_text(prop, "Particle UV", "UV map to change with particle age");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_cloth(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ClothModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier");
- RNA_def_struct_sdna(srna, "ClothModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
-
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
- RNA_def_property_ui_text(prop, "Cloth Settings", "");
-
- prop = RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
- RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
-
- prop = RNA_def_property(srna, "solver_result", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ClothSolverResult");
- RNA_def_property_pointer_sdna(prop, NULL, "solver_result");
- RNA_def_property_ui_text(prop, "Solver Result", "");
-
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Point Cache", "");
-
- prop = RNA_def_property(srna, "hair_grid_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "hair_grid_min");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Hair Grid Minimum", "");
-
- prop = RNA_def_property(srna, "hair_grid_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "hair_grid_max");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Hair Grid Maximum", "");
-
- prop = RNA_def_property(srna, "hair_grid_resolution", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "hair_grid_res");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Hair Grid Resolution", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ClothModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Cloth Modifier", "Cloth simulation modifier");
+ RNA_def_struct_sdna(srna, "ClothModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_CLOTH);
+
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "sim_parms");
+ RNA_def_property_ui_text(prop, "Cloth Settings", "");
+
+ prop = RNA_def_property(srna, "collision_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "coll_parms");
+ RNA_def_property_ui_text(prop, "Cloth Collision Settings", "");
+
+ prop = RNA_def_property(srna, "solver_result", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ClothSolverResult");
+ RNA_def_property_pointer_sdna(prop, NULL, "solver_result");
+ RNA_def_property_ui_text(prop, "Solver Result", "");
+
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ prop = RNA_def_property(srna, "hair_grid_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "hair_grid_min");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Hair Grid Minimum", "");
+
+ prop = RNA_def_property(srna, "hair_grid_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "hair_grid_max");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Hair Grid Maximum", "");
+
+ prop = RNA_def_property(srna, "hair_grid_resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "hair_grid_res");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Hair Grid Resolution", "");
}
static void rna_def_modifier_smoke(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_smoke_type_items[] = {
- {0, "NONE", 0, "None", ""},
- {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""},
- {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"},
- {MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier");
- RNA_def_struct_sdna(srna, "SmokeModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE);
-
- prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "domain");
- RNA_def_property_ui_text(prop, "Domain Settings", "");
-
- prop = RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "flow");
- RNA_def_property_ui_text(prop, "Flow Settings", "");
-
- prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "coll");
- RNA_def_property_ui_text(prop, "Collision Settings", "");
-
- prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_smoke_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Smoke_set_type");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_smoke_type_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {MOD_SMOKE_TYPE_DOMAIN, "DOMAIN", 0, "Domain", ""},
+ {MOD_SMOKE_TYPE_FLOW, "FLOW", 0, "Flow", "Inflow/Outflow"},
+ {MOD_SMOKE_TYPE_COLL, "COLLISION", 0, "Collision", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SmokeModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Smoke Modifier", "Smoke simulation modifier");
+ RNA_def_struct_sdna(srna, "SmokeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SMOKE);
+
+ prop = RNA_def_property(srna, "domain_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "domain");
+ RNA_def_property_ui_text(prop, "Domain Settings", "");
+
+ prop = RNA_def_property(srna, "flow_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "flow");
+ RNA_def_property_ui_text(prop, "Flow Settings", "");
+
+ prop = RNA_def_property(srna, "coll_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "coll");
+ RNA_def_property_ui_text(prop, "Collision Settings", "");
+
+ prop = RNA_def_property(srna, "smoke_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_smoke_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Smoke_set_type");
}
static void rna_def_modifier_dynamic_paint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Dynamic Paint Modifier", "Dynamic Paint modifier");
- RNA_def_struct_sdna(srna, "DynamicPaintModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_DYNAMICPAINT);
-
- prop = RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "canvas");
- RNA_def_property_ui_text(prop, "Canvas Settings", "");
-
- prop = RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "brush");
- RNA_def_property_ui_text(prop, "Brush Settings", "");
-
- prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_prop_dynamicpaint_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "DynamicPaintModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Dynamic Paint Modifier", "Dynamic Paint modifier");
+ RNA_def_struct_sdna(srna, "DynamicPaintModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DYNAMICPAINT);
+
+ prop = RNA_def_property(srna, "canvas_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "canvas");
+ RNA_def_property_ui_text(prop, "Canvas Settings", "");
+
+ prop = RNA_def_property(srna, "brush_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "brush");
+ RNA_def_property_ui_text(prop, "Brush Settings", "");
+
+ prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_prop_dynamicpaint_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
}
static void rna_def_modifier_collision(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Collision Modifier",
- "Collision modifier defining modifier stack position used for collision");
- RNA_def_struct_sdna(srna, "CollisionModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
-
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "CollisionSettings");
- RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Settings", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "CollisionModifier", "Modifier");
+ RNA_def_struct_ui_text(srna,
+ "Collision Modifier",
+ "Collision modifier defining modifier stack position used for collision");
+ RNA_def_struct_sdna(srna, "CollisionModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
+
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "CollisionSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_CollisionModifier_settings_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Settings", "");
}
static void rna_def_modifier_bevel(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_limit_method_items[] = {
- {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
- {MOD_BEVEL_ANGLE, "ANGLE", 0, "Angle", "Only bevel edges with sharp enough angles between faces"},
- {MOD_BEVEL_WEIGHT, "WEIGHT", 0, "Weight",
- "Use bevel weights to determine how much bevel is applied in edge mode"},
- {MOD_BEVEL_VGROUP, "VGROUP", 0, "Vertex Group",
- "Use vertex group weights to select whether vertex or edge is beveled"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_val_type_items[] = {
- {MOD_BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"},
- {MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
- {MOD_BEVEL_AMT_DEPTH, "DEPTH", 0, "Depth", "Amount is perpendicular distance from original edge to bevel face"},
- {MOD_BEVEL_AMT_PERCENT, "PERCENT", 0, "Percent", "Amount is percent of adjacent edge length"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem prop_harden_normals_items[] = {
- { MOD_BEVEL_FACE_STRENGTH_NONE, "FSTR_NONE", 0, "None", "Do not set face strength" },
- { MOD_BEVEL_FACE_STRENGTH_NEW, "FSTR_NEW", 0, "New", "Set face strength on new faces only" },
- { MOD_BEVEL_FACE_STRENGTH_AFFECTED, "FSTR_AFFECTED", 0, "Affected",
- "Set face strength on new and affected faces only" },
- { MOD_BEVEL_FACE_STRENGTH_ALL, "FSTR_ALL", 0, "All", "Set face strength on all faces" },
- { 0, NULL, 0, NULL, NULL },
- };
-
- static EnumPropertyItem prop_miter_items[] = {
- { MOD_BEVEL_MITER_SHARP, "MITER_SHARP", 0, "Sharp", "Default sharp miter" },
- { MOD_BEVEL_MITER_PATCH, "MITER_PATCH", 0, "Patch", "Miter with extra corner" },
- { MOD_BEVEL_MITER_ARC, "MITER_ARC", 0, "Arc", "Miter with curved arc" },
- { 0, NULL, 0, NULL, NULL },
- };
-
- srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
- RNA_def_struct_sdna(srna, "BevelModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
-
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
- RNA_def_property_ui_text(prop, "Width", "Bevel amount");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "width_pct", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 5.0, 2);
- RNA_def_property_ui_text(prop, "Width Percent", "Bevel amount for percentage method");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "res");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
- RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "lim_flags");
- RNA_def_property_enum_items(prop, prop_limit_method_items);
- RNA_def_property_ui_text(prop, "Limit Method", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
- RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
- RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "val_flags");
- RNA_def_property_enum_items(prop, prop_val_type_items);
- RNA_def_property_ui_text(prop, "Amount Type", "What distance Width measures");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "profile", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 2);
- RNA_def_property_ui_text(prop, "Profile", "The profile shape (0.5 = round)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mat");
- RNA_def_property_range(prop, -1, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Material", "Material index of generated faces, -1 for automatic");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_EVEN_WIDTHS);
- RNA_def_property_ui_text(prop, "Loop Slide", "Prefer sliding along edges to having even widths");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mark_seam", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_flags", MOD_BEVEL_MARK_SEAM);
- RNA_def_property_ui_text(prop, "Mark Seams", "Mark Seams along beveled edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mark_sharp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_flags", MOD_BEVEL_MARK_SHARP);
- RNA_def_property_ui_text(prop, "Mark Sharp", "Mark beveled edges as sharp");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "harden_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_HARDEN_NORMALS);
- RNA_def_property_ui_text(
- prop, "Harden Normals",
- "Match normals of new faces to adjacent faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "face_strength_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "face_str_mode");
- RNA_def_property_enum_items(prop, prop_harden_normals_items);
- RNA_def_property_ui_text(prop, "Set Face Strength", "Whether to set face strength, and which faces to set it on");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "miter_outer", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "miter_outer");
- RNA_def_property_enum_items(prop, prop_miter_items);
- RNA_def_property_ui_text(prop, "Outer Miter", "Pattern to use for outside of miters");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "miter_inner", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "miter_inner");
- RNA_def_property_enum_items(prop, prop_miter_items);
- RNA_def_property_ui_text(prop, "Inner Miter", "Pattern to use for inside of miters");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "spread", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "spread");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
- RNA_def_property_ui_text(prop, "Spread", "Spread distance for inner miter arcs");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_limit_method_items[] = {
+ {0, "NONE", 0, "None", "Bevel the entire mesh by a constant amount"},
+ {MOD_BEVEL_ANGLE,
+ "ANGLE",
+ 0,
+ "Angle",
+ "Only bevel edges with sharp enough angles between faces"},
+ {MOD_BEVEL_WEIGHT,
+ "WEIGHT",
+ 0,
+ "Weight",
+ "Use bevel weights to determine how much bevel is applied in edge mode"},
+ {MOD_BEVEL_VGROUP,
+ "VGROUP",
+ 0,
+ "Vertex Group",
+ "Use vertex group weights to select whether vertex or edge is beveled"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_val_type_items[] = {
+ {MOD_BEVEL_AMT_OFFSET, "OFFSET", 0, "Offset", "Amount is offset of new edges from original"},
+ {MOD_BEVEL_AMT_WIDTH, "WIDTH", 0, "Width", "Amount is width of new face"},
+ {MOD_BEVEL_AMT_DEPTH,
+ "DEPTH",
+ 0,
+ "Depth",
+ "Amount is perpendicular distance from original edge to bevel face"},
+ {MOD_BEVEL_AMT_PERCENT,
+ "PERCENT",
+ 0,
+ "Percent",
+ "Amount is percent of adjacent edge length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_harden_normals_items[] = {
+ {MOD_BEVEL_FACE_STRENGTH_NONE, "FSTR_NONE", 0, "None", "Do not set face strength"},
+ {MOD_BEVEL_FACE_STRENGTH_NEW, "FSTR_NEW", 0, "New", "Set face strength on new faces only"},
+ {MOD_BEVEL_FACE_STRENGTH_AFFECTED,
+ "FSTR_AFFECTED",
+ 0,
+ "Affected",
+ "Set face strength on new and affected faces only"},
+ {MOD_BEVEL_FACE_STRENGTH_ALL, "FSTR_ALL", 0, "All", "Set face strength on all faces"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_miter_items[] = {
+ {MOD_BEVEL_MITER_SHARP, "MITER_SHARP", 0, "Sharp", "Default sharp miter"},
+ {MOD_BEVEL_MITER_PATCH, "MITER_PATCH", 0, "Patch", "Miter with extra corner"},
+ {MOD_BEVEL_MITER_ARC, "MITER_ARC", 0, "Arc", "Miter with curved arc"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "BevelModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "Bevel Modifier", "Bevel modifier to make edges and vertices more rounded");
+ RNA_def_struct_sdna(srna, "BevelModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_BEVEL);
+
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Width", "Bevel amount");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "width_pct", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 5.0, 2);
+ RNA_def_property_ui_text(prop, "Width Percent", "Bevel amount for percentage method");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "segments", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "res");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(prop, "Segments", "Number of segments for round edges/verts");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_only_vertices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_VERT);
+ RNA_def_property_ui_text(prop, "Only Vertices", "Bevel verts/corners, not edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "lim_flags");
+ RNA_def_property_enum_items(prop, prop_limit_method_items);
+ RNA_def_property_ui_text(prop, "Limit Method", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "angle_limit", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "bevel_angle");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 2);
+ RNA_def_property_ui_text(prop, "Angle", "Angle above which to bevel edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BevelModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_clamp_overlap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_OVERLAP_OK);
+ RNA_def_property_ui_text(prop, "Clamp Overlap", "Clamp the width to avoid overlap");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "val_flags");
+ RNA_def_property_enum_items(prop, prop_val_type_items);
+ RNA_def_property_ui_text(prop, "Amount Type", "What distance Width measures");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "profile", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 2);
+ RNA_def_property_ui_text(prop, "Profile", "The profile shape (0.5 = round)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mat");
+ RNA_def_property_range(prop, -1, SHRT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Material", "Material index of generated faces, -1 for automatic");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "loop_slide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", MOD_BEVEL_EVEN_WIDTHS);
+ RNA_def_property_ui_text(prop, "Loop Slide", "Prefer sliding along edges to having even widths");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mark_seam", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_flags", MOD_BEVEL_MARK_SEAM);
+ RNA_def_property_ui_text(prop, "Mark Seams", "Mark Seams along beveled edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mark_sharp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_flags", MOD_BEVEL_MARK_SHARP);
+ RNA_def_property_ui_text(prop, "Mark Sharp", "Mark beveled edges as sharp");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "harden_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_BEVEL_HARDEN_NORMALS);
+ RNA_def_property_ui_text(prop, "Harden Normals", "Match normals of new faces to adjacent faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "face_strength_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "face_str_mode");
+ RNA_def_property_enum_items(prop, prop_harden_normals_items);
+ RNA_def_property_ui_text(
+ prop, "Set Face Strength", "Whether to set face strength, and which faces to set it on");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "miter_outer", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "miter_outer");
+ RNA_def_property_enum_items(prop, prop_miter_items);
+ RNA_def_property_ui_text(prop, "Outer Miter", "Pattern to use for outside of miters");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "miter_inner", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "miter_inner");
+ RNA_def_property_enum_items(prop, prop_miter_items);
+ RNA_def_property_ui_text(prop, "Inner Miter", "Pattern to use for inside of miters");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "spread", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "spread");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Spread", "Spread distance for inner miter arcs");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_shrinkwrap(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem shrink_type_items[] = {
- {MOD_SHRINKWRAP_NEAREST_SURFACE, "NEAREST_SURFACEPOINT", 0, "Nearest Surface Point",
- "Shrink the mesh to the nearest target surface"},
- {MOD_SHRINKWRAP_PROJECT, "PROJECT", 0, "Project",
- "Shrink the mesh to the nearest target surface along a given axis"},
- {MOD_SHRINKWRAP_NEAREST_VERTEX, "NEAREST_VERTEX", 0, "Nearest Vertex",
- "Shrink the mesh to the nearest target vertex"},
- {MOD_SHRINKWRAP_TARGET_PROJECT, "TARGET_PROJECT", 0, "Target Normal Project",
- "Shrink the mesh to the nearest target surface "
- "along the interpolated vertex normals of the target"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem shrink_face_cull_items[] = {
- {0, "OFF", 0, "Off", "No culling"},
- {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE, "FRONT", 0, "Front", "No projection when in front of the face"},
- {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE, "BACK", 0, "Back", "No projection when behind the face"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Shrinkwrap Modifier",
- "Shrink wrapping modifier to shrink wrap and object to a target");
- RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
-
- prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
- RNA_def_property_enum_items(prop, shrink_type_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shrinkMode");
- RNA_def_property_enum_items(prop, rna_enum_modifier_shrinkwrap_mode_items);
- RNA_def_property_ui_text(prop, "Snap Mode", "Select how vertices are constrained to the target surface");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
- RNA_def_property_enum_items(prop, shrink_face_cull_items);
- RNA_def_property_enum_funcs(prop, "rna_ShrinkwrapModifier_face_cull_get",
- "rna_ShrinkwrapModifier_face_cull_set", NULL);
- RNA_def_property_ui_text(prop, "Face Cull",
- "Stop vertices from projecting to a face on the target when facing towards/away");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_target_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
- RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ShrinkwrapModifier_auxTarget_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "keepDist");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100, 100, 1, 2);
- RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "projLimit");
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 100, 1, 2);
- RNA_def_property_ui_text(prop, "Project Limit", "Limit the distance used for projection (zero disables)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_project_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
- RNA_def_property_ui_text(prop, "X", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
- RNA_def_property_ui_text(prop, "Y", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
- RNA_def_property_ui_text(prop, "Z", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
- RNA_def_property_range(prop, 0, 6);
- RNA_def_property_ui_range(prop, 0, 6, 1, -1);
- RNA_def_property_ui_text(prop, "Subsurf Levels",
- "Number of subdivisions that must be performed before extracting vertices' "
- "positions and normals");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR);
- RNA_def_property_ui_text(prop, "Negative", "Allow vertices to move in the negative direction of axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR);
- RNA_def_property_ui_text(prop, "Positive", "Allow vertices to move in the positive direction of axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_INVERT_CULL_TARGET);
- RNA_def_property_ui_text(prop, "Invert Cull", "When projecting in the negative direction invert the face cull mode");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem shrink_type_items[] = {
+ {MOD_SHRINKWRAP_NEAREST_SURFACE,
+ "NEAREST_SURFACEPOINT",
+ 0,
+ "Nearest Surface Point",
+ "Shrink the mesh to the nearest target surface"},
+ {MOD_SHRINKWRAP_PROJECT,
+ "PROJECT",
+ 0,
+ "Project",
+ "Shrink the mesh to the nearest target surface along a given axis"},
+ {MOD_SHRINKWRAP_NEAREST_VERTEX,
+ "NEAREST_VERTEX",
+ 0,
+ "Nearest Vertex",
+ "Shrink the mesh to the nearest target vertex"},
+ {MOD_SHRINKWRAP_TARGET_PROJECT,
+ "TARGET_PROJECT",
+ 0,
+ "Target Normal Project",
+ "Shrink the mesh to the nearest target surface "
+ "along the interpolated vertex normals of the target"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem shrink_face_cull_items[] = {
+ {0, "OFF", 0, "Off", "No culling"},
+ {MOD_SHRINKWRAP_CULL_TARGET_FRONTFACE,
+ "FRONT",
+ 0,
+ "Front",
+ "No projection when in front of the face"},
+ {MOD_SHRINKWRAP_CULL_TARGET_BACKFACE,
+ "BACK",
+ 0,
+ "Back",
+ "No projection when behind the face"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ShrinkwrapModifier", "Modifier");
+ RNA_def_struct_ui_text(srna,
+ "Shrinkwrap Modifier",
+ "Shrink wrapping modifier to shrink wrap and object to a target");
+ RNA_def_struct_sdna(srna, "ShrinkwrapModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SHRINKWRAP);
+
+ prop = RNA_def_property(srna, "wrap_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shrinkType");
+ RNA_def_property_enum_items(prop, shrink_type_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "wrap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shrinkMode");
+ RNA_def_property_enum_items(prop, rna_enum_modifier_shrinkwrap_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Snap Mode", "Select how vertices are constrained to the target surface");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "cull_face", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shrinkOpts");
+ RNA_def_property_enum_items(prop, shrink_face_cull_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_ShrinkwrapModifier_face_cull_get", "rna_ShrinkwrapModifier_face_cull_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Face Cull",
+ "Stop vertices from projecting to a face on the target when facing towards/away");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Target", "Mesh target to shrink to");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ShrinkwrapModifier_target_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "auxiliary_target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "auxTarget");
+ RNA_def_property_ui_text(prop, "Auxiliary Target", "Additional mesh target to shrink to");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_ShrinkwrapModifier_auxTarget_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShrinkwrapModifier_vgroup_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "keepDist");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100, 100, 1, 2);
+ RNA_def_property_ui_text(prop, "Offset", "Distance to keep from the target");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "project_limit", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "projLimit");
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 100, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Project Limit", "Limit the distance used for projection (zero disables)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_project_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_X_AXIS);
+ RNA_def_property_ui_text(prop, "X", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_project_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Y_AXIS);
+ RNA_def_property_ui_text(prop, "Y", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_project_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "projAxis", MOD_SHRINKWRAP_PROJECT_OVER_Z_AXIS);
+ RNA_def_property_ui_text(prop, "Z", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "subsurf_levels", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "subsurfLevels");
+ RNA_def_property_range(prop, 0, 6);
+ RNA_def_property_ui_range(prop, 0, 6, 1, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Subsurf Levels",
+ "Number of subdivisions that must be performed before extracting vertices' "
+ "positions and normals");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_negative_direction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_NEG_DIR);
+ RNA_def_property_ui_text(
+ prop, "Negative", "Allow vertices to move in the negative direction of axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_positive_direction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_PROJECT_ALLOW_POS_DIR);
+ RNA_def_property_ui_text(
+ prop, "Positive", "Allow vertices to move in the positive direction of axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_invert_cull", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_INVERT_CULL_TARGET);
+ RNA_def_property_ui_text(
+ prop, "Invert Cull", "When projecting in the negative direction invert the face cull mode");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shrinkOpts", MOD_SHRINKWRAP_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_fluidsim(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier");
- RNA_def_struct_sdna(srna, "FluidsimModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
-
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "fss");
- RNA_def_property_ui_text(prop, "Settings", "Settings for how this object is used in the fluid simulation");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FluidSimulationModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Fluid Simulation Modifier", "Fluid simulation modifier");
+ RNA_def_struct_sdna(srna, "FluidsimModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_FLUIDSIM);
+
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "fss");
+ RNA_def_property_ui_text(
+ prop, "Settings", "Settings for how this object is used in the fluid simulation");
}
static void rna_def_modifier_mask(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem modifier_mask_mode_items[] = {
- {MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""},
- {MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh");
- RNA_def_struct_sdna(srna, "MaskModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, modifier_mask_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob_arm");
- RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_MaskModifier_ob_arm_set", NULL, "rna_Armature_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgroup");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV);
- RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "threshold");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Threshold", "Weights over this threshold remain");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem modifier_mask_mode_items[] = {
+ {MOD_MASK_MODE_VGROUP, "VERTEX_GROUP", 0, "Vertex Group", ""},
+ {MOD_MASK_MODE_ARM, "ARMATURE", 0, "Armature", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MaskModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Mask Modifier", "Mask modifier to hide parts of the mesh");
+ RNA_def_struct_sdna(srna, "MaskModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MASK);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, modifier_mask_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "armature", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob_arm");
+ RNA_def_property_ui_text(prop, "Armature", "Armature to use as source of bones to mask");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_MaskModifier_ob_arm_set", NULL, "rna_Armature_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgroup");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_MaskModifier_vgroup_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_MASK_INV);
+ RNA_def_property_ui_text(prop, "Invert", "Use vertices that are not part of region defined");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "threshold");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Threshold", "Weights over this threshold remain");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_simpledeform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem simple_deform_mode_items[] = {
- {MOD_SIMPLEDEFORM_MODE_TWIST, "TWIST", 0, "Twist", "Rotate around the Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_BEND, "BEND", 0, "Bend", "Bend the mesh over the Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_TAPER, "TAPER", 0, "Taper", "Linearly scale along Z axis of the modifier space"},
- {MOD_SIMPLEDEFORM_MODE_STRETCH, "STRETCH", 0, "Stretch",
- "Stretch the object along the Z axis of the modifier space"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "SimpleDeform Modifier",
- "Simple deformation modifier to apply effects such as twisting and bending");
- RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
-
- prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, simple_deform_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Axis", "Deform around local axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Origin", "Offset the origin and orientation of the deformation");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -10.0, 10.0, 1.0, 3);
- RNA_def_property_ui_text(prop, "Factor", "Amount to deform object");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_float_default(prop, DEG2RADF(45.0f));
- RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3);
- RNA_def_property_ui_text(prop, "Angle", "Angle of deformation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "limit");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_range(prop, 0, 1, 5, 2);
- RNA_def_property_ui_text(prop, "Limits", "Lower/Upper limits for deform");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X);
- RNA_def_property_ui_text(prop, "X", "Do not allow deformation along the X axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y);
- RNA_def_property_ui_text(prop, "Y", "Do not allow deformation along the Y axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Z);
- RNA_def_property_ui_text(prop, "Z", "Do not allow deformation along the Z axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem simple_deform_mode_items[] = {
+ {MOD_SIMPLEDEFORM_MODE_TWIST,
+ "TWIST",
+ 0,
+ "Twist",
+ "Rotate around the Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_BEND,
+ "BEND",
+ 0,
+ "Bend",
+ "Bend the mesh over the Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_TAPER,
+ "TAPER",
+ 0,
+ "Taper",
+ "Linearly scale along Z axis of the modifier space"},
+ {MOD_SIMPLEDEFORM_MODE_STRETCH,
+ "STRETCH",
+ 0,
+ "Stretch",
+ "Stretch the object along the Z axis of the modifier space"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SimpleDeformModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "SimpleDeform Modifier",
+ "Simple deformation modifier to apply effects such as twisting and bending");
+ RNA_def_struct_sdna(srna, "SimpleDeformModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SIMPLEDEFORM);
+
+ prop = RNA_def_property(srna, "deform_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, simple_deform_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SimpleDeformModifier_vgroup_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "deform_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Deform around local axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "origin", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Origin", "Offset the origin and orientation of the deformation");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -10.0, 10.0, 1.0, 3);
+ RNA_def_property_ui_text(prop, "Factor", "Amount to deform object");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_float_default(prop, DEG2RADF(45.0f));
+ RNA_def_property_ui_range(prop, DEG2RAD(-360.0), DEG2RAD(360.0), 10.0, 3);
+ RNA_def_property_ui_text(prop, "Angle", "Angle of deformation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "limits", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "limit");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 5, 2);
+ RNA_def_property_ui_text(prop, "Limits", "Lower/Upper limits for deform");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_X);
+ RNA_def_property_ui_text(prop, "X", "Do not allow deformation along the X axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Y);
+ RNA_def_property_ui_text(prop, "Y", "Do not allow deformation along the Y axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "axis", MOD_SIMPLEDEFORM_LOCK_AXIS_Z);
+ RNA_def_property_ui_text(prop, "Z", "Do not allow deformation along the Z axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SIMPLEDEFORM_FLAG_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_surface(BlenderRNA *brna)
{
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Surface Modifier",
- "Surface modifier defining modifier stack position used for surface fields");
- RNA_def_struct_sdna(srna, "SurfaceModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
+ StructRNA *srna;
+
+ srna = RNA_def_struct(brna, "SurfaceModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Surface Modifier",
+ "Surface modifier defining modifier stack position used for surface fields");
+ RNA_def_struct_sdna(srna, "SurfaceModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_PHYSICS);
}
static void rna_def_modifier_solidify(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Solidify Modifier",
- "Create a solid skin by extruding, compensating for sharp angles");
- RNA_def_struct_sdna(srna, "SolidifyModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
-
- prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
- RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "thickness_clamp", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "offset_clamp");
- RNA_def_property_range(prop, 0, 100.0);
- RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 4);
- RNA_def_property_ui_text(prop, "Clamp", "Offset clamp based on geometry scale");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Vertex Group Factor",
- "Thickness factor to use for zero vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "offset_fac");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
- RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "crease_inner");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Inner Crease", "Assign a crease to inner edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "crease_outer");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Outer Crease", "Assign a crease to outer edges");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "crease_rim");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
- RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mat_ofs_rim");
- RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Rim Material Offset", "Offset material index of generated rim faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SolidifyModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
- RNA_def_property_ui_text(prop, "Fill Rim",
- "Create edge loops between the inner and outer surfaces on face edges "
- "(slow, disable when not needed)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN);
- RNA_def_property_ui_text(prop, "Even Thickness",
- "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_quality_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NORMAL_CALC);
- RNA_def_property_ui_text(prop, "High Quality Normals",
- "Calculate normals which result in more even thickness (slow, disable when not needed)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_VGROUP_INV);
- RNA_def_property_ui_text(prop, "Vertex Group Invert", "Invert the vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_flip_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_FLIP);
- RNA_def_property_ui_text(prop, "Flip Normals", "Invert the face direction");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_rim_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NOSHELL);
- RNA_def_property_ui_text(prop, "Only Rim", "Only add the rim to the original data");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SolidifyModifier", "Modifier");
+ RNA_def_struct_ui_text(srna,
+ "Solidify Modifier",
+ "Create a solid skin by extruding, compensating for sharp angles");
+ RNA_def_struct_sdna(srna, "SolidifyModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SOLIDIFY);
+
+ prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Thickness", "Thickness of the shell");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "thickness_clamp", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_clamp");
+ RNA_def_property_range(prop, 0, 100.0);
+ RNA_def_property_ui_range(prop, 0, 2.0, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Clamp", "Offset clamp based on geometry scale");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_fac");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "edge_crease_inner", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "crease_inner");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Inner Crease", "Assign a crease to inner edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "edge_crease_outer", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "crease_outer");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Outer Crease", "Assign a crease to outer edges");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "edge_crease_rim", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "crease_rim");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rim Crease", "Assign a crease to the edges making up the rim");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
+ RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "material_offset_rim", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mat_ofs_rim");
+ RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Rim Material Offset", "Offset material index of generated rim faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SolidifyModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_rim", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_RIM);
+ RNA_def_property_ui_text(prop,
+ "Fill Rim",
+ "Create edge loops between the inner and outer surfaces on face edges "
+ "(slow, disable when not needed)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_EVEN);
+ RNA_def_property_ui_text(
+ prop,
+ "Even Thickness",
+ "Maintain thickness by adjusting for sharp corners (slow, disable when not needed)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_quality_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NORMAL_CALC);
+ RNA_def_property_ui_text(
+ prop,
+ "High Quality Normals",
+ "Calculate normals which result in more even thickness (slow, disable when not needed)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_VGROUP_INV);
+ RNA_def_property_ui_text(prop, "Vertex Group Invert", "Invert the vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_flip_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_FLIP);
+ RNA_def_property_ui_text(prop, "Flip Normals", "Invert the face direction");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_rim_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SOLIDIFY_NOSHELL);
+ RNA_def_property_ui_text(prop, "Only Rim", "Only add the rim to the original data");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_screw(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ScrewModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Screw Modifier", "Revolve edges");
- RNA_def_struct_sdna(srna, "ScrewModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SCREW);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob_axis");
- RNA_def_property_ui_text(prop, "Object", "Object to define the screw axis");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "steps", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 2, 10000);
- RNA_def_property_ui_range(prop, 3, 512, 1, -1);
- RNA_def_property_ui_text(prop, "Steps", "Number of steps in the revolution");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "render_steps", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 2, 10000);
- RNA_def_property_ui_range(prop, 2, 512, 1, -1);
- RNA_def_property_ui_text(prop, "Render Steps", "Number of steps in the revolution");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "iter");
- RNA_def_property_range(prop, 1, 10000);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Iterations", "Number of times to apply the screw operation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Axis", "Screw axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, -1);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Angle", "Angle of revolution");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "screw_offset", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "screw_ofs");
- RNA_def_property_ui_text(prop, "Screw", "Offset the revolution along its axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "merge_dist");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 1, 4);
- RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal_flip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_FLIP);
- RNA_def_property_ui_text(prop, "Flip", "Flip normals of lathed faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normal_calculate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_CALC);
- RNA_def_property_ui_text(prop, "Calc Order", "Calculate the order of edges (needed for meshes, but not curves)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_object_screw_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_OFFSET);
- RNA_def_property_ui_text(prop, "Object Screw", "Use the distance between the objects to make a screw");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Vertex merging parameters */
- prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_MERGE);
- RNA_def_property_ui_text(prop, "Merge Vertices", "Merge adjacent vertices (screw offset must be zero)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_SMOOTH_SHADING);
- RNA_def_property_ui_text(prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_stretch_u", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_UV_STRETCH_U);
- RNA_def_property_ui_text(prop, "Stretch U", "Stretch the U coordinates between 0-1 when UV's are present");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_stretch_v", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_UV_STRETCH_V);
- RNA_def_property_ui_text(prop, "Stretch V", "Stretch the V coordinates between 0-1 when UV's are present");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-#if 0
- prop = RNA_def_property(srna, "use_angle_object", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_ANGLE);
- RNA_def_property_ui_text(prop, "Object Angle", "Use the angle between the objects rather than the fixed angle");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-#endif
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ScrewModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Screw Modifier", "Revolve edges");
+ RNA_def_struct_sdna(srna, "ScrewModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SCREW);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob_axis");
+ RNA_def_property_ui_text(prop, "Object", "Object to define the screw axis");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "steps", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 2, 10000);
+ RNA_def_property_ui_range(prop, 3, 512, 1, -1);
+ RNA_def_property_ui_text(prop, "Steps", "Number of steps in the revolution");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "render_steps", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 2, 10000);
+ RNA_def_property_ui_range(prop, 2, 512, 1, -1);
+ RNA_def_property_ui_text(prop, "Render Steps", "Number of steps in the revolution");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_range(prop, 1, 10000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Iterations", "Number of times to apply the screw operation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Screw axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_ui_range(prop, -M_PI * 2, M_PI * 2, 10, -1);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Angle", "Angle of revolution");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "screw_offset", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "screw_ofs");
+ RNA_def_property_ui_text(prop, "Screw", "Offset the revolution along its axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "merge_threshold", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "merge_dist");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 1, 4);
+ RNA_def_property_ui_text(prop, "Merge Distance", "Limit below which to merge vertices");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal_flip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_FLIP);
+ RNA_def_property_ui_text(prop, "Flip", "Flip normals of lathed faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normal_calculate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_NORMAL_CALC);
+ RNA_def_property_ui_text(
+ prop, "Calc Order", "Calculate the order of edges (needed for meshes, but not curves)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_object_screw_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_OFFSET);
+ RNA_def_property_ui_text(
+ prop, "Object Screw", "Use the distance between the objects to make a screw");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Vertex merging parameters */
+ prop = RNA_def_property(srna, "use_merge_vertices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_MERGE);
+ RNA_def_property_ui_text(
+ prop, "Merge Vertices", "Merge adjacent vertices (screw offset must be zero)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_SMOOTH_SHADING);
+ RNA_def_property_ui_text(
+ prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_stretch_u", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_UV_STRETCH_U);
+ RNA_def_property_ui_text(
+ prop, "Stretch U", "Stretch the U coordinates between 0-1 when UV's are present");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_stretch_v", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_UV_STRETCH_V);
+ RNA_def_property_ui_text(
+ prop, "Stretch V", "Stretch the V coordinates between 0-1 when UV's are present");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+# if 0
+ prop = RNA_def_property(srna, "use_angle_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SCREW_OBJECT_ANGLE);
+ RNA_def_property_ui_text(prop, "Object Angle", "Use the angle between the objects rather than the fixed angle");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+# endif
}
static void rna_def_modifier_uvwarp(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "UVWarpModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "UVWarp Modifier", "Add target position to uv coordinates");
- RNA_def_struct_sdna(srna, "UVWarpModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
-
- prop = RNA_def_property(srna, "axis_u", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "axis_u");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "U-Axis", "Pole axis for rotation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "axis_v", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "axis_v");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "V-Axis", "Pole axis for rotation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "center");
- RNA_def_property_ui_text(prop, "UV Center", "Center point for rotate/scale");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "object_src");
- RNA_def_property_ui_text(prop, "Object From", "Object defining offset");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "bone_from", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "bone_src");
- RNA_def_property_ui_text(prop, "Bone From", "Bone defining offset");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "object_dst");
- RNA_def_property_ui_text(prop, "Object To", "Object defining offset");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "bone_to", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "bone_dst");
- RNA_def_property_ui_text(prop, "Bone To", "Bone defining offset");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVWarpModifier_vgroup_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
- RNA_def_property_ui_text(prop, "UV Layer", "UV Layer name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVWarpModifier_uvlayer_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "UVWarpModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "UVWarp Modifier", "Add target position to uv coordinates");
+ RNA_def_struct_sdna(srna, "UVWarpModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_UVPROJECT);
+
+ prop = RNA_def_property(srna, "axis_u", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "axis_u");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "U-Axis", "Pole axis for rotation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "axis_v", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "axis_v");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "V-Axis", "Pole axis for rotation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "center", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "center");
+ RNA_def_property_ui_text(prop, "UV Center", "Center point for rotate/scale");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "object_from", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object_src");
+ RNA_def_property_ui_text(prop, "Object From", "Object defining offset");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "bone_from", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "bone_src");
+ RNA_def_property_ui_text(prop, "Bone From", "Bone defining offset");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "object_to", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object_dst");
+ RNA_def_property_ui_text(prop, "Object To", "Object defining offset");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "bone_to", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "bone_dst");
+ RNA_def_property_ui_text(prop, "Bone To", "Bone defining offset");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vgroup_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVWarpModifier_vgroup_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
+ RNA_def_property_ui_text(prop, "UV Layer", "UV Layer name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_UVWarpModifier_uvlayer_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
-static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna), StructRNA *srna,
- const char *mask_vgroup_setter, const char *mask_uvlayer_setter)
+static void rna_def_modifier_weightvg_mask(BlenderRNA *UNUSED(brna),
+ StructRNA *srna,
+ const char *mask_vgroup_setter,
+ const char *mask_uvlayer_setter)
{
- static const EnumPropertyItem weightvg_mask_tex_map_items[] = {
- {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use local generated coordinates"},
- {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use global coordinates"},
- {MOD_DISP_MAP_OBJECT, "OBJECT", 0, "Object", "Use local generated coordinates of another object"},
- {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use coordinates from an UV layer"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem weightvg_mask_tex_used_items[] = {
- {MOD_WVG_MASK_TEX_USE_INT, "INT", 0, "Intensity", ""},
- {MOD_WVG_MASK_TEX_USE_RED, "RED", 0, "Red", ""},
- {MOD_WVG_MASK_TEX_USE_GREEN, "GREEN", 0, "Green", ""},
- {MOD_WVG_MASK_TEX_USE_BLUE, "BLUE", 0, "Blue", ""},
- {MOD_WVG_MASK_TEX_USE_HUE, "HUE", 0, "Hue", ""},
- {MOD_WVG_MASK_TEX_USE_SAT, "SAT", 0, "Saturation", ""},
- {MOD_WVG_MASK_TEX_USE_VAL, "VAL", 0, "Value", ""},
- {MOD_WVG_MASK_TEX_USE_ALPHA, "ALPHA", 0, "Alpha", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_ui_text(prop, "Influence", "Global influence of current modifications on vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name");
- RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, mask_vgroup_setter);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Masking Tex", "Masking texture");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "mask_tex_use_channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_mask_tex_used_items);
- RNA_def_property_ui_text(prop, "Use Channel", "Which texture channel to use for masking");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mask_tex_mapping", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_mask_tex_map_items);
- RNA_def_property_ui_text(prop, "Texture Coordinates", "Which texture coordinates "
- "to use for mapping");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "mask_tex_uvlayer_name");
- RNA_def_property_ui_text(prop, "UV Map", "UV map name");
- RNA_def_property_string_funcs(prop, NULL, NULL, mask_uvlayer_setter);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mask_tex_map_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mask_tex_map_obj");
- RNA_def_property_ui_text(prop, "Texture Coordinate Object", "Which object to take texture "
- "coordinates from");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+ static const EnumPropertyItem weightvg_mask_tex_map_items[] = {
+ {MOD_DISP_MAP_LOCAL, "LOCAL", 0, "Local", "Use local generated coordinates"},
+ {MOD_DISP_MAP_GLOBAL, "GLOBAL", 0, "Global", "Use global coordinates"},
+ {MOD_DISP_MAP_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use local generated coordinates of another object"},
+ {MOD_DISP_MAP_UV, "UV", 0, "UV", "Use coordinates from an UV layer"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem weightvg_mask_tex_used_items[] = {
+ {MOD_WVG_MASK_TEX_USE_INT, "INT", 0, "Intensity", ""},
+ {MOD_WVG_MASK_TEX_USE_RED, "RED", 0, "Red", ""},
+ {MOD_WVG_MASK_TEX_USE_GREEN, "GREEN", 0, "Green", ""},
+ {MOD_WVG_MASK_TEX_USE_BLUE, "BLUE", 0, "Blue", ""},
+ {MOD_WVG_MASK_TEX_USE_HUE, "HUE", 0, "Hue", ""},
+ {MOD_WVG_MASK_TEX_USE_SAT, "SAT", 0, "Saturation", ""},
+ {MOD_WVG_MASK_TEX_USE_VAL, "VAL", 0, "Value", ""},
+ {MOD_WVG_MASK_TEX_USE_ALPHA, "ALPHA", 0, "Alpha", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "mask_constant", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Influence", "Global influence of current modifications on vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mask_vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "mask_defgrp_name");
+ RNA_def_property_ui_text(prop, "Mask VGroup", "Masking vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, mask_vgroup_setter);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mask_texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Masking Tex", "Masking texture");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "mask_tex_use_channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_mask_tex_used_items);
+ RNA_def_property_ui_text(prop, "Use Channel", "Which texture channel to use for masking");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mask_tex_mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_mask_tex_map_items);
+ RNA_def_property_ui_text(prop,
+ "Texture Coordinates",
+ "Which texture coordinates "
+ "to use for mapping");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "mask_tex_uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "mask_tex_uvlayer_name");
+ RNA_def_property_ui_text(prop, "UV Map", "UV map name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, mask_uvlayer_setter);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mask_tex_map_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_tex_map_obj");
+ RNA_def_property_ui_text(prop,
+ "Texture Coordinate Object",
+ "Which object to take texture "
+ "coordinates from");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
}
static void rna_def_modifier_weightvgedit(BlenderRNA *brna)
{
- static const EnumPropertyItem weightvg_edit_falloff_type_items[] = {
- {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"},
- {MOD_WVG_MAPPING_CURVE, "CURVE", ICON_RNDCURVE, "Custom Curve", ""},
- {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
- {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
- {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
- {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
- {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
- {MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE /* Would need a better icon... */, "Median Step",
- "Map all values below 0.5 to 0.0, and all others to 1.0"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "WeightVG Edit Modifier",
- "Edit the weights of vertices in a group");
- RNA_def_struct_sdna(srna, "WeightVGEditModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGEditModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
- RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_ADD2VG);
- RNA_def_property_ui_text(prop, "Group Add", "Add vertices with weight over threshold "
- "to vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REMFVG);
- RNA_def_property_ui_text(prop, "Group Remove", "Remove vertices with weight below threshold "
- "from vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_ui_text(prop, "Default Weight", "Default weight a vertex will have if "
- "it is not in the vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "map_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "cmap_curve");
- RNA_def_property_ui_text(prop, "Mapping Curve", "Custom mapping curve");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "add_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "add_threshold");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_ui_text(prop, "Add Threshold", "Lower bound for a vertex's weight "
- "to be added to the vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "remove_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rem_threshold");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_ui_text(prop, "Remove Threshold", "Upper bound for a vertex's weight "
- "to be removed from the vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Common masking properties. */
- rna_def_modifier_weightvg_mask(brna, srna, "rna_WeightVGEditModifier_mask_defgrp_name_set",
- "rna_WeightVGEditModifier_mask_tex_uvlayer_name_set");
+ static const EnumPropertyItem weightvg_edit_falloff_type_items[] = {
+ {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"},
+ {MOD_WVG_MAPPING_CURVE, "CURVE", ICON_RNDCURVE, "Custom Curve", ""},
+ {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
+ {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
+ {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
+ {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
+ {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
+ {MOD_WVG_MAPPING_STEP,
+ "STEP",
+ ICON_NOCURVE /* Would need a better icon... */,
+ "Median Step",
+ "Map all values below 0.5 to 0.0, and all others to 1.0"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VertexWeightEditModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "WeightVG Edit Modifier", "Edit the weights of vertices in a group");
+ RNA_def_struct_sdna(srna, "WeightVGEditModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGEditModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_edit_falloff_type_items);
+ RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_add", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_ADD2VG);
+ RNA_def_property_ui_text(prop,
+ "Group Add",
+ "Add vertices with weight over threshold "
+ "to vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_remove", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edit_flags", MOD_WVG_EDIT_REMFVG);
+ RNA_def_property_ui_text(prop,
+ "Group Remove",
+ "Remove vertices with weight below threshold "
+ "from vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Default Weight",
+ "Default weight a vertex will have if "
+ "it is not in the vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "map_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "cmap_curve");
+ RNA_def_property_ui_text(prop, "Mapping Curve", "Custom mapping curve");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "add_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "add_threshold");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Add Threshold",
+ "Lower bound for a vertex's weight "
+ "to be added to the vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "remove_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rem_threshold");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Remove Threshold",
+ "Upper bound for a vertex's weight "
+ "to be removed from the vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Common masking properties. */
+ rna_def_modifier_weightvg_mask(brna,
+ srna,
+ "rna_WeightVGEditModifier_mask_defgrp_name_set",
+ "rna_WeightVGEditModifier_mask_tex_uvlayer_name_set");
}
static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
{
- static const EnumPropertyItem weightvg_mix_modes_items[] = {
- {MOD_WVG_MIX_SET, "SET", 0, "Replace", "Replace VGroup A's weights by VGroup B's ones"},
- {MOD_WVG_MIX_ADD, "ADD", 0, "Add", "Add VGroup B's weights to VGroup A's ones"},
- {MOD_WVG_MIX_SUB, "SUB", 0, "Subtract", "Subtract VGroup B's weights from VGroup A's ones"},
- {MOD_WVG_MIX_MUL, "MUL", 0, "Multiply", "Multiply VGroup A's weights by VGroup B's ones"},
- {MOD_WVG_MIX_DIV, "DIV", 0, "Divide", "Divide VGroup A's weights by VGroup B's ones"},
- {MOD_WVG_MIX_DIF, "DIF", 0, "Difference", "Difference between VGroup A's and VGroup B's weights"},
- {MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weights"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem weightvg_mix_set_items[] = {
- {MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"},
- {MOD_WVG_SET_A, "A", 0, "VGroup A", "Affect vertices in VGroup A"},
- {MOD_WVG_SET_B, "B", 0, "VGroup B", "Affect vertices in VGroup B (might add some to VGroup A)"},
- {MOD_WVG_SET_OR, "OR", 0, "VGroup A or B",
- "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
- {MOD_WVG_SET_AND, "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "WeightVG Mix Modifier",
- "Mix the weights of two vertex groups");
- RNA_def_struct_sdna(srna, "WeightVGMixModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
-
- prop = RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name_a");
- RNA_def_property_ui_text(prop, "Vertex Group A", "First vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_defgrp_name_a_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group_b", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name_b");
- RNA_def_property_ui_text(prop, "Vertex Group B", "Second vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_defgrp_name_b_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_ui_text(prop, "Default Weight A", "Default weight a vertex will have if "
- "it is not in the first A vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_ui_text(prop, "Default Weight B", "Default weight a vertex will have if "
- "it is not in the second B vgroup");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_mix_modes_items);
- RNA_def_property_ui_text(prop, "Mix Mode", "How weights from vgroup B affect weights "
- "of vgroup A");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mix_set", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_mix_set_items);
- RNA_def_property_ui_text(prop, "Vertex Set", "Which vertices should be affected");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Common masking properties. */
- rna_def_modifier_weightvg_mask(brna, srna, "rna_WeightVGMixModifier_mask_defgrp_name_set",
- "rna_WeightVGMixModifier_mask_tex_uvlayer_name_set");
+ static const EnumPropertyItem weightvg_mix_modes_items[] = {
+ {MOD_WVG_MIX_SET, "SET", 0, "Replace", "Replace VGroup A's weights by VGroup B's ones"},
+ {MOD_WVG_MIX_ADD, "ADD", 0, "Add", "Add VGroup B's weights to VGroup A's ones"},
+ {MOD_WVG_MIX_SUB, "SUB", 0, "Subtract", "Subtract VGroup B's weights from VGroup A's ones"},
+ {MOD_WVG_MIX_MUL, "MUL", 0, "Multiply", "Multiply VGroup A's weights by VGroup B's ones"},
+ {MOD_WVG_MIX_DIV, "DIV", 0, "Divide", "Divide VGroup A's weights by VGroup B's ones"},
+ {MOD_WVG_MIX_DIF,
+ "DIF",
+ 0,
+ "Difference",
+ "Difference between VGroup A's and VGroup B's weights"},
+ {MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weights"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem weightvg_mix_set_items[] = {
+ {MOD_WVG_SET_ALL, "ALL", 0, "All", "Affect all vertices (might add some to VGroup A)"},
+ {MOD_WVG_SET_A, "A", 0, "VGroup A", "Affect vertices in VGroup A"},
+ {MOD_WVG_SET_B,
+ "B",
+ 0,
+ "VGroup B",
+ "Affect vertices in VGroup B (might add some to VGroup A)"},
+ {MOD_WVG_SET_OR,
+ "OR",
+ 0,
+ "VGroup A or B",
+ "Affect vertices in at least one of both VGroups (might add some to VGroup A)"},
+ {MOD_WVG_SET_AND, "AND", 0, "VGroup A and B", "Affect vertices in both groups"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VertexWeightMixModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "WeightVG Mix Modifier", "Mix the weights of two vertex groups");
+ RNA_def_struct_sdna(srna, "WeightVGMixModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
+
+ prop = RNA_def_property(srna, "vertex_group_a", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name_a");
+ RNA_def_property_ui_text(prop, "Vertex Group A", "First vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_defgrp_name_a_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group_b", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name_b");
+ RNA_def_property_ui_text(prop, "Vertex Group B", "Second vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGMixModifier_defgrp_name_b_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "default_weight_a", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Default Weight A",
+ "Default weight a vertex will have if "
+ "it is not in the first A vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "default_weight_b", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Default Weight B",
+ "Default weight a vertex will have if "
+ "it is not in the second B vgroup");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_mix_modes_items);
+ RNA_def_property_ui_text(prop,
+ "Mix Mode",
+ "How weights from vgroup B affect weights "
+ "of vgroup A");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mix_set", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_mix_set_items);
+ RNA_def_property_ui_text(prop, "Vertex Set", "Which vertices should be affected");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Common masking properties. */
+ rna_def_modifier_weightvg_mask(brna,
+ srna,
+ "rna_WeightVGMixModifier_mask_defgrp_name_set",
+ "rna_WeightVGMixModifier_mask_tex_uvlayer_name_set");
}
static void rna_def_modifier_weightvgproximity(BlenderRNA *brna)
{
- static const EnumPropertyItem weightvg_proximity_modes_items[] = {
- {MOD_WVG_PROXIMITY_OBJECT, "OBJECT", 0, "Object",
- "Use distance between affected and target objects"},
- {MOD_WVG_PROXIMITY_GEOMETRY, "GEOMETRY", 0, "Geometry",
- "Use distance between affected object's vertices and target "
- "object, or target object's geometry"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem proximity_geometry_items[] = {
- {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", 0, "Vertex", "Compute distance to nearest vertex"},
- {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", 0, "Edge", "Compute distance to nearest edge"},
- {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", 0, "Face", "Compute distance to nearest face"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
- {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"},
- /* No curve mapping here! */
- {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
- {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
- {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
- {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
- {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
- {MOD_WVG_MAPPING_STEP, "STEP", ICON_NOCURVE /* Would need a better icon... */, "Median Step",
- "Map all values below 0.5 to 0.0, and all others to 1.0"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "WeightVG Proximity Modifier",
- "Set the weights of vertices in a group from a target object's "
- "distance");
- RNA_def_struct_sdna(srna, "WeightVGProximityModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGProximityModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "proximity_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_proximity_modes_items);
- RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOMETRY);
- RNA_def_property_ui_text(prop, "Proximity Mode", "Which distances to target object to use");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "proximity_geometry", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
- RNA_def_property_enum_items(prop, proximity_geometry_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
- RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOM_FACES);
- RNA_def_property_ui_text(prop, "Proximity Geometry",
- "Use the shortest computed distance to target object's geometry "
- "as weight");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "proximity_ob_target");
- RNA_def_property_ui_text(prop, "Target Object", "Object to calculate vertices distances from");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, -1);
- RNA_def_property_ui_text(prop, "Lowest", "Distance mapping to weight 0.0");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, -1);
- RNA_def_property_ui_text(prop, "Highest", "Distance mapping to weight 1.0");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items);
- RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Common masking properties. */
- rna_def_modifier_weightvg_mask(brna, srna, "rna_WeightVGProximityModifier_mask_defgrp_name_set",
- "rna_WeightVGProximityModifier_mask_tex_uvlayer_name_set");
+ static const EnumPropertyItem weightvg_proximity_modes_items[] = {
+ {MOD_WVG_PROXIMITY_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use distance between affected and target objects"},
+ {MOD_WVG_PROXIMITY_GEOMETRY,
+ "GEOMETRY",
+ 0,
+ "Geometry",
+ "Use distance between affected object's vertices and target "
+ "object, or target object's geometry"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem proximity_geometry_items[] = {
+ {MOD_WVG_PROXIMITY_GEOM_VERTS, "VERTEX", 0, "Vertex", "Compute distance to nearest vertex"},
+ {MOD_WVG_PROXIMITY_GEOM_EDGES, "EDGE", 0, "Edge", "Compute distance to nearest edge"},
+ {MOD_WVG_PROXIMITY_GEOM_FACES, "FACE", 0, "Face", "Compute distance to nearest face"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem weightvg_proximity_falloff_type_items[] = {
+ {MOD_WVG_MAPPING_NONE, "LINEAR", ICON_LINCURVE, "Linear", "Null action"},
+ /* No curve mapping here! */
+ {MOD_WVG_MAPPING_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", ""},
+ {MOD_WVG_MAPPING_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", ""},
+ {MOD_WVG_MAPPING_ROOT, "ROOT", ICON_ROOTCURVE, "Root", ""},
+ {MOD_WVG_MAPPING_SPHERE, "ICON_SPHERECURVE", ICON_SPHERECURVE, "Sphere", ""},
+ {MOD_WVG_MAPPING_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", ""},
+ {MOD_WVG_MAPPING_STEP,
+ "STEP",
+ ICON_NOCURVE /* Would need a better icon... */,
+ "Median Step",
+ "Map all values below 0.5 to 0.0, and all others to 1.0"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VertexWeightProximityModifier", "Modifier");
+ RNA_def_struct_ui_text(srna,
+ "WeightVG Proximity Modifier",
+ "Set the weights of vertices in a group from a target object's "
+ "distance");
+ RNA_def_struct_sdna(srna, "WeightVGProximityModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_VERTEX_WEIGHT);
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightVGProximityModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "proximity_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_proximity_modes_items);
+ RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOMETRY);
+ RNA_def_property_ui_text(prop, "Proximity Mode", "Which distances to target object to use");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "proximity_geometry", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "proximity_flags");
+ RNA_def_property_enum_items(prop, proximity_geometry_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG); /* important to run before default set */
+ RNA_def_property_enum_default(prop, MOD_WVG_PROXIMITY_GEOM_FACES);
+ RNA_def_property_ui_text(prop,
+ "Proximity Geometry",
+ "Use the shortest computed distance to target object's geometry "
+ "as weight");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "proximity_ob_target");
+ RNA_def_property_ui_text(prop, "Target Object", "Object to calculate vertices distances from");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "min_dist", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, -1);
+ RNA_def_property_ui_text(prop, "Lowest", "Distance mapping to weight 0.0");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "max_dist", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1000.0, 10, -1);
+ RNA_def_property_ui_text(prop, "Highest", "Distance mapping to weight 1.0");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, weightvg_proximity_falloff_type_items);
+ RNA_def_property_ui_text(prop, "Falloff Type", "How weights are mapped to their new values");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Common masking properties. */
+ rna_def_modifier_weightvg_mask(brna,
+ srna,
+ "rna_WeightVGProximityModifier_mask_defgrp_name_set",
+ "rna_WeightVGProximityModifier_mask_tex_uvlayer_name_set");
}
static void rna_def_modifier_remesh(BlenderRNA *brna)
{
- static const EnumPropertyItem mode_items[] = {
- {MOD_REMESH_CENTROID, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
- {MOD_REMESH_MASS_POINT, "SMOOTH", 0, "Smooth", "Output a smooth surface with no sharp-features detection"},
- {MOD_REMESH_SHARP_FEATURES, "SHARP", 0, "Sharp",
- "Output a surface that reproduces sharp edges and corners from the input mesh"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "RemeshModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Remesh Modifier",
- "Generate a new surface with regular topology that follows the shape of the input mesh");
- RNA_def_struct_sdna(srna, "RemeshModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_REMESH);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, mode_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_range(prop, 0, 0.99, 0.01, 3);
- RNA_def_property_range(prop, 0, 0.99);
- RNA_def_property_ui_text(prop, "Scale",
- "The ratio of the largest dimension of the model over the size of the grid");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Threshold",
- "If removing disconnected pieces, minimum size of components to preserve as a ratio "
- "of the number of polygons in the largest component");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "octree_depth", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "depth");
- RNA_def_property_range(prop, 1, 12);
- RNA_def_property_ui_text(prop, "Octree Depth", "Resolution of the octree; higher values give finer details");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "hermite_num");
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Sharpness",
- "Tolerance for outliers; lower values filter noise while higher values will reproduce "
- "edges closer to the input");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_remove_disconnected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL);
- RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_SMOOTH_SHADING);
- RNA_def_property_ui_text(prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ static const EnumPropertyItem mode_items[] = {
+ {MOD_REMESH_CENTROID, "BLOCKS", 0, "Blocks", "Output a blocky surface with no smoothing"},
+ {MOD_REMESH_MASS_POINT,
+ "SMOOTH",
+ 0,
+ "Smooth",
+ "Output a smooth surface with no sharp-features detection"},
+ {MOD_REMESH_SHARP_FEATURES,
+ "SHARP",
+ 0,
+ "Sharp",
+ "Output a surface that reproduces sharp edges and corners from the input mesh"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "RemeshModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna,
+ "Remesh Modifier",
+ "Generate a new surface with regular topology that follows the shape of the input mesh");
+ RNA_def_struct_sdna(srna, "RemeshModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_REMESH);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0, 0.99, 0.01, 3);
+ RNA_def_property_range(prop, 0, 0.99);
+ RNA_def_property_ui_text(
+ prop, "Scale", "The ratio of the largest dimension of the model over the size of the grid");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Threshold",
+ "If removing disconnected pieces, minimum size of components to preserve as a ratio "
+ "of the number of polygons in the largest component");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "octree_depth", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "depth");
+ RNA_def_property_range(prop, 1, 12);
+ RNA_def_property_ui_text(
+ prop, "Octree Depth", "Resolution of the octree; higher values give finer details");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "sharpness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "hermite_num");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Sharpness",
+ "Tolerance for outliers; lower values filter noise while higher values will reproduce "
+ "edges closer to the input");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_remove_disconnected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_FLOOD_FILL);
+ RNA_def_property_ui_text(prop, "Remove Disconnected Pieces", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_REMESH_SMOOTH_SHADING);
+ RNA_def_property_ui_text(
+ prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_ocean(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem geometry_items[] = {
- {MOD_OCEAN_GEOM_GENERATE, "GENERATE", 0, "Generate",
- "Generate ocean surface geometry at the specified resolution"},
- {MOD_OCEAN_GEOM_DISPLACE, "DISPLACE", 0, "Displace", "Displace existing geometry according to simulation"},
-#if 0
- {MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only",
- "Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "OceanModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Ocean Modifier", "Simulate an ocean surface");
- RNA_def_struct_sdna(srna, "OceanModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_OCEAN);
-
- prop = RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "geometry_mode");
- RNA_def_property_enum_items(prop, geometry_items);
- RNA_def_property_ui_text(prop, "Geometry", "Method of modifying geometry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_ui_text(prop, "Size", "Surface scale factor (does not affect the height of the waves)");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, -1);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "repeat_x");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Repeat X", "Repetitions of the generated surface in X");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "repeat_y");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Repeat Y", "Repetitions of the generated surface in Y");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Generate Normals",
- "Output normals for bump mapping - disabling can speed up performance if its not needed");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_FOAM);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Generate Foam", "Generate foam mask as a vertex color channel");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "resolution");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_ui_range(prop, 1, 32, 1, -1);
- RNA_def_property_ui_text(prop, "Resolution", "Resolution of the generated surface");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "spatial_size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "spatial_size");
- RNA_def_property_ui_range(prop, 1, 512, 2, -1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Spatial Size",
- "Size of the simulation domain (in meters), and of the generated geometry (in BU)");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "wind_velocity");
- RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "damp");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Damping", "Damp reflected waves going in opposite direction to the wind");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "wave_scale_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "smallest_wave");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Smallest Wave", "Shortest allowed wavelength");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "wave_alignment");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_text(prop, "Wave Alignment", "How much the waves are aligned to each other");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "wave_direction", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "wave_direction");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Wave Direction", "Main direction of the waves when they are (partially) aligned");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "wave_scale", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "wave_scale");
- RNA_def_property_ui_text(prop, "Wave Scale", "Scale of the displacement effect");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "depth");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Depth", "Depth of the solid ground below the water surface");
- RNA_def_property_ui_range(prop, 0, 250, 1, -1);
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "foam_coverage", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "foam_coverage");
- RNA_def_property_ui_text(prop, "Foam Coverage", "Amount of generated foam");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "bake_foam_fade", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "foam_fade");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Foam Fade", "How much foam accumulates over time (baked ocean only)");
- RNA_def_property_ui_range(prop, 0.0, 10.0, 1, -1);
- RNA_def_property_update(prop, 0, NULL);
-
- prop = RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "foamlayername");
- RNA_def_property_ui_text(prop, "Foam Layer Name", "Name of the vertex color layer used for foam");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "chop_amount");
- RNA_def_property_ui_text(prop, "Choppiness",
- "Choppiness of the wave's crest (adds some horizontal component to the displacement)");
- RNA_def_property_ui_range(prop, 0.0, 4.0, 3, -1);
- RNA_def_property_float_funcs(prop, NULL, "rna_OceanModifier_ocean_chop_set", NULL);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "time");
- RNA_def_property_ui_text(prop, "Time", "Current time of the simulation");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, -1);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "random_seed", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "seed");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Random Seed", "Seed of the random generator");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "bakestart");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Bake Start", "Start frame of the ocean baking");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "bakeend");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Bake End", "End frame of the ocean baking");
- RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
-
- prop = RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cached", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Ocean is Cached", "Whether the ocean is using cached data or simulating");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "cachepath");
- RNA_def_property_ui_text(prop, "Cache Path", "Path to a folder to store external baked images");
- /*RNA_def_property_update(prop, 0, "rna_Modifier_update"); */
- /* XXX how to update? */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem geometry_items[] = {
+ {MOD_OCEAN_GEOM_GENERATE,
+ "GENERATE",
+ 0,
+ "Generate",
+ "Generate ocean surface geometry at the specified resolution"},
+ {MOD_OCEAN_GEOM_DISPLACE,
+ "DISPLACE",
+ 0,
+ "Displace",
+ "Displace existing geometry according to simulation"},
+# if 0
+ {MOD_OCEAN_GEOM_SIM_ONLY, "SIM_ONLY", 0, "Sim Only",
+ "Leaves geometry unchanged, but still runs simulation (to be used from texture)"},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "OceanModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Ocean Modifier", "Simulate an ocean surface");
+ RNA_def_struct_sdna(srna, "OceanModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_OCEAN);
+
+ prop = RNA_def_property(srna, "geometry_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "geometry_mode");
+ RNA_def_property_enum_items(prop, geometry_items);
+ RNA_def_property_ui_text(prop, "Geometry", "Method of modifying geometry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_ui_text(
+ prop, "Size", "Surface scale factor (does not affect the height of the waves)");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, -1);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "repeat_x");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Repeat X", "Repetitions of the generated surface in X");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "repeat_y");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Repeat Y", "Repetitions of the generated surface in Y");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_NORMALS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Generate Normals",
+ "Output normals for bump mapping - disabling can speed up performance if its not needed");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "use_foam", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_OCEAN_GENERATE_FOAM);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Generate Foam", "Generate foam mask as a vertex color channel");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "resolution");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_ui_range(prop, 1, 32, 1, -1);
+ RNA_def_property_ui_text(prop, "Resolution", "Resolution of the generated surface");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "spatial_size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "spatial_size");
+ RNA_def_property_ui_range(prop, 1, 512, 2, -1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Spatial Size",
+ "Size of the simulation domain (in meters), and of the generated geometry (in BU)");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "wind_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "wind_velocity");
+ RNA_def_property_ui_text(prop, "Wind Velocity", "Wind speed");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "damp");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Damping", "Damp reflected waves going in opposite direction to the wind");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "wave_scale_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "smallest_wave");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Smallest Wave", "Shortest allowed wavelength");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "wave_alignment", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "wave_alignment");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_text(prop, "Wave Alignment", "How much the waves are aligned to each other");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "wave_direction", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "wave_direction");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Wave Direction", "Main direction of the waves when they are (partially) aligned");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "wave_scale", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "wave_scale");
+ RNA_def_property_ui_text(prop, "Wave Scale", "Scale of the displacement effect");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "depth");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Depth", "Depth of the solid ground below the water surface");
+ RNA_def_property_ui_range(prop, 0, 250, 1, -1);
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "foam_coverage", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "foam_coverage");
+ RNA_def_property_ui_text(prop, "Foam Coverage", "Amount of generated foam");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "bake_foam_fade", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "foam_fade");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Foam Fade", "How much foam accumulates over time (baked ocean only)");
+ RNA_def_property_ui_range(prop, 0.0, 10.0, 1, -1);
+ RNA_def_property_update(prop, 0, NULL);
+
+ prop = RNA_def_property(srna, "foam_layer_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "foamlayername");
+ RNA_def_property_ui_text(
+ prop, "Foam Layer Name", "Name of the vertex color layer used for foam");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "choppiness", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "chop_amount");
+ RNA_def_property_ui_text(
+ prop,
+ "Choppiness",
+ "Choppiness of the wave's crest (adds some horizontal component to the displacement)");
+ RNA_def_property_ui_range(prop, 0.0, 4.0, 3, -1);
+ RNA_def_property_float_funcs(prop, NULL, "rna_OceanModifier_ocean_chop_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "time");
+ RNA_def_property_ui_text(prop, "Time", "Current time of the simulation");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, -1);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "random_seed", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "seed");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Random Seed", "Seed of the random generator");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "bakestart");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Bake Start", "Start frame of the ocean baking");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "bakeend");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Bake End", "End frame of the ocean baking");
+ RNA_def_property_update(prop, 0, "rna_OceanModifier_init_update");
+
+ prop = RNA_def_property(srna, "is_cached", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cached", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Ocean is Cached", "Whether the ocean is using cached data or simulating");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "cachepath");
+ RNA_def_property_ui_text(prop, "Cache Path", "Path to a folder to store external baked images");
+ /*RNA_def_property_update(prop, 0, "rna_Modifier_update"); */
+ /* XXX how to update? */
}
static void rna_def_modifier_skin(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SkinModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Skin Modifier", "Generate Skin");
- RNA_def_struct_sdna(srna, "SkinModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_SKIN);
-
- prop = RNA_def_property(srna, "branch_smoothing", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Branch Smoothing", "Smooth complex geometry around branches");
- RNA_def_property_ui_range(prop, 0, 1, 1, -1);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SKIN_SMOOTH_SHADING);
- RNA_def_property_ui_text(prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_x_symmetry", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_X);
- RNA_def_property_ui_text(prop, "X", "Avoid making unsymmetrical quads across the X axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_y_symmetry", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_Y);
- RNA_def_property_ui_text(prop, "Y", "Avoid making unsymmetrical quads across the Y axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_z_symmetry", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_Z);
- RNA_def_property_ui_text(prop, "Z", "Avoid making unsymmetrical quads across the Z axis");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SkinModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Skin Modifier", "Generate Skin");
+ RNA_def_struct_sdna(srna, "SkinModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_SKIN);
+
+ prop = RNA_def_property(srna, "branch_smoothing", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(prop, "Branch Smoothing", "Smooth complex geometry around branches");
+ RNA_def_property_ui_range(prop, 0, 1, 1, -1);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_smooth_shade", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_SKIN_SMOOTH_SHADING);
+ RNA_def_property_ui_text(
+ prop, "Smooth Shading", "Output faces with smooth shading rather than flat shaded");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_x_symmetry", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_X);
+ RNA_def_property_ui_text(prop, "X", "Avoid making unsymmetrical quads across the X axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_y_symmetry", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_Y);
+ RNA_def_property_ui_text(prop, "Y", "Avoid making unsymmetrical quads across the Y axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_z_symmetry", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_axes", MOD_SKIN_SYMM_Z);
+ RNA_def_property_ui_text(prop, "Z", "Avoid making unsymmetrical quads across the Z axis");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_triangulate(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TriangulateModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Triangulate Modifier", "Triangulate Mesh");
- RNA_def_struct_sdna(srna, "TriangulateModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
-
- prop = RNA_def_property(srna, "quad_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "quad_method");
- RNA_def_property_enum_items(prop, rna_enum_modifier_triangulate_quad_method_items);
- RNA_def_property_ui_text(prop, "Quad Method", "Method for splitting the quads into triangles");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "ngon_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ngon_method");
- RNA_def_property_enum_items(prop, rna_enum_modifier_triangulate_ngon_method_items);
- RNA_def_property_ui_text(prop, "Polygon Method", "Method for splitting the polygons into triangles");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "min_vertices", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "min_vertices");
- RNA_def_property_range(prop, 4, INT_MAX);
- RNA_def_property_ui_text(prop, "Minimum Vertices", "Triangulate only polygons with vertex count greater than or equal to this number");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "keep_custom_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_TRIANGULATE_KEEP_CUSTOMLOOP_NORMALS);
- RNA_def_property_ui_text(prop, "Keep Normals",
- "Try to preserve custom normals (WARNING: depending on chosen triangulation method, "
- "shading may not be fully preserved, 'Fixed' method usually gives the best result here)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TriangulateModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Triangulate Modifier", "Triangulate Mesh");
+ RNA_def_struct_sdna(srna, "TriangulateModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
+
+ prop = RNA_def_property(srna, "quad_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "quad_method");
+ RNA_def_property_enum_items(prop, rna_enum_modifier_triangulate_quad_method_items);
+ RNA_def_property_ui_text(prop, "Quad Method", "Method for splitting the quads into triangles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "ngon_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ngon_method");
+ RNA_def_property_enum_items(prop, rna_enum_modifier_triangulate_ngon_method_items);
+ RNA_def_property_ui_text(
+ prop, "Polygon Method", "Method for splitting the polygons into triangles");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "min_vertices", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "min_vertices");
+ RNA_def_property_range(prop, 4, INT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Minimum Vertices",
+ "Triangulate only polygons with vertex count greater than or equal to this number");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "keep_custom_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_TRIANGULATE_KEEP_CUSTOMLOOP_NORMALS);
+ RNA_def_property_ui_text(
+ prop,
+ "Keep Normals",
+ "Try to preserve custom normals (WARNING: depending on chosen triangulation method, "
+ "shading may not be fully preserved, 'Fixed' method usually gives the best result here)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_meshcache(BlenderRNA *brna)
{
- static const EnumPropertyItem prop_format_type_items[] = {
- {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""},
- {MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_deform_mode_items[] = {
- {MOD_MESHCACHE_DEFORM_OVERWRITE, "OVERWRITE", 0, "Overwrite",
- "Replace vertex coords with cached values"},
- {MOD_MESHCACHE_DEFORM_INTEGRATE, "INTEGRATE", 0, "Integrate",
- "Integrate deformation from this modifiers input with the mesh-cache coords (useful for shape keys)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_interpolation_type_items[] = {
- {MOD_MESHCACHE_INTERP_NONE, "NONE", 0, "None ", ""},
- {MOD_MESHCACHE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
- /* for cardinal we'd need to read 4x cache's */
- // {MOD_MESHCACHE_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_time_type_items[] = {
- /* use 'eval_frame' */
- {MOD_MESHCACHE_TIME_FRAME, "FRAME", 0, "Frame", "Control playback using a frame-number "
- "(ignoring time FPS and start frame from the file)"},
- /* use 'eval_time' */
- {MOD_MESHCACHE_TIME_SECONDS, "TIME", 0, "Time", "Control playback using time in seconds"},
- /* use 'eval_factor' */
- {MOD_MESHCACHE_TIME_FACTOR, "FACTOR", 0, "Factor", "Control playback using a value between [0, 1]"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_time_play_items[] = {
- {MOD_MESHCACHE_PLAY_CFEA, "SCENE", 0, "Scene", "Use the time from the scene"},
- {MOD_MESHCACHE_PLAY_EVAL, "CUSTOM", 0, "Custom", "Use the modifier's own time evaluation"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshCacheModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh");
- RNA_def_struct_sdna(srna, "MeshCacheModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
-
- prop = RNA_def_property(srna, "cache_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_format_type_items);
- RNA_def_property_ui_text(prop, "Format", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "interp");
- RNA_def_property_enum_items(prop, prop_interpolation_type_items);
- RNA_def_property_ui_text(prop, "Interpolation", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "time_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "time_mode");
- RNA_def_property_enum_items(prop, prop_time_type_items);
- RNA_def_property_ui_text(prop, "Time Mode", "Method to control playback time");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "play_mode");
- RNA_def_property_enum_items(prop, prop_time_play_items);
- RNA_def_property_ui_text(prop, "Time Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "deform_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "deform_mode");
- RNA_def_property_enum_items(prop, prop_deform_mode_items);
- RNA_def_property_ui_text(prop, "Deform Mode", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Influence", "Influence of the deformation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* -------------------------------------------------------------------- */
- /* Axis Conversion */
- prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
- RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Forward", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "up_axis");
- RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Up", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "flip_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "flip_axis");
- RNA_def_property_enum_items(prop, rna_enum_axis_flag_xyz_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Flip Axis", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* -------------------------------------------------------------------- */
- /* For Scene time */
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "frame_start");
- RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Frame Start", "Add this to the start frame");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "frame_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frame_scale");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* -------------------------------------------------------------------- */
- /* eval values depend on 'time_mode' */
- prop = RNA_def_property(srna, "eval_frame", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "eval_frame");
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Evaluation Frame", "The frame to evaluate (starting at 0)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "eval_time");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time in seconds");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "eval_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "eval_factor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Evaluation Factor", "Evaluation time in seconds");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ static const EnumPropertyItem prop_format_type_items[] = {
+ {MOD_MESHCACHE_TYPE_MDD, "MDD", 0, "MDD ", ""},
+ {MOD_MESHCACHE_TYPE_PC2, "PC2", 0, "PC2", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_deform_mode_items[] = {
+ {MOD_MESHCACHE_DEFORM_OVERWRITE,
+ "OVERWRITE",
+ 0,
+ "Overwrite",
+ "Replace vertex coords with cached values"},
+ {MOD_MESHCACHE_DEFORM_INTEGRATE,
+ "INTEGRATE",
+ 0,
+ "Integrate",
+ "Integrate deformation from this modifiers input with the mesh-cache coords (useful for "
+ "shape keys)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_interpolation_type_items[] = {
+ {MOD_MESHCACHE_INTERP_NONE, "NONE", 0, "None ", ""},
+ {MOD_MESHCACHE_INTERP_LINEAR, "LINEAR", 0, "Linear", ""},
+ /* for cardinal we'd need to read 4x cache's */
+ // {MOD_MESHCACHE_INTERP_CARDINAL, "CARDINAL", 0, "Cardinal", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_time_type_items[] = {
+ /* use 'eval_frame' */
+ {MOD_MESHCACHE_TIME_FRAME,
+ "FRAME",
+ 0,
+ "Frame",
+ "Control playback using a frame-number "
+ "(ignoring time FPS and start frame from the file)"},
+ /* use 'eval_time' */
+ {MOD_MESHCACHE_TIME_SECONDS, "TIME", 0, "Time", "Control playback using time in seconds"},
+ /* use 'eval_factor' */
+ {MOD_MESHCACHE_TIME_FACTOR,
+ "FACTOR",
+ 0,
+ "Factor",
+ "Control playback using a value between [0, 1]"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_time_play_items[] = {
+ {MOD_MESHCACHE_PLAY_CFEA, "SCENE", 0, "Scene", "Use the time from the scene"},
+ {MOD_MESHCACHE_PLAY_EVAL, "CUSTOM", 0, "Custom", "Use the modifier's own time evaluation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshCacheModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh");
+ RNA_def_struct_sdna(srna, "MeshCacheModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
+
+ prop = RNA_def_property(srna, "cache_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_format_type_items);
+ RNA_def_property_ui_text(prop, "Format", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "interp");
+ RNA_def_property_enum_items(prop, prop_interpolation_type_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "time_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "time_mode");
+ RNA_def_property_enum_items(prop, prop_time_type_items);
+ RNA_def_property_ui_text(prop, "Time Mode", "Method to control playback time");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "play_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "play_mode");
+ RNA_def_property_enum_items(prop, prop_time_play_items);
+ RNA_def_property_ui_text(prop, "Time Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "deform_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "deform_mode");
+ RNA_def_property_enum_items(prop, prop_deform_mode_items);
+ RNA_def_property_ui_text(prop, "Deform Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "File Path", "Path to external displacements file");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Influence", "Influence of the deformation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------------------------------------------------- */
+ /* Axis Conversion */
+ prop = RNA_def_property(srna, "forward_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "forward_axis");
+ RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(prop, "Forward", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "up_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "up_axis");
+ RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(prop, "Up", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "flip_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "flip_axis");
+ RNA_def_property_enum_items(prop, rna_enum_axis_flag_xyz_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Flip Axis", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------------------------------------------------- */
+ /* For Scene time */
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "frame_start");
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Frame Start", "Add this to the start frame");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "frame_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frame_scale");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Frame Scale", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* -------------------------------------------------------------------- */
+ /* eval values depend on 'time_mode' */
+ prop = RNA_def_property(srna, "eval_frame", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eval_frame");
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Evaluation Frame", "The frame to evaluate (starting at 0)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "eval_time", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "eval_time");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Evaluation Time", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "eval_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "eval_factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Evaluation Factor", "Evaluation time in seconds");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_meshseqcache(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MeshSequenceCacheModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh");
- RNA_def_struct_sdna(srna, "MeshSeqCacheModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
-
- prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "cache_file");
- RNA_def_property_struct_type(prop, "CacheFile");
- RNA_def_property_ui_text(prop, "Cache File", "");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object Path", "Path to the object in the Alembic archive used to lookup geometric data");
- RNA_def_property_update(prop, 0, "rna_MeshSequenceCache_object_path_update");
-
- static const EnumPropertyItem read_flag_items[] = {
- {MOD_MESHSEQ_READ_VERT, "VERT", 0, "Vertex", ""},
- {MOD_MESHSEQ_READ_POLY, "POLY", 0, "Faces", ""},
- {MOD_MESHSEQ_READ_UV, "UV", 0, "UV", ""},
- {MOD_MESHSEQ_READ_COLOR, "COLOR", 0, "Color", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "read_data", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_sdna(prop, NULL, "read_flag");
- RNA_def_property_enum_items(prop, read_flag_items);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MeshSequenceCacheModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Cache Modifier", "Cache Mesh");
+ RNA_def_struct_sdna(srna, "MeshSeqCacheModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM); /* XXX, needs own icon */
+
+ prop = RNA_def_property(srna, "cache_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "cache_file");
+ RNA_def_property_struct_type(prop, "CacheFile");
+ RNA_def_property_ui_text(prop, "Cache File", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "object_path", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Object Path",
+ "Path to the object in the Alembic archive used to lookup geometric data");
+ RNA_def_property_update(prop, 0, "rna_MeshSequenceCache_object_path_update");
+
+ static const EnumPropertyItem read_flag_items[] = {
+ {MOD_MESHSEQ_READ_VERT, "VERT", 0, "Vertex", ""},
+ {MOD_MESHSEQ_READ_POLY, "POLY", 0, "Faces", ""},
+ {MOD_MESHSEQ_READ_UV, "UV", 0, "UV", ""},
+ {MOD_MESHSEQ_READ_COLOR, "COLOR", 0, "Color", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "read_data", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_sdna(prop, NULL, "read_flag");
+ RNA_def_property_enum_items(prop, read_flag_items);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_laplaciandeform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "LaplacianDeformModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Laplacian Deform Modifier", "Mesh deform modifier");
- RNA_def_struct_sdna(srna, "LaplacianDeformModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "anchor_grp_name");
- RNA_def_property_ui_text(prop, "Vertex Group for Anchors",
- "Name of Vertex Group which determines Anchors");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_LaplacianDeformModifier_anchor_grp_name_set");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "repeat");
- RNA_def_property_ui_range(prop, 1, 50, 1, -1);
- RNA_def_property_ui_text(prop, "Repeat", "");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_LaplacianDeformModifier_is_bind_get", NULL);
- RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to anchors");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "LaplacianDeformModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Laplacian Deform Modifier", "Mesh deform modifier");
+ RNA_def_struct_sdna(srna, "LaplacianDeformModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "anchor_grp_name");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group for Anchors", "Name of Vertex Group which determines Anchors");
+ RNA_def_property_string_funcs(
+ prop, NULL, NULL, "rna_LaplacianDeformModifier_anchor_grp_name_set");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "repeat");
+ RNA_def_property_ui_range(prop, 1, 50, 1, -1);
+ RNA_def_property_ui_text(prop, "Repeat", "");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "is_bind", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_LaplacianDeformModifier_is_bind_get", NULL);
+ RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to anchors");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_wireframe(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "WireframeModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Wireframe Modifier", "Wireframe effect modifier");
- RNA_def_struct_sdna(srna, "WireframeModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_WIREFRAME);
-
-
- prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 4);
- RNA_def_property_ui_text(prop, "Thickness", "Thickness factor");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Vertex Group Factor",
- "Thickness factor to use for zero vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "offset_fac");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
- RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_replace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_REPLACE);
- RNA_def_property_ui_text(prop, "Replace", "Remove original geometry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_boundary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_BOUNDARY);
- RNA_def_property_ui_text(prop, "Boundary", "Support face boundaries");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_OFS_EVEN);
- RNA_def_property_ui_text(prop, "Offset Even", "Scale the offset to give more even thickness");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_OFS_RELATIVE);
- RNA_def_property_ui_text(prop, "Offset Relative", "Scale the offset by surrounding geometry");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_CREASE);
- RNA_def_property_ui_text(prop, "Offset Relative", "Crease hub edges for improved subsurf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "crease_weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "crease_weight");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 1);
- RNA_def_property_ui_text(prop, "Weight", "Crease weight (if active)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
- RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for selecting the affected areas");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WireframeModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "WireframeModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "Wireframe Modifier", "Wireframe effect modifier");
+ RNA_def_struct_sdna(srna, "WireframeModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_WIREFRAME);
+
+ prop = RNA_def_property(srna, "thickness", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 4);
+ RNA_def_property_ui_text(prop, "Thickness", "Thickness factor");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "thickness_vertex_group", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_fac_vg");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Factor", "Thickness factor to use for zero vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "offset_fac");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1, 1, 0.1, 4);
+ RNA_def_property_ui_text(prop, "Offset", "Offset the thickness from the center");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_replace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_REPLACE);
+ RNA_def_property_ui_text(prop, "Replace", "Remove original geometry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Boundary", "Support face boundaries");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_even_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_OFS_EVEN);
+ RNA_def_property_ui_text(prop, "Offset Even", "Scale the offset to give more even thickness");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_relative_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_OFS_RELATIVE);
+ RNA_def_property_ui_text(prop, "Offset Relative", "Scale the offset by surrounding geometry");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_CREASE);
+ RNA_def_property_ui_text(prop, "Offset Relative", "Crease hub edges for improved subsurf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "crease_weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "crease_weight");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 1);
+ RNA_def_property_ui_text(prop, "Weight", "Crease weight (if active)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "material_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mat_ofs");
+ RNA_def_property_range(prop, SHRT_MIN, SHRT_MAX);
+ RNA_def_property_ui_text(prop, "Material Offset", "Offset material index of generated faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group", "Vertex group name for selecting the affected areas");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WireframeModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WIREFRAME_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_datatransfer(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem DT_layer_vert_items[] = {
- {DT_TYPE_MDEFORMVERT, "VGROUP_WEIGHTS", 0, "Vertex Group(s)", "Transfer active or all vertex groups"},
-#if 0 /* TODO */
- {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
-#endif
-#if 0 /* XXX When SkinModifier is enabled, it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
- {DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
-#endif
- {DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem DT_layer_edge_items[] = {
- {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"},
- {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"},
- {DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"},
- {DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"},
- {DT_TYPE_FREESTYLE_EDGE, "FREESTYLE_EDGE", 0, "Freestyle Mark", "Transfer Freestyle edge mark"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem DT_layer_loop_items[] = {
- {DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"},
- {DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"},
- {DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem DT_layer_poly_items[] = {
- {DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"},
- {DT_TYPE_FREESTYLE_FACE, "FREESTYLE_FACE", 0, "Freestyle Mark", "Transfer Freestyle face mark"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "DataTransferModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Data Transfer Modifier", "Modifier transferring some data from a source mesh");
- RNA_def_struct_sdna(srna, "DataTransferModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_DATA_TRANSFER);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob_source");
- RNA_def_property_ui_text(prop, "Source Object", "Object to transfer data from");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_DataTransferModifier_ob_source_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_boolean(srna, "use_object_transform", true, "Object Transform",
- "Evaluate source and destination meshes in global space");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_OBSRC_TRANSFORM);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Generic, UI-only data types toggles. */
- prop = RNA_def_boolean(srna, "use_vert_data", false, "Vertex Data", "Enable vertex data transfer");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_VERT);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
-
- prop = RNA_def_boolean(srna, "use_edge_data", false, "Edge Data", "Enable edge data transfer");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_EDGE);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
-
- prop = RNA_def_boolean(srna, "use_loop_data", false, "Face Corner Data", "Enable face corner data transfer");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_LOOP);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
-
- prop = RNA_def_boolean(srna, "use_poly_data", false, "Face Data", "Enable face data transfer");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_POLY);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
-
- /* Actual data types selection. */
- prop = RNA_def_enum(srna, "data_types_verts", DT_layer_vert_items, 0, "Vertex Data Types",
- "Which vertex data layers to transfer");
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_sdna(prop, NULL, "data_types");
- RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_verts_data_types_set", NULL);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
-
- prop = RNA_def_enum(srna, "data_types_edges", DT_layer_edge_items, 0, "Edge Data Types",
- "Which edge data layers to transfer");
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_sdna(prop, NULL, "data_types");
- RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_edges_data_types_set", NULL);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
-
- prop = RNA_def_enum(srna, "data_types_loops", DT_layer_loop_items, 0, "Face Corner Data Types",
- "Which face corner data layers to transfer");
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_sdna(prop, NULL, "data_types");
- RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_loops_data_types_set", NULL);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
-
- prop = RNA_def_enum(srna, "data_types_polys", DT_layer_poly_items, 0, "Poly Data Types",
- "Which poly data layers to transfer");
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_sdna(prop, NULL, "data_types");
- RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_polys_data_types_set", NULL);
- RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
-
- /* Mapping methods. */
- prop = RNA_def_enum(srna, "vert_mapping", rna_enum_dt_method_vertex_items, MREMAP_MODE_VERT_NEAREST, "Vertex Mapping",
- "Method used to map source vertices to destination ones");
- RNA_def_property_enum_sdna(prop, NULL, "vmap_mode");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_enum(srna, "edge_mapping", rna_enum_dt_method_edge_items, MREMAP_MODE_EDGE_NEAREST, "Edge Mapping",
- "Method used to map source edges to destination ones");
- RNA_def_property_enum_sdna(prop, NULL, "emap_mode");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_enum(srna, "loop_mapping", rna_enum_dt_method_loop_items, MREMAP_MODE_LOOP_NEAREST_POLYNOR,
- "Face Corner Mapping", "Method used to map source faces' corners to destination ones");
- RNA_def_property_enum_sdna(prop, NULL, "lmap_mode");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_enum(srna, "poly_mapping", rna_enum_dt_method_poly_items, MREMAP_MODE_POLY_NEAREST, "Face Mapping",
- "Method used to map source faces to destination ones");
- RNA_def_property_enum_sdna(prop, NULL, "pmap_mode");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Mapping options and filtering. */
- prop = RNA_def_boolean(srna, "use_max_distance", false, "Only Neighbor Geometry",
- "Source elements must be closer than given distance from destination one");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_MAP_MAXDIST);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float(srna, "max_distance", 1.0f, 0.0f, FLT_MAX, "Max Distance",
- "Maximum allowed distance between source and destination element, for non-topology mappings",
- 0.0f, 100.0f);
- RNA_def_property_float_sdna(prop, NULL, "map_max_distance");
- RNA_def_property_subtype(prop, PROP_DISTANCE);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float(srna, "ray_radius", 0.0f, 0.0f, FLT_MAX, "Ray Radius",
- "'Width' of rays (especially useful when raycasting against vertices or edges)", 0.0f, 10.0f);
- RNA_def_property_float_sdna(prop, NULL, "map_ray_radius");
- RNA_def_property_subtype(prop, PROP_DISTANCE);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float(srna, "islands_precision", 0.0f, 0.0f, 1.0f, "Islands Handling Refinement",
- "Factor controlling precision of islands handling "
- "(typically, 0.1 should be enough, higher values can make things really slow)", 0.0f, 1.0f);
- RNA_def_property_subtype(prop, PROP_DISTANCE);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* How to handle multi-layers types of data. */
- prop = RNA_def_enum(srna, "layers_vgroup_select_src", rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC,
- "Source Layers Selection", "Which layers to transfer, in case of multi-layers types");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_MDEFORMVERT]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-#if 0
- prop = RNA_def_enum(srna, "layers_shapekey_select_src", rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC,
- "Source Layers Selection", "Which layers to transfer, in case of multi-layers types");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_SHAPEKEY]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-#endif
-
- prop = RNA_def_enum(srna, "layers_vcol_select_src", rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC,
- "Source Layers Selection", "Which layers to transfer, in case of multi-layers types");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_VCOL]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_enum(srna, "layers_uv_select_src", rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC,
- "Source Layers Selection", "Which layers to transfer, in case of multi-layers types");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_UV]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_enum(srna, "layers_vgroup_select_dst", rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST,
- "Destination Layers Matching", "How to match source and destination layers");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_MDEFORMVERT]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
-#if 0
- prop = RNA_def_enum(srna, "layers_shapekey_select_dst", rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST,
- "Destination Layers Matching", "How to match source and destination layers");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_SHAPEKEY]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-#endif
-
- prop = RNA_def_enum(srna, "layers_vcol_select_dst", rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST,
- "Destination Layers Matching", "How to match source and destination layers");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_VCOL]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_enum(srna, "layers_uv_select_dst", rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST,
- "Destination Layers Matching", "How to match source and destination layers");
- RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_UV]");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* Mix stuff */
- prop = RNA_def_enum(srna, "mix_mode", rna_enum_dt_mix_mode_items, CDT_MIX_TRANSFER, "Mix Mode",
- "How to affect destination elements with source values");
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_mix_mode_itemf");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float_factor(srna, "mix_factor", 1.0f, 0.0f, 1.0f, "Mix Factor",
- "Factor to use when applying data to destination (exact behavior depends on mix mode)",
- 0.0f, 1.0f);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_string(srna, "vertex_group", NULL, MAX_VGROUP_NAME, "Vertex Group",
- "Vertex group name for selecting the affected areas");
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DataTransferModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_boolean(srna, "invert_vertex_group", false, "Invert", "Invert vertex group influence");
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_INVERT_VGROUP);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem DT_layer_vert_items[] = {
+ {DT_TYPE_MDEFORMVERT,
+ "VGROUP_WEIGHTS",
+ 0,
+ "Vertex Group(s)",
+ "Transfer active or all vertex groups"},
+# if 0 /* TODO */
+ {DT_TYPE_SHAPEKEY, "SHAPEKEYS", 0, "Shapekey(s)", "Transfer active or all shape keys"},
+# endif
+# if 0 /* XXX When SkinModifier is enabled, it seems to erase its own CD_MVERT_SKIN layer from final DM :( */
+ {DT_TYPE_SKIN, "SKIN", 0, "Skin Weight", "Transfer skin weights"},
+# endif
+ {DT_TYPE_BWEIGHT_VERT, "BEVEL_WEIGHT_VERT", 0, "Bevel Weight", "Transfer bevel weights"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem DT_layer_edge_items[] = {
+ {DT_TYPE_SHARP_EDGE, "SHARP_EDGE", 0, "Sharp", "Transfer sharp mark"},
+ {DT_TYPE_SEAM, "SEAM", 0, "UV Seam", "Transfer UV seam mark"},
+ {DT_TYPE_CREASE, "CREASE", 0, "Subsurf Crease", "Transfer crease values"},
+ {DT_TYPE_BWEIGHT_EDGE, "BEVEL_WEIGHT_EDGE", 0, "Bevel Weight", "Transfer bevel weights"},
+ {DT_TYPE_FREESTYLE_EDGE,
+ "FREESTYLE_EDGE",
+ 0,
+ "Freestyle Mark",
+ "Transfer Freestyle edge mark"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem DT_layer_loop_items[] = {
+ {DT_TYPE_LNOR, "CUSTOM_NORMAL", 0, "Custom Normals", "Transfer custom normals"},
+ {DT_TYPE_VCOL, "VCOL", 0, "VCol", "Vertex (face corners) colors"},
+ {DT_TYPE_UV, "UV", 0, "UVs", "Transfer UV layers"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem DT_layer_poly_items[] = {
+ {DT_TYPE_SHARP_FACE, "SMOOTH", 0, "Smooth", "Transfer flat/smooth mark"},
+ {DT_TYPE_FREESTYLE_FACE,
+ "FREESTYLE_FACE",
+ 0,
+ "Freestyle Mark",
+ "Transfer Freestyle face mark"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "DataTransferModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "Data Transfer Modifier", "Modifier transferring some data from a source mesh");
+ RNA_def_struct_sdna(srna, "DataTransferModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_DATA_TRANSFER);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob_source");
+ RNA_def_property_ui_text(prop, "Source Object", "Object to transfer data from");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_DataTransferModifier_ob_source_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_boolean(srna,
+ "use_object_transform",
+ true,
+ "Object Transform",
+ "Evaluate source and destination meshes in global space");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_OBSRC_TRANSFORM);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Generic, UI-only data types toggles. */
+ prop = RNA_def_boolean(
+ srna, "use_vert_data", false, "Vertex Data", "Enable vertex data transfer");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_VERT);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
+
+ prop = RNA_def_boolean(srna, "use_edge_data", false, "Edge Data", "Enable edge data transfer");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_EDGE);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
+
+ prop = RNA_def_boolean(
+ srna, "use_loop_data", false, "Face Corner Data", "Enable face corner data transfer");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_LOOP);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
+
+ prop = RNA_def_boolean(srna, "use_poly_data", false, "Face Data", "Enable face data transfer");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_USE_POLY);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_use_data_update");
+
+ /* Actual data types selection. */
+ prop = RNA_def_enum(srna,
+ "data_types_verts",
+ DT_layer_vert_items,
+ 0,
+ "Vertex Data Types",
+ "Which vertex data layers to transfer");
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_sdna(prop, NULL, "data_types");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_verts_data_types_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
+
+ prop = RNA_def_enum(srna,
+ "data_types_edges",
+ DT_layer_edge_items,
+ 0,
+ "Edge Data Types",
+ "Which edge data layers to transfer");
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_sdna(prop, NULL, "data_types");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_edges_data_types_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
+
+ prop = RNA_def_enum(srna,
+ "data_types_loops",
+ DT_layer_loop_items,
+ 0,
+ "Face Corner Data Types",
+ "Which face corner data layers to transfer");
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_sdna(prop, NULL, "data_types");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_loops_data_types_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
+
+ prop = RNA_def_enum(srna,
+ "data_types_polys",
+ DT_layer_poly_items,
+ 0,
+ "Poly Data Types",
+ "Which poly data layers to transfer");
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_sdna(prop, NULL, "data_types");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_DataTransferModifier_polys_data_types_set", NULL);
+ RNA_def_property_update(prop, 0, "rna_DataTransferModifier_data_types_update");
+
+ /* Mapping methods. */
+ prop = RNA_def_enum(srna,
+ "vert_mapping",
+ rna_enum_dt_method_vertex_items,
+ MREMAP_MODE_VERT_NEAREST,
+ "Vertex Mapping",
+ "Method used to map source vertices to destination ones");
+ RNA_def_property_enum_sdna(prop, NULL, "vmap_mode");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_enum(srna,
+ "edge_mapping",
+ rna_enum_dt_method_edge_items,
+ MREMAP_MODE_EDGE_NEAREST,
+ "Edge Mapping",
+ "Method used to map source edges to destination ones");
+ RNA_def_property_enum_sdna(prop, NULL, "emap_mode");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_enum(srna,
+ "loop_mapping",
+ rna_enum_dt_method_loop_items,
+ MREMAP_MODE_LOOP_NEAREST_POLYNOR,
+ "Face Corner Mapping",
+ "Method used to map source faces' corners to destination ones");
+ RNA_def_property_enum_sdna(prop, NULL, "lmap_mode");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_enum(srna,
+ "poly_mapping",
+ rna_enum_dt_method_poly_items,
+ MREMAP_MODE_POLY_NEAREST,
+ "Face Mapping",
+ "Method used to map source faces to destination ones");
+ RNA_def_property_enum_sdna(prop, NULL, "pmap_mode");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Mapping options and filtering. */
+ prop = RNA_def_boolean(
+ srna,
+ "use_max_distance",
+ false,
+ "Only Neighbor Geometry",
+ "Source elements must be closer than given distance from destination one");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_MAP_MAXDIST);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float(
+ srna,
+ "max_distance",
+ 1.0f,
+ 0.0f,
+ FLT_MAX,
+ "Max Distance",
+ "Maximum allowed distance between source and destination element, for non-topology mappings",
+ 0.0f,
+ 100.0f);
+ RNA_def_property_float_sdna(prop, NULL, "map_max_distance");
+ RNA_def_property_subtype(prop, PROP_DISTANCE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float(
+ srna,
+ "ray_radius",
+ 0.0f,
+ 0.0f,
+ FLT_MAX,
+ "Ray Radius",
+ "'Width' of rays (especially useful when raycasting against vertices or edges)",
+ 0.0f,
+ 10.0f);
+ RNA_def_property_float_sdna(prop, NULL, "map_ray_radius");
+ RNA_def_property_subtype(prop, PROP_DISTANCE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float(
+ srna,
+ "islands_precision",
+ 0.0f,
+ 0.0f,
+ 1.0f,
+ "Islands Handling Refinement",
+ "Factor controlling precision of islands handling "
+ "(typically, 0.1 should be enough, higher values can make things really slow)",
+ 0.0f,
+ 1.0f);
+ RNA_def_property_subtype(prop, PROP_DISTANCE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* How to handle multi-layers types of data. */
+ prop = RNA_def_enum(srna,
+ "layers_vgroup_select_src",
+ rna_enum_dt_layers_select_src_items,
+ DT_LAYERS_ALL_SRC,
+ "Source Layers Selection",
+ "Which layers to transfer, in case of multi-layers types");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_MDEFORMVERT]");
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+# if 0
+ prop = RNA_def_enum(srna, "layers_shapekey_select_src", rna_enum_dt_layers_select_src_items, DT_LAYERS_ALL_SRC,
+ "Source Layers Selection", "Which layers to transfer, in case of multi-layers types");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_SHAPEKEY]");
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+# endif
+
+ prop = RNA_def_enum(srna,
+ "layers_vcol_select_src",
+ rna_enum_dt_layers_select_src_items,
+ DT_LAYERS_ALL_SRC,
+ "Source Layers Selection",
+ "Which layers to transfer, in case of multi-layers types");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_VCOL]");
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_enum(srna,
+ "layers_uv_select_src",
+ rna_enum_dt_layers_select_src_items,
+ DT_LAYERS_ALL_SRC,
+ "Source Layers Selection",
+ "Which layers to transfer, in case of multi-layers types");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_src[DT_MULTILAYER_INDEX_UV]");
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_DataTransferModifier_layers_select_src_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_enum(srna,
+ "layers_vgroup_select_dst",
+ rna_enum_dt_layers_select_dst_items,
+ DT_LAYERS_NAME_DST,
+ "Destination Layers Matching",
+ "How to match source and destination layers");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_MDEFORMVERT]");
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+# if 0
+ prop = RNA_def_enum(srna, "layers_shapekey_select_dst", rna_enum_dt_layers_select_dst_items, DT_LAYERS_NAME_DST,
+ "Destination Layers Matching", "How to match source and destination layers");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_SHAPEKEY]");
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+# endif
+
+ prop = RNA_def_enum(srna,
+ "layers_vcol_select_dst",
+ rna_enum_dt_layers_select_dst_items,
+ DT_LAYERS_NAME_DST,
+ "Destination Layers Matching",
+ "How to match source and destination layers");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_VCOL]");
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_enum(srna,
+ "layers_uv_select_dst",
+ rna_enum_dt_layers_select_dst_items,
+ DT_LAYERS_NAME_DST,
+ "Destination Layers Matching",
+ "How to match source and destination layers");
+ RNA_def_property_enum_sdna(prop, NULL, "layers_select_dst[DT_MULTILAYER_INDEX_UV]");
+ RNA_def_property_enum_funcs(
+ prop, NULL, NULL, "rna_DataTransferModifier_layers_select_dst_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* Mix stuff */
+ prop = RNA_def_enum(srna,
+ "mix_mode",
+ rna_enum_dt_mix_mode_items,
+ CDT_MIX_TRANSFER,
+ "Mix Mode",
+ "How to affect destination elements with source values");
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_DataTransferModifier_mix_mode_itemf");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float_factor(
+ srna,
+ "mix_factor",
+ 1.0f,
+ 0.0f,
+ 1.0f,
+ "Mix Factor",
+ "Factor to use when applying data to destination (exact behavior depends on mix mode)",
+ 0.0f,
+ 1.0f);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_string(srna,
+ "vertex_group",
+ NULL,
+ MAX_VGROUP_NAME,
+ "Vertex Group",
+ "Vertex group name for selecting the affected areas");
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_DataTransferModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_boolean(
+ srna, "invert_vertex_group", false, "Invert", "Invert vertex group influence");
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_DATATRANSFER_INVERT_VGROUP);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_normaledit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_mode_items[] = {
- {MOD_NORMALEDIT_MODE_RADIAL, "RADIAL", 0, "Radial",
- "From an ellipsoid (shape defined by the boundbox's dimensions, target is optional)"},
- {MOD_NORMALEDIT_MODE_DIRECTIONAL, "DIRECTIONAL", 0, "Directional",
- "Normals 'track' (point to) the target object"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_mix_mode_items[] = {
- {MOD_NORMALEDIT_MIX_COPY, "COPY", 0, "Copy", "Copy new normals (overwrite existing)"},
- {MOD_NORMALEDIT_MIX_ADD, "ADD", 0, "Add", "Copy sum of new and old normals"},
- {MOD_NORMALEDIT_MIX_SUB, "SUB", 0, "Subtract", "Copy new normals minus old normals"},
- {MOD_NORMALEDIT_MIX_MUL, "MUL", 0, "Multiply", "Copy product of old and new normals (*not* cross product)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "NormalEditModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "Normal Edit Modifier", "Modifier affecting/generating custom normals");
- RNA_def_struct_sdna(srna, "NormalEditModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_NORMALEDIT);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "How to affect (generate) normals");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float_array(srna, "offset", 3, NULL, -FLT_MAX, FLT_MAX, "Offset",
- "Offset from object's center", -100.0f, 100.0f);
- RNA_def_property_subtype(prop, PROP_COORDS);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mix_mode_items);
- RNA_def_property_ui_text(prop, "Mix Mode", "How to mix generated normals with existing ones");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float(srna, "mix_factor", 1.0f, 0.0f, 1.0f, "Mix Factor",
- "How much of generated normals to mix with exiting ones", 0.0f, 1.0f);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_float(srna, "mix_limit", 1.0f, 0.0f, DEG2RADF(180.0f), "Max Angle",
- "Maximum angle between old and new normals", 0.0f, DEG2RADF(180.0f));
- RNA_def_property_subtype(prop, PROP_ANGLE);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "no_polynors_fix", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_NO_POLYNORS_FIX);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Lock Polygon Normals",
- "Do not flip polygons when their normals are not consistent "
- "with their newly computed custom vertex normals");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for selecting/weighting the affected areas");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NormalEditModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Target", "Target object used to affect normals");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_NormalEditModifier_target_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "use_direction_parallel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_USE_DIRECTION_PARALLEL);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Parallel Normals",
- "Use same direction for all normals, from origin to target's center "
- "(Directional mode only)");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_mode_items[] = {
+ {MOD_NORMALEDIT_MODE_RADIAL,
+ "RADIAL",
+ 0,
+ "Radial",
+ "From an ellipsoid (shape defined by the boundbox's dimensions, target is optional)"},
+ {MOD_NORMALEDIT_MODE_DIRECTIONAL,
+ "DIRECTIONAL",
+ 0,
+ "Directional",
+ "Normals 'track' (point to) the target object"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_mix_mode_items[] = {
+ {MOD_NORMALEDIT_MIX_COPY, "COPY", 0, "Copy", "Copy new normals (overwrite existing)"},
+ {MOD_NORMALEDIT_MIX_ADD, "ADD", 0, "Add", "Copy sum of new and old normals"},
+ {MOD_NORMALEDIT_MIX_SUB, "SUB", 0, "Subtract", "Copy new normals minus old normals"},
+ {MOD_NORMALEDIT_MIX_MUL,
+ "MUL",
+ 0,
+ "Multiply",
+ "Copy product of old and new normals (*not* cross product)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "NormalEditModifier", "Modifier");
+ RNA_def_struct_ui_text(
+ srna, "Normal Edit Modifier", "Modifier affecting/generating custom normals");
+ RNA_def_struct_sdna(srna, "NormalEditModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_NORMALEDIT);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "How to affect (generate) normals");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float_array(srna,
+ "offset",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Offset",
+ "Offset from object's center",
+ -100.0f,
+ 100.0f);
+ RNA_def_property_subtype(prop, PROP_COORDS);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mix_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mix_mode_items);
+ RNA_def_property_ui_text(prop, "Mix Mode", "How to mix generated normals with existing ones");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float(srna,
+ "mix_factor",
+ 1.0f,
+ 0.0f,
+ 1.0f,
+ "Mix Factor",
+ "How much of generated normals to mix with exiting ones",
+ 0.0f,
+ 1.0f);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_float(srna,
+ "mix_limit",
+ 1.0f,
+ 0.0f,
+ DEG2RADF(180.0f),
+ "Max Angle",
+ "Maximum angle between old and new normals",
+ 0.0f,
+ DEG2RADF(180.0f));
+ RNA_def_property_subtype(prop, PROP_ANGLE);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "no_polynors_fix", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_NO_POLYNORS_FIX);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop,
+ "Lock Polygon Normals",
+ "Do not flip polygons when their normals are not consistent "
+ "with their newly computed custom vertex normals");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group", "Vertex group name for selecting/weighting the affected areas");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NormalEditModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Target", "Target object used to affect normals");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_NormalEditModifier_target_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "use_direction_parallel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_NORMALEDIT_USE_DIRECTION_PARALLEL);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop,
+ "Parallel Normals",
+ "Use same direction for all normals, from origin to target's center "
+ "(Directional mode only)");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_surfacedeform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SurfaceDeformModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "SurfaceDeform Modifier", "");
- RNA_def_struct_sdna(srna, "SurfaceDeformModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
-
- prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Target", "Mesh object to deform with");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SurfaceDeformModifier_target_set", NULL, "rna_Mesh_object_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
-
- prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 2.0f, 16.0f);
- RNA_def_property_ui_text(prop, "Interpolation falloff", "Controls how much nearby polygons influence deformation");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SurfaceDeformModifier_is_bound_get", NULL);
- RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to target mesh");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SurfaceDeformModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "SurfaceDeform Modifier", "");
+ RNA_def_struct_sdna(srna, "SurfaceDeformModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_MESHDEFORM);
+
+ prop = RNA_def_property(srna, "target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Target", "Mesh object to deform with");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_SurfaceDeformModifier_target_set", NULL, "rna_Mesh_object_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_Modifier_dependency_update");
+
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 2.0f, 16.0f);
+ RNA_def_property_ui_text(
+ prop, "Interpolation falloff", "Controls how much nearby polygons influence deformation");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "is_bound", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SurfaceDeformModifier_is_bound_get", NULL);
+ RNA_def_property_ui_text(prop, "Bound", "Whether geometry has been bound to target mesh");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_modifier_weightednormal(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem prop_weighting_mode_items[] = {
- {MOD_WEIGHTEDNORMAL_MODE_FACE, "FACE_AREA", 0, "Face Area", "Generate face area weighted normals"},
- {MOD_WEIGHTEDNORMAL_MODE_ANGLE, "CORNER_ANGLE", 0, "Corner Angle", "Generate corner angle weighted normals"},
- {MOD_WEIGHTEDNORMAL_MODE_FACE_ANGLE, "FACE_AREA_WITH_ANGLE", 0, "Face Area And Angle",
- "Generated normals weighted by both face area and angle"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "WeightedNormalModifier", "Modifier");
- RNA_def_struct_ui_text(srna, "WeightedNormal Modifier", "");
- RNA_def_struct_sdna(srna, "WeightedNormalModifierData");
- RNA_def_struct_ui_icon(srna, ICON_MOD_NORMALEDIT);
-
- prop = RNA_def_property(srna, "weight", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Weight",
- "Corrective factor applied to faces' weights, 50 is neutral, "
- "lower values increase weight of weak faces, "
- "higher values increase weight of strong faces");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_weighting_mode_items);
- RNA_def_property_ui_text(prop, "Weighting Mode", "Weighted vertex normal mode to use");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "thresh", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_range(prop, 0, 10, 1, 2);
- RNA_def_property_ui_text(prop, "Threshold", "Threshold value for different weights to be considered equal");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "keep_sharp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_KEEP_SHARP);
- RNA_def_property_ui_text(prop, "Keep Sharp",
- "Keep sharp edges as computed for default split normals, "
- "instead of setting a single weighted normal for each vertex");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
- RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for modifying the selected areas");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightedNormalModifier_defgrp_name_set");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_INVERT_VGROUP);
- RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "face_influence", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_FACE_INFLUENCE);
- RNA_def_property_ui_text(prop, "Face Influence", "Use influence of face for weighting");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem prop_weighting_mode_items[] = {
+ {MOD_WEIGHTEDNORMAL_MODE_FACE,
+ "FACE_AREA",
+ 0,
+ "Face Area",
+ "Generate face area weighted normals"},
+ {MOD_WEIGHTEDNORMAL_MODE_ANGLE,
+ "CORNER_ANGLE",
+ 0,
+ "Corner Angle",
+ "Generate corner angle weighted normals"},
+ {MOD_WEIGHTEDNORMAL_MODE_FACE_ANGLE,
+ "FACE_AREA_WITH_ANGLE",
+ 0,
+ "Face Area And Angle",
+ "Generated normals weighted by both face area and angle"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "WeightedNormalModifier", "Modifier");
+ RNA_def_struct_ui_text(srna, "WeightedNormal Modifier", "");
+ RNA_def_struct_sdna(srna, "WeightedNormalModifierData");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_NORMALEDIT);
+
+ prop = RNA_def_property(srna, "weight", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Weight",
+ "Corrective factor applied to faces' weights, 50 is neutral, "
+ "lower values increase weight of weak faces, "
+ "higher values increase weight of strong faces");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_weighting_mode_items);
+ RNA_def_property_ui_text(prop, "Weighting Mode", "Weighted vertex normal mode to use");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "thresh", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_range(prop, 0, 10, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Threshold", "Threshold value for different weights to be considered equal");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "keep_sharp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_KEEP_SHARP);
+ RNA_def_property_ui_text(prop,
+ "Keep Sharp",
+ "Keep sharp edges as computed for default split normals, "
+ "instead of setting a single weighted normal for each vertex");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "defgrp_name");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group", "Vertex group name for modifying the selected areas");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_WeightedNormalModifier_defgrp_name_set");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "face_influence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_WEIGHTEDNORMAL_FACE_INFLUENCE);
+ RNA_def_property_ui_text(prop, "Face Influence", "Use influence of face for weighting");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
void RNA_def_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* data */
- srna = RNA_def_struct(brna, "Modifier", NULL);
- RNA_def_struct_ui_text(srna, "Modifier", "Modifier affecting the geometry data of an object");
- RNA_def_struct_refine_func(srna, "rna_Modifier_refine");
- RNA_def_struct_path_func(srna, "rna_Modifier_path");
- RNA_def_struct_sdna(srna, "ModifierData");
-
- /* strings */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Modifier_name_set");
- RNA_def_property_ui_text(prop, "Name", "Modifier name");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- /* enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_object_modifier_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
-
- /* flags */
- prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
- RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
-
- prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Render", "Use modifier during render");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
-
- prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode);
- RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode");
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
- RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
-
- prop = RNA_def_property(srna, "show_on_cage", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_OnCage);
- RNA_def_property_ui_text(prop, "On Cage", "Adjust edit cage to modifier result");
- RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- prop = RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline);
- RNA_def_property_ui_text(prop, "Apply on spline",
- "Apply this and all preceding deformation modifiers on splines' points rather than "
- "on filled curve/surface");
- RNA_def_property_ui_icon(prop, ICON_SURFACE_DATA, 0);
- RNA_def_property_update(prop, 0, "rna_Modifier_update");
-
- /* types */
- rna_def_modifier_subsurf(brna);
- rna_def_modifier_lattice(brna);
- rna_def_modifier_curve(brna);
- rna_def_modifier_build(brna);
- rna_def_modifier_mirror(brna);
- rna_def_modifier_decimate(brna);
- rna_def_modifier_wave(brna);
- rna_def_modifier_armature(brna);
- rna_def_modifier_hook(brna);
- rna_def_modifier_softbody(brna);
- rna_def_modifier_boolean(brna);
- rna_def_modifier_array(brna);
- rna_def_modifier_edgesplit(brna);
- rna_def_modifier_displace(brna);
- rna_def_modifier_uvproject(brna);
- rna_def_modifier_smooth(brna);
- rna_def_modifier_correctivesmooth(brna);
- rna_def_modifier_cast(brna);
- rna_def_modifier_meshdeform(brna);
- rna_def_modifier_particlesystem(brna);
- rna_def_modifier_particleinstance(brna);
- rna_def_modifier_explode(brna);
- rna_def_modifier_cloth(brna);
- rna_def_modifier_collision(brna);
- rna_def_modifier_bevel(brna);
- rna_def_modifier_shrinkwrap(brna);
- rna_def_modifier_fluidsim(brna);
- rna_def_modifier_mask(brna);
- rna_def_modifier_simpledeform(brna);
- rna_def_modifier_warp(brna);
- rna_def_modifier_multires(brna);
- rna_def_modifier_surface(brna);
- rna_def_modifier_smoke(brna);
- rna_def_modifier_solidify(brna);
- rna_def_modifier_screw(brna);
- rna_def_modifier_uvwarp(brna);
- rna_def_modifier_weightvgedit(brna);
- rna_def_modifier_weightvgmix(brna);
- rna_def_modifier_weightvgproximity(brna);
- rna_def_modifier_dynamic_paint(brna);
- rna_def_modifier_ocean(brna);
- rna_def_modifier_remesh(brna);
- rna_def_modifier_skin(brna);
- rna_def_modifier_laplaciansmooth(brna);
- rna_def_modifier_triangulate(brna);
- rna_def_modifier_meshcache(brna);
- rna_def_modifier_laplaciandeform(brna);
- rna_def_modifier_wireframe(brna);
- rna_def_modifier_datatransfer(brna);
- rna_def_modifier_normaledit(brna);
- rna_def_modifier_meshseqcache(brna);
- rna_def_modifier_surfacedeform(brna);
- rna_def_modifier_weightednormal(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* data */
+ srna = RNA_def_struct(brna, "Modifier", NULL);
+ RNA_def_struct_ui_text(srna, "Modifier", "Modifier affecting the geometry data of an object");
+ RNA_def_struct_refine_func(srna, "rna_Modifier_refine");
+ RNA_def_struct_path_func(srna, "rna_Modifier_path");
+ RNA_def_struct_sdna(srna, "ModifierData");
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Modifier_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Modifier name");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_object_modifier_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* flags */
+ prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Realtime);
+ RNA_def_property_ui_text(prop, "Realtime", "Display modifier in viewport");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
+
+ prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Render);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Render", "Use modifier during render");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Editmode);
+ RNA_def_property_ui_text(prop, "Edit Mode", "Display modifier in Edit mode");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
+
+ prop = RNA_def_property(srna, "show_on_cage", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_OnCage);
+ RNA_def_property_ui_text(prop, "On Cage", "Adjust edit cage to modifier result");
+ RNA_def_property_ui_icon(prop, ICON_MESH_DATA, 0);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ prop = RNA_def_property(srna, "use_apply_on_spline", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_ApplyOnSpline);
+ RNA_def_property_ui_text(
+ prop,
+ "Apply on spline",
+ "Apply this and all preceding deformation modifiers on splines' points rather than "
+ "on filled curve/surface");
+ RNA_def_property_ui_icon(prop, ICON_SURFACE_DATA, 0);
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
+ /* types */
+ rna_def_modifier_subsurf(brna);
+ rna_def_modifier_lattice(brna);
+ rna_def_modifier_curve(brna);
+ rna_def_modifier_build(brna);
+ rna_def_modifier_mirror(brna);
+ rna_def_modifier_decimate(brna);
+ rna_def_modifier_wave(brna);
+ rna_def_modifier_armature(brna);
+ rna_def_modifier_hook(brna);
+ rna_def_modifier_softbody(brna);
+ rna_def_modifier_boolean(brna);
+ rna_def_modifier_array(brna);
+ rna_def_modifier_edgesplit(brna);
+ rna_def_modifier_displace(brna);
+ rna_def_modifier_uvproject(brna);
+ rna_def_modifier_smooth(brna);
+ rna_def_modifier_correctivesmooth(brna);
+ rna_def_modifier_cast(brna);
+ rna_def_modifier_meshdeform(brna);
+ rna_def_modifier_particlesystem(brna);
+ rna_def_modifier_particleinstance(brna);
+ rna_def_modifier_explode(brna);
+ rna_def_modifier_cloth(brna);
+ rna_def_modifier_collision(brna);
+ rna_def_modifier_bevel(brna);
+ rna_def_modifier_shrinkwrap(brna);
+ rna_def_modifier_fluidsim(brna);
+ rna_def_modifier_mask(brna);
+ rna_def_modifier_simpledeform(brna);
+ rna_def_modifier_warp(brna);
+ rna_def_modifier_multires(brna);
+ rna_def_modifier_surface(brna);
+ rna_def_modifier_smoke(brna);
+ rna_def_modifier_solidify(brna);
+ rna_def_modifier_screw(brna);
+ rna_def_modifier_uvwarp(brna);
+ rna_def_modifier_weightvgedit(brna);
+ rna_def_modifier_weightvgmix(brna);
+ rna_def_modifier_weightvgproximity(brna);
+ rna_def_modifier_dynamic_paint(brna);
+ rna_def_modifier_ocean(brna);
+ rna_def_modifier_remesh(brna);
+ rna_def_modifier_skin(brna);
+ rna_def_modifier_laplaciansmooth(brna);
+ rna_def_modifier_triangulate(brna);
+ rna_def_modifier_meshcache(brna);
+ rna_def_modifier_laplaciandeform(brna);
+ rna_def_modifier_wireframe(brna);
+ rna_def_modifier_datatransfer(brna);
+ rna_def_modifier_normaledit(brna);
+ rna_def_modifier_meshseqcache(brna);
+ rna_def_modifier_surfacedeform(brna);
+ rna_def_modifier_weightednormal(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c
index c7d323f7146..07f7db5cfcd 100644
--- a/source/blender/makesrna/intern/rna_movieclip.c
+++ b/source/blender/makesrna/intern/rna_movieclip.c
@@ -42,355 +42,405 @@
#ifdef RNA_RUNTIME
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_clip.h"
+# include "ED_clip.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
+# include "DNA_screen_types.h"
+# include "DNA_space_types.h"
static void rna_MovieClip_reload_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- BKE_movieclip_reload(bmain, clip);
- DEG_id_tag_update(&clip->id, 0);
+ BKE_movieclip_reload(bmain, clip);
+ DEG_id_tag_update(&clip->id, 0);
}
static void rna_MovieClip_size_get(PointerRNA *ptr, int *values)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- values[0] = clip->lastsize[0];
- values[1] = clip->lastsize[1];
+ values[0] = clip->lastsize[0];
+ values[1] = clip->lastsize[1];
}
static float rna_MovieClip_fps_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- return BKE_movieclip_get_fps(clip);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ return BKE_movieclip_get_fps(clip);
}
-static void rna_MovieClipUser_proxy_render_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_MovieClipUser_proxy_render_settings_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ID *id = (ID *) ptr->id.data;
- MovieClipUser *user = (MovieClipUser *) ptr->data;
-
- /* when changing render settings of space clip user
- * clear cache for clip, so all the memory is available
- * for new render settings
- */
- if (GS(id->name) == ID_SCR) {
- bScreen *screen = (bScreen *) id;
- ScrArea *area;
- SpaceLink *sl;
-
- for (area = screen->areabase.first; area; area = area->next) {
- for (sl = area->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_CLIP) {
- SpaceClip *sc = (SpaceClip *) sl;
-
- if (&sc->user == user) {
- MovieClip *clip = ED_space_clip_get_clip(sc);
-
- if (clip && (clip->flag & MCLIP_USE_PROXY))
- BKE_movieclip_clear_cache(clip);
-
- break;
- }
- }
- }
- }
- }
+ ID *id = (ID *)ptr->id.data;
+ MovieClipUser *user = (MovieClipUser *)ptr->data;
+
+ /* when changing render settings of space clip user
+ * clear cache for clip, so all the memory is available
+ * for new render settings
+ */
+ if (GS(id->name) == ID_SCR) {
+ bScreen *screen = (bScreen *)id;
+ ScrArea *area;
+ SpaceLink *sl;
+
+ for (area = screen->areabase.first; area; area = area->next) {
+ for (sl = area->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_CLIP) {
+ SpaceClip *sc = (SpaceClip *)sl;
+
+ if (&sc->user == user) {
+ MovieClip *clip = ED_space_clip_get_clip(sc);
+
+ if (clip && (clip->flag & MCLIP_USE_PROXY))
+ BKE_movieclip_clear_cache(clip);
+
+ break;
+ }
+ }
+ }
+ }
+ }
}
static PointerRNA rna_MovieClip_metadata_get(MovieClip *clip)
{
- if (clip == NULL || clip->anim == NULL) {
- return PointerRNA_NULL;
- }
-
- IDProperty *metadata = IMB_anim_load_metadata(clip->anim);
- if (metadata == NULL) {
- return PointerRNA_NULL;
- }
-
- PointerRNA ptr;
- RNA_pointer_create(NULL, &RNA_IDPropertyWrapPtr, metadata, &ptr);
- return ptr;
+ if (clip == NULL || clip->anim == NULL) {
+ return PointerRNA_NULL;
+ }
+
+ IDProperty *metadata = IMB_anim_load_metadata(clip->anim);
+ if (metadata == NULL) {
+ return PointerRNA_NULL;
+ }
+
+ PointerRNA ptr;
+ RNA_pointer_create(NULL, &RNA_IDPropertyWrapPtr, metadata, &ptr);
+ return ptr;
}
#else
static void rna_def_movieclip_proxy(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem clip_tc_items[] = {
- {IMB_TC_NONE, "NONE", 0, "No TC in use", ""},
- {IMB_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run", "Use images in the order they are recorded"},
- {IMB_TC_FREE_RUN, "FREE_RUN", 0, "Free Run", "Use global timestamp written by recording device"},
- {IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
- "Interpolate a global timestamp using the record date and time "
- "written by recording device"},
- {IMB_TC_RECORD_RUN_NO_GAPS, "FREE_RUN_NO_GAPS", 0, "Free Run No Gaps",
- "Record run, but ignore timecode, changes in framerate or dropouts"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
- RNA_def_struct_ui_text(srna, "Movie Clip Proxy", "Proxy parameters for a movie clip");
- RNA_def_struct_sdna(srna, "MovieClipProxy");
-
- /* build proxy sized */
- prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original footage dimension");
-
- prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original footage dimension");
-
- prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original footage dimension");
-
- prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "100%", "Build proxy resolution 100% of the original footage dimension");
-
- prop = RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_25);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "25%", "Build proxy resolution 25% of the original undistorted footage dimension");
-
- prop = RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_50);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "50%", "Build proxy resolution 50% of the original undistorted footage dimension");
-
- prop = RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_75);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension");
-
- prop = RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "100%",
- "Build proxy resolution 100% of the original undistorted footage dimension");
-
- /* build timecodes */
- prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
-
- prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
-
- prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
-
- /* quality of proxied image */
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "quality");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images");
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
-
- prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tc");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, clip_tc_items);
- RNA_def_property_ui_text(prop, "Timecode", "");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
-
- /* directory */
- prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "dir");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem clip_tc_items[] = {
+ {IMB_TC_NONE, "NONE", 0, "No TC in use", ""},
+ {IMB_TC_RECORD_RUN,
+ "RECORD_RUN",
+ 0,
+ "Record Run",
+ "Use images in the order they are recorded"},
+ {IMB_TC_FREE_RUN,
+ "FREE_RUN",
+ 0,
+ "Free Run",
+ "Use global timestamp written by recording device"},
+ {IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN,
+ "FREE_RUN_REC_DATE",
+ 0,
+ "Free Run (rec date)",
+ "Interpolate a global timestamp using the record date and time "
+ "written by recording device"},
+ {IMB_TC_RECORD_RUN_NO_GAPS,
+ "FREE_RUN_NO_GAPS",
+ 0,
+ "Free Run No Gaps",
+ "Record run, but ignore timecode, changes in framerate or dropouts"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieClipProxy", NULL);
+ RNA_def_struct_ui_text(srna, "Movie Clip Proxy", "Proxy parameters for a movie clip");
+ RNA_def_struct_sdna(srna, "MovieClipProxy");
+
+ /* build proxy sized */
+ prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_25);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "25%", "Build proxy resolution 25% of the original footage dimension");
+
+ prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_50);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "50%", "Build proxy resolution 50% of the original footage dimension");
+
+ prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_75);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "75%", "Build proxy resolution 75% of the original footage dimension");
+
+ prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_SIZE_100);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "100%", "Build proxy resolution 100% of the original footage dimension");
+
+ prop = RNA_def_property(srna, "build_undistorted_25", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_25);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "25%", "Build proxy resolution 25% of the original undistorted footage dimension");
+
+ prop = RNA_def_property(srna, "build_undistorted_50", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_50);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "50%", "Build proxy resolution 50% of the original undistorted footage dimension");
+
+ prop = RNA_def_property(srna, "build_undistorted_75", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_75);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "75%", "Build proxy resolution 75% of the original undistorted footage dimension");
+
+ prop = RNA_def_property(srna, "build_undistorted_100", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flag", MCLIP_PROXY_UNDISTORTED_SIZE_100);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "100%", "Build proxy resolution 100% of the original undistorted footage dimension");
+
+ /* build timecodes */
+ prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_RECORD_RUN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
+
+ prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flag", IMB_TC_FREE_RUN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
+
+ prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "build_tc_flag", IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
+
+ /* quality of proxied image */
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Quality", "JPEG quality of proxy images");
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+
+ prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tc");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, clip_tc_items);
+ RNA_def_property_ui_text(prop, "Timecode", "");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ /* directory */
+ prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "dir");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
}
static void rna_def_moviecliUser(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem clip_render_size_items[] = {
- {MCLIP_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "25%", ""},
- {MCLIP_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "50%", ""},
- {MCLIP_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "75%", ""},
- {MCLIP_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "100%", ""},
- {MCLIP_PROXY_RENDER_SIZE_FULL, "FULL", 0, "None, full render", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieClipUser", NULL);
- RNA_def_struct_ui_text(srna, "Movie Clip User",
- "Parameters defining how a MovieClip data-block is used by another data-block");
-
- prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "framenr");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Current Frame", "Current frame number in movie or image sequence");
-
- /* render size */
- prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "render_size");
- RNA_def_property_enum_items(prop, clip_render_size_items);
- RNA_def_property_ui_text(prop, "Proxy Render Size",
- "Draw preview using full resolution or different proxy resolutions");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClipUser_proxy_render_settings_update");
-
- /* render undistorted */
- prop = RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT);
- RNA_def_property_ui_text(prop, "Render Undistorted", "Render preview using undistorted proxy");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClipUser_proxy_render_settings_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem clip_render_size_items[] = {
+ {MCLIP_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "25%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "50%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "75%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "100%", ""},
+ {MCLIP_PROXY_RENDER_SIZE_FULL, "FULL", 0, "None, full render", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieClipUser", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "Movie Clip User",
+ "Parameters defining how a MovieClip data-block is used by another data-block");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_text(
+ prop, "Current Frame", "Current frame number in movie or image sequence");
+
+ /* render size */
+ prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "render_size");
+ RNA_def_property_enum_items(prop, clip_render_size_items);
+ RNA_def_property_ui_text(prop,
+ "Proxy Render Size",
+ "Draw preview using full resolution or different proxy resolutions");
+ RNA_def_property_update(
+ prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClipUser_proxy_render_settings_update");
+
+ /* render undistorted */
+ prop = RNA_def_property(srna, "use_render_undistorted", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "render_flag", MCLIP_PROXY_RENDER_UNDISTORT);
+ RNA_def_property_ui_text(prop, "Render Undistorted", "Render preview using undistorted proxy");
+ RNA_def_property_update(
+ prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClipUser_proxy_render_settings_update");
}
static void rna_def_movieClipScopes(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "MovieClipScopes", NULL);
- RNA_def_struct_ui_text(srna, "MovieClipScopes", "Scopes for statistical view of a movie clip");
+ srna = RNA_def_struct(brna, "MovieClipScopes", NULL);
+ RNA_def_struct_ui_text(srna, "MovieClipScopes", "Scopes for statistical view of a movie clip");
}
-
static void rna_def_movieclip(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem clip_source_items[] = {
- {MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
- {MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieClip", "ID");
- RNA_def_struct_ui_text(srna, "MovieClip", "MovieClip data-block referencing an external movie file");
- RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "File Path", "Filename of the movie or sequence file");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
-
- prop = RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTracking");
-
- prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieClipProxy");
-
- /* use proxy */
- prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Proxy / Timecode",
- "Use a preview proxy and/or timecode index for this clip");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- prop = RNA_def_int_vector(srna, "size", 2, NULL, 0, 0, "Size",
- "Width and height in pixels, zero when image data cant be loaded", 0, 0);
- RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "aspx");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, 0.1f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
- RNA_def_property_ui_text(prop, "Display Aspect", "Display Aspect for this clip, does not affect rendering");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* source */
- prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, clip_source_items);
- RNA_def_property_ui_text(prop, "Source", "Where the clip comes from");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* custom proxy directory */
- prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Proxy Custom Directory",
- "Create proxy images in a custom directory (default is movie location)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this movie clip");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* start_frame */
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "start_frame");
- RNA_def_property_ui_text(prop, "Start Frame", "Global scene frame number at which this movie starts playing "
- "(affects all data associated with a clip)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
-
- /* frame_offset */
- prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "frame_offset");
- RNA_def_property_ui_text(prop, "Frame Offset", "Offset of footage first frame relative to it's file name "
- "(affects only how footage is loading, does not change data associated with a clip)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
-
- /* length */
- prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_sdna(prop, NULL, "len");
- RNA_def_property_ui_text(prop, "Duration", "Detected duration of movie clip in frames");
-
- /* FPS */
- prop = RNA_def_property(srna, "fps", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_MovieClip_fps_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Frame Rate", "Detected frame rate of the movie clip in frames per second");
-
- /* color management */
- prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
- RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
- RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
-
- /* metadata */
- func = RNA_def_function(srna, "metadata", "rna_MovieClip_metadata_get");
- RNA_def_function_ui_description(func, "Retrieve metadata of the movie file");
- /* return type */
- parm = RNA_def_pointer(func, "metadata", "IDPropertyWrapPtr", "", "Dict-like object containing the metadata");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- rna_def_animdata_common(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem clip_source_items[] = {
+ {MCLIP_SRC_SEQUENCE, "SEQUENCE", 0, "Image Sequence", "Multiple image files, as a sequence"},
+ {MCLIP_SRC_MOVIE, "MOVIE", 0, "Movie File", "Movie file"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieClip", "ID");
+ RNA_def_struct_ui_text(
+ srna, "MovieClip", "MovieClip data-block referencing an external movie file");
+ RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "File Path", "Filename of the movie or sequence file");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ prop = RNA_def_property(srna, "tracking", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTracking");
+
+ prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieClipProxy");
+
+ /* use proxy */
+ prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this clip");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ prop = RNA_def_int_vector(srna,
+ "size",
+ 2,
+ NULL,
+ 0,
+ 0,
+ "Size",
+ "Width and height in pixels, zero when image data cant be loaded",
+ 0,
+ 0);
+ RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "display_aspect", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "aspx");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.1f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Display Aspect", "Display Aspect for this clip, does not affect rendering");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* source */
+ prop = RNA_def_property(srna, "source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, clip_source_items);
+ RNA_def_property_ui_text(prop, "Source", "Where the clip comes from");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* custom proxy directory */
+ prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MCLIP_USE_PROXY_CUSTOM_DIR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Proxy Custom Directory",
+ "Create proxy images in a custom directory (default is movie location)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this movie clip");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* start_frame */
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "start_frame");
+ RNA_def_property_ui_text(prop,
+ "Start Frame",
+ "Global scene frame number at which this movie starts playing "
+ "(affects all data associated with a clip)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ /* frame_offset */
+ prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "frame_offset");
+ RNA_def_property_ui_text(
+ prop,
+ "Frame Offset",
+ "Offset of footage first frame relative to it's file name "
+ "(affects only how footage is loading, does not change data associated with a clip)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_MovieClip_reload_update");
+
+ /* length */
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_sdna(prop, NULL, "len");
+ RNA_def_property_ui_text(prop, "Duration", "Detected duration of movie clip in frames");
+
+ /* FPS */
+ prop = RNA_def_property(srna, "fps", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_MovieClip_fps_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Frame Rate", "Detected frame rate of the movie clip in frames per second");
+
+ /* color management */
+ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
+
+ /* metadata */
+ func = RNA_def_function(srna, "metadata", "rna_MovieClip_metadata_get");
+ RNA_def_function_ui_description(func, "Retrieve metadata of the movie file");
+ /* return type */
+ parm = RNA_def_pointer(
+ func, "metadata", "IDPropertyWrapPtr", "", "Dict-like object containing the metadata");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ rna_def_animdata_common(srna);
}
void RNA_def_movieclip(BlenderRNA *brna)
{
- rna_def_movieclip(brna);
- rna_def_movieclip_proxy(brna);
- rna_def_moviecliUser(brna);
- rna_def_movieClipScopes(brna);
+ rna_def_movieclip(brna);
+ rna_def_movieclip_proxy(brna);
+ rna_def_moviecliUser(brna);
+ rna_def_movieClipScopes(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_nla.c b/source/blender/makesrna/intern/rna_nla.c
index 5ec46c43734..7573d2cdc05 100644
--- a/source/blender/makesrna/intern/rna_nla.c
+++ b/source/blender/makesrna/intern/rna_nla.c
@@ -39,405 +39,421 @@
#ifdef RNA_RUNTIME
-#include <stdio.h>
-#include <math.h>
+# include <stdio.h>
+# include <math.h>
/* needed for some of the validation stuff... */
-#include "BKE_animsys.h"
-#include "BKE_fcurve.h"
-#include "BKE_nla.h"
+# include "BKE_animsys.h"
+# include "BKE_fcurve.h"
+# include "BKE_nla.h"
-#include "DNA_object_types.h"
+# include "DNA_object_types.h"
-#include "ED_anim_api.h"
+# include "ED_anim_api.h"
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
/* temp constant defined for these funcs only... */
-#define NLASTRIP_MIN_LEN_THRESH 0.1f
+# define NLASTRIP_MIN_LEN_THRESH 0.1f
static void rna_NlaStrip_name_set(PointerRNA *ptr, const char *value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
+ NlaStrip *data = (NlaStrip *)ptr->data;
- /* copy the name first */
- BLI_strncpy_utf8(data->name, value, sizeof(data->name));
+ /* copy the name first */
+ BLI_strncpy_utf8(data->name, value, sizeof(data->name));
- /* validate if there's enough info to do so */
- if (ptr->id.data) {
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
- BKE_nlastrip_validate_name(adt, data);
- }
+ /* validate if there's enough info to do so */
+ if (ptr->id.data) {
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ BKE_nlastrip_validate_name(adt, data);
+ }
}
static char *rna_NlaStrip_path(PointerRNA *ptr)
{
- NlaStrip *strip = (NlaStrip *)ptr->data;
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
-
- /* if we're attached to AnimData, try to resolve path back to AnimData */
- if (adt) {
- NlaTrack *nlt;
- NlaStrip *nls;
-
- for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
- for (nls = nlt->strips.first; nls; nls = nls->next) {
- if (nls == strip) {
- /* XXX but if we animate like this, the control will never work... */
- char name_esc_nlt[sizeof(nlt->name) * 2];
- char name_esc_strip[sizeof(strip->name) * 2];
-
- BLI_strescape(name_esc_nlt, nlt->name, sizeof(name_esc_nlt));
- BLI_strescape(name_esc_strip, strip->name, sizeof(name_esc_strip));
- return BLI_sprintfN("animation_data.nla_tracks[\"%s\"].strips[\"%s\"]",
- name_esc_nlt, name_esc_strip);
- }
- }
- }
- }
-
- /* no path */
- return BLI_strdup("");
+ NlaStrip *strip = (NlaStrip *)ptr->data;
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+
+ /* if we're attached to AnimData, try to resolve path back to AnimData */
+ if (adt) {
+ NlaTrack *nlt;
+ NlaStrip *nls;
+
+ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) {
+ for (nls = nlt->strips.first; nls; nls = nls->next) {
+ if (nls == strip) {
+ /* XXX but if we animate like this, the control will never work... */
+ char name_esc_nlt[sizeof(nlt->name) * 2];
+ char name_esc_strip[sizeof(strip->name) * 2];
+
+ BLI_strescape(name_esc_nlt, nlt->name, sizeof(name_esc_nlt));
+ BLI_strescape(name_esc_strip, strip->name, sizeof(name_esc_strip));
+ return BLI_sprintfN(
+ "animation_data.nla_tracks[\"%s\"].strips[\"%s\"]", name_esc_nlt, name_esc_strip);
+ }
+ }
+ }
+ }
+
+ /* no path */
+ return BLI_strdup("");
}
static void rna_NlaStrip_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- ANIM_id_update(bmain, id);
+ ANIM_id_update(bmain, id);
}
static void rna_NlaStrip_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
- rna_NlaStrip_update(bmain, scene, ptr);
+ rna_NlaStrip_update(bmain, scene, ptr);
}
static void rna_NlaStrip_transform_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- NlaStrip *strip = (NlaStrip *)ptr->data;
+ NlaStrip *strip = (NlaStrip *)ptr->data;
- BKE_nlameta_flush_transforms(strip);
+ BKE_nlameta_flush_transforms(strip);
- /* set the flag */
- if ((strip->flag & NLASTRIP_FLAG_AUTO_BLENDS) && ptr->id.data) {
- /* validate state to ensure that auto-blend gets applied immediately */
- IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
+ /* set the flag */
+ if ((strip->flag & NLASTRIP_FLAG_AUTO_BLENDS) && ptr->id.data) {
+ /* validate state to ensure that auto-blend gets applied immediately */
+ IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
- if (iat->adt) {
- BKE_nla_validate_state(iat->adt);
- }
- }
+ if (iat->adt) {
+ BKE_nla_validate_state(iat->adt);
+ }
+ }
- rna_NlaStrip_update(bmain, scene, ptr);
+ rna_NlaStrip_update(bmain, scene, ptr);
}
static void rna_NlaStrip_start_frame_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
-
- /* clamp value to lie within valid limits
- * - cannot start past the end of the strip + some flexibility threshold
- * - cannot start before the previous strip (if present) ends
- * -> but if it was a transition, we could go up to the start of the strip + some flexibility threshold
- * as long as we re-adjust the transition afterwards
- * - minimum frame is -MAXFRAME so that we don't get clipping on frame 0
- */
- if (data->prev) {
- if (data->prev->type == NLASTRIP_TYPE_TRANSITION) {
- CLAMP(value, data->prev->start + NLASTRIP_MIN_LEN_THRESH, data->end - NLASTRIP_MIN_LEN_THRESH);
-
- /* re-adjust the transition to stick to the endpoints of the action-clips */
- data->prev->end = value;
- }
- else {
- CLAMP(value, data->prev->end, data->end - NLASTRIP_MIN_LEN_THRESH);
- }
- }
- else {
- CLAMP(value, MINAFRAME, data->end);
- }
- data->start = value;
+ NlaStrip *data = (NlaStrip *)ptr->data;
+
+ /* clamp value to lie within valid limits
+ * - cannot start past the end of the strip + some flexibility threshold
+ * - cannot start before the previous strip (if present) ends
+ * -> but if it was a transition, we could go up to the start of the strip + some flexibility threshold
+ * as long as we re-adjust the transition afterwards
+ * - minimum frame is -MAXFRAME so that we don't get clipping on frame 0
+ */
+ if (data->prev) {
+ if (data->prev->type == NLASTRIP_TYPE_TRANSITION) {
+ CLAMP(
+ value, data->prev->start + NLASTRIP_MIN_LEN_THRESH, data->end - NLASTRIP_MIN_LEN_THRESH);
+
+ /* re-adjust the transition to stick to the endpoints of the action-clips */
+ data->prev->end = value;
+ }
+ else {
+ CLAMP(value, data->prev->end, data->end - NLASTRIP_MIN_LEN_THRESH);
+ }
+ }
+ else {
+ CLAMP(value, MINAFRAME, data->end);
+ }
+ data->start = value;
}
static void rna_NlaStrip_end_frame_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
-
- /* clamp value to lie within valid limits
- * - must not have zero or negative length strip, so cannot start before the first frame
- * + some minimum-strip-length threshold
- * - cannot end later than the start of the next strip (if present)
- * -> but if it was a transition, we could go up to the start of the end - some flexibility threshold
- * as long as we re-adjust the transition afterwards
- */
- if (data->next) {
- if (data->next->type == NLASTRIP_TYPE_TRANSITION) {
- CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, data->next->end - NLASTRIP_MIN_LEN_THRESH);
-
- /* readjust the transition to stick to the endpoints of the action-clips */
- data->next->start = value;
- }
- else {
- CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, data->next->start);
- }
- }
- else {
- CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, MAXFRAME);
- }
- data->end = value;
-
-
- /* calculate the lengths the strip and its action (if applicable) */
- if (data->type == NLASTRIP_TYPE_CLIP) {
- float len, actlen;
-
- len = data->end - data->start;
- actlen = data->actend - data->actstart;
- if (IS_EQF(actlen, 0.0f)) actlen = 1.0f;
-
- /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */
- data->scale = len / ((actlen) * data->repeat);
- }
+ NlaStrip *data = (NlaStrip *)ptr->data;
+
+ /* clamp value to lie within valid limits
+ * - must not have zero or negative length strip, so cannot start before the first frame
+ * + some minimum-strip-length threshold
+ * - cannot end later than the start of the next strip (if present)
+ * -> but if it was a transition, we could go up to the start of the end - some flexibility threshold
+ * as long as we re-adjust the transition afterwards
+ */
+ if (data->next) {
+ if (data->next->type == NLASTRIP_TYPE_TRANSITION) {
+ CLAMP(
+ value, data->start + NLASTRIP_MIN_LEN_THRESH, data->next->end - NLASTRIP_MIN_LEN_THRESH);
+
+ /* readjust the transition to stick to the endpoints of the action-clips */
+ data->next->start = value;
+ }
+ else {
+ CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, data->next->start);
+ }
+ }
+ else {
+ CLAMP(value, data->start + NLASTRIP_MIN_LEN_THRESH, MAXFRAME);
+ }
+ data->end = value;
+
+ /* calculate the lengths the strip and its action (if applicable) */
+ if (data->type == NLASTRIP_TYPE_CLIP) {
+ float len, actlen;
+
+ len = data->end - data->start;
+ actlen = data->actend - data->actstart;
+ if (IS_EQF(actlen, 0.0f))
+ actlen = 1.0f;
+
+ /* now, adjust the 'scale' setting to reflect this (so that this change can be valid) */
+ data->scale = len / ((actlen)*data->repeat);
+ }
}
static void rna_NlaStrip_scale_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
+ NlaStrip *data = (NlaStrip *)ptr->data;
- /* set scale value */
- /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
- CLAMP(value, 0.0001f, 1000.0f);
- data->scale = value;
+ /* set scale value */
+ /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ CLAMP(value, 0.0001f, 1000.0f);
+ data->scale = value;
- /* adjust the strip extents in response to this */
- BKE_nlastrip_recalculate_bounds(data);
+ /* adjust the strip extents in response to this */
+ BKE_nlastrip_recalculate_bounds(data);
}
static void rna_NlaStrip_repeat_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
+ NlaStrip *data = (NlaStrip *)ptr->data;
- /* set repeat value */
- /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
- CLAMP(value, 0.01f, 1000.0f);
- data->repeat = value;
+ /* set repeat value */
+ /* NOTE: these need to be synced with the values in the property definition in rna_def_nlastrip() */
+ CLAMP(value, 0.01f, 1000.0f);
+ data->repeat = value;
- /* adjust the strip extents in response to this */
- BKE_nlastrip_recalculate_bounds(data);
+ /* adjust the strip extents in response to this */
+ BKE_nlastrip_recalculate_bounds(data);
}
static void rna_NlaStrip_blend_in_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
- float len;
+ NlaStrip *data = (NlaStrip *)ptr->data;
+ float len;
- /* blend-in is limited to the length of the strip, and also cannot overlap with blendout */
- len = (data->end - data->start) - data->blendout;
- CLAMP(value, 0, len);
+ /* blend-in is limited to the length of the strip, and also cannot overlap with blendout */
+ len = (data->end - data->start) - data->blendout;
+ CLAMP(value, 0, len);
- data->blendin = value;
+ data->blendin = value;
}
static void rna_NlaStrip_blend_out_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
- float len;
+ NlaStrip *data = (NlaStrip *)ptr->data;
+ float len;
- /* blend-out is limited to the length of the strip */
- len = (data->end - data->start);
- CLAMP(value, 0, len);
+ /* blend-out is limited to the length of the strip */
+ len = (data->end - data->start);
+ CLAMP(value, 0, len);
- /* it also cannot overlap with blendin */
- if ((len - value) < data->blendin)
- value = len - data->blendin;
+ /* it also cannot overlap with blendin */
+ if ((len - value) < data->blendin)
+ value = len - data->blendin;
- data->blendout = value;
+ data->blendout = value;
}
static void rna_NlaStrip_use_auto_blend_set(PointerRNA *ptr, bool value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
-
- if (value) {
- /* set the flag */
- data->flag |= NLASTRIP_FLAG_AUTO_BLENDS;
-
- /* validate state to ensure that auto-blend gets applied immediately */
- if (ptr->id.data) {
- IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
-
- if (iat->adt) {
- BKE_nla_validate_state(iat->adt);
- }
- }
- }
- else {
- /* clear the flag */
- data->flag &= ~NLASTRIP_FLAG_AUTO_BLENDS;
-
- /* clear the values too, so that it's clear that there has been an effect */
- /* TODO: it's somewhat debatable whether it's better to leave these in instead... */
- data->blendin = 0.0f;
- data->blendout = 0.0f;
- }
+ NlaStrip *data = (NlaStrip *)ptr->data;
+
+ if (value) {
+ /* set the flag */
+ data->flag |= NLASTRIP_FLAG_AUTO_BLENDS;
+
+ /* validate state to ensure that auto-blend gets applied immediately */
+ if (ptr->id.data) {
+ IdAdtTemplate *iat = (IdAdtTemplate *)ptr->id.data;
+
+ if (iat->adt) {
+ BKE_nla_validate_state(iat->adt);
+ }
+ }
+ }
+ else {
+ /* clear the flag */
+ data->flag &= ~NLASTRIP_FLAG_AUTO_BLENDS;
+
+ /* clear the values too, so that it's clear that there has been an effect */
+ /* TODO: it's somewhat debatable whether it's better to leave these in instead... */
+ data->blendin = 0.0f;
+ data->blendout = 0.0f;
+ }
}
static int rna_NlaStrip_action_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- NlaStrip *strip = (NlaStrip *)ptr->data;
+ NlaStrip *strip = (NlaStrip *)ptr->data;
- /* strip actions shouldn't be editable if NLA tweakmode is on */
- if (ptr->id.data) {
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ /* strip actions shouldn't be editable if NLA tweakmode is on */
+ if (ptr->id.data) {
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
- if (adt) {
- /* active action is only editable when it is not a tweaking strip */
- if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
- return 0;
- }
- }
+ if (adt) {
+ /* active action is only editable when it is not a tweaking strip */
+ if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || (adt->tmpact))
+ return 0;
+ }
+ }
- /* check for clues that strip probably shouldn't be used... */
- if (strip->flag & NLASTRIP_FLAG_TWEAKUSER)
- return 0;
+ /* check for clues that strip probably shouldn't be used... */
+ if (strip->flag & NLASTRIP_FLAG_TWEAKUSER)
+ return 0;
- /* should be ok, though we may still miss some cases */
- return PROP_EDITABLE;
+ /* should be ok, though we may still miss some cases */
+ return PROP_EDITABLE;
}
static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
+ NlaStrip *data = (NlaStrip *)ptr->data;
- /* prevent start frame from occurring after end of action */
- CLAMP(value, MINAFRAME, data->actend);
- data->actstart = value;
+ /* prevent start frame from occurring after end of action */
+ CLAMP(value, MINAFRAME, data->actend);
+ data->actstart = value;
- /* adjust the strip extents in response to this */
- /* TODO: should the strip be moved backwards instead as a special case? */
- BKE_nlastrip_recalculate_bounds(data);
+ /* adjust the strip extents in response to this */
+ /* TODO: should the strip be moved backwards instead as a special case? */
+ BKE_nlastrip_recalculate_bounds(data);
}
static void rna_NlaStrip_action_end_frame_set(PointerRNA *ptr, float value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
+ NlaStrip *data = (NlaStrip *)ptr->data;
- /* prevent end frame from starting before start of action */
- CLAMP(value, data->actstart, MAXFRAME);
- data->actend = value;
+ /* prevent end frame from starting before start of action */
+ CLAMP(value, data->actstart, MAXFRAME);
+ data->actend = value;
- /* adjust the strip extents in response to this */
- BKE_nlastrip_recalculate_bounds(data);
+ /* adjust the strip extents in response to this */
+ BKE_nlastrip_recalculate_bounds(data);
}
static void rna_NlaStrip_animated_influence_set(PointerRNA *ptr, bool value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
-
- if (value) {
- /* set the flag, then make sure a curve for this exists */
- data->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
- BKE_nlastrip_validate_fcurves(data);
- }
- else
- data->flag &= ~NLASTRIP_FLAG_USR_INFLUENCE;
+ NlaStrip *data = (NlaStrip *)ptr->data;
+
+ if (value) {
+ /* set the flag, then make sure a curve for this exists */
+ data->flag |= NLASTRIP_FLAG_USR_INFLUENCE;
+ BKE_nlastrip_validate_fcurves(data);
+ }
+ else
+ data->flag &= ~NLASTRIP_FLAG_USR_INFLUENCE;
}
static void rna_NlaStrip_animated_time_set(PointerRNA *ptr, bool value)
{
- NlaStrip *data = (NlaStrip *)ptr->data;
-
- if (value) {
- /* set the flag, then make sure a curve for this exists */
- data->flag |= NLASTRIP_FLAG_USR_TIME;
- BKE_nlastrip_validate_fcurves(data);
- }
- else
- data->flag &= ~NLASTRIP_FLAG_USR_TIME;
+ NlaStrip *data = (NlaStrip *)ptr->data;
+
+ if (value) {
+ /* set the flag, then make sure a curve for this exists */
+ data->flag |= NLASTRIP_FLAG_USR_TIME;
+ BKE_nlastrip_validate_fcurves(data);
+ }
+ else
+ data->flag &= ~NLASTRIP_FLAG_USR_TIME;
}
-static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip, ReportList *reports, const char *data_path, int index)
+static FCurve *rna_NlaStrip_fcurve_find(NlaStrip *strip,
+ ReportList *reports,
+ const char *data_path,
+ int index)
{
- if (data_path[0] == '\0') {
- BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
- return NULL;
- }
+ if (data_path[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "F-Curve data path empty, invalid argument");
+ return NULL;
+ }
- /* Returns NULL if not found. */
- return list_find_fcurve(&strip->fcurves, data_path, index);
+ /* Returns NULL if not found. */
+ return list_find_fcurve(&strip->fcurves, data_path, index);
}
-
-static NlaStrip *rna_NlaStrip_new(ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, const char *UNUSED(name),
- int start, bAction *action)
+static NlaStrip *rna_NlaStrip_new(ID *id,
+ NlaTrack *track,
+ Main *bmain,
+ bContext *C,
+ ReportList *reports,
+ const char *UNUSED(name),
+ int start,
+ bAction *action)
{
- NlaStrip *strip = BKE_nlastrip_new(action);
-
- if (strip == NULL) {
- BKE_report(reports, RPT_ERROR, "Unable to create new strip");
- return NULL;
- }
-
- strip->end += (start - strip->start);
- strip->start = start;
-
- if (BKE_nlastrips_add_strip(&track->strips, strip) == 0) {
- BKE_report(reports, RPT_ERROR,
- "Unable to add strip (the track does not have any space to accommodate this new strip)");
- BKE_nlastrip_free(NULL, strip, true);
- return NULL;
- }
-
- /* create dummy AnimData block so that BKE_nlastrip_validate_name()
- * can be used to ensure a valid name, as we don't have one here...
- * - only the nla_tracks list is needed there, which we aim to reverse engineer here...
- */
- {
- AnimData adt = {NULL};
- NlaTrack *nlt, *nlt_p;
-
- /* 'first' NLA track is found by going back up chain of given track's parents until we fall off */
- nlt_p = track; nlt = track;
- while ((nlt = nlt->prev) != NULL)
- nlt_p = nlt;
- adt.nla_tracks.first = nlt_p;
-
- /* do the same thing to find the last track */
- nlt_p = track; nlt = track;
- while ((nlt = nlt->next) != NULL)
- nlt_p = nlt;
- adt.nla_tracks.last = nlt_p;
-
- /* now we can just auto-name as usual */
- BKE_nlastrip_validate_name(&adt, strip);
- }
-
- WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
-
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
-
- return strip;
+ NlaStrip *strip = BKE_nlastrip_new(action);
+
+ if (strip == NULL) {
+ BKE_report(reports, RPT_ERROR, "Unable to create new strip");
+ return NULL;
+ }
+
+ strip->end += (start - strip->start);
+ strip->start = start;
+
+ if (BKE_nlastrips_add_strip(&track->strips, strip) == 0) {
+ BKE_report(
+ reports,
+ RPT_ERROR,
+ "Unable to add strip (the track does not have any space to accommodate this new strip)");
+ BKE_nlastrip_free(NULL, strip, true);
+ return NULL;
+ }
+
+ /* create dummy AnimData block so that BKE_nlastrip_validate_name()
+ * can be used to ensure a valid name, as we don't have one here...
+ * - only the nla_tracks list is needed there, which we aim to reverse engineer here...
+ */
+ {
+ AnimData adt = {NULL};
+ NlaTrack *nlt, *nlt_p;
+
+ /* 'first' NLA track is found by going back up chain of given track's parents until we fall off */
+ nlt_p = track;
+ nlt = track;
+ while ((nlt = nlt->prev) != NULL)
+ nlt_p = nlt;
+ adt.nla_tracks.first = nlt_p;
+
+ /* do the same thing to find the last track */
+ nlt_p = track;
+ nlt = track;
+ while ((nlt = nlt->next) != NULL)
+ nlt_p = nlt;
+ adt.nla_tracks.last = nlt_p;
+
+ /* now we can just auto-name as usual */
+ BKE_nlastrip_validate_name(&adt, strip);
+ }
+
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_ADDED, NULL);
+
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
+
+ return strip;
}
-static void rna_NlaStrip_remove(ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, PointerRNA *strip_ptr)
+static void rna_NlaStrip_remove(
+ ID *id, NlaTrack *track, Main *bmain, bContext *C, ReportList *reports, PointerRNA *strip_ptr)
{
- NlaStrip *strip = strip_ptr->data;
- if (BLI_findindex(&track->strips, strip) == -1) {
- BKE_reportf(reports, RPT_ERROR, "NLA strip '%s' not found in track '%s'", strip->name, track->name);
- return;
- }
+ NlaStrip *strip = strip_ptr->data;
+ if (BLI_findindex(&track->strips, strip) == -1) {
+ BKE_reportf(
+ reports, RPT_ERROR, "NLA strip '%s' not found in track '%s'", strip->name, track->name);
+ return;
+ }
- BKE_nlastrip_free(&track->strips, strip, true);
- RNA_POINTER_INVALIDATE(strip_ptr);
+ BKE_nlastrip_free(&track->strips, strip, true);
+ RNA_POINTER_INVALIDATE(strip_ptr);
- WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
+ WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_REMOVED, NULL);
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, id, ID_RECALC_ANIMATION | ID_RECALC_COPY_ON_WRITE);
}
/* Set the 'solo' setting for the given NLA-track, making sure that it is the only one
@@ -445,393 +461,459 @@ static void rna_NlaStrip_remove(ID *id, NlaTrack *track, Main *bmain, bContext *
*/
static void rna_NlaTrack_solo_set(PointerRNA *ptr, bool value)
{
- NlaTrack *data = (NlaTrack *)ptr->data;
- AnimData *adt = BKE_animdata_from_id(ptr->id.data);
- NlaTrack *nt;
-
- if (data == NULL) {
- return;
- }
-
- /* firstly, make sure 'solo' flag for all tracks is disabled */
- for (nt = data; nt; nt = nt->next) {
- nt->flag &= ~NLATRACK_SOLO;
- }
- for (nt = data; nt; nt = nt->prev) {
- nt->flag &= ~NLATRACK_SOLO;
- }
-
- /* now, enable 'solo' for the given track if appropriate */
- if (value) {
- /* set solo status */
- data->flag |= NLATRACK_SOLO;
-
- /* set solo-status on AnimData */
- adt->flag |= ADT_NLA_SOLO_TRACK;
- }
- else {
- /* solo status was already cleared on track */
-
- /* clear solo-status on AnimData */
- adt->flag &= ~ADT_NLA_SOLO_TRACK;
- }
+ NlaTrack *data = (NlaTrack *)ptr->data;
+ AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+ NlaTrack *nt;
+
+ if (data == NULL) {
+ return;
+ }
+
+ /* firstly, make sure 'solo' flag for all tracks is disabled */
+ for (nt = data; nt; nt = nt->next) {
+ nt->flag &= ~NLATRACK_SOLO;
+ }
+ for (nt = data; nt; nt = nt->prev) {
+ nt->flag &= ~NLATRACK_SOLO;
+ }
+
+ /* now, enable 'solo' for the given track if appropriate */
+ if (value) {
+ /* set solo status */
+ data->flag |= NLATRACK_SOLO;
+
+ /* set solo-status on AnimData */
+ adt->flag |= ADT_NLA_SOLO_TRACK;
+ }
+ else {
+ /* solo status was already cleared on track */
+
+ /* clear solo-status on AnimData */
+ adt->flag &= ~ADT_NLA_SOLO_TRACK;
+ }
}
#else
/* enum defines exported for rna_animation.c */
const EnumPropertyItem rna_enum_nla_mode_blend_items[] = {
- {NLASTRIP_MODE_REPLACE, "REPLACE", 0, "Replace",
- "The strip values replace the accumulated results by amount specified by influence"},
- {NLASTRIP_MODE_COMBINE, "COMBINE", 0, "Combine",
- "The strip values are combined with accumulated results by appropriately using addition, "
- "multiplication, or quaternion math, based on channel type"},
- {0, "", 0, NULL, NULL},
- {NLASTRIP_MODE_ADD, "ADD", 0, "Add", "Weighted result of strip is added to the accumulated results"},
- {NLASTRIP_MODE_SUBTRACT, "SUBTRACT", 0, "Subtract",
- "Weighted result of strip is removed from the accumulated results"},
- {NLASTRIP_MODE_MULTIPLY, "MULTIPLY", 0, "Multiply",
- "Weighted result of strip is multiplied with the accumulated results"},
- {0, NULL, 0, NULL, NULL},
+ {NLASTRIP_MODE_REPLACE,
+ "REPLACE",
+ 0,
+ "Replace",
+ "The strip values replace the accumulated results by amount specified by influence"},
+ {NLASTRIP_MODE_COMBINE,
+ "COMBINE",
+ 0,
+ "Combine",
+ "The strip values are combined with accumulated results by appropriately using addition, "
+ "multiplication, or quaternion math, based on channel type"},
+ {0, "", 0, NULL, NULL},
+ {NLASTRIP_MODE_ADD,
+ "ADD",
+ 0,
+ "Add",
+ "Weighted result of strip is added to the accumulated results"},
+ {NLASTRIP_MODE_SUBTRACT,
+ "SUBTRACT",
+ 0,
+ "Subtract",
+ "Weighted result of strip is removed from the accumulated results"},
+ {NLASTRIP_MODE_MULTIPLY,
+ "MULTIPLY",
+ 0,
+ "Multiply",
+ "Weighted result of strip is multiplied with the accumulated results"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_nla_mode_extend_items[] = {
- {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"},
- {NLASTRIP_EXTEND_HOLD, "HOLD", 0, "Hold",
- "Hold the first frame if no previous strips in track, and always hold last frame"},
- {NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame"},
- {0, NULL, 0, NULL, NULL},
+ {NLASTRIP_EXTEND_NOTHING, "NOTHING", 0, "Nothing", "Strip has no influence past its extents"},
+ {NLASTRIP_EXTEND_HOLD,
+ "HOLD",
+ 0,
+ "Hold",
+ "Hold the first frame if no previous strips in track, and always hold last frame"},
+ {NLASTRIP_EXTEND_HOLD_FORWARD, "HOLD_FORWARD", 0, "Hold Forward", "Only hold last frame"},
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_strip_fcurves(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "NlaStripFCurves");
- srna = RNA_def_struct(brna, "NlaStripFCurves", NULL);
- RNA_def_struct_sdna(srna, "NlaStrip");
- RNA_def_struct_ui_text(srna, "NLA-Strip F-Curves", "Collection of NLA strip F-Curves");
-
- /* Strip.fcurves.find(...) */
- func = RNA_def_function(srna, "find", "rna_NlaStrip_fcurve_find");
- RNA_def_function_ui_description(func, "Find an F-Curve. Note that this function performs a linear scan "
- "of all F-Curves in the NLA strip.");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
-
- parm = RNA_def_pointer(func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "NlaStripFCurves");
+ srna = RNA_def_struct(brna, "NlaStripFCurves", NULL);
+ RNA_def_struct_sdna(srna, "NlaStrip");
+ RNA_def_struct_ui_text(srna, "NLA-Strip F-Curves", "Collection of NLA strip F-Curves");
+
+ /* Strip.fcurves.find(...) */
+ func = RNA_def_function(srna, "find", "rna_NlaStrip_fcurve_find");
+ RNA_def_function_ui_description(
+ func,
+ "Find an F-Curve. Note that this function performs a linear scan "
+ "of all F-Curves in the NLA strip.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "F-Curve data path");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "Array index", 0, INT_MAX);
+
+ parm = RNA_def_pointer(
+ func, "fcurve", "FCurve", "", "The found F-Curve, or None if it doesn't exist");
+ RNA_def_function_return(func, parm);
}
static void rna_def_nlastrip(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* enum defs */
- static const EnumPropertyItem prop_type_items[] = {
- {NLASTRIP_TYPE_CLIP, "CLIP", 0, "Action Clip", "NLA Strip references some Action"},
- {NLASTRIP_TYPE_TRANSITION, "TRANSITION", 0, "Transition", "NLA Strip 'transitions' between adjacent strips"},
- {NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"},
- {NLASTRIP_TYPE_SOUND, "SOUND", 0, "Sound Clip", "NLA Strip representing a sound event for speakers"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* struct definition */
- srna = RNA_def_struct(brna, "NlaStrip", NULL);
- RNA_def_struct_ui_text(srna, "NLA Strip", "A container referencing an existing Action");
- RNA_def_struct_path_func(srna, "rna_NlaStrip_path");
- RNA_def_struct_ui_icon(srna, ICON_NLA); /* XXX */
-
- /* name property */
- 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_NlaStrip_name_set");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* XXX for now, not editable, since this is dangerous */
- RNA_def_property_enum_items(prop, prop_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of NLA Strip");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "extendmode");
- RNA_def_property_enum_items(prop, rna_enum_nla_mode_extend_items);
- RNA_def_property_ui_text(prop, "Extrapolation", "Action to take for gaps past the strip extents");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "blendmode");
- RNA_def_property_enum_items(prop, rna_enum_nla_mode_blend_items);
- RNA_def_property_ui_text(prop, "Blending", "Method used for combining strip's result with accumulated result");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- /* Strip extents */
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "start");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Start Frame", "");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "end");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_end_frame_set", NULL);
- RNA_def_property_ui_text(prop, "End Frame", "");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- /* Blending */
- prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "blendin");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_in_set", NULL);
- RNA_def_property_ui_text(prop, "Blend In", "Number of frames at start of strip to fade in influence");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "blendout");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_out_set", NULL);
- RNA_def_property_ui_text(prop, "Blend Out", "");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_AUTO_BLENDS);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_use_auto_blend_set");
- RNA_def_property_ui_text(prop, "Auto Blend In/Out",
- "Number of frames for Blending In/Out is automatically determined from "
- "overlapping strips");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- /* Action */
- prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "act");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable");
- RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_dependency_update");
-
- /* Action extents */
- prop = RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "actstart");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Action Start Frame", "First frame from action to use");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- prop = RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "actend");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_end_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Action End Frame", "Last frame from action to use");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- /* Action Reuse */
- prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "repeat");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
- /* these limits have currently be chosen arbitrarily, but could be extended
- * (minimum should still be > 0 though) if needed... */
- RNA_def_property_range(prop, 0.1f, 1000.0f);
- RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_scale_set", NULL);
- /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs
- * due to numeric errors */
- RNA_def_property_range(prop, 0.0001f, 1000.0f);
- RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- /* Strip's F-Curves */
- prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fcurves", NULL);
- RNA_def_property_struct_type(prop, "FCurve");
- RNA_def_property_ui_text(prop, "F-Curves", "F-Curves for controlling the strip's influence and timing");
- rna_def_strip_fcurves(brna, prop);
-
- /* Strip's F-Modifiers */
- prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "FModifier");
- RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting all the F-Curves in the referenced Action");
-
- /* Strip's Sub-Strips (for Meta-Strips) */
- prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "NlaStrip");
- RNA_def_property_ui_text(prop, "NLA Strips",
- "NLA Strips that this strip acts as a container for (if it is of type Meta)");
-
- /* Settings - Values necessary for evaluation */
- prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Influence", "Amount the strip contributes to the current result");
- /* XXX: Update temporarily disabled so that the property can be edited at all!
- * Even autokey only applies after the curves have been re-evaluated, causing the unkeyed values to be lost
- */
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ NULL);
-
- prop = RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate");
- /* XXX: Update temporarily disabled so that the property can be edited at all!
- * Even autokey only applies after the curves have been re-evaluated, causing the unkeyed values to be lost
- */
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ NULL);
-
- /* TODO: should the animated_influence/time settings be animatable themselves? */
- prop = RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_influence_set");
- RNA_def_property_ui_text(prop, "Animated Influence",
- "Influence setting is controlled by an F-Curve rather than automatically determined");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
- RNA_def_property_ui_text(prop, "Animated Strip Time",
- "Strip time is controlled by an F-Curve rather than automatically determined");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC);
- RNA_def_property_ui_text(prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
-
- /* settings */
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- /* can be made editable by hooking it up to the necessary NLA API methods */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ACTIVE);
- RNA_def_property_ui_text(prop, "Active", "NLA Strip is active");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_SELECT);
- RNA_def_property_ui_text(prop, "Select", "NLA Strip is selected");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "Disable NLA Strip evaluation");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_REVERSE);
- RNA_def_property_ui_text(prop, "Reversed",
- "NLA Strip is played back in reverse order (only when timing is "
- "automatically determined)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "use_sync_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_SYNC_LENGTH);
- RNA_def_property_ui_text(prop, "Sync Action Length",
- "Update range of frames referenced from action "
- "after tweaking strip and its keyframes");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* enum defs */
+ static const EnumPropertyItem prop_type_items[] = {
+ {NLASTRIP_TYPE_CLIP, "CLIP", 0, "Action Clip", "NLA Strip references some Action"},
+ {NLASTRIP_TYPE_TRANSITION,
+ "TRANSITION",
+ 0,
+ "Transition",
+ "NLA Strip 'transitions' between adjacent strips"},
+ {NLASTRIP_TYPE_META, "META", 0, "Meta", "NLA Strip acts as a container for adjacent strips"},
+ {NLASTRIP_TYPE_SOUND,
+ "SOUND",
+ 0,
+ "Sound Clip",
+ "NLA Strip representing a sound event for speakers"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* struct definition */
+ srna = RNA_def_struct(brna, "NlaStrip", NULL);
+ RNA_def_struct_ui_text(srna, "NLA Strip", "A container referencing an existing Action");
+ RNA_def_struct_path_func(srna, "rna_NlaStrip_path");
+ RNA_def_struct_ui_icon(srna, ICON_NLA); /* XXX */
+
+ /* name property */
+ 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_NlaStrip_name_set");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_clear_flag(
+ prop, PROP_EDITABLE); /* XXX for now, not editable, since this is dangerous */
+ RNA_def_property_enum_items(prop, prop_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of NLA Strip");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "extrapolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "extendmode");
+ RNA_def_property_enum_items(prop, rna_enum_nla_mode_extend_items);
+ RNA_def_property_ui_text(
+ prop, "Extrapolation", "Action to take for gaps past the strip extents");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blendmode");
+ RNA_def_property_enum_items(prop, rna_enum_nla_mode_blend_items);
+ RNA_def_property_ui_text(
+ prop, "Blending", "Method used for combining strip's result with accumulated result");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ /* Strip extents */
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "start");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_start_frame_set", NULL);
+ RNA_def_property_ui_text(prop, "Start Frame", "");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "end");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_end_frame_set", NULL);
+ RNA_def_property_ui_text(prop, "End Frame", "");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ /* Blending */
+ prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "blendin");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_in_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Blend In", "Number of frames at start of strip to fade in influence");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "blend_out", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "blendout");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_blend_out_set", NULL);
+ RNA_def_property_ui_text(prop, "Blend Out", "");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "use_auto_blend", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_AUTO_BLENDS);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_use_auto_blend_set");
+ RNA_def_property_ui_text(prop,
+ "Auto Blend In/Out",
+ "Number of frames for Blending In/Out is automatically determined from "
+ "overlapping strips");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ /* Action */
+ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "act");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Action_id_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable");
+ RNA_def_property_ui_text(prop, "Action", "Action referenced by this strip");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_dependency_update");
+
+ /* Action extents */
+ prop = RNA_def_property(srna, "action_frame_start", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "actstart");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_start_frame_set", NULL);
+ RNA_def_property_ui_text(prop, "Action Start Frame", "First frame from action to use");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ prop = RNA_def_property(srna, "action_frame_end", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "actend");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_action_end_frame_set", NULL);
+ RNA_def_property_ui_text(prop, "Action End Frame", "Last frame from action to use");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ /* Action Reuse */
+ prop = RNA_def_property(srna, "repeat", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "repeat");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_repeat_set", NULL);
+ /* these limits have currently be chosen arbitrarily, but could be extended
+ * (minimum should still be > 0 though) if needed... */
+ RNA_def_property_range(prop, 0.1f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Repeat", "Number of times to repeat the action range");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_float_funcs(prop, NULL, "rna_NlaStrip_scale_set", NULL);
+ /* these limits can be extended, but beyond this, we can get some crazy+annoying bugs
+ * due to numeric errors */
+ RNA_def_property_range(prop, 0.0001f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Scale", "Scaling factor for action");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ /* Strip's F-Curves */
+ prop = RNA_def_property(srna, "fcurves", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "fcurves", NULL);
+ RNA_def_property_struct_type(prop, "FCurve");
+ RNA_def_property_ui_text(
+ prop, "F-Curves", "F-Curves for controlling the strip's influence and timing");
+ rna_def_strip_fcurves(brna, prop);
+
+ /* Strip's F-Modifiers */
+ prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FModifier");
+ RNA_def_property_ui_text(
+ prop, "Modifiers", "Modifiers affecting all the F-Curves in the referenced Action");
+
+ /* Strip's Sub-Strips (for Meta-Strips) */
+ prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "NlaStrip");
+ RNA_def_property_ui_text(
+ prop,
+ "NLA Strips",
+ "NLA Strips that this strip acts as a container for (if it is of type Meta)");
+
+ /* Settings - Values necessary for evaluation */
+ prop = RNA_def_property(srna, "influence", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Influence", "Amount the strip contributes to the current result");
+ /* XXX: Update temporarily disabled so that the property can be edited at all!
+ * Even autokey only applies after the curves have been re-evaluated, causing the unkeyed values to be lost
+ */
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ NULL);
+
+ prop = RNA_def_property(srna, "strip_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_ui_text(prop, "Strip Time", "Frame of referenced Action to evaluate");
+ /* XXX: Update temporarily disabled so that the property can be edited at all!
+ * Even autokey only applies after the curves have been re-evaluated, causing the unkeyed values to be lost
+ */
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, /*"rna_NlaStrip_update"*/ NULL);
+
+ /* TODO: should the animated_influence/time settings be animatable themselves? */
+ prop = RNA_def_property(srna, "use_animated_influence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_INFLUENCE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_influence_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Animated Influence",
+ "Influence setting is controlled by an F-Curve rather than automatically determined");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "use_animated_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaStrip_animated_time_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Animated Strip Time",
+ "Strip time is controlled by an F-Curve rather than automatically determined");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "use_animated_time_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_USR_TIME_CYCLIC);
+ RNA_def_property_ui_text(
+ prop, "Cyclic Strip Time", "Cycle the animated time within the action start & end");
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
+
+ /* settings */
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ /* can be made editable by hooking it up to the necessary NLA API methods */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_ACTIVE);
+ RNA_def_property_ui_text(prop, "Active", "NLA Strip is active");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_SELECT);
+ RNA_def_property_ui_text(prop, "Select", "NLA Strip is selected");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_MUTED);
+ RNA_def_property_ui_text(prop, "Muted", "Disable NLA Strip evaluation");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "use_reverse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_REVERSE);
+ RNA_def_property_ui_text(prop,
+ "Reversed",
+ "NLA Strip is played back in reverse order (only when timing is "
+ "automatically determined)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "use_sync_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLASTRIP_FLAG_SYNC_LENGTH);
+ RNA_def_property_ui_text(prop,
+ "Sync Action Length",
+ "Update range of frames referenced from action "
+ "after tweaking strip and its keyframes");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
}
static void rna_api_nlatrack_strips(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "NlaStrips");
- srna = RNA_def_struct(brna, "NlaStrips", NULL);
- RNA_def_struct_sdna(srna, "NlaTrack");
- RNA_def_struct_ui_text(srna, "Nla Strips", "Collection of Nla Strips");
-
- func = RNA_def_function(srna, "new", "rna_NlaStrip_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new Action-Clip strip to the track");
- parm = RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "start", 0, INT_MIN, INT_MAX, "Start Frame",
- "Start frame for this strip", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "action", "Action", "", "Action to assign to this strip");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "New NLA Strip");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_NlaStrip_remove");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a NLA Strip");
- parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "NLA Strip to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "NlaStrips");
+ srna = RNA_def_struct(brna, "NlaStrips", NULL);
+ RNA_def_struct_sdna(srna, "NlaTrack");
+ RNA_def_struct_ui_text(srna, "Nla Strips", "Collection of Nla Strips");
+
+ func = RNA_def_function(srna, "new", "rna_NlaStrip_new");
+ RNA_def_function_flag(func,
+ FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new Action-Clip strip to the track");
+ parm = RNA_def_string(func, "name", "NlaStrip", 0, "", "Name for the NLA Strips");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "start",
+ 0,
+ INT_MIN,
+ INT_MAX,
+ "Start Frame",
+ "Start frame for this strip",
+ INT_MIN,
+ INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "action", "Action", "", "Action to assign to this strip");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "New NLA Strip");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_NlaStrip_remove");
+ RNA_def_function_flag(func,
+ FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a NLA Strip");
+ parm = RNA_def_pointer(func, "strip", "NlaStrip", "", "NLA Strip to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_nlatrack(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "NlaTrack", NULL);
- RNA_def_struct_ui_text(srna, "NLA Track", "A animation layer containing Actions referenced as NLA strips");
- RNA_def_struct_ui_icon(srna, ICON_NLA);
-
- /* strips collection */
- prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "NlaStrip");
- RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips on this NLA-track");
-
- rna_api_nlatrack_strips(brna, prop);
-
- /* name property */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
- /* settings */
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- /* can be made editable by hooking it up to the necessary NLA API methods */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_ACTIVE);
- RNA_def_property_ui_text(prop, "Active", "NLA Track is active");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
- prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
- /* can be made editable by hooking it up to the necessary NLA API methods */
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SOLO);
- RNA_def_property_ui_text(prop, "Solo",
- "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
- "same AnimData block are disabled)");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaTrack_solo_set");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SELECTED);
- RNA_def_property_ui_text(prop, "Select", "NLA Track is selected");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_MUTED);
- RNA_def_property_ui_text(prop, "Muted", "Disable NLA Track evaluation");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_PROTECTED);
- RNA_def_property_ui_text(prop, "Locked", "NLA Track is locked");
- RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "NlaTrack", NULL);
+ RNA_def_struct_ui_text(
+ srna, "NLA Track", "A animation layer containing Actions referenced as NLA strips");
+ RNA_def_struct_ui_icon(srna, ICON_NLA);
+
+ /* strips collection */
+ prop = RNA_def_property(srna, "strips", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "NlaStrip");
+ RNA_def_property_ui_text(prop, "NLA Strips", "NLA Strips on this NLA-track");
+
+ rna_api_nlatrack_strips(brna, prop);
+
+ /* name property */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+
+ /* settings */
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ /* can be made editable by hooking it up to the necessary NLA API methods */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_ACTIVE);
+ RNA_def_property_ui_text(prop, "Active", "NLA Track is active");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+
+ prop = RNA_def_property(srna, "is_solo", PROP_BOOLEAN, PROP_NONE);
+ /* can be made editable by hooking it up to the necessary NLA API methods */
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SOLO);
+ RNA_def_property_ui_text(
+ prop,
+ "Solo",
+ "NLA Track is evaluated itself (i.e. active Action and all other NLA Tracks in the "
+ "same AnimData block are disabled)");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NlaTrack_solo_set");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_SELECTED);
+ RNA_def_property_ui_text(prop, "Select", "NLA Track is selected");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_MUTED);
+ RNA_def_property_ui_text(prop, "Muted", "Disable NLA Track evaluation");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_update");
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NLATRACK_PROTECTED);
+ RNA_def_property_ui_text(prop, "Locked", "NLA Track is locked");
+ RNA_def_property_update(prop, NC_ANIMATION | ND_NLA, NULL); /* this will do? */
}
/* --------- */
void RNA_def_nla(BlenderRNA *brna)
{
- rna_def_nlatrack(brna);
- rna_def_nlastrip(brna);
+ rna_def_nlatrack(brna);
+ rna_def_nlastrip(brna);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c
index 44cf15995f9..fb0ee247598 100644
--- a/source/blender/makesrna/intern/rna_nodetree.c
+++ b/source/blender/makesrna/intern/rna_nodetree.c
@@ -60,3202 +60,3371 @@
#include "DEG_depsgraph_query.h"
const EnumPropertyItem rna_enum_node_socket_in_out_items[] = {
- { SOCK_IN, "IN", 0, "Input", "" },
- { SOCK_OUT, "OUT", 0, "Output", "" },
- { 0, NULL, 0, NULL, NULL }
-};
+ {SOCK_IN, "IN", 0, "Input", ""}, {SOCK_OUT, "OUT", 0, "Output", ""}, {0, NULL, 0, NULL, NULL}};
#ifndef RNA_RUNTIME
static const EnumPropertyItem rna_enum_node_socket_draw_shape_items[] = {
- {SOCK_DRAW_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""},
- {SOCK_DRAW_SHAPE_SQUARE, "SQUARE", 0, "Square", ""},
- {SOCK_DRAW_SHAPE_DIAMOND, "DIAMOND", 0, "Diamond", ""},
- {0, NULL, 0, NULL, NULL }
-};
+ {SOCK_DRAW_SHAPE_CIRCLE, "CIRCLE", 0, "Circle", ""},
+ {SOCK_DRAW_SHAPE_SQUARE, "SQUARE", 0, "Square", ""},
+ {SOCK_DRAW_SHAPE_DIAMOND, "DIAMOND", 0, "Diamond", ""},
+ {0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem node_socket_type_items[] = {
- {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""},
- {SOCK_FLOAT, "VALUE", 0, "Value", ""},
- {SOCK_INT, "INT", 0, "Int", ""},
- {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
- {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
- {SOCK_STRING, "STRING", 0, "String", ""},
- {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
- {SOCK_SHADER, "SHADER", 0, "Shader", ""},
- {0, NULL, 0, NULL, NULL},
+ {SOCK_CUSTOM, "CUSTOM", 0, "Custom", ""},
+ {SOCK_FLOAT, "VALUE", 0, "Value", ""},
+ {SOCK_INT, "INT", 0, "Int", ""},
+ {SOCK_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
+ {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
+ {SOCK_STRING, "STRING", 0, "String", ""},
+ {SOCK_RGBA, "RGBA", 0, "RGBA", ""},
+ {SOCK_SHADER, "SHADER", 0, "Shader", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_quality_items[] = {
- {NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
- {NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"},
- {NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"},
- {0, NULL, 0, NULL, NULL},
+ {NTREE_QUALITY_HIGH, "HIGH", 0, "High", "High quality"},
+ {NTREE_QUALITY_MEDIUM, "MEDIUM", 0, "Medium", "Medium quality"},
+ {NTREE_QUALITY_LOW, "LOW", 0, "Low", "Low quality"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_chunksize_items[] = {
- {NTREE_CHUNCKSIZE_32, "32", 0, "32x32", "Chunksize of 32x32"},
- {NTREE_CHUNCKSIZE_64, "64", 0, "64x64", "Chunksize of 64x64"},
- {NTREE_CHUNCKSIZE_128, "128", 0, "128x128", "Chunksize of 128x128"},
- {NTREE_CHUNCKSIZE_256, "256", 0, "256x256", "Chunksize of 256x256"},
- {NTREE_CHUNCKSIZE_512, "512", 0, "512x512", "Chunksize of 512x512"},
- {NTREE_CHUNCKSIZE_1024, "1024", 0, "1024x1024", "Chunksize of 1024x1024"},
- {0, NULL, 0, NULL, NULL},
+ {NTREE_CHUNCKSIZE_32, "32", 0, "32x32", "Chunksize of 32x32"},
+ {NTREE_CHUNCKSIZE_64, "64", 0, "64x64", "Chunksize of 64x64"},
+ {NTREE_CHUNCKSIZE_128, "128", 0, "128x128", "Chunksize of 128x128"},
+ {NTREE_CHUNCKSIZE_256, "256", 0, "256x256", "Chunksize of 256x256"},
+ {NTREE_CHUNCKSIZE_512, "512", 0, "512x512", "Chunksize of 512x512"},
+ {NTREE_CHUNCKSIZE_1024, "1024", 0, "1024x1024", "Chunksize of 1024x1024"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_node_math_items[] = {
- {NODE_MATH_ADD, "ADD", 0, "Add", ""},
- {NODE_MATH_SUB, "SUBTRACT", 0, "Subtract", ""},
- {NODE_MATH_MUL, "MULTIPLY", 0, "Multiply", ""},
- {NODE_MATH_DIVIDE, "DIVIDE", 0, "Divide", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {NODE_MATH_POW, "POWER", 0, "Power", ""},
- {NODE_MATH_LOG, "LOGARITHM", 0, "Logarithm", ""},
- {NODE_MATH_SQRT, "SQRT", 0, "Square Root", ""},
- {NODE_MATH_ABS, "ABSOLUTE", 0, "Absolute", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {NODE_MATH_MIN, "MINIMUM", 0, "Minimum", ""},
- {NODE_MATH_MAX, "MAXIMUM", 0, "Maximum", ""},
- {NODE_MATH_LESS, "LESS_THAN", 0, "Less Than", ""},
- {NODE_MATH_GREATER, "GREATER_THAN", 0, "Greater Than", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {NODE_MATH_ROUND, "ROUND", 0, "Round", ""},
- {NODE_MATH_FLOOR, "FLOOR", 0, "Floor", ""},
- {NODE_MATH_CEIL, "CEIL", 0, "Ceil", ""},
- {NODE_MATH_FRACT, "FRACT", 0, "Fract", ""},
- {NODE_MATH_MOD, "MODULO", 0, "Modulo", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {NODE_MATH_SIN, "SINE", 0, "Sine", ""},
- {NODE_MATH_COS, "COSINE", 0, "Cosine", ""},
- {NODE_MATH_TAN, "TANGENT", 0, "Tangent", ""},
- {NODE_MATH_ASIN, "ARCSINE", 0, "Arcsine", ""},
- {NODE_MATH_ACOS, "ARCCOSINE", 0, "Arccosine", ""},
- {NODE_MATH_ATAN, "ARCTANGENT", 0, "Arctangent", ""},
- {NODE_MATH_ATAN2, "ARCTAN2", 0, "Arctan2", ""},
- {0, NULL, 0, NULL, NULL},
+ {NODE_MATH_ADD, "ADD", 0, "Add", ""},
+ {NODE_MATH_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {NODE_MATH_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {NODE_MATH_DIVIDE, "DIVIDE", 0, "Divide", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {NODE_MATH_POW, "POWER", 0, "Power", ""},
+ {NODE_MATH_LOG, "LOGARITHM", 0, "Logarithm", ""},
+ {NODE_MATH_SQRT, "SQRT", 0, "Square Root", ""},
+ {NODE_MATH_ABS, "ABSOLUTE", 0, "Absolute", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {NODE_MATH_MIN, "MINIMUM", 0, "Minimum", ""},
+ {NODE_MATH_MAX, "MAXIMUM", 0, "Maximum", ""},
+ {NODE_MATH_LESS, "LESS_THAN", 0, "Less Than", ""},
+ {NODE_MATH_GREATER, "GREATER_THAN", 0, "Greater Than", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {NODE_MATH_ROUND, "ROUND", 0, "Round", ""},
+ {NODE_MATH_FLOOR, "FLOOR", 0, "Floor", ""},
+ {NODE_MATH_CEIL, "CEIL", 0, "Ceil", ""},
+ {NODE_MATH_FRACT, "FRACT", 0, "Fract", ""},
+ {NODE_MATH_MOD, "MODULO", 0, "Modulo", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {NODE_MATH_SIN, "SINE", 0, "Sine", ""},
+ {NODE_MATH_COS, "COSINE", 0, "Cosine", ""},
+ {NODE_MATH_TAN, "TANGENT", 0, "Tangent", ""},
+ {NODE_MATH_ASIN, "ARCSINE", 0, "Arcsine", ""},
+ {NODE_MATH_ACOS, "ARCCOSINE", 0, "Arccosine", ""},
+ {NODE_MATH_ATAN, "ARCTANGENT", 0, "Arctangent", ""},
+ {NODE_MATH_ATAN2, "ARCTAN2", 0, "Arctan2", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_node_vec_math_items[] = {
- {0, "ADD", 0, "Add", ""},
- {1, "SUBTRACT", 0, "Subtract", ""},
- {2, "AVERAGE", 0, "Average", ""},
- {3, "DOT_PRODUCT", 0, "Dot Product", ""},
- {4, "CROSS_PRODUCT", 0, "Cross Product", ""},
- {5, "NORMALIZE", 0, "Normalize", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "ADD", 0, "Add", ""},
+ {1, "SUBTRACT", 0, "Subtract", ""},
+ {2, "AVERAGE", 0, "Average", ""},
+ {3, "DOT_PRODUCT", 0, "Dot Product", ""},
+ {4, "CROSS_PRODUCT", 0, "Cross Product", ""},
+ {5, "NORMALIZE", 0, "Normalize", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_node_filter_items[] = {
- {0, "SOFTEN", 0, "Soften", ""},
- {1, "SHARPEN", 0, "Sharpen", ""},
- {2, "LAPLACE", 0, "Laplace", ""},
- {3, "SOBEL", 0, "Sobel", ""},
- {4, "PREWITT", 0, "Prewitt", ""},
- {5, "KIRSCH", 0, "Kirsch", ""},
- {6, "SHADOW", 0, "Shadow", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "SOFTEN", 0, "Soften", ""},
+ {1, "SHARPEN", 0, "Sharpen", ""},
+ {2, "LAPLACE", 0, "Laplace", ""},
+ {3, "SOBEL", 0, "Sobel", ""},
+ {4, "PREWITT", 0, "Prewitt", ""},
+ {5, "KIRSCH", 0, "Kirsch", ""},
+ {6, "SHADOW", 0, "Shadow", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem node_sampler_type_items[] = {
- {0, "NEAREST", 0, "Nearest", ""},
- {1, "BILINEAR", 0, "Bilinear", ""},
- {2, "BICUBIC", 0, "Bicubic", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "NEAREST", 0, "Nearest", ""},
+ {1, "BILINEAR", 0, "Bilinear", ""},
+ {2, "BICUBIC", 0, "Bicubic", ""},
+ {0, NULL, 0, NULL, NULL},
};
-
static const EnumPropertyItem prop_shader_output_target_items[] = {
- {SHD_OUTPUT_ALL, "ALL", 0, "All", "Use shaders for all renderers and viewports, unless there exists a more specific output"},
- {SHD_OUTPUT_EEVEE, "EEVEE", 0, "Eevee", "Use shaders for Eevee renderer"},
- {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
- {0, NULL, 0, NULL, NULL},
+ {SHD_OUTPUT_ALL,
+ "ALL",
+ 0,
+ "All",
+ "Use shaders for all renderers and viewports, unless there exists a more specific output"},
+ {SHD_OUTPUT_EEVEE, "EEVEE", 0, "Eevee", "Use shaders for Eevee renderer"},
+ {SHD_OUTPUT_CYCLES, "CYCLES", 0, "Cycles", "Use shaders for Cycles renderer"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#include "BLI_linklist.h"
-#include "BLI_string.h"
+# include "BLI_linklist.h"
+# include "BLI_string.h"
-#include "BKE_context.h"
-#include "BKE_idprop.h"
+# include "BKE_context.h"
+# include "BKE_idprop.h"
-#include "BKE_global.h"
+# include "BKE_global.h"
-#include "ED_node.h"
-#include "ED_render.h"
+# include "ED_node.h"
+# include "ED_render.h"
-#include "GPU_material.h"
+# include "GPU_material.h"
-#include "NOD_common.h"
-#include "NOD_socket.h"
-#include "NOD_shader.h"
-#include "NOD_composite.h"
+# include "NOD_common.h"
+# include "NOD_socket.h"
+# include "NOD_shader.h"
+# include "NOD_composite.h"
-#include "RE_engine.h"
-#include "RE_pipeline.h"
-
-#include "DNA_scene_types.h"
-#include "WM_api.h"
+# include "RE_engine.h"
+# include "RE_pipeline.h"
+# include "DNA_scene_types.h"
+# include "WM_api.h"
int rna_node_tree_type_to_enum(bNodeTreeType *typeinfo)
{
- int i = 0, result = -1;
- NODE_TREE_TYPES_BEGIN (nt)
- {
- if (nt == typeinfo) {
- result = i;
- break;
- }
- ++i;
- }
- NODE_TREE_TYPES_END;
- return result;
+ int i = 0, result = -1;
+ NODE_TREE_TYPES_BEGIN (nt) {
+ if (nt == typeinfo) {
+ result = i;
+ break;
+ }
+ ++i;
+ }
+ NODE_TREE_TYPES_END;
+ return result;
}
int rna_node_tree_idname_to_enum(const char *idname)
{
- int i = 0, result = -1;
- NODE_TREE_TYPES_BEGIN (nt)
- {
- if (STREQ(nt->idname, idname)) {
- result = i;
- break;
- }
- ++i;
- }
- NODE_TREE_TYPES_END;
- return result;
+ int i = 0, result = -1;
+ NODE_TREE_TYPES_BEGIN (nt) {
+ if (STREQ(nt->idname, idname)) {
+ result = i;
+ break;
+ }
+ ++i;
+ }
+ NODE_TREE_TYPES_END;
+ return result;
}
bNodeTreeType *rna_node_tree_type_from_enum(int value)
{
- int i = 0;
- bNodeTreeType *result = NULL;
- NODE_TREE_TYPES_BEGIN (nt)
- {
- if (i == value) {
- result = nt;
- break;
- }
- ++i;
- }
- NODE_TREE_TYPES_END;
- return result;
+ int i = 0;
+ bNodeTreeType *result = NULL;
+ NODE_TREE_TYPES_BEGIN (nt) {
+ if (i == value) {
+ result = nt;
+ break;
+ }
+ ++i;
+ }
+ NODE_TREE_TYPES_END;
+ return result;
}
-const EnumPropertyItem *rna_node_tree_type_itemf(void *data, bool (*poll)(void *data, bNodeTreeType *), bool *r_free)
+const EnumPropertyItem *rna_node_tree_type_itemf(void *data,
+ bool (*poll)(void *data, bNodeTreeType *),
+ bool *r_free)
{
- EnumPropertyItem tmp = {0};
- EnumPropertyItem *item = NULL;
- int totitem = 0, i = 0;
+ EnumPropertyItem tmp = {0};
+ EnumPropertyItem *item = NULL;
+ int totitem = 0, i = 0;
- NODE_TREE_TYPES_BEGIN (nt)
- {
- if (poll && !poll(data, nt)) {
- ++i;
- continue;
- }
+ NODE_TREE_TYPES_BEGIN (nt) {
+ if (poll && !poll(data, nt)) {
+ ++i;
+ continue;
+ }
- tmp.value = i;
- tmp.identifier = nt->idname;
- tmp.icon = nt->ui_icon;
- tmp.name = nt->ui_name;
- tmp.description = nt->ui_description;
+ tmp.value = i;
+ tmp.identifier = nt->idname;
+ tmp.icon = nt->ui_icon;
+ tmp.name = nt->ui_name;
+ tmp.description = nt->ui_description;
- RNA_enum_item_add(&item, &totitem, &tmp);
+ RNA_enum_item_add(&item, &totitem, &tmp);
- ++i;
- }
- NODE_TREE_TYPES_END;
+ ++i;
+ }
+ NODE_TREE_TYPES_END;
- if (totitem == 0) {
- *r_free = false;
- return DummyRNA_NULL_items;
- }
+ if (totitem == 0) {
+ *r_free = false;
+ return DummyRNA_NULL_items;
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
int rna_node_type_to_enum(bNodeType *typeinfo)
{
- int i = 0, result = -1;
- NODE_TYPES_BEGIN(ntype) {
- if (ntype == typeinfo) {
- result = i;
- break;
- }
- ++i;
- } NODE_TYPES_END;
- return result;
+ int i = 0, result = -1;
+ NODE_TYPES_BEGIN (ntype) {
+ if (ntype == typeinfo) {
+ result = i;
+ break;
+ }
+ ++i;
+ }
+ NODE_TYPES_END;
+ return result;
}
int rna_node_idname_to_enum(const char *idname)
{
- int i = 0, result = -1;
- NODE_TYPES_BEGIN(ntype) {
- if (STREQ(ntype->idname, idname)) {
- result = i;
- break;
- }
- ++i;
- } NODE_TYPES_END;
- return result;
+ int i = 0, result = -1;
+ NODE_TYPES_BEGIN (ntype) {
+ if (STREQ(ntype->idname, idname)) {
+ result = i;
+ break;
+ }
+ ++i;
+ }
+ NODE_TYPES_END;
+ return result;
}
bNodeType *rna_node_type_from_enum(int value)
{
- int i = 0;
- bNodeType *result = NULL;
- NODE_TYPES_BEGIN(ntype) {
- if (i == value) {
- result = ntype;
- break;
- }
- ++i;
- } NODE_TYPES_END;
- return result;
+ int i = 0;
+ bNodeType *result = NULL;
+ NODE_TYPES_BEGIN (ntype) {
+ if (i == value) {
+ result = ntype;
+ break;
+ }
+ ++i;
+ }
+ NODE_TYPES_END;
+ return result;
}
-const EnumPropertyItem *rna_node_type_itemf(void *data, bool (*poll)(void *data, bNodeType *), bool *r_free)
+const EnumPropertyItem *rna_node_type_itemf(void *data,
+ bool (*poll)(void *data, bNodeType *),
+ bool *r_free)
{
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0};
- int totitem = 0, i = 0;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0};
+ int totitem = 0, i = 0;
- NODE_TYPES_BEGIN(ntype) {
- if (poll && !poll(data, ntype)) {
- ++i;
- continue;
- }
+ NODE_TYPES_BEGIN (ntype) {
+ if (poll && !poll(data, ntype)) {
+ ++i;
+ continue;
+ }
- tmp.value = i;
- tmp.identifier = ntype->idname;
- tmp.icon = ntype->ui_icon;
- tmp.name = ntype->ui_name;
- tmp.description = ntype->ui_description;
+ tmp.value = i;
+ tmp.identifier = ntype->idname;
+ tmp.icon = ntype->ui_icon;
+ tmp.name = ntype->ui_name;
+ tmp.description = ntype->ui_description;
- RNA_enum_item_add(&item, &totitem, &tmp);
+ RNA_enum_item_add(&item, &totitem, &tmp);
- ++i;
- } NODE_TYPES_END;
+ ++i;
+ }
+ NODE_TYPES_END;
- if (totitem == 0) {
- *r_free = false;
- return DummyRNA_NULL_items;
- }
+ if (totitem == 0) {
+ *r_free = false;
+ return DummyRNA_NULL_items;
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
int rna_node_socket_type_to_enum(bNodeSocketType *typeinfo)
{
- int i = 0, result = -1;
- NODE_SOCKET_TYPES_BEGIN(stype) {
- if (stype == typeinfo) {
- result = i;
- break;
- }
- ++i;
- } NODE_SOCKET_TYPES_END;
- return result;
+ int i = 0, result = -1;
+ NODE_SOCKET_TYPES_BEGIN (stype) {
+ if (stype == typeinfo) {
+ result = i;
+ break;
+ }
+ ++i;
+ }
+ NODE_SOCKET_TYPES_END;
+ return result;
}
int rna_node_socket_idname_to_enum(const char *idname)
{
- int i = 0, result = -1;
- NODE_SOCKET_TYPES_BEGIN(stype) {
- if (STREQ(stype->idname, idname)) {
- result = i;
- break;
- }
- ++i;
- } NODE_SOCKET_TYPES_END;
- return result;
+ int i = 0, result = -1;
+ NODE_SOCKET_TYPES_BEGIN (stype) {
+ if (STREQ(stype->idname, idname)) {
+ result = i;
+ break;
+ }
+ ++i;
+ }
+ NODE_SOCKET_TYPES_END;
+ return result;
}
bNodeSocketType *rna_node_socket_type_from_enum(int value)
{
- int i = 0;
- bNodeSocketType *result = NULL;
- NODE_SOCKET_TYPES_BEGIN(stype) {
- if (i == value) {
- result = stype;
- break;
- }
- ++i;
- } NODE_SOCKET_TYPES_END;
- return result;
-}
-
-const EnumPropertyItem *rna_node_socket_type_itemf(
- void *data, bool (*poll)(void *data, bNodeSocketType *), bool *r_free)
-{
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0};
- int totitem = 0, i = 0;
- StructRNA *srna;
-
- NODE_SOCKET_TYPES_BEGIN(stype) {
- if (poll && !poll(data, stype)) {
- ++i;
- continue;
- }
-
- srna = stype->ext_socket.srna;
- tmp.value = i;
- tmp.identifier = stype->idname;
- tmp.icon = RNA_struct_ui_icon(srna);
- tmp.name = RNA_struct_ui_name(srna);
- tmp.description = RNA_struct_ui_description(srna);
-
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- ++i;
- }
- NODE_SOCKET_TYPES_END;
-
- if (totitem == 0) {
- *r_free = false;
- return DummyRNA_NULL_items;
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
-}
-
-static const EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
-{
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp;
- int totitem = 0;
-
- /* hack, don't want to add include path to RNA just for this, since in the future RNA types
- * for nodes should be defined locally at runtime anyway ...
- */
-
- tmp.value = NODE_CUSTOM;
- tmp.identifier = "CUSTOM";
- tmp.name = "Custom";
- tmp.description = "Custom Node";
- tmp.icon = ICON_NONE;
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = NODE_CUSTOM_GROUP;
- tmp.identifier = "CUSTOM GROUP";
- tmp.name = "CustomGroup";
- tmp.description = "Custom Group Node";
- tmp.icon = ICON_NONE;
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- tmp.value = NODE_UNDEFINED;
- tmp.identifier = "UNDEFINED";
- tmp.name = "UNDEFINED";
- tmp.description = "";
- tmp.icon = ICON_NONE;
- RNA_enum_item_add(&item, &totitem, &tmp);
-
-#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
- if (STREQ(#Category, "Node")) { \
- tmp.value = ID; \
- tmp.identifier = EnumName; \
- tmp.name = UIName; \
- tmp.description = UIDesc; \
- tmp.icon = ICON_NONE; \
- RNA_enum_item_add(&item, &totitem, &tmp); \
- }
-#include "../../nodes/NOD_static_types.h"
-#undef DefNode
-
- if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
-#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
- if (STREQ(#Category, "ShaderNode")) { \
- tmp.value = ID; \
- tmp.identifier = EnumName; \
- tmp.name = UIName; \
- tmp.description = UIDesc; \
- tmp.icon = ICON_NONE; \
- RNA_enum_item_add(&item, &totitem, &tmp); \
- }
-#include "../../nodes/NOD_static_types.h"
-#undef DefNode
- }
-
- if (RNA_struct_is_a(ptr->type, &RNA_CompositorNode)) {
-#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
- if (STREQ(#Category, "CompositorNode")) { \
- tmp.value = ID; \
- tmp.identifier = EnumName; \
- tmp.name = UIName; \
- tmp.description = UIDesc; \
- tmp.icon = ICON_NONE; \
- RNA_enum_item_add(&item, &totitem, &tmp); \
- }
-#include "../../nodes/NOD_static_types.h"
-#undef DefNode
- }
-
- if (RNA_struct_is_a(ptr->type, &RNA_TextureNode)) {
-#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
- if (STREQ(#Category, "TextureNode")) { \
- tmp.value = ID; \
- tmp.identifier = EnumName; \
- tmp.name = UIName; \
- tmp.description = UIDesc; \
- tmp.icon = ICON_NONE; \
- RNA_enum_item_add(&item, &totitem, &tmp); \
- }
-#include "../../nodes/NOD_static_types.h"
-#undef DefNode
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ int i = 0;
+ bNodeSocketType *result = NULL;
+ NODE_SOCKET_TYPES_BEGIN (stype) {
+ if (i == value) {
+ result = stype;
+ break;
+ }
+ ++i;
+ }
+ NODE_SOCKET_TYPES_END;
+ return result;
+}
+
+const EnumPropertyItem *rna_node_socket_type_itemf(void *data,
+ bool (*poll)(void *data, bNodeSocketType *),
+ bool *r_free)
+{
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0};
+ int totitem = 0, i = 0;
+ StructRNA *srna;
+
+ NODE_SOCKET_TYPES_BEGIN (stype) {
+ if (poll && !poll(data, stype)) {
+ ++i;
+ continue;
+ }
+
+ srna = stype->ext_socket.srna;
+ tmp.value = i;
+ tmp.identifier = stype->idname;
+ tmp.icon = RNA_struct_ui_icon(srna);
+ tmp.name = RNA_struct_ui_name(srna);
+ tmp.description = RNA_struct_ui_description(srna);
+
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ ++i;
+ }
+ NODE_SOCKET_TYPES_END;
+
+ if (totitem == 0) {
+ *r_free = false;
+ return DummyRNA_NULL_items;
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+}
+
+static const EnumPropertyItem *rna_node_static_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp;
+ int totitem = 0;
+
+ /* hack, don't want to add include path to RNA just for this, since in the future RNA types
+ * for nodes should be defined locally at runtime anyway ...
+ */
+
+ tmp.value = NODE_CUSTOM;
+ tmp.identifier = "CUSTOM";
+ tmp.name = "Custom";
+ tmp.description = "Custom Node";
+ tmp.icon = ICON_NONE;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = NODE_CUSTOM_GROUP;
+ tmp.identifier = "CUSTOM GROUP";
+ tmp.name = "CustomGroup";
+ tmp.description = "Custom Group Node";
+ tmp.icon = ICON_NONE;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ tmp.value = NODE_UNDEFINED;
+ tmp.identifier = "UNDEFINED";
+ tmp.name = "UNDEFINED";
+ tmp.description = "";
+ tmp.icon = ICON_NONE;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
+ if (STREQ(#Category, "Node")) { \
+ tmp.value = ID; \
+ tmp.identifier = EnumName; \
+ tmp.name = UIName; \
+ tmp.description = UIDesc; \
+ tmp.icon = ICON_NONE; \
+ RNA_enum_item_add(&item, &totitem, &tmp); \
+ }
+# include "../../nodes/NOD_static_types.h"
+# undef DefNode
+
+ if (RNA_struct_is_a(ptr->type, &RNA_ShaderNode)) {
+# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
+ if (STREQ(#Category, "ShaderNode")) { \
+ tmp.value = ID; \
+ tmp.identifier = EnumName; \
+ tmp.name = UIName; \
+ tmp.description = UIDesc; \
+ tmp.icon = ICON_NONE; \
+ RNA_enum_item_add(&item, &totitem, &tmp); \
+ }
+# include "../../nodes/NOD_static_types.h"
+# undef DefNode
+ }
+
+ if (RNA_struct_is_a(ptr->type, &RNA_CompositorNode)) {
+# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
+ if (STREQ(#Category, "CompositorNode")) { \
+ tmp.value = ID; \
+ tmp.identifier = EnumName; \
+ tmp.name = UIName; \
+ tmp.description = UIDesc; \
+ tmp.icon = ICON_NONE; \
+ RNA_enum_item_add(&item, &totitem, &tmp); \
+ }
+# include "../../nodes/NOD_static_types.h"
+# undef DefNode
+ }
+
+ if (RNA_struct_is_a(ptr->type, &RNA_TextureNode)) {
+# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
+ if (STREQ(#Category, "TextureNode")) { \
+ tmp.value = ID; \
+ tmp.identifier = EnumName; \
+ tmp.name = UIName; \
+ tmp.description = UIDesc; \
+ tmp.icon = ICON_NONE; \
+ RNA_enum_item_add(&item, &totitem, &tmp); \
+ }
+# include "../../nodes/NOD_static_types.h"
+# undef DefNode
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
/* ******** Node Tree ******** */
static StructRNA *rna_NodeTree_refine(struct PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
- if (ntree->typeinfo->ext.srna)
- return ntree->typeinfo->ext.srna;
- else
- return &RNA_NodeTree;
+ if (ntree->typeinfo->ext.srna)
+ return ntree->typeinfo->ext.srna;
+ else
+ return &RNA_NodeTree;
}
static bool rna_NodeTree_poll(const bContext *C, bNodeTreeType *ntreetype)
{
- extern FunctionRNA rna_NodeTree_poll_func;
+ extern FunctionRNA rna_NodeTree_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, ntreetype->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_NodeTree_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, ntreetype->ext.srna, NULL, &ptr); /* dummy */
+ func = &rna_NodeTree_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- ntreetype->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ ntreetype->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static void rna_NodeTree_update_reg(bNodeTree *ntree)
{
- extern FunctionRNA rna_NodeTree_update_func;
+ extern FunctionRNA rna_NodeTree_update_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_id_pointer_create(&ntree->id, &ptr);
- func = &rna_NodeTree_update_func; /* RNA_struct_find_function(&ptr, "update"); */
+ RNA_id_pointer_create(&ntree->id, &ptr);
+ func = &rna_NodeTree_update_func; /* RNA_struct_find_function(&ptr, "update"); */
- RNA_parameter_list_create(&list, &ptr, func);
- ntree->typeinfo->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ ntree->typeinfo->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void rna_NodeTree_get_from_context(const bContext *C, bNodeTreeType *ntreetype,
- bNodeTree **r_ntree, ID **r_id, ID **r_from)
+static void rna_NodeTree_get_from_context(
+ const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from)
{
- extern FunctionRNA rna_NodeTree_get_from_context_func;
+ extern FunctionRNA rna_NodeTree_get_from_context_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret1, *ret2, *ret3;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret1, *ret2, *ret3;
- RNA_pointer_create(NULL, ntreetype->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_NodeTree_get_from_context_func; /* RNA_struct_find_function(&ptr, "get_from_context"); */
+ RNA_pointer_create(NULL, ntreetype->ext.srna, NULL, &ptr); /* dummy */
+ func =
+ &rna_NodeTree_get_from_context_func; /* RNA_struct_find_function(&ptr, "get_from_context"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- ntreetype->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ ntreetype->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "result_1", &ret1);
- RNA_parameter_get_lookup(&list, "result_2", &ret2);
- RNA_parameter_get_lookup(&list, "result_3", &ret3);
- *r_ntree = *(bNodeTree **)ret1;
- *r_id = *(ID **)ret2;
- *r_from = *(ID **)ret3;
+ RNA_parameter_get_lookup(&list, "result_1", &ret1);
+ RNA_parameter_get_lookup(&list, "result_2", &ret2);
+ RNA_parameter_get_lookup(&list, "result_3", &ret3);
+ *r_ntree = *(bNodeTree **)ret1;
+ *r_id = *(ID **)ret2;
+ *r_from = *(ID **)ret3;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_NodeTree_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- bNodeTreeType *nt = RNA_struct_blender_type_get(type);
+ bNodeTreeType *nt = RNA_struct_blender_type_get(type);
- if (!nt)
- return;
+ if (!nt)
+ return;
- RNA_struct_free_extension(type, &nt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &nt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- ntreeTypeFreeLink(nt);
+ ntreeTypeFreeLink(nt);
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
}
-static StructRNA *rna_NodeTree_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_NodeTree_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeTreeType *nt, dummynt;
- bNodeTree dummyntree;
- PointerRNA dummyptr;
- int have_function[3];
+ bNodeTreeType *nt, dummynt;
+ bNodeTree dummyntree;
+ PointerRNA dummyptr;
+ int have_function[3];
- /* setup dummy tree & tree type to store static properties in */
- memset(&dummynt, 0, sizeof(bNodeTreeType));
- memset(&dummyntree, 0, sizeof(bNodeTree));
- dummyntree.typeinfo = &dummynt;
- RNA_pointer_create(NULL, &RNA_NodeTree, &dummyntree, &dummyptr);
+ /* setup dummy tree & tree type to store static properties in */
+ memset(&dummynt, 0, sizeof(bNodeTreeType));
+ memset(&dummyntree, 0, sizeof(bNodeTree));
+ dummyntree.typeinfo = &dummynt;
+ RNA_pointer_create(NULL, &RNA_NodeTree, &dummyntree, &dummyptr);
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
- if (strlen(identifier) >= sizeof(dummynt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering node tree class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummynt.idname));
- return NULL;
- }
+ if (strlen(identifier) >= sizeof(dummynt.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering node tree class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummynt.idname));
+ return NULL;
+ }
- /* check if we have registered this tree type before, and remove it */
- nt = ntreeTypeFind(dummynt.idname);
- if (nt) {
- rna_NodeTree_unregister(bmain, nt->ext.srna);
- }
+ /* check if we have registered this tree type before, and remove it */
+ nt = ntreeTypeFind(dummynt.idname);
+ if (nt) {
+ rna_NodeTree_unregister(bmain, nt->ext.srna);
+ }
- /* create a new node tree type */
- nt = MEM_callocN(sizeof(bNodeTreeType), "node tree type");
- memcpy(nt, &dummynt, sizeof(dummynt));
+ /* create a new node tree type */
+ nt = MEM_callocN(sizeof(bNodeTreeType), "node tree type");
+ memcpy(nt, &dummynt, sizeof(dummynt));
- nt->type = NTREE_CUSTOM;
+ nt->type = NTREE_CUSTOM;
- nt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, &RNA_NodeTree);
- nt->ext.data = data;
- nt->ext.call = call;
- nt->ext.free = free;
- RNA_struct_blender_type_set(nt->ext.srna, nt);
+ nt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, &RNA_NodeTree);
+ nt->ext.data = data;
+ nt->ext.call = call;
+ nt->ext.free = free;
+ RNA_struct_blender_type_set(nt->ext.srna, nt);
- RNA_def_struct_ui_text(nt->ext.srna, nt->ui_name, nt->ui_description);
- RNA_def_struct_ui_icon(nt->ext.srna, nt->ui_icon);
+ RNA_def_struct_ui_text(nt->ext.srna, nt->ui_name, nt->ui_description);
+ RNA_def_struct_ui_icon(nt->ext.srna, nt->ui_icon);
- nt->poll = (have_function[0]) ? rna_NodeTree_poll : NULL;
- nt->update = (have_function[1]) ? rna_NodeTree_update_reg : NULL;
- nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : NULL;
+ nt->poll = (have_function[0]) ? rna_NodeTree_poll : NULL;
+ nt->update = (have_function[1]) ? rna_NodeTree_update_reg : NULL;
+ nt->get_from_context = (have_function[2]) ? rna_NodeTree_get_from_context : NULL;
- ntreeTypeAdd(nt);
+ ntreeTypeAdd(nt);
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return nt->ext.srna;
+ return nt->ext.srna;
}
static bool rna_NodeTree_check(bNodeTree *ntree, ReportList *reports)
{
- if (!ntreeIsRegistered(ntree)) {
- if (reports)
- BKE_reportf(reports, RPT_ERROR, "Node tree '%s' has undefined type %s", ntree->id.name + 2, ntree->idname);
+ if (!ntreeIsRegistered(ntree)) {
+ if (reports)
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Node tree '%s' has undefined type %s",
+ ntree->id.name + 2,
+ ntree->idname);
- return false;
- }
- else
- return true;
+ return false;
+ }
+ else
+ return true;
}
static void rna_NodeTree_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_NODES, &ntree->id);
- ED_node_tag_update_nodetree(bmain, ntree, node);
+ ED_node_tag_update_nodetree(bmain, ntree, node);
}
-static bNode *rna_NodeTree_node_new(bNodeTree *ntree, bContext *C, ReportList *reports, const char *type)
+static bNode *rna_NodeTree_node_new(bNodeTree *ntree,
+ bContext *C,
+ ReportList *reports,
+ const char *type)
{
- bNodeType *ntype;
- bNode *node;
+ bNodeType *ntype;
+ bNode *node;
- if (!rna_NodeTree_check(ntree, reports))
- return NULL;
+ if (!rna_NodeTree_check(ntree, reports))
+ return NULL;
- ntype = nodeTypeFind(type);
- if (!ntype) {
- BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type);
- return NULL;
- }
+ ntype = nodeTypeFind(type);
+ if (!ntype) {
+ BKE_reportf(reports, RPT_ERROR, "Node type %s undefined", type);
+ return NULL;
+ }
- if (ntype->poll && !ntype->poll(ntype, ntree)) {
- BKE_reportf(reports, RPT_ERROR, "Cannot add node of type %s to node tree '%s'", type, ntree->id.name + 2);
- return NULL;
- }
+ if (ntype->poll && !ntype->poll(ntype, ntree)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Cannot add node of type %s to node tree '%s'",
+ type,
+ ntree->id.name + 2);
+ return NULL;
+ }
- node = nodeAddNode(C, ntree, type);
- BLI_assert(node && node->typeinfo);
+ node = nodeAddNode(C, ntree, type);
+ BLI_assert(node && node->typeinfo);
- if (ntree->type == NTREE_TEXTURE) {
- ntreeTexCheckCyclics(ntree);
- }
+ if (ntree->type == NTREE_TEXTURE) {
+ ntreeTexCheckCyclics(ntree);
+ }
- ntreeUpdateTree(CTX_data_main(C), ntree);
- nodeUpdate(ntree, node);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
+ nodeUpdate(ntree, node);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- return node;
+ return node;
}
-static void rna_NodeTree_node_remove(bNodeTree *ntree, Main *bmain, ReportList *reports, PointerRNA *node_ptr)
+static void rna_NodeTree_node_remove(bNodeTree *ntree,
+ Main *bmain,
+ ReportList *reports,
+ PointerRNA *node_ptr)
{
- bNode *node = node_ptr->data;
+ bNode *node = node_ptr->data;
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- if (BLI_findindex(&ntree->nodes, node) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
- return;
- }
+ if (BLI_findindex(&ntree->nodes, node) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Unable to locate node '%s' in node tree", node->name);
+ return;
+ }
- nodeRemoveNode(bmain, ntree, node, true);
+ nodeRemoveNode(bmain, ntree, node, true);
- RNA_POINTER_INVALIDATE(node_ptr);
+ RNA_POINTER_INVALIDATE(node_ptr);
- ntreeUpdateTree(bmain, ntree); /* update group node socket links */
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree); /* update group node socket links */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_NodeTree_node_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
{
- bNode *node = ntree->nodes.first;
+ bNode *node = ntree->nodes.first;
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- while (node) {
- bNode *next_node = node->next;
+ while (node) {
+ bNode *next_node = node->next;
- nodeRemoveNode(bmain, ntree, node, true);
+ nodeRemoveNode(bmain, ntree, node, true);
- node = next_node;
- }
+ node = next_node;
+ }
- ntreeUpdateTree(bmain, ntree);
+ ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static PointerRNA rna_NodeTree_active_node_get(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
- bNode *node = nodeGetActive(ntree);
- return rna_pointer_inherit_refine(ptr, &RNA_Node, node);
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNode *node = nodeGetActive(ntree);
+ return rna_pointer_inherit_refine(ptr, &RNA_Node, node);
}
static void rna_NodeTree_active_node_set(PointerRNA *ptr, const PointerRNA value)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
- bNode *node = (bNode *)value.data;
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNode *node = (bNode *)value.data;
- if (node && BLI_findindex(&ntree->nodes, node) != -1)
- nodeSetActive(ntree, node);
- else
- nodeClearActive(ntree);
+ if (node && BLI_findindex(&ntree->nodes, node) != -1)
+ nodeSetActive(ntree, node);
+ else
+ nodeClearActive(ntree);
}
-static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, Main *bmain, ReportList *reports,
- bNodeSocket *fromsock, bNodeSocket *tosock,
+static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree,
+ Main *bmain,
+ ReportList *reports,
+ bNodeSocket *fromsock,
+ bNodeSocket *tosock,
bool verify_limits)
{
- bNodeLink *ret;
- bNode *fromnode = NULL, *tonode = NULL;
+ bNodeLink *ret;
+ bNode *fromnode = NULL, *tonode = NULL;
- if (!rna_NodeTree_check(ntree, reports))
- return NULL;
+ if (!rna_NodeTree_check(ntree, reports))
+ return NULL;
- nodeFindNode(ntree, fromsock, &fromnode, NULL);
- nodeFindNode(ntree, tosock, &tonode, NULL);
- /* check validity of the sockets:
- * if sockets from different trees are passed in this will fail!
- */
- if (!fromnode || !tonode)
- return NULL;
+ nodeFindNode(ntree, fromsock, &fromnode, NULL);
+ nodeFindNode(ntree, tosock, &tonode, NULL);
+ /* check validity of the sockets:
+ * if sockets from different trees are passed in this will fail!
+ */
+ if (!fromnode || !tonode)
+ return NULL;
- if (&fromsock->in_out == &tosock->in_out) {
- BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
- return NULL;
- }
+ if (&fromsock->in_out == &tosock->in_out) {
+ BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets");
+ return NULL;
+ }
- if (verify_limits) {
- /* remove other socket links if limit is exceeded */
- if (nodeCountSocketLinks(ntree, fromsock) + 1 > fromsock->limit)
- nodeRemSocketLinks(ntree, fromsock);
- if (nodeCountSocketLinks(ntree, tosock) + 1 > tosock->limit)
- nodeRemSocketLinks(ntree, tosock);
- }
+ if (verify_limits) {
+ /* remove other socket links if limit is exceeded */
+ if (nodeCountSocketLinks(ntree, fromsock) + 1 > fromsock->limit)
+ nodeRemSocketLinks(ntree, fromsock);
+ if (nodeCountSocketLinks(ntree, tosock) + 1 > tosock->limit)
+ nodeRemSocketLinks(ntree, tosock);
+ }
- ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);
+ ret = nodeAddLink(ntree, fromnode, fromsock, tonode, tosock);
- if (ret) {
+ if (ret) {
- /* not an issue from the UI, clear hidden from API to keep valid state. */
- fromsock->flag &= ~SOCK_HIDDEN;
- tosock->flag &= ~SOCK_HIDDEN;
+ /* not an issue from the UI, clear hidden from API to keep valid state. */
+ fromsock->flag &= ~SOCK_HIDDEN;
+ tosock->flag &= ~SOCK_HIDDEN;
- if (tonode)
- nodeUpdate(ntree, tonode);
+ if (tonode)
+ nodeUpdate(ntree, tonode);
- ntreeUpdateTree(bmain, ntree);
+ ntreeUpdateTree(bmain, ntree);
- ED_node_tag_update_nodetree(bmain, ntree, ret->tonode);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- }
- return ret;
+ ED_node_tag_update_nodetree(bmain, ntree, ret->tonode);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ }
+ return ret;
}
-static void rna_NodeTree_link_remove(bNodeTree *ntree, Main *bmain, ReportList *reports, PointerRNA *link_ptr)
+static void rna_NodeTree_link_remove(bNodeTree *ntree,
+ Main *bmain,
+ ReportList *reports,
+ PointerRNA *link_ptr)
{
- bNodeLink *link = link_ptr->data;
+ bNodeLink *link = link_ptr->data;
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- if (BLI_findindex(&ntree->links, link) == -1) {
- BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
- return;
- }
+ if (BLI_findindex(&ntree->links, link) == -1) {
+ BKE_report(reports, RPT_ERROR, "Unable to locate link in node tree");
+ return;
+ }
- nodeRemLink(ntree, link);
- RNA_POINTER_INVALIDATE(link_ptr);
+ nodeRemLink(ntree, link);
+ RNA_POINTER_INVALIDATE(link_ptr);
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_NodeTree_link_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
{
- bNodeLink *link = ntree->links.first;
+ bNodeLink *link = ntree->links.first;
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- while (link) {
- bNodeLink *next_link = link->next;
+ while (link) {
+ bNodeLink *next_link = link->next;
- nodeRemLink(ntree, link);
+ nodeRemLink(ntree, link);
- link = next_link;
- }
- ntreeUpdateTree(bmain, ntree);
+ link = next_link;
+ }
+ ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static int rna_NodeTree_active_input_get(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
- bNodeSocket *gsock;
- int index;
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNodeSocket *gsock;
+ int index;
- for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, ++index)
- if (gsock->flag & SELECT)
- return index;
- return -1;
+ for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, ++index)
+ if (gsock->flag & SELECT)
+ return index;
+ return -1;
}
static void rna_NodeTree_active_input_set(PointerRNA *ptr, int value)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
- bNodeSocket *gsock;
- int index;
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNodeSocket *gsock;
+ int index;
- for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, ++index) {
- if (index == value)
- gsock->flag |= SELECT;
- else
- gsock->flag &= ~SELECT;
- }
- for (gsock = ntree->outputs.first; gsock; gsock = gsock->next) {
- gsock->flag &= ~SELECT;
- }
+ for (gsock = ntree->inputs.first, index = 0; gsock; gsock = gsock->next, ++index) {
+ if (index == value)
+ gsock->flag |= SELECT;
+ else
+ gsock->flag &= ~SELECT;
+ }
+ for (gsock = ntree->outputs.first; gsock; gsock = gsock->next) {
+ gsock->flag &= ~SELECT;
+ }
}
static int rna_NodeTree_active_output_get(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
- bNodeSocket *gsock;
- int index;
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNodeSocket *gsock;
+ int index;
- for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, ++index)
- if (gsock->flag & SELECT)
- return index;
- return -1;
+ for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, ++index)
+ if (gsock->flag & SELECT)
+ return index;
+ return -1;
}
static void rna_NodeTree_active_output_set(PointerRNA *ptr, int value)
{
- bNodeTree *ntree = (bNodeTree *)ptr->data;
- bNodeSocket *gsock;
- int index;
+ bNodeTree *ntree = (bNodeTree *)ptr->data;
+ bNodeSocket *gsock;
+ int index;
- for (gsock = ntree->inputs.first; gsock; gsock = gsock->next) {
- gsock->flag &= ~SELECT;
- }
- for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, ++index) {
- if (index == value)
- gsock->flag |= SELECT;
- else
- gsock->flag &= ~SELECT;
- }
+ for (gsock = ntree->inputs.first; gsock; gsock = gsock->next) {
+ gsock->flag &= ~SELECT;
+ }
+ for (gsock = ntree->outputs.first, index = 0; gsock; gsock = gsock->next, ++index) {
+ if (index == value)
+ gsock->flag |= SELECT;
+ else
+ gsock->flag &= ~SELECT;
+ }
}
-static bNodeSocket *rna_NodeTree_inputs_new(bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
+static bNodeSocket *rna_NodeTree_inputs_new(
+ bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
{
- bNodeSocket *sock;
+ bNodeSocket *sock;
- if (!rna_NodeTree_check(ntree, reports))
- return NULL;
+ if (!rna_NodeTree_check(ntree, reports))
+ return NULL;
- sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name);
+ sock = ntreeAddSocketInterface(ntree, SOCK_IN, type, name);
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- return sock;
+ return sock;
}
-static bNodeSocket *rna_NodeTree_outputs_new(bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
+static bNodeSocket *rna_NodeTree_outputs_new(
+ bNodeTree *ntree, Main *bmain, ReportList *reports, const char *type, const char *name)
{
- bNodeSocket *sock;
+ bNodeSocket *sock;
- if (!rna_NodeTree_check(ntree, reports))
- return NULL;
+ if (!rna_NodeTree_check(ntree, reports))
+ return NULL;
- sock = ntreeAddSocketInterface(ntree, SOCK_OUT, type, name);
+ sock = ntreeAddSocketInterface(ntree, SOCK_OUT, type, name);
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- return sock;
+ return sock;
}
-static void rna_NodeTree_socket_remove(bNodeTree *ntree, Main *bmain, ReportList *reports, bNodeSocket *sock)
+static void rna_NodeTree_socket_remove(bNodeTree *ntree,
+ Main *bmain,
+ ReportList *reports,
+ bNodeSocket *sock)
{
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- if (BLI_findindex(&ntree->inputs, sock) == -1 && BLI_findindex(&ntree->outputs, sock) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
- }
- else {
- ntreeRemoveSocketInterface(ntree, sock);
+ if (BLI_findindex(&ntree->inputs, sock) == -1 && BLI_findindex(&ntree->outputs, sock) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
+ }
+ else {
+ ntreeRemoveSocketInterface(ntree, sock);
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- }
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ }
}
static void rna_NodeTree_inputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
{
- bNodeSocket *sock, *nextsock;
+ bNodeSocket *sock, *nextsock;
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- for (sock = ntree->inputs.first; sock; sock = nextsock) {
- nextsock = sock->next;
- ntreeRemoveSocketInterface(ntree, sock);
- }
+ for (sock = ntree->inputs.first; sock; sock = nextsock) {
+ nextsock = sock->next;
+ ntreeRemoveSocketInterface(ntree, sock);
+ }
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_NodeTree_outputs_clear(bNodeTree *ntree, Main *bmain, ReportList *reports)
{
- bNodeSocket *sock, *nextsock;
+ bNodeSocket *sock, *nextsock;
- if (!rna_NodeTree_check(ntree, reports))
- return;
+ if (!rna_NodeTree_check(ntree, reports))
+ return;
- for (sock = ntree->outputs.first; sock; sock = nextsock) {
- nextsock = sock->next;
- ntreeRemoveSocketInterface(ntree, sock);
- }
+ for (sock = ntree->outputs.first; sock; sock = nextsock) {
+ nextsock = sock->next;
+ ntreeRemoveSocketInterface(ntree, sock);
+ }
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_NodeTree_inputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
{
- bNodeSocket *sock;
+ bNodeSocket *sock;
- if (from_index == to_index)
- return;
- if (from_index < 0 || to_index < 0)
- return;
+ if (from_index == to_index)
+ return;
+ if (from_index < 0 || to_index < 0)
+ return;
- sock = BLI_findlink(&ntree->inputs, from_index);
- if (to_index < from_index) {
- bNodeSocket *nextsock = BLI_findlink(&ntree->inputs, to_index);
- if (nextsock) {
- BLI_remlink(&ntree->inputs, sock);
- BLI_insertlinkbefore(&ntree->inputs, nextsock, sock);
- }
- }
- else {
- bNodeSocket *prevsock = BLI_findlink(&ntree->inputs, to_index);
- if (prevsock) {
- BLI_remlink(&ntree->inputs, sock);
- BLI_insertlinkafter(&ntree->inputs, prevsock, sock);
- }
- }
+ sock = BLI_findlink(&ntree->inputs, from_index);
+ if (to_index < from_index) {
+ bNodeSocket *nextsock = BLI_findlink(&ntree->inputs, to_index);
+ if (nextsock) {
+ BLI_remlink(&ntree->inputs, sock);
+ BLI_insertlinkbefore(&ntree->inputs, nextsock, sock);
+ }
+ }
+ else {
+ bNodeSocket *prevsock = BLI_findlink(&ntree->inputs, to_index);
+ if (prevsock) {
+ BLI_remlink(&ntree->inputs, sock);
+ BLI_insertlinkafter(&ntree->inputs, prevsock, sock);
+ }
+ }
- ntree->update |= NTREE_UPDATE_GROUP_IN;
+ ntree->update |= NTREE_UPDATE_GROUP_IN;
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_NodeTree_outputs_move(bNodeTree *ntree, Main *bmain, int from_index, int to_index)
{
- bNodeSocket *sock;
+ bNodeSocket *sock;
- if (from_index == to_index)
- return;
- if (from_index < 0 || to_index < 0)
- return;
+ if (from_index == to_index)
+ return;
+ if (from_index < 0 || to_index < 0)
+ return;
- sock = BLI_findlink(&ntree->outputs, from_index);
- if (to_index < from_index) {
- bNodeSocket *nextsock = BLI_findlink(&ntree->outputs, to_index);
- if (nextsock) {
- BLI_remlink(&ntree->outputs, sock);
- BLI_insertlinkbefore(&ntree->outputs, nextsock, sock);
- }
- }
- else {
- bNodeSocket *prevsock = BLI_findlink(&ntree->outputs, to_index);
- if (prevsock) {
- BLI_remlink(&ntree->outputs, sock);
- BLI_insertlinkafter(&ntree->outputs, prevsock, sock);
- }
- }
+ sock = BLI_findlink(&ntree->outputs, from_index);
+ if (to_index < from_index) {
+ bNodeSocket *nextsock = BLI_findlink(&ntree->outputs, to_index);
+ if (nextsock) {
+ BLI_remlink(&ntree->outputs, sock);
+ BLI_insertlinkbefore(&ntree->outputs, nextsock, sock);
+ }
+ }
+ else {
+ bNodeSocket *prevsock = BLI_findlink(&ntree->outputs, to_index);
+ if (prevsock) {
+ BLI_remlink(&ntree->outputs, sock);
+ BLI_insertlinkafter(&ntree->outputs, prevsock, sock);
+ }
+ }
- ntree->update |= NTREE_UPDATE_GROUP_OUT;
+ ntree->update |= NTREE_UPDATE_GROUP_OUT;
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_NodeTree_interface_update(bNodeTree *ntree, bContext *C)
{
- Main *bmain = CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
- ntree->update |= NTREE_UPDATE_GROUP;
- ntreeUpdateTree(bmain, ntree);
+ ntree->update |= NTREE_UPDATE_GROUP;
+ ntreeUpdateTree(bmain, ntree);
- ED_node_tag_update_nodetree(bmain, ntree, NULL);
+ ED_node_tag_update_nodetree(bmain, ntree, NULL);
}
-
/* ******** NodeLink ******** */
static bool rna_NodeLink_is_hidden_get(PointerRNA *ptr)
{
- bNodeLink *link = ptr->data;
- return nodeLinkIsHidden(link);
+ bNodeLink *link = ptr->data;
+ return nodeLinkIsHidden(link);
}
-
/* ******** Node ******** */
static StructRNA *rna_Node_refine(struct PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
+ bNode *node = (bNode *)ptr->data;
- if (node->typeinfo->ext.srna)
- return node->typeinfo->ext.srna;
- else
- return ptr->type;
+ if (node->typeinfo->ext.srna)
+ return node->typeinfo->ext.srna;
+ else
+ return ptr->type;
}
static char *rna_Node_path(PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
- char name_esc[sizeof(node->name) * 2];
+ bNode *node = (bNode *)ptr->data;
+ char name_esc[sizeof(node->name) * 2];
- BLI_strescape(name_esc, node->name, sizeof(name_esc));
- return BLI_sprintfN("nodes[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, node->name, sizeof(name_esc));
+ return BLI_sprintfN("nodes[\"%s\"]", name_esc);
}
char *rna_Node_ImageUser_path(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node;
- char name_esc[sizeof(node->name) * 2];
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node;
+ char name_esc[sizeof(node->name) * 2];
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->type == SH_NODE_TEX_ENVIRONMENT) {
- NodeTexEnvironment *data = node->storage;
- if (&data->iuser != ptr->data)
- continue;
- }
- else if (node->type == SH_NODE_TEX_IMAGE) {
- NodeTexImage *data = node->storage;
- if (&data->iuser != ptr->data)
- continue;
- }
- else
- continue;
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == SH_NODE_TEX_ENVIRONMENT) {
+ NodeTexEnvironment *data = node->storage;
+ if (&data->iuser != ptr->data)
+ continue;
+ }
+ else if (node->type == SH_NODE_TEX_IMAGE) {
+ NodeTexImage *data = node->storage;
+ if (&data->iuser != ptr->data)
+ continue;
+ }
+ else
+ continue;
- BLI_strescape(name_esc, node->name, sizeof(name_esc));
- return BLI_sprintfN("nodes[\"%s\"].image_user", name_esc);
- }
+ BLI_strescape(name_esc, node->name, sizeof(name_esc));
+ return BLI_sprintfN("nodes[\"%s\"].image_user", name_esc);
+ }
- return NULL;
+ return NULL;
}
static bool rna_Node_poll(bNodeType *ntype, bNodeTree *ntree)
{
- extern FunctionRNA rna_Node_poll_func;
+ extern FunctionRNA rna_Node_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, ntype->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, ntype->ext.srna, NULL, &ptr); /* dummy */
+ func = &rna_Node_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "node_tree", &ntree);
- ntype->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "node_tree", &ntree);
+ ntype->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static bool rna_Node_poll_instance(bNode *node, bNodeTree *ntree)
{
- extern FunctionRNA rna_Node_poll_instance_func;
+ extern FunctionRNA rna_Node_poll_instance_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, node->typeinfo->ext.srna, node, &ptr); /* dummy */
- func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
+ RNA_pointer_create(NULL, node->typeinfo->ext.srna, node, &ptr); /* dummy */
+ func = &rna_Node_poll_instance_func; /* RNA_struct_find_function(&ptr, "poll_instance"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "node_tree", &ntree);
- node->typeinfo->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "node_tree", &ntree);
+ node->typeinfo->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static bool rna_Node_poll_instance_default(bNode *node, bNodeTree *ntree)
{
- /* use the basic poll function */
- return rna_Node_poll(node->typeinfo, ntree);
+ /* use the basic poll function */
+ return rna_Node_poll(node->typeinfo, ntree);
}
static void rna_Node_update_reg(bNodeTree *ntree, bNode *node)
{
- extern FunctionRNA rna_Node_update_func;
+ extern FunctionRNA rna_Node_update_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create((ID *)ntree, node->typeinfo->ext.srna, node, &ptr);
- func = &rna_Node_update_func; /* RNA_struct_find_function(&ptr, "update"); */
+ RNA_pointer_create((ID *)ntree, node->typeinfo->ext.srna, node, &ptr);
+ func = &rna_Node_update_func; /* RNA_struct_find_function(&ptr, "update"); */
- RNA_parameter_list_create(&list, &ptr, func);
- node->typeinfo->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ node->typeinfo->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_insert_link(bNodeTree *ntree, bNode *node, bNodeLink *link)
{
- extern FunctionRNA rna_Node_insert_link_func;
+ extern FunctionRNA rna_Node_insert_link_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create((ID *)ntree, node->typeinfo->ext.srna, node, &ptr);
- func = &rna_Node_insert_link_func;
+ RNA_pointer_create((ID *)ntree, node->typeinfo->ext.srna, node, &ptr);
+ func = &rna_Node_insert_link_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "link", &link);
- node->typeinfo->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "link", &link);
+ node->typeinfo->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_init(const bContext *C, PointerRNA *ptr)
{
- extern FunctionRNA rna_Node_init_func;
+ extern FunctionRNA rna_Node_init_func;
- bNode *node = (bNode *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNode *node = (bNode *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- func = &rna_Node_init_func; /* RNA_struct_find_function(&ptr, "init"); */
+ func = &rna_Node_init_func; /* RNA_struct_find_function(&ptr, "init"); */
- RNA_parameter_list_create(&list, ptr, func);
- node->typeinfo->ext.call((bContext *)C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ node->typeinfo->ext.call((bContext *)C, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_copy(PointerRNA *ptr, struct bNode *copynode)
{
- extern FunctionRNA rna_Node_copy_func;
+ extern FunctionRNA rna_Node_copy_func;
- bNode *node = (bNode *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNode *node = (bNode *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- func = &rna_Node_copy_func; /* RNA_struct_find_function(&ptr, "copy"); */
+ func = &rna_Node_copy_func; /* RNA_struct_find_function(&ptr, "copy"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "node", &copynode);
- node->typeinfo->ext.call(NULL, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "node", &copynode);
+ node->typeinfo->ext.call(NULL, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_free(PointerRNA *ptr)
{
- extern FunctionRNA rna_Node_free_func;
+ extern FunctionRNA rna_Node_free_func;
- bNode *node = (bNode *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNode *node = (bNode *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- func = &rna_Node_free_func; /* RNA_struct_find_function(&ptr, "free"); */
+ func = &rna_Node_free_func; /* RNA_struct_find_function(&ptr, "free"); */
- RNA_parameter_list_create(&list, ptr, func);
- node->typeinfo->ext.call(NULL, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ node->typeinfo->ext.call(NULL, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_draw_buttons(struct uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- extern FunctionRNA rna_Node_draw_buttons_func;
+ extern FunctionRNA rna_Node_draw_buttons_func;
- bNode *node = (bNode *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNode *node = (bNode *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- func = &rna_Node_draw_buttons_func; /* RNA_struct_find_function(&ptr, "draw_buttons"); */
+ func = &rna_Node_draw_buttons_func; /* RNA_struct_find_function(&ptr, "draw_buttons"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "layout", &layout);
- node->typeinfo->ext.call(C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "layout", &layout);
+ node->typeinfo->ext.call(C, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_draw_buttons_ext(struct uiLayout *layout, bContext *C, PointerRNA *ptr)
{
- extern FunctionRNA rna_Node_draw_buttons_ext_func;
+ extern FunctionRNA rna_Node_draw_buttons_ext_func;
- bNode *node = (bNode *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNode *node = (bNode *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- func = &rna_Node_draw_buttons_ext_func; /* RNA_struct_find_function(&ptr, "draw_buttons_ext"); */
+ func = &rna_Node_draw_buttons_ext_func; /* RNA_struct_find_function(&ptr, "draw_buttons_ext"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "layout", &layout);
- node->typeinfo->ext.call(C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "layout", &layout);
+ node->typeinfo->ext.call(C, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Node_draw_label(bNodeTree *ntree, bNode *node, char *label, int maxlen)
{
- extern FunctionRNA rna_Node_draw_label_func;
+ extern FunctionRNA rna_Node_draw_label_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- char *rlabel;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ char *rlabel;
- func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
+ func = &rna_Node_draw_label_func; /* RNA_struct_find_function(&ptr, "draw_label"); */
- RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
- RNA_parameter_list_create(&list, &ptr, func);
- node->typeinfo->ext.call(NULL, &ptr, func, &list);
+ RNA_pointer_create(&ntree->id, &RNA_Node, node, &ptr);
+ RNA_parameter_list_create(&list, &ptr, func);
+ node->typeinfo->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "label", &ret);
- rlabel = *(char **)ret;
- BLI_strncpy(label, rlabel != NULL ? rlabel : "", maxlen);
+ RNA_parameter_get_lookup(&list, "label", &ret);
+ rlabel = *(char **)ret;
+ BLI_strncpy(label, rlabel != NULL ? rlabel : "", maxlen);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static bool rna_Node_is_registered_node_type(StructRNA *type)
{
- return (RNA_struct_blender_type_get(type) != NULL);
+ return (RNA_struct_blender_type_get(type) != NULL);
}
-static void rna_Node_is_registered_node_type_runtime(bContext *UNUSED(C), ReportList *UNUSED(reports), PointerRNA *ptr, ParameterList *parms)
+static void rna_Node_is_registered_node_type_runtime(bContext *UNUSED(C),
+ ReportList *UNUSED(reports),
+ PointerRNA *ptr,
+ ParameterList *parms)
{
- int result = (RNA_struct_blender_type_get(ptr->type) != NULL);
- RNA_parameter_set_lookup(parms, "result", &result);
+ int result = (RNA_struct_blender_type_get(ptr->type) != NULL);
+ RNA_parameter_set_lookup(parms, "result", &result);
}
static void rna_Node_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- bNodeType *nt = RNA_struct_blender_type_get(type);
-
- if (!nt)
- return;
+ bNodeType *nt = RNA_struct_blender_type_get(type);
- RNA_struct_free_extension(type, &nt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ if (!nt)
+ return;
- /* this also frees the allocated nt pointer, no MEM_free call needed! */
- nodeUnregisterType(nt);
+ RNA_struct_free_extension(type, &nt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
+ /* this also frees the allocated nt pointer, no MEM_free call needed! */
+ nodeUnregisterType(nt);
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
}
/* Generic internal registration function.
* Can be used to implement callbacks for registerable RNA node subtypes.
*/
-static bNodeType *rna_Node_register_base(Main *bmain, ReportList *reports, StructRNA *basetype,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- bNodeType *nt, dummynt;
- bNode dummynode;
- PointerRNA dummyptr;
- FunctionRNA *func;
- PropertyRNA *parm;
- int have_function[10];
-
- /* setup dummy node & node type to store static properties in */
- memset(&dummynt, 0, sizeof(bNodeType));
- /* this does some additional initialization of default values */
- node_type_base_custom(&dummynt, identifier, "", 0, 0);
-
- memset(&dummynode, 0, sizeof(bNode));
- dummynode.typeinfo = &dummynt;
- RNA_pointer_create(NULL, basetype, &dummynode, &dummyptr);
-
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummynt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering node class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummynt.idname));
- return NULL;
- }
-
- /* check if we have registered this node type before, and remove it */
- nt = nodeTypeFind(dummynt.idname);
- if (nt) {
- rna_Node_unregister(bmain, nt->ext.srna);
- }
-
- /* create a new node type */
- nt = MEM_callocN(sizeof(bNodeType), "node type");
- memcpy(nt, &dummynt, sizeof(dummynt));
- /* make sure the node type struct is freed on unregister */
- nt->needs_free = 1;
-
- nt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype);
- nt->ext.data = data;
- nt->ext.call = call;
- nt->ext.free = free;
- RNA_struct_blender_type_set(nt->ext.srna, nt);
-
- RNA_def_struct_ui_text(nt->ext.srna, nt->ui_name, nt->ui_description);
- RNA_def_struct_ui_icon(nt->ext.srna, nt->ui_icon);
-
- func = RNA_def_function_runtime(nt->ext.srna, "is_registered_node_type", rna_Node_is_registered_node_type_runtime);
- RNA_def_function_ui_description(func, "True if a registered node type");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
- parm = RNA_def_boolean(func, "result", false, "Result", "");
- RNA_def_function_return(func, parm);
-
- /* XXX bad level call! needed to initialize the basic draw functions ... */
- ED_init_custom_node_type(nt);
-
- nt->poll = (have_function[0]) ? rna_Node_poll : NULL;
- nt->poll_instance = (have_function[1]) ? rna_Node_poll_instance : rna_Node_poll_instance_default;
- nt->updatefunc = (have_function[2]) ? rna_Node_update_reg : NULL;
- nt->insert_link = (have_function[3]) ? rna_Node_insert_link : NULL;
- nt->initfunc_api = (have_function[4]) ? rna_Node_init : NULL;
- nt->copyfunc_api = (have_function[5]) ? rna_Node_copy : NULL;
- nt->freefunc_api = (have_function[6]) ? rna_Node_free : NULL;
- nt->draw_buttons = (have_function[7]) ? rna_Node_draw_buttons : NULL;
- nt->draw_buttons_ex = (have_function[8]) ? rna_Node_draw_buttons_ext : NULL;
- nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : NULL;
-
- /* sanitize size values in case not all have been registered */
- if (nt->maxwidth < nt->minwidth)
- nt->maxwidth = nt->minwidth;
- if (nt->maxheight < nt->minheight)
- nt->maxheight = nt->minheight;
- CLAMP(nt->width, nt->minwidth, nt->maxwidth);
- CLAMP(nt->height, nt->minheight, nt->maxheight);
-
- return nt;
-}
-
-static StructRNA *rna_Node_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_Node, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
+static bNodeType *rna_Node_register_base(Main *bmain,
+ ReportList *reports,
+ StructRNA *basetype,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ bNodeType *nt, dummynt;
+ bNode dummynode;
+ PointerRNA dummyptr;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+ int have_function[10];
+
+ /* setup dummy node & node type to store static properties in */
+ memset(&dummynt, 0, sizeof(bNodeType));
+ /* this does some additional initialization of default values */
+ node_type_base_custom(&dummynt, identifier, "", 0, 0);
+
+ memset(&dummynode, 0, sizeof(bNode));
+ dummynode.typeinfo = &dummynt;
+ RNA_pointer_create(NULL, basetype, &dummynode, &dummyptr);
+
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummynt.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering node class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummynt.idname));
+ return NULL;
+ }
+
+ /* check if we have registered this node type before, and remove it */
+ nt = nodeTypeFind(dummynt.idname);
+ if (nt) {
+ rna_Node_unregister(bmain, nt->ext.srna);
+ }
+
+ /* create a new node type */
+ nt = MEM_callocN(sizeof(bNodeType), "node type");
+ memcpy(nt, &dummynt, sizeof(dummynt));
+ /* make sure the node type struct is freed on unregister */
+ nt->needs_free = 1;
+
+ nt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, nt->idname, basetype);
+ nt->ext.data = data;
+ nt->ext.call = call;
+ nt->ext.free = free;
+ RNA_struct_blender_type_set(nt->ext.srna, nt);
+
+ RNA_def_struct_ui_text(nt->ext.srna, nt->ui_name, nt->ui_description);
+ RNA_def_struct_ui_icon(nt->ext.srna, nt->ui_icon);
+
+ func = RNA_def_function_runtime(
+ nt->ext.srna, "is_registered_node_type", rna_Node_is_registered_node_type_runtime);
+ RNA_def_function_ui_description(func, "True if a registered node type");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
+ parm = RNA_def_boolean(func, "result", false, "Result", "");
+ RNA_def_function_return(func, parm);
+
+ /* XXX bad level call! needed to initialize the basic draw functions ... */
+ ED_init_custom_node_type(nt);
+
+ nt->poll = (have_function[0]) ? rna_Node_poll : NULL;
+ nt->poll_instance = (have_function[1]) ? rna_Node_poll_instance : rna_Node_poll_instance_default;
+ nt->updatefunc = (have_function[2]) ? rna_Node_update_reg : NULL;
+ nt->insert_link = (have_function[3]) ? rna_Node_insert_link : NULL;
+ nt->initfunc_api = (have_function[4]) ? rna_Node_init : NULL;
+ nt->copyfunc_api = (have_function[5]) ? rna_Node_copy : NULL;
+ nt->freefunc_api = (have_function[6]) ? rna_Node_free : NULL;
+ nt->draw_buttons = (have_function[7]) ? rna_Node_draw_buttons : NULL;
+ nt->draw_buttons_ex = (have_function[8]) ? rna_Node_draw_buttons_ext : NULL;
+ nt->labelfunc = (have_function[9]) ? rna_Node_draw_label : NULL;
+
+ /* sanitize size values in case not all have been registered */
+ if (nt->maxwidth < nt->minwidth)
+ nt->maxwidth = nt->minwidth;
+ if (nt->maxheight < nt->minheight)
+ nt->maxheight = nt->minheight;
+ CLAMP(nt->width, nt->minwidth, nt->maxwidth);
+ CLAMP(nt->height, nt->minheight, nt->maxheight);
+
+ return nt;
+}
+
+static StructRNA *rna_Node_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_Node, data, identifier, validate, call, free);
+ if (!nt)
+ return NULL;
+
+ nodeRegisterType(nt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+
+ return nt->ext.srna;
+}
+
+static StructRNA *rna_ShaderNode_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free);
+ if (!nt)
+ return NULL;
- nodeRegisterType(nt);
+ nodeRegisterType(nt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+
+ return nt->ext.srna;
+}
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
-
- return nt->ext.srna;
-}
-
-static StructRNA *rna_ShaderNode_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_ShaderNode, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
-
- nodeRegisterType(nt);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
-
- return nt->ext.srna;
-}
-
-static StructRNA *rna_CompositorNode_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_CompositorNode_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_CompositorNode, data, identifier, validate, call, free);
+ if (!nt)
+ return NULL;
- nodeRegisterType(nt);
+ nodeRegisterType(nt);
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return nt->ext.srna;
+ return nt->ext.srna;
}
-static StructRNA *rna_TextureNode_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_TextureNode_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_TextureNode, data, identifier, validate, call, free);
+ if (!nt)
+ return NULL;
- nodeRegisterType(nt);
+ nodeRegisterType(nt);
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return nt->ext.srna;
+ return nt->ext.srna;
}
static IDProperty *rna_Node_idprops(PointerRNA *ptr, bool create)
{
- bNode *node = ptr->data;
+ bNode *node = ptr->data;
- if (create && !node->prop) {
- IDPropertyTemplate val = {0};
- node->prop = IDP_New(IDP_GROUP, &val, "RNA_Node ID properties");
- }
+ if (create && !node->prop) {
+ IDPropertyTemplate val = {0};
+ node->prop = IDP_New(IDP_GROUP, &val, "RNA_Node ID properties");
+ }
- return node->prop;
+ return node->prop;
}
static void rna_Node_parent_set(PointerRNA *ptr, PointerRNA value)
{
- bNode *node = ptr->data;
- bNode *parent = value.data;
+ bNode *node = ptr->data;
+ bNode *parent = value.data;
- if (parent) {
- /* XXX only Frame node allowed for now,
- * in the future should have a poll function or so to test possible attachment.
- */
- if (parent->type != NODE_FRAME)
- return;
+ if (parent) {
+ /* XXX only Frame node allowed for now,
+ * in the future should have a poll function or so to test possible attachment.
+ */
+ if (parent->type != NODE_FRAME)
+ return;
- /* make sure parent is not attached to the node */
- if (nodeAttachNodeCheck(parent, node))
- return;
- }
+ /* make sure parent is not attached to the node */
+ if (nodeAttachNodeCheck(parent, node))
+ return;
+ }
- nodeDetachNode(node);
- if (parent) {
- nodeAttachNode(node, parent);
- }
+ nodeDetachNode(node);
+ if (parent) {
+ nodeAttachNode(node, parent);
+ }
}
static bool rna_Node_parent_poll(PointerRNA *ptr, PointerRNA value)
{
- bNode *node = ptr->data;
- bNode *parent = value.data;
+ bNode *node = ptr->data;
+ bNode *parent = value.data;
- /* XXX only Frame node allowed for now,
- * in the future should have a poll function or so to test possible attachment.
- */
- if (parent->type != NODE_FRAME)
- return false;
+ /* XXX only Frame node allowed for now,
+ * in the future should have a poll function or so to test possible attachment.
+ */
+ if (parent->type != NODE_FRAME)
+ return false;
- /* make sure parent is not attached to the node */
- if (nodeAttachNodeCheck(parent, node))
- return false;
+ /* make sure parent is not attached to the node */
+ if (nodeAttachNodeCheck(parent, node))
+ return false;
- return true;
+ return true;
}
static void rna_Node_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
- ED_node_tag_update_nodetree(bmain, ntree, node);
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
+ ED_node_tag_update_nodetree(bmain, ntree, node);
}
static void rna_Node_socket_value_update(ID *id, bNode *node, bContext *C)
{
- ED_node_tag_update_nodetree(CTX_data_main(C), (bNodeTree *)id, node);
+ ED_node_tag_update_nodetree(CTX_data_main(C), (bNodeTree *)id, node);
}
static void rna_Node_select_set(PointerRNA *ptr, bool value)
{
- bNode *node = (bNode *)ptr->data;
- nodeSetSelected(node, value);
+ bNode *node = (bNode *)ptr->data;
+ nodeSetSelected(node, value);
}
static void rna_Node_name_set(PointerRNA *ptr, const char *value)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
- char oldname[sizeof(node->name)];
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
+ char oldname[sizeof(node->name)];
- /* make a copy of the old name first */
- BLI_strncpy(oldname, node->name, sizeof(node->name));
- /* set new name */
- BLI_strncpy_utf8(node->name, value, sizeof(node->name));
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, node->name, sizeof(node->name));
+ /* set new name */
+ BLI_strncpy_utf8(node->name, value, sizeof(node->name));
- nodeUniqueName(ntree, node);
+ nodeUniqueName(ntree, node);
- /* fix all the animation data which may link to this */
- BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
+ /* fix all the animation data which may link to this */
+ BKE_animdata_fix_paths_rename_all(NULL, "nodes", oldname, node->name);
}
-static bNodeSocket *rna_Node_inputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
+static bNodeSocket *rna_Node_inputs_new(ID *id,
+ bNode *node,
+ Main *bmain,
+ ReportList *reports,
+ const char *type,
+ const char *name,
+ const char *identifier)
{
- /* Adding an input to a group node is not working, simpler to add it to its underlying nodetree. */
- if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
- return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, reports, type, name);
- }
+ /* Adding an input to a group node is not working, simpler to add it to its underlying nodetree. */
+ if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
+ return rna_NodeTree_inputs_new((bNodeTree *)node->id, bmain, reports, type, name);
+ }
- bNodeTree *ntree = (bNodeTree *)id;
- bNodeSocket *sock;
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNodeSocket *sock;
- sock = nodeAddSocket(ntree, node, SOCK_IN, type, identifier, name);
+ sock = nodeAddSocket(ntree, node, SOCK_IN, type, identifier, name);
- if (sock == NULL) {
- BKE_report(reports, RPT_ERROR, "Unable to create socket");
- }
- else {
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- }
+ if (sock == NULL) {
+ BKE_report(reports, RPT_ERROR, "Unable to create socket");
+ }
+ else {
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ }
- return sock;
+ return sock;
}
-static bNodeSocket *rna_Node_outputs_new(ID *id, bNode *node, Main *bmain, ReportList *reports, const char *type, const char *name, const char *identifier)
+static bNodeSocket *rna_Node_outputs_new(ID *id,
+ bNode *node,
+ Main *bmain,
+ ReportList *reports,
+ const char *type,
+ const char *name,
+ const char *identifier)
{
- /* Adding an output to a group node is not working, simpler to add it to its underlying nodetree. */
- if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
- return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, reports, type, name);
- }
+ /* Adding an output to a group node is not working, simpler to add it to its underlying nodetree. */
+ if (ELEM(node->type, NODE_GROUP, NODE_CUSTOM_GROUP) && node->id != NULL) {
+ return rna_NodeTree_outputs_new((bNodeTree *)node->id, bmain, reports, type, name);
+ }
- bNodeTree *ntree = (bNodeTree *)id;
- bNodeSocket *sock;
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNodeSocket *sock;
- sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, name);
+ sock = nodeAddSocket(ntree, node, SOCK_OUT, type, identifier, name);
- if (sock == NULL) {
- BKE_report(reports, RPT_ERROR, "Unable to create socket");
- }
- else {
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- }
+ if (sock == NULL) {
+ BKE_report(reports, RPT_ERROR, "Unable to create socket");
+ }
+ else {
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ }
- return sock;
+ return sock;
}
-static void rna_Node_socket_remove(ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
+static void rna_Node_socket_remove(
+ ID *id, bNode *node, Main *bmain, ReportList *reports, bNodeSocket *sock)
{
- bNodeTree *ntree = (bNodeTree *)id;
+ bNodeTree *ntree = (bNodeTree *)id;
- if (BLI_findindex(&node->inputs, sock) == -1 && BLI_findindex(&node->outputs, sock) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
- }
- else {
- nodeRemoveSocket(ntree, node, sock);
+ if (BLI_findindex(&node->inputs, sock) == -1 && BLI_findindex(&node->outputs, sock) == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Unable to locate socket '%s' in node", sock->identifier);
+ }
+ else {
+ nodeRemoveSocket(ntree, node, sock);
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- }
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ }
}
static void rna_Node_inputs_clear(ID *id, bNode *node, Main *bmain)
{
- bNodeTree *ntree = (bNodeTree *)id;
- bNodeSocket *sock, *nextsock;
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNodeSocket *sock, *nextsock;
- for (sock = node->inputs.first; sock; sock = nextsock) {
- nextsock = sock->next;
- nodeRemoveSocket(ntree, node, sock);
- }
+ for (sock = node->inputs.first; sock; sock = nextsock) {
+ nextsock = sock->next;
+ nodeRemoveSocket(ntree, node, sock);
+ }
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_Node_outputs_clear(ID *id, bNode *node, Main *bmain)
{
- bNodeTree *ntree = (bNodeTree *)id;
- bNodeSocket *sock, *nextsock;
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNodeSocket *sock, *nextsock;
- for (sock = node->outputs.first; sock; sock = nextsock) {
- nextsock = sock->next;
- nodeRemoveSocket(ntree, node, sock);
- }
+ for (sock = node->outputs.first; sock; sock = nextsock) {
+ nextsock = sock->next;
+ nodeRemoveSocket(ntree, node, sock);
+ }
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_Node_inputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
{
- bNodeTree *ntree = (bNodeTree *)id;
- bNodeSocket *sock;
-
- if (from_index == to_index)
- return;
- if (from_index < 0 || to_index < 0)
- return;
-
- sock = BLI_findlink(&node->inputs, from_index);
- if (to_index < from_index) {
- bNodeSocket *nextsock = BLI_findlink(&node->inputs, to_index);
- if (nextsock) {
- BLI_remlink(&node->inputs, sock);
- BLI_insertlinkbefore(&node->inputs, nextsock, sock);
- }
- }
- else {
- bNodeSocket *prevsock = BLI_findlink(&node->inputs, to_index);
- if (prevsock) {
- BLI_remlink(&node->inputs, sock);
- BLI_insertlinkafter(&node->inputs, prevsock, sock);
- }
- }
-
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNodeSocket *sock;
+
+ if (from_index == to_index)
+ return;
+ if (from_index < 0 || to_index < 0)
+ return;
+
+ sock = BLI_findlink(&node->inputs, from_index);
+ if (to_index < from_index) {
+ bNodeSocket *nextsock = BLI_findlink(&node->inputs, to_index);
+ if (nextsock) {
+ BLI_remlink(&node->inputs, sock);
+ BLI_insertlinkbefore(&node->inputs, nextsock, sock);
+ }
+ }
+ else {
+ bNodeSocket *prevsock = BLI_findlink(&node->inputs, to_index);
+ if (prevsock) {
+ BLI_remlink(&node->inputs, sock);
+ BLI_insertlinkafter(&node->inputs, prevsock, sock);
+ }
+ }
+
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
static void rna_Node_outputs_move(ID *id, bNode *node, Main *bmain, int from_index, int to_index)
{
- bNodeTree *ntree = (bNodeTree *)id;
- bNodeSocket *sock;
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNodeSocket *sock;
- if (from_index == to_index)
- return;
- if (from_index < 0 || to_index < 0)
- return;
+ if (from_index == to_index)
+ return;
+ if (from_index < 0 || to_index < 0)
+ return;
- sock = BLI_findlink(&node->outputs, from_index);
- if (to_index < from_index) {
- bNodeSocket *nextsock = BLI_findlink(&node->outputs, to_index);
- if (nextsock) {
- BLI_remlink(&node->outputs, sock);
- BLI_insertlinkbefore(&node->outputs, nextsock, sock);
- }
- }
- else {
- bNodeSocket *prevsock = BLI_findlink(&node->outputs, to_index);
- if (prevsock) {
- BLI_remlink(&node->outputs, sock);
- BLI_insertlinkafter(&node->outputs, prevsock, sock);
- }
- }
+ sock = BLI_findlink(&node->outputs, from_index);
+ if (to_index < from_index) {
+ bNodeSocket *nextsock = BLI_findlink(&node->outputs, to_index);
+ if (nextsock) {
+ BLI_remlink(&node->outputs, sock);
+ BLI_insertlinkbefore(&node->outputs, nextsock, sock);
+ }
+ }
+ else {
+ bNodeSocket *prevsock = BLI_findlink(&node->outputs, to_index);
+ if (prevsock) {
+ BLI_remlink(&node->outputs, sock);
+ BLI_insertlinkafter(&node->outputs, prevsock, sock);
+ }
+ }
- ntreeUpdateTree(bmain, ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(bmain, ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
}
-static void rna_Node_width_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
+static void rna_Node_width_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- bNode *node = ptr->data;
- *min = *softmin = node->typeinfo->minwidth;
- *max = *softmax = node->typeinfo->maxwidth;
+ bNode *node = ptr->data;
+ *min = *softmin = node->typeinfo->minwidth;
+ *max = *softmax = node->typeinfo->maxwidth;
}
-static void rna_Node_height_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
+static void rna_Node_height_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- bNode *node = ptr->data;
- *min = *softmin = node->typeinfo->minheight;
- *max = *softmax = node->typeinfo->maxheight;
+ bNode *node = ptr->data;
+ *min = *softmin = node->typeinfo->minheight;
+ *max = *softmax = node->typeinfo->maxheight;
}
static void rna_Node_dimensions_get(PointerRNA *ptr, float *value)
{
- bNode *node = ptr->data;
- value[0] = node->totr.xmax - node->totr.xmin;
- value[1] = node->totr.ymax - node->totr.ymin;
+ bNode *node = ptr->data;
+ value[0] = node->totr.xmax - node->totr.xmin;
+ value[1] = node->totr.ymax - node->totr.ymin;
}
-
/* ******** Node Socket ******** */
-static void rna_NodeSocket_draw(bContext *C, struct uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
+static void rna_NodeSocket_draw(
+ bContext *C, struct uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text)
{
- extern FunctionRNA rna_NodeSocket_draw_func;
+ extern FunctionRNA rna_NodeSocket_draw_func;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- func = &rna_NodeSocket_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
+ func = &rna_NodeSocket_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "layout", &layout);
- RNA_parameter_set_lookup(&list, "node", node_ptr);
- RNA_parameter_set_lookup(&list, "text", &text);
- sock->typeinfo->ext_socket.call(C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "layout", &layout);
+ RNA_parameter_set_lookup(&list, "node", node_ptr);
+ RNA_parameter_set_lookup(&list, "text", &text);
+ sock->typeinfo->ext_socket.call(C, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void rna_NodeSocket_draw_color(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color)
+static void rna_NodeSocket_draw_color(bContext *C,
+ PointerRNA *ptr,
+ PointerRNA *node_ptr,
+ float *r_color)
{
- extern FunctionRNA rna_NodeSocket_draw_color_func;
+ extern FunctionRNA rna_NodeSocket_draw_color_func;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
- func = &rna_NodeSocket_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
+ func = &rna_NodeSocket_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "node", node_ptr);
- sock->typeinfo->ext_socket.call(C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "node", node_ptr);
+ sock->typeinfo->ext_socket.call(C, ptr, func, &list);
- RNA_parameter_get_lookup(&list, "color", &ret);
- copy_v4_v4(r_color, (float *)ret);
+ RNA_parameter_get_lookup(&list, "color", &ret);
+ copy_v4_v4(r_color, (float *)ret);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_NodeSocket_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- bNodeSocketType *st = RNA_struct_blender_type_get(type);
- if (!st)
- return;
+ bNodeSocketType *st = RNA_struct_blender_type_get(type);
+ if (!st)
+ return;
- RNA_struct_free_extension(type, &st->ext_socket);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &st->ext_socket);
+ RNA_struct_free(&BLENDER_RNA, type);
- nodeUnregisterSocketType(st);
+ nodeUnregisterSocketType(st);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
}
-static StructRNA *rna_NodeSocket_register(
- Main *UNUSED(bmain), ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_NodeSocket_register(Main *UNUSED(bmain),
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeSocketType *st, dummyst;
- bNodeSocket dummysock;
- PointerRNA dummyptr;
- int have_function[2];
+ bNodeSocketType *st, dummyst;
+ bNodeSocket dummysock;
+ PointerRNA dummyptr;
+ int have_function[2];
- /* setup dummy socket & socket type to store static properties in */
- memset(&dummyst, 0, sizeof(bNodeSocketType));
+ /* setup dummy socket & socket type to store static properties in */
+ memset(&dummyst, 0, sizeof(bNodeSocketType));
- memset(&dummysock, 0, sizeof(bNodeSocket));
- dummysock.typeinfo = &dummyst;
- RNA_pointer_create(NULL, &RNA_NodeSocket, &dummysock, &dummyptr);
+ memset(&dummysock, 0, sizeof(bNodeSocket));
+ dummysock.typeinfo = &dummyst;
+ RNA_pointer_create(NULL, &RNA_NodeSocket, &dummysock, &dummyptr);
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
- if (strlen(identifier) >= sizeof(dummyst.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering node socket class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyst.idname));
- return NULL;
- }
+ if (strlen(identifier) >= sizeof(dummyst.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering node socket class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummyst.idname));
+ return NULL;
+ }
- /* check if we have registered this socket type before */
- st = nodeSocketTypeFind(dummyst.idname);
- if (!st) {
- /* create a new node socket type */
- st = MEM_callocN(sizeof(bNodeSocketType), "node socket type");
- memcpy(st, &dummyst, sizeof(dummyst));
+ /* check if we have registered this socket type before */
+ st = nodeSocketTypeFind(dummyst.idname);
+ if (!st) {
+ /* create a new node socket type */
+ st = MEM_callocN(sizeof(bNodeSocketType), "node socket type");
+ memcpy(st, &dummyst, sizeof(dummyst));
- nodeRegisterSocketType(st);
- }
+ nodeRegisterSocketType(st);
+ }
- /* if RNA type is already registered, unregister first */
- if (st->ext_socket.srna) {
- StructRNA *srna = st->ext_socket.srna;
- RNA_struct_free_extension(srna, &st->ext_socket);
- RNA_struct_free(&BLENDER_RNA, srna);
- }
- st->ext_socket.srna = RNA_def_struct_ptr(&BLENDER_RNA, st->idname, &RNA_NodeSocket);
- st->ext_socket.data = data;
- st->ext_socket.call = call;
- st->ext_socket.free = free;
- RNA_struct_blender_type_set(st->ext_socket.srna, st);
+ /* if RNA type is already registered, unregister first */
+ if (st->ext_socket.srna) {
+ StructRNA *srna = st->ext_socket.srna;
+ RNA_struct_free_extension(srna, &st->ext_socket);
+ RNA_struct_free(&BLENDER_RNA, srna);
+ }
+ st->ext_socket.srna = RNA_def_struct_ptr(&BLENDER_RNA, st->idname, &RNA_NodeSocket);
+ st->ext_socket.data = data;
+ st->ext_socket.call = call;
+ st->ext_socket.free = free;
+ RNA_struct_blender_type_set(st->ext_socket.srna, st);
- /* XXX bad level call! needed to initialize the basic draw functions ... */
- ED_init_custom_node_socket_type(st);
+ /* XXX bad level call! needed to initialize the basic draw functions ... */
+ ED_init_custom_node_socket_type(st);
- st->draw = (have_function[0]) ? rna_NodeSocket_draw : NULL;
- st->draw_color = (have_function[1]) ? rna_NodeSocket_draw_color : NULL;
+ st->draw = (have_function[0]) ? rna_NodeSocket_draw : NULL;
+ st->draw_color = (have_function[1]) ? rna_NodeSocket_draw_color : NULL;
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return st->ext_socket.srna;
+ return st->ext_socket.srna;
}
static StructRNA *rna_NodeSocket_refine(PointerRNA *ptr)
{
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
- if (sock->typeinfo->ext_socket.srna)
- return sock->typeinfo->ext_socket.srna;
- else
- return &RNA_NodeSocket;
+ if (sock->typeinfo->ext_socket.srna)
+ return sock->typeinfo->ext_socket.srna;
+ else
+ return &RNA_NodeSocket;
}
static char *rna_NodeSocket_path(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- bNode *node;
- int socketindex;
- char name_esc[sizeof(node->name) * 2];
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ bNode *node;
+ int socketindex;
+ char name_esc[sizeof(node->name) * 2];
- if (!nodeFindNode(ntree, sock, &node, &socketindex))
- return NULL;
+ if (!nodeFindNode(ntree, sock, &node, &socketindex))
+ return NULL;
- BLI_strescape(name_esc, node->name, sizeof(name_esc));
+ BLI_strescape(name_esc, node->name, sizeof(name_esc));
- if (sock->in_out == SOCK_IN) {
- return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", name_esc, socketindex);
- }
- else {
- return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", name_esc, socketindex);
- }
+ if (sock->in_out == SOCK_IN) {
+ return BLI_sprintfN("nodes[\"%s\"].inputs[%d]", name_esc, socketindex);
+ }
+ else {
+ return BLI_sprintfN("nodes[\"%s\"].outputs[%d]", name_esc, socketindex);
+ }
}
static IDProperty *rna_NodeSocket_idprops(PointerRNA *ptr, bool create)
{
- bNodeSocket *sock = ptr->data;
+ bNodeSocket *sock = ptr->data;
- if (create && !sock->prop) {
- IDPropertyTemplate val = {0};
- sock->prop = IDP_New(IDP_GROUP, &val, "RNA_NodeSocket ID properties");
- }
+ if (create && !sock->prop) {
+ IDPropertyTemplate val = {0};
+ sock->prop = IDP_New(IDP_GROUP, &val, "RNA_NodeSocket ID properties");
+ }
- return sock->prop;
+ return sock->prop;
}
static PointerRNA rna_NodeSocket_node_get(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- bNode *node;
- PointerRNA r_ptr;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ bNode *node;
+ PointerRNA r_ptr;
- nodeFindNode(ntree, sock, &node, NULL);
+ nodeFindNode(ntree, sock, &node, NULL);
- RNA_pointer_create((ID *)ntree, &RNA_Node, node, &r_ptr);
- return r_ptr;
+ RNA_pointer_create((ID *)ntree, &RNA_Node, node, &r_ptr);
+ return r_ptr;
}
static void rna_NodeSocket_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- bNode *node;
- if (nodeFindNode(ntree, sock, &node, NULL)) {
- ED_node_tag_update_nodetree(bmain, ntree, node);
- }
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ bNode *node;
+ if (nodeFindNode(ntree, sock, &node, NULL)) {
+ ED_node_tag_update_nodetree(bmain, ntree, node);
+ }
}
static bool rna_NodeSocket_is_output_get(PointerRNA *ptr)
{
- bNodeSocket *sock = ptr->data;
- return sock->in_out == SOCK_OUT;
+ bNodeSocket *sock = ptr->data;
+ return sock->in_out == SOCK_OUT;
}
static void rna_NodeSocket_link_limit_set(PointerRNA *ptr, int value)
{
- bNodeSocket *sock = ptr->data;
- sock->limit = (value == 0 ? 0xFFF : value);
+ bNodeSocket *sock = ptr->data;
+ sock->limit = (value == 0 ? 0xFFF : value);
}
static void rna_NodeSocket_hide_set(PointerRNA *ptr, bool value)
{
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
- /* don't hide linked sockets */
- if (sock->flag & SOCK_IN_USE)
- return;
+ /* don't hide linked sockets */
+ if (sock->flag & SOCK_IN_USE)
+ return;
- if (value)
- sock->flag |= SOCK_HIDDEN;
- else
- sock->flag &= ~SOCK_HIDDEN;
+ if (value)
+ sock->flag |= SOCK_HIDDEN;
+ else
+ sock->flag &= ~SOCK_HIDDEN;
}
-
static void rna_NodeSocketInterface_draw(bContext *C, struct uiLayout *layout, PointerRNA *ptr)
{
- extern FunctionRNA rna_NodeSocketInterface_draw_func;
+ extern FunctionRNA rna_NodeSocketInterface_draw_func;
- bNodeSocket *stemp = (bNodeSocket *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
+ bNodeSocket *stemp = (bNodeSocket *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
- if (!stemp->typeinfo)
- return;
+ if (!stemp->typeinfo)
+ return;
- func = &rna_NodeSocketInterface_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
+ func = &rna_NodeSocketInterface_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "layout", &layout);
- stemp->typeinfo->ext_interface.call(C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "layout", &layout);
+ stemp->typeinfo->ext_interface.call(C, ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_NodeSocketInterface_draw_color(bContext *C, PointerRNA *ptr, float *r_color)
{
- extern FunctionRNA rna_NodeSocketInterface_draw_color_func;
+ extern FunctionRNA rna_NodeSocketInterface_draw_color_func;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
- if (!sock->typeinfo)
- return;
+ if (!sock->typeinfo)
+ return;
- func = &rna_NodeSocketInterface_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
+ func =
+ &rna_NodeSocketInterface_draw_color_func; /* RNA_struct_find_function(&ptr, "draw_color"); */
- RNA_parameter_list_create(&list, ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- sock->typeinfo->ext_interface.call(C, ptr, func, &list);
+ RNA_parameter_list_create(&list, ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ sock->typeinfo->ext_interface.call(C, ptr, func, &list);
- RNA_parameter_get_lookup(&list, "color", &ret);
- copy_v4_v4(r_color, (float *)ret);
+ RNA_parameter_get_lookup(&list, "color", &ret);
+ copy_v4_v4(r_color, (float *)ret);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void rna_NodeSocketInterface_register_properties(bNodeTree *ntree, bNodeSocket *stemp, StructRNA *data_srna)
+static void rna_NodeSocketInterface_register_properties(bNodeTree *ntree,
+ bNodeSocket *stemp,
+ StructRNA *data_srna)
{
- extern FunctionRNA rna_NodeSocketInterface_register_properties_func;
+ extern FunctionRNA rna_NodeSocketInterface_register_properties_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- if (!stemp->typeinfo)
- return;
+ if (!stemp->typeinfo)
+ return;
- RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
- func = &rna_NodeSocketInterface_register_properties_func; /* RNA_struct_find_function(&ptr, "register_properties"); */
+ RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
+ func =
+ &rna_NodeSocketInterface_register_properties_func; /* RNA_struct_find_function(&ptr, "register_properties"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "data_rna_type", &data_srna);
- stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "data_rna_type", &data_srna);
+ stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void rna_NodeSocketInterface_init_socket(bNodeTree *ntree, bNodeSocket *stemp, bNode *node, bNodeSocket *sock, const char *data_path)
+static void rna_NodeSocketInterface_init_socket(
+ bNodeTree *ntree, bNodeSocket *stemp, bNode *node, bNodeSocket *sock, const char *data_path)
{
- extern FunctionRNA rna_NodeSocketInterface_init_socket_func;
+ extern FunctionRNA rna_NodeSocketInterface_init_socket_func;
- PointerRNA ptr, node_ptr, sock_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr, node_ptr, sock_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- if (!stemp->typeinfo)
- return;
+ if (!stemp->typeinfo)
+ return;
- RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
- RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
- RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
- func = &rna_NodeSocketInterface_init_socket_func; /* RNA_struct_find_function(&ptr, "init_socket"); */
+ RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
+ RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
+ RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
+ func =
+ &rna_NodeSocketInterface_init_socket_func; /* RNA_struct_find_function(&ptr, "init_socket"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "node", &node_ptr);
- RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
- RNA_parameter_set_lookup(&list, "data_path", &data_path);
- stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "node", &node_ptr);
+ RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
+ RNA_parameter_set_lookup(&list, "data_path", &data_path);
+ stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree, bNodeSocket *stemp, bNode *node, bNodeSocket *sock)
+static void rna_NodeSocketInterface_from_socket(bNodeTree *ntree,
+ bNodeSocket *stemp,
+ bNode *node,
+ bNodeSocket *sock)
{
- extern FunctionRNA rna_NodeSocketInterface_from_socket_func;
+ extern FunctionRNA rna_NodeSocketInterface_from_socket_func;
- PointerRNA ptr, node_ptr, sock_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr, node_ptr, sock_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- if (!stemp->typeinfo)
- return;
+ if (!stemp->typeinfo)
+ return;
- RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
- RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
- RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
- func = &rna_NodeSocketInterface_from_socket_func; /* RNA_struct_find_function(&ptr, "from_socket"); */
+ RNA_pointer_create((ID *)ntree, &RNA_NodeSocketInterface, stemp, &ptr);
+ RNA_pointer_create((ID *)ntree, &RNA_Node, node, &node_ptr);
+ RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &sock_ptr);
+ func =
+ &rna_NodeSocketInterface_from_socket_func; /* RNA_struct_find_function(&ptr, "from_socket"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "node", &node_ptr);
- RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
- stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "node", &node_ptr);
+ RNA_parameter_set_lookup(&list, "socket", &sock_ptr);
+ stemp->typeinfo->ext_interface.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_NodeSocketInterface_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- bNodeSocketType *st = RNA_struct_blender_type_get(type);
- if (!st)
- return;
-
- RNA_struct_free_extension(type, &st->ext_interface);
-
- RNA_struct_free(&BLENDER_RNA, type);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
-}
-
-static StructRNA *rna_NodeSocketInterface_register(
- Main *UNUSED(bmain), ReportList *UNUSED(reports), void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- bNodeSocketType *st, dummyst;
- bNodeSocket dummysock;
- PointerRNA dummyptr;
- int have_function[5];
-
- /* setup dummy socket & socket type to store static properties in */
- memset(&dummyst, 0, sizeof(bNodeSocketType));
-
- memset(&dummysock, 0, sizeof(bNodeSocket));
- dummysock.typeinfo = &dummyst;
- RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummysock, &dummyptr);
-
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
-
- /* check if we have registered this socket type before */
- st = nodeSocketTypeFind(dummyst.idname);
- if (st) {
- /* basic socket type registered by a socket class before. */
- }
- else {
- /* create a new node socket type */
- st = MEM_callocN(sizeof(bNodeSocketType), "node socket type");
- memcpy(st, &dummyst, sizeof(dummyst));
-
- nodeRegisterSocketType(st);
- }
-
- /* if RNA type is already registered, unregister first */
- if (st->ext_interface.srna) {
- StructRNA *srna = st->ext_interface.srna;
- RNA_struct_free_extension(srna, &st->ext_interface);
- RNA_struct_free(&BLENDER_RNA, srna);
- }
- st->ext_interface.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_NodeSocketInterface);
- st->ext_interface.data = data;
- st->ext_interface.call = call;
- st->ext_interface.free = free;
- RNA_struct_blender_type_set(st->ext_interface.srna, st);
-
- st->interface_draw = (have_function[0]) ? rna_NodeSocketInterface_draw : NULL;
- st->interface_draw_color = (have_function[1]) ? rna_NodeSocketInterface_draw_color : NULL;
- st->interface_register_properties = (have_function[2]) ? rna_NodeSocketInterface_register_properties : NULL;
- st->interface_init_socket = (have_function[3]) ? rna_NodeSocketInterface_init_socket : NULL;
- st->interface_from_socket = (have_function[4]) ? rna_NodeSocketInterface_from_socket : NULL;
-
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
-
- return st->ext_interface.srna;
+ bNodeSocketType *st = RNA_struct_blender_type_get(type);
+ if (!st)
+ return;
+
+ RNA_struct_free_extension(type, &st->ext_interface);
+
+ RNA_struct_free(&BLENDER_RNA, type);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+}
+
+static StructRNA *rna_NodeSocketInterface_register(Main *UNUSED(bmain),
+ ReportList *UNUSED(reports),
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ bNodeSocketType *st, dummyst;
+ bNodeSocket dummysock;
+ PointerRNA dummyptr;
+ int have_function[5];
+
+ /* setup dummy socket & socket type to store static properties in */
+ memset(&dummyst, 0, sizeof(bNodeSocketType));
+
+ memset(&dummysock, 0, sizeof(bNodeSocket));
+ dummysock.typeinfo = &dummyst;
+ RNA_pointer_create(NULL, &RNA_NodeSocketInterface, &dummysock, &dummyptr);
+
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
+
+ /* check if we have registered this socket type before */
+ st = nodeSocketTypeFind(dummyst.idname);
+ if (st) {
+ /* basic socket type registered by a socket class before. */
+ }
+ else {
+ /* create a new node socket type */
+ st = MEM_callocN(sizeof(bNodeSocketType), "node socket type");
+ memcpy(st, &dummyst, sizeof(dummyst));
+
+ nodeRegisterSocketType(st);
+ }
+
+ /* if RNA type is already registered, unregister first */
+ if (st->ext_interface.srna) {
+ StructRNA *srna = st->ext_interface.srna;
+ RNA_struct_free_extension(srna, &st->ext_interface);
+ RNA_struct_free(&BLENDER_RNA, srna);
+ }
+ st->ext_interface.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_NodeSocketInterface);
+ st->ext_interface.data = data;
+ st->ext_interface.call = call;
+ st->ext_interface.free = free;
+ RNA_struct_blender_type_set(st->ext_interface.srna, st);
+
+ st->interface_draw = (have_function[0]) ? rna_NodeSocketInterface_draw : NULL;
+ st->interface_draw_color = (have_function[1]) ? rna_NodeSocketInterface_draw_color : NULL;
+ st->interface_register_properties = (have_function[2]) ?
+ rna_NodeSocketInterface_register_properties :
+ NULL;
+ st->interface_init_socket = (have_function[3]) ? rna_NodeSocketInterface_init_socket : NULL;
+ st->interface_from_socket = (have_function[4]) ? rna_NodeSocketInterface_from_socket : NULL;
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+
+ return st->ext_interface.srna;
}
static StructRNA *rna_NodeSocketInterface_refine(PointerRNA *ptr)
{
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
- if (sock->typeinfo && sock->typeinfo->ext_interface.srna)
- return sock->typeinfo->ext_interface.srna;
- else
- return &RNA_NodeSocketInterface;
+ if (sock->typeinfo && sock->typeinfo->ext_interface.srna)
+ return sock->typeinfo->ext_interface.srna;
+ else
+ return &RNA_NodeSocketInterface;
}
static char *rna_NodeSocketInterface_path(PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNodeSocket *sock = (bNodeSocket *)ptr->data;
- int socketindex;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNodeSocket *sock = (bNodeSocket *)ptr->data;
+ int socketindex;
- socketindex = BLI_findindex(&ntree->inputs, sock);
- if (socketindex != -1)
- return BLI_sprintfN("inputs[%d]", socketindex);
+ socketindex = BLI_findindex(&ntree->inputs, sock);
+ if (socketindex != -1)
+ return BLI_sprintfN("inputs[%d]", socketindex);
- socketindex = BLI_findindex(&ntree->outputs, sock);
- if (socketindex != -1)
- return BLI_sprintfN("outputs[%d]", socketindex);
+ socketindex = BLI_findindex(&ntree->outputs, sock);
+ if (socketindex != -1)
+ return BLI_sprintfN("outputs[%d]", socketindex);
- return NULL;
+ return NULL;
}
static IDProperty *rna_NodeSocketInterface_idprops(PointerRNA *ptr, bool create)
{
- bNodeSocket *sock = ptr->data;
+ bNodeSocket *sock = ptr->data;
- if (create && !sock->prop) {
- IDPropertyTemplate val = {0};
- sock->prop = IDP_New(IDP_GROUP, &val, "RNA_NodeSocketInterface ID properties");
- }
+ if (create && !sock->prop) {
+ IDPropertyTemplate val = {0};
+ sock->prop = IDP_New(IDP_GROUP, &val, "RNA_NodeSocketInterface ID properties");
+ }
- return sock->prop;
+ return sock->prop;
}
static void rna_NodeSocketInterface_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = ptr->id.data;
- bNodeSocket *stemp = ptr->data;
+ bNodeTree *ntree = ptr->id.data;
+ bNodeSocket *stemp = ptr->data;
- if (!stemp->typeinfo)
- return;
+ if (!stemp->typeinfo)
+ return;
- ntree->update |= NTREE_UPDATE_GROUP;
- ntreeUpdateTree(bmain, ntree);
+ ntree->update |= NTREE_UPDATE_GROUP;
+ ntreeUpdateTree(bmain, ntree);
- ED_node_tag_update_nodetree(bmain, ntree, NULL);
+ ED_node_tag_update_nodetree(bmain, ntree, NULL);
}
-
/* ******** Standard Node Socket Base Types ******** */
-static void rna_NodeSocketStandard_draw(ID *id, bNodeSocket *sock, struct bContext *C, struct uiLayout *layout, PointerRNA *nodeptr,
+static void rna_NodeSocketStandard_draw(ID *id,
+ bNodeSocket *sock,
+ struct bContext *C,
+ struct uiLayout *layout,
+ PointerRNA *nodeptr,
const char *text)
{
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
- sock->typeinfo->draw(C, layout, &ptr, nodeptr, text);
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
+ sock->typeinfo->draw(C, layout, &ptr, nodeptr, text);
}
-static void rna_NodeSocketStandard_draw_color(ID *id, bNodeSocket *sock, struct bContext *C, PointerRNA *nodeptr, float *r_color)
+static void rna_NodeSocketStandard_draw_color(
+ ID *id, bNodeSocket *sock, struct bContext *C, PointerRNA *nodeptr, float *r_color)
{
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
- sock->typeinfo->draw_color(C, &ptr, nodeptr, r_color);
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
+ sock->typeinfo->draw_color(C, &ptr, nodeptr, r_color);
}
-static void rna_NodeSocketInterfaceStandard_draw(ID *id, bNodeSocket *sock, struct bContext *C, struct uiLayout *layout)
+static void rna_NodeSocketInterfaceStandard_draw(ID *id,
+ bNodeSocket *sock,
+ struct bContext *C,
+ struct uiLayout *layout)
{
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
- sock->typeinfo->interface_draw(C, layout, &ptr);
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
+ sock->typeinfo->interface_draw(C, layout, &ptr);
}
-static void rna_NodeSocketInterfaceStandard_draw_color(ID *id, bNodeSocket *sock, struct bContext *C, float *r_color)
+static void rna_NodeSocketInterfaceStandard_draw_color(ID *id,
+ bNodeSocket *sock,
+ struct bContext *C,
+ float *r_color)
{
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
- sock->typeinfo->interface_draw_color(C, &ptr, r_color);
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_NodeSocket, sock, &ptr);
+ sock->typeinfo->interface_draw_color(C, &ptr, r_color);
}
-static void rna_NodeSocketStandard_float_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
+static void rna_NodeSocketStandard_float_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- bNodeSocket *sock = ptr->data;
- bNodeSocketValueFloat *dval = sock->default_value;
- int subtype = sock->typeinfo->subtype;
+ bNodeSocket *sock = ptr->data;
+ bNodeSocketValueFloat *dval = sock->default_value;
+ int subtype = sock->typeinfo->subtype;
- if (dval->max < dval->min) {
- dval->max = dval->min;
- }
+ if (dval->max < dval->min) {
+ dval->max = dval->min;
+ }
- *min = (subtype == PROP_UNSIGNED ? 0.0f : -FLT_MAX);
- *max = FLT_MAX;
- *softmin = dval->min;
- *softmax = dval->max;
+ *min = (subtype == PROP_UNSIGNED ? 0.0f : -FLT_MAX);
+ *max = FLT_MAX;
+ *softmin = dval->min;
+ *softmax = dval->max;
}
-static void rna_NodeSocketStandard_int_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_NodeSocketStandard_int_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- bNodeSocket *sock = ptr->data;
- bNodeSocketValueInt *dval = sock->default_value;
- int subtype = sock->typeinfo->subtype;
+ bNodeSocket *sock = ptr->data;
+ bNodeSocketValueInt *dval = sock->default_value;
+ int subtype = sock->typeinfo->subtype;
- if (dval->max < dval->min) {
- dval->max = dval->min;
- }
+ if (dval->max < dval->min) {
+ dval->max = dval->min;
+ }
- *min = (subtype == PROP_UNSIGNED ? 0 : INT_MIN);
- *max = INT_MAX;
- *softmin = dval->min;
- *softmax = dval->max;
+ *min = (subtype == PROP_UNSIGNED ? 0 : INT_MIN);
+ *max = INT_MAX;
+ *softmin = dval->min;
+ *softmax = dval->max;
}
-static void rna_NodeSocketStandard_vector_range(PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
+static void rna_NodeSocketStandard_vector_range(
+ PointerRNA *ptr, float *min, float *max, float *softmin, float *softmax)
{
- bNodeSocket *sock = ptr->data;
- bNodeSocketValueVector *dval = sock->default_value;
+ bNodeSocket *sock = ptr->data;
+ bNodeSocketValueVector *dval = sock->default_value;
- if (dval->max < dval->min) {
- dval->max = dval->min;
- }
+ if (dval->max < dval->min) {
+ dval->max = dval->min;
+ }
- *min = -FLT_MAX;
- *max = FLT_MAX;
- *softmin = dval->min;
- *softmax = dval->max;
+ *min = -FLT_MAX;
+ *max = FLT_MAX;
+ *softmin = dval->min;
+ *softmax = dval->max;
}
/* using a context update function here, to avoid searching the node if possible */
static void rna_NodeSocketStandard_value_update(struct bContext *C, PointerRNA *ptr)
{
- bNode *node;
+ bNode *node;
- /* default update */
- rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+ /* default update */
+ rna_NodeSocket_update(CTX_data_main(C), CTX_data_scene(C), ptr);
- /* try to use node from context, faster */
- node = CTX_data_pointer_get(C, "node").data;
- if (!node) {
- bNodeTree *ntree = ptr->id.data;
- bNodeSocket *sock = ptr->data;
+ /* try to use node from context, faster */
+ node = CTX_data_pointer_get(C, "node").data;
+ if (!node) {
+ bNodeTree *ntree = ptr->id.data;
+ bNodeSocket *sock = ptr->data;
- /* fall back to searching node in the tree */
- nodeFindNode(ntree, sock, &node, NULL);
- }
+ /* fall back to searching node in the tree */
+ nodeFindNode(ntree, sock, &node, NULL);
+ }
}
-
/* ******** Node Types ******** */
static void rna_NodeInternalSocketTemplate_name_get(PointerRNA *ptr, char *value)
{
- bNodeSocketTemplate *stemp = ptr->data;
- strcpy(value, stemp->name);
+ bNodeSocketTemplate *stemp = ptr->data;
+ strcpy(value, stemp->name);
}
static int rna_NodeInternalSocketTemplate_name_length(PointerRNA *ptr)
{
- bNodeSocketTemplate *stemp = ptr->data;
- return strlen(stemp->name);
+ bNodeSocketTemplate *stemp = ptr->data;
+ return strlen(stemp->name);
}
static void rna_NodeInternalSocketTemplate_identifier_get(PointerRNA *ptr, char *value)
{
- bNodeSocketTemplate *stemp = ptr->data;
- strcpy(value, stemp->identifier);
+ bNodeSocketTemplate *stemp = ptr->data;
+ strcpy(value, stemp->identifier);
}
static int rna_NodeInternalSocketTemplate_identifier_length(PointerRNA *ptr)
{
- bNodeSocketTemplate *stemp = ptr->data;
- return strlen(stemp->identifier);
+ bNodeSocketTemplate *stemp = ptr->data;
+ return strlen(stemp->identifier);
}
static int rna_NodeInternalSocketTemplate_type_get(PointerRNA *ptr)
{
- bNodeSocketTemplate *stemp = ptr->data;
- return stemp->type;
+ bNodeSocketTemplate *stemp = ptr->data;
+ return stemp->type;
}
static PointerRNA rna_NodeInternal_input_template(StructRNA *srna, int index)
{
- bNodeType *ntype = RNA_struct_blender_type_get(srna);
- if (ntype && ntype->inputs) {
- bNodeSocketTemplate *stemp = ntype->inputs;
- int i = 0;
- while (i < index && stemp->type >= 0) {
- ++i;
- ++stemp;
- }
- if (i == index && stemp->type >= 0) {
- PointerRNA ptr;
- RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
- return ptr;
- }
- }
- return PointerRNA_NULL;
+ bNodeType *ntype = RNA_struct_blender_type_get(srna);
+ if (ntype && ntype->inputs) {
+ bNodeSocketTemplate *stemp = ntype->inputs;
+ int i = 0;
+ while (i < index && stemp->type >= 0) {
+ ++i;
+ ++stemp;
+ }
+ if (i == index && stemp->type >= 0) {
+ PointerRNA ptr;
+ RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
+ return ptr;
+ }
+ }
+ return PointerRNA_NULL;
}
static PointerRNA rna_NodeInternal_output_template(StructRNA *srna, int index)
{
- bNodeType *ntype = RNA_struct_blender_type_get(srna);
- if (ntype && ntype->outputs) {
- bNodeSocketTemplate *stemp = ntype->outputs;
- int i = 0;
- while (i < index && stemp->type >= 0) {
- ++i;
- ++stemp;
- }
- if (i == index && stemp->type >= 0) {
- PointerRNA ptr;
- RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
- return ptr;
- }
- }
- return PointerRNA_NULL;
+ bNodeType *ntype = RNA_struct_blender_type_get(srna);
+ if (ntype && ntype->outputs) {
+ bNodeSocketTemplate *stemp = ntype->outputs;
+ int i = 0;
+ while (i < index && stemp->type >= 0) {
+ ++i;
+ ++stemp;
+ }
+ if (i == index && stemp->type >= 0) {
+ PointerRNA ptr;
+ RNA_pointer_create(NULL, &RNA_NodeInternalSocketTemplate, stemp, &ptr);
+ return ptr;
+ }
+ }
+ return PointerRNA_NULL;
}
static bool rna_NodeInternal_poll(StructRNA *srna, bNodeTree *ntree)
{
- bNodeType *ntype = RNA_struct_blender_type_get(srna);
- return ntype && (!ntype->poll || ntype->poll(ntype, ntree));
+ bNodeType *ntype = RNA_struct_blender_type_get(srna);
+ return ntype && (!ntype->poll || ntype->poll(ntype, ntree));
}
static bool rna_NodeInternal_poll_instance(bNode *node, bNodeTree *ntree)
{
- bNodeType *ntype = node->typeinfo;
- if (ntype->poll_instance) {
- return ntype->poll_instance(node, ntree);
- }
- else {
- /* fall back to basic poll function */
- return !ntype->poll || ntype->poll(ntype, ntree);
- }
+ bNodeType *ntype = node->typeinfo;
+ if (ntype->poll_instance) {
+ return ntype->poll_instance(node, ntree);
+ }
+ else {
+ /* fall back to basic poll function */
+ return !ntype->poll || ntype->poll(ntype, ntree);
+ }
}
static void rna_NodeInternal_update(ID *id, bNode *node)
{
- bNodeTree *ntree = (bNodeTree *)id;
- if (node->typeinfo->updatefunc)
- node->typeinfo->updatefunc(ntree, node);
+ bNodeTree *ntree = (bNodeTree *)id;
+ if (node->typeinfo->updatefunc)
+ node->typeinfo->updatefunc(ntree, node);
}
-static void rna_NodeInternal_draw_buttons(ID *id, bNode *node, struct bContext *C, struct uiLayout *layout)
+static void rna_NodeInternal_draw_buttons(ID *id,
+ bNode *node,
+ struct bContext *C,
+ struct uiLayout *layout)
{
- if (node->typeinfo->draw_buttons) {
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_Node, node, &ptr);
- node->typeinfo->draw_buttons(layout, C, &ptr);
- }
+ if (node->typeinfo->draw_buttons) {
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_Node, node, &ptr);
+ node->typeinfo->draw_buttons(layout, C, &ptr);
+ }
}
-static void rna_NodeInternal_draw_buttons_ext(ID *id, bNode *node, struct bContext *C, struct uiLayout *layout)
+static void rna_NodeInternal_draw_buttons_ext(ID *id,
+ bNode *node,
+ struct bContext *C,
+ struct uiLayout *layout)
{
- if (node->typeinfo->draw_buttons_ex) {
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_Node, node, &ptr);
- node->typeinfo->draw_buttons_ex(layout, C, &ptr);
- }
- else if (node->typeinfo->draw_buttons) {
- PointerRNA ptr;
- RNA_pointer_create(id, &RNA_Node, node, &ptr);
- node->typeinfo->draw_buttons(layout, C, &ptr);
- }
+ if (node->typeinfo->draw_buttons_ex) {
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_Node, node, &ptr);
+ node->typeinfo->draw_buttons_ex(layout, C, &ptr);
+ }
+ else if (node->typeinfo->draw_buttons) {
+ PointerRNA ptr;
+ RNA_pointer_create(id, &RNA_Node, node, &ptr);
+ node->typeinfo->draw_buttons(layout, C, &ptr);
+ }
}
-static StructRNA *rna_NodeCustomGroup_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_NodeCustomGroup_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_NodeCustomGroup, data, identifier, validate, call, free);
+ if (!nt)
+ return NULL;
- /* this updates the group node instance from the tree's interface */
- nt->verifyfunc = node_group_verify;
+ /* this updates the group node instance from the tree's interface */
+ nt->verifyfunc = node_group_verify;
- nodeRegisterType(nt);
+ nodeRegisterType(nt);
- /* update while blender is running */
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return nt->ext.srna;
+ return nt->ext.srna;
}
-static StructRNA *rna_ShaderNodeCustomGroup_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_ShaderNodeCustomGroup_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeType * nt = rna_Node_register_base(bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free);
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_ShaderNodeCustomGroup, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
+ if (!nt)
+ return NULL;
- nt->verifyfunc = node_group_verify;
- nt->type = NODE_CUSTOM_GROUP;
+ nt->verifyfunc = node_group_verify;
+ nt->type = NODE_CUSTOM_GROUP;
- register_node_type_sh_custom_group(nt);
+ register_node_type_sh_custom_group(nt);
- nodeRegisterType(nt);
+ nodeRegisterType(nt);
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return nt->ext.srna;
+ return nt->ext.srna;
}
-static StructRNA *rna_CompositorNodeCustomGroup_register(
- Main *bmain, ReportList *reports,
- void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_CompositorNodeCustomGroup_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bNodeType *nt = rna_Node_register_base(bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free);
- if (!nt)
- return NULL;
+ bNodeType *nt = rna_Node_register_base(
+ bmain, reports, &RNA_CompositorNodeCustomGroup, data, identifier, validate, call, free);
+ if (!nt)
+ return NULL;
- nt->verifyfunc = node_group_verify;
- nt->type = NODE_CUSTOM_GROUP;
+ nt->verifyfunc = node_group_verify;
+ nt->type = NODE_CUSTOM_GROUP;
- register_node_type_cmp_custom_group(nt);
+ register_node_type_cmp_custom_group(nt);
- nodeRegisterType(nt);
+ nodeRegisterType(nt);
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- return nt->ext.srna;
+ return nt->ext.srna;
}
-
static void rna_CompositorNode_tag_need_exec(bNode *node)
{
- node->need_exec = true;
+ node->need_exec = true;
}
static void rna_Node_tex_image_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
- ED_node_tag_update_nodetree(bmain, ntree, node);
- WM_main_add_notifier(NC_IMAGE, NULL);
+ ED_node_tag_update_nodetree(bmain, ntree, node);
+ WM_main_add_notifier(NC_IMAGE, NULL);
}
static void rna_NodeGroup_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
- if (node->id)
- ntreeUpdateTree(bmain, (bNodeTree *)node->id);
+ if (node->id)
+ ntreeUpdateTree(bmain, (bNodeTree *)node->id);
- ED_node_tag_update_nodetree(bmain, ntree, node);
+ ED_node_tag_update_nodetree(bmain, ntree, node);
}
static void rna_NodeGroup_node_tree_set(PointerRNA *ptr, const PointerRNA value)
{
- bNodeTree *ntree = ptr->id.data;
- bNode *node = ptr->data;
- bNodeTree *ngroup = value.data;
+ bNodeTree *ntree = ptr->id.data;
+ bNode *node = ptr->data;
+ bNodeTree *ngroup = value.data;
- if (nodeGroupPoll(ntree, ngroup)) {
- if (node->id)
- id_us_min(node->id);
- if (ngroup)
- id_us_plus(&ngroup->id);
+ if (nodeGroupPoll(ntree, ngroup)) {
+ if (node->id)
+ id_us_min(node->id);
+ if (ngroup)
+ id_us_plus(&ngroup->id);
- node->id = &ngroup->id;
- }
+ node->id = &ngroup->id;
+ }
}
static bool rna_NodeGroup_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
{
- bNodeTree *ntree = ptr->id.data;
- bNodeTree *ngroup = value.data;
+ bNodeTree *ntree = ptr->id.data;
+ bNodeTree *ngroup = value.data;
- /* only allow node trees of the same type as the group node's tree */
- if (ngroup->type != ntree->type)
- return false;
+ /* only allow node trees of the same type as the group node's tree */
+ if (ngroup->type != ntree->type)
+ return false;
- return nodeGroupPoll(ntree, ngroup);
+ return nodeGroupPoll(ntree, ngroup);
}
-
static StructRNA *rna_NodeGroup_interface_typef(PointerRNA *ptr)
{
- bNode *node = ptr->data;
- bNodeTree *ngroup = (bNodeTree *)node->id;
+ bNode *node = ptr->data;
+ bNodeTree *ngroup = (bNodeTree *)node->id;
- if (ngroup) {
- StructRNA *srna = ntreeInterfaceTypeGet(ngroup, true);
- if (srna)
- return srna;
- }
- return &RNA_PropertyGroup;
+ if (ngroup) {
+ StructRNA *srna = ntreeInterfaceTypeGet(ngroup, true);
+ if (srna)
+ return srna;
+ }
+ return &RNA_PropertyGroup;
}
static StructRNA *rna_NodeGroupInputOutput_interface_typef(PointerRNA *ptr)
{
- bNodeTree *ntree = ptr->id.data;
+ bNodeTree *ntree = ptr->id.data;
- if (ntree) {
- StructRNA *srna = ntreeInterfaceTypeGet(ntree, true);
- if (srna)
- return srna;
- }
- return &RNA_PropertyGroup;
+ if (ntree) {
+ StructRNA *srna = ntreeInterfaceTypeGet(ntree, true);
+ if (srna)
+ return srna;
+ }
+ return &RNA_PropertyGroup;
}
static void rna_distance_matte_t1_set(PointerRNA *ptr, float value)
{
- bNode *node = (bNode *)ptr->data;
- NodeChroma *chroma = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeChroma *chroma = node->storage;
- chroma->t1 = value;
+ chroma->t1 = value;
}
static void rna_distance_matte_t2_set(PointerRNA *ptr, float value)
{
- bNode *node = (bNode *)ptr->data;
- NodeChroma *chroma = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeChroma *chroma = node->storage;
- chroma->t2 = value;
+ chroma->t2 = value;
}
static void rna_difference_matte_t1_set(PointerRNA *ptr, float value)
{
- bNode *node = (bNode *)ptr->data;
- NodeChroma *chroma = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeChroma *chroma = node->storage;
- chroma->t1 = value;
+ chroma->t1 = value;
}
static void rna_difference_matte_t2_set(PointerRNA *ptr, float value)
{
- bNode *node = (bNode *)ptr->data;
- NodeChroma *chroma = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeChroma *chroma = node->storage;
- chroma->t2 = value;
+ chroma->t2 = value;
}
/* Button Set Funcs for Matte Nodes */
static void rna_Matte_t1_set(PointerRNA *ptr, float value)
{
- bNode *node = (bNode *)ptr->data;
- NodeChroma *chroma = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeChroma *chroma = node->storage;
- chroma->t1 = value;
+ chroma->t1 = value;
- if (value < chroma->t2)
- chroma->t2 = value;
+ if (value < chroma->t2)
+ chroma->t2 = value;
}
static void rna_Matte_t2_set(PointerRNA *ptr, float value)
{
- bNode *node = (bNode *)ptr->data;
- NodeChroma *chroma = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeChroma *chroma = node->storage;
- if (value > chroma->t1)
- value = chroma->t1;
+ if (value > chroma->t1)
+ value = chroma->t1;
- chroma->t2 = value;
+ chroma->t2 = value;
}
static void rna_Node_scene_set(PointerRNA *ptr, PointerRNA value)
{
- bNode *node = (bNode *)ptr->data;
+ bNode *node = (bNode *)ptr->data;
- if (node->id) {
- id_us_min(node->id);
- node->id = NULL;
- }
+ if (node->id) {
+ id_us_min(node->id);
+ node->id = NULL;
+ }
- node->id = value.data;
+ node->id = value.data;
- id_us_plus(node->id);
+ id_us_plus(node->id);
}
static void rna_Node_image_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
- Image *ima = (Image *)node->id;
- ImageUser *iuser = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ Image *ima = (Image *)node->id;
+ ImageUser *iuser = node->storage;
- BKE_image_multilayer_index(ima->rr, iuser);
- BKE_image_signal(bmain, ima, iuser, IMA_SIGNAL_SRC_CHANGE);
+ BKE_image_multilayer_index(ima->rr, iuser);
+ BKE_image_signal(bmain, ima, iuser, IMA_SIGNAL_SRC_CHANGE);
- rna_Node_update(bmain, scene, ptr);
+ rna_Node_update(bmain, scene, ptr);
- if (scene->nodetree != NULL) {
- ntreeCompositUpdateRLayers(scene->nodetree);
- }
+ if (scene->nodetree != NULL) {
+ ntreeCompositUpdateRLayers(scene->nodetree);
+ }
}
static const EnumPropertyItem *renderresult_layers_add_enum(RenderLayer *rl)
{
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0};
- int i = 0, totitem = 0;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0};
+ int i = 0, totitem = 0;
- while (rl) {
- tmp.identifier = rl->name;
- /* little trick: using space char instead empty string makes the item selectable in the dropdown */
- if (rl->name[0] == '\0')
- tmp.name = " ";
- else
- tmp.name = rl->name;
- tmp.value = i++;
- RNA_enum_item_add(&item, &totitem, &tmp);
- rl = rl->next;
- }
+ while (rl) {
+ tmp.identifier = rl->name;
+ /* little trick: using space char instead empty string makes the item selectable in the dropdown */
+ if (rl->name[0] == '\0')
+ tmp.name = " ";
+ else
+ tmp.name = rl->name;
+ tmp.value = i++;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ rl = rl->next;
+ }
- RNA_enum_item_end(&item, &totitem);
+ RNA_enum_item_end(&item, &totitem);
- return item;
+ return item;
}
-static const EnumPropertyItem *rna_Node_image_layer_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Node_image_layer_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- bNode *node = (bNode *)ptr->data;
- Image *ima = (Image *)node->id;
- const EnumPropertyItem *item = NULL;
- RenderLayer *rl;
+ bNode *node = (bNode *)ptr->data;
+ Image *ima = (Image *)node->id;
+ const EnumPropertyItem *item = NULL;
+ RenderLayer *rl;
- if (ima == NULL || ima->rr == NULL) {
- *r_free = false;
- return DummyRNA_NULL_items;
- }
+ if (ima == NULL || ima->rr == NULL) {
+ *r_free = false;
+ return DummyRNA_NULL_items;
+ }
- rl = ima->rr->layers.first;
- item = renderresult_layers_add_enum(rl);
+ rl = ima->rr->layers.first;
+ item = renderresult_layers_add_enum(rl);
- *r_free = true;
+ *r_free = true;
- return item;
+ return item;
}
static bool rna_Node_image_has_layers_get(PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
- Image *ima = (Image *)node->id;
+ bNode *node = (bNode *)ptr->data;
+ Image *ima = (Image *)node->id;
- if (!ima || !(ima->rr)) return 0;
+ if (!ima || !(ima->rr))
+ return 0;
- return RE_layers_have_name(ima->rr);
+ return RE_layers_have_name(ima->rr);
}
static bool rna_Node_image_has_views_get(PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
- Image *ima = (Image *)node->id;
+ bNode *node = (bNode *)ptr->data;
+ Image *ima = (Image *)node->id;
- if (!ima || !(ima->rr)) return 0;
+ if (!ima || !(ima->rr))
+ return 0;
- return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
+ return BLI_listbase_count_at_most(&ima->rr->views, 2) > 1;
}
static const EnumPropertyItem *renderresult_views_add_enum(RenderView *rv)
{
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "ALL", 0, "All", ""};
- int i = 1, totitem = 0;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "ALL", 0, "All", ""};
+ int i = 1, totitem = 0;
- /* option to use all views */
- RNA_enum_item_add(&item, &totitem, &tmp);
+ /* option to use all views */
+ RNA_enum_item_add(&item, &totitem, &tmp);
- while (rv) {
- tmp.identifier = rv->name;
- /* little trick: using space char instead empty string makes the item selectable in the dropdown */
- if (rv->name[0] == '\0')
- tmp.name = " ";
- else
- tmp.name = rv->name;
- tmp.value = i++;
- RNA_enum_item_add(&item, &totitem, &tmp);
- rv = rv->next;
- }
+ while (rv) {
+ tmp.identifier = rv->name;
+ /* little trick: using space char instead empty string makes the item selectable in the dropdown */
+ if (rv->name[0] == '\0')
+ tmp.name = " ";
+ else
+ tmp.name = rv->name;
+ tmp.value = i++;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ rv = rv->next;
+ }
- RNA_enum_item_end(&item, &totitem);
+ RNA_enum_item_end(&item, &totitem);
- return item;
+ return item;
}
-static const EnumPropertyItem *rna_Node_image_view_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Node_image_view_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- bNode *node = (bNode *)ptr->data;
- Image *ima = (Image *)node->id;
- const EnumPropertyItem *item = NULL;
- RenderView *rv;
+ bNode *node = (bNode *)ptr->data;
+ Image *ima = (Image *)node->id;
+ const EnumPropertyItem *item = NULL;
+ RenderView *rv;
- if (ima == NULL || ima->rr == NULL) {
- *r_free = false;
- return DummyRNA_NULL_items;
- }
+ if (ima == NULL || ima->rr == NULL) {
+ *r_free = false;
+ return DummyRNA_NULL_items;
+ }
- rv = ima->rr->views.first;
- item = renderresult_views_add_enum(rv);
+ rv = ima->rr->views.first;
+ item = renderresult_views_add_enum(rv);
- *r_free = true;
+ *r_free = true;
- return item;
+ return item;
}
-static const EnumPropertyItem *rna_Node_view_layer_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Node_view_layer_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- bNode *node = (bNode *)ptr->data;
- Scene *sce = (Scene *)node->id;
- const EnumPropertyItem *item = NULL;
- RenderLayer *rl;
+ bNode *node = (bNode *)ptr->data;
+ Scene *sce = (Scene *)node->id;
+ const EnumPropertyItem *item = NULL;
+ RenderLayer *rl;
- if (sce == NULL) {
- *r_free = false;
- return DummyRNA_NULL_items;
- }
+ if (sce == NULL) {
+ *r_free = false;
+ return DummyRNA_NULL_items;
+ }
- rl = sce->view_layers.first;
- item = renderresult_layers_add_enum(rl);
+ rl = sce->view_layers.first;
+ item = renderresult_layers_add_enum(rl);
- *r_free = true;
+ *r_free = true;
- return item;
+ return item;
}
static void rna_Node_view_layer_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_Node_update(bmain, scene, ptr);
- if (scene->nodetree != NULL) {
- ntreeCompositUpdateRLayers(scene->nodetree);
- }
-}
-
-static const EnumPropertyItem *rna_Node_channel_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
-{
- bNode *node = (bNode *)ptr->data;
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0};
- int totitem = 0;
-
- switch (node->custom1) {
- case CMP_NODE_CHANNEL_MATTE_CS_RGB:
- tmp.identifier = "R"; tmp.name = "R"; tmp.value = 1;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "G"; tmp.name = "G"; tmp.value = 2;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "B"; tmp.name = "B"; tmp.value = 3;
- RNA_enum_item_add(&item, &totitem, &tmp);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_HSV:
- tmp.identifier = "H"; tmp.name = "H"; tmp.value = 1;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "S"; tmp.name = "S"; tmp.value = 2;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "V"; tmp.name = "V"; tmp.value = 3;
- RNA_enum_item_add(&item, &totitem, &tmp);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YUV:
- tmp.identifier = "Y"; tmp.name = "Y"; tmp.value = 1;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "G"; tmp.name = "U"; tmp.value = 2;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "V"; tmp.name = "V"; tmp.value = 3;
- RNA_enum_item_add(&item, &totitem, &tmp);
- break;
- case CMP_NODE_CHANNEL_MATTE_CS_YCC:
- tmp.identifier = "Y"; tmp.name = "Y"; tmp.value = 1;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "CB"; tmp.name = "Cr"; tmp.value = 2;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.identifier = "CR"; tmp.name = "Cb"; tmp.value = 3;
- RNA_enum_item_add(&item, &totitem, &tmp);
- break;
- default:
- return DummyRNA_NULL_items;
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ rna_Node_update(bmain, scene, ptr);
+ if (scene->nodetree != NULL) {
+ ntreeCompositUpdateRLayers(scene->nodetree);
+ }
+}
+
+static const EnumPropertyItem *rna_Node_channel_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ bNode *node = (bNode *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0};
+ int totitem = 0;
+
+ switch (node->custom1) {
+ case CMP_NODE_CHANNEL_MATTE_CS_RGB:
+ tmp.identifier = "R";
+ tmp.name = "R";
+ tmp.value = 1;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "G";
+ tmp.name = "G";
+ tmp.value = 2;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "B";
+ tmp.name = "B";
+ tmp.value = 3;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_HSV:
+ tmp.identifier = "H";
+ tmp.name = "H";
+ tmp.value = 1;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "S";
+ tmp.name = "S";
+ tmp.value = 2;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "V";
+ tmp.name = "V";
+ tmp.value = 3;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YUV:
+ tmp.identifier = "Y";
+ tmp.name = "Y";
+ tmp.value = 1;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "G";
+ tmp.name = "U";
+ tmp.value = 2;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "V";
+ tmp.name = "V";
+ tmp.value = 3;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ break;
+ case CMP_NODE_CHANNEL_MATTE_CS_YCC:
+ tmp.identifier = "Y";
+ tmp.name = "Y";
+ tmp.value = 1;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "CB";
+ tmp.name = "Cr";
+ tmp.value = 2;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.identifier = "CR";
+ tmp.name = "Cb";
+ tmp.value = 3;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ break;
+ default:
+ return DummyRNA_NULL_items;
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
static void rna_Image_Node_update_id(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
- node->update |= NODE_UPDATE_ID;
- nodeUpdate(ntree, node); /* to update image node sockets */
+ node->update |= NODE_UPDATE_ID;
+ nodeUpdate(ntree, node); /* to update image node sockets */
}
static void rna_Mapping_Node_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bNode *node = ptr->data;
- BKE_texture_mapping_init(node->storage);
- rna_Node_update(bmain, scene, ptr);
+ bNode *node = ptr->data;
+ BKE_texture_mapping_init(node->storage);
+ rna_Node_update(bmain, scene, ptr);
}
static void rna_NodeOutputFile_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- bNode *node = ptr->data;
- rna_iterator_listbase_begin(iter, &node->inputs, NULL);
+ bNode *node = ptr->data;
+ rna_iterator_listbase_begin(iter, &node->inputs, NULL);
}
static PointerRNA rna_NodeOutputFile_slot_file_get(CollectionPropertyIterator *iter)
{
- PointerRNA ptr;
- bNodeSocket *sock = rna_iterator_listbase_get(iter);
- RNA_pointer_create(iter->parent.id.data, &RNA_NodeOutputFileSlotFile, sock->storage, &ptr);
- return ptr;
+ PointerRNA ptr;
+ bNodeSocket *sock = rna_iterator_listbase_get(iter);
+ RNA_pointer_create(iter->parent.id.data, &RNA_NodeOutputFileSlotFile, sock->storage, &ptr);
+ return ptr;
}
static void rna_NodeColorBalance_update_lgg(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ntreeCompositColorBalanceSyncFromLGG(ptr->id.data, ptr->data);
- rna_Node_update(bmain, scene, ptr);
+ ntreeCompositColorBalanceSyncFromLGG(ptr->id.data, ptr->data);
+ rna_Node_update(bmain, scene, ptr);
}
static void rna_NodeColorBalance_update_cdl(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ntreeCompositColorBalanceSyncFromCDL(ptr->id.data, ptr->data);
- rna_Node_update(bmain, scene, ptr);
+ ntreeCompositColorBalanceSyncFromCDL(ptr->id.data, ptr->data);
+ rna_Node_update(bmain, scene, ptr);
}
static void rna_NodeCryptomatte_matte_get(PointerRNA *ptr, char *value)
{
- bNode *node = (bNode *)ptr->data;
- NodeCryptomatte *nc = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeCryptomatte *nc = node->storage;
- strcpy(value, (nc->matte_id) ? nc->matte_id : "");
+ strcpy(value, (nc->matte_id) ? nc->matte_id : "");
}
static int rna_NodeCryptomatte_matte_length(PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
- NodeCryptomatte *nc = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeCryptomatte *nc = node->storage;
- return (nc->matte_id) ? strlen(nc->matte_id) : 0;
+ return (nc->matte_id) ? strlen(nc->matte_id) : 0;
}
static void rna_NodeCryptomatte_matte_set(PointerRNA *ptr, const char *value)
{
- bNode *node = (bNode *)ptr->data;
- NodeCryptomatte *nc = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeCryptomatte *nc = node->storage;
- if (nc->matte_id)
- MEM_freeN(nc->matte_id);
+ if (nc->matte_id)
+ MEM_freeN(nc->matte_id);
- if (value && value[0])
- nc->matte_id = BLI_strdup(value);
- else
- nc->matte_id = NULL;
+ if (value && value[0])
+ nc->matte_id = BLI_strdup(value);
+ else
+ nc->matte_id = NULL;
}
static void rna_NodeCryptomatte_update_add(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ntreeCompositCryptomatteSyncFromAdd(ptr->id.data, ptr->data);
- rna_Node_update(bmain, scene, ptr);
+ ntreeCompositCryptomatteSyncFromAdd(ptr->id.data, ptr->data);
+ rna_Node_update(bmain, scene, ptr);
}
static void rna_NodeCryptomatte_update_remove(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ntreeCompositCryptomatteSyncFromRemove(ptr->id.data, ptr->data);
- rna_Node_update(bmain, scene, ptr);
+ ntreeCompositCryptomatteSyncFromRemove(ptr->id.data, ptr->data);
+ rna_Node_update(bmain, scene, ptr);
}
/* ******** Node Socket Types ******** */
static PointerRNA rna_NodeOutputFile_slot_layer_get(CollectionPropertyIterator *iter)
{
- PointerRNA ptr;
- bNodeSocket *sock = rna_iterator_listbase_get(iter);
- RNA_pointer_create(iter->parent.id.data, &RNA_NodeOutputFileSlotLayer, sock->storage, &ptr);
- return ptr;
+ PointerRNA ptr;
+ bNodeSocket *sock = rna_iterator_listbase_get(iter);
+ RNA_pointer_create(iter->parent.id.data, &RNA_NodeOutputFileSlotLayer, sock->storage, &ptr);
+ return ptr;
}
-static int rna_NodeOutputFileSocket_find_node(bNodeTree *ntree, NodeImageMultiFileSocket *data, bNode **nodep, bNodeSocket **sockp)
+static int rna_NodeOutputFileSocket_find_node(bNodeTree *ntree,
+ NodeImageMultiFileSocket *data,
+ bNode **nodep,
+ bNodeSocket **sockp)
{
- bNode *node;
- bNodeSocket *sock;
+ bNode *node;
+ bNodeSocket *sock;
- for (node = ntree->nodes.first; node; node = node->next) {
- for (sock = node->inputs.first; sock; sock = sock->next) {
- NodeImageMultiFileSocket *sockdata = sock->storage;
- if (sockdata == data) {
- *nodep = node;
- *sockp = sock;
- return 1;
- }
- }
- }
+ for (node = ntree->nodes.first; node; node = node->next) {
+ for (sock = node->inputs.first; sock; sock = sock->next) {
+ NodeImageMultiFileSocket *sockdata = sock->storage;
+ if (sockdata == data) {
+ *nodep = node;
+ *sockp = sock;
+ return 1;
+ }
+ }
+ }
- *nodep = NULL;
- *sockp = NULL;
- return 0;
+ *nodep = NULL;
+ *sockp = NULL;
+ return 0;
}
static void rna_NodeOutputFileSlotFile_path_set(PointerRNA *ptr, const char *value)
{
- bNodeTree *ntree = ptr->id.data;
- NodeImageMultiFileSocket *sockdata = ptr->data;
- bNode *node;
- bNodeSocket *sock;
+ bNodeTree *ntree = ptr->id.data;
+ NodeImageMultiFileSocket *sockdata = ptr->data;
+ bNode *node;
+ bNodeSocket *sock;
- if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
- ntreeCompositOutputFileSetPath(node, sock, value);
- }
+ if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
+ ntreeCompositOutputFileSetPath(node, sock, value);
+ }
}
static void rna_NodeOutputFileSlotLayer_name_set(PointerRNA *ptr, const char *value)
{
- bNodeTree *ntree = ptr->id.data;
- NodeImageMultiFileSocket *sockdata = ptr->data;
- bNode *node;
- bNodeSocket *sock;
+ bNodeTree *ntree = ptr->id.data;
+ NodeImageMultiFileSocket *sockdata = ptr->data;
+ bNode *node;
+ bNodeSocket *sock;
- if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
- ntreeCompositOutputFileSetLayer(node, sock, value);
- }
+ if (rna_NodeOutputFileSocket_find_node(ntree, sockdata, &node, &sock)) {
+ ntreeCompositOutputFileSetLayer(node, sock, value);
+ }
}
-static bNodeSocket *rna_NodeOutputFile_slots_new(ID *id, bNode *node, bContext *C, ReportList *UNUSED(reports), const char *name)
+static bNodeSocket *rna_NodeOutputFile_slots_new(
+ ID *id, bNode *node, bContext *C, ReportList *UNUSED(reports), const char *name)
{
- bNodeTree *ntree = (bNodeTree *)id;
- Scene *scene = CTX_data_scene(C);
- ImageFormatData *im_format = NULL;
- bNodeSocket *sock;
- if (scene)
- im_format = &scene->r.im_format;
+ bNodeTree *ntree = (bNodeTree *)id;
+ Scene *scene = CTX_data_scene(C);
+ ImageFormatData *im_format = NULL;
+ bNodeSocket *sock;
+ if (scene)
+ im_format = &scene->r.im_format;
- sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
+ sock = ntreeCompositOutputFileAddSocket(ntree, node, name, im_format);
- ntreeUpdateTree(CTX_data_main(C), ntree);
- WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
+ ntreeUpdateTree(CTX_data_main(C), ntree);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, ntree);
- return sock;
+ return sock;
}
static void rna_ShaderNodeTexIES_mode_set(PointerRNA *ptr, int value)
{
- bNode *node = (bNode *)ptr->data;
- NodeShaderTexIES *nss = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeShaderTexIES *nss = node->storage;
- if (nss->mode != value) {
- nss->mode = value;
- nss->filepath[0] = '\0';
+ if (nss->mode != value) {
+ nss->mode = value;
+ nss->filepath[0] = '\0';
- /* replace text datablock by filepath */
- if (node->id) {
- Text *text = (Text *)node->id;
+ /* replace text datablock by filepath */
+ if (node->id) {
+ Text *text = (Text *)node->id;
- if (value == NODE_IES_EXTERNAL && text->name) {
- BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
- BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global());
- }
+ if (value == NODE_IES_EXTERNAL && text->name) {
+ BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
+ BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global());
+ }
- id_us_min(node->id);
- node->id = NULL;
- }
- }
+ id_us_min(node->id);
+ node->id = NULL;
+ }
+ }
}
static void rna_ShaderNodeScript_mode_set(PointerRNA *ptr, int value)
{
- bNode *node = (bNode *)ptr->data;
- NodeShaderScript *nss = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeShaderScript *nss = node->storage;
- if (nss->mode != value) {
- nss->mode = value;
- nss->filepath[0] = '\0';
- nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
+ if (nss->mode != value) {
+ nss->mode = value;
+ nss->filepath[0] = '\0';
+ nss->flag &= ~NODE_SCRIPT_AUTO_UPDATE;
- /* replace text data-block by filepath */
- if (node->id) {
- Text *text = (Text *)node->id;
+ /* replace text data-block by filepath */
+ if (node->id) {
+ Text *text = (Text *)node->id;
- if (value == NODE_SCRIPT_EXTERNAL && text->name) {
- BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
- BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global());
- }
+ if (value == NODE_SCRIPT_EXTERNAL && text->name) {
+ BLI_strncpy(nss->filepath, text->name, sizeof(nss->filepath));
+ BLI_path_rel(nss->filepath, BKE_main_blendfile_path_from_global());
+ }
- id_us_min(node->id);
- node->id = NULL;
- }
+ id_us_min(node->id);
+ node->id = NULL;
+ }
- /* remove any bytecode */
- if (nss->bytecode) {
- MEM_freeN(nss->bytecode);
- nss->bytecode = NULL;
- }
+ /* remove any bytecode */
+ if (nss->bytecode) {
+ MEM_freeN(nss->bytecode);
+ nss->bytecode = NULL;
+ }
- nss->bytecode_hash[0] = '\0';
- }
+ nss->bytecode_hash[0] = '\0';
+ }
}
static void rna_ShaderNodeScript_bytecode_get(PointerRNA *ptr, char *value)
{
- bNode *node = (bNode *)ptr->data;
- NodeShaderScript *nss = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeShaderScript *nss = node->storage;
- strcpy(value, (nss->bytecode) ? nss->bytecode : "");
+ strcpy(value, (nss->bytecode) ? nss->bytecode : "");
}
static int rna_ShaderNodeScript_bytecode_length(PointerRNA *ptr)
{
- bNode *node = (bNode *)ptr->data;
- NodeShaderScript *nss = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeShaderScript *nss = node->storage;
- return (nss->bytecode) ? strlen(nss->bytecode) : 0;
+ return (nss->bytecode) ? strlen(nss->bytecode) : 0;
}
static void rna_ShaderNodeScript_bytecode_set(PointerRNA *ptr, const char *value)
{
- bNode *node = (bNode *)ptr->data;
- NodeShaderScript *nss = node->storage;
+ bNode *node = (bNode *)ptr->data;
+ NodeShaderScript *nss = node->storage;
- if (nss->bytecode)
- MEM_freeN(nss->bytecode);
+ if (nss->bytecode)
+ MEM_freeN(nss->bytecode);
- if (value && value[0])
- nss->bytecode = BLI_strdup(value);
- else
- nss->bytecode = NULL;
+ if (value && value[0])
+ nss->bytecode = BLI_strdup(value);
+ else
+ nss->bytecode = NULL;
}
static void rna_ShaderNodeScript_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
- RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
+ RenderEngineType *engine_type = RE_engines_find(scene->r.engine);
- if (engine_type && engine_type->update_script_node) {
- /* auto update node */
- RenderEngine *engine = RE_engine_create(engine_type);
- engine_type->update_script_node(engine, ntree, node);
- RE_engine_free(engine);
- }
+ if (engine_type && engine_type->update_script_node) {
+ /* auto update node */
+ RenderEngine *engine = RE_engine_create(engine_type);
+ engine_type->update_script_node(engine, ntree, node);
+ RE_engine_free(engine);
+ }
- ED_node_tag_update_nodetree(bmain, ntree, node);
+ ED_node_tag_update_nodetree(bmain, ntree, node);
}
static void rna_ShaderNode_socket_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
- nodeUpdate(ntree, node);
- rna_Node_update(bmain, scene, ptr);
+ nodeUpdate(ntree, node);
+ rna_Node_update(bmain, scene, ptr);
}
static void rna_CompositorNodeScale_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- bNodeTree *ntree = (bNodeTree *)ptr->id.data;
- bNode *node = (bNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)ptr->id.data;
+ bNode *node = (bNode *)ptr->data;
- nodeUpdate(ntree, node);
- rna_Node_update(bmain, scene, ptr);
+ nodeUpdate(ntree, node);
+ rna_Node_update(bmain, scene, ptr);
}
static PointerRNA rna_ShaderNodePointDensity_psys_get(PointerRNA *ptr)
{
- bNode *node = ptr->data;
- NodeShaderTexPointDensity *shader_point_density = node->storage;
- Object *ob = (Object *)node->id;
- ParticleSystem *psys = NULL;
- PointerRNA value;
+ bNode *node = ptr->data;
+ NodeShaderTexPointDensity *shader_point_density = node->storage;
+ Object *ob = (Object *)node->id;
+ ParticleSystem *psys = NULL;
+ PointerRNA value;
- if (ob && shader_point_density->particle_system) {
- psys = BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1);
- }
+ if (ob && shader_point_density->particle_system) {
+ psys = BLI_findlink(&ob->particlesystem, shader_point_density->particle_system - 1);
+ }
- RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
- return value;
+ RNA_pointer_create(&ob->id, &RNA_ParticleSystem, psys, &value);
+ return value;
}
static void rna_ShaderNodePointDensity_psys_set(PointerRNA *ptr, PointerRNA value)
{
- bNode *node = ptr->data;
- NodeShaderTexPointDensity *shader_point_density = node->storage;
- Object *ob = (Object *)node->id;
-
- if (ob && value.id.data == ob) {
- shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
- }
- else {
- shader_point_density->particle_system = 0;
- }
-}
-
-static int point_density_particle_color_source_from_shader(NodeShaderTexPointDensity *shader_point_density)
-{
- switch (shader_point_density->color_source) {
- case SHD_POINTDENSITY_COLOR_PARTAGE:
- return TEX_PD_COLOR_PARTAGE;
- case SHD_POINTDENSITY_COLOR_PARTSPEED:
- return TEX_PD_COLOR_PARTSPEED;
- case SHD_POINTDENSITY_COLOR_PARTVEL:
- return TEX_PD_COLOR_PARTVEL;
- default:
- BLI_assert(!"Unknown color source");
- return TEX_PD_COLOR_CONSTANT;
- }
-}
-
-static int point_density_vertex_color_source_from_shader(NodeShaderTexPointDensity *shader_point_density)
-{
- switch (shader_point_density->ob_color_source) {
- case SHD_POINTDENSITY_COLOR_VERTCOL:
- return TEX_PD_COLOR_VERTCOL;
- case SHD_POINTDENSITY_COLOR_VERTWEIGHT:
- return TEX_PD_COLOR_VERTWEIGHT;
- case SHD_POINTDENSITY_COLOR_VERTNOR:
- return TEX_PD_COLOR_VERTNOR;
- default:
- BLI_assert(!"Unknown color source");
- return TEX_PD_COLOR_CONSTANT;
- }
-}
-
-void rna_ShaderNodePointDensity_density_cache(bNode *self,
- Depsgraph *depsgraph)
-{
- NodeShaderTexPointDensity *shader_point_density = self->storage;
- PointDensity *pd = &shader_point_density->pd;
-
- if (depsgraph == NULL) {
- return;
- }
-
- /* Make sure there's no cached data. */
- BKE_texture_pointdensity_free_data(pd);
- RE_point_density_free(pd);
-
- /* Create PointDensity structure from node for sampling. */
- BKE_texture_pointdensity_init_data(pd);
- pd->object = (Object *)self->id;
- pd->radius = shader_point_density->radius;
- if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
- pd->source = TEX_PD_PSYS;
- pd->psys = shader_point_density->particle_system;
- pd->psys_cache_space = TEX_PD_OBJECTSPACE;
- pd->color_source = point_density_particle_color_source_from_shader(shader_point_density);
- }
- else {
- BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT);
- pd->source = TEX_PD_OBJECT;
- pd->ob_cache_space = TEX_PD_OBJECTSPACE;
- pd->ob_color_source = point_density_vertex_color_source_from_shader(shader_point_density);
- BLI_strncpy(pd->vertex_attribute_name,
- shader_point_density->vertex_attribute_name,
- sizeof(pd->vertex_attribute_name));
- }
-
- /* Store resolution, so it can be changed in the UI. */
- shader_point_density->cached_resolution = shader_point_density->resolution;
-
- /* Single-threaded sampling of the voxel domain. */
- RE_point_density_cache(depsgraph, pd);
+ bNode *node = ptr->data;
+ NodeShaderTexPointDensity *shader_point_density = node->storage;
+ Object *ob = (Object *)node->id;
+
+ if (ob && value.id.data == ob) {
+ shader_point_density->particle_system = BLI_findindex(&ob->particlesystem, value.data) + 1;
+ }
+ else {
+ shader_point_density->particle_system = 0;
+ }
+}
+
+static int point_density_particle_color_source_from_shader(
+ NodeShaderTexPointDensity *shader_point_density)
+{
+ switch (shader_point_density->color_source) {
+ case SHD_POINTDENSITY_COLOR_PARTAGE:
+ return TEX_PD_COLOR_PARTAGE;
+ case SHD_POINTDENSITY_COLOR_PARTSPEED:
+ return TEX_PD_COLOR_PARTSPEED;
+ case SHD_POINTDENSITY_COLOR_PARTVEL:
+ return TEX_PD_COLOR_PARTVEL;
+ default:
+ BLI_assert(!"Unknown color source");
+ return TEX_PD_COLOR_CONSTANT;
+ }
+}
+
+static int point_density_vertex_color_source_from_shader(
+ NodeShaderTexPointDensity *shader_point_density)
+{
+ switch (shader_point_density->ob_color_source) {
+ case SHD_POINTDENSITY_COLOR_VERTCOL:
+ return TEX_PD_COLOR_VERTCOL;
+ case SHD_POINTDENSITY_COLOR_VERTWEIGHT:
+ return TEX_PD_COLOR_VERTWEIGHT;
+ case SHD_POINTDENSITY_COLOR_VERTNOR:
+ return TEX_PD_COLOR_VERTNOR;
+ default:
+ BLI_assert(!"Unknown color source");
+ return TEX_PD_COLOR_CONSTANT;
+ }
+}
+
+void rna_ShaderNodePointDensity_density_cache(bNode *self, Depsgraph *depsgraph)
+{
+ NodeShaderTexPointDensity *shader_point_density = self->storage;
+ PointDensity *pd = &shader_point_density->pd;
+
+ if (depsgraph == NULL) {
+ return;
+ }
+
+ /* Make sure there's no cached data. */
+ BKE_texture_pointdensity_free_data(pd);
+ RE_point_density_free(pd);
+
+ /* Create PointDensity structure from node for sampling. */
+ BKE_texture_pointdensity_init_data(pd);
+ pd->object = (Object *)self->id;
+ pd->radius = shader_point_density->radius;
+ if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) {
+ pd->source = TEX_PD_PSYS;
+ pd->psys = shader_point_density->particle_system;
+ pd->psys_cache_space = TEX_PD_OBJECTSPACE;
+ pd->color_source = point_density_particle_color_source_from_shader(shader_point_density);
+ }
+ else {
+ BLI_assert(shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_OBJECT);
+ pd->source = TEX_PD_OBJECT;
+ pd->ob_cache_space = TEX_PD_OBJECTSPACE;
+ pd->ob_color_source = point_density_vertex_color_source_from_shader(shader_point_density);
+ BLI_strncpy(pd->vertex_attribute_name,
+ shader_point_density->vertex_attribute_name,
+ sizeof(pd->vertex_attribute_name));
+ }
+
+ /* Store resolution, so it can be changed in the UI. */
+ shader_point_density->cached_resolution = shader_point_density->resolution;
+
+ /* Single-threaded sampling of the voxel domain. */
+ RE_point_density_cache(depsgraph, pd);
}
void rna_ShaderNodePointDensity_density_calc(bNode *self,
@@ -3263,29 +3432,29 @@ void rna_ShaderNodePointDensity_density_calc(bNode *self,
int *length,
float **values)
{
- NodeShaderTexPointDensity *shader_point_density = self->storage;
- PointDensity *pd = &shader_point_density->pd;
- const int resolution = shader_point_density->cached_resolution;
+ NodeShaderTexPointDensity *shader_point_density = self->storage;
+ PointDensity *pd = &shader_point_density->pd;
+ const int resolution = shader_point_density->cached_resolution;
- if (depsgraph == NULL) {
- *length = 0;
- return;
- }
+ if (depsgraph == NULL) {
+ *length = 0;
+ return;
+ }
- /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
- *length = 4 * resolution * resolution * resolution;
+ /* TODO(sergey): Will likely overflow, but how to pass size_t via RNA? */
+ *length = 4 * resolution * resolution * resolution;
- if (*values == NULL) {
- *values = MEM_mallocN(sizeof(float) * (*length), "point density dynamic array");
- }
+ if (*values == NULL) {
+ *values = MEM_mallocN(sizeof(float) * (*length), "point density dynamic array");
+ }
- /* Single-threaded sampling of the voxel domain. */
- RE_point_density_sample(depsgraph, pd, resolution, *values);
+ /* Single-threaded sampling of the voxel domain. */
+ RE_point_density_sample(depsgraph, pd, resolution, *values);
- /* We're done, time to clean up. */
- BKE_texture_pointdensity_free_data(pd);
- memset(pd, 0, sizeof(*pd));
- shader_point_density->cached_resolution = 0.0f;
+ /* We're done, time to clean up. */
+ BKE_texture_pointdensity_free_data(pd);
+ memset(pd, 0, sizeof(*pd));
+ shader_point_density->cached_resolution = 0.0f;
}
void rna_ShaderNodePointDensity_density_minmax(bNode *self,
@@ -3293,3266 +3462,3498 @@ void rna_ShaderNodePointDensity_density_minmax(bNode *self,
float r_min[3],
float r_max[3])
{
- NodeShaderTexPointDensity *shader_point_density = self->storage;
- PointDensity *pd = &shader_point_density->pd;
+ NodeShaderTexPointDensity *shader_point_density = self->storage;
+ PointDensity *pd = &shader_point_density->pd;
- if (depsgraph == NULL) {
- zero_v3(r_min);
- zero_v3(r_max);
- return;
- }
+ if (depsgraph == NULL) {
+ zero_v3(r_min);
+ zero_v3(r_max);
+ return;
+ }
- RE_point_density_minmax(depsgraph, pd, r_min, r_max);
+ RE_point_density_minmax(depsgraph, pd, r_min, r_max);
}
#else
static const EnumPropertyItem prop_image_layer_items[] = {
- { 0, "PLACEHOLDER", 0, "Placeholder", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "PLACEHOLDER", 0, "Placeholder", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_image_view_items[] = {
- { 0, "ALL", 0, "All", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "ALL", 0, "All", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_view_layer_items[] = {
- { 0, "PLACEHOLDER", 0, "Placeholder", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "PLACEHOLDER", 0, "Placeholder", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_tri_channel_items[] = {
- { 1, "R", 0, "R", ""},
- { 2, "G", 0, "G", ""},
- { 3, "B", 0, "B", ""},
- {0, NULL, 0, NULL, NULL},
+ {1, "R", 0, "R", ""},
+ {2, "G", 0, "G", ""},
+ {3, "B", 0, "B", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_flip_items[] = {
- {0, "X", 0, "Flip X", ""},
- {1, "Y", 0, "Flip Y", ""},
- {2, "XY", 0, "Flip X & Y", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "X", 0, "Flip X", ""},
+ {1, "Y", 0, "Flip Y", ""},
+ {2, "XY", 0, "Flip X & Y", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_ycc_items[] = {
- { 0, "ITUBT601", 0, "ITU 601", ""},
- { 1, "ITUBT709", 0, "ITU 709", ""},
- { 2, "JFIF", 0, "Jpeg", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "ITUBT601", 0, "ITU 601", ""},
+ {1, "ITUBT709", 0, "ITU 709", ""},
+ {2, "JFIF", 0, "Jpeg", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_glossy_items[] = {
- {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
- {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
- {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
- {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
- {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
+ {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
+ {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
+ {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
+ {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_anisotropic_items[] = {
- {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
- {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
- {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
+ {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
+ {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
+ {SHD_GLOSSY_ASHIKHMIN_SHIRLEY, "ASHIKHMIN_SHIRLEY", 0, "Ashikhmin-Shirley", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_glass_items[] = {
- {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
- {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
- {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
- {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
+ {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
+ {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
+ {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_refraction_items[] = {
- {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
- {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
- {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_GLOSSY_SHARP, "SHARP", 0, "Sharp", ""},
+ {SHD_GLOSSY_BECKMANN, "BECKMANN", 0, "Beckmann", ""},
+ {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_toon_items[] = {
- {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
- {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_TOON_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
+ {SHD_TOON_GLOSSY, "GLOSSY", 0, "Glossy", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_hair_items[] = {
- {SHD_HAIR_REFLECTION, "Reflection", 0, "Reflection", ""},
- {SHD_HAIR_TRANSMISSION, "Transmission", 0, "Transmission", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_HAIR_REFLECTION, "Reflection", 0, "Reflection", ""},
+ {SHD_HAIR_TRANSMISSION, "Transmission", 0, "Transmission", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_principled_hair_items[] = {
- {SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION, "ABSORPTION", 0, "Absorption coefficient",
- "Directly set the absorption coefficient sigma_a (this is not the most intuitive way to color hair)"},
- {SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION, "MELANIN", 0, "Melanin concentration",
- "Define the melanin concentrations below to get the most realistic-looking hair"
- "(you can get the concentrations for different types of hair online)"},
- {SHD_PRINCIPLED_HAIR_REFLECTANCE, "COLOR", 0, "Direct coloring",
- "Choose the color of your preference, and the shader will approximate the absorption coefficient to render lookalike hair"},
- {0, NULL, 0, NULL, NULL},
+ {SHD_PRINCIPLED_HAIR_DIRECT_ABSORPTION,
+ "ABSORPTION",
+ 0,
+ "Absorption coefficient",
+ "Directly set the absorption coefficient sigma_a (this is not the most intuitive way to "
+ "color hair)"},
+ {SHD_PRINCIPLED_HAIR_PIGMENT_CONCENTRATION,
+ "MELANIN",
+ 0,
+ "Melanin concentration",
+ "Define the melanin concentrations below to get the most realistic-looking hair"
+ "(you can get the concentrations for different types of hair online)"},
+ {SHD_PRINCIPLED_HAIR_REFLECTANCE,
+ "COLOR",
+ 0,
+ "Direct coloring",
+ "Choose the color of your preference, and the shader will approximate the absorption "
+ "coefficient to render lookalike hair"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_script_mode_items[] = {
- {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
- {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
- {0, NULL, 0, NULL, NULL},
+ {NODE_SCRIPT_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text data-block"},
+ {NODE_SCRIPT_EXTERNAL, "EXTERNAL", 0, "External", "Use external .osl or .oso file"},
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem node_ies_mode_items[] = {
- {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text datablock"},
- {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
- {0, NULL, 0, NULL, NULL},
+ {NODE_IES_INTERNAL, "INTERNAL", 0, "Internal", "Use internal text datablock"},
+ {NODE_IES_EXTERNAL, "EXTERNAL", 0, "External", "Use external .ies file"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_principled_distribution_items[] = {
- {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
- {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
- {0, NULL, 0, NULL, NULL},
+ {SHD_GLOSSY_GGX, "GGX", 0, "GGX", ""},
+ {SHD_GLOSSY_MULTI_GGX, "MULTI_GGX", 0, "Multiscatter GGX", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem node_subsurface_method_items[] = {
- {SHD_SUBSURFACE_BURLEY, "BURLEY", 0, "Christensen-Burley", "Approximation to physically based volume scattering"},
- {SHD_SUBSURFACE_RANDOM_WALK, "RANDOM_WALK", 0, "Random Walk", "Volumetric approximation to physically based volume scattering"},
- { 0, NULL, 0, NULL, NULL }
-};
-
+ {SHD_SUBSURFACE_BURLEY,
+ "BURLEY",
+ 0,
+ "Christensen-Burley",
+ "Approximation to physically based volume scattering"},
+ {SHD_SUBSURFACE_RANDOM_WALK,
+ "RANDOM_WALK",
+ 0,
+ "Random Walk",
+ "Volumetric approximation to physically based volume scattering"},
+ {0, NULL, 0, NULL, NULL}};
/* -- Common nodes ---------------------------------------------------------- */
static void def_group_input(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
- RNA_def_property_struct_type(prop, "PropertyGroup");
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
+ prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
+ RNA_def_property_struct_type(prop, "PropertyGroup");
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
}
static void def_group_output(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
- RNA_def_property_struct_type(prop, "PropertyGroup");
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
+ prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, "rna_NodeGroupInputOutput_interface_typef", NULL);
+ RNA_def_property_struct_type(prop, "PropertyGroup");
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
- prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
- RNA_def_property_ui_text(prop, "Active Output", "True if this node is used as the active group output");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
+ RNA_def_property_ui_text(
+ prop, "Active Output", "True if this node is used as the active group output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_group(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "NodeTree");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_NodeGroup_node_tree_set", NULL, "rna_NodeGroup_node_tree_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Node Tree", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "NodeTree");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_NodeGroup_node_tree_set", NULL, "rna_NodeGroup_node_tree_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Node Tree", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeGroup_update");
- prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_NodeGroup_interface_typef", NULL);
- RNA_def_property_struct_type(prop, "PropertyGroup");
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
+ prop = RNA_def_property(srna, "interface", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_NodeGroup_interface_typef", NULL);
+ RNA_def_property_struct_type(prop, "PropertyGroup");
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Interface", "Interface socket data");
}
-static void def_custom_group(
- BlenderRNA *brna, const char *struct_name, const char *base_name,
- const char *ui_name, const char *ui_desc, const char *reg_func)
+static void def_custom_group(BlenderRNA *brna,
+ const char *struct_name,
+ const char *base_name,
+ const char *ui_name,
+ const char *ui_desc,
+ const char *reg_func)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, struct_name, base_name);
- RNA_def_struct_ui_text(srna, ui_name, ui_desc);
- RNA_def_struct_sdna(srna, "bNode");
+ srna = RNA_def_struct(brna, struct_name, base_name);
+ RNA_def_struct_ui_text(srna, ui_name, ui_desc);
+ RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_register_funcs(srna, reg_func, "rna_Node_unregister", NULL);
+ RNA_def_struct_register_funcs(srna, reg_func, "rna_Node_unregister", NULL);
- def_group(srna);
+ def_group(srna);
}
static void def_frame(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Text");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Text", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Text");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Text", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodeFrame", "storage");
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_NODETREE);
+ RNA_def_struct_sdna_from(srna, "NodeFrame", "storage");
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_ID_NODETREE);
- prop = RNA_def_property(srna, "shrink", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_FRAME_SHRINK);
- RNA_def_property_ui_text(prop, "Shrink", "Shrink the frame to minimal bounding box");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+ prop = RNA_def_property(srna, "shrink", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_FRAME_SHRINK);
+ RNA_def_property_ui_text(prop, "Shrink", "Shrink the frame to minimal bounding box");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
- prop = RNA_def_property(srna, "label_size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "label_size");
- RNA_def_property_range(prop, 8, 64);
- RNA_def_property_ui_text(prop, "Label Font Size", "Font size to use for displaying the label");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+ prop = RNA_def_property(srna, "label_size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "label_size");
+ RNA_def_property_range(prop, 8, 64);
+ RNA_def_property_ui_text(prop, "Label Font Size", "Font size to use for displaying the label");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
}
static void def_math(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, rna_enum_node_math_items);
- RNA_def_property_ui_text(prop, "Operation", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, rna_enum_node_math_items);
+ RNA_def_property_ui_text(prop, "Operation", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MATH_CLAMP);
- RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MATH_CLAMP);
+ RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_vector_math(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, rna_enum_node_vec_math_items);
- RNA_def_property_ui_text(prop, "Operation", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "operation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, rna_enum_node_vec_math_items);
+ RNA_def_property_ui_text(prop, "Operation", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_rgb_curve(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Mapping", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_vector_curve(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Mapping", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_time(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_ui_text(prop, "Start Frame", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(prop, "Start Frame", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_ui_text(prop, "End Frame", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_ui_text(prop, "End Frame", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_colorramp(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Color Ramp", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Color Ramp", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_mix_rgb(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, rna_enum_ramp_blend_items);
- RNA_def_property_ui_text(prop, "Blend Type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, rna_enum_ramp_blend_items);
+ RNA_def_property_ui_text(prop, "Blend Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MIXRGB_USE_ALPHA);
- RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MIXRGB_USE_ALPHA);
+ RNA_def_property_ui_text(prop, "Alpha", "Include alpha of second input in this operation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MIXRGB_CLAMP);
- RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_MIXRGB_CLAMP);
+ RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_texture(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Texture");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Texture", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Texture");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Texture", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_ui_text(prop, "Node Output", "For node-based textures, which output node to use");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "node_output", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(
+ prop, "Node Output", "For node-based textures, which output node to use");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
-
/* -- Shader Nodes ---------------------------------------------------------- */
static void def_sh_output(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
- RNA_def_property_ui_text(prop, "Active Output", "True if this node is used as the active output");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "is_active_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_DO_OUTPUT);
+ RNA_def_property_ui_text(
+ prop, "Active Output", "True if this node is used as the active output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, prop_shader_output_target_items);
- RNA_def_property_ui_text(prop, "Target", "Which renderer and viewport shading types to use the shaders for");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "target", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, prop_shader_output_target_items);
+ RNA_def_property_ui_text(
+ prop, "Target", "Which renderer and viewport shading types to use the shaders for");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_output_linestyle(StructRNA *srna)
{
- def_sh_output(srna);
- def_mix_rgb(srna);
+ def_sh_output(srna);
+ def_mix_rgb(srna);
}
static void def_sh_mapping(StructRNA *srna)
{
- static const EnumPropertyItem prop_vect_type_items[] = {
- {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"},
- {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
- {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
- {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static float default_1[3] = {1.f, 1.f, 1.f};
-
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
-
- prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_vect_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- /* Not PROP_XYZ, this is now in radians, no more degrees */
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Rotation", "");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Scale", "");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
- RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
-
- prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
- RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
- RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+ static const EnumPropertyItem prop_vect_type_items[] = {
+ {TEXMAP_TYPE_TEXTURE,
+ "TEXTURE",
+ 0,
+ "Texture",
+ "Transform a texture by inverse mapping the texture coordinate"},
+ {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
+ {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
+ {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static float default_1[3] = {1.f, 1.f, 1.f};
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
+
+ prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_vect_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ /* Not PROP_XYZ, this is now in radians, no more degrees */
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Scale", "");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
+ RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
+
+ prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
+ RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
+ RNA_def_property_update(prop, 0, "rna_Mapping_Node_update");
}
static void def_sh_attribute(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeShaderAttribute", "storage");
- prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Attribute Name", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "attribute_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Attribute Name", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_tex(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "base.tex_mapping");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
+ prop = RNA_def_property(srna, "texture_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "base.tex_mapping");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Texture Mapping", "Texture coordinate mapping settings");
- prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "base.color_mapping");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
+ prop = RNA_def_property(srna, "color_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "base.color_mapping");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Color Mapping", "Color mapping settings");
}
static void def_sh_tex_sky(StructRNA *srna)
{
- static const EnumPropertyItem prop_sky_type[] = {
- {SHD_SKY_OLD, "PREETHAM", 0, "Preetham", ""},
- {SHD_SKY_NEW, "HOSEK_WILKIE", 0, "Hosek / Wilkie", ""},
- {0, NULL, 0, NULL, NULL},
- };
- static float default_dir[3] = {0.0f, 0.0f, 1.0f};
+ static const EnumPropertyItem prop_sky_type[] = {
+ {SHD_SKY_OLD, "PREETHAM", 0, "Preetham", ""},
+ {SHD_SKY_NEW, "HOSEK_WILKIE", 0, "Hosek / Wilkie", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static float default_dir[3] = {0.0f, 0.0f, 1.0f};
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage");
- def_sh_tex(srna);
+ RNA_def_struct_sdna_from(srna, "NodeTexSky", "storage");
+ def_sh_tex(srna);
- prop = RNA_def_property(srna, "sky_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sky_model");
- RNA_def_property_enum_items(prop, prop_sky_type);
- RNA_def_property_ui_text(prop, "Sky Type", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "sky_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sky_model");
+ RNA_def_property_enum_items(prop, prop_sky_type);
+ RNA_def_property_ui_text(prop, "Sky Type", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_dir);
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "sun_direction", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_ui_text(prop, "Sun Direction", "Direction from where the sun is shining");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_dir);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 1.0f, 10.0f);
- RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "turbidity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 1.0f, 10.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Turbidity", "Atmospheric turbidity");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "ground_albedo", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Ground Albedo", "Ground color that is subtly reflected in the sky");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "ground_albedo", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Ground Albedo", "Ground color that is subtly reflected in the sky");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static const EnumPropertyItem sh_tex_prop_color_space_items[] = {
- {SHD_COLORSPACE_COLOR, "COLOR", 0, "Color",
- "Image contains color data, and will be converted to linear color for rendering"},
- {SHD_COLORSPACE_NONE, "NONE", 0, "Non-Color Data",
- "Image contains non-color data, for example a displacement or normal map, "
- "and will not be converted"},
- {0, NULL, 0, NULL, NULL},
+ {SHD_COLORSPACE_COLOR,
+ "COLOR",
+ 0,
+ "Color",
+ "Image contains color data, and will be converted to linear color for rendering"},
+ {SHD_COLORSPACE_NONE,
+ "NONE",
+ 0,
+ "Non-Color Data",
+ "Image contains non-color data, for example a displacement or normal map, "
+ "and will not be converted"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem sh_tex_prop_interpolation_items[] = {
- {SHD_INTERP_LINEAR, "Linear", 0, "Linear",
- "Linear interpolation"},
- {SHD_INTERP_CLOSEST, "Closest", 0, "Closest",
- "No interpolation (sample closest texel)"},
- {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic",
- "Cubic interpolation"},
- {SHD_INTERP_SMART, "Smart", 0, "Smart",
- "Bicubic when magnifying, else bilinear (OSL only)"},
- {0, NULL, 0, NULL, NULL},
+ {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
+ {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
+ {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
+ {SHD_INTERP_SMART, "Smart", 0, "Smart", "Bicubic when magnifying, else bilinear (OSL only)"},
+ {0, NULL, 0, NULL, NULL},
};
static void def_sh_tex_environment(StructRNA *srna)
{
- static const EnumPropertyItem prop_projection_items[] = {
- {SHD_PROJ_EQUIRECTANGULAR, "EQUIRECTANGULAR", 0, "Equirectangular",
- "Equirectangular or latitude-longitude projection"},
- {SHD_PROJ_MIRROR_BALL, "MIRROR_BALL", 0, "Mirror Ball",
- "Projection from an orthographic photo of a mirror ball"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
-
- RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
- def_sh_tex(srna);
-
- prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, sh_tex_prop_color_space_items);
- RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR);
- RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_projection_items);
- RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, sh_tex_prop_interpolation_items);
- RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ static const EnumPropertyItem prop_projection_items[] = {
+ {SHD_PROJ_EQUIRECTANGULAR,
+ "EQUIRECTANGULAR",
+ 0,
+ "Equirectangular",
+ "Equirectangular or latitude-longitude projection"},
+ {SHD_PROJ_MIRROR_BALL,
+ "MIRROR_BALL",
+ 0,
+ "Mirror Ball",
+ "Projection from an orthographic photo of a mirror ball"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeTexEnvironment", "storage");
+ def_sh_tex(srna);
+
+ prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, sh_tex_prop_color_space_items);
+ RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR);
+ RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_projection_items);
+ RNA_def_property_ui_text(prop, "Projection", "Projection of the input image");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, sh_tex_prop_interpolation_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+ RNA_def_property_ui_text(
+ prop,
+ "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_image(StructRNA *srna)
{
- static const EnumPropertyItem prop_projection_items[] = {
- {SHD_PROJ_FLAT, "FLAT", 0, "Flat",
- "Image is projected flat using the X and Y coordinates of the texture vector"},
- {SHD_PROJ_BOX, "BOX", 0, "Box",
- "Image is projected using different components for each side of the object space bounding box"},
- {SHD_PROJ_SPHERE, "SPHERE", 0, "Sphere",
- "Image is projected spherically using the Z axis as central"},
- {SHD_PROJ_TUBE, "TUBE", 0, "Tube",
- "Image is projected from the tube using the Z axis as central"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_image_extension[] = {
- {SHD_IMAGE_EXTENSION_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
- {SHD_IMAGE_EXTENSION_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
- {SHD_IMAGE_EXTENSION_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
-
- RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
- def_sh_tex(srna);
-
- prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, sh_tex_prop_color_space_items);
- RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR);
- RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_projection_items);
- RNA_def_property_ui_text(prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, sh_tex_prop_interpolation_items);
- RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Projection Blend", "For box projection, amount of blend to use between sides");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_image_extension);
- RNA_def_property_ui_text(prop, "Extension", "How the image is extrapolated past its original bounds");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ static const EnumPropertyItem prop_projection_items[] = {
+ {SHD_PROJ_FLAT,
+ "FLAT",
+ 0,
+ "Flat",
+ "Image is projected flat using the X and Y coordinates of the texture vector"},
+ {SHD_PROJ_BOX,
+ "BOX",
+ 0,
+ "Box",
+ "Image is projected using different components for each side of the object space bounding "
+ "box"},
+ {SHD_PROJ_SPHERE,
+ "SPHERE",
+ 0,
+ "Sphere",
+ "Image is projected spherically using the Z axis as central"},
+ {SHD_PROJ_TUBE,
+ "TUBE",
+ 0,
+ "Tube",
+ "Image is projected from the tube using the Z axis as central"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_image_extension[] = {
+ {SHD_IMAGE_EXTENSION_REPEAT,
+ "REPEAT",
+ 0,
+ "Repeat",
+ "Cause the image to repeat horizontally and vertically"},
+ {SHD_IMAGE_EXTENSION_EXTEND,
+ "EXTEND",
+ 0,
+ "Extend",
+ "Extend by repeating edge pixels of the image"},
+ {SHD_IMAGE_EXTENSION_CLIP,
+ "CLIP",
+ 0,
+ "Clip",
+ "Clip to image size and set exterior pixels as transparent"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_tex_image_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeTexImage", "storage");
+ def_sh_tex(srna);
+
+ prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, sh_tex_prop_color_space_items);
+ RNA_def_property_enum_default(prop, SHD_COLORSPACE_COLOR);
+ RNA_def_property_ui_text(prop, "Color Space", "Image file color space");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "projection", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_projection_items);
+ RNA_def_property_ui_text(
+ prop, "Projection", "Method to project 2D image on object with a 3D texture vector");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, sh_tex_prop_interpolation_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "projection_blend", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(
+ prop, "Projection Blend", "For box projection, amount of blend to use between sides");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_image_extension);
+ RNA_def_property_ui_text(
+ prop, "Extension", "How the image is extrapolated past its original bounds");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+ RNA_def_property_ui_text(
+ prop,
+ "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_gradient(StructRNA *srna)
{
- static const EnumPropertyItem prop_gradient_type[] = {
- {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"},
- {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
- {SHD_BLEND_EASING, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
- {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
- {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
- {SHD_BLEND_QUADRATIC_SPHERE, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
- "Create a quadratic progression in the shape of a sphere"},
- {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
- def_sh_tex(srna);
-
- prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_gradient_type);
- RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ static const EnumPropertyItem prop_gradient_type[] = {
+ {SHD_BLEND_LINEAR, "LINEAR", 0, "Linear", "Create a linear progression"},
+ {SHD_BLEND_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
+ {SHD_BLEND_EASING,
+ "EASING",
+ 0,
+ "Easing",
+ "Create a progression easing from one step to the next"},
+ {SHD_BLEND_DIAGONAL, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
+ {SHD_BLEND_SPHERICAL, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
+ {SHD_BLEND_QUADRATIC_SPHERE,
+ "QUADRATIC_SPHERE",
+ 0,
+ "Quadratic sphere",
+ "Create a quadratic progression in the shape of a sphere"},
+ {SHD_BLEND_RADIAL, "RADIAL", 0, "Radial", "Create a radial progression"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeTexGradient", "storage");
+ def_sh_tex(srna);
+
+ prop = RNA_def_property(srna, "gradient_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_gradient_type);
+ RNA_def_property_ui_text(prop, "Gradient Type", "Style of the color blending");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_noise(StructRNA *srna)
{
- RNA_def_struct_sdna_from(srna, "NodeTexNoise", "storage");
- def_sh_tex(srna);
+ RNA_def_struct_sdna_from(srna, "NodeTexNoise", "storage");
+ def_sh_tex(srna);
}
static void def_sh_tex_checker(StructRNA *srna)
{
- RNA_def_struct_sdna_from(srna, "NodeTexChecker", "storage");
- def_sh_tex(srna);
+ RNA_def_struct_sdna_from(srna, "NodeTexChecker", "storage");
+ def_sh_tex(srna);
}
static void def_sh_tex_brick(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeTexBrick", "storage");
- def_sh_tex(srna);
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "offset_freq");
- RNA_def_property_int_default(prop, 2);
- RNA_def_property_range(prop, 1, 99);
- RNA_def_property_ui_text(prop, "Offset Frequency", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ RNA_def_struct_sdna_from(srna, "NodeTexBrick", "storage");
+ def_sh_tex(srna);
- prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "squash_freq");
- RNA_def_property_int_default(prop, 2);
- RNA_def_property_range(prop, 1, 99);
- RNA_def_property_ui_text(prop, "Squash Frequency", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "offset_freq");
+ RNA_def_property_int_default(prop, 2);
+ RNA_def_property_range(prop, 1, 99);
+ RNA_def_property_ui_text(prop, "Offset Frequency", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Offset Amount", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "squash_freq");
+ RNA_def_property_int_default(prop, 2);
+ RNA_def_property_range(prop, 1, 99);
+ RNA_def_property_ui_text(prop, "Squash Frequency", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "squash");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.0f, 99.0f);
- RNA_def_property_ui_text(prop, "Squash Amount", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Offset Amount", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "squash");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.0f, 99.0f);
+ RNA_def_property_ui_text(prop, "Squash Amount", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_magic(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
- def_sh_tex(srna);
+ RNA_def_struct_sdna_from(srna, "NodeTexMagic", "storage");
+ def_sh_tex(srna);
- prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "depth");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "turbulence_depth", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "depth");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(prop, "Depth", "Level of detail in the added turbulent noise");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_musgrave(StructRNA *srna)
{
- static const EnumPropertyItem prop_musgrave_type[] = {
- {SHD_MUSGRAVE_MULTIFRACTAL, "MULTIFRACTAL", 0, "Multifractal", ""},
- {SHD_MUSGRAVE_RIDGED_MULTIFRACTAL, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", ""},
- {SHD_MUSGRAVE_HYBRID_MULTIFRACTAL, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""},
- {SHD_MUSGRAVE_FBM, "FBM", 0, "fBM", ""},
- {SHD_MUSGRAVE_HETERO_TERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_musgrave_type[] = {
+ {SHD_MUSGRAVE_MULTIFRACTAL, "MULTIFRACTAL", 0, "Multifractal", ""},
+ {SHD_MUSGRAVE_RIDGED_MULTIFRACTAL, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal", ""},
+ {SHD_MUSGRAVE_HYBRID_MULTIFRACTAL, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal", ""},
+ {SHD_MUSGRAVE_FBM, "FBM", 0, "fBM", ""},
+ {SHD_MUSGRAVE_HETERO_TERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeTexMusgrave", "storage");
- def_sh_tex(srna);
+ RNA_def_struct_sdna_from(srna, "NodeTexMusgrave", "storage");
+ def_sh_tex(srna);
- prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "musgrave_type");
- RNA_def_property_enum_items(prop, prop_musgrave_type);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "musgrave_type");
+ RNA_def_property_enum_items(prop, prop_musgrave_type);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_voronoi(StructRNA *srna)
{
- static const EnumPropertyItem prop_coloring_items[] = {
- {SHD_VORONOI_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
- {SHD_VORONOI_CELLS, "CELLS", 0, "Cells", "Color cells by position"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem prop_distance_items[] = {
- { SHD_VORONOI_DISTANCE, "DISTANCE", 0, "Distance", "Distance" },
- { SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Manhattan (city block) distance" },
- { SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Chebychev distance" },
- { SHD_VORONOI_MINKOWSKI, "MINKOWSKI", 0, "Minkowski", "Minkowski distance" },
- { 0, NULL, 0, NULL, NULL }
- };
-
- static EnumPropertyItem prop_feature_items[] = {
- { SHD_VORONOI_F1, "F1", 0, "Closest", "Closest point" },
- { SHD_VORONOI_F2, "F2", 0, "2nd Closest", "2nd closest point" },
- { SHD_VORONOI_F3, "F3", 0, "3rd Closest", "3rd closest point" },
- { SHD_VORONOI_F4, "F4", 0, "4th Closest", "4th closest point" },
- { SHD_VORONOI_F2F1, "F2F1", 0, "Crackle", "Difference between 2nd and 1st closest point" },
- { 0, NULL, 0, NULL, NULL }
- };
-
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
- def_sh_tex(srna);
-
- prop = RNA_def_property(srna, "coloring", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "coloring");
- RNA_def_property_enum_items(prop, prop_coloring_items);
- RNA_def_property_ui_text(prop, "Coloring", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "distance", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "distance");
- RNA_def_property_enum_items(prop, prop_distance_items);
- RNA_def_property_ui_text(prop, "Distance metric", "");
- RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
-
- prop = RNA_def_property(srna, "feature", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "feature");
- RNA_def_property_enum_items(prop, prop_feature_items);
- RNA_def_property_ui_text(prop, "Feature Output", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ static const EnumPropertyItem prop_coloring_items[] = {
+ {SHD_VORONOI_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
+ {SHD_VORONOI_CELLS, "CELLS", 0, "Cells", "Color cells by position"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem prop_distance_items[] = {
+ {SHD_VORONOI_DISTANCE, "DISTANCE", 0, "Distance", "Distance"},
+ {SHD_VORONOI_MANHATTAN, "MANHATTAN", 0, "Manhattan", "Manhattan (city block) distance"},
+ {SHD_VORONOI_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "Chebychev distance"},
+ {SHD_VORONOI_MINKOWSKI, "MINKOWSKI", 0, "Minkowski", "Minkowski distance"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static EnumPropertyItem prop_feature_items[] = {
+ {SHD_VORONOI_F1, "F1", 0, "Closest", "Closest point"},
+ {SHD_VORONOI_F2, "F2", 0, "2nd Closest", "2nd closest point"},
+ {SHD_VORONOI_F3, "F3", 0, "3rd Closest", "3rd closest point"},
+ {SHD_VORONOI_F4, "F4", 0, "4th Closest", "4th closest point"},
+ {SHD_VORONOI_F2F1, "F2F1", 0, "Crackle", "Difference between 2nd and 1st closest point"},
+ {0, NULL, 0, NULL, NULL}};
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeTexVoronoi", "storage");
+ def_sh_tex(srna);
+
+ prop = RNA_def_property(srna, "coloring", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "coloring");
+ RNA_def_property_enum_items(prop, prop_coloring_items);
+ RNA_def_property_ui_text(prop, "Coloring", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "distance", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "distance");
+ RNA_def_property_enum_items(prop, prop_distance_items);
+ RNA_def_property_ui_text(prop, "Distance metric", "");
+ RNA_def_property_update(prop, 0, "rna_ShaderNode_socket_update");
+
+ prop = RNA_def_property(srna, "feature", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "feature");
+ RNA_def_property_enum_items(prop, prop_feature_items);
+ RNA_def_property_ui_text(prop, "Feature Output", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_wave(StructRNA *srna)
{
- static const EnumPropertyItem prop_wave_type_items[] = {
- {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
- {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_wave_type_items[] = {
+ {SHD_WAVE_BANDS, "BANDS", 0, "Bands", "Use standard wave texture in bands"},
+ {SHD_WAVE_RINGS, "RINGS", 0, "Rings", "Use wave texture in rings"},
+ {0, NULL, 0, NULL, NULL},
+ };
- static const EnumPropertyItem prop_wave_profile_items[] = {
- {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
- {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_wave_profile_items[] = {
+ {SHD_WAVE_PROFILE_SIN, "SIN", 0, "Sine", "Use a standard sine profile"},
+ {SHD_WAVE_PROFILE_SAW, "SAW", 0, "Saw", "Use a sawtooth profile"},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
- def_sh_tex(srna);
+ RNA_def_struct_sdna_from(srna, "NodeTexWave", "storage");
+ def_sh_tex(srna);
- prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "wave_type");
- RNA_def_property_enum_items(prop, prop_wave_type_items);
- RNA_def_property_ui_text(prop, "Wave Type", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "wave_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wave_type");
+ RNA_def_property_enum_items(prop, prop_wave_type_items);
+ RNA_def_property_ui_text(prop, "Wave Type", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "wave_profile");
- RNA_def_property_enum_items(prop, prop_wave_profile_items);
- RNA_def_property_ui_text(prop, "Wave Profile", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "wave_profile", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wave_profile");
+ RNA_def_property_enum_items(prop, prop_wave_profile_items);
+ RNA_def_property_ui_text(prop, "Wave Profile", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_coord(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Object", "Use coordinates from this object (for object texture coordinates output)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(
+ prop, "Object", "Use coordinates from this object (for object texture coordinates output)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "From Instancer", "Use the parent of the dupli object if possible");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(
+ prop, "From Instancer", "Use the parent of the dupli object if possible");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_vect_transform(StructRNA *srna)
{
- static const EnumPropertyItem prop_vect_type_items[] = {
- {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
- {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
- {SHD_VECT_TRANSFORM_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_vect_space_items[] = {
- {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
- {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
- {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage");
-
- prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_vect_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_vect_space_items);
- RNA_def_property_ui_text(prop, "Convert From", "Space to convert from");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_vect_space_items);
- RNA_def_property_ui_text(prop, "Convert To", "Space to convert to");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ static const EnumPropertyItem prop_vect_type_items[] = {
+ {SHD_VECT_TRANSFORM_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
+ {SHD_VECT_TRANSFORM_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
+ {SHD_VECT_TRANSFORM_TYPE_NORMAL,
+ "NORMAL",
+ 0,
+ "Normal",
+ "Transform a normal vector with unit length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_vect_space_items[] = {
+ {SHD_VECT_TRANSFORM_SPACE_WORLD, "WORLD", 0, "World", ""},
+ {SHD_VECT_TRANSFORM_SPACE_OBJECT, "OBJECT", 0, "Object", ""},
+ {SHD_VECT_TRANSFORM_SPACE_CAMERA, "CAMERA", 0, "Camera", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeShaderVectTransform", "storage");
+
+ prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_vect_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "convert_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_vect_space_items);
+ RNA_def_property_ui_text(prop, "Convert From", "Space to convert from");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "convert_to", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_vect_space_items);
+ RNA_def_property_ui_text(prop, "Convert To", "Space to convert to");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_tex_wireframe(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_pixel_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Pixel Size", "Use screen pixel size instead of world units");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_tex_pointdensity(StructRNA *srna)
{
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem point_source_items[] = {
- {SHD_POINTDENSITY_SOURCE_PSYS, "PARTICLE_SYSTEM", 0, "Particle System",
- "Generate point density from a particle system"},
- {SHD_POINTDENSITY_SOURCE_OBJECT, "OBJECT", 0, "Object Vertices",
- "Generate point density from an object's vertices"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_interpolation_items[] = {
- {SHD_INTERP_CLOSEST, "Closest", 0, "Closest",
- "No interpolation (sample closest texel)"},
- {SHD_INTERP_LINEAR, "Linear", 0, "Linear",
- "Linear interpolation"},
- {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic",
- "Cubic interpolation"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem space_items[] = {
- {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
- {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem particle_color_source_items[] = {
- {SHD_POINTDENSITY_COLOR_PARTAGE, "PARTICLE_AGE", 0, "Particle Age",
- "Lifetime mapped as 0.0 - 1.0 intensity"},
- {SHD_POINTDENSITY_COLOR_PARTSPEED, "PARTICLE_SPEED", 0, "Particle Speed",
- "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"},
- {SHD_POINTDENSITY_COLOR_PARTVEL, "PARTICLE_VELOCITY", 0, "Particle Velocity",
- "XYZ velocity mapped to RGB colors"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem vertex_color_source_items[] = {
- {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
- {SHD_POINTDENSITY_COLOR_VERTWEIGHT, "VERTEX_WEIGHT", 0, "Vertex Weight", "Vertex group weight"},
- {SHD_POINTDENSITY_COLOR_VERTNOR, "VERTEX_NORMAL", 0, "Vertex Normal",
- "XYZ normal vector mapped to RGB colors"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage");
-
- prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, point_source_items);
- RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_pointer_funcs(prop, "rna_ShaderNodePointDensity_psys_get",
- "rna_ShaderNodePointDensity_psys_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 32768);
- RNA_def_property_ui_text(prop, "Resolution", "Resolution used by the texture holding the point density");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0.001, FLT_MAX);
- RNA_def_property_ui_text(prop, "Radius", "Radius from the shaded sample to look for points within");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, space_items);
- RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_interpolation_items);
- RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "color_source");
- RNA_def_property_enum_items(prop, particle_color_source_items);
- RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ob_color_source");
- RNA_def_property_enum_items(prop, vertex_color_source_items);
- RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache");
- RNA_def_function_ui_description(func, "Cache point density data for later calculation");
- RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
-
- func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
- RNA_def_function_ui_description(func, "Calculate point density");
- RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
- /* TODO, See how array size of 0 works, this shouldnt be used. */
- parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
- RNA_def_function_output(func, parm);
-
- func = RNA_def_function(srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax");
- RNA_def_function_ui_description(func, "Calculate point density");
- RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
- parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_array(parm, 3);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_array(parm, 3);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem point_source_items[] = {
+ {SHD_POINTDENSITY_SOURCE_PSYS,
+ "PARTICLE_SYSTEM",
+ 0,
+ "Particle System",
+ "Generate point density from a particle system"},
+ {SHD_POINTDENSITY_SOURCE_OBJECT,
+ "OBJECT",
+ 0,
+ "Object Vertices",
+ "Generate point density from an object's vertices"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_interpolation_items[] = {
+ {SHD_INTERP_CLOSEST, "Closest", 0, "Closest", "No interpolation (sample closest texel)"},
+ {SHD_INTERP_LINEAR, "Linear", 0, "Linear", "Linear interpolation"},
+ {SHD_INTERP_CUBIC, "Cubic", 0, "Cubic", "Cubic interpolation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem space_items[] = {
+ {SHD_POINTDENSITY_SPACE_OBJECT, "OBJECT", 0, "Object Space", ""},
+ {SHD_POINTDENSITY_SPACE_WORLD, "WORLD", 0, "World Space", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem particle_color_source_items[] = {
+ {SHD_POINTDENSITY_COLOR_PARTAGE,
+ "PARTICLE_AGE",
+ 0,
+ "Particle Age",
+ "Lifetime mapped as 0.0 - 1.0 intensity"},
+ {SHD_POINTDENSITY_COLOR_PARTSPEED,
+ "PARTICLE_SPEED",
+ 0,
+ "Particle Speed",
+ "Particle speed (absolute magnitude of velocity) mapped as 0.0-1.0 intensity"},
+ {SHD_POINTDENSITY_COLOR_PARTVEL,
+ "PARTICLE_VELOCITY",
+ 0,
+ "Particle Velocity",
+ "XYZ velocity mapped to RGB colors"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem vertex_color_source_items[] = {
+ {SHD_POINTDENSITY_COLOR_VERTCOL, "VERTEX_COLOR", 0, "Vertex Color", "Vertex color layer"},
+ {SHD_POINTDENSITY_COLOR_VERTWEIGHT,
+ "VERTEX_WEIGHT",
+ 0,
+ "Vertex Weight",
+ "Vertex group weight"},
+ {SHD_POINTDENSITY_COLOR_VERTNOR,
+ "VERTEX_NORMAL",
+ 0,
+ "Vertex Normal",
+ "XYZ normal vector mapped to RGB colors"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Object", "Object to take point data from");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeShaderTexPointDensity", "storage");
+
+ prop = RNA_def_property(srna, "point_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, point_source_items);
+ RNA_def_property_ui_text(prop, "Point Source", "Point data to use as renderable point density");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Particle System", "Particle System to render as points");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_ShaderNodePointDensity_psys_get",
+ "rna_ShaderNodePointDensity_psys_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 32768);
+ RNA_def_property_ui_text(
+ prop, "Resolution", "Resolution used by the texture holding the point density");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0.001, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Radius", "Radius from the shaded sample to look for points within");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, space_items);
+ RNA_def_property_ui_text(prop, "Space", "Coordinate system to calculate voxels in");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_interpolation_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Texture interpolation");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "particle_color_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "color_source");
+ RNA_def_property_enum_items(prop, particle_color_source_items);
+ RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "vertex_color_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ob_color_source");
+ RNA_def_property_enum_items(prop, vertex_color_source_items);
+ RNA_def_property_ui_text(prop, "Color Source", "Data to derive color results from");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "vertex_attribute_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Vertex Attribute Name", "Vertex attribute to use for color");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ func = RNA_def_function(srna, "cache_point_density", "rna_ShaderNodePointDensity_density_cache");
+ RNA_def_function_ui_description(func, "Cache point density data for later calculation");
+ RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
+
+ func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
+ RNA_def_function_ui_description(func, "Calculate point density");
+ RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
+ /* TODO, See how array size of 0 works, this shouldnt be used. */
+ parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
+ RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(
+ srna, "calc_point_density_minmax", "rna_ShaderNodePointDensity_density_minmax");
+ RNA_def_function_ui_description(func, "Calculate point density");
+ RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
+ parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_array(parm, 3);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_array(parm, 3);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
static void def_glossy(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_glossy_items);
- RNA_def_property_ui_text(prop, "Distribution", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_glossy_items);
+ RNA_def_property_ui_text(prop, "Distribution", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_glass(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_glass_items);
- RNA_def_property_ui_text(prop, "Distribution", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_glass_items);
+ RNA_def_property_ui_text(prop, "Distribution", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_principled(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_principled_distribution_items);
- RNA_def_property_ui_text(prop, "Distribution", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_principled_distribution_items);
+ RNA_def_property_ui_text(prop, "Distribution", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
- prop = RNA_def_property(srna, "subsurface_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, node_subsurface_method_items);
- RNA_def_property_ui_text(prop, "Subsurface Method", "Method for rendering subsurface scattering");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
+ prop = RNA_def_property(srna, "subsurface_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, node_subsurface_method_items);
+ RNA_def_property_ui_text(
+ prop, "Subsurface Method", "Method for rendering subsurface scattering");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
}
static void def_refraction(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_refraction_items);
- RNA_def_property_ui_text(prop, "Distribution", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_refraction_items);
+ RNA_def_property_ui_text(prop, "Distribution", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_anisotropic(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_anisotropic_items);
- RNA_def_property_ui_text(prop, "Distribution", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_anisotropic_items);
+ RNA_def_property_ui_text(prop, "Distribution", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_toon(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_toon_items);
- RNA_def_property_ui_text(prop, "Component", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_toon_items);
+ RNA_def_property_ui_text(prop, "Component", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_bump(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Invert", "Invert the bump mapping direction to push into the surface instead of out");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(
+ prop, "Invert", "Invert the bump mapping direction to push into the surface instead of out");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_hair(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_hair_items);
- RNA_def_property_ui_text(prop, "Component", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "component", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_hair_items);
+ RNA_def_property_ui_text(prop, "Component", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
/* RNA initialization for the custom property. */
static void def_hair_principled(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_ui_text(prop, "Color parametrization", "Select the shader's color parametrization");
- RNA_def_property_enum_items(prop, node_principled_hair_items);
- RNA_def_property_enum_default(prop, SHD_PRINCIPLED_HAIR_REFLECTANCE);
- /* Upon editing, update both the node data AND the UI representation */
- /* (This effectively shows/hides the relevant sockets) */
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
+ prop = RNA_def_property(srna, "parametrization", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_ui_text(
+ prop, "Color parametrization", "Select the shader's color parametrization");
+ RNA_def_property_enum_items(prop, node_principled_hair_items);
+ RNA_def_property_enum_default(prop, SHD_PRINCIPLED_HAIR_REFLECTANCE);
+ /* Upon editing, update both the node data AND the UI representation */
+ /* (This effectively shows/hides the relevant sockets) */
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
}
static void def_sh_uvmap(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "From Instancer", "Use the parent of the dupli object if possible");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "from_instancer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(
+ prop, "From Instancer", "Use the parent of the dupli object if possible");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodeShaderUVMap", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeShaderUVMap", "storage");
- prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "UV Map", "UV coordinates to be used for mapping");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "UV Map", "UV coordinates to be used for mapping");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
}
static void def_sh_uvalongstroke(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_tips", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(
+ prop, "Use Tips", "Lower half of the texture is for tips of the stroke");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_normal_map(StructRNA *srna)
{
- static const EnumPropertyItem prop_space_items[] = {
- {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
- {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
- {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
- {SHD_SPACE_BLENDER_OBJECT, "BLENDER_OBJECT", 0, "Blender Object Space", "Object space normal mapping, compatible with Blender render baking"},
- {SHD_SPACE_BLENDER_WORLD, "BLENDER_WORLD", 0, "Blender World Space", "World space normal mapping, compatible with Blender render baking"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_space_items[] = {
+ {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space normal mapping"},
+ {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space normal mapping"},
+ {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space normal mapping"},
+ {SHD_SPACE_BLENDER_OBJECT,
+ "BLENDER_OBJECT",
+ 0,
+ "Blender Object Space",
+ "Object space normal mapping, compatible with Blender render baking"},
+ {SHD_SPACE_BLENDER_WORLD,
+ "BLENDER_WORLD",
+ 0,
+ "Blender World Space",
+ "World space normal mapping, compatible with Blender render baking"},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeShaderNormalMap", "storage");
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_space_items);
- RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_space_items);
+ RNA_def_property_ui_text(prop, "Space", "Space of the input normal");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent space maps");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
}
static void def_sh_displacement(StructRNA *srna)
{
- static const EnumPropertyItem prop_space_items[] = {
- {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Displacement is in object space, affected by object scale"},
- {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "Displacement is in world space, not affected by object scale"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_space_items[] = {
+ {SHD_SPACE_OBJECT,
+ "OBJECT",
+ 0,
+ "Object Space",
+ "Displacement is in object space, affected by object scale"},
+ {SHD_SPACE_WORLD,
+ "WORLD",
+ 0,
+ "World Space",
+ "Displacement is in world space, not affected by object scale"},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, prop_space_items);
- RNA_def_property_ui_text(prop, "Space", "Space of the input height");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, prop_space_items);
+ RNA_def_property_ui_text(prop, "Space", "Space of the input height");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
}
static void def_sh_vector_displacement(StructRNA *srna)
{
- static const EnumPropertyItem prop_space_items[] = {
- {SHD_SPACE_TANGENT, "TANGENT", 0, "Tangent Space", "Tangent space vector displacement mapping"},
- {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
- {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_space_items[] = {
+ {SHD_SPACE_TANGENT,
+ "TANGENT",
+ 0,
+ "Tangent Space",
+ "Tangent space vector displacement mapping"},
+ {SHD_SPACE_OBJECT, "OBJECT", 0, "Object Space", "Object space vector displacement mapping"},
+ {SHD_SPACE_WORLD, "WORLD", 0, "World Space", "World space vector displacement mapping"},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, prop_space_items);
- RNA_def_property_ui_text(prop, "Space", "Space of the input height");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, prop_space_items);
+ RNA_def_property_ui_text(prop, "Space", "Space of the input height");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
}
static void def_sh_tangent(StructRNA *srna)
{
- static const EnumPropertyItem prop_direction_type_items[] = {
- {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
- {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_direction_type_items[] = {
+ {SHD_TANGENT_RADIAL, "RADIAL", 0, "Radial", "Radial tangent around the X, Y or Z axis"},
+ {SHD_TANGENT_UVMAP, "UV_MAP", 0, "UV Map", "Tangent from UV map"},
+ {0, NULL, 0, NULL, NULL},
+ };
- static const EnumPropertyItem prop_axis_items[] = {
- {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
- {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
- {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem prop_axis_items[] = {
+ {SHD_TANGENT_AXIS_X, "X", 0, "X", "X axis"},
+ {SHD_TANGENT_AXIS_Y, "Y", 0, "Y", "Y axis"},
+ {SHD_TANGENT_AXIS_Z, "Z", 0, "Z", "Z axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeShaderTangent", "storage");
- prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_direction_type_items);
- RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "direction_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_direction_type_items);
+ RNA_def_property_ui_text(prop, "Direction", "Method to use for the tangent");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_axis_items);
- RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_axis_items);
+ RNA_def_property_ui_text(prop, "Axis", "Axis for radial tangents");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "uv_map", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "UV Map", "UV Map for tangent generated from UV");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
}
static void def_sh_bevel(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 2, 16);
- RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_range(prop, 2, 16);
+ RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
}
static void def_sh_ambient_occlusion(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 1, 128);
- RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
- RNA_def_property_update(prop, 0, "rna_Node_update");
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_range(prop, 1, 128);
+ RNA_def_property_ui_text(prop, "Samples", "Number of rays to trace per shader evaluation");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
- prop = RNA_def_property(srna, "inside", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_AO_INSIDE);
- RNA_def_property_ui_text(prop, "Inside", "Trace rays towards the inside of the object");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "inside", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_AO_INSIDE);
+ RNA_def_property_ui_text(prop, "Inside", "Trace rays towards the inside of the object");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "only_local", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_AO_LOCAL);
- RNA_def_property_ui_text(prop, "Only Local", "Only consider the object itself when computing AO");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "only_local", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", SHD_AO_LOCAL);
+ RNA_def_property_ui_text(
+ prop, "Only Local", "Only consider the object itself when computing AO");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_sh_subsurface(StructRNA *srna)
{
- static const EnumPropertyItem prop_subsurface_falloff_items[] = {
- {SHD_SUBSURFACE_CUBIC, "CUBIC", 0, "Cubic", "Simple cubic falloff function"},
- {SHD_SUBSURFACE_GAUSSIAN, "GAUSSIAN", 0, "Gaussian", "Normal distribution, multiple can be combined to fit more complex profiles"},
- {SHD_SUBSURFACE_BURLEY, "BURLEY", 0, "Christensen-Burley", "Approximation to physically based volume scattering"},
- {SHD_SUBSURFACE_RANDOM_WALK, "RANDOM_WALK", 0, "Random Walk", "Volumetric approximation to physically based volume scattering"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, prop_subsurface_falloff_items);
- RNA_def_property_ui_text(prop, "Falloff", "Function to determine how much light nearby points contribute based on their distance to the shading point");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
+ static const EnumPropertyItem prop_subsurface_falloff_items[] = {
+ {SHD_SUBSURFACE_CUBIC, "CUBIC", 0, "Cubic", "Simple cubic falloff function"},
+ {SHD_SUBSURFACE_GAUSSIAN,
+ "GAUSSIAN",
+ 0,
+ "Gaussian",
+ "Normal distribution, multiple can be combined to fit more complex profiles"},
+ {SHD_SUBSURFACE_BURLEY,
+ "BURLEY",
+ 0,
+ "Christensen-Burley",
+ "Approximation to physically based volume scattering"},
+ {SHD_SUBSURFACE_RANDOM_WALK,
+ "RANDOM_WALK",
+ 0,
+ "Random Walk",
+ "Volumetric approximation to physically based volume scattering"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, prop_subsurface_falloff_items);
+ RNA_def_property_ui_text(prop,
+ "Falloff",
+ "Function to determine how much light nearby points contribute based "
+ "on their distance to the shading point");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNode_socket_update");
}
static void def_sh_tex_ies(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Text");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "IES Text", "Internal IES file");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "ies", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Text");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "IES Text", "Internal IES file");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeShaderTexIES", "storage");
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "File Path", "IES light path");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "File Path", "IES light path");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeTexIES_mode_set", NULL);
- RNA_def_property_enum_items(prop, node_ies_mode_items);
- RNA_def_property_ui_text(prop, "Source", "Whether the IES file is loaded from disk or from a Text datablock");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeTexIES_mode_set", NULL);
+ RNA_def_property_enum_items(prop, node_ies_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Source", "Whether the IES file is loaded from disk or from a Text datablock");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
}
static void def_sh_script(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Text");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
-
- RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "File Path", "Shader script path");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeScript_mode_set", NULL);
- RNA_def_property_enum_items(prop, node_script_mode_items);
- RNA_def_property_ui_text(prop, "Script Source", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_SCRIPT_AUTO_UPDATE);
- RNA_def_property_ui_text(prop, "Auto Update",
- "Automatically update the shader when the .osl file changes (external scripts only)");
-
- prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ShaderNodeScript_bytecode_get", "rna_ShaderNodeScript_bytecode_length",
- "rna_ShaderNodeScript_bytecode_set");
- RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- /* needs to be reset to avoid bad pointer type in API functions below */
- RNA_def_struct_sdna_from(srna, "bNode", NULL);
-
- /* API functions */
-
-#if 0 /* XXX TODO use general node api for this */
- func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
- RNA_def_function_ui_description(func, "Find a socket by name");
- parm = RNA_def_string(func, "name", NULL, 0, "Socket name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
- parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
- RNA_def_function_ui_description(func, "Add a socket socket");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
- parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
- RNA_def_function_ui_description(func, "Remove a socket socket");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-#endif
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Text");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Script", "Internal shader script to define the shader");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeShaderScript", "storage");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "File Path", "Shader script path");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_ShaderNodeScript_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ShaderNodeScript_mode_set", NULL);
+ RNA_def_property_enum_items(prop, node_script_mode_items);
+ RNA_def_property_ui_text(prop, "Script Source", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_auto_update", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_SCRIPT_AUTO_UPDATE);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Update",
+ "Automatically update the shader when the .osl file changes (external scripts only)");
+
+ prop = RNA_def_property(srna, "bytecode", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ShaderNodeScript_bytecode_get",
+ "rna_ShaderNodeScript_bytecode_length",
+ "rna_ShaderNodeScript_bytecode_set");
+ RNA_def_property_ui_text(prop, "Bytecode", "Compile bytecode for shader script node");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "bytecode_hash", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Bytecode Hash", "Hash of compile bytecode, for quick equality checking");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ /* needs to be reset to avoid bad pointer type in API functions below */
+ RNA_def_struct_sdna_from(srna, "bNode", NULL);
+
+ /* API functions */
+
+# if 0 /* XXX TODO use general node api for this */
+ func = RNA_def_function(srna, "find_socket", "rna_ShaderNodeScript_find_socket");
+ RNA_def_function_ui_description(func, "Find a socket by name");
+ parm = RNA_def_string(func, "name", NULL, 0, "Socket name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
+ parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "add_socket", "rna_ShaderNodeScript_add_socket");
+ RNA_def_function_ui_description(func, "Add a socket socket");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", node_socket_type_items, SOCK_FLOAT, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /*parm =*/ RNA_def_boolean(func, "is_output", false, "Output", "Whether the socket is an output");
+ parm = RNA_def_pointer(func, "result", "NodeSocket", "", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove_socket", "rna_ShaderNodeScript_remove_socket");
+ RNA_def_function_ui_description(func, "Remove a socket socket");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_pointer(func, "sock", "NodeSocket", "Socket", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+# endif
}
/* -- Compositor Nodes ------------------------------------------------------ */
static void def_cmp_alpha_over(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- /* XXX: Tooltip */
- prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Convert Premul", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ /* XXX: Tooltip */
+ prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Convert Premul", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeTwoFloats", "storage");
- prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Premul", "Mix Factor");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "premul", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Premul", "Mix Factor");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_blur(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem filter_type_items[] = {
- {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
- {R_FILTER_TENT, "TENT", 0, "Tent", ""},
- {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
- {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
- {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
- {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
- {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
- {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem aspect_correction_type_items[] = {
- {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
- {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
- {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* duplicated in def_cmp_bokehblur */
- prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
- RNA_def_property_ui_text(prop, "Variable Size", "Support variable blur per-pixel when using an image for size input");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_EXTEND_BOUNDS);
- RNA_def_property_ui_text(prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
-
- prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "sizex");
- RNA_def_property_range(prop, 0, 2048);
- RNA_def_property_ui_text(prop, "Size X", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "sizey");
- RNA_def_property_range(prop, 0, 2048);
- RNA_def_property_ui_text(prop, "Size Y", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
- RNA_def_property_ui_text(prop, "Relative", "Use relative (percent) values to define blur radius");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "aspect");
- RNA_def_property_enum_items(prop, aspect_correction_type_items);
- RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fac");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Factor", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "percentx");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Relative Size X", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "percenty");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Relative Size Y", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filtertype");
- RNA_def_property_enum_items(prop, filter_type_items);
- RNA_def_property_ui_text(prop, "Filter Type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
- RNA_def_property_ui_text(prop, "Bokeh", "Use circular filter (slower)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
- RNA_def_property_ui_text(prop, "Gamma", "Apply filter on gamma corrected values");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem filter_type_items[] = {
+ {R_FILTER_BOX, "FLAT", 0, "Flat", ""},
+ {R_FILTER_TENT, "TENT", 0, "Tent", ""},
+ {R_FILTER_QUAD, "QUAD", 0, "Quadratic", ""},
+ {R_FILTER_CUBIC, "CUBIC", 0, "Cubic", ""},
+ {R_FILTER_GAUSS, "GAUSS", 0, "Gaussian", ""},
+ {R_FILTER_FAST_GAUSS, "FAST_GAUSS", 0, "Fast Gaussian", ""},
+ {R_FILTER_CATROM, "CATROM", 0, "Catrom", ""},
+ {R_FILTER_MITCH, "MITCH", 0, "Mitch", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem aspect_correction_type_items[] = {
+ {CMP_NODE_BLUR_ASPECT_NONE, "NONE", 0, "None", ""},
+ {CMP_NODE_BLUR_ASPECT_Y, "Y", 0, "Y", ""},
+ {CMP_NODE_BLUR_ASPECT_X, "X", 0, "X", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* duplicated in def_cmp_bokehblur */
+ prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+ RNA_def_property_ui_text(
+ prop, "Variable Size", "Support variable blur per-pixel when using an image for size input");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_EXTEND_BOUNDS);
+ RNA_def_property_ui_text(
+ prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
+
+ prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "sizex");
+ RNA_def_property_range(prop, 0, 2048);
+ RNA_def_property_ui_text(prop, "Size X", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "sizey");
+ RNA_def_property_range(prop, 0, 2048);
+ RNA_def_property_ui_text(prop, "Size Y", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
+ RNA_def_property_ui_text(
+ prop, "Relative", "Use relative (percent) values to define blur radius");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "aspect_correction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "aspect");
+ RNA_def_property_enum_items(prop, aspect_correction_type_items);
+ RNA_def_property_ui_text(prop, "Aspect Correction", "Type of aspect correction to use");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Factor", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "factor_x", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "percentx");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Relative Size X", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "factor_y", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "percenty");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Relative Size Y", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filtertype");
+ RNA_def_property_enum_items(prop, filter_type_items);
+ RNA_def_property_ui_text(prop, "Filter Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_bokeh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bokeh", 1);
+ RNA_def_property_ui_text(prop, "Bokeh", "Use circular filter (slower)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gamma", 1);
+ RNA_def_property_ui_text(prop, "Gamma", "Apply filter on gamma corrected values");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_filter(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, rna_enum_node_filter_items);
- RNA_def_property_ui_text(prop, "Filter Type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, rna_enum_node_filter_items);
+ RNA_def_property_ui_text(prop, "Filter Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_map_value(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_array(prop, 1);
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Offset", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_array(prop, 1);
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Size", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
- RNA_def_property_ui_text(prop, "Use Minimum", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
- RNA_def_property_ui_text(prop, "Use Maximum", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_array(prop, 1);
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Minimum", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_array(prop, 1);
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Maximum", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "TexMapping", "storage");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_array(prop, 1);
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Offset", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_array(prop, 1);
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Size", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
+ RNA_def_property_ui_text(prop, "Use Minimum", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
+ RNA_def_property_ui_text(prop, "Use Maximum", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_array(prop, 1);
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Minimum", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_array(prop, 1);
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Maximum", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_map_range(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Clamp", "Clamp result of the node to 0..1 range");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_vector_blur(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
-
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "samples");
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_ui_text(prop, "Samples", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "minspeed");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "Min Speed",
- "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "maxspeed");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fac");
- RNA_def_property_range(prop, 0.0, 20.0);
- RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
- RNA_def_property_ui_text(prop, "Blur Factor",
- "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
- RNA_def_property_ui_text(prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeBlurData", "storage");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_ui_text(prop, "Samples", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "speed_min", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "minspeed");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(
+ prop,
+ "Min Speed",
+ "Minimum speed for a pixel to be blurred (used to separate background from foreground)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "speed_max", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "maxspeed");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(prop, "Max Speed", "Maximum speed, or zero for none");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac");
+ RNA_def_property_range(prop, 0.0, 20.0);
+ RNA_def_property_ui_range(prop, 0.0, 2.0, 1.0, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Blur Factor",
+ "Scaling factor for motion vectors (actually, 'shutter speed', in frames)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_curved", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "curved", 1);
+ RNA_def_property_ui_text(
+ prop, "Curved", "Interpolate between frames in a Bezier curve, rather than linearly");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_levels(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- static const EnumPropertyItem channel_items[] = {
- {1, "COMBINED_RGB", 0, "C", "Combined RGB"},
- {2, "RED", 0, "R", "Red Channel"},
- {3, "GREEN", 0, "G", "Green Channel"},
- {4, "BLUE", 0, "B", "Blue Channel"},
- {5, "LUMINANCE", 0, "L", "Luminance Channel"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem channel_items[] = {
+ {1, "COMBINED_RGB", 0, "C", "Combined RGB"},
+ {2, "RED", 0, "R", "Red Channel"},
+ {3, "GREEN", 0, "G", "Green Channel"},
+ {4, "BLUE", 0, "B", "Blue Channel"},
+ {5, "LUMINANCE", 0, "L", "Luminance Channel"},
+ {0, NULL, 0, NULL, NULL},
+ };
- prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, channel_items);
- RNA_def_property_ui_text(prop, "Channel", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, channel_items);
+ RNA_def_property_ui_text(prop, "Channel", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_node_image_user(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "frames");
- RNA_def_property_range(prop, 0, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "sfra");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- /* copied from the rna_image.c */
- RNA_def_property_ui_text(prop, "Start Frame",
- "Global starting frame of the movie/sequence, assuming first picture has a #1");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- /* copied from the rna_image.c */
- RNA_def_property_ui_text(prop, "Offset", "Offset the number of the frame to use in the animation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
- RNA_def_property_ui_text(prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.c */
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
- /* copied from the rna_image.c */
- RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "layer");
- RNA_def_property_enum_items(prop, prop_image_layer_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf");
- RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
- RNA_def_property_ui_text(prop, "Layer", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update");
-
- prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer");
-
- prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "view");
- RNA_def_property_enum_items(prop, prop_image_view_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_view_itemf");
- RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
- RNA_def_property_ui_text(prop, "View", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "frames");
+ RNA_def_property_range(prop, 0, MAXFRAMEF);
+ RNA_def_property_ui_text(
+ prop, "Frames", "Number of images of a movie to use"); /* copied from the rna_image.c */
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "sfra");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ /* copied from the rna_image.c */
+ RNA_def_property_ui_text(
+ prop,
+ "Start Frame",
+ "Global starting frame of the movie/sequence, assuming first picture has a #1");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "frame_offset", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ /* copied from the rna_image.c */
+ RNA_def_property_ui_text(
+ prop, "Offset", "Offset the number of the frame to use in the animation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_cyclic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cycl", 1);
+ RNA_def_property_ui_text(
+ prop, "Cyclic", "Cycle the images in the movie"); /* copied from the rna_image.c */
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_auto_refresh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMA_ANIM_ALWAYS);
+ /* copied from the rna_image.c */
+ RNA_def_property_ui_text(prop, "Auto-Refresh", "Always refresh image on frame changes");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "layer");
+ RNA_def_property_enum_items(prop, prop_image_layer_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_layer_itemf");
+ RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
+ RNA_def_property_ui_text(prop, "Layer", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_image_layer_update");
+
+ prop = RNA_def_property(srna, "has_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_layers_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has Layers", "True if this image has any named layer");
+
+ prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "view");
+ RNA_def_property_enum_items(prop, prop_image_view_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_image_view_itemf");
+ RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
+ RNA_def_property_ui_text(prop, "View", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "has_views", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Node_image_has_views_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has View", "True if this image has multiple views");
}
static void def_cmp_image(StructRNA *srna)
{
- PropertyRNA *prop;
-
-#if 0
- static const EnumPropertyItem type_items[] = {
- {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
- {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
- {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
- {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
- {0, NULL, 0, NULL, NULL},
- };
-#endif
-
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id");
-
- prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT);
- RNA_def_property_ui_text(prop, "Straight Alpha Output", "Put Node output buffer to straight alpha instead of premultiplied");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- /* NB: image user properties used in the UI are redefined in def_node_image_user,
- * to trigger correct updates of the node editor. RNA design problem that prevents
- * updates from nested structs ...
- */
- RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
- def_node_image_user(srna);
+ PropertyRNA *prop;
+
+# if 0
+ static const EnumPropertyItem type_items[] = {
+ {IMA_SRC_FILE, "IMAGE", 0, "Image", ""},
+ {IMA_SRC_MOVIE, "MOVIE", "Movie", ""},
+ {IMA_SRC_SEQUENCE, "SEQUENCE", "Sequence", ""},
+ {IMA_SRC_GENERATED, "GENERATED", "Generated", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Image_Node_update_id");
+
+ prop = RNA_def_property(srna, "use_straight_alpha_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODE_IMAGE_USE_STRAIGHT_OUTPUT);
+ RNA_def_property_ui_text(prop,
+ "Straight Alpha Output",
+ "Put Node output buffer to straight alpha instead of premultiplied");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ /* NB: image user properties used in the UI are redefined in def_node_image_user,
+ * to trigger correct updates of the node editor. RNA design problem that prevents
+ * updates from nested structs ...
+ */
+ RNA_def_struct_sdna_from(srna, "ImageUser", "storage");
+ def_node_image_user(srna);
}
static void def_cmp_render_layers(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
- RNA_def_property_struct_type(prop, "Scene");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Scene", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Scene", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
- prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, prop_view_layer_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_view_layer_itemf");
- RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
- RNA_def_property_ui_text(prop, "Layer", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
+ prop = RNA_def_property(srna, "layer", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, prop_view_layer_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_view_layer_itemf");
+ RNA_def_property_flag(prop, PROP_ENUM_NO_TRANSLATE);
+ RNA_def_property_ui_text(prop, "Layer", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_view_layer_update");
}
static void rna_def_cmp_output_file_slot_file(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "NodeOutputFileSlotFile", NULL);
- RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
- RNA_def_struct_ui_text(srna, "Output File Slot", "Single layer file slot of the file output node");
+ srna = RNA_def_struct(brna, "NodeOutputFileSlotFile", NULL);
+ RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
+ RNA_def_struct_ui_text(
+ srna, "Output File Slot", "Single layer file slot of the file output node");
- prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_node_format", 1);
- RNA_def_property_ui_text(prop, "Use Node Format", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+ prop = RNA_def_property(srna, "use_node_format", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_node_format", 1);
+ RNA_def_property_ui_text(prop, "Use Node Format", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
- prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ImageFormatSettings");
+ prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ImageFormatSettings");
- prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "path");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotFile_path_set");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_ui_text(prop, "Path", "Subpath used for this slot");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+ prop = RNA_def_property(srna, "path", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "path");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotFile_path_set");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_ui_text(prop, "Path", "Subpath used for this slot");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
}
static void rna_def_cmp_output_file_slot_layer(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "NodeOutputFileSlotLayer", NULL);
- RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
- RNA_def_struct_ui_text(srna, "Output File Layer Slot", "Multilayer slot of the file output node");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "layer");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotLayer_name_set");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_ui_text(prop, "Name", "OpenEXR layer name used for this slot");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
-}
-static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna, PropertyRNA *cprop, const char *struct_name)
-{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, struct_name);
- srna = RNA_def_struct(brna, struct_name, NULL);
- RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots");
-
- func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new");
- RNA_def_function_ui_description(func, "Add a file slot to this node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return value */
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
- RNA_def_function_return(func, parm);
-
- /* NB: methods below can use the standard node socket API functions,
- * included here for completeness.
- */
-
- func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
- RNA_def_function_ui_description(func, "Remove a file slot from this node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
- RNA_def_function_ui_description(func, "Remove all file slots from this node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
-
- func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
- RNA_def_function_ui_description(func, "Move a file slot to another position");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "NodeOutputFileSlotLayer", NULL);
+ RNA_def_struct_sdna(srna, "NodeImageMultiFileSocket");
+ RNA_def_struct_ui_text(
+ srna, "Output File Layer Slot", "Multilayer slot of the file output node");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "layer");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_NodeOutputFileSlotLayer_name_set");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_ui_text(prop, "Name", "OpenEXR layer name used for this slot");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+}
+static void rna_def_cmp_output_file_slots_api(BlenderRNA *brna,
+ PropertyRNA *cprop,
+ const char *struct_name)
+{
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, struct_name);
+ srna = RNA_def_struct(brna, struct_name, NULL);
+ RNA_def_struct_sdna(srna, "bNode");
+ RNA_def_struct_ui_text(srna, "File Output Slots", "Collection of File Output node slots");
+
+ func = RNA_def_function(srna, "new", "rna_NodeOutputFile_slots_new");
+ RNA_def_function_ui_description(func, "Add a file slot to this node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return value */
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
+ RNA_def_function_return(func, parm);
+
+ /* NB: methods below can use the standard node socket API functions,
+ * included here for completeness.
+ */
+
+ func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
+ RNA_def_function_ui_description(func, "Remove a file slot from this node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "clear", "rna_Node_inputs_clear");
+ RNA_def_function_ui_description(func, "Remove all file slots from this node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+
+ func = RNA_def_function(srna, "move", "rna_Node_inputs_move");
+ RNA_def_function_ui_description(func, "Move a file slot to another position");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ parm = RNA_def_int(
+ func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void def_cmp_output_file(BlenderRNA *brna, StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
-
- prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "base_path");
- RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_input");
- RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ImageFormatSettings");
-
- /* XXX using two different collections here for the same basic DNA list!
- * Details of the output slots depend on whether the node is in Multilayer EXR mode.
- */
-
- prop = RNA_def_property(srna, "file_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_NodeOutputFile_slots_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end",
- "rna_NodeOutputFile_slot_file_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "NodeOutputFileSlotFile");
- RNA_def_property_ui_text(prop, "File Slots", "");
- rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileFileSlots");
-
- prop = RNA_def_property(srna, "layer_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_NodeOutputFile_slots_begin", "rna_iterator_listbase_next", "rna_iterator_listbase_end",
- "rna_NodeOutputFile_slot_layer_get", NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "NodeOutputFileSlotLayer");
- RNA_def_property_ui_text(prop, "EXR Layer Slots", "");
- rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileLayerSlots");
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeImageMultiFile", "storage");
+
+ prop = RNA_def_property(srna, "base_path", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "base_path");
+ RNA_def_property_ui_text(prop, "Base Path", "Base output path for the image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "active_input_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_input");
+ RNA_def_property_ui_text(prop, "Active Input Index", "Active input index in details view list");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ImageFormatSettings");
+
+ /* XXX using two different collections here for the same basic DNA list!
+ * Details of the output slots depend on whether the node is in Multilayer EXR mode.
+ */
+
+ prop = RNA_def_property(srna, "file_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_NodeOutputFile_slots_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_NodeOutputFile_slot_file_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "NodeOutputFileSlotFile");
+ RNA_def_property_ui_text(prop, "File Slots", "");
+ rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileFileSlots");
+
+ prop = RNA_def_property(srna, "layer_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_NodeOutputFile_slots_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_NodeOutputFile_slot_layer_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "NodeOutputFileSlotLayer");
+ RNA_def_property_ui_text(prop, "EXR Layer Slots", "");
+ rna_def_cmp_output_file_slots_api(brna, prop, "CompositorNodeOutputFileLayerSlots");
}
static void def_cmp_dilate_erode(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem mode_items[] = {
- {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""},
- {CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""},
- {CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {CMP_NODE_DILATEERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_range(prop, -5000, 5000);
- RNA_def_property_ui_range(prop, -100, 100, 0, -1);
- RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- /* CMP_NODE_DILATEERODE_DISTANCE_THRESH only */
- prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_range(prop, -100, 100);
- RNA_def_property_ui_text(prop, "Edge", "Edge to inset");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
-
- /* CMP_NODE_DILATEERODE_DISTANCE_FEATHER only */
- prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "falloff");
- RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
- RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mode_items[] = {
+ {CMP_NODE_DILATEERODE_STEP, "STEP", 0, "Step", ""},
+ {CMP_NODE_DILATEERODE_DISTANCE_THRESH, "THRESHOLD", 0, "Threshold", ""},
+ {CMP_NODE_DILATEERODE_DISTANCE, "DISTANCE", 0, "Distance", ""},
+ {CMP_NODE_DILATEERODE_DISTANCE_FEATHER, "FEATHER", 0, "Feather", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Growing/shrinking mode");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_range(prop, -5000, 5000);
+ RNA_def_property_ui_range(prop, -100, 100, 0, -1);
+ RNA_def_property_ui_text(prop, "Distance", "Distance to grow/shrink (number of iterations)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ /* CMP_NODE_DILATEERODE_DISTANCE_THRESH only */
+ prop = RNA_def_property(srna, "edge", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_range(prop, -100, 100);
+ RNA_def_property_ui_text(prop, "Edge", "Edge to inset");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeDilateErode", "storage");
+
+ /* CMP_NODE_DILATEERODE_DISTANCE_FEATHER only */
+ prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "falloff");
+ RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
+ RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_inpaint(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
-#if 0
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+# if 0
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of inpaint algorithm");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-#endif
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of inpaint algorithm");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+# endif
- prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_range(prop, 1, 10000);
- RNA_def_property_ui_text(prop, "Distance", "Distance to inpaint (number of iterations)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "distance", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_range(prop, 1, 10000);
+ RNA_def_property_ui_text(prop, "Distance", "Distance to inpaint (number of iterations)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_despeckle(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Threshold for detecting pixels to despeckle");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom4");
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "threshold_neighbor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom4");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Neighbor", "Threshold for the number of neighbor pixels that must match");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_scale(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem space_items[] = {
- {CMP_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
- {CMP_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
- {CMP_SCALE_SCENEPERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
- {CMP_SCALE_RENDERPERCENT, "RENDER_SIZE", 0, "Render Size", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* matching bgpic_camera_frame_items[] */
- static const EnumPropertyItem space_frame_items[] = {
- {0, "STRETCH", 0, "Stretch", ""},
- {CMP_SCALE_RENDERSIZE_FRAME_ASPECT, "FIT", 0, "Fit", ""},
- {CMP_SCALE_RENDERSIZE_FRAME_ASPECT | CMP_SCALE_RENDERSIZE_FRAME_CROP, "CROP", 0, "Crop", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, space_items);
- RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
-
- /* expose 2 flags as a enum of 3 items */
- prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, space_frame_items);
- RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally (factor of image size)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom4");
- RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically (factor of image size)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem space_items[] = {
+ {CMP_SCALE_RELATIVE, "RELATIVE", 0, "Relative", ""},
+ {CMP_SCALE_ABSOLUTE, "ABSOLUTE", 0, "Absolute", ""},
+ {CMP_SCALE_SCENEPERCENT, "SCENE_SIZE", 0, "Scene Size", ""},
+ {CMP_SCALE_RENDERPERCENT, "RENDER_SIZE", 0, "Render Size", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* matching bgpic_camera_frame_items[] */
+ static const EnumPropertyItem space_frame_items[] = {
+ {0, "STRETCH", 0, "Stretch", ""},
+ {CMP_SCALE_RENDERSIZE_FRAME_ASPECT, "FIT", 0, "Fit", ""},
+ {CMP_SCALE_RENDERSIZE_FRAME_ASPECT | CMP_SCALE_RENDERSIZE_FRAME_CROP, "CROP", 0, "Crop", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, space_items);
+ RNA_def_property_ui_text(prop, "Space", "Coordinate space to scale relative to");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_CompositorNodeScale_update");
+
+ /* expose 2 flags as a enum of 3 items */
+ prop = RNA_def_property(srna, "frame_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, space_frame_items);
+ RNA_def_property_ui_text(prop, "Frame Method", "How the image fits in the camera frame");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "offset_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_ui_text(prop, "X Offset", "Offset image horizontally (factor of image size)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "offset_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom4");
+ RNA_def_property_ui_text(prop, "Y Offset", "Offset image vertically (factor of image size)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_rotate(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_sampler_type_items);
- RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_sampler_type_items);
+ RNA_def_property_ui_text(prop, "Filter", "Method to use to filter rotation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_diff_matte(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
- prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t1_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t1_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t2_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_float_funcs(prop, NULL, "rna_difference_matte_t2_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Falloff", "Color distances below this additional threshold are partially keyed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_color_matte(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
- prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "color_hue", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "H", "Hue tolerance for colors to be considered a keying color");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "S", "Saturation Tolerance for the color");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "S", "Saturation Tolerance for the color");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t3");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "V", "Value Tolerance for the color");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "color_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t3");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "V", "Value Tolerance for the color");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_distance_matte(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem color_space_items[] = {
- {1, "RGB", 0, "RGB", "RGB color space"},
- {2, "YCC", 0, "YCC", "YCbCr Suppression"},
- {0, NULL, 0, NULL, NULL},
- };
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+ static const EnumPropertyItem color_space_items[] = {
+ {1, "RGB", 0, "RGB", "RGB color space"},
+ {2, "YCC", 0, "YCC", "YCbCr Suppression"},
+ {0, NULL, 0, NULL, NULL},
+ };
- prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "channel");
- RNA_def_property_enum_items(prop, color_space_items);
- RNA_def_property_ui_text(prop, "Channel", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+ prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "channel");
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_ui_text(prop, "Channel", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t1_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t1_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Tolerance", "Color distances below this threshold are keyed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t2_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Falloff", "Color distances below this additional threshold are partially keyed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_float_funcs(prop, NULL, "rna_distance_matte_t2_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Falloff", "Color distances below this additional threshold are partially keyed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_color_spill(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem channel_items[] = {
- {1, "R", 0, "R", "Red Spill Suppression"},
- {2, "G", 0, "G", "Green Spill Suppression"},
- {3, "B", 0, "B", "Blue Spill Suppression"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem limit_channel_items[] = {
- {0, "R", 0, "R", "Limit by Red"},
- {1, "G", 0, "G", "Limit by Green"},
- {2, "B", 0, "B", "Limit by Blue"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem algorithm_items[] = {
- {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"},
- {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, channel_items);
- RNA_def_property_ui_text(prop, "Channel", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, algorithm_items);
- RNA_def_property_ui_text(prop, "Algorithm", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
-
- prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "limchan");
- RNA_def_property_enum_items(prop, limit_channel_items);
- RNA_def_property_ui_text(prop, "Limit Channel", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "limscale");
- RNA_def_property_range(prop, 0.5f, 1.5f);
- RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0);
- RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "uspillr");
- RNA_def_property_range(prop, 0.0f, 1.5f);
- RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "uspillg");
- RNA_def_property_range(prop, 0.0f, 1.5f);
- RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "uspillb");
- RNA_def_property_range(prop, 0.0f, 1.5f);
- RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem channel_items[] = {
+ {1, "R", 0, "R", "Red Spill Suppression"},
+ {2, "G", 0, "G", "Green Spill Suppression"},
+ {3, "B", 0, "B", "Blue Spill Suppression"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem limit_channel_items[] = {
+ {0, "R", 0, "R", "Limit by Red"},
+ {1, "G", 0, "G", "Limit by Green"},
+ {2, "B", 0, "B", "Limit by Blue"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem algorithm_items[] = {
+ {0, "SIMPLE", 0, "Simple", "Simple Limit Algorithm"},
+ {1, "AVERAGE", 0, "Average", "Average Limit Algorithm"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, channel_items);
+ RNA_def_property_ui_text(prop, "Channel", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, algorithm_items);
+ RNA_def_property_ui_text(prop, "Algorithm", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeColorspill", "storage");
+
+ prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "limchan");
+ RNA_def_property_enum_items(prop, limit_channel_items);
+ RNA_def_property_ui_text(prop, "Limit Channel", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "limscale");
+ RNA_def_property_range(prop, 0.5f, 1.5f);
+ RNA_def_property_ui_text(prop, "Ratio", "Scale limit by value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_unspill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "unspill", 0);
+ RNA_def_property_ui_text(prop, "Unspill", "Compensate all channels (differently) by hand");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill_red", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "uspillr");
+ RNA_def_property_range(prop, 0.0f, 1.5f);
+ RNA_def_property_ui_text(prop, "R", "Red spillmap scale");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill_green", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "uspillg");
+ RNA_def_property_range(prop, 0.0f, 1.5f);
+ RNA_def_property_ui_text(prop, "G", "Green spillmap scale");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "unspill_blue", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "uspillb");
+ RNA_def_property_range(prop, 0.0f, 1.5f);
+ RNA_def_property_ui_text(prop, "B", "Blue spillmap scale");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_luma_matte(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
- prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
- RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
- RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
- RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
- RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_brightcontrast(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Convert Premul", "Keep output image premultiplied alpha");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_premultiply", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Convert Premul", "Keep output image premultiplied alpha");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_chroma_matte(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
-
- prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
- RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
- RNA_def_property_ui_text(prop, "Acceptance", "Tolerance for a color to be considered a keying color");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
- RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
- RNA_def_property_ui_text(prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fsize");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fstrength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Falloff", "Alpha falloff");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t3");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "tolerance", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
+ RNA_def_property_range(prop, DEG2RADF(1.0f), DEG2RADF(80.0f));
+ RNA_def_property_ui_text(
+ prop, "Acceptance", "Tolerance for a color to be considered a keying color");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(30.0f));
+ RNA_def_property_ui_text(
+ prop, "Cutoff", "Tolerance below which colors will be considered as exact matches");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fsize");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Lift", "Alpha lift");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fstrength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Falloff", "Alpha falloff");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "shadow_adjust", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t3");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Shadow Adjust", "Adjusts the brightness of any shadows captured");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_channel_matte(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem color_space_items[] = {
- {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB Color Space"},
- {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV Color Space"},
- {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"},
- {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr Color Space"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem algorithm_items[] = {
- {0, "SINGLE", 0, "Single", "Limit by single channel"},
- {1, "MAX", 0, "Max", "Limit by max of other channels "},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, color_space_items);
- RNA_def_property_ui_text(prop, "Color Space", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, prop_tri_channel_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
- RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
-
- prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "algorithm");
- RNA_def_property_enum_items(prop, algorithm_items);
- RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "channel");
- RNA_def_property_enum_items(prop, prop_tri_channel_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
- RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channel's value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t1");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
- RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
- RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "t2");
- RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
- RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
- RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem color_space_items[] = {
+ {CMP_NODE_CHANNEL_MATTE_CS_RGB, "RGB", 0, "RGB", "RGB Color Space"},
+ {CMP_NODE_CHANNEL_MATTE_CS_HSV, "HSV", 0, "HSV", "HSV Color Space"},
+ {CMP_NODE_CHANNEL_MATTE_CS_YUV, "YUV", 0, "YUV", "YUV Color Space"},
+ {CMP_NODE_CHANNEL_MATTE_CS_YCC, "YCC", 0, "YCbCr", "YCbCr Color Space"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem algorithm_items[] = {
+ {0, "SINGLE", 0, "Single", "Limit by single channel"},
+ {1, "MAX", 0, "Max", "Limit by max of other channels "},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "color_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, color_space_items);
+ RNA_def_property_ui_text(prop, "Color Space", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "matte_channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, prop_tri_channel_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
+ RNA_def_property_ui_text(prop, "Channel", "Channel used to determine matte");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeChroma", "storage");
+
+ prop = RNA_def_property(srna, "limit_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "algorithm");
+ RNA_def_property_enum_items(prop, algorithm_items);
+ RNA_def_property_ui_text(prop, "Algorithm", "Algorithm to use to limit channel");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "limit_channel", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "channel");
+ RNA_def_property_enum_items(prop, prop_tri_channel_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Node_channel_itemf");
+ RNA_def_property_ui_text(prop, "Limit Channel", "Limit by this channel's value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "limit_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t1");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t1_set", NULL);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "High", "Values higher than this setting are 100% opaque");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "limit_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "t2");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Matte_t2_set", NULL);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Low", "Values lower than this setting are 100% keyed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_flip(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_flip_items);
- RNA_def_property_ui_text(prop, "Axis", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_flip_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_splitviewer(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, rna_enum_axis_xy_items);
- RNA_def_property_ui_text(prop, "Axis", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xy_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Factor", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "factor", PROP_INT, PROP_FACTOR);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Factor", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_id_mask(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 0, 32767);
- RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_range(prop, 0, 32767);
+ RNA_def_property_ui_text(prop, "Index", "Pass index number to convert to alpha");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
- RNA_def_property_ui_text(prop, "Anti-Aliasing", "Apply an anti-aliasing filter to the mask");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 0);
+ RNA_def_property_ui_text(prop, "Anti-Aliasing", "Apply an anti-aliasing filter to the mask");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_double_edge_mask(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem BufEdgeMode_items[] = {
- {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
- {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem InnerEdgeMode_items[] = {
- {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
- {1, "ADJACENT_ONLY", 0, "Adjacent Only",
- "Only inner mask pixels adjacent to outer mask pixels are considered during mask calculation"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, InnerEdgeMode_items);
- RNA_def_property_ui_text(prop, "Inner Edge Mode", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom2");
- RNA_def_property_enum_items(prop, BufEdgeMode_items);
- RNA_def_property_ui_text(prop, "Buffer Edge Mode", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem BufEdgeMode_items[] = {
+ {0, "BLEED_OUT", 0, "Bleed Out", "Allow mask pixels to bleed along edges"},
+ {1, "KEEP_IN", 0, "Keep In", "Restrict mask pixels from touching edges"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem InnerEdgeMode_items[] = {
+ {0, "ALL", 0, "All", "All pixels on inner mask edge are considered during mask calculation"},
+ {1,
+ "ADJACENT_ONLY",
+ 0,
+ "Adjacent Only",
+ "Only inner mask pixels adjacent to outer mask pixels are considered during mask "
+ "calculation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "inner_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, InnerEdgeMode_items);
+ RNA_def_property_ui_text(prop, "Inner Edge Mode", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "edge_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom2");
+ RNA_def_property_enum_items(prop, BufEdgeMode_items);
+ RNA_def_property_ui_text(prop, "Buffer Edge Mode", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_map_uv(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Alpha", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "alpha", PROP_INT, PROP_FACTOR);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Alpha", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_defocus(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem bokeh_items[] = {
- {8, "OCTAGON", 0, "Octagonal", "8 sides"},
- {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
- {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
- {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
- {4, "SQUARE", 0, "Square", "4 sides"},
- {3, "TRIANGLE", 0, "Triangular", "3 sides"},
- {0, "CIRCLE", 0, "Circular", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
- RNA_def_property_struct_type(prop, "Scene");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Scene", "Scene from which to select the active camera (render scene if undefined)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
-
- prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bktype");
- RNA_def_property_enum_items(prop, bokeh_items);
- RNA_def_property_ui_text(prop, "Bokeh Type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
- RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
- RNA_def_property_ui_text(prop, "Gamma Correction", "Enable gamma correction before and after main process");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- /* TODO */
- prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fstop");
- RNA_def_property_range(prop, 0.0f, 128.0f);
- RNA_def_property_ui_text(prop, "F-stop",
- "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
- "the blur radius");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "maxblur");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bthresh");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Threshold",
- "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
- RNA_def_property_ui_text(prop, "Preview", "Enable low quality mode, useful for preview");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
- RNA_def_property_ui_text(prop, "Use Z-Buffer",
- "Disable when using an image as input instead of actual z-buffer "
- "(auto enabled if node not image based, eg. time node)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Z-Scale",
- "Scale the Z input when not using a z-buffer, controls maximum blur designated "
- "by the color white or input value 1");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem bokeh_items[] = {
+ {8, "OCTAGON", 0, "Octagonal", "8 sides"},
+ {7, "HEPTAGON", 0, "Heptagonal", "7 sides"},
+ {6, "HEXAGON", 0, "Hexagonal", "6 sides"},
+ {5, "PENTAGON", 0, "Pentagonal", "5 sides"},
+ {4, "SQUARE", 0, "Square", "4 sides"},
+ {3, "TRIANGLE", 0, "Triangular", "3 sides"},
+ {0, "CIRCLE", 0, "Circular", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_scene_set", NULL, NULL);
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(
+ prop, "Scene", "Scene from which to select the active camera (render scene if undefined)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeDefocus", "storage");
+
+ prop = RNA_def_property(srna, "bokeh", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bktype");
+ RNA_def_property_enum_items(prop, bokeh_items);
+ RNA_def_property_ui_text(prop, "Bokeh Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(90.0f));
+ RNA_def_property_ui_text(prop, "Angle", "Bokeh shape rotation offset");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_gamma_correction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gamco", 1);
+ RNA_def_property_ui_text(
+ prop, "Gamma Correction", "Enable gamma correction before and after main process");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ /* TODO */
+ prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fstop");
+ RNA_def_property_range(prop, 0.0f, 128.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "F-stop",
+ "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
+ "the blur radius");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxblur");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bthresh");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Threshold",
+ "CoC radius threshold, prevents background bleed on in-focus midground, 0=off");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "preview", 1);
+ RNA_def_property_ui_text(prop, "Preview", "Enable low quality mode, useful for preview");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "no_zbuf", 1);
+ RNA_def_property_ui_text(prop,
+ "Use Z-Buffer",
+ "Disable when using an image as input instead of actual z-buffer "
+ "(auto enabled if node not image based, eg. time node)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "z_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Z-Scale",
+ "Scale the Z input when not using a z-buffer, controls maximum blur designated "
+ "by the color white or input value 1");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_invert(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
- RNA_def_property_ui_text(prop, "RGB", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "invert_rgb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_RGB);
+ RNA_def_property_ui_text(prop, "RGB", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
- RNA_def_property_ui_text(prop, "Alpha", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_CHAN_A);
+ RNA_def_property_ui_text(prop, "Alpha", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_crop(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
- RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
-
- prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "x1");
- RNA_def_property_range(prop, 0, 10000);
- RNA_def_property_ui_text(prop, "X1", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "x2");
- RNA_def_property_range(prop, 0, 10000);
- RNA_def_property_ui_text(prop, "X2", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "y1");
- RNA_def_property_range(prop, 0, 10000);
- RNA_def_property_ui_text(prop, "Y1", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "y2");
- RNA_def_property_range(prop, 0, 10000);
- RNA_def_property_ui_text(prop, "Y2", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fac_x1");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "X1", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fac_x2");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "X2", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fac_y1");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Y1", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fac_y2");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Y2", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "use_crop_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_ui_text(prop, "Crop Image Size", "Whether to crop the size of the input image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", 1);
+ RNA_def_property_ui_text(prop, "Relative", "Use relative values to crop image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeTwoXYs", "storage");
+
+ prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "x1");
+ RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_ui_text(prop, "X1", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "x2");
+ RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_ui_text(prop, "X2", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "y1");
+ RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_ui_text(prop, "Y1", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "y2");
+ RNA_def_property_range(prop, 0, 10000);
+ RNA_def_property_ui_text(prop, "Y2", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_x1");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "X1", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_x2");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "X2", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_y1");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Y1", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rel_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fac_y2");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Y2", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_dblur(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "iter");
- RNA_def_property_range(prop, 1, 32);
- RNA_def_property_ui_text(prop, "Iterations", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
- RNA_def_property_ui_text(prop, "Wrap", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "center_x");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Center X", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "center_y");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Center Y", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "distance");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Distance", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
- RNA_def_property_ui_text(prop, "Angle", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "spin");
- RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
- RNA_def_property_ui_text(prop, "Spin", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zoom");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Zoom", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeDBlurData", "storage");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_text(prop, "Iterations", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "wrap", 1);
+ RNA_def_property_ui_text(prop, "Wrap", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "center_x");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Center X", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "center_y");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Center Y", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "distance");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Distance", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(360.0f));
+ RNA_def_property_ui_text(prop, "Angle", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "spin", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "spin");
+ RNA_def_property_range(prop, DEG2RADF(-360.0f), DEG2RADF(360.0f));
+ RNA_def_property_ui_text(prop, "Spin", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zoom");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Zoom", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_bilateral_blur(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeBilateralBlurData", "storage");
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "iter");
- RNA_def_property_range(prop, 1, 128);
- RNA_def_property_ui_text(prop, "Iterations", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_range(prop, 1, 128);
+ RNA_def_property_ui_text(prop, "Iterations", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sigma_color");
- RNA_def_property_range(prop, 0.01f, 3.0f);
- RNA_def_property_ui_text(prop, "Color Sigma", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "sigma_color", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sigma_color");
+ RNA_def_property_range(prop, 0.01f, 3.0f);
+ RNA_def_property_ui_text(prop, "Color Sigma", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sigma_space");
- RNA_def_property_range(prop, 0.01f, 30.0f);
- RNA_def_property_ui_text(prop, "Space Sigma", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "sigma_space", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sigma_space");
+ RNA_def_property_range(prop, 0.01f, 30.0f);
+ RNA_def_property_ui_text(prop, "Space Sigma", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_premul_key(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem type_items[] = {
- {0, "STRAIGHT_TO_PREMUL", 0, "Straight to Premul", ""},
- {1, "PREMUL_TO_STRAIGHT", 0, "Premul to Straight", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ static const EnumPropertyItem type_items[] = {
+ {0, "STRAIGHT_TO_PREMUL", 0, "Straight to Premul", ""},
+ {1, "PREMUL_TO_STRAIGHT", 0, "Premul to Straight", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(
+ prop, "Mapping", "Conversion between premultiplied alpha and key alpha");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_glare(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem type_items[] = {
- {3, "GHOSTS", 0, "Ghosts", ""},
- {2, "STREAKS", 0, "Streaks", ""},
- {1, "FOG_GLOW", 0, "Fog Glow", ""},
- {0, "SIMPLE_STAR", 0, "Simple Star", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem quality_items[] = {
- {0, "HIGH", 0, "High", ""},
- {1, "MEDIUM", 0, "Medium", ""},
- {2, "LOW", 0, "Low", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
-
- prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Glare Type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "quality");
- RNA_def_property_enum_items(prop, quality_items);
- RNA_def_property_ui_text(prop, "Quality",
- "If not set to high quality, the effect will be applied to a low-res copy "
- "of the source image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "iter");
- RNA_def_property_range(prop, 2, 5);
- RNA_def_property_ui_text(prop, "Iterations", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "colmod");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color Modulation",
- "Amount of Color Modulation, modulates colors of streaks and ghosts for "
- "a spectral dispersion effect");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mix");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Mix",
- "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "threshold");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Threshold",
- "The glare filter will only be applied to pixels brighter than this value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "streaks");
- RNA_def_property_range(prop, 1, 16);
- RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fade");
- RNA_def_property_range(prop, 0.75f, 1.0f);
- RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "star_45", 0);
- RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "size");
- RNA_def_property_range(prop, 6, 9);
- RNA_def_property_ui_text(prop, "Size",
- "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- /* TODO */
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem type_items[] = {
+ {3, "GHOSTS", 0, "Ghosts", ""},
+ {2, "STREAKS", 0, "Streaks", ""},
+ {1, "FOG_GLOW", 0, "Fog Glow", ""},
+ {0, "SIMPLE_STAR", 0, "Simple Star", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem quality_items[] = {
+ {0, "HIGH", 0, "High", ""},
+ {1, "MEDIUM", 0, "Medium", ""},
+ {2, "LOW", 0, "Low", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeGlare", "storage");
+
+ prop = RNA_def_property(srna, "glare_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Glare Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "quality", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "quality");
+ RNA_def_property_enum_items(prop, quality_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Quality",
+ "If not set to high quality, the effect will be applied to a low-res copy "
+ "of the source image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "iter");
+ RNA_def_property_range(prop, 2, 5);
+ RNA_def_property_ui_text(prop, "Iterations", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "color_modulation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "colmod");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Color Modulation",
+ "Amount of Color Modulation, modulates colors of streaks and ghosts for "
+ "a spectral dispersion effect");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "mix", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mix");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Mix", "-1 is original image only, 0 is exact 50/50 mix, 1 is processed image only");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "threshold");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Threshold",
+ "The glare filter will only be applied to pixels brighter than this value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "streaks", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "streaks");
+ RNA_def_property_range(prop, 1, 16);
+ RNA_def_property_ui_text(prop, "Streaks", "Total number of streaks");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "angle_offset", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle_ofs");
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_text(prop, "Angle Offset", "Streak angle offset");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "fade", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fade");
+ RNA_def_property_range(prop, 0.75f, 1.0f);
+ RNA_def_property_ui_text(prop, "Fade", "Streak fade-out factor");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_rotate_45", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "star_45", 0);
+ RNA_def_property_ui_text(prop, "Rotate 45", "Simple star filter: add 45 degree rotation offset");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "size");
+ RNA_def_property_range(prop, 6, 9);
+ RNA_def_property_ui_text(
+ prop,
+ "Size",
+ "Glow/glare size (not actual size; relative to initial size of bright area of pixels)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ /* TODO */
}
static void def_cmp_tonemap(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem type_items[] = {
- {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
- {0, "RH_SIMPLE", 0, "Rh Simple", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
-
- prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Tonemap Type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "key");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, 0.001f, 10.0f);
- RNA_def_property_ui_text(prop, "Offset",
- "Normally always 1, but can be used as an extra control to alter the brightness curve");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "gamma");
- RNA_def_property_range(prop, 0.001f, 3.0f);
- RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f");
- RNA_def_property_range(prop, -8.0f, 8.0f);
- RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "m");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "a");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "c");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem type_items[] = {
+ {1, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
+ {0, "RH_SIMPLE", 0, "Rh Simple", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_struct_sdna_from(srna, "NodeTonemap", "storage");
+
+ prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Tonemap Type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "key");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, 0.001f, 10.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Offset",
+ "Normally always 1, but can be used as an extra control to alter the brightness curve");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_range(prop, 0.001f, 3.0f);
+ RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f");
+ RNA_def_property_range(prop, -8.0f, 8.0f);
+ RNA_def_property_ui_text(
+ prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "m");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "a");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "c");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_lensdist(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeLensDist", "storage");
- prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
- RNA_def_property_ui_text(prop, "Projector",
- "Enable/disable projector mode (the effect is applied in horizontal direction only)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_projector", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proj", 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Projector",
+ "Enable/disable projector mode (the effect is applied in horizontal direction only)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
- RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering (faster, but also noisier)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_jitter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jit", 1);
+ RNA_def_property_ui_text(prop, "Jitter", "Enable/disable jittering (faster, but also noisier)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
- RNA_def_property_ui_text(prop, "Fit",
- "For positive distortion factor only: scale image such that black areas are not visible");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_fit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "fit", 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Fit",
+ "For positive distortion factor only: scale image such that black areas are not visible");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_colorbalance(StructRNA *srna)
{
- PropertyRNA *prop;
- static float default_1[3] = {1.f, 1.f, 1.f};
-
- static const EnumPropertyItem type_items[] = {
- {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
- {1, "OFFSET_POWER_SLOPE", 0, "Offset/Power/Slope (ASC-CDL)", "ASC-CDL standard color correction"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Correction Formula", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
-
- prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "lift");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Lift", "Correction for Shadows");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
-
- prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gamma");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Gamma", "Correction for Midtones");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
-
- prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gain");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Gain", "Correction for Highlights");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
-
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
- RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
-
- prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "power");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_range(prop, 0.f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Power", "Correction for Midtones");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
-
- prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "slope");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_range(prop, 0.f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
-
- prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
- RNA_def_property_ui_text(prop, "Basis", "Support negative color by using this as the RGB basis");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
+ PropertyRNA *prop;
+ static float default_1[3] = {1.f, 1.f, 1.f};
+
+ static const EnumPropertyItem type_items[] = {
+ {0, "LIFT_GAMMA_GAIN", 0, "Lift/Gamma/Gain", ""},
+ {1,
+ "OFFSET_POWER_SLOPE",
+ 0,
+ "Offset/Power/Slope (ASC-CDL)",
+ "ASC-CDL standard color correction"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "correction_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Correction Formula", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeColorBalance", "storage");
+
+ prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "lift");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Lift", "Correction for Shadows");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gamma");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Gamma", "Correction for Midtones");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
+
+ prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gain");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Gain", "Correction for Highlights");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_lgg");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Offset", "Correction for Shadows");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
+
+ prop = RNA_def_property(srna, "power", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "power");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_range(prop, 0.f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Power", "Correction for Midtones");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
+
+ prop = RNA_def_property(srna, "slope", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "slope");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_range(prop, 0.f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Slope", "Correction for Highlights");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
+
+ prop = RNA_def_property(srna, "offset_basis", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1.0, 1.0, 1.0, 2);
+ RNA_def_property_ui_text(prop, "Basis", "Support negative color by using this as the RGB basis");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeColorBalance_update_cdl");
}
static void def_cmp_huecorrect(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Mapping", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_zcombine(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
- RNA_def_property_ui_text(prop, "Use Alpha", "Take Alpha channel into account when doing the Z operation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
+ RNA_def_property_ui_text(
+ prop, "Use Alpha", "Take Alpha channel into account when doing the Z operation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 0);
- RNA_def_property_ui_text(prop, "Anti-Alias Z", "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for Blender renders");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_antialias_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", 0);
+ RNA_def_property_ui_text(
+ prop,
+ "Anti-Alias Z",
+ "Anti-alias the z-buffer to try to avoid artifacts, mostly useful for Blender renders");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_ycc(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_ycc_items);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_ycc_items);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_movieclip(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
+ RNA_def_struct_sdna_from(srna, "MovieClipUser", "storage");
}
static void def_cmp_stabilize2d(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_sampler_type_items);
- RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_sampler_type_items);
+ RNA_def_property_ui_text(prop, "Filter", "Method to use to filter stabilization");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom2", CMP_NODEFLAG_STABILIZE_INVERSE);
- RNA_def_property_ui_text(prop, "Invert", "Invert stabilization to re-introduce motion to the frame");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom2", CMP_NODEFLAG_STABILIZE_INVERSE);
+ RNA_def_property_ui_text(
+ prop, "Invert", "Invert stabilization to re-introduce motion to the frame");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_moviedistortion(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- static const EnumPropertyItem distortion_type_items[] = {
- {0, "UNDISTORT", 0, "Undistort", ""},
- {1, "DISTORT", 0, "Distort", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem distortion_type_items[] = {
+ {0, "UNDISTORT", 0, "Undistort", ""},
+ {1, "DISTORT", 0, "Distort", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, distortion_type_items);
- RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "distortion_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, distortion_type_items);
+ RNA_def_property_ui_text(prop, "Distortion", "Distortion to use to filter image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_mask(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem aspect_type_items[] = {
- {0, "SCENE", 0, "Scene Size", ""},
- {CMP_NODEFLAG_MASK_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
- {CMP_NODEFLAG_MASK_FIXED_SCENE, "FIXED_SCENE", 0, "Fixed/Scene", "Pixel size scaled by scene percentage"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Mask");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask", "");
-
- prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "custom1", CMP_NODEFLAG_MASK_NO_FEATHER);
- RNA_def_property_ui_text(prop, "Feather", "Use feather information from the mask");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_MASK_MOTION_BLUR);
- RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_range(prop, 1, CMP_NODE_MASK_MBLUR_SAMPLES_MAX);
- RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
-
- prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, aspect_type_items);
- RNA_def_property_ui_text(prop, "Size Source", "Where to get the mask size from for aspect/size information");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
-
- RNA_def_struct_sdna_from(srna, "NodeMask", "storage");
-
- prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "X", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Y", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem aspect_type_items[] = {
+ {0, "SCENE", 0, "Scene Size", ""},
+ {CMP_NODEFLAG_MASK_FIXED, "FIXED", 0, "Fixed", "Use pixel size for the buffer"},
+ {CMP_NODEFLAG_MASK_FIXED_SCENE,
+ "FIXED_SCENE",
+ 0,
+ "Fixed/Scene",
+ "Pixel size scaled by scene percentage"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Mask");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask", "");
+
+ prop = RNA_def_property(srna, "use_feather", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom1", CMP_NODEFLAG_MASK_NO_FEATHER);
+ RNA_def_property_ui_text(prop, "Feather", "Use feather information from the mask");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_MASK_MOTION_BLUR);
+ RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_range(prop, 1, CMP_NODE_MASK_MBLUR_SAMPLES_MAX);
+ RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "size_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, aspect_type_items);
+ RNA_def_property_ui_text(
+ prop, "Size Source", "Where to get the mask size from for aspect/size information");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeMask", "storage");
+
+ prop = RNA_def_property(srna, "size_x", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "X", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "size_y", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Y", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void dev_cmd_transform(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_sampler_type_items);
- RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_sampler_type_items);
+ RNA_def_property_ui_text(prop, "Filter", "Method to use to filter transform");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
/* -- Compositor Nodes ------------------------------------------------------ */
static const EnumPropertyItem node_masktype_items[] = {
- {0, "ADD", 0, "Add", ""},
- {1, "SUBTRACT", 0, "Subtract", ""},
- {2, "MULTIPLY", 0, "Multiply", ""},
- {3, "NOT", 0, "Not", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "ADD", 0, "Add", ""},
+ {1, "SUBTRACT", 0, "Subtract", ""},
+ {2, "MULTIPLY", 0, "Multiply", ""},
+ {3, "NOT", 0, "Not", ""},
+ {0, NULL, 0, NULL, NULL},
};
static void def_cmp_boxmask(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_masktype_items);
- RNA_def_property_ui_text(prop, "Mask type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeBoxMask", "storage");
-
- prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, -1.0f, 2.0f);
- RNA_def_property_ui_text(prop, "X", "X position of the middle of the box");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "y");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, -1.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the box");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "width");
- RNA_def_property_float_default(prop, 0.3f);
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Width", "Width of the box");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "height");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Height", "Height of the box");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
- RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the box");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_masktype_items);
+ RNA_def_property_ui_text(prop, "Mask type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeBoxMask", "storage");
+
+ prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, -1.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "X", "X position of the middle of the box");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "y");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, -1.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the box");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "width");
+ RNA_def_property_float_default(prop, 0.3f);
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Width", "Width of the box");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "height");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Height", "Height of the box");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
+ RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the box");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_ellipsemask(StructRNA *srna)
{
- PropertyRNA *prop;
- prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, node_masktype_items);
- RNA_def_property_ui_text(prop, "Mask type", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeEllipseMask", "storage");
-
- prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "x");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, -1.0f, 2.0f);
- RNA_def_property_ui_text(prop, "X", "X position of the middle of the ellipse");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "y");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, -1.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the ellipse");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "width");
- RNA_def_property_float_default(prop, 0.3f);
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Width", "Width of the ellipse");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "height");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Height", "Height of the ellipse");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
- RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the ellipse");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+ prop = RNA_def_property(srna, "mask_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, node_masktype_items);
+ RNA_def_property_ui_text(prop, "Mask type", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeEllipseMask", "storage");
+
+ prop = RNA_def_property(srna, "x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "x");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, -1.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "X", "X position of the middle of the ellipse");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "y");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, -1.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Y", "Y position of the middle of the ellipse");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "width");
+ RNA_def_property_float_default(prop, 0.3f);
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Width", "Width of the ellipse");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "height");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Height", "Height of the ellipse");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, DEG2RADF(-1800.0f), DEG2RADF(1800.0f));
+ RNA_def_property_ui_text(prop, "Rotation", "Rotation angle of the ellipse");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_bokehblur(StructRNA *srna)
{
- PropertyRNA *prop;
-
- /* duplicated in def_cmp_blur */
- prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
- RNA_def_property_ui_text(prop, "Variable Size",
- "Support variable blur per-pixel when using an image for size input");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_EXTEND_BOUNDS);
- RNA_def_property_ui_text(prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
-#if 0
- prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_range(prop, 0.0f, 128.0f);
- RNA_def_property_ui_text(prop, "F-stop",
- "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
- "the blur radius");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-#endif
-
- prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom4");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
+ PropertyRNA *prop;
+
+ /* duplicated in def_cmp_blur */
+ prop = RNA_def_property(srna, "use_variable_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_VARIABLE_SIZE);
+ RNA_def_property_ui_text(
+ prop, "Variable Size", "Support variable blur per-pixel when using an image for size input");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_extended_bounds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", CMP_NODEFLAG_BLUR_EXTEND_BOUNDS);
+ RNA_def_property_ui_text(
+ prop, "Extend Bounds", "Extend bounds of the input image to fully fit blurred image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+# if 0
+ prop = RNA_def_property(srna, "f_stop", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_range(prop, 0.0f, 128.0f);
+ RNA_def_property_ui_text(prop, "F-stop",
+ "Amount of focal blur, 128=infinity=perfect focus, half the value doubles "
+ "the blur radius");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+# endif
+
+ prop = RNA_def_property(srna, "blur_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom4");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Max Blur", "Blur limit, maximum CoC radius");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_bokehimage(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeBokehImage", "storage");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, DEG2RADF(-720.0f), DEG2RADF(720.0f));
- RNA_def_property_ui_text(prop, "Angle", "Angle of the bokeh");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "flaps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "flaps");
- RNA_def_property_int_default(prop, 5);
- RNA_def_property_range(prop, 3, 24);
- RNA_def_property_ui_text(prop, "Flaps", "Number of flaps");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "rounding", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rounding");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Rounding", "Level of rounding of the bokeh");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "catadioptric", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "catadioptric");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Catadioptric", "Level of catadioptric of the bokeh");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "lensshift");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Lens shift", "Shift of the lens components");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeBokehImage", "storage");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, DEG2RADF(-720.0f), DEG2RADF(720.0f));
+ RNA_def_property_ui_text(prop, "Angle", "Angle of the bokeh");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "flaps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "flaps");
+ RNA_def_property_int_default(prop, 5);
+ RNA_def_property_range(prop, 3, 24);
+ RNA_def_property_ui_text(prop, "Flaps", "Number of flaps");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "rounding", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rounding");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Rounding", "Level of rounding of the bokeh");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "catadioptric", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "catadioptric");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Catadioptric", "Level of catadioptric of the bokeh");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "shift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lensshift");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Lens shift", "Shift of the lens components");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_switch(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
- RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "check", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 0);
+ RNA_def_property_ui_text(prop, "Switch", "Off: first socket, On: second socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_switch_view(StructRNA *UNUSED(srna))
@@ -6561,2137 +6962,2295 @@ static void def_cmp_switch_view(StructRNA *UNUSED(srna))
static void def_cmp_colorcorrection(StructRNA *srna)
{
- PropertyRNA *prop;
- prop = RNA_def_property(srna, "red", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Red", "Red channel active");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "green", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 2);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Green", "Green channel active");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "blue", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "custom1", 4);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Blue", "Blue channel active");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeColorCorrection", "storage");
-
- prop = RNA_def_property(srna, "midtones_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "startmidtones");
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Midtones Start", "Start of midtones");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "midtones_end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "endmidtones");
- RNA_def_property_float_default(prop, 0.7f);
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Midtones End", "End of midtones");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "master_saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "master.saturation");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Master Saturation", "Master saturation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "master_contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "master.contrast");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Master Contrast", "Master contrast");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "master_gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "master.gamma");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Master Gamma", "Master gamma");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "master_gain", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "master.gain");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Master Gain", "Master gain");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "master_lift", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "master.lift");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_text(prop, "Master Lift", "Master lift");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
-//
- prop = RNA_def_property(srna, "shadows_saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shadows.saturation");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Shadows Saturation", "Shadows saturation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "shadows_contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shadows.contrast");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Shadows Contrast", "Shadows contrast");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "shadows_gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shadows.gamma");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Shadows Gamma", "Shadows gamma");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "shadows_gain", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shadows.gain");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Shadows Gain", "Shadows gain");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "shadows_lift", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "shadows.lift");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_text(prop, "Shadows Lift", "Shadows lift");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-//
- prop = RNA_def_property(srna, "midtones_saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "midtones.saturation");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Midtones Saturation", "Midtones saturation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "midtones_contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "midtones.contrast");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Midtones Contrast", "Midtones contrast");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "midtones_gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "midtones.gamma");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Midtones Gamma", "Midtones gamma");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "midtones_gain", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "midtones.gain");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Midtones Gain", "Midtones gain");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "midtones_lift", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "midtones.lift");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_text(prop, "Midtones Lift", "Midtones lift");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-//
- prop = RNA_def_property(srna, "highlights_saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "highlights.saturation");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Highlights Saturation", "Highlights saturation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "highlights_contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "highlights.contrast");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Highlights Contrast", "Highlights contrast");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "highlights_gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "highlights.gamma");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Highlights Gamma", "Highlights gamma");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "highlights_gain", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "highlights.gain");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0, 4);
- RNA_def_property_ui_text(prop, "Highlights Gain", "Highlights gain");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "highlights_lift", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "highlights.lift");
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, -1, 1);
- RNA_def_property_ui_text(prop, "Highlights Lift", "Highlights lift");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+ prop = RNA_def_property(srna, "red", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 1);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Red", "Red channel active");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "green", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 2);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Green", "Green channel active");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "blue", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "custom1", 4);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Blue", "Blue channel active");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeColorCorrection", "storage");
+
+ prop = RNA_def_property(srna, "midtones_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "startmidtones");
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Midtones Start", "Start of midtones");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "midtones_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "endmidtones");
+ RNA_def_property_float_default(prop, 0.7f);
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Midtones End", "End of midtones");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "master_saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "master.saturation");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Master Saturation", "Master saturation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "master_contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "master.contrast");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Master Contrast", "Master contrast");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "master_gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "master.gamma");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Master Gamma", "Master gamma");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "master_gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "master.gain");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Master Gain", "Master gain");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "master_lift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "master.lift");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_text(prop, "Master Lift", "Master lift");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ //
+ prop = RNA_def_property(srna, "shadows_saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shadows.saturation");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Shadows Saturation", "Shadows saturation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "shadows_contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shadows.contrast");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Shadows Contrast", "Shadows contrast");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "shadows_gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shadows.gamma");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Shadows Gamma", "Shadows gamma");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "shadows_gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shadows.gain");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Shadows Gain", "Shadows gain");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "shadows_lift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "shadows.lift");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_text(prop, "Shadows Lift", "Shadows lift");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ //
+ prop = RNA_def_property(srna, "midtones_saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "midtones.saturation");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Midtones Saturation", "Midtones saturation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "midtones_contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "midtones.contrast");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Midtones Contrast", "Midtones contrast");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "midtones_gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "midtones.gamma");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Midtones Gamma", "Midtones gamma");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "midtones_gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "midtones.gain");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Midtones Gain", "Midtones gain");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "midtones_lift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "midtones.lift");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_text(prop, "Midtones Lift", "Midtones lift");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ //
+ prop = RNA_def_property(srna, "highlights_saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "highlights.saturation");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Highlights Saturation", "Highlights saturation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "highlights_contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "highlights.contrast");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Highlights Contrast", "Highlights contrast");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "highlights_gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "highlights.gamma");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Highlights Gamma", "Highlights gamma");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "highlights_gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "highlights.gain");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0, 4);
+ RNA_def_property_ui_text(prop, "Highlights Gain", "Highlights gain");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "highlights_lift", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "highlights.lift");
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, -1, 1);
+ RNA_def_property_ui_text(prop, "Highlights Lift", "Highlights lift");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_viewer(StructRNA *srna)
{
- PropertyRNA *prop;
- static const EnumPropertyItem tileorder_items[] = {
- {0, "CENTEROUT", 0, "Center", "Expand from center"},
- {1, "RANDOM", 0, "Random", "Random tiles"},
- {2, "BOTTOMUP", 0, "Bottom up", "Expand from bottom"},
- {3, "RULE_OF_THIRDS", 0, "Rule of thirds", "Expand from 9 places"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "tile_order", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, tileorder_items);
- RNA_def_property_ui_text(prop, "Tile order", "Tile order");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "X", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom4");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Y", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", CMP_NODE_OUTPUT_IGNORE_ALPHA);
- RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+ static const EnumPropertyItem tileorder_items[] = {
+ {0, "CENTEROUT", 0, "Center", "Expand from center"},
+ {1, "RANDOM", 0, "Random", "Random tiles"},
+ {2, "BOTTOMUP", 0, "Bottom up", "Expand from bottom"},
+ {3, "RULE_OF_THIRDS", 0, "Rule of thirds", "Expand from 9 places"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "tile_order", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, tileorder_items);
+ RNA_def_property_ui_text(prop, "Tile order", "Tile order");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "center_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "X", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "center_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom4");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Y", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", CMP_NODE_OUTPUT_IGNORE_ALPHA);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Alpha",
+ "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_composite(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", CMP_NODE_OUTPUT_IGNORE_ALPHA);
- RNA_def_property_ui_text(prop, "Use Alpha", "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "custom2", CMP_NODE_OUTPUT_IGNORE_ALPHA);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Alpha",
+ "Colors are treated alpha premultiplied, or colors output straight (alpha gets set to 1)");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_keyingscreen(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodeKeyingScreenData", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeKeyingScreenData", "storage");
- prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "tracking_object");
- RNA_def_property_ui_text(prop, "Tracking Object", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "tracking_object");
+ RNA_def_property_ui_text(prop, "Tracking Object", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_keying(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
-
- prop = RNA_def_property(srna, "screen_balance", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "screen_balance");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Screen Balance", "Balance between two non-primary channels primary channel is comparing against");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "despill_factor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Despill Factor", "Factor of despilling screen color from image");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "despill_balance");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Despill Balance", "Balance between non-key colors used to detect amount of key color to be removed");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "clip_black");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Clip Black", "Value of non-scaled matte pixel which considers as fully background pixel");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "clip_white", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "clip_white");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Clip White", "Value of non-scaled matte pixel which considers as fully foreground pixel");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "blur_pre");
- RNA_def_property_range(prop, 0, 2048);
- RNA_def_property_ui_text(prop, "Pre Blur", "Chroma pre-blur size which applies before running keyer");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "blur_post", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "blur_post");
- RNA_def_property_range(prop, 0, 2048);
- RNA_def_property_ui_text(prop, "Post Blur", "Matte blur size which applies after clipping and dilate/eroding");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "dilate_distance", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "dilate_distance");
- RNA_def_property_range(prop, -100, 100);
- RNA_def_property_ui_text(prop, "Dilate/Erode", "Matte dilate/erode side");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "edge_kernel_radius");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Edge Kernel Radius", "Radius of kernel used to detect whether pixel belongs to edge");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "edge_kernel_tolerance", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "edge_kernel_tolerance");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Edge Kernel Tolerance", "Tolerance to pixels inside kernel which are treating as belonging to the same plane");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "feather_falloff");
- RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
- RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type the feather");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "feather_distance");
- RNA_def_property_range(prop, -100, 100);
- RNA_def_property_ui_text(prop, "Feather Distance", "Distance to grow/shrink the feather");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "NodeKeyingData", "storage");
+
+ prop = RNA_def_property(srna, "screen_balance", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "screen_balance");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Screen Balance",
+ "Balance between two non-primary channels primary channel is comparing against");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "despill_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "despill_factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Despill Factor", "Factor of despilling screen color from image");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "despill_balance", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "despill_balance");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Despill Balance",
+ "Balance between non-key colors used to detect amount of key color to be removed");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "clip_black", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "clip_black");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Clip Black",
+ "Value of non-scaled matte pixel which considers as fully background pixel");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "clip_white", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "clip_white");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Clip White",
+ "Value of non-scaled matte pixel which considers as fully foreground pixel");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "blur_pre", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "blur_pre");
+ RNA_def_property_range(prop, 0, 2048);
+ RNA_def_property_ui_text(
+ prop, "Pre Blur", "Chroma pre-blur size which applies before running keyer");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "blur_post", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "blur_post");
+ RNA_def_property_range(prop, 0, 2048);
+ RNA_def_property_ui_text(
+ prop, "Post Blur", "Matte blur size which applies after clipping and dilate/eroding");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "dilate_distance", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "dilate_distance");
+ RNA_def_property_range(prop, -100, 100);
+ RNA_def_property_ui_text(prop, "Dilate/Erode", "Matte dilate/erode side");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "edge_kernel_radius", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "edge_kernel_radius");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(
+ prop, "Edge Kernel Radius", "Radius of kernel used to detect whether pixel belongs to edge");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "edge_kernel_tolerance", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "edge_kernel_tolerance");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Edge Kernel Tolerance",
+ "Tolerance to pixels inside kernel which are treating as belonging to the same plane");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "feather_falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "feather_falloff");
+ RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_curve_only_items);
+ RNA_def_property_ui_text(prop, "Feather Falloff", "Falloff type the feather");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_CURVE); /* Abusing id_curve :/ */
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "feather_distance", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "feather_distance");
+ RNA_def_property_range(prop, -100, 100);
+ RNA_def_property_ui_text(prop, "Feather Distance", "Distance to grow/shrink the feather");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_trackpos(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem position_items[] = {
- {CMP_TRACKPOS_ABSOLUTE, "ABSOLUTE", 0,
- "Absolute", "Output absolute position of a marker"},
- {CMP_TRACKPOS_RELATIVE_START, "RELATIVE_START", 0,
- "Relative Start", "Output position of a marker relative to first marker of a track"},
- {CMP_TRACKPOS_RELATIVE_FRAME, "RELATIVE_FRAME", 0,
- "Relative Frame", "Output position of a marker relative to marker at given frame number"},
- {CMP_TRACKPOS_ABSOLUTE_FRAME, "ABSOLUTE_FRAME", 0,
- "Absolute Frame", "Output absolute position of a marker at given frame number"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "custom1");
- RNA_def_property_enum_items(prop, position_items);
- RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
-
- prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "tracking_object");
- RNA_def_property_ui_text(prop, "Tracking Object", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "track_name");
- RNA_def_property_ui_text(prop, "Track", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem position_items[] = {
+ {CMP_TRACKPOS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Output absolute position of a marker"},
+ {CMP_TRACKPOS_RELATIVE_START,
+ "RELATIVE_START",
+ 0,
+ "Relative Start",
+ "Output position of a marker relative to first marker of a track"},
+ {CMP_TRACKPOS_RELATIVE_FRAME,
+ "RELATIVE_FRAME",
+ 0,
+ "Relative Frame",
+ "Output position of a marker relative to marker at given frame number"},
+ {CMP_TRACKPOS_ABSOLUTE_FRAME,
+ "ABSOLUTE_FRAME",
+ 0,
+ "Absolute Frame",
+ "Output absolute position of a marker at given frame number"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "position", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "custom1");
+ RNA_def_property_enum_items(prop, position_items);
+ RNA_def_property_ui_text(prop, "Position", "Which marker position to use for output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "frame_relative", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_ui_text(prop, "Frame", "Frame to be used for relative position");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ RNA_def_struct_sdna_from(srna, "NodeTrackPosData", "storage");
+
+ prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "tracking_object");
+ RNA_def_property_ui_text(prop, "Tracking Object", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "track_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "track_name");
+ RNA_def_property_ui_text(prop, "Track", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_translate(StructRNA *srna)
{
- static const EnumPropertyItem translate_items[] = {
- {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"},
- {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
- {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
- {CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem translate_items[] = {
+ {CMP_NODE_WRAP_NONE, "NONE", 0, "None", "No wrapping on X and Y"},
+ {CMP_NODE_WRAP_X, "XAXIS", 0, "X Axis", "Wrap all pixels on the X axis"},
+ {CMP_NODE_WRAP_Y, "YAXIS", 0, "Y Axis", "Wrap all pixels on the Y axis"},
+ {CMP_NODE_WRAP_XY, "BOTH", 0, "Both Axes", "Wrap all pixels on both axes"},
+ {0, NULL, 0, NULL, NULL},
+ };
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeTranslateData", "storage");
- prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
- RNA_def_property_ui_text(prop, "Relative",
- "Use relative (fraction of input image size) values to define translation");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_relative", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "relative", 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Relative",
+ "Use relative (fraction of input image size) values to define translation");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "wrap_axis");
- RNA_def_property_enum_items(prop, translate_items);
- RNA_def_property_ui_text(prop, "Wrapping", "Wrap image on a specific axis");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "wrap_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wrap_axis");
+ RNA_def_property_enum_items(prop, translate_items);
+ RNA_def_property_ui_text(prop, "Wrapping", "Wrap image on a specific axis");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_planetrackdeform(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- RNA_def_struct_sdna_from(srna, "NodePlaneTrackDeformData", "storage");
+ RNA_def_struct_sdna_from(srna, "NodePlaneTrackDeformData", "storage");
- prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "tracking_object");
- RNA_def_property_ui_text(prop, "Tracking Object", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "tracking_object", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "tracking_object");
+ RNA_def_property_ui_text(prop, "Tracking Object", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "plane_track_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "plane_track_name");
- RNA_def_property_ui_text(prop, "Plane Track", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "plane_track_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "plane_track_name");
+ RNA_def_property_ui_text(prop, "Plane Track", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR);
- RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CMP_NODEFLAG_PLANETRACKDEFORM_MOTION_BLUR);
+ RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled motion blur of the mask");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, CMP_NODE_PLANETRACKDEFORM_MBLUR_SAMPLES_MAX);
- RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, CMP_NODE_PLANETRACKDEFORM_MBLUR_SAMPLES_MAX);
+ RNA_def_property_ui_text(prop, "Samples", "Number of motion blur samples");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0f);
- RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0f);
+ RNA_def_property_ui_text(prop, "Shutter", "Exposure for motion blur as a factor of FPS");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_sunbeams(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "NodeSunBeams", "storage");
+ RNA_def_struct_sdna_from(srna, "NodeSunBeams", "storage");
- prop = RNA_def_property(srna, "source", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "source");
- RNA_def_property_range(prop, -100.0f, 100.0f);
- RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Source", "Source point of rays as a factor of the image width & height");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "source", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "source");
+ RNA_def_property_range(prop, -100.0f, 100.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Source", "Source point of rays as a factor of the image width & height");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "ray_length");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Ray Length", "Length of rays as a factor of the image size");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "ray_length", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "ray_length");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 10, 3);
+ RNA_def_property_ui_text(prop, "Ray Length", "Length of rays as a factor of the image size");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_cmp_cryptomatte(StructRNA *srna)
{
- PropertyRNA *prop;
- static float default_1[3] = {1.f, 1.f, 1.f};
-
- RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
- prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_NodeCryptomatte_matte_get", "rna_NodeCryptomatte_matte_length",
- "rna_NodeCryptomatte_matte_set");
- RNA_def_property_ui_text(prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
-
- prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Add", "Add object or material to matte, by picking a color from the Pick output");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_add");
-
- prop = RNA_def_property(srna, "remove", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Remove", "Remove object or material from matte, by picking a color from the Pick output");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_remove");
+ PropertyRNA *prop;
+ static float default_1[3] = {1.f, 1.f, 1.f};
+
+ RNA_def_struct_sdna_from(srna, "NodeCryptomatte", "storage");
+ prop = RNA_def_property(srna, "matte_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_NodeCryptomatte_matte_get",
+ "rna_NodeCryptomatte_matte_length",
+ "rna_NodeCryptomatte_matte_set");
+ RNA_def_property_ui_text(
+ prop, "Matte Objects", "List of object and material crypto IDs to include in matte");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "add", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Add", "Add object or material to matte, by picking a color from the Pick output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_add");
+
+ prop = RNA_def_property(srna, "remove", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Remove",
+ "Remove object or material from matte, by picking a color from the Pick output");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeCryptomatte_update_remove");
}
/* -- Texture Nodes --------------------------------------------------------- */
static void def_tex_output(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
+ RNA_def_struct_sdna_from(srna, "TexNodeOutput", "storage");
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Output Name", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Output Name", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_tex_image(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "id");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "id");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "storage");
- RNA_def_property_struct_type(prop, "ImageUser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining the image duration, offset and related settings");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "storage");
+ RNA_def_property_struct_type(prop, "ImageUser");
+ RNA_def_property_ui_text(
+ prop, "Image User", "Parameters defining the image duration, offset and related settings");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
static void def_tex_bricks(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom3");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Offset Amount", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom3");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Offset Amount", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom1");
- RNA_def_property_range(prop, 2, 99);
- RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "offset_frequency", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom1");
+ RNA_def_property_range(prop, 2, 99);
+ RNA_def_property_ui_text(prop, "Offset Frequency", "Offset every N rows");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom4");
- RNA_def_property_range(prop, 0.0f, 99.0f);
- RNA_def_property_ui_text(prop, "Squash Amount", "");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "squash", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom4");
+ RNA_def_property_range(prop, 0.0f, 99.0f);
+ RNA_def_property_ui_text(prop, "Squash Amount", "");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
- prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "custom2");
- RNA_def_property_range(prop, 2, 99);
- RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+ prop = RNA_def_property(srna, "squash_frequency", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "custom2");
+ RNA_def_property_range(prop, 2, 99);
+ RNA_def_property_ui_text(prop, "Squash Frequency", "Squash every N rows");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
}
/* -------------------------------------------------------------------------- */
static void rna_def_shader_node(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal");
- RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
- RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_register_funcs(srna, "rna_ShaderNode_register", "rna_Node_unregister", NULL);
+ srna = RNA_def_struct(brna, "ShaderNode", "NodeInternal");
+ RNA_def_struct_ui_text(srna, "Shader Node", "Material shader node");
+ RNA_def_struct_sdna(srna, "bNode");
+ RNA_def_struct_register_funcs(srna, "rna_ShaderNode_register", "rna_Node_unregister", NULL);
}
static void rna_def_compositor_node(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
+ StructRNA *srna;
+ FunctionRNA *func;
- srna = RNA_def_struct(brna, "CompositorNode", "NodeInternal");
- RNA_def_struct_ui_text(srna, "Compositor Node", "");
- RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_register_funcs(srna, "rna_CompositorNode_register", "rna_Node_unregister", NULL);
+ srna = RNA_def_struct(brna, "CompositorNode", "NodeInternal");
+ RNA_def_struct_ui_text(srna, "Compositor Node", "");
+ RNA_def_struct_sdna(srna, "bNode");
+ RNA_def_struct_register_funcs(srna, "rna_CompositorNode_register", "rna_Node_unregister", NULL);
- /* compositor node need_exec flag */
- func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec");
- RNA_def_function_ui_description(func, "Tag the node for compositor update");
+ /* compositor node need_exec flag */
+ func = RNA_def_function(srna, "tag_need_exec", "rna_CompositorNode_tag_need_exec");
+ RNA_def_function_ui_description(func, "Tag the node for compositor update");
}
static void rna_def_texture_node(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "TextureNode", "NodeInternal");
- RNA_def_struct_ui_text(srna, "Texture Node", "");
- RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", NULL);
+ srna = RNA_def_struct(brna, "TextureNode", "NodeInternal");
+ RNA_def_struct_ui_text(srna, "Texture Node", "");
+ RNA_def_struct_sdna(srna, "bNode");
+ RNA_def_struct_register_funcs(srna, "rna_TextureNode_register", "rna_Node_unregister", NULL);
}
/* -------------------------------------------------------------------------- */
static void rna_def_node_socket(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- static float default_draw_color[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-
- srna = RNA_def_struct(brna, "NodeSocket", NULL);
- RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_refine_func(srna, "rna_NodeSocket_refine");
- RNA_def_struct_ui_icon(srna, ICON_PLUGIN);
- RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
- RNA_def_struct_register_funcs(srna, "rna_NodeSocket_register", "rna_NodeSocket_unregister", NULL);
- RNA_def_struct_idprops_func(srna, "rna_NodeSocket_idprops");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Socket name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "identifier");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
-
- prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
- RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_UNAVAIL);
- RNA_def_property_ui_text(prop, "Enabled", "Enable the socket");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "link_limit", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "limit");
- RNA_def_property_int_funcs(prop, NULL, "rna_NodeSocket_link_limit_set", NULL);
- RNA_def_property_range(prop, 1, 0xFFF);
- RNA_def_property_ui_text(prop, "Link Limit", "Max number of links allowed for this socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);
- RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDE_VALUE);
- RNA_def_property_ui_text(prop, "Hide Value", "Hide the socket input value");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "node", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, "rna_NodeSocket_node_get", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "Node");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Node", "Node owning this socket");
-
- /* NB: the type property is used by standard sockets.
- * Ideally should be defined only for the registered subclass,
- * but to use the existing DNA is added in the base type here.
- * Future socket types can ignore or override this if needed.
- */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, node_socket_type_items);
- RNA_def_property_enum_default(prop, SOCK_FLOAT);
- RNA_def_property_ui_text(prop, "Type", "Data type");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
-
- prop = RNA_def_property(srna, "draw_shape", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "draw_shape");
- RNA_def_property_enum_items(prop, rna_enum_node_socket_draw_shape_items);
- RNA_def_property_enum_default(prop, SOCK_DRAW_SHAPE_CIRCLE);
- RNA_def_property_ui_text(prop, "Shape", "Socket shape");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
-
- /* registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name", "");
-
- /* draw socket */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw socket");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "Node");
- RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
- // RNA_def_property_string_default(parm, "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_color", NULL);
- RNA_def_function_ui_description(func, "Color of the socket icon");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "Node");
- RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
+
+ srna = RNA_def_struct(brna, "NodeSocket", NULL);
+ RNA_def_struct_ui_text(srna, "Node Socket", "Input or output socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+ RNA_def_struct_refine_func(srna, "rna_NodeSocket_refine");
+ RNA_def_struct_ui_icon(srna, ICON_PLUGIN);
+ RNA_def_struct_path_func(srna, "rna_NodeSocket_path");
+ RNA_def_struct_register_funcs(
+ srna, "rna_NodeSocket_register", "rna_NodeSocket_unregister", NULL);
+ RNA_def_struct_idprops_func(srna, "rna_NodeSocket_idprops");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Socket name");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "identifier");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
+
+ prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDDEN);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_NodeSocket_hide_set");
+ RNA_def_property_ui_text(prop, "Hide", "Hide the socket");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_UNAVAIL);
+ RNA_def_property_ui_text(prop, "Enabled", "Enable the socket");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "link_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "limit");
+ RNA_def_property_int_funcs(prop, NULL, "rna_NodeSocket_link_limit_set", NULL);
+ RNA_def_property_range(prop, 1, 0xFFF);
+ RNA_def_property_ui_text(prop, "Link Limit", "Max number of links allowed for this socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "is_linked", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_IN_USE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Linked", "True if the socket is connected");
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SOCK_COLLAPSED);
+ RNA_def_property_ui_text(prop, "Expanded", "Socket links are expanded in the user interface");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "hide_value", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SOCK_HIDE_VALUE);
+ RNA_def_property_ui_text(prop, "Hide Value", "Hide the socket input value");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(prop, "rna_NodeSocket_node_get", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Node", "Node owning this socket");
+
+ /* NB: the type property is used by standard sockets.
+ * Ideally should be defined only for the registered subclass,
+ * but to use the existing DNA is added in the base type here.
+ * Future socket types can ignore or override this if needed.
+ */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, node_socket_type_items);
+ RNA_def_property_enum_default(prop, SOCK_FLOAT);
+ RNA_def_property_ui_text(prop, "Type", "Data type");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+
+ prop = RNA_def_property(srna, "draw_shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_shape");
+ RNA_def_property_enum_items(prop, rna_enum_node_socket_draw_shape_items);
+ RNA_def_property_enum_default(prop, SOCK_DRAW_SHAPE_CIRCLE);
+ RNA_def_property_ui_text(prop, "Shape", "Socket shape");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocket_update");
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "ID Name", "");
+
+ /* draw socket */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw socket");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "Node");
+ RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
+ // RNA_def_property_string_default(parm, "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_color", NULL);
+ RNA_def_function_ui_description(func, "Color of the socket icon");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "Node");
+ RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_float_array(
+ func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
+ RNA_def_function_output(func, parm);
}
static void rna_def_node_socket_interface(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- static float default_draw_color[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-
- srna = RNA_def_struct(brna, "NodeSocketInterface", NULL);
- RNA_def_struct_ui_text(srna, "Node Socket Template", "Parameters to define node sockets");
- /* XXX Using bNodeSocket DNA for templates is a compatibility hack.
- * This allows to keep the inputs/outputs lists in bNodeTree working for earlier versions
- * and at the same time use them for socket templates in groups.
- */
- RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_refine_func(srna, "rna_NodeSocketInterface_refine");
- RNA_def_struct_path_func(srna, "rna_NodeSocketInterface_path");
- RNA_def_struct_idprops_func(srna, "rna_NodeSocketInterface_idprops");
- RNA_def_struct_register_funcs(srna, "rna_NodeSocketInterface_register", "rna_NodeSocketInterface_unregister", NULL);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Socket name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "identifier");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
-
- prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
-
- /* registration */
- prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name", "");
-
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw template settings");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_color", NULL);
- RNA_def_function_ui_description(func, "Color of the socket icon");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
- RNA_def_function_output(func, parm);
-
- func = RNA_def_function(srna, "register_properties", NULL);
- RNA_def_function_ui_description(func, "Define RNA properties of a socket");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "data_rna_type", "Struct", "Data RNA Type", "RNA type for special socket properties");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "init_socket", NULL);
- RNA_def_function_ui_description(func, "Initialize a node socket instance");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "data_path", NULL, 0, "Data Path", "Path to specialized socket data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "from_socket", NULL);
- RNA_def_function_ui_description(func, "Setup template parameters from an existing socket");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-}
-
-static void rna_def_node_socket_float(BlenderRNA *brna, const char *idname, const char *interface_idname, PropertySubType subtype)
-{
- StructRNA *srna;
- PropertyRNA *prop;
- float value_default;
-
- /* choose sensible common default based on subtype */
- switch (subtype) {
- case PROP_FACTOR:
- value_default = 1.0f;
- break;
- case PROP_PERCENTAGE:
- value_default = 100.0f;
- break;
- default:
- value_default = 0.0f;
- break;
- }
-
- srna = RNA_def_struct(brna, idname, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Float Node Socket", "Floating point number socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
-
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
-
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
-
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "Float Node Socket Interface", "Floating point number socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
-
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_float_default(prop, value_default);
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
-}
-
-static void rna_def_node_socket_int(BlenderRNA *brna, const char *identifier, const char *interface_idname, PropertySubType subtype)
-{
- StructRNA *srna;
- PropertyRNA *prop;
- int value_default;
-
- /* choose sensible common default based on subtype */
- switch (subtype) {
- case PROP_FACTOR:
- value_default = 1;
- break;
- case PROP_PERCENTAGE:
- value_default = 100;
- break;
- default:
- value_default = 0;
- break;
- }
-
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Integer Node Socket", "Integer number socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
-
- prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
- RNA_def_property_int_sdna(prop, NULL, "value");
- RNA_def_property_int_default(prop, value_default);
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
-
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
-
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "Integer Node Socket Interface", "Integer number socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
-
- prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
- RNA_def_property_int_sdna(prop, NULL, "value");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- prop = RNA_def_property(srna, "min_value", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- prop = RNA_def_property(srna, "max_value", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "max");
- RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
-}
-
-static void rna_def_node_socket_bool(BlenderRNA *brna, const char *identifier, const char *interface_idname)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Boolean Node Socket", "Boolean value socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
-
- prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
-
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
-
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "Boolean Node Socket Interface", "Boolean value socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
+
+ srna = RNA_def_struct(brna, "NodeSocketInterface", NULL);
+ RNA_def_struct_ui_text(srna, "Node Socket Template", "Parameters to define node sockets");
+ /* XXX Using bNodeSocket DNA for templates is a compatibility hack.
+ * This allows to keep the inputs/outputs lists in bNodeTree working for earlier versions
+ * and at the same time use them for socket templates in groups.
+ */
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+ RNA_def_struct_refine_func(srna, "rna_NodeSocketInterface_refine");
+ RNA_def_struct_path_func(srna, "rna_NodeSocketInterface_path");
+ RNA_def_struct_idprops_func(srna, "rna_NodeSocketInterface_idprops");
+ RNA_def_struct_register_funcs(
+ srna, "rna_NodeSocketInterface_register", "rna_NodeSocketInterface_unregister", NULL);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Socket name");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "identifier");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Identifier", "Unique identifier for mapping sockets");
+
+ prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_NodeSocket_is_output_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Output", "True if the socket is an output, otherwise input");
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_socket_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "ID Name", "");
+
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw template settings");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_color", NULL);
+ RNA_def_function_ui_description(func, "Color of the socket icon");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_float_array(
+ func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
+ RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(srna, "register_properties", NULL);
+ RNA_def_function_ui_description(func, "Define RNA properties of a socket");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(
+ func, "data_rna_type", "Struct", "Data RNA Type", "RNA type for special socket properties");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "init_socket", NULL);
+ RNA_def_function_ui_description(func, "Initialize a node socket instance");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the socket to initialize");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Socket to initialize");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "data_path", NULL, 0, "Data Path", "Path to specialized socket data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "from_socket", NULL);
+ RNA_def_function_ui_description(func, "Setup template parameters from an existing socket");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "node", "Node", "Node", "Node of the original socket");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "Socket", "Original socket");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+}
+
+static void rna_def_node_socket_float(BlenderRNA *brna,
+ const char *idname,
+ const char *interface_idname,
+ PropertySubType subtype)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+ float value_default;
+
+ /* choose sensible common default based on subtype */
+ switch (subtype) {
+ case PROP_FACTOR:
+ value_default = 1.0f;
+ break;
+ case PROP_PERCENTAGE:
+ value_default = 100.0f;
+ break;
+ default:
+ value_default = 0.0f;
+ break;
+ }
+
+ srna = RNA_def_struct(brna, idname, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Float Node Socket", "Floating point number socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
+
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(
+ srna, "Float Node Socket Interface", "Floating point number socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueFloat", "default_value");
+
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_float_default(prop, value_default);
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_float_range");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+}
+
+static void rna_def_node_socket_int(BlenderRNA *brna,
+ const char *identifier,
+ const char *interface_idname,
+ PropertySubType subtype)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+ int value_default;
+
+ /* choose sensible common default based on subtype */
+ switch (subtype) {
+ case PROP_FACTOR:
+ value_default = 1;
+ break;
+ case PROP_PERCENTAGE:
+ value_default = 100;
+ break;
+ default:
+ value_default = 0;
+ break;
+ }
+
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Integer Node Socket", "Integer number socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
+
+ prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
+ RNA_def_property_int_sdna(prop, NULL, "value");
+ RNA_def_property_int_default(prop, value_default);
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(srna, "Integer Node Socket Interface", "Integer number socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueInt", "default_value");
+
+ prop = RNA_def_property(srna, "default_value", PROP_INT, subtype);
+ RNA_def_property_int_sdna(prop, NULL, "value");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_int_range");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ prop = RNA_def_property(srna, "min_value", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ prop = RNA_def_property(srna, "max_value", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+}
+
+static void rna_def_node_socket_bool(BlenderRNA *brna,
+ const char *identifier,
+ const char *interface_idname)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Boolean Node Socket", "Boolean value socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
+
+ prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(srna, "Boolean Node Socket Interface", "Boolean value socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueBoolean", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "default_value", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "value", 1);
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
}
-static void rna_def_node_socket_vector(BlenderRNA *brna, const char *identifier, const char *interface_idname, PropertySubType subtype)
+static void rna_def_node_socket_vector(BlenderRNA *brna,
+ const char *identifier,
+ const char *interface_idname,
+ PropertySubType subtype)
{
- StructRNA *srna;
- PropertyRNA *prop;
- const float *value_default;
+ StructRNA *srna;
+ PropertyRNA *prop;
+ const float *value_default;
- /* choose sensible common default based on subtype */
- switch (subtype) {
- case PROP_DIRECTION: {
- static const float default_direction[3] = {0.0f, 0.0f, 1.0f};
- value_default = default_direction;
- break;
- }
- default: {
- static const float default_vector[3] = {0.0f, 0.0f, 0.0f};
- value_default = default_vector;
- break;
- }
- }
+ /* choose sensible common default based on subtype */
+ switch (subtype) {
+ case PROP_DIRECTION: {
+ static const float default_direction[3] = {0.0f, 0.0f, 1.0f};
+ value_default = default_direction;
+ break;
+ }
+ default: {
+ static const float default_vector[3] = {0.0f, 0.0f, 0.0f};
+ value_default = default_vector;
+ break;
+ }
+ }
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Vector Node Socket", "3D vector socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Vector Node Socket", "3D vector socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_float_array_default(prop, value_default);
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_float_array_default(prop, value_default);
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "Vector Node Socket Interface", "3D vector socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(srna, "Vector Node Socket Interface", "3D vector socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueVector", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, subtype);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_NodeSocketStandard_vector_range");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
- prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "min_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum Value", "Minimum value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
- prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "max_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum Value", "Maximum value");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
}
-static void rna_def_node_socket_color(BlenderRNA *brna, const char *identifier, const char *interface_idname)
+static void rna_def_node_socket_color(BlenderRNA *brna,
+ const char *identifier,
+ const char *interface_idname)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Color Node Socket", "RGBA color socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Color Node Socket", "RGBA color socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "Color Node Socket Interface", "RGBA color socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(srna, "Color Node Socket Interface", "RGBA color socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueRGBA", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
}
-static void rna_def_node_socket_string(BlenderRNA *brna, const char *identifier, const char *interface_idname)
+static void rna_def_node_socket_string(BlenderRNA *brna,
+ const char *identifier,
+ const char *interface_idname)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "String Node Socket", "String socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "String Node Socket", "String socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "value");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketStandard_value_update");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "String Node Socket Interface", "String socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(srna, "String Node Socket Interface", "String socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
+ RNA_def_struct_sdna_from(srna, "bNodeSocketValueString", "default_value");
- prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "value");
- RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
+ prop = RNA_def_property(srna, "default_value", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Default Value", "Input value used for unconnected socket");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_NodeSocketInterface_update");
- RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
+ RNA_def_struct_sdna_from(srna, "bNodeSocket", NULL);
}
-static void rna_def_node_socket_shader(BlenderRNA *brna, const char *identifier, const char *interface_idname)
+static void rna_def_node_socket_shader(BlenderRNA *brna,
+ const char *identifier,
+ const char *interface_idname)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Shader Node Socket", "Shader socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Shader Node Socket", "Shader socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
- /* socket interface */
- srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
- RNA_def_struct_ui_text(srna, "Shader Node Socket Interface", "Shader socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ /* socket interface */
+ srna = RNA_def_struct(brna, interface_idname, "NodeSocketInterfaceStandard");
+ RNA_def_struct_ui_text(srna, "Shader Node Socket Interface", "Shader socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
}
static void rna_def_node_socket_virtual(BlenderRNA *brna, const char *identifier)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
- RNA_def_struct_ui_text(srna, "Virtual Node Socket", "Virtual socket of a node");
- RNA_def_struct_sdna(srna, "bNodeSocket");
+ srna = RNA_def_struct(brna, identifier, "NodeSocketStandard");
+ RNA_def_struct_ui_text(srna, "Virtual Node Socket", "Virtual socket of a node");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
}
static void rna_def_node_socket_standard_types(BlenderRNA *brna)
{
- /* XXX Workaround: Registered functions are not exposed in python by bpy,
- * it expects them to be registered from python and use the native implementation.
- * However, the standard socket types below are not registering these functions from python,
- * so in order to call them in py scripts we need to overload and replace them with plain C callbacks.
- * These types provide a usable basis for socket types defined in C.
- */
-
- StructRNA *srna;
- PropertyRNA *parm, *prop;
- FunctionRNA *func;
-
- static float default_draw_color[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-
- srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- /* draw socket */
- func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Draw socket");
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "Node");
- RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
- // RNA_def_property_string_default(parm, "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Color of the socket icon");
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "Node");
- RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
- RNA_def_function_output(func, parm);
-
-
- srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface");
- RNA_def_struct_sdna(srna, "bNodeSocket");
-
- /* for easier type comparison in python */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
- RNA_def_property_enum_items(prop, node_socket_type_items);
- RNA_def_property_enum_default(prop, SOCK_FLOAT);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "Data type");
-
- func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Draw template settings");
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Color of the socket icon");
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_float_array(func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
- RNA_def_function_output(func, parm);
-
-
- /* XXX These types should eventually be registered at runtime.
- * Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions
- * to get the idname strings from int type and subtype (see node_socket.c, register_standard_node_socket_types).
- */
-
- rna_def_node_socket_float(brna, "NodeSocketFloat", "NodeSocketInterfaceFloat", PROP_NONE);
- rna_def_node_socket_float(brna, "NodeSocketFloatUnsigned", "NodeSocketInterfaceFloatUnsigned", PROP_UNSIGNED);
- rna_def_node_socket_float(brna, "NodeSocketFloatPercentage", "NodeSocketInterfaceFloatPercentage", PROP_PERCENTAGE);
- rna_def_node_socket_float(brna, "NodeSocketFloatFactor", "NodeSocketInterfaceFloatFactor", PROP_FACTOR);
- rna_def_node_socket_float(brna, "NodeSocketFloatAngle", "NodeSocketInterfaceFloatAngle", PROP_ANGLE);
- rna_def_node_socket_float(brna, "NodeSocketFloatTime", "NodeSocketInterfaceFloatTime", PROP_TIME);
-
- rna_def_node_socket_int(brna, "NodeSocketInt", "NodeSocketInterfaceInt", PROP_NONE);
- rna_def_node_socket_int(brna, "NodeSocketIntUnsigned", "NodeSocketInterfaceIntUnsigned", PROP_UNSIGNED);
- rna_def_node_socket_int(brna, "NodeSocketIntPercentage", "NodeSocketInterfaceIntPercentage", PROP_PERCENTAGE);
- rna_def_node_socket_int(brna, "NodeSocketIntFactor", "NodeSocketInterfaceIntFactor", PROP_FACTOR);
-
- rna_def_node_socket_bool(brna, "NodeSocketBool", "NodeSocketInterfaceBool");
-
- rna_def_node_socket_vector(brna, "NodeSocketVector", "NodeSocketInterfaceVector", PROP_NONE);
- rna_def_node_socket_vector(brna, "NodeSocketVectorTranslation", "NodeSocketInterfaceVectorTranslation", PROP_TRANSLATION);
- rna_def_node_socket_vector(brna, "NodeSocketVectorDirection", "NodeSocketInterfaceVectorDirection", PROP_DIRECTION);
- rna_def_node_socket_vector(brna, "NodeSocketVectorVelocity", "NodeSocketInterfaceVectorVelocity", PROP_VELOCITY);
- rna_def_node_socket_vector(brna, "NodeSocketVectorAcceleration", "NodeSocketInterfaceVectorAcceleration", PROP_ACCELERATION);
- rna_def_node_socket_vector(brna, "NodeSocketVectorEuler", "NodeSocketInterfaceVectorEuler", PROP_EULER);
- rna_def_node_socket_vector(brna, "NodeSocketVectorXYZ", "NodeSocketInterfaceVectorXYZ", PROP_XYZ);
-
- rna_def_node_socket_color(brna, "NodeSocketColor", "NodeSocketInterfaceColor");
-
- rna_def_node_socket_string(brna, "NodeSocketString", "NodeSocketInterfaceString");
-
- rna_def_node_socket_shader(brna, "NodeSocketShader", "NodeSocketInterfaceShader");
-
- rna_def_node_socket_virtual(brna, "NodeSocketVirtual");
+ /* XXX Workaround: Registered functions are not exposed in python by bpy,
+ * it expects them to be registered from python and use the native implementation.
+ * However, the standard socket types below are not registering these functions from python,
+ * so in order to call them in py scripts we need to overload and replace them with plain C callbacks.
+ * These types provide a usable basis for socket types defined in C.
+ */
+
+ StructRNA *srna;
+ PropertyRNA *parm, *prop;
+ FunctionRNA *func;
+
+ static float default_draw_color[] = {0.0f, 0.0f, 0.0f, 1.0f};
+
+ srna = RNA_def_struct(brna, "NodeSocketStandard", "NodeSocket");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ /* draw socket */
+ func = RNA_def_function(srna, "draw", "rna_NodeSocketStandard_draw");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Draw socket");
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "Node");
+ RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_property(func, "text", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(parm, "Text", "Text label to draw alongside properties");
+ // RNA_def_property_string_default(parm, "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_color", "rna_NodeSocketStandard_draw_color");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Color of the socket icon");
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "Node");
+ RNA_def_property_ui_text(parm, "Node", "Node the socket belongs to");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_float_array(
+ func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
+ RNA_def_function_output(func, parm);
+
+ srna = RNA_def_struct(brna, "NodeSocketInterfaceStandard", "NodeSocketInterface");
+ RNA_def_struct_sdna(srna, "bNodeSocket");
+
+ /* for easier type comparison in python */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
+ RNA_def_property_enum_items(prop, node_socket_type_items);
+ RNA_def_property_enum_default(prop, SOCK_FLOAT);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Type", "Data type");
+
+ func = RNA_def_function(srna, "draw", "rna_NodeSocketInterfaceStandard_draw");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Draw template settings");
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_color", "rna_NodeSocketInterfaceStandard_draw_color");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Color of the socket icon");
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_float_array(
+ func, "color", 4, default_draw_color, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
+ RNA_def_function_output(func, parm);
+
+ /* XXX These types should eventually be registered at runtime.
+ * Then use the nodeStaticSocketType and nodeStaticSocketInterfaceType functions
+ * to get the idname strings from int type and subtype (see node_socket.c, register_standard_node_socket_types).
+ */
+
+ rna_def_node_socket_float(brna, "NodeSocketFloat", "NodeSocketInterfaceFloat", PROP_NONE);
+ rna_def_node_socket_float(
+ brna, "NodeSocketFloatUnsigned", "NodeSocketInterfaceFloatUnsigned", PROP_UNSIGNED);
+ rna_def_node_socket_float(
+ brna, "NodeSocketFloatPercentage", "NodeSocketInterfaceFloatPercentage", PROP_PERCENTAGE);
+ rna_def_node_socket_float(
+ brna, "NodeSocketFloatFactor", "NodeSocketInterfaceFloatFactor", PROP_FACTOR);
+ rna_def_node_socket_float(
+ brna, "NodeSocketFloatAngle", "NodeSocketInterfaceFloatAngle", PROP_ANGLE);
+ rna_def_node_socket_float(
+ brna, "NodeSocketFloatTime", "NodeSocketInterfaceFloatTime", PROP_TIME);
+
+ rna_def_node_socket_int(brna, "NodeSocketInt", "NodeSocketInterfaceInt", PROP_NONE);
+ rna_def_node_socket_int(
+ brna, "NodeSocketIntUnsigned", "NodeSocketInterfaceIntUnsigned", PROP_UNSIGNED);
+ rna_def_node_socket_int(
+ brna, "NodeSocketIntPercentage", "NodeSocketInterfaceIntPercentage", PROP_PERCENTAGE);
+ rna_def_node_socket_int(
+ brna, "NodeSocketIntFactor", "NodeSocketInterfaceIntFactor", PROP_FACTOR);
+
+ rna_def_node_socket_bool(brna, "NodeSocketBool", "NodeSocketInterfaceBool");
+
+ rna_def_node_socket_vector(brna, "NodeSocketVector", "NodeSocketInterfaceVector", PROP_NONE);
+ rna_def_node_socket_vector(brna,
+ "NodeSocketVectorTranslation",
+ "NodeSocketInterfaceVectorTranslation",
+ PROP_TRANSLATION);
+ rna_def_node_socket_vector(
+ brna, "NodeSocketVectorDirection", "NodeSocketInterfaceVectorDirection", PROP_DIRECTION);
+ rna_def_node_socket_vector(
+ brna, "NodeSocketVectorVelocity", "NodeSocketInterfaceVectorVelocity", PROP_VELOCITY);
+ rna_def_node_socket_vector(brna,
+ "NodeSocketVectorAcceleration",
+ "NodeSocketInterfaceVectorAcceleration",
+ PROP_ACCELERATION);
+ rna_def_node_socket_vector(
+ brna, "NodeSocketVectorEuler", "NodeSocketInterfaceVectorEuler", PROP_EULER);
+ rna_def_node_socket_vector(
+ brna, "NodeSocketVectorXYZ", "NodeSocketInterfaceVectorXYZ", PROP_XYZ);
+
+ rna_def_node_socket_color(brna, "NodeSocketColor", "NodeSocketInterfaceColor");
+
+ rna_def_node_socket_string(brna, "NodeSocketString", "NodeSocketInterfaceString");
+
+ rna_def_node_socket_shader(brna, "NodeSocketShader", "NodeSocketInterfaceShader");
+
+ rna_def_node_socket_virtual(brna, "NodeSocketVirtual");
}
static void rna_def_internal_node(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop, *parm;
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "NodeInternalSocketTemplate", NULL);
- RNA_def_struct_ui_text(srna, "Socket Template", "Type and default value of a node socket");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_NodeInternalSocketTemplate_name_get", "rna_NodeInternalSocketTemplate_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Name of the socket");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_NodeInternalSocketTemplate_identifier_get", "rna_NodeInternalSocketTemplate_identifier_length", NULL);
- RNA_def_property_ui_text(prop, "Identifier", "Identifier of the socket");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, "rna_NodeInternalSocketTemplate_type_get", NULL, NULL);
- RNA_def_property_enum_items(prop, node_socket_type_items);
- RNA_def_property_ui_text(prop, "Type", "Data type of the socket");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* XXX Workaround: Registered functions are not exposed in python by bpy,
- * it expects them to be registered from python and use the native implementation.
- * However, the standard node types are not registering these functions from python,
- * so in order to call them in py scripts we need to overload and replace them with plain C callbacks.
- * This type provides a usable basis for node types defined in C.
- */
-
- srna = RNA_def_struct(brna, "NodeInternal", "Node");
- RNA_def_struct_sdna(srna, "bNode");
-
- /* poll */
- func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll");
- RNA_def_function_ui_description(func, "If non-null output is returned, the node type can be added to the tree");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
- parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance");
- RNA_def_function_ui_description(func, "If non-null output is returned, the node can be added to the tree");
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
- parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* update */
- func = RNA_def_function(srna, "update", "rna_NodeInternal_update");
- RNA_def_function_ui_description(func, "Update on editor changes");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_ALLOW_WRITE);
-
- /* draw buttons */
- func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons");
- RNA_def_function_ui_description(func, "Draw node buttons");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* draw buttons extended */
- func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext");
- RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ StructRNA *srna;
+ PropertyRNA *prop, *parm;
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "NodeInternalSocketTemplate", NULL);
+ RNA_def_struct_ui_text(srna, "Socket Template", "Type and default value of a node socket");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_NodeInternalSocketTemplate_name_get",
+ "rna_NodeInternalSocketTemplate_name_length",
+ NULL);
+ RNA_def_property_ui_text(prop, "Name", "Name of the socket");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_NodeInternalSocketTemplate_identifier_get",
+ "rna_NodeInternalSocketTemplate_identifier_length",
+ NULL);
+ RNA_def_property_ui_text(prop, "Identifier", "Identifier of the socket");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop, "rna_NodeInternalSocketTemplate_type_get", NULL, NULL);
+ RNA_def_property_enum_items(prop, node_socket_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Data type of the socket");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* XXX Workaround: Registered functions are not exposed in python by bpy,
+ * it expects them to be registered from python and use the native implementation.
+ * However, the standard node types are not registering these functions from python,
+ * so in order to call them in py scripts we need to overload and replace them with plain C callbacks.
+ * This type provides a usable basis for node types defined in C.
+ */
+
+ srna = RNA_def_struct(brna, "NodeInternal", "Node");
+ RNA_def_struct_sdna(srna, "bNode");
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", "rna_NodeInternal_poll");
+ RNA_def_function_ui_description(
+ func, "If non-null output is returned, the node type can be added to the tree");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
+ parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "poll_instance", "rna_NodeInternal_poll_instance");
+ RNA_def_function_ui_description(
+ func, "If non-null output is returned, the node can be added to the tree");
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
+ parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* update */
+ func = RNA_def_function(srna, "update", "rna_NodeInternal_update");
+ RNA_def_function_ui_description(func, "Update on editor changes");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_ALLOW_WRITE);
+
+ /* draw buttons */
+ func = RNA_def_function(srna, "draw_buttons", "rna_NodeInternal_draw_buttons");
+ RNA_def_function_ui_description(func, "Draw node buttons");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* draw buttons extended */
+ func = RNA_def_function(srna, "draw_buttons_ext", "rna_NodeInternal_draw_buttons_ext");
+ RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
}
static void rna_def_node_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
- const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs");
- const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs");
- const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new");
- const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear");
- const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move");
-
- RNA_def_property_srna(cprop, structtype);
- srna = RNA_def_struct(brna, structtype, NULL);
- RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets");
-
- func = RNA_def_function(srna, "new", newfunc);
- RNA_def_function_ui_description(func, "Add a socket to this node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "identifier", NULL, MAX_NAME, "Identifier", "Unique socket identifier");
- /* return value */
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
- RNA_def_function_ui_description(func, "Remove a socket from this node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "clear", clearfunc);
- RNA_def_function_ui_description(func, "Remove all sockets from this node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
-
- func = RNA_def_function(srna, "move", movefunc);
- RNA_def_function_ui_description(func, "Move a socket to another position");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+ const char *structtype = (in_out == SOCK_IN ? "NodeInputs" : "NodeOutputs");
+ const char *uiname = (in_out == SOCK_IN ? "Node Inputs" : "Node Outputs");
+ const char *newfunc = (in_out == SOCK_IN ? "rna_Node_inputs_new" : "rna_Node_outputs_new");
+ const char *clearfunc = (in_out == SOCK_IN ? "rna_Node_inputs_clear" : "rna_Node_outputs_clear");
+ const char *movefunc = (in_out == SOCK_IN ? "rna_Node_inputs_move" : "rna_Node_outputs_move");
+
+ RNA_def_property_srna(cprop, structtype);
+ srna = RNA_def_struct(brna, structtype, NULL);
+ RNA_def_struct_sdna(srna, "bNode");
+ RNA_def_struct_ui_text(srna, uiname, "Collection of Node Sockets");
+
+ func = RNA_def_function(srna, "new", newfunc);
+ RNA_def_function_ui_description(func, "Add a socket to this node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(func, "identifier", NULL, MAX_NAME, "Identifier", "Unique socket identifier");
+ /* return value */
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "New socket");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Node_socket_remove");
+ RNA_def_function_ui_description(func, "Remove a socket from this node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "The socket to remove");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "clear", clearfunc);
+ RNA_def_function_ui_description(func, "Remove all sockets from this node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+
+ func = RNA_def_function(srna, "move", movefunc);
+ RNA_def_function_ui_description(func, "Move a socket to another position");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ parm = RNA_def_int(
+ func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_node(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem dummy_static_type_items[] = {
- {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Node", NULL);
- RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
- RNA_def_struct_sdna(srna, "bNode");
- RNA_def_struct_ui_icon(srna, ICON_NODE);
- RNA_def_struct_refine_func(srna, "rna_Node_refine");
- RNA_def_struct_path_func(srna, "rna_Node_path");
- RNA_def_struct_register_funcs(srna, "rna_Node_register", "rna_Node_unregister", NULL);
- RNA_def_struct_idprops_func(srna, "rna_Node_idprops");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, dummy_static_type_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
- RNA_def_property_enum_default(prop, NODE_CUSTOM);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "Node type (deprecated, use bl_static_type or bl_idname for the actual identifier string)");
-
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "locx");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, -100000.0f, 100000.0f);
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
-
- prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "width");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
- RNA_def_property_ui_text(prop, "Width", "Width of the node");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "width_hidden", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "miniwidth");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
- RNA_def_property_ui_text(prop, "Width Hidden", "Width of the node in hidden state");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "height");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_height_range");
- RNA_def_property_ui_text(prop, "Height", "Height of the node");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_Node_dimensions_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the node");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
-
- prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "label");
- RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
- RNA_def_property_struct_type(prop, "NodeSocket");
- RNA_def_property_ui_text(prop, "Inputs", "");
- rna_def_node_sockets_api(brna, prop, SOCK_IN);
-
- prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
- RNA_def_property_struct_type(prop, "NodeSocket");
- RNA_def_property_ui_text(prop, "Outputs", "");
- rna_def_node_sockets_api(brna, prop, SOCK_OUT);
-
- prop = RNA_def_property(srna, "internal_links", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "internal_links", NULL);
- RNA_def_property_struct_type(prop, "NodeLink");
- RNA_def_property_ui_text(prop, "Internal Links", "Internal input-to-output connections for muting");
-
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "parent");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_parent_set", NULL, "rna_Node_parent_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Node");
- RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to");
-
- prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_CUSTOM_COLOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the node");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Node_select_set");
- RNA_def_property_ui_text(prop, "Select", "Node selection state");
- RNA_def_property_update(prop, NC_NODE | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_OPTIONS);
- RNA_def_property_ui_text(prop, "Show Options", "");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_PREVIEW);
- RNA_def_property_ui_text(prop, "Show Preview", "");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_HIDDEN);
- RNA_def_property_ui_text(prop, "Hide", "");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_MUTED);
- RNA_def_property_ui_text(prop, "Mute", "");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_ACTIVE_TEXTURE);
- RNA_def_property_ui_text(prop, "Show Texture", "Draw node in viewport textured draw mode");
- RNA_def_property_update(prop, 0, "rna_Node_update");
-
- /* generic property update function */
- func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
- RNA_def_function_ui_description(func, "Update after property changes");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
- RNA_def_function_ui_description(func, "True if a registered node type");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
- parm = RNA_def_boolean(func, "result", false, "Result", "");
- RNA_def_function_return(func, parm);
-
- /* registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name", "");
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Label", "The node label");
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
- RNA_def_property_enum_items(prop, rna_enum_icon_items);
- RNA_def_property_enum_default(prop, ICON_NODE);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Icon", "The node icon");
-
- prop = RNA_def_property(srna, "bl_static_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
- RNA_def_property_enum_items(prop, dummy_static_type_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
- RNA_def_property_enum_default(prop, NODE_CUSTOM);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Static Type", "Node type (deprecated, use with care)");
-
- /* type-based size properties */
- prop = RNA_def_property(srna, "bl_width_default", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "typeinfo->width");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_width_min", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "typeinfo->minwidth");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_width_max", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "typeinfo->maxwidth");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_height_default", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "typeinfo->height");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_height_min", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_height_max", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "If non-null output is returned, the node type can be added to the tree");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
- parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "poll_instance", NULL);
- RNA_def_function_ui_description(func, "If non-null output is returned, the node can be added to the tree");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
- parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* update */
- func = RNA_def_function(srna, "update", NULL);
- RNA_def_function_ui_description(func, "Update on editor changes");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
-
- /* insert_link */
- func = RNA_def_function(srna, "insert_link", NULL);
- RNA_def_function_ui_description(func, "Handle creation of a link to or from the node");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* init */
- func = RNA_def_function(srna, "init", NULL);
- RNA_def_function_ui_description(func, "Initialize a new instance of this node");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* copy */
- func = RNA_def_function(srna, "copy", NULL);
- RNA_def_function_ui_description(func, "Initialize a new instance of this node from an existing node");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* free */
- func = RNA_def_function(srna, "free", NULL);
- RNA_def_function_ui_description(func, "Clean up node on removal");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
-
- /* draw buttons */
- func = RNA_def_function(srna, "draw_buttons", NULL);
- RNA_def_function_ui_description(func, "Draw node buttons");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* draw buttons extended */
- func = RNA_def_function(srna, "draw_buttons_ext", NULL);
- RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "UILayout");
- RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* dynamic label */
- func = RNA_def_function(srna, "draw_label", NULL);
- RNA_def_function_ui_description(func, "Returns a dynamic label string");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_string(func, "label", NULL, MAX_NAME, "Label", "");
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem dummy_static_type_items[] = {
+ {NODE_CUSTOM, "CUSTOM", 0, "Custom", "Custom Node"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Node", NULL);
+ RNA_def_struct_ui_text(srna, "Node", "Node in a node tree");
+ RNA_def_struct_sdna(srna, "bNode");
+ RNA_def_struct_ui_icon(srna, ICON_NODE);
+ RNA_def_struct_refine_func(srna, "rna_Node_refine");
+ RNA_def_struct_path_func(srna, "rna_Node_path");
+ RNA_def_struct_register_funcs(srna, "rna_Node_register", "rna_Node_unregister", NULL);
+ RNA_def_struct_idprops_func(srna, "rna_Node_idprops");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, dummy_static_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
+ RNA_def_property_enum_default(prop, NODE_CUSTOM);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Type",
+ "Node type (deprecated, use bl_static_type or bl_idname for the actual identifier string)");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "locx");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_update(prop, NC_NODE, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "width", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "width");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
+ RNA_def_property_ui_text(prop, "Width", "Width of the node");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "width_hidden", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "miniwidth");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_width_range");
+ RNA_def_property_ui_text(prop, "Width Hidden", "Width of the node in hidden state");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "height");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_Node_height_range");
+ RNA_def_property_ui_text(prop, "Height", "Height of the node");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(prop, "rna_Node_dimensions_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Dimensions", "Absolute bounding box dimensions of the node");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique node identifier");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Node_name_set");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "label");
+ RNA_def_property_ui_text(prop, "Label", "Optional custom node label");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
+ RNA_def_property_struct_type(prop, "NodeSocket");
+ RNA_def_property_ui_text(prop, "Inputs", "");
+ rna_def_node_sockets_api(brna, prop, SOCK_IN);
+
+ prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
+ RNA_def_property_struct_type(prop, "NodeSocket");
+ RNA_def_property_ui_text(prop, "Outputs", "");
+ rna_def_node_sockets_api(brna, prop, SOCK_OUT);
+
+ prop = RNA_def_property(srna, "internal_links", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "internal_links", NULL);
+ RNA_def_property_struct_type(prop, "NodeLink");
+ RNA_def_property_ui_text(
+ prop, "Internal Links", "Internal input-to-output connections for muting");
+
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "parent");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Node_parent_set", NULL, "rna_Node_parent_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_ui_text(prop, "Parent", "Parent this node is attached to");
+
+ prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_CUSTOM_COLOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Custom Color", "Use custom color for the node");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Color", "Custom color of the node body");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Node_select_set");
+ RNA_def_property_ui_text(prop, "Select", "Node selection state");
+ RNA_def_property_update(prop, NC_NODE | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "show_options", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_OPTIONS);
+ RNA_def_property_ui_text(prop, "Show Options", "");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "show_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_PREVIEW);
+ RNA_def_property_ui_text(prop, "Show Preview", "");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_HIDDEN);
+ RNA_def_property_ui_text(prop, "Hide", "");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_MUTED);
+ RNA_def_property_ui_text(prop, "Mute", "");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ prop = RNA_def_property(srna, "show_texture", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_ACTIVE_TEXTURE);
+ RNA_def_property_ui_text(prop, "Show Texture", "Draw node in viewport textured draw mode");
+ RNA_def_property_update(prop, 0, "rna_Node_update");
+
+ /* generic property update function */
+ func = RNA_def_function(srna, "socket_value_update", "rna_Node_socket_value_update");
+ RNA_def_function_ui_description(func, "Update after property changes");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
+ RNA_def_function_ui_description(func, "True if a registered node type");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
+ parm = RNA_def_boolean(func, "result", false, "Result", "");
+ RNA_def_function_return(func, parm);
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "ID Name", "");
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "Label", "The node label");
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
+ RNA_def_property_enum_items(prop, rna_enum_icon_items);
+ RNA_def_property_enum_default(prop, ICON_NODE);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_ui_text(prop, "Icon", "The node icon");
+
+ prop = RNA_def_property(srna, "bl_static_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typeinfo->type");
+ RNA_def_property_enum_items(prop, dummy_static_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_node_static_type_itemf");
+ RNA_def_property_enum_default(prop, NODE_CUSTOM);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_ui_text(prop, "Static Type", "Node type (deprecated, use with care)");
+
+ /* type-based size properties */
+ prop = RNA_def_property(srna, "bl_width_default", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "typeinfo->width");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_width_min", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "typeinfo->minwidth");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_width_max", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "typeinfo->maxwidth");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_height_default", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "typeinfo->height");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_height_min", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_height_max", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "typeinfo->minheight");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(
+ func, "If non-null output is returned, the node type can be added to the tree");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
+ parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "poll_instance", NULL);
+ RNA_def_function_ui_description(
+ func, "If non-null output is returned, the node can be added to the tree");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
+ parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* update */
+ func = RNA_def_function(srna, "update", NULL);
+ RNA_def_function_ui_description(func, "Update on editor changes");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+
+ /* insert_link */
+ func = RNA_def_function(srna, "insert_link", NULL);
+ RNA_def_function_ui_description(func, "Handle creation of a link to or from the node");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "link", "NodeLink", "Link", "Node link that will be inserted");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* init */
+ func = RNA_def_function(srna, "init", NULL);
+ RNA_def_function_ui_description(func, "Initialize a new instance of this node");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* copy */
+ func = RNA_def_function(srna, "copy", NULL);
+ RNA_def_function_ui_description(func,
+ "Initialize a new instance of this node from an existing node");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "node", "Node", "Node", "Existing node to copy");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* free */
+ func = RNA_def_function(srna, "free", NULL);
+ RNA_def_function_ui_description(func, "Clean up node on removal");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+
+ /* draw buttons */
+ func = RNA_def_function(srna, "draw_buttons", NULL);
+ RNA_def_function_ui_description(func, "Draw node buttons");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* draw buttons extended */
+ func = RNA_def_function(srna, "draw_buttons_ext", NULL);
+ RNA_def_function_ui_description(func, "Draw node buttons in the sidebar");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "UILayout");
+ RNA_def_property_ui_text(parm, "Layout", "Layout in the UI");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* dynamic label */
+ func = RNA_def_function(srna, "draw_label", NULL);
+ RNA_def_function_ui_description(func, "Returns a dynamic label string");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_string(func, "label", NULL, MAX_NAME, "Label", "");
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
+ RNA_def_function_output(func, parm);
}
static void rna_def_node_link(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "NodeLink", NULL);
- RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
- RNA_def_struct_sdna(srna, "bNodeLink");
- RNA_def_struct_ui_icon(srna, ICON_NODE);
-
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_LINK_VALID);
- RNA_def_struct_ui_text(srna, "Valid", "Link is valid");
- RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "fromnode");
- RNA_def_property_struct_type(prop, "Node");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "From node", "");
-
- prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tonode");
- RNA_def_property_struct_type(prop, "Node");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "To node", "");
-
- prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "fromsock");
- RNA_def_property_struct_type(prop, "NodeSocket");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "From socket", "");
-
- prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tosock");
- RNA_def_property_struct_type(prop, "NodeSocket");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "To socket", "");
-
- prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "NodeLink", NULL);
+ RNA_def_struct_ui_text(srna, "NodeLink", "Link between nodes in a node tree");
+ RNA_def_struct_sdna(srna, "bNodeLink");
+ RNA_def_struct_ui_icon(srna, ICON_NODE);
+
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NODE_LINK_VALID);
+ RNA_def_struct_ui_text(srna, "Valid", "Link is valid");
+ RNA_def_property_update(prop, NC_NODE | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "from_node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "fromnode");
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "From node", "");
+
+ prop = RNA_def_property(srna, "to_node", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tonode");
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "To node", "");
+
+ prop = RNA_def_property(srna, "from_socket", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "fromsock");
+ RNA_def_property_struct_type(prop, "NodeSocket");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "From socket", "");
+
+ prop = RNA_def_property(srna, "to_socket", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tosock");
+ RNA_def_property_struct_type(prop, "NodeSocket");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "To socket", "");
+
+ prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_NodeLink_is_hidden_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Is Hidden", "Link is hidden due to invisible sockets");
}
static void rna_def_nodetree_nodes_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm, *prop;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "Nodes");
- srna = RNA_def_struct(brna, "Nodes", NULL);
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_text(srna, "Nodes", "Collection of Nodes");
-
- func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
- RNA_def_function_ui_description(func, "Add a node to this node tree");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- /* XXX warning note should eventually be removed,
- * added this here to avoid frequent confusion with API changes from "type" to "bl_idname"
- */
- parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return value */
- parm = RNA_def_pointer(func, "node", "Node", "", "New node");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
- RNA_def_function_ui_description(func, "Remove a node from this node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
- RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Node");
- RNA_def_property_pointer_funcs(prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
- RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
+ StructRNA *srna;
+ PropertyRNA *parm, *prop;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "Nodes");
+ srna = RNA_def_struct(brna, "Nodes", NULL);
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_text(srna, "Nodes", "Collection of Nodes");
+
+ func = RNA_def_function(srna, "new", "rna_NodeTree_node_new");
+ RNA_def_function_ui_description(func, "Add a node to this node tree");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ /* XXX warning note should eventually be removed,
+ * added this here to avoid frequent confusion with API changes from "type" to "bl_idname"
+ */
+ parm = RNA_def_string(
+ func,
+ "type",
+ NULL,
+ MAX_NAME,
+ "Type",
+ "Type of node to add (Warning: should be same as node.bl_idname, not node.type!)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return value */
+ parm = RNA_def_pointer(func, "node", "Node", "", "New node");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_NodeTree_node_remove");
+ RNA_def_function_ui_description(func, "Remove a node from this node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "node", "Node", "", "The node to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_NodeTree_node_clear");
+ RNA_def_function_ui_description(func, "Remove all nodes from this node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_NodeTree_active_node_get", "rna_NodeTree_active_node_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Node", "Active node in this tree");
+ RNA_def_property_update(prop, NC_SCENE | ND_OB_ACTIVE, NULL);
}
static void rna_def_nodetree_link_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "NodeLinks");
- srna = RNA_def_struct(brna, "NodeLinks", NULL);
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
-
- func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
- RNA_def_function_ui_description(func, "Add a node link to this node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_boolean(func, "verify_limits", true, "Verify Limits", "Remove existing links if connection limit is exceeded");
- /* return */
- parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
- RNA_def_function_ui_description(func, "remove a node link from the node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
- RNA_def_function_ui_description(func, "remove all node links from the node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "NodeLinks");
+ srna = RNA_def_struct(brna, "NodeLinks", NULL);
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_text(srna, "Node Links", "Collection of Node Links");
+
+ func = RNA_def_function(srna, "new", "rna_NodeTree_link_new");
+ RNA_def_function_ui_description(func, "Add a node link to this node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "input", "NodeSocket", "", "The input socket");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "output", "NodeSocket", "", "The output socket");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "verify_limits",
+ true,
+ "Verify Limits",
+ "Remove existing links if connection limit is exceeded");
+ /* return */
+ parm = RNA_def_pointer(func, "link", "NodeLink", "", "New node link");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_NodeTree_link_remove");
+ RNA_def_function_ui_description(func, "remove a node link from the node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "link", "NodeLink", "", "The node link to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_NodeTree_link_clear");
+ RNA_def_function_ui_description(func, "remove all node links from the node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
}
static void rna_def_node_tree_sockets_api(BlenderRNA *brna, PropertyRNA *cprop, int in_out)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
- const char *structtype = (in_out == SOCK_IN ? "NodeTreeInputs" : "NodeTreeOutputs");
- const char *uiname = (in_out == SOCK_IN ? "Node Tree Inputs" : "Node Tree Outputs");
- const char *newfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_new" : "rna_NodeTree_outputs_new");
- const char *clearfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_clear" : "rna_NodeTree_outputs_clear");
- const char *movefunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_move" : "rna_NodeTree_outputs_move");
-
- RNA_def_property_srna(cprop, structtype);
- srna = RNA_def_struct(brna, structtype, NULL);
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_text(srna, uiname, "Collection of Node Tree Sockets");
-
- func = RNA_def_function(srna, "new", newfunc);
- RNA_def_function_ui_description(func, "Add a socket to this node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return value */
- parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "New socket");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove");
- RNA_def_function_ui_description(func, "Remove a socket from this node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "clear", clearfunc);
- RNA_def_function_ui_description(func, "Remove all sockets from this node tree");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
-
- func = RNA_def_function(srna, "move", movefunc);
- RNA_def_function_ui_description(func, "Move a socket to another position");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_int(func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+ const char *structtype = (in_out == SOCK_IN ? "NodeTreeInputs" : "NodeTreeOutputs");
+ const char *uiname = (in_out == SOCK_IN ? "Node Tree Inputs" : "Node Tree Outputs");
+ const char *newfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_new" :
+ "rna_NodeTree_outputs_new");
+ const char *clearfunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_clear" :
+ "rna_NodeTree_outputs_clear");
+ const char *movefunc = (in_out == SOCK_IN ? "rna_NodeTree_inputs_move" :
+ "rna_NodeTree_outputs_move");
+
+ RNA_def_property_srna(cprop, structtype);
+ srna = RNA_def_struct(brna, structtype, NULL);
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_text(srna, uiname, "Collection of Node Tree Sockets");
+
+ func = RNA_def_function(srna, "new", newfunc);
+ RNA_def_function_ui_description(func, "Add a socket to this node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "type", NULL, MAX_NAME, "Type", "Data type");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return value */
+ parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "New socket");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_NodeTree_socket_remove");
+ RNA_def_function_ui_description(func, "Remove a socket from this node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "socket", "NodeSocketInterface", "", "The socket to remove");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "clear", clearfunc);
+ RNA_def_function_ui_description(func, "Remove all sockets from this node tree");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+
+ func = RNA_def_function(srna, "move", movefunc);
+ RNA_def_function_ui_description(func, "Move a socket to another position");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_int(
+ func, "from_index", -1, 0, INT_MAX, "From Index", "Index of the socket to move", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "to_index", -1, 0, INT_MAX, "To Index", "Target index for the socket", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_nodetree(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem static_type_items[] = {
- {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
- {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
- {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "NodeTree", "ID");
- RNA_def_struct_ui_text(srna, "Node Tree",
- "Node tree consisting of linked nodes used for shading, textures and compositing");
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_icon(srna, ICON_NODETREE);
- RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
- RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", NULL);
-
- prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_sdna(prop, NULL, "view_center");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* AnimData */
- rna_def_animdata_common(srna);
-
- /* Nodes Collection */
- prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
- RNA_def_property_struct_type(prop, "Node");
- RNA_def_property_ui_text(prop, "Nodes", "");
- rna_def_nodetree_nodes_api(brna, prop);
-
- /* NodeLinks Collection */
- prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
- RNA_def_property_struct_type(prop, "NodeLink");
- RNA_def_property_ui_text(prop, "Links", "");
- rna_def_nodetree_link_api(brna, prop);
-
- /* Grease Pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
- RNA_def_property_update(prop, NC_NODE, NULL);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, static_type_items);
- RNA_def_property_ui_text(prop, "Type", "Node Tree type (deprecated, bl_idname is the actual node tree type identifier)");
-
- prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
- RNA_def_property_struct_type(prop, "NodeSocketInterface");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Inputs", "Node tree inputs");
- rna_def_node_tree_sockets_api(brna, prop, SOCK_IN);
-
- prop = RNA_def_property(srna, "active_input", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_NodeTree_active_input_get", "rna_NodeTree_active_input_set", NULL);
- RNA_def_property_ui_text(prop, "Active Input", "Index of the active input");
- RNA_def_property_update(prop, NC_NODE, NULL);
-
- prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
- RNA_def_property_struct_type(prop, "NodeSocketInterface");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Outputs", "Node tree outputs");
- rna_def_node_tree_sockets_api(brna, prop, SOCK_OUT);
-
- prop = RNA_def_property(srna, "active_output", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL);
- RNA_def_property_ui_text(prop, "Active Output", "Index of the active output");
- RNA_def_property_update(prop, NC_NODE, NULL);
-
- /* exposed as a function for runtime interface type properties */
- func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update");
- RNA_def_function_ui_description(func, "Updated node group interface");
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name", "");
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Label", "The node tree label");
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
- RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
- RNA_def_property_enum_items(prop, rna_enum_icon_items);
- RNA_def_property_enum_default(prop, ICON_NODETREE);
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Icon", "The node tree icon");
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "Check visibility in the editor");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
-
- /* update */
- func = RNA_def_function(srna, "update", NULL);
- RNA_def_function_ui_description(func, "Update on editor changes");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
-
- /* get a node tree from context */
- func = RNA_def_function(srna, "get_from_context", NULL);
- RNA_def_function_ui_description(func, "Get a node tree from the context");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "result_1", "NodeTree", "Node Tree", "Active node tree from context");
- RNA_def_function_output(func, parm);
- parm = RNA_def_pointer(func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree");
- RNA_def_function_output(func, parm);
- parm = RNA_def_pointer(func, "result_3", "ID", "From ID", "Original ID data-block selected from the context");
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem static_type_items[] = {
+ {NTREE_SHADER, "SHADER", ICON_MATERIAL, "Shader", "Shader nodes"},
+ {NTREE_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture nodes"},
+ {NTREE_COMPOSIT, "COMPOSITING", ICON_RENDERLAYERS, "Compositing", "Compositing nodes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "NodeTree", "ID");
+ RNA_def_struct_ui_text(
+ srna,
+ "Node Tree",
+ "Node tree consisting of linked nodes used for shading, textures and compositing");
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_icon(srna, ICON_NODETREE);
+ RNA_def_struct_refine_func(srna, "rna_NodeTree_refine");
+ RNA_def_struct_register_funcs(srna, "rna_NodeTree_register", "rna_NodeTree_unregister", NULL);
+
+ prop = RNA_def_property(srna, "view_center", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_sdna(prop, NULL, "view_center");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* AnimData */
+ rna_def_animdata_common(srna);
+
+ /* Nodes Collection */
+ prop = RNA_def_property(srna, "nodes", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "nodes", NULL);
+ RNA_def_property_struct_type(prop, "Node");
+ RNA_def_property_ui_text(prop, "Nodes", "");
+ rna_def_nodetree_nodes_api(brna, prop);
+
+ /* NodeLinks Collection */
+ prop = RNA_def_property(srna, "links", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "links", NULL);
+ RNA_def_property_struct_type(prop, "NodeLink");
+ RNA_def_property_ui_text(prop, "Links", "");
+ rna_def_nodetree_link_api(brna, prop);
+
+ /* Grease Pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Grease Pencil Data", "Grease Pencil data-block");
+ RNA_def_property_update(prop, NC_NODE, NULL);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, static_type_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Type",
+ "Node Tree type (deprecated, bl_idname is the actual node tree type identifier)");
+
+ prop = RNA_def_property(srna, "inputs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "inputs", NULL);
+ RNA_def_property_struct_type(prop, "NodeSocketInterface");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Inputs", "Node tree inputs");
+ rna_def_node_tree_sockets_api(brna, prop, SOCK_IN);
+
+ prop = RNA_def_property(srna, "active_input", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(
+ prop, "rna_NodeTree_active_input_get", "rna_NodeTree_active_input_set", NULL);
+ RNA_def_property_ui_text(prop, "Active Input", "Index of the active input");
+ RNA_def_property_update(prop, NC_NODE, NULL);
+
+ prop = RNA_def_property(srna, "outputs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "outputs", NULL);
+ RNA_def_property_struct_type(prop, "NodeSocketInterface");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Outputs", "Node tree outputs");
+ rna_def_node_tree_sockets_api(brna, prop, SOCK_OUT);
+
+ prop = RNA_def_property(srna, "active_output", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(
+ prop, "rna_NodeTree_active_output_get", "rna_NodeTree_active_output_set", NULL);
+ RNA_def_property_ui_text(prop, "Active Output", "Index of the active output");
+ RNA_def_property_update(prop, NC_NODE, NULL);
+
+ /* exposed as a function for runtime interface type properties */
+ func = RNA_def_function(srna, "interface_update", "rna_NodeTree_interface_update");
+ RNA_def_function_ui_description(func, "Updated node group interface");
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "ID Name", "");
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_name");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "Label", "The node tree label");
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_TRANSLATION);
+ RNA_def_property_string_sdna(prop, NULL, "typeinfo->ui_description");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "typeinfo->ui_icon");
+ RNA_def_property_enum_items(prop, rna_enum_icon_items);
+ RNA_def_property_enum_default(prop, ICON_NODETREE);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "Icon", "The node tree icon");
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(func, "Check visibility in the editor");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", false, "", ""));
+
+ /* update */
+ func = RNA_def_function(srna, "update", NULL);
+ RNA_def_function_ui_description(func, "Update on editor changes");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+
+ /* get a node tree from context */
+ func = RNA_def_function(srna, "get_from_context", NULL);
+ RNA_def_function_ui_description(func, "Get a node tree from the context");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "result_1", "NodeTree", "Node Tree", "Active node tree from context");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_pointer(
+ func, "result_2", "ID", "Owner ID", "ID data-block that owns the node tree");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_pointer(
+ func, "result_3", "ID", "From ID", "Original ID data-block selected from the context");
+ RNA_def_function_output(func, parm);
}
static void rna_def_composite_nodetree(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
- RNA_def_struct_ui_text(srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
-
- prop = RNA_def_property(srna, "render_quality", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "render_quality");
- RNA_def_property_enum_items(prop, node_quality_items);
- RNA_def_property_ui_text(prop, "Render Quality", "Quality when rendering");
-
- prop = RNA_def_property(srna, "edit_quality", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "edit_quality");
- RNA_def_property_enum_items(prop, node_quality_items);
- RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
-
- prop = RNA_def_property(srna, "chunk_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "chunksize");
- RNA_def_property_enum_items(prop, node_chunksize_items);
- RNA_def_property_ui_text(prop, "Chunksize", "Max size of a tile (smaller values gives better distribution "
- "of multiple threads, but more overhead)");
-
- prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_OPENCL);
- RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations");
-
- prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_GROUPNODE_BUFFER);
- RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes");
-
- prop = RNA_def_property(srna, "use_two_pass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_TWO_PASS);
- RNA_def_property_ui_text(prop, "Two Pass", "Use two pass execution during editing: first calculate fast nodes, "
- "second pass calculate all nodes");
-
- prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_VIEWER_BORDER);
- RNA_def_property_ui_text(prop, "Viewer Border", "Use boundaries for viewer nodes and composite backdrop");
- RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "CompositorNodeTree", "NodeTree");
+ RNA_def_struct_ui_text(
+ srna, "Compositor Node Tree", "Node tree consisting of linked nodes used for compositing");
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_icon(srna, ICON_RENDERLAYERS);
+
+ prop = RNA_def_property(srna, "render_quality", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "render_quality");
+ RNA_def_property_enum_items(prop, node_quality_items);
+ RNA_def_property_ui_text(prop, "Render Quality", "Quality when rendering");
+
+ prop = RNA_def_property(srna, "edit_quality", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "edit_quality");
+ RNA_def_property_enum_items(prop, node_quality_items);
+ RNA_def_property_ui_text(prop, "Edit Quality", "Quality when editing");
+
+ prop = RNA_def_property(srna, "chunk_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "chunksize");
+ RNA_def_property_enum_items(prop, node_chunksize_items);
+ RNA_def_property_ui_text(prop,
+ "Chunksize",
+ "Max size of a tile (smaller values gives better distribution "
+ "of multiple threads, but more overhead)");
+
+ prop = RNA_def_property(srna, "use_opencl", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_OPENCL);
+ RNA_def_property_ui_text(prop, "OpenCL", "Enable GPU calculations");
+
+ prop = RNA_def_property(srna, "use_groupnode_buffer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_COM_GROUPNODE_BUFFER);
+ RNA_def_property_ui_text(prop, "Buffer Groups", "Enable buffering of group nodes");
+
+ prop = RNA_def_property(srna, "use_two_pass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_TWO_PASS);
+ RNA_def_property_ui_text(prop,
+ "Two Pass",
+ "Use two pass execution during editing: first calculate fast nodes, "
+ "second pass calculate all nodes");
+
+ prop = RNA_def_property(srna, "use_viewer_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", NTREE_VIEWER_BORDER);
+ RNA_def_property_ui_text(
+ prop, "Viewer Border", "Use boundaries for viewer nodes and composite backdrop");
+ RNA_def_property_update(prop, NC_NODE | ND_DISPLAY, "rna_NodeTree_update");
}
static void rna_def_shader_nodetree(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
- RNA_def_struct_ui_text(srna, "Shader Node Tree",
- "Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
+ srna = RNA_def_struct(brna, "ShaderNodeTree", "NodeTree");
+ RNA_def_struct_ui_text(
+ srna,
+ "Shader Node Tree",
+ "Node tree consisting of linked nodes used for materials (and other shading data-blocks)");
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_icon(srna, ICON_MATERIAL);
- func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
- RNA_def_function_ui_description(func, "Return active shader output node for the specified target");
- parm = RNA_def_enum(func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "get_output_node", "ntreeShaderOutputNode");
+ RNA_def_function_ui_description(func,
+ "Return active shader output node for the specified target");
+ parm = RNA_def_enum(
+ func, "target", prop_shader_output_target_items, SHD_OUTPUT_ALL, "Target", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "node", "ShaderNode", "Node", "");
+ RNA_def_function_return(func, parm);
}
static void rna_def_texture_nodetree(BlenderRNA *brna)
{
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
- RNA_def_struct_ui_text(srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
- RNA_def_struct_sdna(srna, "bNodeTree");
- RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
-}
-
-static StructRNA *define_specific_node(BlenderRNA *brna, const char *struct_name, const char *base_name,
- const char *ui_name, const char *ui_desc, void (*def_func)(StructRNA *))
-{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* XXX hack, want to avoid "NodeInternal" prefix, so use "Node" in NOD_static_types.h and replace here */
- if (STREQ(base_name, "Node"))
- base_name = "NodeInternal";
-
- srna = RNA_def_struct(brna, struct_name, base_name);
- RNA_def_struct_ui_text(srna, ui_name, ui_desc);
- RNA_def_struct_sdna(srna, "bNode");
-
- func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
- RNA_def_function_ui_description(func, "True if a registered node type");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
- parm = RNA_def_boolean(func, "result", false, "Result", "");
- RNA_def_function_return(func, parm);
-
- /* Exposes the socket template type lists in RNA for use in scripts
- * Only used in the C nodes and not exposed in the base class to keep the namespace clean for pynodes.
- */
- func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template");
- RNA_def_function_ui_description(func, "Input socket template");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
- parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Index", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template");
- RNA_def_function_ui_description(func, "Output socket template");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
- parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Index", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- if (def_func)
- def_func(srna);
-
- return srna;
+ StructRNA *srna;
+
+ srna = RNA_def_struct(brna, "TextureNodeTree", "NodeTree");
+ RNA_def_struct_ui_text(
+ srna, "Texture Node Tree", "Node tree consisting of linked nodes used for textures");
+ RNA_def_struct_sdna(srna, "bNodeTree");
+ RNA_def_struct_ui_icon(srna, ICON_TEXTURE);
+}
+
+static StructRNA *define_specific_node(BlenderRNA *brna,
+ const char *struct_name,
+ const char *base_name,
+ const char *ui_name,
+ const char *ui_desc,
+ void (*def_func)(StructRNA *))
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* XXX hack, want to avoid "NodeInternal" prefix, so use "Node" in NOD_static_types.h and replace here */
+ if (STREQ(base_name, "Node"))
+ base_name = "NodeInternal";
+
+ srna = RNA_def_struct(brna, struct_name, base_name);
+ RNA_def_struct_ui_text(srna, ui_name, ui_desc);
+ RNA_def_struct_sdna(srna, "bNode");
+
+ func = RNA_def_function(srna, "is_registered_node_type", "rna_Node_is_registered_node_type");
+ RNA_def_function_ui_description(func, "True if a registered node type");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
+ parm = RNA_def_boolean(func, "result", false, "Result", "");
+ RNA_def_function_return(func, parm);
+
+ /* Exposes the socket template type lists in RNA for use in scripts
+ * Only used in the C nodes and not exposed in the base class to keep the namespace clean for pynodes.
+ */
+ func = RNA_def_function(srna, "input_template", "rna_NodeInternal_input_template");
+ RNA_def_function_ui_description(func, "Input socket template");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
+ parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Index", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "output_template", "rna_NodeInternal_output_template");
+ RNA_def_function_ui_description(func, "Output socket template");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_SELF_TYPE);
+ parm = RNA_def_property(func, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Index", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "result", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(parm, "NodeInternalSocketTemplate");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ if (def_func)
+ def_func(srna);
+
+ return srna;
}
static void rna_def_node_instance_hash(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "NodeInstanceHash", NULL);
- RNA_def_struct_ui_text(srna, "Node Instance Hash", "Hash table containing node instance data");
+ srna = RNA_def_struct(brna, "NodeInstanceHash", NULL);
+ RNA_def_struct_ui_text(srna, "Node Instance Hash", "Hash table containing node instance data");
- /* XXX This type is a stub for now, only used to store instance hash in the context.
- * Eventually could use a StructRNA pointer to define a specific data type
- * and expose lookup functions.
- */
+ /* XXX This type is a stub for now, only used to store instance hash in the context.
+ * Eventually could use a StructRNA pointer to define a specific data type
+ * and expose lookup functions.
+ */
}
void RNA_def_nodetree(BlenderRNA *brna)
{
- StructRNA *srna;
-
- rna_def_node_socket(brna);
- rna_def_node_socket_interface(brna);
-
- rna_def_node(brna);
- rna_def_node_link(brna);
-
- rna_def_internal_node(brna);
- rna_def_shader_node(brna);
- rna_def_compositor_node(brna);
- rna_def_texture_node(brna);
-
- rna_def_nodetree(brna);
-
- rna_def_node_socket_standard_types(brna);
-
- rna_def_composite_nodetree(brna);
- rna_def_shader_nodetree(brna);
- rna_def_texture_nodetree(brna);
-
-#define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
- { \
- srna = define_specific_node(brna, #Category #StructName, #Category, UIName, UIDesc, DefFunc); \
- if (ID == CMP_NODE_OUTPUT_FILE) { \
- /* needs brna argument, can't use NOD_static_types.h */ \
- def_cmp_output_file(brna, srna); \
- } \
- }
-
- /* hack, don't want to add include path to RNA just for this, since in the future RNA types
- * for nodes should be defined locally at runtime anyway ...
- */
-#include "../../nodes/NOD_static_types.h"
-
- /* Node group types need to be defined for shader, compositor, texture nodes individually.
- * Cannot use the static types header for this, since they share the same int id.
- */
- define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", "Group", "", def_group);
- define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", "Group", "", def_group);
- define_specific_node(brna, "TextureNodeGroup", "TextureNode", "Group", "", def_group);
- def_custom_group(brna, "ShaderNodeCustomGroup", "ShaderNode", "Shader Custom Group", "Custom Shader Group Node for Python nodes", "rna_ShaderNodeCustomGroup_register");
- def_custom_group(brna, "CompositorNodeCustomGroup", "CompositorNode", "Compositor Custom Group", "Custom Compositor Group Node for Python nodes", "rna_CompositorNodeCustomGroup_register");
- def_custom_group(brna, "NodeCustomGroup", "Node", "Custom Group", "Base node type for custom registered node group types", "rna_NodeCustomGroup_register");
-
- /* special socket types */
- rna_def_cmp_output_file_slot_file(brna);
- rna_def_cmp_output_file_slot_layer(brna);
-
- rna_def_node_instance_hash(brna);
+ StructRNA *srna;
+
+ rna_def_node_socket(brna);
+ rna_def_node_socket_interface(brna);
+
+ rna_def_node(brna);
+ rna_def_node_link(brna);
+
+ rna_def_internal_node(brna);
+ rna_def_shader_node(brna);
+ rna_def_compositor_node(brna);
+ rna_def_texture_node(brna);
+
+ rna_def_nodetree(brna);
+
+ rna_def_node_socket_standard_types(brna);
+
+ rna_def_composite_nodetree(brna);
+ rna_def_shader_nodetree(brna);
+ rna_def_texture_nodetree(brna);
+
+# define DefNode(Category, ID, DefFunc, EnumName, StructName, UIName, UIDesc) \
+ { \
+ srna = define_specific_node( \
+ brna, #Category #StructName, #Category, UIName, UIDesc, DefFunc); \
+ if (ID == CMP_NODE_OUTPUT_FILE) { \
+ /* needs brna argument, can't use NOD_static_types.h */ \
+ def_cmp_output_file(brna, srna); \
+ } \
+ }
+
+ /* hack, don't want to add include path to RNA just for this, since in the future RNA types
+ * for nodes should be defined locally at runtime anyway ...
+ */
+# include "../../nodes/NOD_static_types.h"
+
+ /* Node group types need to be defined for shader, compositor, texture nodes individually.
+ * Cannot use the static types header for this, since they share the same int id.
+ */
+ define_specific_node(brna, "ShaderNodeGroup", "ShaderNode", "Group", "", def_group);
+ define_specific_node(brna, "CompositorNodeGroup", "CompositorNode", "Group", "", def_group);
+ define_specific_node(brna, "TextureNodeGroup", "TextureNode", "Group", "", def_group);
+ def_custom_group(brna,
+ "ShaderNodeCustomGroup",
+ "ShaderNode",
+ "Shader Custom Group",
+ "Custom Shader Group Node for Python nodes",
+ "rna_ShaderNodeCustomGroup_register");
+ def_custom_group(brna,
+ "CompositorNodeCustomGroup",
+ "CompositorNode",
+ "Compositor Custom Group",
+ "Custom Compositor Group Node for Python nodes",
+ "rna_CompositorNodeCustomGroup_register");
+ def_custom_group(brna,
+ "NodeCustomGroup",
+ "Node",
+ "Custom Group",
+ "Base node type for custom registered node group types",
+ "rna_NodeCustomGroup_register");
+
+ /* special socket types */
+ rna_def_cmp_output_file_slot_file(brna);
+ rna_def_cmp_output_file_slot_layer(brna);
+
+ rna_def_node_instance_hash(brna);
}
/* clean up macro definition */
-#undef NODE_DEFINE_SUBTYPES
+# undef NODE_DEFINE_SUBTYPES
#endif
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index c8feff4c0e8..b36e6490e5f 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -61,2721 +61,2937 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_object_mode_items[] = {
- {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
- {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
- {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
- {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
- {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
- {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
- {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
- {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
- {OB_MODE_EDIT_GPENCIL, "EDIT_GPENCIL", ICON_EDITMODE_HLT, "Edit Mode", "Edit Grease Pencil Strokes"},
- {OB_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", ICON_SCULPTMODE_HLT, "Sculpt Mode", "Sculpt Grease Pencil Strokes"},
- {OB_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", ICON_GREASEPENCIL, "Draw", "Paint Grease Pencil Strokes"},
- {OB_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", ICON_WPAINT_HLT, "Weight Paint", "Grease Pencil Weight Paint Strokes" },
- {0, NULL, 0, NULL, NULL},
+ {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
+ {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
+ {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
+ {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
+ {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
+ {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
+ {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+ {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
+ {OB_MODE_EDIT_GPENCIL,
+ "EDIT_GPENCIL",
+ ICON_EDITMODE_HLT,
+ "Edit Mode",
+ "Edit Grease Pencil Strokes"},
+ {OB_MODE_SCULPT_GPENCIL,
+ "SCULPT_GPENCIL",
+ ICON_SCULPTMODE_HLT,
+ "Sculpt Mode",
+ "Sculpt Grease Pencil Strokes"},
+ {OB_MODE_PAINT_GPENCIL,
+ "PAINT_GPENCIL",
+ ICON_GREASEPENCIL,
+ "Draw",
+ "Paint Grease Pencil Strokes"},
+ {OB_MODE_WEIGHT_GPENCIL,
+ "WEIGHT_GPENCIL",
+ ICON_WPAINT_HLT,
+ "Weight Paint",
+ "Grease Pencil Weight Paint Strokes"},
+ {0, NULL, 0, NULL, NULL},
};
/* Same as above, but with names that distinguish grease pencil. */
const EnumPropertyItem rna_enum_workspace_object_mode_items[] = {
- {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
- {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
- {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
- {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
- {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
- {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
- {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
- {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
- {OB_MODE_EDIT_GPENCIL, "EDIT_GPENCIL", ICON_EDITMODE_HLT, "Grease Pencil Edit Mode", "Edit Grease Pencil Strokes"},
- {OB_MODE_SCULPT_GPENCIL, "SCULPT_GPENCIL", ICON_SCULPTMODE_HLT, "Grease Pencil Sculpt Mode", "Sculpt Grease Pencil Strokes"},
- {OB_MODE_PAINT_GPENCIL, "PAINT_GPENCIL", ICON_GREASEPENCIL, "Grease Pencil Draw", "Paint Grease Pencil Strokes"},
- {OB_MODE_WEIGHT_GPENCIL, "WEIGHT_GPENCIL", ICON_WPAINT_HLT, "Grease Pencil Weight Paint", "Grease Pencil Weight Paint Strokes" },
- {0, NULL, 0, NULL, NULL},
+ {OB_MODE_OBJECT, "OBJECT", ICON_OBJECT_DATAMODE, "Object Mode", ""},
+ {OB_MODE_EDIT, "EDIT", ICON_EDITMODE_HLT, "Edit Mode", ""},
+ {OB_MODE_POSE, "POSE", ICON_POSE_HLT, "Pose Mode", ""},
+ {OB_MODE_SCULPT, "SCULPT", ICON_SCULPTMODE_HLT, "Sculpt Mode", ""},
+ {OB_MODE_VERTEX_PAINT, "VERTEX_PAINT", ICON_VPAINT_HLT, "Vertex Paint", ""},
+ {OB_MODE_WEIGHT_PAINT, "WEIGHT_PAINT", ICON_WPAINT_HLT, "Weight Paint", ""},
+ {OB_MODE_TEXTURE_PAINT, "TEXTURE_PAINT", ICON_TPAINT_HLT, "Texture Paint", ""},
+ {OB_MODE_PARTICLE_EDIT, "PARTICLE_EDIT", ICON_PARTICLEMODE, "Particle Edit", ""},
+ {OB_MODE_EDIT_GPENCIL,
+ "EDIT_GPENCIL",
+ ICON_EDITMODE_HLT,
+ "Grease Pencil Edit Mode",
+ "Edit Grease Pencil Strokes"},
+ {OB_MODE_SCULPT_GPENCIL,
+ "SCULPT_GPENCIL",
+ ICON_SCULPTMODE_HLT,
+ "Grease Pencil Sculpt Mode",
+ "Sculpt Grease Pencil Strokes"},
+ {OB_MODE_PAINT_GPENCIL,
+ "PAINT_GPENCIL",
+ ICON_GREASEPENCIL,
+ "Grease Pencil Draw",
+ "Paint Grease Pencil Strokes"},
+ {OB_MODE_WEIGHT_GPENCIL,
+ "WEIGHT_GPENCIL",
+ ICON_WPAINT_HLT,
+ "Grease Pencil Weight Paint",
+ "Grease Pencil Weight Paint Strokes"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_empty_drawtype_items[] = {
- {OB_PLAINAXES, "PLAIN_AXES", ICON_EMPTY_AXIS, "Plain Axes", ""},
- {OB_ARROWS, "ARROWS", ICON_EMPTY_ARROWS, "Arrows", ""},
- {OB_SINGLE_ARROW, "SINGLE_ARROW", ICON_EMPTY_SINGLE_ARROW, "Single Arrow", ""},
- {OB_CIRCLE, "CIRCLE", ICON_MESH_CIRCLE, "Circle", ""},
- {OB_CUBE, "CUBE", ICON_CUBE, "Cube", ""},
- {OB_EMPTY_SPHERE, "SPHERE", ICON_SPHERE, "Sphere", ""},
- {OB_EMPTY_CONE, "CONE", ICON_CONE, "Cone", ""},
- {OB_EMPTY_IMAGE, "IMAGE", ICON_FILE_IMAGE, "Image", ""},
- {0, NULL, 0, NULL, NULL},
+ {OB_PLAINAXES, "PLAIN_AXES", ICON_EMPTY_AXIS, "Plain Axes", ""},
+ {OB_ARROWS, "ARROWS", ICON_EMPTY_ARROWS, "Arrows", ""},
+ {OB_SINGLE_ARROW, "SINGLE_ARROW", ICON_EMPTY_SINGLE_ARROW, "Single Arrow", ""},
+ {OB_CIRCLE, "CIRCLE", ICON_MESH_CIRCLE, "Circle", ""},
+ {OB_CUBE, "CUBE", ICON_CUBE, "Cube", ""},
+ {OB_EMPTY_SPHERE, "SPHERE", ICON_SPHERE, "Sphere", ""},
+ {OB_EMPTY_CONE, "CONE", ICON_CONE, "Cone", ""},
+ {OB_EMPTY_IMAGE, "IMAGE", ICON_FILE_IMAGE, "Image", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_object_empty_image_depth_items[] = {
- {OB_EMPTY_IMAGE_DEPTH_DEFAULT, "DEFAULT", 0, "Default", ""},
- {OB_EMPTY_IMAGE_DEPTH_FRONT, "FRONT", 0, "Front", ""},
- {OB_EMPTY_IMAGE_DEPTH_BACK, "BACK", 0, "Back", ""},
- {0, NULL, 0, NULL, NULL},
+ {OB_EMPTY_IMAGE_DEPTH_DEFAULT, "DEFAULT", 0, "Default", ""},
+ {OB_EMPTY_IMAGE_DEPTH_FRONT, "FRONT", 0, "Front", ""},
+ {OB_EMPTY_IMAGE_DEPTH_BACK, "BACK", 0, "Back", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_gpencil_type_items[] = {
- {GP_EMPTY, "EMPTY", ICON_EMPTY_AXIS, "Blank", "Create an empty grease pencil object"},
- {GP_STROKE, "STROKE", ICON_STROKE, "Stroke", "Create a simple stroke with basic colors"},
- {GP_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Construct a Suzanne grease pencil object"},
- {0, NULL, 0, NULL, NULL }
-};
+ {GP_EMPTY, "EMPTY", ICON_EMPTY_AXIS, "Blank", "Create an empty grease pencil object"},
+ {GP_STROKE, "STROKE", ICON_STROKE, "Stroke", "Create a simple stroke with basic colors"},
+ {GP_MONKEY, "MONKEY", ICON_MONKEY, "Monkey", "Construct a Suzanne grease pencil object"},
+ {0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem parent_type_items[] = {
- {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
- {PARSKEL, "ARMATURE", 0, "Armature", ""},
- {PARSKEL, "LATTICE", 0, "Lattice", "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */
- {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
- {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
- {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
- {0, NULL, 0, NULL, NULL},
+ {PAROBJECT, "OBJECT", 0, "Object", "The object is parented to an object"},
+ {PARSKEL, "ARMATURE", 0, "Armature", ""},
+ {PARSKEL,
+ "LATTICE",
+ 0,
+ "Lattice",
+ "The object is parented to a lattice"}, /* PARSKEL reuse will give issues */
+ {PARVERT1, "VERTEX", 0, "Vertex", "The object is parented to a vertex"},
+ {PARVERT3, "VERTEX_3", 0, "3 Vertices", ""},
+ {PARBONE, "BONE", 0, "Bone", "The object is parented to a bone"},
+ {0, NULL, 0, NULL, NULL},
};
#define INSTANCE_ITEMS_SHARED \
- {0, "NONE", 0, "None", ""}, \
- {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Instantiate child objects on all vertices"}, \
- {OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces"}
+ {0, "NONE", 0, "None", ""}, \
+ {OB_DUPLIVERTS, "VERTS", 0, "Verts", "Instantiate child objects on all vertices"}, \
+ { \
+ OB_DUPLIFACES, "FACES", 0, "Faces", "Instantiate child objects on all faces" \
+ }
#define INSTANCE_ITEM_COLLECTION \
- {OB_DUPLICOLLECTION, "COLLECTION", 0, "Collection", "Enable collection instancing"}
+ { \
+ OB_DUPLICOLLECTION, "COLLECTION", 0, "Collection", "Enable collection instancing" \
+ }
static const EnumPropertyItem instance_items[] = {
- INSTANCE_ITEMS_SHARED,
- INSTANCE_ITEM_COLLECTION,
- {0, NULL, 0, NULL, NULL},
+ INSTANCE_ITEMS_SHARED,
+ INSTANCE_ITEM_COLLECTION,
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static EnumPropertyItem instance_items_nogroup[] = {
- INSTANCE_ITEMS_SHARED,
- {0, NULL, 0, NULL, NULL},
+ INSTANCE_ITEMS_SHARED,
+ {0, NULL, 0, NULL, NULL},
};
#endif
#undef INSTANCE_ITEMS_SHARED
#undef INSTANCE_ITEM_COLLECTION
const EnumPropertyItem rna_enum_metaelem_type_items[] = {
- {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
- {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
- {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
- {MB_ELIPSOID, "ELLIPSOID", ICON_META_ELLIPSOID, "Ellipsoid", ""}, /* NOTE: typo at original definition! */
- {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
- {0, NULL, 0, NULL, NULL},
+ {MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
+ {MB_TUBE, "CAPSULE", ICON_META_CAPSULE, "Capsule", ""},
+ {MB_PLANE, "PLANE", ICON_META_PLANE, "Plane", ""},
+ {MB_ELIPSOID,
+ "ELLIPSOID",
+ ICON_META_ELLIPSOID,
+ "Ellipsoid",
+ ""}, /* NOTE: typo at original definition! */
+ {MB_CUBE, "CUBE", ICON_META_CUBE, "Cube", ""},
+ {0, NULL, 0, NULL, NULL},
};
/* used for 2 enums */
-#define OBTYPE_CU_CURVE {OB_CURVE, "CURVE", 0, "Curve", ""}
-#define OBTYPE_CU_SURF {OB_SURF, "SURFACE", 0, "Surface", ""}
-#define OBTYPE_CU_FONT {OB_FONT, "FONT", 0, "Font", ""}
+#define OBTYPE_CU_CURVE \
+ { \
+ OB_CURVE, "CURVE", 0, "Curve", "" \
+ }
+#define OBTYPE_CU_SURF \
+ { \
+ OB_SURF, "SURFACE", 0, "Surface", "" \
+ }
+#define OBTYPE_CU_FONT \
+ { \
+ OB_FONT, "FONT", 0, "Font", "" \
+ }
const EnumPropertyItem rna_enum_object_type_items[] = {
- {OB_MESH, "MESH", 0, "Mesh", ""},
- OBTYPE_CU_CURVE,
- OBTYPE_CU_SURF,
- {OB_MBALL, "META", 0, "Meta", ""},
- OBTYPE_CU_FONT,
- {0, "", 0, NULL, NULL},
- {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
- {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
- {OB_EMPTY, "EMPTY", 0, "Empty", ""},
- {OB_GPENCIL, "GPENCIL", 0, "GPencil", ""},
- {0, "", 0, NULL, NULL},
- {OB_CAMERA, "CAMERA", 0, "Camera", ""},
- {OB_LAMP, "LIGHT", 0, "Light", ""},
- {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
- {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""},
- {0, NULL, 0, NULL, NULL},
+ {OB_MESH, "MESH", 0, "Mesh", ""},
+ OBTYPE_CU_CURVE,
+ OBTYPE_CU_SURF,
+ {OB_MBALL, "META", 0, "Meta", ""},
+ OBTYPE_CU_FONT,
+ {0, "", 0, NULL, NULL},
+ {OB_ARMATURE, "ARMATURE", 0, "Armature", ""},
+ {OB_LATTICE, "LATTICE", 0, "Lattice", ""},
+ {OB_EMPTY, "EMPTY", 0, "Empty", ""},
+ {OB_GPENCIL, "GPENCIL", 0, "GPencil", ""},
+ {0, "", 0, NULL, NULL},
+ {OB_CAMERA, "CAMERA", 0, "Camera", ""},
+ {OB_LAMP, "LIGHT", 0, "Light", ""},
+ {OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
+ {OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_type_curve_items[] = {
- OBTYPE_CU_CURVE,
- OBTYPE_CU_SURF,
- OBTYPE_CU_FONT,
- {0, NULL, 0, NULL, NULL},
+ OBTYPE_CU_CURVE,
+ OBTYPE_CU_SURF,
+ OBTYPE_CU_FONT,
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_rotation_mode_items[] = {
- {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
- {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
- {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
- {ROT_MODE_AXISANGLE, "AXIS_ANGLE", 0, "Axis Angle",
- "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
- {0, NULL, 0, NULL, NULL},
+ {ROT_MODE_QUAT, "QUATERNION", 0, "Quaternion (WXYZ)", "No Gimbal Lock"},
+ {ROT_MODE_XYZ, "XYZ", 0, "XYZ Euler", "XYZ Rotation Order - prone to Gimbal Lock (default)"},
+ {ROT_MODE_XZY, "XZY", 0, "XZY Euler", "XZY Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_YXZ, "YXZ", 0, "YXZ Euler", "YXZ Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_YZX, "YZX", 0, "YZX Euler", "YZX Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_ZXY, "ZXY", 0, "ZXY Euler", "ZXY Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_ZYX, "ZYX", 0, "ZYX Euler", "ZYX Rotation Order - prone to Gimbal Lock"},
+ {ROT_MODE_AXISANGLE,
+ "AXIS_ANGLE",
+ 0,
+ "Axis Angle",
+ "Axis Angle (W+XYZ), defines a rotation around some axis defined by 3D-Vector"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_object_axis_items[] = {
- {OB_POSX, "POS_X", 0, "+X", ""},
- {OB_POSY, "POS_Y", 0, "+Y", ""},
- {OB_POSZ, "POS_Z", 0, "+Z", ""},
- {OB_NEGX, "NEG_X", 0, "-X", ""},
- {OB_NEGY, "NEG_Y", 0, "-Y", ""},
- {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
+ {OB_POSX, "POS_X", 0, "+X", ""},
+ {OB_POSY, "POS_Y", 0, "+Y", ""},
+ {OB_POSZ, "POS_Z", 0, "+Z", ""},
+ {OB_NEGX, "NEG_X", 0, "-X", ""},
+ {OB_NEGY, "NEG_Y", 0, "-Y", ""},
+ {OB_NEGZ, "NEG_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_math.h"
-
-#include "DNA_key_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_gpencil_types.h"
-#include "DNA_ID.h"
-#include "DNA_lattice_types.h"
-#include "DNA_node_types.h"
-
-#include "BKE_armature.h"
-#include "BKE_brush.h"
-#include "BKE_constraint.h"
-#include "BKE_context.h"
-#include "BKE_curve.h"
-#include "BKE_effect.h"
-#include "BKE_global.h"
-#include "BKE_key.h"
-#include "BKE_object.h"
-#include "BKE_material.h"
-#include "BKE_mesh.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_scene.h"
-#include "BKE_deform.h"
-
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-
-#include "ED_object.h"
-#include "ED_particle.h"
-#include "ED_curve.h"
-#include "ED_lattice.h"
+# include "BLI_math.h"
+
+# include "DNA_key_types.h"
+# include "DNA_constraint_types.h"
+# include "DNA_gpencil_types.h"
+# include "DNA_ID.h"
+# include "DNA_lattice_types.h"
+# include "DNA_node_types.h"
+
+# include "BKE_armature.h"
+# include "BKE_brush.h"
+# include "BKE_constraint.h"
+# include "BKE_context.h"
+# include "BKE_curve.h"
+# include "BKE_effect.h"
+# include "BKE_global.h"
+# include "BKE_key.h"
+# include "BKE_object.h"
+# include "BKE_material.h"
+# include "BKE_mesh.h"
+# include "BKE_modifier.h"
+# include "BKE_particle.h"
+# include "BKE_scene.h"
+# include "BKE_deform.h"
+
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+
+# include "ED_object.h"
+# include "ED_particle.h"
+# include "ED_curve.h"
+# include "ED_lattice.h"
static void rna_Object_internal_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM);
}
-static void rna_Object_internal_update_draw(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Object_internal_update_draw(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
}
static void rna_Object_matrix_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- /* don't use compat so we get predictable rotation */
- BKE_object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, false, true);
- rna_Object_internal_update(bmain, scene, ptr);
+ /* don't use compat so we get predictable rotation */
+ BKE_object_apply_mat4(ptr->id.data, ((Object *)ptr->id.data)->obmat, false, true);
+ rna_Object_internal_update(bmain, scene, ptr);
}
static void rna_Object_hide_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- BKE_main_collection_sync_remap(bmain);
- DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
+ Object *ob = ptr->id.data;
+ BKE_main_collection_sync_remap(bmain);
+ DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
}
static void rna_MaterialIndex_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- if (ob && ob->type == OB_GPENCIL) {
- /* notifying material property in topbar */
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
- }
+ Object *ob = (Object *)ptr->id.data;
+ if (ob && ob->type == OB_GPENCIL) {
+ /* notifying material property in topbar */
+ WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ }
}
-
static void rna_Object_matrix_local_get(PointerRNA *ptr, float values[16])
{
- Object *ob = ptr->id.data;
- BKE_object_matrix_local_get(ob, (float(*)[4])values);
+ Object *ob = ptr->id.data;
+ BKE_object_matrix_local_get(ob, (float(*)[4])values);
}
static void rna_Object_matrix_local_set(PointerRNA *ptr, const float values[16])
{
- Object *ob = ptr->id.data;
- float local_mat[4][4];
+ Object *ob = ptr->id.data;
+ float local_mat[4][4];
- /* localspace matrix is truly relative to the parent, but parameters stored in object are
- * relative to parentinv matrix. Undo the parent inverse part before applying it as local matrix. */
- if (ob->parent) {
- float invmat[4][4];
- invert_m4_m4(invmat, ob->parentinv);
- mul_m4_m4m4(local_mat, invmat, (float(*)[4])values);
- }
- else {
- copy_m4_m4(local_mat, (float(*)[4])values);
- }
+ /* localspace matrix is truly relative to the parent, but parameters stored in object are
+ * relative to parentinv matrix. Undo the parent inverse part before applying it as local matrix. */
+ if (ob->parent) {
+ float invmat[4][4];
+ invert_m4_m4(invmat, ob->parentinv);
+ mul_m4_m4m4(local_mat, invmat, (float(*)[4])values);
+ }
+ else {
+ copy_m4_m4(local_mat, (float(*)[4])values);
+ }
- /* don't use compat so we get predictable rotation, and do not use parenting either, because it's a local matrix! */
- BKE_object_apply_mat4(ob, local_mat, false, false);
+ /* don't use compat so we get predictable rotation, and do not use parenting either, because it's a local matrix! */
+ BKE_object_apply_mat4(ob, local_mat, false, false);
}
static void rna_Object_matrix_basis_get(PointerRNA *ptr, float values[16])
{
- Object *ob = ptr->id.data;
- BKE_object_to_mat4(ob, (float(*)[4])values);
+ Object *ob = ptr->id.data;
+ BKE_object_to_mat4(ob, (float(*)[4])values);
}
static void rna_Object_matrix_basis_set(PointerRNA *ptr, const float values[16])
{
- Object *ob = ptr->id.data;
- BKE_object_apply_mat4(ob, (float(*)[4])values, false, false);
+ Object *ob = ptr->id.data;
+ BKE_object_apply_mat4(ob, (float(*)[4])values, false, false);
}
void rna_Object_internal_update_data(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ptr->id.data);
}
static void rna_Object_active_shape_update(bContext *C, PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
-
- if (CTX_data_edit_object(C) == ob) {
- /* exit/enter editmode to get new shape */
- switch (ob->type) {
- case OB_MESH:
- EDBM_mesh_load(bmain, ob);
- EDBM_mesh_make(ob, scene->toolsettings->selectmode, true);
-
- DEG_id_tag_update(ob->data, 0);
-
- EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_mesh);
- BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_mesh);
- break;
- case OB_CURVE:
- case OB_SURF:
- ED_curve_editnurb_load(bmain, ob);
- ED_curve_editnurb_make(ob);
- break;
- case OB_LATTICE:
- BKE_editlattice_load(ob);
- BKE_editlattice_make(ob);
- break;
- }
- }
-
- rna_Object_internal_update_data(bmain, scene, ptr);
+ Object *ob = ptr->id.data;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+
+ if (CTX_data_edit_object(C) == ob) {
+ /* exit/enter editmode to get new shape */
+ switch (ob->type) {
+ case OB_MESH:
+ EDBM_mesh_load(bmain, ob);
+ EDBM_mesh_make(ob, scene->toolsettings->selectmode, true);
+
+ DEG_id_tag_update(ob->data, 0);
+
+ EDBM_mesh_normals_update(((Mesh *)ob->data)->edit_mesh);
+ BKE_editmesh_tessface_calc(((Mesh *)ob->data)->edit_mesh);
+ break;
+ case OB_CURVE:
+ case OB_SURF:
+ ED_curve_editnurb_load(bmain, ob);
+ ED_curve_editnurb_make(ob);
+ break;
+ case OB_LATTICE:
+ BKE_editlattice_load(ob);
+ BKE_editlattice_make(ob);
+ break;
+ }
+ }
+
+ rna_Object_internal_update_data(bmain, scene, ptr);
}
static void rna_Object_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_TRANSFORM);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_PARENT, ptr->id.data);
}
static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->data;
- ID *id = value.data;
-
- if (ob->mode & OB_MODE_EDIT) {
- return;
- }
-
- /* assigning NULL only for empties */
- if ((id == NULL) && (ob->type != OB_EMPTY)) {
- return;
- }
-
- BLI_assert(BKE_id_is_in_global_main(&ob->id));
- BLI_assert(BKE_id_is_in_global_main(id));
-
- if (ob->type == OB_EMPTY) {
- if (ob->data) {
- id_us_min((ID *)ob->data);
- ob->data = NULL;
- }
-
- if (!id || GS(id->name) == ID_IM) {
- id_us_plus(id);
- ob->data = id;
- }
- }
- else if (ob->type == OB_MESH) {
- BKE_mesh_assign_object(G_MAIN, ob, (Mesh *)id);
- }
- else {
- if (ob->data) {
- id_us_min((ID *)ob->data);
- }
-
- /* no need to type-check here ID. this is done in the _typef() function */
- BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name)));
- id_us_plus(id);
-
- ob->data = id;
- test_object_materials(G_MAIN, ob, id);
-
- if (GS(id->name) == ID_CU) {
- BKE_curve_type_test(ob);
- }
- else if (ob->type == OB_ARMATURE) {
- BKE_pose_rebuild(G_MAIN, ob, ob->data, true);
- }
- }
+ Object *ob = (Object *)ptr->data;
+ ID *id = value.data;
+
+ if (ob->mode & OB_MODE_EDIT) {
+ return;
+ }
+
+ /* assigning NULL only for empties */
+ if ((id == NULL) && (ob->type != OB_EMPTY)) {
+ return;
+ }
+
+ BLI_assert(BKE_id_is_in_global_main(&ob->id));
+ BLI_assert(BKE_id_is_in_global_main(id));
+
+ if (ob->type == OB_EMPTY) {
+ if (ob->data) {
+ id_us_min((ID *)ob->data);
+ ob->data = NULL;
+ }
+
+ if (!id || GS(id->name) == ID_IM) {
+ id_us_plus(id);
+ ob->data = id;
+ }
+ }
+ else if (ob->type == OB_MESH) {
+ BKE_mesh_assign_object(G_MAIN, ob, (Mesh *)id);
+ }
+ else {
+ if (ob->data) {
+ id_us_min((ID *)ob->data);
+ }
+
+ /* no need to type-check here ID. this is done in the _typef() function */
+ BLI_assert(OB_DATA_SUPPORT_ID(GS(id->name)));
+ id_us_plus(id);
+
+ ob->data = id;
+ test_object_materials(G_MAIN, ob, id);
+
+ if (GS(id->name) == ID_CU) {
+ BKE_curve_type_test(ob);
+ }
+ else if (ob->type == OB_ARMATURE) {
+ BKE_pose_rebuild(G_MAIN, ob, ob->data, true);
+ }
+ }
}
static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->data;
-
- /* keep in sync with OB_DATA_SUPPORT_ID() macro */
- switch (ob->type) {
- case OB_EMPTY: return &RNA_Image;
- case OB_MESH: return &RNA_Mesh;
- case OB_CURVE: return &RNA_Curve;
- case OB_SURF: return &RNA_Curve;
- case OB_FONT: return &RNA_Curve;
- case OB_MBALL: return &RNA_MetaBall;
- case OB_LAMP: return &RNA_Light;
- case OB_CAMERA: return &RNA_Camera;
- case OB_LATTICE: return &RNA_Lattice;
- case OB_ARMATURE: return &RNA_Armature;
- case OB_SPEAKER: return &RNA_Speaker;
- case OB_LIGHTPROBE: return &RNA_LightProbe;
- case OB_GPENCIL: return &RNA_GreasePencil;
- default: return &RNA_ID;
- }
+ Object *ob = (Object *)ptr->data;
+
+ /* keep in sync with OB_DATA_SUPPORT_ID() macro */
+ switch (ob->type) {
+ case OB_EMPTY:
+ return &RNA_Image;
+ case OB_MESH:
+ return &RNA_Mesh;
+ case OB_CURVE:
+ return &RNA_Curve;
+ case OB_SURF:
+ return &RNA_Curve;
+ case OB_FONT:
+ return &RNA_Curve;
+ case OB_MBALL:
+ return &RNA_MetaBall;
+ case OB_LAMP:
+ return &RNA_Light;
+ case OB_CAMERA:
+ return &RNA_Camera;
+ case OB_LATTICE:
+ return &RNA_Lattice;
+ case OB_ARMATURE:
+ return &RNA_Armature;
+ case OB_SPEAKER:
+ return &RNA_Speaker;
+ case OB_LIGHTPROBE:
+ return &RNA_LightProbe;
+ case OB_GPENCIL:
+ return &RNA_GreasePencil;
+ default:
+ return &RNA_ID;
+ }
}
static bool rna_Object_data_poll(PointerRNA *ptr, const PointerRNA value)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- if (ob->type == OB_GPENCIL) {
- /* GP Object - Don't allow using "Annotation" GP datablocks here */
- bGPdata *gpd = value.data;
- return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
- }
+ if (ob->type == OB_GPENCIL) {
+ /* GP Object - Don't allow using "Annotation" GP datablocks here */
+ bGPdata *gpd = value.data;
+ return (gpd->flag & GP_DATA_ANNOTATIONS) == 0;
+ }
- return true;
+ return true;
}
static void rna_Object_parent_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->data;
- Object *par = (Object *)value.data;
+ Object *ob = (Object *)ptr->data;
+ Object *par = (Object *)value.data;
- {
- ED_object_parent(ob, par, ob->partype, ob->parsubstr);
- }
+ {
+ ED_object_parent(ob, par, ob->partype, ob->parsubstr);
+ }
}
static void rna_Object_parent_type_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- ED_object_parent(ob, ob->parent, value, ob->parsubstr);
+ ED_object_parent(ob, ob->parent, value, ob->parsubstr);
}
-static const EnumPropertyItem *rna_Object_parent_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Object_parent_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- Object *ob = (Object *)ptr->data;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ Object *ob = (Object *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
+ RNA_enum_items_add_value(&item, &totitem, parent_type_items, PAROBJECT);
- if (ob->parent) {
- Object *par = ob->parent;
+ if (ob->parent) {
+ Object *par = ob->parent;
- if (par->type == OB_LATTICE) {
- /* special hack: prevents this overriding others */
- RNA_enum_items_add_value(&item, &totitem, &parent_type_items[2], PARSKEL);
- }
- else if (par->type == OB_ARMATURE) {
- /* special hack: prevents this being overridden */
- RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
- RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
- }
+ if (par->type == OB_LATTICE) {
+ /* special hack: prevents this overriding others */
+ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[2], PARSKEL);
+ }
+ else if (par->type == OB_ARMATURE) {
+ /* special hack: prevents this being overridden */
+ RNA_enum_items_add_value(&item, &totitem, &parent_type_items[1], PARSKEL);
+ RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARBONE);
+ }
- if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
- RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
- RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
- }
- }
+ if (OB_TYPE_SUPPORT_PARVERT(par->type)) {
+ RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT1);
+ RNA_enum_items_add_value(&item, &totitem, parent_type_items, PARVERT3);
+ }
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static void rna_Object_empty_display_type_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- BKE_object_empty_draw_type_set(ob, value);
+ BKE_object_empty_draw_type_set(ob, value);
}
static void rna_Object_parent_bone_set(PointerRNA *ptr, const char *value)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- ED_object_parent(ob, ob->parent, ob->partype, value);
+ ED_object_parent(ob, ob->parent, ob->partype, value);
}
-static const EnumPropertyItem *rna_Object_instance_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Object_instance_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- Object *ob = (Object *)ptr->data;
- const EnumPropertyItem *item;
+ Object *ob = (Object *)ptr->data;
+ const EnumPropertyItem *item;
- if (ob->type == OB_EMPTY) {
- item = instance_items;
- }
- else {
- item = instance_items_nogroup;
- }
+ if (ob->type == OB_EMPTY) {
+ item = instance_items;
+ }
+ else {
+ item = instance_items_nogroup;
+ }
- return item;
+ return item;
}
static void rna_Object_dup_collection_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->data;
- Collection *grp = (Collection *)value.data;
-
- /* must not let this be set if the object belongs in this group already,
- * thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
- */
- if (BKE_collection_has_object_recursive(grp, ob) == 0) {
- if (ob->type == OB_EMPTY) {
- id_us_min(&ob->instance_collection->id);
- ob->instance_collection = grp;
- id_us_plus(&ob->instance_collection->id);
- }
- else {
- BKE_report(NULL, RPT_ERROR,
- "Only empty objects support group instances");
- }
- }
- else {
- BKE_report(NULL, RPT_ERROR,
- "Cannot set instance-collection as object belongs in group being instanced, thus causing a cycle");
- }
+ Object *ob = (Object *)ptr->data;
+ Collection *grp = (Collection *)value.data;
+
+ /* must not let this be set if the object belongs in this group already,
+ * thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
+ */
+ if (BKE_collection_has_object_recursive(grp, ob) == 0) {
+ if (ob->type == OB_EMPTY) {
+ id_us_min(&ob->instance_collection->id);
+ ob->instance_collection = grp;
+ id_us_plus(&ob->instance_collection->id);
+ }
+ else {
+ BKE_report(NULL, RPT_ERROR, "Only empty objects support group instances");
+ }
+ }
+ else {
+ BKE_report(NULL,
+ RPT_ERROR,
+ "Cannot set instance-collection as object belongs in group being instanced, thus "
+ "causing a cycle");
+ }
}
static void rna_VertexGroup_name_set(PointerRNA *ptr, const char *value)
{
- Object *ob = (Object *)ptr->id.data;
- bDeformGroup *dg = (bDeformGroup *)ptr->data;
- BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
- defgroup_unique_name(dg, ob);
+ Object *ob = (Object *)ptr->id.data;
+ bDeformGroup *dg = (bDeformGroup *)ptr->data;
+ BLI_strncpy_utf8(dg->name, value, sizeof(dg->name));
+ defgroup_unique_name(dg, ob);
}
static int rna_VertexGroup_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- return BLI_findindex(&ob->defbase, ptr->data);
+ return BLI_findindex(&ob->defbase, ptr->data);
}
static PointerRNA rna_Object_active_vertex_group_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef - 1));
+ Object *ob = (Object *)ptr->id.data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_VertexGroup, BLI_findlink(&ob->defbase, ob->actdef - 1));
}
static int rna_Object_active_vertex_group_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return ob->actdef - 1;
+ Object *ob = (Object *)ptr->id.data;
+ return ob->actdef - 1;
}
static void rna_Object_active_vertex_group_index_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
- ob->actdef = value + 1;
+ Object *ob = (Object *)ptr->id.data;
+ ob->actdef = value + 1;
}
-static void rna_Object_active_vertex_group_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Object_active_vertex_group_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&ob->defbase) - 1);
}
void rna_object_vgroup_name_index_get(PointerRNA *ptr, char *value, int index)
{
- Object *ob = (Object *)ptr->id.data;
- bDeformGroup *dg;
+ Object *ob = (Object *)ptr->id.data;
+ bDeformGroup *dg;
- dg = BLI_findlink(&ob->defbase, index - 1);
+ dg = BLI_findlink(&ob->defbase, index - 1);
- if (dg) BLI_strncpy(value, dg->name, sizeof(dg->name));
- else value[0] = '\0';
+ if (dg)
+ BLI_strncpy(value, dg->name, sizeof(dg->name));
+ else
+ value[0] = '\0';
}
int rna_object_vgroup_name_index_length(PointerRNA *ptr, int index)
{
- Object *ob = (Object *)ptr->id.data;
- bDeformGroup *dg;
+ Object *ob = (Object *)ptr->id.data;
+ bDeformGroup *dg;
- dg = BLI_findlink(&ob->defbase, index - 1);
- return (dg) ? strlen(dg->name) : 0;
+ dg = BLI_findlink(&ob->defbase, index - 1);
+ return (dg) ? strlen(dg->name) : 0;
}
void rna_object_vgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
{
- Object *ob = (Object *)ptr->id.data;
- *index = defgroup_name_index(ob, value) + 1;
+ Object *ob = (Object *)ptr->id.data;
+ *index = defgroup_name_index(ob, value) + 1;
}
void rna_object_vgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
{
- Object *ob = (Object *)ptr->id.data;
- bDeformGroup *dg = defgroup_find_name(ob, value);
- if (dg) {
- BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
- return;
- }
+ Object *ob = (Object *)ptr->id.data;
+ bDeformGroup *dg = defgroup_find_name(ob, value);
+ if (dg) {
+ BLI_strncpy(result,
+ value,
+ maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
+ return;
+ }
- result[0] = '\0';
+ result[0] = '\0';
}
static void rna_FaceMap_name_set(PointerRNA *ptr, const char *value)
{
- Object *ob = (Object *)ptr->id.data;
- bFaceMap *fmap = (bFaceMap *)ptr->data;
- BLI_strncpy_utf8(fmap->name, value, sizeof(fmap->name));
- BKE_object_facemap_unique_name(ob, fmap);
+ Object *ob = (Object *)ptr->id.data;
+ bFaceMap *fmap = (bFaceMap *)ptr->data;
+ BLI_strncpy_utf8(fmap->name, value, sizeof(fmap->name));
+ BKE_object_facemap_unique_name(ob, fmap);
}
static int rna_FaceMap_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- return BLI_findindex(&ob->fmaps, ptr->data);
+ return BLI_findindex(&ob->fmaps, ptr->data);
}
static PointerRNA rna_Object_active_face_map_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_FaceMap, BLI_findlink(&ob->fmaps, ob->actfmap - 1));
+ Object *ob = (Object *)ptr->id.data;
+ return rna_pointer_inherit_refine(ptr, &RNA_FaceMap, BLI_findlink(&ob->fmaps, ob->actfmap - 1));
}
static int rna_Object_active_face_map_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return ob->actfmap - 1;
+ Object *ob = (Object *)ptr->id.data;
+ return ob->actfmap - 1;
}
static void rna_Object_active_face_map_index_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
- ob->actfmap = value + 1;
+ Object *ob = (Object *)ptr->id.data;
+ ob->actfmap = value + 1;
}
-static void rna_Object_active_face_map_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Object_active_face_map_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&ob->fmaps) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&ob->fmaps) - 1);
}
void rna_object_BKE_object_facemap_name_index_get(PointerRNA *ptr, char *value, int index)
{
- Object *ob = (Object *)ptr->id.data;
- bFaceMap *fmap;
+ Object *ob = (Object *)ptr->id.data;
+ bFaceMap *fmap;
- fmap = BLI_findlink(&ob->fmaps, index - 1);
+ fmap = BLI_findlink(&ob->fmaps, index - 1);
- if (fmap) BLI_strncpy(value, fmap->name, sizeof(fmap->name));
- else value[0] = '\0';
+ if (fmap)
+ BLI_strncpy(value, fmap->name, sizeof(fmap->name));
+ else
+ value[0] = '\0';
}
int rna_object_BKE_object_facemap_name_index_length(PointerRNA *ptr, int index)
{
- Object *ob = (Object *)ptr->id.data;
- bFaceMap *fmap;
+ Object *ob = (Object *)ptr->id.data;
+ bFaceMap *fmap;
- fmap = BLI_findlink(&ob->fmaps, index - 1);
- return (fmap) ? strlen(fmap->name) : 0;
+ fmap = BLI_findlink(&ob->fmaps, index - 1);
+ return (fmap) ? strlen(fmap->name) : 0;
}
void rna_object_BKE_object_facemap_name_index_set(PointerRNA *ptr, const char *value, short *index)
{
- Object *ob = (Object *)ptr->id.data;
- *index = BKE_object_facemap_name_index(ob, value) + 1;
+ Object *ob = (Object *)ptr->id.data;
+ *index = BKE_object_facemap_name_index(ob, value) + 1;
}
void rna_object_fmap_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
{
- Object *ob = (Object *)ptr->id.data;
- bFaceMap *fmap = BKE_object_facemap_find_name(ob, value);
- if (fmap) {
- BLI_strncpy(result, value, maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
- return;
- }
+ Object *ob = (Object *)ptr->id.data;
+ bFaceMap *fmap = BKE_object_facemap_find_name(ob, value);
+ if (fmap) {
+ BLI_strncpy(result,
+ value,
+ maxlen); /* no need for BLI_strncpy_utf8, since this matches an existing group */
+ return;
+ }
- result[0] = '\0';
+ result[0] = '\0';
}
-
void rna_object_uvlayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
{
- Object *ob = (Object *)ptr->id.data;
- Mesh *me;
- CustomDataLayer *layer;
- int a;
+ Object *ob = (Object *)ptr->id.data;
+ Mesh *me;
+ CustomDataLayer *layer;
+ int a;
- if (ob->type == OB_MESH && ob->data) {
- me = (Mesh *)ob->data;
+ if (ob->type == OB_MESH && ob->data) {
+ me = (Mesh *)ob->data;
- for (a = 0; a < me->ldata.totlayer; a++) {
- layer = &me->ldata.layers[a];
+ for (a = 0; a < me->ldata.totlayer; a++) {
+ layer = &me->ldata.layers[a];
- if (layer->type == CD_MLOOPUV && STREQ(layer->name, value)) {
- BLI_strncpy(result, value, maxlen);
- return;
- }
- }
- }
+ if (layer->type == CD_MLOOPUV && STREQ(layer->name, value)) {
+ BLI_strncpy(result, value, maxlen);
+ return;
+ }
+ }
+ }
- result[0] = '\0';
+ result[0] = '\0';
}
void rna_object_vcollayer_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
{
- Object *ob = (Object *)ptr->id.data;
- Mesh *me;
- CustomDataLayer *layer;
- int a;
+ Object *ob = (Object *)ptr->id.data;
+ Mesh *me;
+ CustomDataLayer *layer;
+ int a;
- if (ob->type == OB_MESH && ob->data) {
- me = (Mesh *)ob->data;
+ if (ob->type == OB_MESH && ob->data) {
+ me = (Mesh *)ob->data;
- for (a = 0; a < me->fdata.totlayer; a++) {
- layer = &me->fdata.layers[a];
+ for (a = 0; a < me->fdata.totlayer; a++) {
+ layer = &me->fdata.layers[a];
- if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
- BLI_strncpy(result, value, maxlen);
- return;
- }
- }
- }
+ if (layer->type == CD_MCOL && STREQ(layer->name, value)) {
+ BLI_strncpy(result, value, maxlen);
+ return;
+ }
+ }
+ }
- result[0] = '\0';
+ result[0] = '\0';
}
static int rna_Object_active_material_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return MAX2(ob->actcol - 1, 0);
+ Object *ob = (Object *)ptr->id.data;
+ return MAX2(ob->actcol - 1, 0);
}
static void rna_Object_active_material_index_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
- ob->actcol = value + 1;
+ Object *ob = (Object *)ptr->id.data;
+ ob->actcol = value + 1;
- if (ob->type == OB_MESH) {
- Mesh *me = ob->data;
+ if (ob->type == OB_MESH) {
+ Mesh *me = ob->data;
- if (me->edit_mesh)
- me->edit_mesh->mat_nr = value;
- }
+ if (me->edit_mesh)
+ me->edit_mesh->mat_nr = value;
+ }
}
-static void rna_Object_active_material_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Object_active_material_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = (Object *)ptr->id.data;
- *min = 0;
- *max = max_ii(ob->totcol - 1, 0);
+ Object *ob = (Object *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(ob->totcol - 1, 0);
}
/* returns active base material */
static PointerRNA rna_Object_active_material_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- Material *ma;
+ Object *ob = (Object *)ptr->id.data;
+ Material *ma;
- ma = (ob->totcol) ? give_current_material(ob, ob->actcol) : NULL;
- return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
+ ma = (ob->totcol) ? give_current_material(ob, ob->actcol) : NULL;
+ return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
}
static void rna_Object_active_material_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- DEG_id_tag_update(value.data, 0);
- BLI_assert(BKE_id_is_in_global_main(&ob->id));
- BLI_assert(BKE_id_is_in_global_main(value.data));
- assign_material(G_MAIN, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
+ DEG_id_tag_update(value.data, 0);
+ BLI_assert(BKE_id_is_in_global_main(&ob->id));
+ BLI_assert(BKE_id_is_in_global_main(value.data));
+ assign_material(G_MAIN, ob, value.data, ob->actcol, BKE_MAT_ASSIGN_EXISTING);
- if (ob && ob->type == OB_GPENCIL) {
- /* notifying material property in topbar */
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
- }
+ if (ob && ob->type == OB_GPENCIL) {
+ /* notifying material property in topbar */
+ WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ }
}
static int rna_Object_active_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- Object *ob = (Object *)ptr->id.data;
- bool is_editable;
+ Object *ob = (Object *)ptr->id.data;
+ bool is_editable;
- if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
- is_editable = !ID_IS_LINKED(ob);
- }
- else {
- is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
- }
+ if ((ob->matbits == NULL) || (ob->actcol == 0) || ob->matbits[ob->actcol - 1]) {
+ is_editable = !ID_IS_LINKED(ob);
+ }
+ else {
+ is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
+ }
- return is_editable ? PROP_EDITABLE : 0;
+ return is_editable ? PROP_EDITABLE : 0;
}
-
-static void rna_Object_active_particle_system_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Object_active_particle_system_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = (Object *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
+ Object *ob = (Object *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&ob->particlesystem) - 1);
}
static int rna_Object_active_particle_system_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- return psys_get_current_num(ob);
+ Object *ob = (Object *)ptr->id.data;
+ return psys_get_current_num(ob);
}
static void rna_Object_active_particle_system_index_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
- psys_set_current_num(ob, value);
+ Object *ob = (Object *)ptr->id.data;
+ psys_set_current_num(ob, value);
}
static void rna_Object_particle_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
- /* TODO: Disabled for now, because bContext is not available. */
-#if 0
- Object *ob = (Object *)ptr->id.data;
- PE_current_changed(NULL, scene, ob);
-#else
- (void) scene;
- (void) ptr;
-#endif
+ /* TODO: Disabled for now, because bContext is not available. */
+# if 0
+ Object *ob = (Object *)ptr->id.data;
+ PE_current_changed(NULL, scene, ob);
+# else
+ (void)scene;
+ (void)ptr;
+# endif
}
/* rotation - axis-angle */
static void rna_Object_rotation_axis_angle_get(PointerRNA *ptr, float *value)
{
- Object *ob = ptr->data;
+ Object *ob = ptr->data;
- /* for now, assume that rotation mode is axis-angle */
- value[0] = ob->rotAngle;
- copy_v3_v3(&value[1], ob->rotAxis);
+ /* for now, assume that rotation mode is axis-angle */
+ value[0] = ob->rotAngle;
+ copy_v3_v3(&value[1], ob->rotAxis);
}
/* rotation - axis-angle */
static void rna_Object_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
{
- Object *ob = ptr->data;
+ Object *ob = ptr->data;
- /* for now, assume that rotation mode is axis-angle */
- ob->rotAngle = value[0];
- copy_v3_v3(ob->rotAxis, &value[1]);
+ /* for now, assume that rotation mode is axis-angle */
+ ob->rotAngle = value[0];
+ copy_v3_v3(ob->rotAxis, &value[1]);
- /* TODO: validate axis? */
+ /* TODO: validate axis? */
}
static void rna_Object_rotation_mode_set(PointerRNA *ptr, int value)
{
- Object *ob = ptr->data;
+ Object *ob = ptr->data;
- /* use API Method for conversions... */
- BKE_rotMode_change_values(ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
+ /* use API Method for conversions... */
+ BKE_rotMode_change_values(
+ ob->quat, ob->rot, ob->rotAxis, &ob->rotAngle, ob->rotmode, (short)value);
- /* finally, set the new rotation type */
- ob->rotmode = value;
+ /* finally, set the new rotation type */
+ ob->rotmode = value;
}
static void rna_Object_dimensions_get(PointerRNA *ptr, float *value)
{
- Object *ob = ptr->data;
- BKE_object_dimensions_get(ob, value);
+ Object *ob = ptr->data;
+ BKE_object_dimensions_get(ob, value);
}
static void rna_Object_dimensions_set(PointerRNA *ptr, const float *value)
{
- Object *ob = ptr->data;
- BKE_object_dimensions_set(ob, value, 0);
+ Object *ob = ptr->data;
+ BKE_object_dimensions_set(ob, value, 0);
}
static int rna_Object_location_editable(PointerRNA *ptr, int index)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX))
- return 0;
- else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY))
- return 0;
- else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ))
- return 0;
- else
- return PROP_EDITABLE;
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (ob->protectflag & OB_LOCK_LOCX))
+ return 0;
+ else if ((index == 1) && (ob->protectflag & OB_LOCK_LOCY))
+ return 0;
+ else if ((index == 2) && (ob->protectflag & OB_LOCK_LOCZ))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static int rna_Object_scale_editable(PointerRNA *ptr, int index)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX))
- return 0;
- else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY))
- return 0;
- else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ))
- return 0;
- else
- return PROP_EDITABLE;
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (ob->protectflag & OB_LOCK_SCALEX))
+ return 0;
+ else if ((index == 1) && (ob->protectflag & OB_LOCK_SCALEY))
+ return 0;
+ else if ((index == 2) && (ob->protectflag & OB_LOCK_SCALEZ))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static int rna_Object_rotation_euler_editable(PointerRNA *ptr, int index)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX))
- return 0;
- else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY))
- return 0;
- else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ))
- return 0;
- else
- return PROP_EDITABLE;
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (ob->protectflag & OB_LOCK_ROTX))
+ return 0;
+ else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTY))
+ return 0;
+ else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTZ))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static int rna_Object_rotation_4d_editable(PointerRNA *ptr, int index)
{
- Object *ob = (Object *)ptr->data;
+ Object *ob = (Object *)ptr->data;
- /* only consider locks if locking components individually... */
- if (ob->protectflag & OB_LOCK_ROT4D) {
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW))
- return 0;
- else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX))
- return 0;
- else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY))
- return 0;
- else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ))
- return 0;
- }
+ /* only consider locks if locking components individually... */
+ if (ob->protectflag & OB_LOCK_ROT4D) {
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (ob->protectflag & OB_LOCK_ROTW))
+ return 0;
+ else if ((index == 1) && (ob->protectflag & OB_LOCK_ROTX))
+ return 0;
+ else if ((index == 2) && (ob->protectflag & OB_LOCK_ROTY))
+ return 0;
+ else if ((index == 3) && (ob->protectflag & OB_LOCK_ROTZ))
+ return 0;
+ }
- return PROP_EDITABLE;
+ return PROP_EDITABLE;
}
static int rna_MaterialSlot_material_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- Object *ob = (Object *)ptr->id.data;
- const int index = (Material **)ptr->data - ob->mat;
- bool is_editable;
+ Object *ob = (Object *)ptr->id.data;
+ const int index = (Material **)ptr->data - ob->mat;
+ bool is_editable;
- if ((ob->matbits == NULL) || ob->matbits[index]) {
- is_editable = !ID_IS_LINKED(ob);
- }
- else {
- is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
- }
+ if ((ob->matbits == NULL) || ob->matbits[index]) {
+ is_editable = !ID_IS_LINKED(ob);
+ }
+ else {
+ is_editable = ob->data ? !ID_IS_LINKED(ob->data) : false;
+ }
- return is_editable ? PROP_EDITABLE : 0;
+ return is_editable ? PROP_EDITABLE : 0;
}
static PointerRNA rna_MaterialSlot_material_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- Material *ma;
- const int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ Material *ma;
+ const int index = (Material **)ptr->data - ob->mat;
- ma = give_current_material(ob, index + 1);
- return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
+ ma = give_current_material(ob, index + 1);
+ return rna_pointer_inherit_refine(ptr, &RNA_Material, ma);
}
static void rna_MaterialSlot_material_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->id.data;
- int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ int index = (Material **)ptr->data - ob->mat;
- BLI_assert(BKE_id_is_in_global_main(&ob->id));
- BLI_assert(BKE_id_is_in_global_main(value.data));
- assign_material(G_MAIN, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
+ BLI_assert(BKE_id_is_in_global_main(&ob->id));
+ BLI_assert(BKE_id_is_in_global_main(value.data));
+ assign_material(G_MAIN, ob, value.data, index + 1, BKE_MAT_ASSIGN_EXISTING);
}
static bool rna_MaterialSlot_material_poll(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->id.data;
- Material *ma = (Material *)value.data;
+ Object *ob = (Object *)ptr->id.data;
+ Material *ma = (Material *)value.data;
- if (ob->type == OB_GPENCIL) {
- /* GP Materials only */
- return (ma->gp_style != NULL);
- }
- else {
- /* Everything except GP materials */
- return (ma->gp_style == NULL);
- }
+ if (ob->type == OB_GPENCIL) {
+ /* GP Materials only */
+ return (ma->gp_style != NULL);
+ }
+ else {
+ /* Everything except GP materials */
+ return (ma->gp_style == NULL);
+ }
}
static int rna_MaterialSlot_link_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ int index = (Material **)ptr->data - ob->mat;
- return ob->matbits[index] != 0;
+ return ob->matbits[index] != 0;
}
static void rna_MaterialSlot_link_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
- int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ int index = (Material **)ptr->data - ob->mat;
- if (value) {
- ob->matbits[index] = 1;
- /* ob->colbits |= (1 << index); */ /* DEPRECATED */
- }
- else {
- ob->matbits[index] = 0;
- /* ob->colbits &= ~(1 << index); */ /* DEPRECATED */
- }
+ if (value) {
+ ob->matbits[index] = 1;
+ /* ob->colbits |= (1 << index); */ /* DEPRECATED */
+ }
+ else {
+ ob->matbits[index] = 0;
+ /* ob->colbits &= ~(1 << index); */ /* DEPRECATED */
+ }
}
static int rna_MaterialSlot_name_length(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- Material *ma;
- int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ Material *ma;
+ int index = (Material **)ptr->data - ob->mat;
- ma = give_current_material(ob, index + 1);
+ ma = give_current_material(ob, index + 1);
- if (ma)
- return strlen(ma->id.name + 2);
+ if (ma)
+ return strlen(ma->id.name + 2);
- return 0;
+ return 0;
}
static void rna_MaterialSlot_name_get(PointerRNA *ptr, char *str)
{
- Object *ob = (Object *)ptr->id.data;
- Material *ma;
- int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ Material *ma;
+ int index = (Material **)ptr->data - ob->mat;
- ma = give_current_material(ob, index + 1);
+ ma = give_current_material(ob, index + 1);
- if (ma)
- strcpy(str, ma->id.name + 2);
- else
- str[0] = '\0';
+ if (ma)
+ strcpy(str, ma->id.name + 2);
+ else
+ str[0] = '\0';
}
static void rna_MaterialSlot_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_Object_internal_update(bmain, scene, ptr);
+ rna_Object_internal_update(bmain, scene, ptr);
- WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
- DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_OB_SHADING, ptr->id.data);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_LINKS, NULL);
+ DEG_relations_tag_update(bmain);
}
static char *rna_MaterialSlot_path(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- int index = (Material **)ptr->data - ob->mat;
+ Object *ob = (Object *)ptr->id.data;
+ int index = (Material **)ptr->data - ob->mat;
- return BLI_sprintfN("material_slots[%d]", index);
+ return BLI_sprintfN("material_slots[%d]", index);
}
static PointerRNA rna_Object_display_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ObjectDisplay, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_ObjectDisplay, ptr->data);
}
static char *rna_ObjectDisplay_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("display");
+ return BLI_strdup("display");
}
static PointerRNA rna_Object_active_particle_system_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ParticleSystem *psys = psys_get_current(ob);
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystem *psys = psys_get_current(ob);
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleSystem, psys);
}
-static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Object_active_shape_key_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = (Object *)ptr->id.data;
- Key *key = BKE_key_from_object(ob);
+ Object *ob = (Object *)ptr->id.data;
+ Key *key = BKE_key_from_object(ob);
- *min = 0;
- if (key) {
- *max = BLI_listbase_count(&key->block) - 1;
- if (*max < 0) *max = 0;
- }
- else {
- *max = 0;
- }
+ *min = 0;
+ if (key) {
+ *max = BLI_listbase_count(&key->block) - 1;
+ if (*max < 0)
+ *max = 0;
+ }
+ else {
+ *max = 0;
+ }
}
static int rna_Object_active_shape_key_index_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- return MAX2(ob->shapenr - 1, 0);
+ return MAX2(ob->shapenr - 1, 0);
}
static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- ob->shapenr = value + 1;
+ ob->shapenr = value + 1;
}
static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- Key *key = BKE_key_from_object(ob);
- KeyBlock *kb;
- PointerRNA keyptr;
+ Object *ob = (Object *)ptr->id.data;
+ Key *key = BKE_key_from_object(ob);
+ KeyBlock *kb;
+ PointerRNA keyptr;
- if (key == NULL)
- return PointerRNA_NULL;
+ if (key == NULL)
+ return PointerRNA_NULL;
- kb = BLI_findlink(&key->block, ob->shapenr - 1);
- RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
- return keyptr;
+ kb = BLI_findlink(&key->block, ob->shapenr - 1);
+ RNA_pointer_create((ID *)key, &RNA_ShapeKey, kb, &keyptr);
+ return keyptr;
}
static PointerRNA rna_Object_field_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- /* weak */
- if (!ob->pd)
- ob->pd = BKE_partdeflect_new(0);
+ /* weak */
+ if (!ob->pd)
+ ob->pd = BKE_partdeflect_new(0);
- return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
+ return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, ob->pd);
}
static PointerRNA rna_Object_collision_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- if (ob->type != OB_MESH)
- return PointerRNA_NULL;
+ if (ob->type != OB_MESH)
+ return PointerRNA_NULL;
- /* weak */
- if (!ob->pd)
- ob->pd = BKE_partdeflect_new(0);
+ /* weak */
+ if (!ob->pd)
+ ob->pd = BKE_partdeflect_new(0);
- return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
+ return rna_pointer_inherit_refine(ptr, &RNA_CollisionSettings, ob->pd);
}
static PointerRNA rna_Object_active_constraint_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- bConstraint *con = BKE_constraints_active_get(&ob->constraints);
- return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
+ Object *ob = (Object *)ptr->id.data;
+ bConstraint *con = BKE_constraints_active_get(&ob->constraints);
+ return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
}
static void rna_Object_active_constraint_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->id.data;
- BKE_constraints_active_set(&ob->constraints, (bConstraint *)value.data);
+ Object *ob = (Object *)ptr->id.data;
+ BKE_constraints_active_set(&ob->constraints, (bConstraint *)value.data);
}
static bConstraint *rna_Object_constraints_new(Object *object, Main *bmain, int type)
{
- bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type);
+ bConstraint *new_con = BKE_constraint_add_for_object(object, NULL, type);
- ED_object_constraint_tag_update(bmain, object, new_con);
- WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
+ ED_object_constraint_tag_update(bmain, object, new_con);
+ WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, object);
- return new_con;
+ return new_con;
}
-static void rna_Object_constraints_remove(Object *object, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
+static void rna_Object_constraints_remove(Object *object,
+ Main *bmain,
+ ReportList *reports,
+ PointerRNA *con_ptr)
{
- bConstraint *con = con_ptr->data;
- if (BLI_findindex(&object->constraints, con) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in object '%s'", con->name, object->id.name + 2);
- return;
- }
+ bConstraint *con = con_ptr->data;
+ if (BLI_findindex(&object->constraints, con) == -1) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Constraint '%s' not found in object '%s'",
+ con->name,
+ object->id.name + 2);
+ return;
+ }
- BKE_constraint_remove(&object->constraints, con);
- RNA_POINTER_INVALIDATE(con_ptr);
+ BKE_constraint_remove(&object->constraints, con);
+ RNA_POINTER_INVALIDATE(con_ptr);
- ED_object_constraint_update(bmain, object);
- ED_object_constraint_set_active(object, NULL);
- WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
+ ED_object_constraint_update(bmain, object);
+ ED_object_constraint_set_active(object, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
}
static void rna_Object_constraints_clear(Object *object, Main *bmain)
{
- BKE_constraints_free(&object->constraints);
+ BKE_constraints_free(&object->constraints);
- ED_object_constraint_update(bmain, object);
- ED_object_constraint_set_active(object, NULL);
+ ED_object_constraint_update(bmain, object);
+ ED_object_constraint_set_active(object, NULL);
- WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
+ WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, object);
}
-bool rna_Object_constraints_override_apply(
- Main *UNUSED(bmain),
- PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
- const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
- PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
+bool rna_Object_constraints_override_apply(Main *UNUSED(bmain),
+ PointerRNA *ptr_dst,
+ PointerRNA *ptr_src,
+ PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *UNUSED(prop_src),
+ PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst),
+ const int UNUSED(len_src),
+ const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst),
+ PointerRNA *UNUSED(ptr_item_src),
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
{
- BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
- "Unsupported RNA override operation on constraints collection");
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
+ "Unsupported RNA override operation on constraints collection");
- Object *ob_dst = (Object *)ptr_dst->id.data;
- Object *ob_src = (Object *)ptr_src->id.data;
+ Object *ob_dst = (Object *)ptr_dst->id.data;
+ Object *ob_src = (Object *)ptr_src->id.data;
- /* Remember that insertion operations are defined and stored in correct order, which means that
- * even if we insert several items in a row, we alays insert first one, then second one, etc.
- * So we should always find 'anchor' constraint in both _src *and* _dst> */
- bConstraint *con_anchor = NULL;
- if (opop->subitem_local_name && opop->subitem_local_name[0]) {
- con_anchor = BLI_findstring(&ob_dst->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
- }
- if (con_anchor == NULL && opop->subitem_local_index >= 0) {
- con_anchor = BLI_findlink(&ob_dst->constraints, opop->subitem_local_index);
- }
- /* Otherwise we just insert in first position. */
+ /* Remember that insertion operations are defined and stored in correct order, which means that
+ * even if we insert several items in a row, we alays insert first one, then second one, etc.
+ * So we should always find 'anchor' constraint in both _src *and* _dst> */
+ bConstraint *con_anchor = NULL;
+ if (opop->subitem_local_name && opop->subitem_local_name[0]) {
+ con_anchor = BLI_findstring(
+ &ob_dst->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
+ }
+ if (con_anchor == NULL && opop->subitem_local_index >= 0) {
+ con_anchor = BLI_findlink(&ob_dst->constraints, opop->subitem_local_index);
+ }
+ /* Otherwise we just insert in first position. */
- bConstraint *con_src = NULL;
- if (opop->subitem_local_name && opop->subitem_local_name[0]) {
- con_src = BLI_findstring(&ob_src->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
- }
- if (con_src == NULL && opop->subitem_local_index >= 0) {
- con_src = BLI_findlink(&ob_src->constraints, opop->subitem_local_index);
- }
- con_src = con_src ? con_src->next : ob_src->constraints.first;
+ bConstraint *con_src = NULL;
+ if (opop->subitem_local_name && opop->subitem_local_name[0]) {
+ con_src = BLI_findstring(
+ &ob_src->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
+ }
+ if (con_src == NULL && opop->subitem_local_index >= 0) {
+ con_src = BLI_findlink(&ob_src->constraints, opop->subitem_local_index);
+ }
+ con_src = con_src ? con_src->next : ob_src->constraints.first;
- BLI_assert(con_src != NULL);
+ BLI_assert(con_src != NULL);
- bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
+ bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
- /* This handles NULL anchor as expected by adding at head of list. */
- BLI_insertlinkafter(&ob_dst->constraints, con_anchor, con_dst);
+ /* This handles NULL anchor as expected by adding at head of list. */
+ BLI_insertlinkafter(&ob_dst->constraints, con_anchor, con_dst);
- /* This should actually *not* be needed in typical cases. However, if overridden source was edited,
- * we *may* have some new conflicting names. */
- BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
+ /* This should actually *not* be needed in typical cases. However, if overridden source was edited,
+ * we *may* have some new conflicting names. */
+ BKE_constraint_unique_name(con_dst, &ob_dst->constraints);
-// printf("%s: We inserted a constraint...\n", __func__);
- return true;
+ // printf("%s: We inserted a constraint...\n", __func__);
+ return true;
}
-static ModifierData *rna_Object_modifier_new(Object *object, bContext *C, ReportList *reports,
- const char *name, int type)
+static ModifierData *rna_Object_modifier_new(
+ Object *object, bContext *C, ReportList *reports, const char *name, int type)
{
- return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
+ return ED_object_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
}
-static void rna_Object_modifier_remove(Object *object, bContext *C, ReportList *reports, PointerRNA *md_ptr)
+static void rna_Object_modifier_remove(Object *object,
+ bContext *C,
+ ReportList *reports,
+ PointerRNA *md_ptr)
{
- ModifierData *md = md_ptr->data;
- if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == false) {
- /* error is already set */
- return;
- }
+ ModifierData *md = md_ptr->data;
+ if (ED_object_modifier_remove(reports, CTX_data_main(C), object, md) == false) {
+ /* error is already set */
+ return;
+ }
- RNA_POINTER_INVALIDATE(md_ptr);
+ RNA_POINTER_INVALIDATE(md_ptr);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
}
static void rna_Object_modifier_clear(Object *object, bContext *C)
{
- ED_object_modifier_clear(CTX_data_main(C), object);
-
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
-}
-
-bool rna_Object_modifiers_override_apply(
- Main *UNUSED(bmain),
- PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
- const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
- PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
-{
- BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
- "Unsupported RNA override operation on modifiers collection");
-
- Object *ob_dst = (Object *)ptr_dst->id.data;
- Object *ob_src = (Object *)ptr_src->id.data;
-
- /* Remember that insertion operations are defined and stored in correct order, which means that
- * even if we insert several items in a row, we alays insert first one, then second one, etc.
- * So we should always find 'anchor' constraint in both _src *and* _dst> */
- ModifierData *mod_anchor = NULL;
- if (opop->subitem_local_name && opop->subitem_local_name[0]) {
- mod_anchor = BLI_findstring(&ob_dst->modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
- }
- if (mod_anchor == NULL && opop->subitem_local_index >= 0) {
- mod_anchor = BLI_findlink(&ob_dst->modifiers, opop->subitem_local_index);
- }
- /* Otherwise we just insert in first position. */
-
- ModifierData *mod_src = NULL;
- if (opop->subitem_local_name && opop->subitem_local_name[0]) {
- mod_src = BLI_findstring(&ob_src->modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
- }
- if (mod_src == NULL && opop->subitem_local_index >= 0) {
- mod_src = BLI_findlink(&ob_src->modifiers, opop->subitem_local_index);
- }
- mod_src = mod_src ? mod_src->next : ob_src->modifiers.first;
-
- BLI_assert(mod_src != NULL);
-
- ModifierData *mod_dst = modifier_new(mod_src->type);
- modifier_copyData(mod_src, mod_dst);
-
- /* This handles NULL anchor as expected by adding at head of list. */
- BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
-
- /* This should actually *not* be needed in typical cases. However, if overridden source was edited,
- * we *may* have some new conflicting names. */
- modifier_unique_name(&ob_dst->modifiers, mod_dst);
-
-// printf("%s: We inserted a modifier...\n", __func__);
- return true;
+ ED_object_modifier_clear(CTX_data_main(C), object);
+
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
+}
+
+bool rna_Object_modifiers_override_apply(Main *UNUSED(bmain),
+ PointerRNA *ptr_dst,
+ PointerRNA *ptr_src,
+ PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *UNUSED(prop_src),
+ PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst),
+ const int UNUSED(len_src),
+ const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst),
+ PointerRNA *UNUSED(ptr_item_src),
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
+{
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
+ "Unsupported RNA override operation on modifiers collection");
+
+ Object *ob_dst = (Object *)ptr_dst->id.data;
+ Object *ob_src = (Object *)ptr_src->id.data;
+
+ /* Remember that insertion operations are defined and stored in correct order, which means that
+ * even if we insert several items in a row, we alays insert first one, then second one, etc.
+ * So we should always find 'anchor' constraint in both _src *and* _dst> */
+ ModifierData *mod_anchor = NULL;
+ if (opop->subitem_local_name && opop->subitem_local_name[0]) {
+ mod_anchor = BLI_findstring(
+ &ob_dst->modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
+ }
+ if (mod_anchor == NULL && opop->subitem_local_index >= 0) {
+ mod_anchor = BLI_findlink(&ob_dst->modifiers, opop->subitem_local_index);
+ }
+ /* Otherwise we just insert in first position. */
+
+ ModifierData *mod_src = NULL;
+ if (opop->subitem_local_name && opop->subitem_local_name[0]) {
+ mod_src = BLI_findstring(
+ &ob_src->modifiers, opop->subitem_local_name, offsetof(ModifierData, name));
+ }
+ if (mod_src == NULL && opop->subitem_local_index >= 0) {
+ mod_src = BLI_findlink(&ob_src->modifiers, opop->subitem_local_index);
+ }
+ mod_src = mod_src ? mod_src->next : ob_src->modifiers.first;
+
+ BLI_assert(mod_src != NULL);
+
+ ModifierData *mod_dst = modifier_new(mod_src->type);
+ modifier_copyData(mod_src, mod_dst);
+
+ /* This handles NULL anchor as expected by adding at head of list. */
+ BLI_insertlinkafter(&ob_dst->modifiers, mod_anchor, mod_dst);
+
+ /* This should actually *not* be needed in typical cases. However, if overridden source was edited,
+ * we *may* have some new conflicting names. */
+ modifier_unique_name(&ob_dst->modifiers, mod_dst);
+
+ // printf("%s: We inserted a modifier...\n", __func__);
+ return true;
}
static GpencilModifierData *rna_Object_greasepencil_modifier_new(
- Object *object, bContext *C, ReportList *reports,
- const char *name, int type)
+ Object *object, bContext *C, ReportList *reports, const char *name, int type)
{
- return ED_object_gpencil_modifier_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
+ return ED_object_gpencil_modifier_add(
+ reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
}
-static void rna_Object_greasepencil_modifier_remove(
- Object *object, bContext *C, ReportList *reports, PointerRNA *gmd_ptr)
+static void rna_Object_greasepencil_modifier_remove(Object *object,
+ bContext *C,
+ ReportList *reports,
+ PointerRNA *gmd_ptr)
{
- GpencilModifierData *gmd = gmd_ptr->data;
- if (ED_object_gpencil_modifier_remove(reports, CTX_data_main(C), object, gmd) == false) {
- /* error is already set */
- return;
- }
+ GpencilModifierData *gmd = gmd_ptr->data;
+ if (ED_object_gpencil_modifier_remove(reports, CTX_data_main(C), object, gmd) == false) {
+ /* error is already set */
+ return;
+ }
- RNA_POINTER_INVALIDATE(gmd_ptr);
+ RNA_POINTER_INVALIDATE(gmd_ptr);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
}
static void rna_Object_greasepencil_modifier_clear(Object *object, bContext *C)
{
- ED_object_gpencil_modifier_clear(CTX_data_main(C), object);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
+ ED_object_gpencil_modifier_clear(CTX_data_main(C), object);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
}
/* shader fx */
static ShaderFxData *rna_Object_shaderfx_new(
- Object *object, bContext *C, ReportList *reports,
- const char *name, int type)
+ Object *object, bContext *C, ReportList *reports, const char *name, int type)
{
- return ED_object_shaderfx_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
+ return ED_object_shaderfx_add(reports, CTX_data_main(C), CTX_data_scene(C), object, name, type);
}
-static void rna_Object_shaderfx_remove(
- Object *object, bContext *C, ReportList *reports, PointerRNA *gmd_ptr)
+static void rna_Object_shaderfx_remove(Object *object,
+ bContext *C,
+ ReportList *reports,
+ PointerRNA *gmd_ptr)
{
- ShaderFxData *gmd = gmd_ptr->data;
- if (ED_object_shaderfx_remove(reports, CTX_data_main(C), object, gmd) == false) {
- /* error is already set */
- return;
- }
+ ShaderFxData *gmd = gmd_ptr->data;
+ if (ED_object_shaderfx_remove(reports, CTX_data_main(C), object, gmd) == false) {
+ /* error is already set */
+ return;
+ }
- RNA_POINTER_INVALIDATE(gmd_ptr);
+ RNA_POINTER_INVALIDATE(gmd_ptr);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
}
static void rna_Object_shaderfx_clear(Object *object, bContext *C)
{
- ED_object_shaderfx_clear(CTX_data_main(C), object);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
+ ED_object_shaderfx_clear(CTX_data_main(C), object);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, object);
}
static void rna_Object_boundbox_get(PointerRNA *ptr, float *values)
{
- Object *ob = (Object *)ptr->id.data;
- BoundBox *bb = BKE_object_boundbox_get(ob);
- if (bb) {
- memcpy(values, bb->vec, sizeof(bb->vec));
- }
- else {
- copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
- }
-
+ Object *ob = (Object *)ptr->id.data;
+ BoundBox *bb = BKE_object_boundbox_get(ob);
+ if (bb) {
+ memcpy(values, bb->vec, sizeof(bb->vec));
+ }
+ else {
+ copy_vn_fl(values, sizeof(bb->vec) / sizeof(float), 0.0f);
+ }
}
static bDeformGroup *rna_Object_vgroup_new(Object *ob, const char *name)
{
- bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
+ bDeformGroup *defgroup = BKE_object_defgroup_add_name(ob, name);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- return defgroup;
+ return defgroup;
}
static void rna_Object_vgroup_remove(Object *ob, ReportList *reports, PointerRNA *defgroup_ptr)
{
- bDeformGroup *defgroup = defgroup_ptr->data;
- if (BLI_findindex(&ob->defbase, defgroup) == -1) {
- BKE_reportf(reports, RPT_ERROR, "DeformGroup '%s' not in object '%s'", defgroup->name, ob->id.name + 2);
- return;
- }
+ bDeformGroup *defgroup = defgroup_ptr->data;
+ if (BLI_findindex(&ob->defbase, defgroup) == -1) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "DeformGroup '%s' not in object '%s'",
+ defgroup->name,
+ ob->id.name + 2);
+ return;
+ }
- BKE_object_defgroup_remove(ob, defgroup);
- RNA_POINTER_INVALIDATE(defgroup_ptr);
+ BKE_object_defgroup_remove(ob, defgroup);
+ RNA_POINTER_INVALIDATE(defgroup_ptr);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
static void rna_Object_vgroup_clear(Object *ob)
{
- BKE_object_defgroup_remove_all(ob);
+ BKE_object_defgroup_remove_all(ob);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
-static void rna_VertexGroup_vertex_add(ID *id, bDeformGroup *def, ReportList *reports, int index_len,
- int *index, float weight, int assignmode)
+static void rna_VertexGroup_vertex_add(ID *id,
+ bDeformGroup *def,
+ ReportList *reports,
+ int index_len,
+ int *index,
+ float weight,
+ int assignmode)
{
- Object *ob = (Object *)id;
+ Object *ob = (Object *)id;
- if (BKE_object_is_in_editmode_vgroup(ob)) {
- BKE_report(reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
- return;
- }
+ if (BKE_object_is_in_editmode_vgroup(ob)) {
+ BKE_report(
+ reports, RPT_ERROR, "VertexGroup.add(): cannot be called while object is in edit mode");
+ return;
+ }
- while (index_len--)
- ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
+ while (index_len--)
+ ED_vgroup_vert_add(
+ ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
}
-static void rna_VertexGroup_vertex_remove(ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
+static void rna_VertexGroup_vertex_remove(
+ ID *id, bDeformGroup *dg, ReportList *reports, int index_len, int *index)
{
- Object *ob = (Object *)id;
+ Object *ob = (Object *)id;
- if (BKE_object_is_in_editmode_vgroup(ob)) {
- BKE_report(reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
- return;
- }
+ if (BKE_object_is_in_editmode_vgroup(ob)) {
+ BKE_report(
+ reports, RPT_ERROR, "VertexGroup.remove(): cannot be called while object is in edit mode");
+ return;
+ }
- while (index_len--)
- ED_vgroup_vert_remove(ob, dg, *index++);
+ while (index_len--)
+ ED_vgroup_vert_remove(ob, dg, *index++);
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
}
static float rna_VertexGroup_weight(ID *id, bDeformGroup *dg, ReportList *reports, int index)
{
- float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
+ float weight = ED_vgroup_vert_weight((Object *)id, dg, index);
- if (weight < 0) {
- BKE_report(reports, RPT_ERROR, "Vertex not in group");
- }
- return weight;
+ if (weight < 0) {
+ BKE_report(reports, RPT_ERROR, "Vertex not in group");
+ }
+ return weight;
}
static bFaceMap *rna_Object_fmap_new(Object *ob, const char *name)
{
- bFaceMap *fmap = BKE_object_facemap_add_name(ob, name);
+ bFaceMap *fmap = BKE_object_facemap_add_name(ob, name);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- return fmap;
+ return fmap;
}
static void rna_Object_fmap_remove(Object *ob, ReportList *reports, PointerRNA *fmap_ptr)
{
- bFaceMap *fmap = fmap_ptr->data;
- if (BLI_findindex(&ob->fmaps, fmap) == -1) {
- BKE_reportf(reports, RPT_ERROR, "FaceMap '%s' not in object '%s'", fmap->name, ob->id.name + 2);
- return;
- }
+ bFaceMap *fmap = fmap_ptr->data;
+ if (BLI_findindex(&ob->fmaps, fmap) == -1) {
+ BKE_reportf(
+ reports, RPT_ERROR, "FaceMap '%s' not in object '%s'", fmap->name, ob->id.name + 2);
+ return;
+ }
- BKE_object_facemap_remove(ob, fmap);
- RNA_POINTER_INVALIDATE(fmap_ptr);
+ BKE_object_facemap_remove(ob, fmap);
+ RNA_POINTER_INVALIDATE(fmap_ptr);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
-
static void rna_Object_fmap_clear(Object *ob)
{
- BKE_object_facemap_clear(ob);
+ BKE_object_facemap_clear(ob);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
-
-static void rna_FaceMap_face_add(ID *id, bFaceMap *fmap, ReportList *reports, int index_len,
- int *index)
+static void rna_FaceMap_face_add(
+ ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
{
- Object *ob = (Object *)id;
+ Object *ob = (Object *)id;
- if (BKE_object_is_in_editmode(ob)) {
- BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
- return;
- }
+ if (BKE_object_is_in_editmode(ob)) {
+ BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
+ return;
+ }
- while (index_len--)
- ED_object_facemap_face_add(ob, fmap, *index++);
+ while (index_len--)
+ ED_object_facemap_face_add(ob, fmap, *index++);
- WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
}
-static void rna_FaceMap_face_remove(ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
+static void rna_FaceMap_face_remove(
+ ID *id, bFaceMap *fmap, ReportList *reports, int index_len, int *index)
{
- Object *ob = (Object *)id;
+ Object *ob = (Object *)id;
- if (BKE_object_is_in_editmode(ob)) {
- BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
- return;
- }
+ if (BKE_object_is_in_editmode(ob)) {
+ BKE_report(reports, RPT_ERROR, "FaceMap.add(): cannot be called while object is in edit mode");
+ return;
+ }
- while (index_len--)
- ED_object_facemap_face_remove(ob, fmap, *index++);
+ while (index_len--)
+ ED_object_facemap_face_remove(ob, fmap, *index++);
- WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, (ID *)ob->data);
}
/* generic poll functions */
bool rna_Lattice_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_LATTICE;
+ return ((Object *)value.id.data)->type == OB_LATTICE;
}
bool rna_Curve_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_CURVE;
+ return ((Object *)value.id.data)->type == OB_CURVE;
}
bool rna_Armature_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_ARMATURE;
+ return ((Object *)value.id.data)->type == OB_ARMATURE;
}
bool rna_Mesh_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_MESH;
+ return ((Object *)value.id.data)->type == OB_MESH;
}
bool rna_Camera_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_CAMERA;
+ return ((Object *)value.id.data)->type == OB_CAMERA;
}
bool rna_Light_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_LAMP;
+ return ((Object *)value.id.data)->type == OB_LAMP;
}
bool rna_GPencil_object_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- return ((Object *)value.id.data)->type == OB_GPENCIL;
+ return ((Object *)value.id.data)->type == OB_GPENCIL;
}
int rna_Object_use_dynamic_topology_sculpting_get(PointerRNA *ptr)
{
- SculptSession *ss = ((Object *)ptr->id.data)->sculpt;
- return (ss && ss->bm);
+ SculptSession *ss = ((Object *)ptr->id.data)->sculpt;
+ return (ss && ss->bm);
}
#else
static void rna_def_vertex_group(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem assign_mode_items[] = {
- {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
- {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
- {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "VertexGroup", NULL);
- RNA_def_struct_sdna(srna, "bDeformGroup");
- RNA_def_struct_ui_text(srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
- RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Vertex group name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
- /* update data because modifiers may use [#24761] */
- RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
- /* update data because modifiers may use [#24761] */
- RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
-
- func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
- RNA_def_function_ui_description(func, "Add vertices to the group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
- parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
- RNA_def_function_ui_description(func, "Remove a vertex from the group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
- RNA_def_function_ui_description(func, "Get a vertex weight from the group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem assign_mode_items[] = {
+ {WEIGHT_REPLACE, "REPLACE", 0, "Replace", "Replace"},
+ {WEIGHT_ADD, "ADD", 0, "Add", "Add"},
+ {WEIGHT_SUBTRACT, "SUBTRACT", 0, "Subtract", "Subtract"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "VertexGroup", NULL);
+ RNA_def_struct_sdna(srna, "bDeformGroup");
+ RNA_def_struct_ui_text(
+ srna, "Vertex Group", "Group of vertices, used for armature deform and other purposes");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_VERTEX);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Vertex group name");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_VertexGroup_name_set");
+ /* update data because modifiers may use [#24761] */
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "lock_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "", "Maintain the relative weights for the group");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", 0);
+ /* update data because modifiers may use [#24761] */
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_VertexGroup_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index number of the vertex group");
+
+ func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
+ RNA_def_function_ui_description(func, "Add vertices to the group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+ parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex from the group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "weight", "rna_VertexGroup_weight");
+ RNA_def_function_ui_description(func, "Get a vertex weight from the group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "Index", "The index of the vertex", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
+ RNA_def_function_return(func, parm);
}
static void rna_def_face_map(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "FaceMap", NULL);
- RNA_def_struct_sdna(srna, "bFaceMap");
- RNA_def_struct_ui_text(srna, "Face Map", "Group of faces, each face can only be part of one map");
- RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Face map name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FaceMap_name_set");
- /* update data because modifiers may use [#24761] */
- RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select", "Face-map selection state (for tools to use)");
- /* important not to use a notifier here, creates a feedback loop! */
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_FaceMap_index_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Index", "Index number of the face map");
-
- func = RNA_def_function(srna, "add", "rna_FaceMap_face_add");
- RNA_def_function_ui_description(func, "Add vertices to the group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "remove", "rna_FaceMap_face_remove");
- RNA_def_function_ui_description(func, "Remove a vertex from the group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
- RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "FaceMap", NULL);
+ RNA_def_struct_sdna(srna, "bFaceMap");
+ RNA_def_struct_ui_text(
+ srna, "Face Map", "Group of faces, each face can only be part of one map");
+ RNA_def_struct_ui_icon(srna, ICON_MOD_TRIANGULATE);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Face map name");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FaceMap_name_set");
+ /* update data because modifiers may use [#24761] */
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA | NA_RENAME, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Face-map selection state (for tools to use)");
+ /* important not to use a notifier here, creates a feedback loop! */
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_FaceMap_index_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Index", "Index number of the face map");
+
+ func = RNA_def_function(srna, "add", "rna_FaceMap_face_add");
+ RNA_def_function_ui_description(func, "Add vertices to the group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_FaceMap_face_remove");
+ RNA_def_function_ui_description(func, "Remove a vertex from the group");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
+ RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
}
static void rna_def_material_slot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem link_items[] = {
- {1, "OBJECT", 0, "Object", ""},
- {0, "DATA", 0, "Data", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
- * pointer data points to ob->mat + index, and we manually implement
- * get/set for the properties. */
-
- srna = RNA_def_struct(brna, "MaterialSlot", NULL);
- RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
- RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
-
- /* WARNING! Order is crucial for override to work properly here... :/
- * 'link' must come before material pointer, since it defines where (in object or obdata) that one is set! */
- prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, link_items);
- RNA_def_property_enum_funcs(prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
-
- 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_editable_func(prop, "rna_MaterialSlot_material_editable");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_pointer_funcs(prop, "rna_MaterialSlot_material_get", "rna_MaterialSlot_material_set", NULL, "rna_MaterialSlot_material_poll");
- RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Material slot name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
-
- RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem link_items[] = {
+ {1, "OBJECT", 0, "Object", ""},
+ {0, "DATA", 0, "Data", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* NOTE: there is no MaterialSlot equivalent in DNA, so the internal
+ * pointer data points to ob->mat + index, and we manually implement
+ * get/set for the properties. */
+
+ srna = RNA_def_struct(brna, "MaterialSlot", NULL);
+ RNA_def_struct_ui_text(srna, "Material Slot", "Material slot in an object");
+ RNA_def_struct_ui_icon(srna, ICON_MATERIAL_DATA);
+
+ /* WARNING! Order is crucial for override to work properly here... :/
+ * 'link' must come before material pointer, since it defines where (in object or obdata) that one is set! */
+ prop = RNA_def_property(srna, "link", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, link_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_MaterialSlot_link_get", "rna_MaterialSlot_link_set", NULL);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Link", "Link material to object or the object's data");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
+
+ 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_editable_func(prop, "rna_MaterialSlot_material_editable");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_pointer_funcs(prop,
+ "rna_MaterialSlot_material_get",
+ "rna_MaterialSlot_material_set",
+ NULL,
+ "rna_MaterialSlot_material_poll");
+ RNA_def_property_ui_text(prop, "Material", "Material data-block used by this material slot");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_MaterialSlot_name_get", "rna_MaterialSlot_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Material slot name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
+ RNA_def_struct_path_func(srna, "rna_MaterialSlot_path");
}
static void rna_def_object_constraints(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ObjectConstraints");
- srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
-
-
- /* Collection active property */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Constraint");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_constraint_get",
- "rna_Object_active_constraint_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
-
-
- /* Constraint collection */
- func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
- RNA_def_function_ui_description(func, "Add a new constraint to this object");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- /* object to add */
- parm = RNA_def_enum(func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
- RNA_def_function_ui_description(func, "Remove a constraint from this object");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- /* constraint to remove */
- parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Remove all constraint from this object");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ObjectConstraints");
+ srna = RNA_def_struct(brna, "ObjectConstraints", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Object Constraints", "Collection of object constraints");
+
+ /* Collection active property */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Constraint");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Object_active_constraint_get", "rna_Object_active_constraint_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Constraint", "Active Object constraint");
+
+ /* Constraint collection */
+ func = RNA_def_function(srna, "new", "rna_Object_constraints_new");
+ RNA_def_function_ui_description(func, "Add a new constraint to this object");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ /* object to add */
+ parm = RNA_def_enum(
+ func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Object_constraints_remove");
+ RNA_def_function_ui_description(func, "Remove a constraint from this object");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ /* constraint to remove */
+ parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_Object_constraints_clear");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Remove all constraint from this object");
}
/* object.modifiers */
static void rna_def_object_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ObjectModifiers");
- srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
-
-#if 0
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EditBone");
- RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
- /*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
-
- /* todo, redraw */
-/* RNA_def_property_collection_active(prop, prop_act); */
-#endif
-
- /* add modifier */
- func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new modifier");
- parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* modifier to add */
- parm = RNA_def_enum(func, "type", rna_enum_object_modifier_type_items, 1, "", "Modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
- RNA_def_function_return(func, parm);
-
- /* remove modifier */
- func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
- /* modifier to remove */
- parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* clear all modifiers */
- func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Remove all modifiers from the object");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ObjectModifiers");
+ srna = RNA_def_struct(brna, "ObjectModifiers", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Object Modifiers", "Collection of object modifiers");
+
+# if 0
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EditBone");
+ RNA_def_property_pointer_sdna(prop, NULL, "act_edbone");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active EditBone", "Armatures active edit bone");
+ /*RNA_def_property_update(prop, 0, "rna_Armature_act_editbone_update"); */
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Armature_act_edit_bone_set", NULL, NULL);
+
+ /* todo, redraw */
+/* RNA_def_property_collection_active(prop, prop_act); */
+# endif
+
+ /* add modifier */
+ func = RNA_def_function(srna, "new", "rna_Object_modifier_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new modifier");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* modifier to add */
+ parm = RNA_def_enum(
+ func, "type", rna_enum_object_modifier_type_items, 1, "", "Modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Newly created modifier");
+ RNA_def_function_return(func, parm);
+
+ /* remove modifier */
+ func = RNA_def_function(srna, "remove", "rna_Object_modifier_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an existing modifier from the object");
+ /* modifier to remove */
+ parm = RNA_def_pointer(func, "modifier", "Modifier", "", "Modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* clear all modifiers */
+ func = RNA_def_function(srna, "clear", "rna_Object_modifier_clear");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Remove all modifiers from the object");
}
/* object.grease_pencil_modifiers */
static void rna_def_object_grease_pencil_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ObjectGpencilModifiers");
- srna = RNA_def_struct(brna, "ObjectGpencilModifiers", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Object Grease Pencil Modifiers", "Collection of object grease pencil modifiers");
-
- /* add greasepencil modifier */
- func = RNA_def_function(srna, "new", "rna_Object_greasepencil_modifier_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new greasepencil_modifier");
- parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the greasepencil_modifier");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* greasepencil_modifier to add */
- parm = RNA_def_enum(func, "type", rna_enum_object_greasepencil_modifier_type_items, 1, "", "Modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "greasepencil_modifier", "GpencilModifier", "", "Newly created modifier");
- RNA_def_function_return(func, parm);
-
- /* remove greasepencil_modifier */
- func = RNA_def_function(srna, "remove", "rna_Object_greasepencil_modifier_remove");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove an existing greasepencil_modifier from the object");
- /* greasepencil_modifier to remove */
- parm = RNA_def_pointer(func, "greasepencil_modifier", "GpencilModifier", "", "Modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* clear all greasepencil modifiers */
- func = RNA_def_function(srna, "clear", "rna_Object_greasepencil_modifier_clear");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Remove all grease pencil modifiers from the object");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ObjectGpencilModifiers");
+ srna = RNA_def_struct(brna, "ObjectGpencilModifiers", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(
+ srna, "Object Grease Pencil Modifiers", "Collection of object grease pencil modifiers");
+
+ /* add greasepencil modifier */
+ func = RNA_def_function(srna, "new", "rna_Object_greasepencil_modifier_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new greasepencil_modifier");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the greasepencil_modifier");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* greasepencil_modifier to add */
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_object_greasepencil_modifier_type_items,
+ 1,
+ "",
+ "Modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(
+ func, "greasepencil_modifier", "GpencilModifier", "", "Newly created modifier");
+ RNA_def_function_return(func, parm);
+
+ /* remove greasepencil_modifier */
+ func = RNA_def_function(srna, "remove", "rna_Object_greasepencil_modifier_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func,
+ "Remove an existing greasepencil_modifier from the object");
+ /* greasepencil_modifier to remove */
+ parm = RNA_def_pointer(
+ func, "greasepencil_modifier", "GpencilModifier", "", "Modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* clear all greasepencil modifiers */
+ func = RNA_def_function(srna, "clear", "rna_Object_greasepencil_modifier_clear");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Remove all grease pencil modifiers from the object");
}
/* object.shaderfxs */
static void rna_def_object_shaderfxs(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "ObjectShaderFx");
- srna = RNA_def_struct(brna, "ObjectShaderFx", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Object Shader Effects", "Collection of object effects");
-
- /* add shader_fx */
- func = RNA_def_function(srna, "new", "rna_Object_shaderfx_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new shader fx");
- parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the effect");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* shader to add */
- parm = RNA_def_enum(func, "type", rna_enum_object_shaderfx_type_items, 1, "", "Effect type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Newly created effect");
- RNA_def_function_return(func, parm);
-
- /* remove shader_fx */
- func = RNA_def_function(srna, "remove", "rna_Object_shaderfx_remove");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove an existing effect from the object");
- /* shader to remove */
- parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Effect to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* clear all shader fx */
- func = RNA_def_function(srna, "clear", "rna_Object_shaderfx_clear");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Remove all effects from the object");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "ObjectShaderFx");
+ srna = RNA_def_struct(brna, "ObjectShaderFx", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Object Shader Effects", "Collection of object effects");
+
+ /* add shader_fx */
+ func = RNA_def_function(srna, "new", "rna_Object_shaderfx_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new shader fx");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the effect");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* shader to add */
+ parm = RNA_def_enum(
+ func, "type", rna_enum_object_shaderfx_type_items, 1, "", "Effect type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Newly created effect");
+ RNA_def_function_return(func, parm);
+
+ /* remove shader_fx */
+ func = RNA_def_function(srna, "remove", "rna_Object_shaderfx_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an existing effect from the object");
+ /* shader to remove */
+ parm = RNA_def_pointer(func, "shader_fx", "ShaderFx", "", "Effect to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* clear all shader fx */
+ func = RNA_def_function(srna, "clear", "rna_Object_shaderfx_clear");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Remove all effects from the object");
}
/* object.particle_systems */
static void rna_def_object_particle_systems(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- PropertyRNA *prop;
+ PropertyRNA *prop;
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
- RNA_def_property_srna(cprop, "ParticleSystems");
- srna = RNA_def_struct(brna, "ParticleSystems", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
+ RNA_def_property_srna(cprop, "ParticleSystems");
+ srna = RNA_def_struct(brna, "ParticleSystems", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Particle Systems", "Collection of particle systems");
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Particle System", "Active particle system being displayed");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_particle_system_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Active Particle System", "Active particle system being displayed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_Object_active_particle_system_index_get",
- "rna_Object_active_particle_system_index_set",
- "rna_Object_active_particle_system_index_range");
- RNA_def_property_ui_text(prop, "Active Particle System Index", "Index of active particle system slot");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_Object_active_particle_system_index_get",
+ "rna_Object_active_particle_system_index_set",
+ "rna_Object_active_particle_system_index_range");
+ RNA_def_property_ui_text(
+ prop, "Active Particle System Index", "Index of active particle system slot");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_particle_update");
}
-
/* object.vertex_groups */
static void rna_def_object_vertex_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "VertexGroups");
- srna = RNA_def_struct(brna, "VertexGroups", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "VertexGroup");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_vertex_group_get",
- "rna_Object_active_vertex_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "actdef");
- RNA_def_property_int_funcs(prop, "rna_Object_active_vertex_group_index_get",
- "rna_Object_active_vertex_group_index_set",
- "rna_Object_active_vertex_group_index_range");
- RNA_def_property_ui_text(prop, "Active Vertex Group Index", "Active index in vertex group array");
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
-
- /* vertex groups */ /* add_vertex_group */
- func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
- RNA_def_function_ui_description(func, "Add vertex group to object");
- RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
- parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Delete vertex group from object");
- parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
- RNA_def_function_ui_description(func, "Delete all vertex groups from object");
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "VertexGroups");
+ srna = RNA_def_struct(brna, "VertexGroups", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Vertex Groups", "Collection of vertex groups");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "VertexGroup");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_Object_active_vertex_group_get",
+ "rna_Object_active_vertex_group_set",
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Active Vertex Group", "Vertex groups of the object");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "actdef");
+ RNA_def_property_int_funcs(prop,
+ "rna_Object_active_vertex_group_index_get",
+ "rna_Object_active_vertex_group_index_set",
+ "rna_Object_active_vertex_group_index_range");
+ RNA_def_property_ui_text(
+ prop, "Active Vertex Group Index", "Active index in vertex group array");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
+
+ /* vertex groups */ /* add_vertex_group */
+ func = RNA_def_function(srna, "new", "rna_Object_vgroup_new");
+ RNA_def_function_ui_description(func, "Add vertex group to object");
+ RNA_def_string(func, "name", "Group", 0, "", "Vertex group name"); /* optional */
+ parm = RNA_def_pointer(func, "group", "VertexGroup", "", "New vertex group");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Object_vgroup_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Delete vertex group from object");
+ parm = RNA_def_pointer(func, "group", "VertexGroup", "", "Vertex group to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_Object_vgroup_clear");
+ RNA_def_function_ui_description(func, "Delete all vertex groups from object");
}
/* object.face_maps */
static void rna_def_object_face_maps(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "FaceMaps");
- srna = RNA_def_struct(brna, "FaceMaps", NULL);
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_ui_text(srna, "Face Maps", "Collection of face maps");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "FaceMap");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_face_map_get",
- "rna_Object_active_face_map_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Face Map", "Face maps of the object");
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "actfmap");
- RNA_def_property_int_funcs(prop, "rna_Object_active_face_map_index_get",
- "rna_Object_active_face_map_index_set",
- "rna_Object_active_face_map_index_range");
- RNA_def_property_ui_text(prop, "Active Face Map Index", "Active index in face map array");
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
-
- /* face maps */ /* add_face_map */
- func = RNA_def_function(srna, "new", "rna_Object_fmap_new");
- RNA_def_function_ui_description(func, "Add face map to object");
- RNA_def_string(func, "name", "Map", 0, "", "face map name"); /* optional */
- parm = RNA_def_pointer(func, "fmap", "FaceMap", "", "New face map");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Object_fmap_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Delete vertex group from object");
- parm = RNA_def_pointer(func, "group", "FaceMap", "", "Face map to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
-
- func = RNA_def_function(srna, "clear", "rna_Object_fmap_clear");
- RNA_def_function_ui_description(func, "Delete all vertex groups from object");
+ StructRNA *srna;
+
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "FaceMaps");
+ srna = RNA_def_struct(brna, "FaceMaps", NULL);
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_ui_text(srna, "Face Maps", "Collection of face maps");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FaceMap");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Object_active_face_map_get", "rna_Object_active_face_map_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Face Map", "Face maps of the object");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "actfmap");
+ RNA_def_property_int_funcs(prop,
+ "rna_Object_active_face_map_index_get",
+ "rna_Object_active_face_map_index_set",
+ "rna_Object_active_face_map_index_range");
+ RNA_def_property_ui_text(prop, "Active Face Map Index", "Active index in face map array");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_Object_internal_update_data");
+
+ /* face maps */ /* add_face_map */
+ func = RNA_def_function(srna, "new", "rna_Object_fmap_new");
+ RNA_def_function_ui_description(func, "Add face map to object");
+ RNA_def_string(func, "name", "Map", 0, "", "face map name"); /* optional */
+ parm = RNA_def_pointer(func, "fmap", "FaceMap", "", "New face map");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Object_fmap_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Delete vertex group from object");
+ parm = RNA_def_pointer(func, "group", "FaceMap", "", "Face map to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_property_clear_flag(parm, PROP_THICK_WRAP);
+
+ func = RNA_def_function(srna, "clear", "rna_Object_fmap_clear");
+ RNA_def_function_ui_description(func, "Delete all vertex groups from object");
}
static void rna_def_object_display(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ObjectDisplay", NULL);
- RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3d viewport");
- RNA_def_struct_sdna(srna, "Object");
- RNA_def_struct_nested(brna, srna, "Object");
- RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
+ srna = RNA_def_struct(brna, "ObjectDisplay", NULL);
+ RNA_def_struct_ui_text(srna, "Object Display", "Object display settings for 3d viewport");
+ RNA_def_struct_sdna(srna, "Object");
+ RNA_def_struct_nested(brna, srna, "Object");
+ RNA_def_struct_path_func(srna, "rna_ObjectDisplay_path");
- prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "dtx", OB_DRAW_NO_SHADOW_CAST);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3d viewport");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+ prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "dtx", OB_DRAW_NO_SHADOW_CAST);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Shadow", "Object cast shadows in the 3d viewport");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
}
static void rna_def_object(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem up_items[] = {
- {OB_POSX, "X", 0, "X", ""},
- {OB_POSY, "Y", 0, "Y", ""},
- {OB_POSZ, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem drawtype_items[] = {
- {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Display the bounds of the object"},
- {OB_WIRE, "WIRE", 0, "Wire", "Display the object as a wireframe"},
- {OB_SOLID, "SOLID", 0, "Solid", "Display the object as a solid (if solid drawing is enabled in the viewport)"},
- {OB_TEXTURE, "TEXTURED", 0, "Textured",
- "Display the object with textures (if textures are enabled in the viewport)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem boundtype_items[] = {
- {OB_BOUND_BOX, "BOX", 0, "Box", "Display bounds as box"},
- {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Display bounds as sphere"},
- {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Display bounds as cylinder"},
- {OB_BOUND_CONE, "CONE", 0, "Cone", "Display bounds as cone"},
- {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Display bounds as capsule"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static int boundbox_dimsize[] = {8, 3};
-
- srna = RNA_def_struct(brna, "Object", "ID");
- RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene");
- RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
- RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
-
- prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ID");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", "rna_Object_data_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Data", "Object data");
- RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_object_type_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "Type of Object");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_object_mode_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
-
- /* for data access */
- prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
- RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Bounding Box",
- "Object's bounding box in object-space coordinates, all values are -1.0 when "
- "not available");
-
- /* parent */
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Parent", "Parent Object");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
-
- prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
- RNA_def_property_enum_items(prop, parent_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
- RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
-
- prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "par1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "parsubstr");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
- RNA_def_property_ui_text(prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
-
- /* Track and Up flags */
- /* XXX: these have been saved here for a bit longer (after old track was removed),
- * since some other tools still refer to this */
- 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, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Track Axis",
- "Axis that points in 'forward' direction (applies to InstanceFrame when "
- "parent 'Follow' is enabled)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- 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, up_items);
- RNA_def_property_ui_text(prop, "Up Axis",
- "Axis that points in the upward direction (applies to InstanceFrame when "
- "parent 'Follow' is enabled)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- /* proxy */
- prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
-
- prop = RNA_def_property(srna, "proxy_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "proxy_group");
- RNA_def_property_ui_text(prop, "Proxy Collection", "Library collection duplicator object this proxy object controls");
-
- /* materials */
- prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
- RNA_def_property_struct_type(prop, "MaterialSlot");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_NO_PROP_NAME);
- /* don't dereference pointer! */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
-
- prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_material_get",
- "rna_Object_active_material_set", NULL,
- "rna_MaterialSlot_material_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
- RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
-
- prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "actcol");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_int_funcs(prop, "rna_Object_active_material_index_get", "rna_Object_active_material_index_set",
- "rna_Object_active_material_index_range");
- RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_MaterialIndex_update");
-
- /* transform */
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Location", "Location of the object");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "quat");
- RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_float_array_default(prop, rna_default_quaternion);
- RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
- * having a single one is better for Keyframing and other property-management situations...
- */
- prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
- RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_Object_rotation_axis_angle_get",
- "rna_Object_rotation_axis_angle_set", NULL);
- RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
- RNA_def_property_float_array_default(prop, rna_default_axis_angle);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "rotmode");
- RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
- RNA_def_property_ui_text(prop, "Rotation Mode", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
- RNA_def_property_float_array_default(prop, rna_default_scale_3d);
- RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
- RNA_def_property_array(prop, 3);
- /* Only as convinient helper for py API, and conflicts with animating scale. */
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_funcs(prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
- RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_ui_text(prop, "Dimensions",
- "Absolute bounding box dimensions of the object (WARNING: assigning to it or "
- "its members mutiple consecutive times will not work correctly, "
- "as this needs up-to-date evaluated data)");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
-
- /* delta transforms */
- prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "dloc");
- RNA_def_property_ui_text(prop, "Delta Location", "Extra translation added to the location of the object");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "drot");
- RNA_def_property_ui_text(prop, "Delta Rotation (Euler)",
- "Extra rotation added to the rotation of the object (when using Euler rotations)");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "dquat");
- RNA_def_property_float_array_default(prop, rna_default_quaternion);
- RNA_def_property_ui_text(prop, "Delta Rotation (Quaternion)",
- "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
-#if 0 /* XXX not supported well yet... */
- prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
- /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
- RNA_def_property_float_sdna(prop, NULL, "dquat");
- RNA_def_property_float_array_default(prop, rna_default_axis_angle);
- RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)",
- "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-#endif
-
- prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "dscale");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
- RNA_def_property_float_array_default(prop, rna_default_scale_3d);
- RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- /* transform locks */
- prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- /* XXX this is sub-optimal - it really should be included above,
- * but due to technical reasons we can't do this! */
- prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
- "Lock editing of 'angle' component of four-component rotations in the interface");
- /* XXX this needs a better name */
- prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
- RNA_def_property_ui_text(prop, "Lock Rotations (4D)",
- "Lock editing of four component rotations by components (instead of as Eulers)");
-
- prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- /* matrix */
- prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "obmat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
-
- prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Local Matrix", "Parent relative transformation matrix - "
- "WARNING: Only takes into account 'Object' parenting, so e.g. in case of bone parenting "
- "you get a matrix relative to the Armature object, not to the actual parent bone");
- RNA_def_property_float_funcs(prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Input Matrix",
- "Matrix access to location, rotation and scale (including deltas), "
- "before constraints and parenting are applied");
- RNA_def_property_float_funcs(prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- /*parent_inverse*/
- prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "parentinv");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
- RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
-
- /* modifiers */
- prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Modifier");
- RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting the geometric data of the object");
- RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION);
- rna_def_object_modifiers(brna, prop);
-
- /* Grease Pencil modifiers. */
- prop = RNA_def_property(srna, "grease_pencil_modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "greasepencil_modifiers", NULL);
- RNA_def_property_struct_type(prop, "GpencilModifier");
- RNA_def_property_ui_text(prop, "Grease Pencil Modifiers", "Modifiers affecting the data of the grease pencil object");
- rna_def_object_grease_pencil_modifiers(brna, prop);
-
- /* Shader FX. */
- prop = RNA_def_property(srna, "shader_effects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "shader_fx", NULL);
- RNA_def_property_struct_type(prop, "ShaderFx");
- RNA_def_property_ui_text(prop, "Shader Effects", "Effects affecting display of object");
- rna_def_object_shaderfxs(brna, prop);
-
- /* constraints */
- prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Constraint");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION);
- RNA_def_property_ui_text(prop, "Constraints", "Constraints affecting the transformation of the object");
- RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply");
-/* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */
- rna_def_object_constraints(brna, prop);
-
- /* vertex groups */
- prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
- RNA_def_property_struct_type(prop, "VertexGroup");
- RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
- rna_def_object_vertex_groups(brna, prop);
-
-
- /* face maps */
- prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "fmaps", NULL);
- RNA_def_property_struct_type(prop, "FaceMap");
- RNA_def_property_ui_text(prop, "Face Maps", "Maps of faces of the object");
- rna_def_object_face_maps(brna, prop);
-
- /* empty */
- prop = RNA_def_property(srna, "empty_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
- RNA_def_property_enum_items(prop, rna_enum_object_empty_drawtype_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Object_empty_display_type_set", NULL);
- RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "empty_display_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
- RNA_def_property_range(prop, 0.0001f, 1000.0f);
- RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
- RNA_def_property_ui_text(prop, "Empty Display Size", "Size of display for empties in the viewport");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
- RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "empty_image_depth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_object_empty_image_depth_items);
- RNA_def_property_ui_text(prop, "Empty Image Depth", "Determine which other objects will occlude the image");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_empty_image_perspective", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_PERSPECTIVE);
- RNA_def_property_ui_text(prop, "Display in Perspective Mode", "Display image in perspective mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_empty_image_orthographic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC);
- RNA_def_property_ui_text(prop, "Display in Orthographic Mode", "Display image in orthographic mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "use_empty_image_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "empty_image_flag", OB_EMPTY_IMAGE_USE_ALPHA_BLEND);
- RNA_def_property_ui_text(prop, "Use Alpha", "Use alpha blending instead of alpha test (can produce sorting artifacts)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- static EnumPropertyItem prop_empty_image_side_items[] = {
- {0, "DOUBLE_SIDED", 0, "Both", ""},
- {OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
- {OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
- {0, NULL, 0, NULL, NULL},
- };
- prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "empty_image_visibility_flag");
- RNA_def_property_enum_items(prop, prop_empty_image_side_items);
- RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- /* render */
- prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "index");
- RNA_def_property_ui_text(prop, "Pass Index", "Index number for the \"Object Index\" render pass");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update_draw");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_ui_text(prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- /* physics */
- prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "pd");
- RNA_def_property_struct_type(prop, "FieldSettings");
- RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Field Settings", "Settings for using the object as a field in physics simulation");
-
- prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "pd");
- RNA_def_property_struct_type(prop, "CollisionSettings");
- RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Collision Settings",
- "Settings for using the object as a collider in physics simulation");
-
- prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "soft");
- RNA_def_property_struct_type(prop, "SoftBodySettings");
- RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
-
- prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
- rna_def_object_particle_systems(brna, prop);
-
-
- prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
- RNA_def_property_struct_type(prop, "RigidBodyObject");
- RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
-
- prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
- RNA_def_property_struct_type(prop, "RigidBodyConstraint");
- RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
-
- /* restrict */
- prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Disable View", "Disable object in the viewport");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
-
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Disable Select", "Disable object selection in the viewport");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
-
- prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Disable Render", "Disable object in renders");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
-
- prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
- RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
-
- prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
- RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
-
- /* anim */
- rna_def_animdata_common(srna);
-
- rna_def_animviz_common(srna);
- rna_def_motionpath_common(srna);
-
- /* instancing */
- prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
- RNA_def_property_enum_items(prop, instance_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_instance_type_itemf");
- RNA_def_property_ui_text(prop, "Instance Type", "If not None, object instancing method to use");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
-
- prop = RNA_def_property(srna, "use_instance_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
- RNA_def_property_ui_text(prop, "Orient with Normals", "Rotate instance according to vertex normal");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "use_instance_faces_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
- RNA_def_property_ui_text(prop, "Scale to Face Sizes", "Scale instance based on face size");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "instance_faces_scale");
- RNA_def_property_range(prop, 0.001f, 10000.0f);
- RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_collection_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
-
- prop = RNA_def_property(srna, "is_instancer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* drawing */
- prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "dt");
- RNA_def_property_enum_items(prop, drawtype_items);
- RNA_def_property_ui_text(prop, "Display As", "How to display object in viewport");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
-
- prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWBOUNDOX);
- RNA_def_property_ui_text(prop, "Display Bounds", "Display the object's bounds");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "display_bounds_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "boundtype");
- RNA_def_property_enum_items(prop, boundtype_items);
- RNA_def_property_ui_text(prop, "Display Bounds Type", "Object boundary display type");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
- RNA_def_property_ui_text(prop, "Display Name", "Display the object's name");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
- RNA_def_property_ui_text(prop, "Display Axes", "Display the object's origin and axes");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
- RNA_def_property_ui_text(prop, "Display Texture Space", "Display the object's texture space");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
- RNA_def_property_ui_text(prop, "Display Wire", "Add the object's wireframe over solid drawing");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_ALL_EDGES);
- RNA_def_property_ui_text(prop, "Display All Edges", "Display all edges for mesh objects");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
- RNA_def_property_ui_text(prop, "Display Transparent",
- "Display material transparency in the object");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
- RNA_def_property_ui_text(prop, "In Front",
- "Make the object draw in front of others");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- /* pose */
- prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "poselib");
- RNA_def_property_struct_type(prop, "Action");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
-
- prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "pose");
- RNA_def_property_struct_type(prop, "Pose");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
-
- /* shape keys */
- prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
- RNA_def_property_ui_text(prop, "Shape Key Lock", "Always show the current Shape for this Object");
- RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
- RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_EDIT_MODE);
- RNA_def_property_ui_text(prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for Meshes only)");
- RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
- RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
-
- prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ShapeKey");
- RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
-
- prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "shapenr");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
- RNA_def_property_int_funcs(prop, "rna_Object_active_shape_key_index_get", "rna_Object_active_shape_key_index_set",
- "rna_Object_active_shape_key_index_range");
- RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
- RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
-
- /* sculpt */
- prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
-
- /* Base Settings */
- prop = RNA_def_property(srna, "is_from_instancer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_DUPLI);
- RNA_def_property_ui_text(prop, "Base from Instancer", "Object comes from a instancer");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_from_set", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_SET);
- RNA_def_property_ui_text(prop, "Base from Set", "Object comes from a background set");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* Object Display */
- prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ObjectDisplay");
- RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3d viewport");
-
- RNA_api_object(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem up_items[] = {
+ {OB_POSX, "X", 0, "X", ""},
+ {OB_POSY, "Y", 0, "Y", ""},
+ {OB_POSZ, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem drawtype_items[] = {
+ {OB_BOUNDBOX, "BOUNDS", 0, "Bounds", "Display the bounds of the object"},
+ {OB_WIRE, "WIRE", 0, "Wire", "Display the object as a wireframe"},
+ {OB_SOLID,
+ "SOLID",
+ 0,
+ "Solid",
+ "Display the object as a solid (if solid drawing is enabled in the viewport)"},
+ {OB_TEXTURE,
+ "TEXTURED",
+ 0,
+ "Textured",
+ "Display the object with textures (if textures are enabled in the viewport)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem boundtype_items[] = {
+ {OB_BOUND_BOX, "BOX", 0, "Box", "Display bounds as box"},
+ {OB_BOUND_SPHERE, "SPHERE", 0, "Sphere", "Display bounds as sphere"},
+ {OB_BOUND_CYLINDER, "CYLINDER", 0, "Cylinder", "Display bounds as cylinder"},
+ {OB_BOUND_CONE, "CONE", 0, "Cone", "Display bounds as cone"},
+ {OB_BOUND_CAPSULE, "CAPSULE", 0, "Capsule", "Display bounds as capsule"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static int boundbox_dimsize[] = {8, 3};
+
+ srna = RNA_def_struct(brna, "Object", "ID");
+ RNA_def_struct_ui_text(srna, "Object", "Object data-block defining an object in a scene");
+ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+ RNA_def_struct_ui_icon(srna, ICON_OBJECT_DATA);
+
+ prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ID");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", "rna_Object_data_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Data", "Object data");
+ RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_object_type_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Type", "Type of Object");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_object_mode_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mode", "Object interaction mode");
+
+ /* for data access */
+ prop = RNA_def_property(srna, "bound_box", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_Object_boundbox_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Bounding Box",
+ "Object's bounding box in object-space coordinates, all values are -1.0 when "
+ "not available");
+
+ /* parent */
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_parent_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Parent", "Parent Object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
+ prop = RNA_def_property(srna, "parent_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "partype");
+ RNA_def_property_enum_items(prop, parent_type_items);
+ RNA_def_property_enum_funcs(
+ prop, NULL, "rna_Object_parent_type_set", "rna_Object_parent_type_itemf");
+ RNA_def_property_ui_text(prop, "Parent Type", "Type of parent relation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
+ prop = RNA_def_property(srna, "parent_vertices", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "par1");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Parent Vertices", "Indices of vertices in case of a vertex parenting relation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "parent_bone", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "parsubstr");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Object_parent_bone_set");
+ RNA_def_property_ui_text(
+ prop, "Parent Bone", "Name of parent bone in case of a bone parenting relation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
+ /* Track and Up flags */
+ /* XXX: these have been saved here for a bit longer (after old track was removed),
+ * since some other tools still refer to this */
+ 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, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Track Axis",
+ "Axis that points in 'forward' direction (applies to InstanceFrame when "
+ "parent 'Follow' is enabled)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
+ 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, up_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Up Axis",
+ "Axis that points in the upward direction (applies to InstanceFrame when "
+ "parent 'Follow' is enabled)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
+ /* proxy */
+ prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
+
+ prop = RNA_def_property(srna, "proxy_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "proxy_group");
+ RNA_def_property_ui_text(
+ prop, "Proxy Collection", "Library collection duplicator object this proxy object controls");
+
+ /* materials */
+ prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "mat", "totcol");
+ RNA_def_property_struct_type(prop, "MaterialSlot");
+ RNA_def_property_override_flag(prop,
+ PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_NO_PROP_NAME);
+ /* don't dereference pointer! */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Material Slots", "Material slots in the object");
+
+ prop = RNA_def_property(srna, "active_material", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_Object_active_material_get",
+ "rna_Object_active_material_set",
+ NULL,
+ "rna_MaterialSlot_material_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_func(prop, "rna_Object_active_material_editable");
+ RNA_def_property_ui_text(prop, "Active Material", "Active material being displayed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_MaterialSlot_update");
+
+ prop = RNA_def_property(srna, "active_material_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "actcol");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_int_funcs(prop,
+ "rna_Object_active_material_index_get",
+ "rna_Object_active_material_index_set",
+ "rna_Object_active_material_index_range");
+ RNA_def_property_ui_text(prop, "Active Material Index", "Index of active material slot");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_MaterialIndex_update");
+
+ /* transform */
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_editable_array_func(prop, "rna_Object_location_editable");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Location", "Location of the object");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "quat");
+ RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
+ RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
+ * having a single one is better for Keyframing and other property-management situations...
+ */
+ prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_float_funcs(
+ prop, "rna_Object_rotation_axis_angle_get", "rna_Object_rotation_axis_angle_set", NULL);
+ RNA_def_property_editable_array_func(prop, "rna_Object_rotation_4d_editable");
+ RNA_def_property_float_array_default(prop, rna_default_axis_angle);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(
+ prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_editable_array_func(prop, "rna_Object_rotation_euler_editable");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotmode");
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Object_rotation_mode_set", NULL);
+ RNA_def_property_ui_text(prop, "Rotation Mode", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_array_func(prop, "rna_Object_scale_editable");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
+ RNA_def_property_float_array_default(prop, rna_default_scale_3d);
+ RNA_def_property_ui_text(prop, "Scale", "Scaling of the object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "dimensions", PROP_FLOAT, PROP_XYZ_LENGTH);
+ RNA_def_property_array(prop, 3);
+ /* Only as convinient helper for py API, and conflicts with animating scale. */
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(
+ prop, "rna_Object_dimensions_get", "rna_Object_dimensions_set", NULL);
+ RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_ui_text(
+ prop,
+ "Dimensions",
+ "Absolute bounding box dimensions of the object (WARNING: assigning to it or "
+ "its members mutiple consecutive times will not work correctly, "
+ "as this needs up-to-date evaluated data)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /* delta transforms */
+ prop = RNA_def_property(srna, "delta_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "dloc");
+ RNA_def_property_ui_text(
+ prop, "Delta Location", "Extra translation added to the location of the object");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "delta_rotation_euler", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "drot");
+ RNA_def_property_ui_text(
+ prop,
+ "Delta Rotation (Euler)",
+ "Extra rotation added to the rotation of the object (when using Euler rotations)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "delta_rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "dquat");
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
+ RNA_def_property_ui_text(
+ prop,
+ "Delta Rotation (Quaternion)",
+ "Extra rotation added to the rotation of the object (when using Quaternion rotations)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+# if 0 /* XXX not supported well yet... */
+ prop = RNA_def_property(srna, "delta_rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+ /* FIXME: this is not a single field any more! (drotAxis and drotAngle) */
+ RNA_def_property_float_sdna(prop, NULL, "dquat");
+ RNA_def_property_float_array_default(prop, rna_default_axis_angle);
+ RNA_def_property_ui_text(prop, "Delta Rotation (Axis Angle)",
+ "Extra rotation added to the rotation of the object (when using Axis-Angle rotations)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+# endif
+
+ prop = RNA_def_property(srna, "delta_scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "dscale");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
+ RNA_def_property_float_array_default(prop, rna_default_scale_3d);
+ RNA_def_property_ui_text(prop, "Delta Scale", "Extra scaling added to the scale of the object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /* transform locks */
+ prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /* XXX this is sub-optimal - it really should be included above,
+ * but due to technical reasons we can't do this! */
+ prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Lock Rotation (4D Angle)",
+ "Lock editing of 'angle' component of four-component rotations in the interface");
+ /* XXX this needs a better name */
+ prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
+ RNA_def_property_ui_text(
+ prop,
+ "Lock Rotations (4D)",
+ "Lock editing of four component rotations by components (instead of as Eulers)");
+
+ prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /* matrix */
+ prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "obmat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Matrix World", "Worldspace transformation matrix");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_matrix_world_update");
+
+ prop = RNA_def_property(srna, "matrix_local", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Local Matrix",
+ "Parent relative transformation matrix - "
+ "WARNING: Only takes into account 'Object' parenting, so e.g. in case of bone parenting "
+ "you get a matrix relative to the Armature object, not to the actual parent bone");
+ RNA_def_property_float_funcs(
+ prop, "rna_Object_matrix_local_get", "rna_Object_matrix_local_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Input Matrix",
+ "Matrix access to location, rotation and scale (including deltas), "
+ "before constraints and parenting are applied");
+ RNA_def_property_float_funcs(
+ prop, "rna_Object_matrix_basis_get", "rna_Object_matrix_basis_set", NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /*parent_inverse*/
+ prop = RNA_def_property(srna, "matrix_parent_inverse", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "parentinv");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ prop, "Matrix", "Inverse of object's parent matrix at time of parenting");
+ RNA_def_property_update(prop, NC_OBJECT | ND_TRANSFORM, "rna_Object_internal_update");
+
+ /* modifiers */
+ prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Modifier");
+ RNA_def_property_ui_text(
+ prop, "Modifiers", "Modifiers affecting the geometric data of the object");
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_modifiers_override_apply");
+ RNA_def_property_override_flag(prop,
+ PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION);
+ rna_def_object_modifiers(brna, prop);
+
+ /* Grease Pencil modifiers. */
+ prop = RNA_def_property(srna, "grease_pencil_modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "greasepencil_modifiers", NULL);
+ RNA_def_property_struct_type(prop, "GpencilModifier");
+ RNA_def_property_ui_text(
+ prop, "Grease Pencil Modifiers", "Modifiers affecting the data of the grease pencil object");
+ rna_def_object_grease_pencil_modifiers(brna, prop);
+
+ /* Shader FX. */
+ prop = RNA_def_property(srna, "shader_effects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "shader_fx", NULL);
+ RNA_def_property_struct_type(prop, "ShaderFx");
+ RNA_def_property_ui_text(prop, "Shader Effects", "Effects affecting display of object");
+ rna_def_object_shaderfxs(brna, prop);
+
+ /* constraints */
+ prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Constraint");
+ RNA_def_property_override_flag(prop,
+ PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION);
+ RNA_def_property_ui_text(
+ prop, "Constraints", "Constraints affecting the transformation of the object");
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_Object_constraints_override_apply");
+ /* RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "constraints__add", "constraints__remove"); */
+ rna_def_object_constraints(brna, prop);
+
+ /* vertex groups */
+ prop = RNA_def_property(srna, "vertex_groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "defbase", NULL);
+ RNA_def_property_struct_type(prop, "VertexGroup");
+ RNA_def_property_ui_text(prop, "Vertex Groups", "Vertex groups of the object");
+ rna_def_object_vertex_groups(brna, prop);
+
+ /* face maps */
+ prop = RNA_def_property(srna, "face_maps", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "fmaps", NULL);
+ RNA_def_property_struct_type(prop, "FaceMap");
+ RNA_def_property_ui_text(prop, "Face Maps", "Maps of faces of the object");
+ rna_def_object_face_maps(brna, prop);
+
+ /* empty */
+ prop = RNA_def_property(srna, "empty_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "empty_drawtype");
+ RNA_def_property_enum_items(prop, rna_enum_object_empty_drawtype_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Object_empty_display_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Empty Display Type", "Viewport display style for empties");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "empty_display_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "empty_drawsize");
+ RNA_def_property_range(prop, 0.0001f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Empty Display Size", "Size of display for empties in the viewport");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "empty_image_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ima_ofs");
+ RNA_def_property_ui_text(prop, "Origin Offset", "Origin offset distance");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 0.1f, 2);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+ RNA_def_property_ui_text(
+ prop,
+ "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "empty_image_depth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_object_empty_image_depth_items);
+ RNA_def_property_ui_text(
+ prop, "Empty Image Depth", "Determine which other objects will occlude the image");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_empty_image_perspective", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_PERSPECTIVE);
+ RNA_def_property_ui_text(
+ prop, "Display in Perspective Mode", "Display image in perspective mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_empty_image_orthographic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "empty_image_visibility_flag", OB_EMPTY_IMAGE_HIDE_ORTHOGRAPHIC);
+ RNA_def_property_ui_text(
+ prop, "Display in Orthographic Mode", "Display image in orthographic mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "use_empty_image_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "empty_image_flag", OB_EMPTY_IMAGE_USE_ALPHA_BLEND);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Alpha",
+ "Use alpha blending instead of alpha test (can produce sorting artifacts)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ static EnumPropertyItem prop_empty_image_side_items[] = {
+ {0, "DOUBLE_SIDED", 0, "Both", ""},
+ {OB_EMPTY_IMAGE_HIDE_BACK, "FRONT", 0, "Front", ""},
+ {OB_EMPTY_IMAGE_HIDE_FRONT, "BACK", 0, "Back", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ prop = RNA_def_property(srna, "empty_image_side", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "empty_image_visibility_flag");
+ RNA_def_property_enum_items(prop, prop_empty_image_side_items);
+ RNA_def_property_ui_text(prop, "Empty Image Side", "Show front/back side");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ /* render */
+ prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_ui_text(
+ prop, "Pass Index", "Index number for the \"Object Index\" render pass");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Object_internal_update_draw");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_ui_text(
+ prop, "Color", "Object color and alpha, used when faces have the ObColor mode enabled");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ /* physics */
+ prop = RNA_def_property(srna, "field", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pd");
+ RNA_def_property_struct_type(prop, "FieldSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_field_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Field Settings", "Settings for using the object as a field in physics simulation");
+
+ prop = RNA_def_property(srna, "collision", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pd");
+ RNA_def_property_struct_type(prop, "CollisionSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_collision_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop,
+ "Collision Settings",
+ "Settings for using the object as a collider in physics simulation");
+
+ prop = RNA_def_property(srna, "soft_body", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "soft");
+ RNA_def_property_struct_type(prop, "SoftBodySettings");
+ RNA_def_property_ui_text(prop, "Soft Body Settings", "Settings for soft body simulation");
+
+ prop = RNA_def_property(srna, "particle_systems", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "particlesystem", NULL);
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
+ rna_def_object_particle_systems(brna, prop);
+
+ prop = RNA_def_property(srna, "rigid_body", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_object");
+ RNA_def_property_struct_type(prop, "RigidBodyObject");
+ RNA_def_property_ui_text(prop, "Rigid Body Settings", "Settings for rigid body simulation");
+
+ prop = RNA_def_property(srna, "rigid_body_constraint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_constraint");
+ RNA_def_property_struct_type(prop, "RigidBodyConstraint");
+ RNA_def_property_ui_text(prop, "Rigid Body Constraint", "Constraint constraining rigid bodies");
+
+ /* restrict */
+ prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_VIEW);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Disable View", "Disable object in the viewport");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, -1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
+
+ prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_SELECT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Disable Select", "Disable object selection in the viewport");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, -1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
+
+ prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "restrictflag", OB_RESTRICT_RENDER);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Disable Render", "Disable object in renders");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_hide_update");
+
+ prop = RNA_def_property(srna, "show_instancer_for_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_RENDER);
+ RNA_def_property_ui_text(prop, "Render Instancer", "Make instancer visible when rendering");
+
+ prop = RNA_def_property(srna, "show_instancer_for_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "duplicator_visibility_flag", OB_DUPLI_FLAG_VIEWPORT);
+ RNA_def_property_ui_text(prop, "Display Instancer", "Make instancer visible in the viewport");
+
+ /* anim */
+ rna_def_animdata_common(srna);
+
+ rna_def_animviz_common(srna);
+ rna_def_motionpath_common(srna);
+
+ /* instancing */
+ prop = RNA_def_property(srna, "instance_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "transflag");
+ RNA_def_property_enum_items(prop, instance_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Object_instance_type_itemf");
+ RNA_def_property_ui_text(prop, "Instance Type", "If not None, object instancing method to use");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
+ prop = RNA_def_property(srna, "use_instance_vertices_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIROT);
+ RNA_def_property_ui_text(
+ prop, "Orient with Normals", "Rotate instance according to vertex normal");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "use_instance_faces_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLIFACES_SCALE);
+ RNA_def_property_ui_text(prop, "Scale to Face Sizes", "Scale instance based on face size");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "instance_faces_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "instance_faces_scale");
+ RNA_def_property_range(prop, 0.001f, 10000.0f);
+ RNA_def_property_ui_text(prop, "Instance Faces Scale", "Scale the face instance objects");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_collection_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Instance Collection", "Instance an existing collection");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
+
+ prop = RNA_def_property(srna, "is_instancer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transflag", OB_DUPLI);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* drawing */
+ prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "dt");
+ RNA_def_property_enum_items(prop, drawtype_items);
+ RNA_def_property_ui_text(prop, "Display As", "How to display object in viewport");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
+
+ prop = RNA_def_property(srna, "show_bounds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWBOUNDOX);
+ RNA_def_property_ui_text(prop, "Display Bounds", "Display the object's bounds");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "display_bounds_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "boundtype");
+ RNA_def_property_enum_items(prop, boundtype_items);
+ RNA_def_property_ui_text(prop, "Display Bounds Type", "Object boundary display type");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_name", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWNAME);
+ RNA_def_property_ui_text(prop, "Display Name", "Display the object's name");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_AXIS);
+ RNA_def_property_ui_text(prop, "Display Axes", "Display the object's origin and axes");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_texture_space", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_TEXSPACE);
+ RNA_def_property_ui_text(prop, "Display Texture Space", "Display the object's texture space");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWWIRE);
+ RNA_def_property_ui_text(prop, "Display Wire", "Add the object's wireframe over solid drawing");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_all_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAW_ALL_EDGES);
+ RNA_def_property_ui_text(prop, "Display All Edges", "Display all edges for mesh objects");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_transparent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWTRANSP);
+ RNA_def_property_ui_text(
+ prop, "Display Transparent", "Display material transparency in the object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_in_front", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dtx", OB_DRAWXRAY);
+ RNA_def_property_ui_text(prop, "In Front", "Make the object draw in front of others");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ /* pose */
+ prop = RNA_def_property(srna, "pose_library", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "poselib");
+ RNA_def_property_struct_type(prop, "Action");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Pose Library", "Action used as a pose library for armatures");
+
+ prop = RNA_def_property(srna, "pose", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pose");
+ RNA_def_property_struct_type(prop, "Pose");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Pose", "Current pose for armatures");
+
+ /* shape keys */
+ prop = RNA_def_property(srna, "show_only_shape_key", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_LOCK);
+ RNA_def_property_ui_text(
+ prop, "Shape Key Lock", "Always show the current Shape for this Object");
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "use_shape_key_edit_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shapeflag", OB_SHAPE_EDIT_MODE);
+ RNA_def_property_ui_text(
+ prop, "Shape Key Edit Mode", "Apply shape keys in edit mode (for Meshes only)");
+ RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
+ RNA_def_property_update(prop, 0, "rna_Object_internal_update_data");
+
+ prop = RNA_def_property(srna, "active_shape_key", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ShapeKey");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_active_shape_key_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Shape Key", "Current shape key");
+
+ prop = RNA_def_property(srna, "active_shape_key_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "shapenr");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* XXX this is really unpredictable... */
+ RNA_def_property_int_funcs(prop,
+ "rna_Object_active_shape_key_index_get",
+ "rna_Object_active_shape_key_index_set",
+ "rna_Object_active_shape_key_index_range");
+ RNA_def_property_ui_text(prop, "Active Shape Key Index", "Current shape key index");
+ RNA_def_property_update(prop, 0, "rna_Object_active_shape_update");
+
+ /* sculpt */
+ prop = RNA_def_property(srna, "use_dynamic_topology_sculpting", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Object_use_dynamic_topology_sculpting_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Dynamic Topology Sculpting", NULL);
+
+ /* Base Settings */
+ prop = RNA_def_property(srna, "is_from_instancer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_DUPLI);
+ RNA_def_property_ui_text(prop, "Base from Instancer", "Object comes from a instancer");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_from_set", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "base_flag", BASE_FROM_SET);
+ RNA_def_property_ui_text(prop, "Base from Set", "Object comes from a background set");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* Object Display */
+ prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ObjectDisplay");
+ RNA_def_property_pointer_funcs(prop, "rna_Object_display_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Object Display", "Object display settings for 3d viewport");
+
+ RNA_api_object(srna);
}
void RNA_def_object(BlenderRNA *brna)
{
- rna_def_object(brna);
+ rna_def_object(brna);
- RNA_define_animate_sdna(false);
- rna_def_vertex_group(brna);
- rna_def_face_map(brna);
- rna_def_material_slot(brna);
- rna_def_object_display(brna);
- RNA_define_animate_sdna(true);
+ RNA_define_animate_sdna(false);
+ rna_def_vertex_group(brna);
+ rna_def_face_map(brna);
+ rna_def_material_slot(brna);
+ rna_def_object_display(brna);
+ RNA_define_animate_sdna(true);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 68b8d1b2a5f..7862671b867 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -41,855 +40,1092 @@
#include "DEG_depsgraph.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
static const EnumPropertyItem space_items[] = {
- {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space",
- "The most global space in Blender"},
- {CONSTRAINT_SPACE_POSE, "POSE", 0, "Pose Space",
- "The pose space of a bone (its armature's object space)"},
- {CONSTRAINT_SPACE_PARLOCAL, "LOCAL_WITH_PARENT", 0, "Local With Parent",
- "The rest pose local space of a bone (thus matrix includes parent transforms)"},
- {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space",
- "The local space of an object/bone"},
- {0, NULL, 0, NULL, NULL},
+ {CONSTRAINT_SPACE_WORLD, "WORLD", 0, "World Space", "The most global space in Blender"},
+ {CONSTRAINT_SPACE_POSE,
+ "POSE",
+ 0,
+ "Pose Space",
+ "The pose space of a bone (its armature's object space)"},
+ {CONSTRAINT_SPACE_PARLOCAL,
+ "LOCAL_WITH_PARENT",
+ 0,
+ "Local With Parent",
+ "The rest pose local space of a bone (thus matrix includes parent transforms)"},
+ {CONSTRAINT_SPACE_LOCAL, "LOCAL", 0, "Local Space", "The local space of an object/bone"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_math.h"
+# include "BLI_math.h"
-#include "BKE_anim.h"
-#include "BKE_bvhutils.h"
-#include "BKE_constraint.h"
-#include "BKE_context.h"
-#include "BKE_customdata.h"
-#include "BKE_font.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
-#include "BKE_mesh.h"
-#include "BKE_mball.h"
-#include "BKE_modifier.h"
-#include "BKE_object.h"
-#include "BKE_report.h"
+# include "BKE_anim.h"
+# include "BKE_bvhutils.h"
+# include "BKE_constraint.h"
+# include "BKE_context.h"
+# include "BKE_customdata.h"
+# include "BKE_font.h"
+# include "BKE_global.h"
+# include "BKE_main.h"
+# include "BKE_mesh.h"
+# include "BKE_mball.h"
+# include "BKE_modifier.h"
+# include "BKE_object.h"
+# include "BKE_report.h"
-#include "ED_object.h"
-#include "ED_screen.h"
+# include "ED_object.h"
+# include "ED_screen.h"
-#include "DNA_curve_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_view3d_types.h"
+# include "DNA_curve_types.h"
+# include "DNA_mesh_types.h"
+# include "DNA_meshdata_types.h"
+# include "DNA_scene_types.h"
+# include "DNA_view3d_types.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph_query.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
static void rna_Object_select_set(
- Object *ob, bContext *C, ReportList *reports,
- bool select, ViewLayer *view_layer)
+ Object *ob, bContext *C, ReportList *reports, bool select, ViewLayer *view_layer)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return;
- }
-
- if (select) {
- BKE_view_layer_base_select(base);
- }
- else {
- base->flag &= ~BASE_SELECTED;
- }
-
- Scene *scene = CTX_data_scene(C);
- DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
- WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return;
+ }
+
+ if (select) {
+ BKE_view_layer_base_select(base);
+ }
+ else {
+ base->flag &= ~BASE_SELECTED;
+ }
+
+ Scene *scene = CTX_data_scene(C);
+ DEG_id_tag_update(&scene->id, ID_RECALC_SELECT);
+ WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
}
-static bool rna_Object_select_get(Object *ob, bContext *C, ReportList *reports, ViewLayer *view_layer)
+static bool rna_Object_select_get(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ ViewLayer *view_layer)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return false;
- }
-
- return ((base->flag & BASE_SELECTED) != 0);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return false;
+ }
+
+ return ((base->flag & BASE_SELECTED) != 0);
}
static void rna_Object_hide_set(
- Object *ob, bContext *C, ReportList *reports,
- bool hide, ViewLayer *view_layer)
+ Object *ob, bContext *C, ReportList *reports, bool hide, ViewLayer *view_layer)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return;
- }
-
- if (hide) {
- base->flag |= BASE_HIDDEN;
- }
- else {
- base->flag &= ~BASE_HIDDEN;
- }
-
- Scene *scene = CTX_data_scene(C);
- BKE_layer_collection_sync(scene, view_layer);
- DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return;
+ }
+
+ if (hide) {
+ base->flag |= BASE_HIDDEN;
+ }
+ else {
+ base->flag &= ~BASE_HIDDEN;
+ }
+
+ Scene *scene = CTX_data_scene(C);
+ BKE_layer_collection_sync(scene, view_layer);
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+ WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene);
}
-static bool rna_Object_hide_get(Object *ob, bContext *C, ReportList *reports, ViewLayer *view_layer)
+static bool rna_Object_hide_get(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ ViewLayer *view_layer)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return false;
- }
-
- return ((base->flag & BASE_HIDDEN) != 0);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return false;
+ }
+
+ return ((base->flag & BASE_HIDDEN) != 0);
}
-static bool rna_Object_visible_get(Object *ob, bContext *C, ReportList *reports, ViewLayer *view_layer, View3D *v3d)
+static bool rna_Object_visible_get(
+ Object *ob, bContext *C, ReportList *reports, ViewLayer *view_layer, View3D *v3d)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- if (v3d == NULL) {
- v3d = CTX_wm_view3d(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return false;
- }
-
- return BASE_VISIBLE(v3d, base);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ if (v3d == NULL) {
+ v3d = CTX_wm_view3d(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return false;
+ }
+
+ return BASE_VISIBLE(v3d, base);
}
-static bool rna_Object_holdout_get(Object *ob, bContext *C, ReportList *reports, ViewLayer *view_layer)
+static bool rna_Object_holdout_get(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ ViewLayer *view_layer)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return false;
- }
-
- return ((base->flag & BASE_HOLDOUT) != 0);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return false;
+ }
+
+ return ((base->flag & BASE_HOLDOUT) != 0);
}
-static bool rna_Object_indirect_only_get(Object *ob, bContext *C, ReportList *reports, ViewLayer *view_layer)
+static bool rna_Object_indirect_only_get(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ ViewLayer *view_layer)
{
- if (view_layer == NULL) {
- view_layer = CTX_data_view_layer(C);
- }
- Base *base = BKE_view_layer_base_find(view_layer, ob);
-
- if (!base) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in View Layer '%s'!", ob->id.name + 2, view_layer->name);
- return false;
- }
-
- return ((base->flag & BASE_INDIRECT_ONLY) != 0);
+ if (view_layer == NULL) {
+ view_layer = CTX_data_view_layer(C);
+ }
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+
+ if (!base) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' not in View Layer '%s'!",
+ ob->id.name + 2,
+ view_layer->name);
+ return false;
+ }
+
+ return ((base->flag & BASE_INDIRECT_ONLY) != 0);
}
-static Base *rna_Object_local_view_property_helper(bScreen *sc, View3D *v3d, Object *ob, ReportList *reports, Scene **r_scene)
+static Base *rna_Object_local_view_property_helper(
+ bScreen *sc, View3D *v3d, Object *ob, ReportList *reports, Scene **r_scene)
{
- if (v3d->localvd == NULL) {
- BKE_report(reports, RPT_ERROR, "Viewport not in local view");
- return NULL;
- }
-
- wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Base *base = BKE_view_layer_base_find(view_layer, ob);
- if (base == NULL) {
- BKE_reportf(reports,
- RPT_WARNING,
- "Object %s not in view layer %s",
- ob->id.name + 2,
- view_layer->name);
-
- }
- if (r_scene) {
- *r_scene = win->scene;
- }
- return base;
+ if (v3d->localvd == NULL) {
+ BKE_report(reports, RPT_ERROR, "Viewport not in local view");
+ return NULL;
+ }
+
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Base *base = BKE_view_layer_base_find(view_layer, ob);
+ if (base == NULL) {
+ BKE_reportf(
+ reports, RPT_WARNING, "Object %s not in view layer %s", ob->id.name + 2, view_layer->name);
+ }
+ if (r_scene) {
+ *r_scene = win->scene;
+ }
+ return base;
}
static bool rna_Object_local_view_get(Object *ob, ReportList *reports, PointerRNA *v3d_ptr)
{
- bScreen *sc = v3d_ptr->id.data;
- View3D *v3d = v3d_ptr->data;
- Base *base = rna_Object_local_view_property_helper(sc, v3d, ob, reports, NULL);
- if (base == NULL) {
- return false; /* Error reported. */
- }
- return (base->local_view_bits & v3d->local_view_uuid) != 0;
+ bScreen *sc = v3d_ptr->id.data;
+ View3D *v3d = v3d_ptr->data;
+ Base *base = rna_Object_local_view_property_helper(sc, v3d, ob, reports, NULL);
+ if (base == NULL) {
+ return false; /* Error reported. */
+ }
+ return (base->local_view_bits & v3d->local_view_uuid) != 0;
}
-static void rna_Object_local_view_set(Object *ob, ReportList *reports, PointerRNA *v3d_ptr, bool state)
+static void rna_Object_local_view_set(Object *ob,
+ ReportList *reports,
+ PointerRNA *v3d_ptr,
+ bool state)
{
- bScreen *sc = v3d_ptr->id.data;
- View3D *v3d = v3d_ptr->data;
- Scene *scene;
- Base *base = rna_Object_local_view_property_helper(sc, v3d, ob, reports, &scene);
- if (base == NULL) {
- return; /* Error reported. */
- }
- const short local_view_bits_prev = base->local_view_bits;
- SET_FLAG_FROM_TEST(base->local_view_bits, state, v3d->local_view_uuid);
- if (local_view_bits_prev != base->local_view_bits) {
- DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
- ScrArea *sa = ED_screen_area_find_with_spacedata(sc, (SpaceLink *)v3d, true);
- if (sa) {
- ED_area_tag_redraw(sa);
- }
- }
+ bScreen *sc = v3d_ptr->id.data;
+ View3D *v3d = v3d_ptr->data;
+ Scene *scene;
+ Base *base = rna_Object_local_view_property_helper(sc, v3d, ob, reports, &scene);
+ if (base == NULL) {
+ return; /* Error reported. */
+ }
+ const short local_view_bits_prev = base->local_view_bits;
+ SET_FLAG_FROM_TEST(base->local_view_bits, state, v3d->local_view_uuid);
+ if (local_view_bits_prev != base->local_view_bits) {
+ DEG_id_tag_update(&scene->id, ID_RECALC_BASE_FLAGS);
+ ScrArea *sa = ED_screen_area_find_with_spacedata(sc, (SpaceLink *)v3d, true);
+ if (sa) {
+ ED_area_tag_redraw(sa);
+ }
+ }
}
/* Convert a given matrix from a space to another (using the object and/or a bone as reference). */
-static void rna_Object_mat_convert_space(Object *ob, ReportList *reports, bPoseChannel *pchan,
- float *mat, float *mat_ret, int from, int to)
+static void rna_Object_mat_convert_space(Object *ob,
+ ReportList *reports,
+ bPoseChannel *pchan,
+ float *mat,
+ float *mat_ret,
+ int from,
+ int to)
{
- copy_m4_m4((float (*)[4])mat_ret, (float (*)[4])mat);
-
- /* Error in case of invalid from/to values when pchan is NULL */
- if (pchan == NULL) {
- if (ELEM(from, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
- const char *identifier = NULL;
- RNA_enum_identifier(space_items, from, &identifier);
- BKE_reportf(reports, RPT_ERROR, "'from_space' '%s' is invalid when no pose bone is given!", identifier);
- return;
- }
- if (ELEM(to, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
- const char *identifier = NULL;
- RNA_enum_identifier(space_items, to, &identifier);
- BKE_reportf(reports, RPT_ERROR, "'to_space' '%s' is invalid when no pose bone is given!", identifier);
- return;
- }
- }
-
- BKE_constraint_mat_convertspace(ob, pchan, (float (*)[4])mat_ret, from, to, false);
+ copy_m4_m4((float(*)[4])mat_ret, (float(*)[4])mat);
+
+ /* Error in case of invalid from/to values when pchan is NULL */
+ if (pchan == NULL) {
+ if (ELEM(from, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
+ const char *identifier = NULL;
+ RNA_enum_identifier(space_items, from, &identifier);
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "'from_space' '%s' is invalid when no pose bone is given!",
+ identifier);
+ return;
+ }
+ if (ELEM(to, CONSTRAINT_SPACE_POSE, CONSTRAINT_SPACE_PARLOCAL)) {
+ const char *identifier = NULL;
+ RNA_enum_identifier(space_items, to, &identifier);
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "'to_space' '%s' is invalid when no pose bone is given!",
+ identifier);
+ return;
+ }
+ }
+
+ BKE_constraint_mat_convertspace(ob, pchan, (float(*)[4])mat_ret, from, to, false);
}
-static void rna_Object_calc_matrix_camera(
- Object *ob, Depsgraph *depsgraph, float mat_ret[16], int width, int height, float scalex, float scaley)
+static void rna_Object_calc_matrix_camera(Object *ob,
+ Depsgraph *depsgraph,
+ float mat_ret[16],
+ int width,
+ int height,
+ float scalex,
+ float scaley)
{
- const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
- CameraParams params;
+ const Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob);
+ CameraParams params;
- /* setup parameters */
- BKE_camera_params_init(&params);
- BKE_camera_params_from_object(&params, ob_eval);
+ /* setup parameters */
+ BKE_camera_params_init(&params);
+ BKE_camera_params_from_object(&params, ob_eval);
- /* compute matrix, viewplane, .. */
- BKE_camera_params_compute_viewplane(&params, width, height, scalex, scaley);
- BKE_camera_params_compute_matrix(&params);
+ /* compute matrix, viewplane, .. */
+ BKE_camera_params_compute_viewplane(&params, width, height, scalex, scaley);
+ BKE_camera_params_compute_matrix(&params);
- copy_m4_m4((float (*)[4])mat_ret, params.winmat);
+ copy_m4_m4((float(*)[4])mat_ret, params.winmat);
}
static void rna_Object_camera_fit_coords(
- Object *ob, Depsgraph *depsgraph, int num_cos, float *cos, float co_ret[3], float *scale_ret)
+ Object *ob, Depsgraph *depsgraph, int num_cos, float *cos, float co_ret[3], float *scale_ret)
{
- BKE_camera_view_frame_fit_to_coords(depsgraph, (const float (*)[3])cos, num_cos / 3, ob, co_ret, scale_ret);
+ BKE_camera_view_frame_fit_to_coords(
+ depsgraph, (const float(*)[3])cos, num_cos / 3, ob, co_ret, scale_ret);
}
/* copied from Mesh_getFromObject and adapted to RNA interface */
/* settings: 0 - preview, 1 - render */
-static Mesh *rna_Object_to_mesh(
- Object *ob, bContext *C, ReportList *reports, Depsgraph *depsgraph,
- bool apply_modifiers, bool calc_undeformed)
+static Mesh *rna_Object_to_mesh(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ Depsgraph *depsgraph,
+ bool apply_modifiers,
+ bool calc_undeformed)
{
- Main *bmain = CTX_data_main(C);
+ Main *bmain = CTX_data_main(C);
- return rna_Main_meshes_new_from_object(bmain, reports, depsgraph, ob, apply_modifiers, calc_undeformed);
+ return rna_Main_meshes_new_from_object(
+ bmain, reports, depsgraph, ob, apply_modifiers, calc_undeformed);
}
-static PointerRNA rna_Object_shape_key_add(Object *ob, bContext *C, ReportList *reports,
- const char *name, bool from_mix)
+static PointerRNA rna_Object_shape_key_add(
+ Object *ob, bContext *C, ReportList *reports, const char *name, bool from_mix)
{
- Main *bmain = CTX_data_main(C);
- KeyBlock *kb = NULL;
+ Main *bmain = CTX_data_main(C);
+ KeyBlock *kb = NULL;
- if ((kb = BKE_object_shapekey_insert(bmain, ob, name, from_mix))) {
- PointerRNA keyptr;
+ if ((kb = BKE_object_shapekey_insert(bmain, ob, name, from_mix))) {
+ PointerRNA keyptr;
- RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr);
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ RNA_pointer_create((ID *)ob->data, &RNA_ShapeKey, kb, &keyptr);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
- return keyptr;
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
- return PointerRNA_NULL;
- }
+ return keyptr;
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Object '%s' does not support shapes", ob->id.name + 2);
+ return PointerRNA_NULL;
+ }
}
-static void rna_Object_shape_key_remove(
- Object *ob, Main *bmain, ReportList *reports,
- PointerRNA *kb_ptr)
+static void rna_Object_shape_key_remove(Object *ob,
+ Main *bmain,
+ ReportList *reports,
+ PointerRNA *kb_ptr)
{
- KeyBlock *kb = kb_ptr->data;
- Key *key = BKE_key_from_object(ob);
+ KeyBlock *kb = kb_ptr->data;
+ Key *key = BKE_key_from_object(ob);
- if ((key == NULL) || BLI_findindex(&key->block, kb) == -1) {
- BKE_report(reports, RPT_ERROR, "ShapeKey not found");
- return;
- }
+ if ((key == NULL) || BLI_findindex(&key->block, kb) == -1) {
+ BKE_report(reports, RPT_ERROR, "ShapeKey not found");
+ return;
+ }
- if (!BKE_object_shapekey_remove(bmain, ob, kb)) {
- BKE_report(reports, RPT_ERROR, "Could not remove ShapeKey");
- return;
- }
+ if (!BKE_object_shapekey_remove(bmain, ob, kb)) {
+ BKE_report(reports, RPT_ERROR, "Could not remove ShapeKey");
+ return;
+ }
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- RNA_POINTER_INVALIDATE(kb_ptr);
+ RNA_POINTER_INVALIDATE(kb_ptr);
}
-#if 0
+# if 0
static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex,
float weight, int assignmode)
{
- if (ob->type != OB_MESH) {
- BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
- return;
- }
-
- Mesh *me = (Mesh *)ob->data;
- int group_index = BLI_findlink(&ob->defbase, group);
- if (group_index == -1) {
- BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
- return;
- }
-
- if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
- BKE_report(reports, RPT_ERROR, "Bad assignment mode");
- return;
- }
-
- /* makes a set of dVerts corresponding to the mVerts */
- if (!me->dvert)
- create_dverts(&me->id);
-
- /* loop list adding verts to group */
- for (i = 0; i < totindex; i++) {
- if (i < 0 || i >= me->totvert) {
- BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
- return;
- }
-
- add_vert_defnr(ob, group_index, i, weight, assignmode);
- }
+ if (ob->type != OB_MESH) {
+ BKE_report(reports, RPT_ERROR, "Object should be of mesh type");
+ return;
+ }
+
+ Mesh *me = (Mesh *)ob->data;
+ int group_index = BLI_findlink(&ob->defbase, group);
+ if (group_index == -1) {
+ BKE_report(reports, RPT_ERROR, "No vertex groups assigned to mesh");
+ return;
+ }
+
+ if (assignmode != WEIGHT_REPLACE && assignmode != WEIGHT_ADD && assignmode != WEIGHT_SUBTRACT) {
+ BKE_report(reports, RPT_ERROR, "Bad assignment mode");
+ return;
+ }
+
+ /* makes a set of dVerts corresponding to the mVerts */
+ if (!me->dvert)
+ create_dverts(&me->id);
+
+ /* loop list adding verts to group */
+ for (i = 0; i < totindex; i++) {
+ if (i < 0 || i >= me->totvert) {
+ BKE_report(reports, RPT_ERROR, "Bad vertex index in list");
+ return;
+ }
+
+ add_vert_defnr(ob, group_index, i, weight, assignmode);
+ }
}
-#endif
+# endif
/* don't call inside a loop */
static int mesh_looptri_to_poly_index(Mesh *me_eval, const MLoopTri *lt)
{
- const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
- return index_mp_to_orig ? index_mp_to_orig[lt->poly] : lt->poly;
+ const int *index_mp_to_orig = CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
+ return index_mp_to_orig ? index_mp_to_orig[lt->poly] : lt->poly;
}
-static Object *eval_object_ensure(Object *ob, bContext *C, ReportList *reports, PointerRNA *rnaptr_depsgraph)
+static Object *eval_object_ensure(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ PointerRNA *rnaptr_depsgraph)
{
- if (ob->runtime.mesh_eval == NULL) {
- Object *ob_orig = ob;
- Depsgraph *depsgraph = rnaptr_depsgraph != NULL ? rnaptr_depsgraph->data : NULL;
- if (depsgraph == NULL) {
- depsgraph = CTX_data_depsgraph(C);
- }
- if (depsgraph != NULL) {
- ob = DEG_get_evaluated_object(depsgraph, ob);
- }
- if (ob == NULL || ob->runtime.mesh_eval == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' has no evaluated mesh data", ob_orig->id.name + 2);
- return NULL;
- }
- }
- return ob;
+ if (ob->runtime.mesh_eval == NULL) {
+ Object *ob_orig = ob;
+ Depsgraph *depsgraph = rnaptr_depsgraph != NULL ? rnaptr_depsgraph->data : NULL;
+ if (depsgraph == NULL) {
+ depsgraph = CTX_data_depsgraph(C);
+ }
+ if (depsgraph != NULL) {
+ ob = DEG_get_evaluated_object(depsgraph, ob);
+ }
+ if (ob == NULL || ob->runtime.mesh_eval == NULL) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Object '%s' has no evaluated mesh data", ob_orig->id.name + 2);
+ return NULL;
+ }
+ }
+ return ob;
}
-static void rna_Object_ray_cast(
- Object *ob, bContext *C, ReportList *reports,
- float origin[3], float direction[3], float distance, PointerRNA *rnaptr_depsgraph,
- bool *r_success, float r_location[3], float r_normal[3], int *r_index)
+static void rna_Object_ray_cast(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ float origin[3],
+ float direction[3],
+ float distance,
+ PointerRNA *rnaptr_depsgraph,
+ bool *r_success,
+ float r_location[3],
+ float r_normal[3],
+ int *r_index)
{
- bool success = false;
-
- if (ob->runtime.mesh_eval == NULL && (ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) {
- return;
- }
-
- /* Test BoundBox first (efficiency) */
- BoundBox *bb = BKE_object_boundbox_get(ob);
- float distmin;
- normalize_v3(direction); /* Needed for valid distance check from isect_ray_aabb_v3_simple() call. */
- if (!bb ||
- (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, NULL) && distmin <= distance))
- {
- BVHTreeFromMesh treeData = {NULL};
-
- /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
- BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
-
- /* may fail if the mesh has no faces, in that case the ray-cast misses */
- if (treeData.tree != NULL) {
- BVHTreeRayHit hit;
-
- hit.index = -1;
- hit.dist = distance;
-
- if (BLI_bvhtree_ray_cast(treeData.tree, origin, direction, 0.0f, &hit,
- treeData.raycast_callback, &treeData) != -1)
- {
- if (hit.dist <= distance) {
- *r_success = success = true;
-
- copy_v3_v3(r_location, hit.co);
- copy_v3_v3(r_normal, hit.no);
- *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, &treeData.looptri[hit.index]);
- }
- }
-
- free_bvhtree_from_mesh(&treeData);
- }
- }
- if (success == false) {
- *r_success = false;
-
- zero_v3(r_location);
- zero_v3(r_normal);
- *r_index = -1;
- }
+ bool success = false;
+
+ if (ob->runtime.mesh_eval == NULL &&
+ (ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) {
+ return;
+ }
+
+ /* Test BoundBox first (efficiency) */
+ BoundBox *bb = BKE_object_boundbox_get(ob);
+ float distmin;
+ normalize_v3(
+ direction); /* Needed for valid distance check from isect_ray_aabb_v3_simple() call. */
+ if (!bb ||
+ (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, NULL) &&
+ distmin <= distance)) {
+ BVHTreeFromMesh treeData = {NULL};
+
+ /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
+ BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
+
+ /* may fail if the mesh has no faces, in that case the ray-cast misses */
+ if (treeData.tree != NULL) {
+ BVHTreeRayHit hit;
+
+ hit.index = -1;
+ hit.dist = distance;
+
+ if (BLI_bvhtree_ray_cast(treeData.tree,
+ origin,
+ direction,
+ 0.0f,
+ &hit,
+ treeData.raycast_callback,
+ &treeData) != -1) {
+ if (hit.dist <= distance) {
+ *r_success = success = true;
+
+ copy_v3_v3(r_location, hit.co);
+ copy_v3_v3(r_normal, hit.no);
+ *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval,
+ &treeData.looptri[hit.index]);
+ }
+ }
+
+ free_bvhtree_from_mesh(&treeData);
+ }
+ }
+ if (success == false) {
+ *r_success = false;
+
+ zero_v3(r_location);
+ zero_v3(r_normal);
+ *r_index = -1;
+ }
}
-static void rna_Object_closest_point_on_mesh(
- Object *ob, bContext *C, ReportList *reports, float origin[3], float distance, PointerRNA *rnaptr_depsgraph,
- bool *r_success, float r_location[3], float r_normal[3], int *r_index)
+static void rna_Object_closest_point_on_mesh(Object *ob,
+ bContext *C,
+ ReportList *reports,
+ float origin[3],
+ float distance,
+ PointerRNA *rnaptr_depsgraph,
+ bool *r_success,
+ float r_location[3],
+ float r_normal[3],
+ int *r_index)
{
- BVHTreeFromMesh treeData = {NULL};
+ BVHTreeFromMesh treeData = {NULL};
- if (ob->runtime.mesh_eval == NULL && (ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) {
- return;
- }
+ if (ob->runtime.mesh_eval == NULL &&
+ (ob = eval_object_ensure(ob, C, reports, rnaptr_depsgraph)) == NULL) {
+ return;
+ }
- /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
- BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
+ /* no need to managing allocation or freeing of the BVH data. this is generated and freed as needed */
+ BKE_bvhtree_from_mesh_get(&treeData, ob->runtime.mesh_eval, BVHTREE_FROM_LOOPTRI, 4);
- if (treeData.tree == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' could not create internal data for finding nearest point",
- ob->id.name + 2);
- return;
- }
- else {
- BVHTreeNearest nearest;
+ if (treeData.tree == NULL) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Object '%s' could not create internal data for finding nearest point",
+ ob->id.name + 2);
+ return;
+ }
+ else {
+ BVHTreeNearest nearest;
- nearest.index = -1;
- nearest.dist_sq = distance * distance;
+ nearest.index = -1;
+ nearest.dist_sq = distance * distance;
- if (BLI_bvhtree_find_nearest(treeData.tree, origin, &nearest, treeData.nearest_callback, &treeData) != -1) {
- *r_success = true;
+ if (BLI_bvhtree_find_nearest(
+ treeData.tree, origin, &nearest, treeData.nearest_callback, &treeData) != -1) {
+ *r_success = true;
- copy_v3_v3(r_location, nearest.co);
- copy_v3_v3(r_normal, nearest.no);
- *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval, &treeData.looptri[nearest.index]);
+ copy_v3_v3(r_location, nearest.co);
+ copy_v3_v3(r_normal, nearest.no);
+ *r_index = mesh_looptri_to_poly_index(ob->runtime.mesh_eval,
+ &treeData.looptri[nearest.index]);
- goto finally;
- }
- }
+ goto finally;
+ }
+ }
- *r_success = false;
+ *r_success = false;
- zero_v3(r_location);
- zero_v3(r_normal);
- *r_index = -1;
+ zero_v3(r_location);
+ zero_v3(r_normal);
+ *r_index = -1;
finally:
- free_bvhtree_from_mesh(&treeData);
+ free_bvhtree_from_mesh(&treeData);
}
static bool rna_Object_is_modified(Object *ob, Scene *scene, int settings)
{
- return BKE_object_is_modified(scene, ob) & settings;
+ return BKE_object_is_modified(scene, ob) & settings;
}
static bool rna_Object_is_deform_modified(Object *ob, Scene *scene, int settings)
{
- return BKE_object_is_deform_modified(scene, ob) & settings;
+ return BKE_object_is_deform_modified(scene, ob) & settings;
}
-#ifndef NDEBUG
+# ifndef NDEBUG
-#include "BKE_mesh_runtime.h"
+# include "BKE_mesh_runtime.h"
-void rna_Object_me_eval_info(struct Object *ob, bContext *C, int type, PointerRNA *rnaptr_depsgraph, char *result)
+void rna_Object_me_eval_info(
+ struct Object *ob, bContext *C, int type, PointerRNA *rnaptr_depsgraph, char *result)
{
- Mesh *me_eval = NULL;
- char *ret = NULL;
-
- result[0] = '\0';
-
- switch (type) {
- case 1:
- case 2:
- if (ob->runtime.mesh_eval == NULL && (ob = eval_object_ensure(ob, C, NULL, rnaptr_depsgraph)) == NULL) {
- return;
- }
- }
-
- switch (type) {
- case 0:
- if (ob->type == OB_MESH) {
- me_eval = ob->data;
- }
- break;
- case 1:
- me_eval = ob->runtime.mesh_deform_eval;
- break;
- case 2:
- me_eval = ob->runtime.mesh_eval;
- break;
- }
-
- if (me_eval) {
- ret = BKE_mesh_runtime_debug_info(me_eval);
- if (ret) {
- strcpy(result, ret);
- MEM_freeN(ret);
- }
- }
+ Mesh *me_eval = NULL;
+ char *ret = NULL;
+
+ result[0] = '\0';
+
+ switch (type) {
+ case 1:
+ case 2:
+ if (ob->runtime.mesh_eval == NULL &&
+ (ob = eval_object_ensure(ob, C, NULL, rnaptr_depsgraph)) == NULL) {
+ return;
+ }
+ }
+
+ switch (type) {
+ case 0:
+ if (ob->type == OB_MESH) {
+ me_eval = ob->data;
+ }
+ break;
+ case 1:
+ me_eval = ob->runtime.mesh_deform_eval;
+ break;
+ case 2:
+ me_eval = ob->runtime.mesh_eval;
+ break;
+ }
+
+ if (me_eval) {
+ ret = BKE_mesh_runtime_debug_info(me_eval);
+ if (ret) {
+ strcpy(result, ret);
+ MEM_freeN(ret);
+ }
+ }
}
-#endif /* NDEBUG */
+# endif /* NDEBUG */
static bool rna_Object_update_from_editmode(Object *ob, Main *bmain)
{
- /* fail gracefully if we aren't in edit-mode. */
- return ED_object_editmode_load(bmain, ob);
+ /* fail gracefully if we aren't in edit-mode. */
+ return ED_object_editmode_load(bmain, ob);
}
#else /* RNA_RUNTIME */
void RNA_api_object(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem mesh_type_items[] = {
- {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
- {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
- {0, NULL, 0, NULL, NULL},
- };
-
-#ifndef NDEBUG
- static const EnumPropertyItem mesh_dm_info_items[] = {
- {0, "SOURCE", 0, "Source", "Source mesh"},
- {1, "DEFORM", 0, "Deform", "Objects deform mesh"},
- {2, "FINAL", 0, "Final", "Objects final mesh"},
- {0, NULL, 0, NULL, NULL},
- };
-#endif
-
- /* Special wrapper to access the base selection value */
- func = RNA_def_function(srna, "select_get", "rna_Object_select_get");
- RNA_def_function_ui_description(func, "Test if the object is selected. The selection state is per view layer");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
- parm = RNA_def_boolean(func, "result", 0, "", "Object selected");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "select_set", "rna_Object_select_set");
- RNA_def_function_ui_description(func, "Select or deselect the object. The selection state is per view layer");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_boolean(func, "state", 0, "", "Selection state to define");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
-
- func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get");
- RNA_def_function_ui_description(func, "Test if the object is hidden for viewport editing. This hiding state is per view layer");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
- parm = RNA_def_boolean(func, "result", 0, "", "Object hideed");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set");
- RNA_def_function_ui_description(func, "Hide the object for viewport editing. This hiding state is per view layer");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_boolean(func, "state", 0, "", "Hide state to define");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
-
- func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get");
- RNA_def_function_ui_description(func, "Test if the object is visible in the 3D viewport, taking into account all visibility settings");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
- parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport");
- parm = RNA_def_boolean(func, "result", 0, "", "Object visible");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get");
- RNA_def_function_ui_description(func, "Test if object is masked in the view layer");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
- parm = RNA_def_boolean(func, "result", 0, "", "Object holdout");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get");
- RNA_def_function_ui_description(func, "Test if object is set to contribute only indirectly (through shadows and reflections) in the view layer");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
- parm = RNA_def_boolean(func, "result", 0, "", "Object indirect only");
- RNA_def_function_return(func, parm);
-
- /* Local View */
- func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get");
- RNA_def_function_ui_description(func, "Get the local view state for this object");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED);
- parm = RNA_def_boolean(func, "result", 0, "", "Object local view state");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set");
- RNA_def_function_ui_description(func, "Set the local view state for this object");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED);
- parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* Matrix space conversion */
- func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space");
- RNA_def_function_ui_description(func, "Convert (transform) the given matrix from one space to another");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "pose_bone", "PoseBone", "",
- "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
- "'LOCAL' spaces are usable)");
- parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The matrix to transform");
- parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The transformed matrix");
- RNA_def_function_output(func, parm);
- parm = RNA_def_enum(func, "from_space", space_items, CONSTRAINT_SPACE_WORLD, "",
- "The space in which 'matrix' is currently");
- parm = RNA_def_enum(func, "to_space", space_items, CONSTRAINT_SPACE_WORLD, "",
- "The space to which you want to transform 'matrix'");
-
- /* Camera-related operations */
- func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
- RNA_def_function_ui_description(func, "Generate the camera projection matrix of this object "
- "(mostly useful for Camera and Light types)");
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The camera projection matrix");
- RNA_def_function_output(func, parm);
- parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
- parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
- parm = RNA_def_float(func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
- parm = RNA_def_float(func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f);
-
- func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
- RNA_def_function_ui_description(func, "Compute the coordinate (and scale for ortho cameras) "
- "given object should be to 'see' all given coordinates");
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float_array(func, "coordinates", 1, NULL, -FLT_MAX, FLT_MAX, "", "Coordinates to fit in",
- -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED);
- parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(parm, 3);
- RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
- RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
- parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
- RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
-
- /* mesh */
- func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
- RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "Dependency Graph", "Evaluated dependency graph within which to evaluate modifiers");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "calc_undeformed", false, "Calculate Undeformed", "Calculate undeformed vertex coordinates");
- parm = RNA_def_pointer(func, "mesh", "Mesh", "",
- "Mesh created from object, remove it if it is only used for export");
- RNA_def_function_return(func, parm);
-
- /* Armature */
- func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
- RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier");
- parm = RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
- RNA_def_function_return(func, parm);
-
- /* Shape key */
- func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
- RNA_def_function_ui_description(func, "Add shape key to this object");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */
- RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes");
- parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
- RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
-
-
- /* Ray Cast */
- func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
- RNA_def_function_ui_description(func, "Cast a ray onto evaluated geometry, in object space "
- "(using context's or provided depsgraph to get evaluated mesh if needed)");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
-
- /* ray start and end */
- parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX,
- "", "Origin of the ray, in object space", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX,
- "", "Direction of the ray, in object space", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX,
- "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "",
- "Depsgraph to use to get evaluated data, when called from original object "
- "(only needed if current Context's depsgraph is not suitable)");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
-
- /* return location and normal */
- parm = RNA_def_boolean(func, "result", 0, "", "Wheter the ray successfully hit the geometry");
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
- "The hit location of this ray cast", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
- "The face normal at the ray cast hit location", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
- RNA_def_function_output(func, parm);
-
-
-
- /* Nearest Point */
- func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
- RNA_def_function_ui_description(func, "Find the nearest point on evaluated geometry, in object space "
- "(using context's or provided depsgraph to get evaluated mesh if needed)");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
-
- /* location of point for test and max distance */
- parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX,
- "", "Point to find closest geometry from (in object space)", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* default is sqrt(FLT_MAX) */
- RNA_def_float(func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "",
- "Depsgraph to use to get evaluated data, when called from original object "
- "(only needed if current Context's depsgraph is not suitable)");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
-
- /* return location and normal */
- parm = RNA_def_boolean(func, "result", 0, "", "Wheter closest point on geometry was found");
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
- "The location on the object closest to the point", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
- "The face normal at the closest point", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
- parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
- RNA_def_function_output(func, parm);
-
-
-
- /* View */
-
- /* utility function for checking if the object is modified */
- func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
- RNA_def_function_ui_description(func, "Determine if this object is modified from the base mesh data");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is modified");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
- RNA_def_function_ui_description(func, "Determine if this object is modified by a deformation from the base mesh data");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is deform-modified");
- RNA_def_function_return(func, parm);
-
-#ifndef NDEBUG
- /* mesh */
- func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info");
- RNA_def_function_ui_description(func, "Returns a string for original/evaluated mesh data (debug builds only, "
- "using context's or provided depsgraph to get evaluated mesh if needed)");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "",
- "Depsgraph to use to get evaluated data, when called from original object "
- "(only needed if current Context's depsgraph is not suitable)");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- /* weak!, no way to return dynamic string type */
- parm = RNA_def_string(func, "result", NULL, 16384, "", "Requested informations");
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
- RNA_def_function_output(func, parm);
-#endif /* NDEBUG */
-
- func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
- RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_boolean(func, "result", 0, "", "Success");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
- RNA_def_function_ui_description(func, "Release memory used by caches associated with this object. Intended to be used by render engines only");
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem mesh_type_items[] = {
+ {eModifierMode_Realtime, "PREVIEW", 0, "Preview", "Apply modifier preview settings"},
+ {eModifierMode_Render, "RENDER", 0, "Render", "Apply modifier render settings"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+# ifndef NDEBUG
+ static const EnumPropertyItem mesh_dm_info_items[] = {
+ {0, "SOURCE", 0, "Source", "Source mesh"},
+ {1, "DEFORM", 0, "Deform", "Objects deform mesh"},
+ {2, "FINAL", 0, "Final", "Objects final mesh"},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif
+
+ /* Special wrapper to access the base selection value */
+ func = RNA_def_function(srna, "select_get", "rna_Object_select_get");
+ RNA_def_function_ui_description(
+ func, "Test if the object is selected. The selection state is per view layer");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+ parm = RNA_def_boolean(func, "result", 0, "", "Object selected");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "select_set", "rna_Object_select_set");
+ RNA_def_function_ui_description(
+ func, "Select or deselect the object. The selection state is per view layer");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_boolean(func, "state", 0, "", "Selection state to define");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+
+ func = RNA_def_function(srna, "hide_get", "rna_Object_hide_get");
+ RNA_def_function_ui_description(
+ func,
+ "Test if the object is hidden for viewport editing. This hiding state is per view layer");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+ parm = RNA_def_boolean(func, "result", 0, "", "Object hideed");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "hide_set", "rna_Object_hide_set");
+ RNA_def_function_ui_description(
+ func, "Hide the object for viewport editing. This hiding state is per view layer");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_boolean(func, "state", 0, "", "Hide state to define");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+
+ func = RNA_def_function(srna, "visible_get", "rna_Object_visible_get");
+ RNA_def_function_ui_description(func,
+ "Test if the object is visible in the 3D viewport, taking into "
+ "account all visibility settings");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+ parm = RNA_def_pointer(
+ func, "viewport", "SpaceView3D", "", "Use this instead of the active 3D viewport");
+ parm = RNA_def_boolean(func, "result", 0, "", "Object visible");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "holdout_get", "rna_Object_holdout_get");
+ RNA_def_function_ui_description(func, "Test if object is masked in the view layer");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+ parm = RNA_def_boolean(func, "result", 0, "", "Object holdout");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "indirect_only_get", "rna_Object_indirect_only_get");
+ RNA_def_function_ui_description(func,
+ "Test if object is set to contribute only indirectly (through "
+ "shadows and reflections) in the view layer");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "view_layer", "ViewLayer", "", "Use this instead of the active view layer");
+ parm = RNA_def_boolean(func, "result", 0, "", "Object indirect only");
+ RNA_def_function_return(func, parm);
+
+ /* Local View */
+ func = RNA_def_function(srna, "local_view_get", "rna_Object_local_view_get");
+ RNA_def_function_ui_description(func, "Get the local view state for this object");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "result", 0, "", "Object local view state");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "local_view_set", "rna_Object_local_view_set");
+ RNA_def_function_ui_description(func, "Set the local view state for this object");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "viewport", "SpaceView3D", "", "Viewport in local view");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "state", 0, "", "Local view state to define");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* Matrix space conversion */
+ func = RNA_def_function(srna, "convert_space", "rna_Object_mat_convert_space");
+ RNA_def_function_ui_description(
+ func, "Convert (transform) the given matrix from one space to another");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func,
+ "pose_bone",
+ "PoseBone",
+ "",
+ "Bone to use to define spaces (may be None, in which case only the two 'WORLD' and "
+ "'LOCAL' spaces are usable)");
+ parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The matrix to transform");
+ parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The transformed matrix");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_enum(func,
+ "from_space",
+ space_items,
+ CONSTRAINT_SPACE_WORLD,
+ "",
+ "The space in which 'matrix' is currently");
+ parm = RNA_def_enum(func,
+ "to_space",
+ space_items,
+ CONSTRAINT_SPACE_WORLD,
+ "",
+ "The space to which you want to transform 'matrix'");
+
+ /* Camera-related operations */
+ func = RNA_def_function(srna, "calc_matrix_camera", "rna_Object_calc_matrix_camera");
+ RNA_def_function_ui_description(func,
+ "Generate the camera projection matrix of this object "
+ "(mostly useful for Camera and Light types)");
+ parm = RNA_def_pointer(
+ func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "result", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The camera projection matrix");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_int(func, "x", 1, 0, INT_MAX, "", "Width of the render area", 0, 10000);
+ parm = RNA_def_int(func, "y", 1, 0, INT_MAX, "", "Height of the render area", 0, 10000);
+ parm = RNA_def_float(
+ func, "scale_x", 1.0f, 1.0e-6f, FLT_MAX, "", "Width scaling factor", 1.0e-2f, 100.0f);
+ parm = RNA_def_float(
+ func, "scale_y", 1.0f, 1.0e-6f, FLT_MAX, "", "Height scaling factor", 1.0e-2f, 100.0f);
+
+ func = RNA_def_function(srna, "camera_fit_coords", "rna_Object_camera_fit_coords");
+ RNA_def_function_ui_description(func,
+ "Compute the coordinate (and scale for ortho cameras) "
+ "given object should be to 'see' all given coordinates");
+ parm = RNA_def_pointer(
+ func, "depsgraph", "Depsgraph", "", "Depsgraph to get evaluated data from");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float_array(func,
+ "coordinates",
+ 1,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "Coordinates to fit in",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL | PROP_DYNAMIC, PARM_REQUIRED);
+ parm = RNA_def_property(func, "co_return", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(parm, 3);
+ RNA_def_property_ui_text(parm, "", "The location to aim to be able to see all given points");
+ RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
+ parm = RNA_def_property(func, "scale_return", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(
+ parm, "", "The ortho scale to aim to be able to see all given points (if relevant)");
+ RNA_def_parameter_flags(parm, 0, PARM_OUTPUT);
+
+ /* mesh */
+ func = RNA_def_function(srna, "to_mesh", "rna_Object_to_mesh");
+ RNA_def_function_ui_description(func, "Create a Mesh data-block with modifiers applied");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func,
+ "depsgraph",
+ "Depsgraph",
+ "Dependency Graph",
+ "Evaluated dependency graph within which to evaluate modifiers");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "apply_modifiers", 0, "", "Apply modifiers");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "calc_undeformed",
+ false,
+ "Calculate Undeformed",
+ "Calculate undeformed vertex coordinates");
+ parm = RNA_def_pointer(func,
+ "mesh",
+ "Mesh",
+ "",
+ "Mesh created from object, remove it if it is only used for export");
+ RNA_def_function_return(func, parm);
+
+ /* Armature */
+ func = RNA_def_function(srna, "find_armature", "modifiers_isDeformedByArmature");
+ RNA_def_function_ui_description(
+ func, "Find armature influencing this object as a parent or via a modifier");
+ parm = RNA_def_pointer(
+ func, "ob_arm", "Object", "", "Armature object influencing this object or NULL");
+ RNA_def_function_return(func, parm);
+
+ /* Shape key */
+ func = RNA_def_function(srna, "shape_key_add", "rna_Object_shape_key_add");
+ RNA_def_function_ui_description(func, "Add shape key to this object");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keyblock"); /* optional */
+ RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes");
+ parm = RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "shape_key_remove", "rna_Object_shape_key_remove");
+ RNA_def_function_ui_description(func, "Remove a Shape Key from this object");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "key", "ShapeKey", "", "Keyblock to be removed");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* Ray Cast */
+ func = RNA_def_function(srna, "ray_cast", "rna_Object_ray_cast");
+ RNA_def_function_ui_description(
+ func,
+ "Cast a ray onto evaluated geometry, in object space "
+ "(using context's or provided depsgraph to get evaluated mesh if needed)");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+
+ /* ray start and end */
+ parm = RNA_def_float_vector(func,
+ "origin",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "Origin of the ray, in object space",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float_vector(func,
+ "direction",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "Direction of the ray, in object space",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_float(func,
+ "distance",
+ BVH_RAYCAST_DIST_MAX,
+ 0.0,
+ BVH_RAYCAST_DIST_MAX,
+ "",
+ "Maximum distance",
+ 0.0,
+ BVH_RAYCAST_DIST_MAX);
+ parm = RNA_def_pointer(
+ func,
+ "depsgraph",
+ "Depsgraph",
+ "",
+ "Depsgraph to use to get evaluated data, when called from original object "
+ "(only needed if current Context's depsgraph is not suitable)");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+
+ /* return location and normal */
+ parm = RNA_def_boolean(func, "result", 0, "", "Wheter the ray successfully hit the geometry");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "location",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Location",
+ "The hit location of this ray cast",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "normal",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Normal",
+ "The face normal at the ray cast hit location",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_int(
+ func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
+ RNA_def_function_output(func, parm);
+
+ /* Nearest Point */
+ func = RNA_def_function(srna, "closest_point_on_mesh", "rna_Object_closest_point_on_mesh");
+ RNA_def_function_ui_description(
+ func,
+ "Find the nearest point on evaluated geometry, in object space "
+ "(using context's or provided depsgraph to get evaluated mesh if needed)");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+
+ /* location of point for test and max distance */
+ parm = RNA_def_float_vector(func,
+ "origin",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "",
+ "Point to find closest geometry from (in object space)",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* default is sqrt(FLT_MAX) */
+ RNA_def_float(
+ func, "distance", 1.844674352395373e+19, 0.0, FLT_MAX, "", "Maximum distance", 0.0, FLT_MAX);
+ parm = RNA_def_pointer(
+ func,
+ "depsgraph",
+ "Depsgraph",
+ "",
+ "Depsgraph to use to get evaluated data, when called from original object "
+ "(only needed if current Context's depsgraph is not suitable)");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+
+ /* return location and normal */
+ parm = RNA_def_boolean(func, "result", 0, "", "Wheter closest point on geometry was found");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "location",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Location",
+ "The location on the object closest to the point",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "normal",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Normal",
+ "The face normal at the closest point",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ parm = RNA_def_int(
+ func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
+ RNA_def_function_output(func, parm);
+
+ /* View */
+
+ /* utility function for checking if the object is modified */
+ func = RNA_def_function(srna, "is_modified", "rna_Object_is_modified");
+ RNA_def_function_ui_description(func,
+ "Determine if this object is modified from the base mesh data");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is modified");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "is_deform_modified", "rna_Object_is_deform_modified");
+ RNA_def_function_ui_description(
+ func, "Determine if this object is modified by a deformation from the base mesh data");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene in which to check the object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "settings", mesh_type_items, 0, "", "Modifier settings to apply");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "result", 0, "", "Whether the object is deform-modified");
+ RNA_def_function_return(func, parm);
+
+# ifndef NDEBUG
+ /* mesh */
+ func = RNA_def_function(srna, "dm_info", "rna_Object_me_eval_info");
+ RNA_def_function_ui_description(
+ func,
+ "Returns a string for original/evaluated mesh data (debug builds only, "
+ "using context's or provided depsgraph to get evaluated mesh if needed)");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ parm = RNA_def_enum(func, "type", mesh_dm_info_items, 0, "", "Modifier settings to apply");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func,
+ "depsgraph",
+ "Depsgraph",
+ "",
+ "Depsgraph to use to get evaluated data, when called from original object "
+ "(only needed if current Context's depsgraph is not suitable)");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ /* weak!, no way to return dynamic string type */
+ parm = RNA_def_string(func, "result", NULL, 16384, "", "Requested informations");
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
+ RNA_def_function_output(func, parm);
+# endif /* NDEBUG */
+
+ func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode");
+ RNA_def_function_ui_description(func, "Load the objects edit-mode data into the object data");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_boolean(func, "result", 0, "", "Success");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "cache_release", "BKE_object_free_caches");
+ RNA_def_function_ui_description(func,
+ "Release memory used by caches associated with this object. "
+ "Intended to be used by render engines only");
}
#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 337b44a534b..157d011eb72 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -36,1769 +36,1902 @@
#include "WM_types.h"
static const EnumPropertyItem effector_shape_items[] = {
- {PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
- {PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
- {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", "Field originates from the local XY plane of the object"},
- {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface", "Field originates from the surface of the object"},
- {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point", "Field originates from all of the vertices of the object"},
- {0, NULL, 0, NULL, NULL},
+ {PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
+ {PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
+ {PFIELD_SHAPE_PLANE,
+ "PLANE",
+ 0,
+ "Plane",
+ "Field originates from the local XY plane of the object"},
+ {PFIELD_SHAPE_SURFACE,
+ "SURFACE",
+ 0,
+ "Surface",
+ "Field originates from the surface of the object"},
+ {PFIELD_SHAPE_POINTS,
+ "POINTS",
+ 0,
+ "Every Point",
+ "Field originates from all of the vertices of the object"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_math_base.h"
-
+# include "BLI_math_base.h"
/* type specific return values only used from functions */
static const EnumPropertyItem curve_shape_items[] = {
- {PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
- {PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
- {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", "Field originates from the local XY plane of the object"},
- {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", "Field originates from the curve itself"},
- {0, NULL, 0, NULL, NULL},
+ {PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
+ {PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
+ {PFIELD_SHAPE_PLANE,
+ "PLANE",
+ 0,
+ "Plane",
+ "Field originates from the local XY plane of the object"},
+ {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve", "Field originates from the curve itself"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem empty_shape_items[] = {
- {PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
- {PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
- {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", "Field originates from the local XY plane of the object"},
- {0, NULL, 0, NULL, NULL},
+ {PFIELD_SHAPE_POINT, "POINT", 0, "Point", "Field originates from the object center"},
+ {PFIELD_SHAPE_LINE, "LINE", 0, "Line", "Field originates from the local Z axis of the object"},
+ {PFIELD_SHAPE_PLANE,
+ "PLANE",
+ 0,
+ "Plane",
+ "Field originates from the local XY plane of the object"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem vortex_shape_items[] = {
- {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
- {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
- {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""},
- {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point (New)", ""},
- {0, NULL, 0, NULL, NULL},
+ {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
+ {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
+ {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Surface falloff (New)", ""},
+ {PFIELD_SHAPE_POINTS, "POINTS", 0, "Every Point (New)", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem curve_vortex_shape_items[] = {
- {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
- {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
- {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""},
- {0, NULL, 0, NULL, NULL},
+ {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
+ {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
+ {PFIELD_SHAPE_SURFACE, "SURFACE", 0, "Curve (New)", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem empty_vortex_shape_items[] = {
- {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
- {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
- {0, NULL, 0, NULL, NULL},
+ {PFIELD_SHAPE_POINT, "POINT", 0, "Point", ""},
+ {PFIELD_SHAPE_PLANE, "PLANE", 0, "Plane", ""},
+ {0, NULL, 0, NULL, NULL},
};
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "DNA_modifier_types.h"
-#include "DNA_texture_types.h"
+# include "DNA_modifier_types.h"
+# include "DNA_texture_types.h"
-#include "BKE_collection.h"
-#include "BKE_context.h"
-#include "BKE_modifier.h"
-#include "BKE_pointcache.h"
+# include "BKE_collection.h"
+# include "BKE_context.h"
+# include "BKE_modifier.h"
+# include "BKE_pointcache.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "ED_object.h"
+# include "ED_object.h"
static void rna_Cache_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- PointCache *cache = (PointCache *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ PointCache *cache = (PointCache *)ptr->data;
- if (!ob)
- return;
+ if (!ob)
+ return;
- cache->flag |= PTCACHE_OUTDATED;
+ cache->flag |= PTCACHE_OUTDATED;
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- if (pid.cache) {
- /* Just make sure this wasn't changed. */
- if (pid.type == PTCACHE_TYPE_SMOKE_DOMAIN)
- cache->step = 1;
- BKE_ptcache_update_info(&pid);
- }
+ if (pid.cache) {
+ /* Just make sure this wasn't changed. */
+ if (pid.type == PTCACHE_TYPE_SMOKE_DOMAIN)
+ cache->step = 1;
+ BKE_ptcache_update_info(&pid);
+ }
}
static void rna_Cache_toggle_disk_cache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- PointCache *cache = (PointCache *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ PointCache *cache = (PointCache *)ptr->data;
- if (!ob)
- return;
+ if (!ob)
+ return;
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- /* smoke can only use disk cache */
- if (pid.cache && pid.type != PTCACHE_TYPE_SMOKE_DOMAIN)
- BKE_ptcache_toggle_disk_cache(&pid);
- else
- cache->flag ^= PTCACHE_DISK_CACHE;
+ /* smoke can only use disk cache */
+ if (pid.cache && pid.type != PTCACHE_TYPE_SMOKE_DOMAIN)
+ BKE_ptcache_toggle_disk_cache(&pid);
+ else
+ cache->flag ^= PTCACHE_DISK_CACHE;
}
static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- PointCache *cache = (PointCache *)ptr->data;
- bool use_new_name = true;
+ Object *ob = (Object *)ptr->id.data;
+ PointCache *cache = (PointCache *)ptr->data;
+ bool use_new_name = true;
- if (!ob)
- return;
+ if (!ob)
+ return;
- /* TODO: check for proper characters */
+ /* TODO: check for proper characters */
- if (cache->flag & PTCACHE_EXTERNAL) {
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ if (cache->flag & PTCACHE_EXTERNAL) {
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- if (pid.cache) {
- BKE_ptcache_load_external(&pid);
- }
+ if (pid.cache) {
+ BKE_ptcache_load_external(&pid);
+ }
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_POINTCACHE, ob);
- }
- else {
- PTCacheID *pid = NULL, *pid2 = NULL;
- ListBase pidlist;
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_POINTCACHE, ob);
+ }
+ else {
+ PTCacheID *pid = NULL, *pid2 = NULL;
+ ListBase pidlist;
- BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
+ BKE_ptcache_ids_from_object(&pidlist, ob, NULL, 0);
- for (pid = pidlist.first; pid; pid = pid->next) {
- if (pid->cache == cache)
- pid2 = pid;
- else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) {
- /*TODO: report "name exists" to user */
- BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
- use_new_name = false;
- }
- }
+ for (pid = pidlist.first; pid; pid = pid->next) {
+ if (pid->cache == cache)
+ pid2 = pid;
+ else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) {
+ /*TODO: report "name exists" to user */
+ BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name));
+ use_new_name = false;
+ }
+ }
- if (use_new_name) {
- BLI_filename_make_safe(cache->name);
+ if (use_new_name) {
+ BLI_filename_make_safe(cache->name);
- if (pid2 && cache->flag & PTCACHE_DISK_CACHE) {
- char old_name[80];
- char new_name[80];
+ if (pid2 && cache->flag & PTCACHE_DISK_CACHE) {
+ char old_name[80];
+ char new_name[80];
- BLI_strncpy(old_name, cache->prev_name, sizeof(old_name));
- BLI_strncpy(new_name, cache->name, sizeof(new_name));
+ BLI_strncpy(old_name, cache->prev_name, sizeof(old_name));
+ BLI_strncpy(new_name, cache->name, sizeof(new_name));
- BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
- }
+ BKE_ptcache_disk_cache_rename(pid2, old_name, new_name);
+ }
- BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name));
- }
+ BLI_strncpy(cache->prev_name, cache->name, sizeof(cache->prev_name));
+ }
- BLI_freelistN(&pidlist);
- }
+ BLI_freelistN(&pidlist);
+ }
}
static void rna_Cache_list_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- PointCache *cache = ptr->data;
- ListBase lb;
+ PointCache *cache = ptr->data;
+ ListBase lb;
- while (cache->prev)
- cache = cache->prev;
+ while (cache->prev)
+ cache = cache->prev;
- lb.first = cache;
- lb.last = NULL; /* not used by listbase_begin */
+ lb.first = cache;
+ lb.last = NULL; /* not used by listbase_begin */
- rna_iterator_listbase_begin(iter, &lb, NULL);
+ rna_iterator_listbase_begin(iter, &lb, NULL);
}
-static void rna_Cache_active_point_cache_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Cache_active_point_cache_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = ptr->id.data;
- PointCache *cache = ptr->data;
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- *min = 0;
- *max = 0;
+ *min = 0;
+ *max = 0;
- if (pid.cache) {
- *max = max_ii(0, BLI_listbase_count(pid.ptcaches) - 1);
- }
+ if (pid.cache) {
+ *max = max_ii(0, BLI_listbase_count(pid.ptcaches) - 1);
+ }
}
static int rna_Cache_active_point_cache_index_get(PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- PointCache *cache = ptr->data;
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- int num = 0;
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ int num = 0;
- if (pid.cache) {
- num = BLI_findindex(pid.ptcaches, cache);
- }
+ if (pid.cache) {
+ num = BLI_findindex(pid.ptcaches, cache);
+ }
- return num;
+ return num;
}
static void rna_Cache_active_point_cache_index_set(struct PointerRNA *ptr, int value)
{
- Object *ob = ptr->id.data;
- PointCache *cache = ptr->data;
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- if (pid.cache) {
- *(pid.cache_ptr) = BLI_findlink(pid.ptcaches, value);
- }
+ if (pid.cache) {
+ *(pid.cache_ptr) = BLI_findlink(pid.ptcaches, value);
+ }
}
-static void rna_PointCache_frame_step_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_PointCache_frame_step_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = ptr->id.data;
- PointCache *cache = ptr->data;
- PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
+ Object *ob = ptr->id.data;
+ PointCache *cache = ptr->data;
+ PTCacheID pid = BKE_ptcache_id_find(ob, NULL, cache);
- *min = 1;
- *max = 20;
+ *min = 1;
+ *max = 20;
- if (pid.cache) {
- *max = pid.max_step;
- }
+ if (pid.cache) {
+ *max = pid.max_step;
+ }
}
static char *rna_CollisionSettings_path(PointerRNA *UNUSED(ptr))
{
- /* both methods work ok, but return the shorter path */
-#if 0
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Collision);
-
- if (md) {
- char name_esc[sizeof(md->name) * 2];
-
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
- }
- else {
- return BLI_strdup("");
- }
-#else
- /* more reliable */
- return BLI_strdup("collision");
-#endif
+ /* both methods work ok, but return the shorter path */
+# if 0
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Collision);
+
+ if (md) {
+ char name_esc[sizeof(md->name) * 2];
+
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
+ }
+ else {
+ return BLI_strdup("");
+ }
+# else
+ /* more reliable */
+ return BLI_strdup("collision");
+# endif
}
static bool rna_SoftBodySettings_use_edges_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- return (((data->softflag) & OB_SB_EDGES) != 0);
+ Object *data = (Object *)(ptr->id.data);
+ return (((data->softflag) & OB_SB_EDGES) != 0);
}
static void rna_SoftBodySettings_use_edges_set(PointerRNA *ptr, bool value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value) data->softflag |= OB_SB_EDGES;
- else data->softflag &= ~OB_SB_EDGES;
+ Object *data = (Object *)(ptr->id.data);
+ if (value)
+ data->softflag |= OB_SB_EDGES;
+ else
+ data->softflag &= ~OB_SB_EDGES;
}
static bool rna_SoftBodySettings_use_goal_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- return (((data->softflag) & OB_SB_GOAL) != 0);
+ Object *data = (Object *)(ptr->id.data);
+ return (((data->softflag) & OB_SB_GOAL) != 0);
}
static void rna_SoftBodySettings_use_goal_set(PointerRNA *ptr, bool value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value) data->softflag |= OB_SB_GOAL;
- else data->softflag &= ~OB_SB_GOAL;
+ Object *data = (Object *)(ptr->id.data);
+ if (value)
+ data->softflag |= OB_SB_GOAL;
+ else
+ data->softflag &= ~OB_SB_GOAL;
}
static bool rna_SoftBodySettings_stiff_quads_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- return (((data->softflag) & OB_SB_QUADS) != 0);
+ Object *data = (Object *)(ptr->id.data);
+ return (((data->softflag) & OB_SB_QUADS) != 0);
}
static void rna_SoftBodySettings_stiff_quads_set(PointerRNA *ptr, bool value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value) data->softflag |= OB_SB_QUADS;
- else data->softflag &= ~OB_SB_QUADS;
+ Object *data = (Object *)(ptr->id.data);
+ if (value)
+ data->softflag |= OB_SB_QUADS;
+ else
+ data->softflag &= ~OB_SB_QUADS;
}
static bool rna_SoftBodySettings_self_collision_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- return (((data->softflag) & OB_SB_SELF) != 0);
+ Object *data = (Object *)(ptr->id.data);
+ return (((data->softflag) & OB_SB_SELF) != 0);
}
static void rna_SoftBodySettings_self_collision_set(PointerRNA *ptr, bool value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value) data->softflag |= OB_SB_SELF;
- else data->softflag &= ~OB_SB_SELF;
+ Object *data = (Object *)(ptr->id.data);
+ if (value)
+ data->softflag |= OB_SB_SELF;
+ else
+ data->softflag &= ~OB_SB_SELF;
}
static int rna_SoftBodySettings_new_aero_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- if (data->softflag & OB_SB_AERO_ANGLE)
- return 1;
- else
- return 0;
+ Object *data = (Object *)(ptr->id.data);
+ if (data->softflag & OB_SB_AERO_ANGLE)
+ return 1;
+ else
+ return 0;
}
static void rna_SoftBodySettings_new_aero_set(PointerRNA *ptr, int value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value == 1)
- data->softflag |= OB_SB_AERO_ANGLE;
- else /* value == 0 */
- data->softflag &= ~OB_SB_AERO_ANGLE;
+ Object *data = (Object *)(ptr->id.data);
+ if (value == 1)
+ data->softflag |= OB_SB_AERO_ANGLE;
+ else /* value == 0 */
+ data->softflag &= ~OB_SB_AERO_ANGLE;
}
static bool rna_SoftBodySettings_face_collision_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- return (((data->softflag) & OB_SB_FACECOLL) != 0);
+ Object *data = (Object *)(ptr->id.data);
+ return (((data->softflag) & OB_SB_FACECOLL) != 0);
}
static void rna_SoftBodySettings_face_collision_set(PointerRNA *ptr, bool value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value) data->softflag |= OB_SB_FACECOLL;
- else data->softflag &= ~OB_SB_FACECOLL;
+ Object *data = (Object *)(ptr->id.data);
+ if (value)
+ data->softflag |= OB_SB_FACECOLL;
+ else
+ data->softflag &= ~OB_SB_FACECOLL;
}
static bool rna_SoftBodySettings_edge_collision_get(PointerRNA *ptr)
{
- Object *data = (Object *)(ptr->id.data);
- return (((data->softflag) & OB_SB_EDGECOLL) != 0);
+ Object *data = (Object *)(ptr->id.data);
+ return (((data->softflag) & OB_SB_EDGECOLL) != 0);
}
static void rna_SoftBodySettings_edge_collision_set(PointerRNA *ptr, bool value)
{
- Object *data = (Object *)(ptr->id.data);
- if (value) data->softflag |= OB_SB_EDGECOLL;
- else data->softflag &= ~OB_SB_EDGECOLL;
+ Object *data = (Object *)(ptr->id.data);
+ if (value)
+ data->softflag |= OB_SB_EDGECOLL;
+ else
+ data->softflag &= ~OB_SB_EDGECOLL;
}
static void rna_SoftBodySettings_goal_vgroup_get(PointerRNA *ptr, char *value)
{
- SoftBody *sb = (SoftBody *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup);
+ SoftBody *sb = (SoftBody *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, sb->vertgroup);
}
static int rna_SoftBodySettings_goal_vgroup_length(PointerRNA *ptr)
{
- SoftBody *sb = (SoftBody *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, sb->vertgroup);
+ SoftBody *sb = (SoftBody *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, sb->vertgroup);
}
static void rna_SoftBodySettings_goal_vgroup_set(PointerRNA *ptr, const char *value)
{
- SoftBody *sb = (SoftBody *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
+ SoftBody *sb = (SoftBody *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &sb->vertgroup);
}
static void rna_SoftBodySettings_mass_vgroup_set(PointerRNA *ptr, const char *value)
{
- SoftBody *sb = (SoftBody *)ptr->data;
- rna_object_vgroup_name_set(ptr, value, sb->namedVG_Mass, sizeof(sb->namedVG_Mass));
+ SoftBody *sb = (SoftBody *)ptr->data;
+ rna_object_vgroup_name_set(ptr, value, sb->namedVG_Mass, sizeof(sb->namedVG_Mass));
}
static void rna_SoftBodySettings_spring_vgroup_set(PointerRNA *ptr, const char *value)
{
- SoftBody *sb = (SoftBody *)ptr->data;
- rna_object_vgroup_name_set(ptr, value, sb->namedVG_Spring_K, sizeof(sb->namedVG_Spring_K));
+ SoftBody *sb = (SoftBody *)ptr->data;
+ rna_object_vgroup_name_set(ptr, value, sb->namedVG_Spring_K, sizeof(sb->namedVG_Spring_K));
}
-
static char *rna_SoftBodySettings_path(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
- char name_esc[sizeof(md->name) * 2];
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings", name_esc);
}
static int particle_id_check(PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- return (GS(id->name) == ID_PA);
+ return (GS(id->name) == ID_PA);
}
static void rna_FieldSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- if (particle_id_check(ptr)) {
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
-
- if (part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
- id_us_min(&part->pd->tex->id);
- part->pd->tex = NULL;
- }
-
- if (part->pd2 && part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
- id_us_min(&part->pd2->tex->id);
- part->pd2->tex = NULL;
- }
-
- DEG_id_tag_update(&part->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION | ID_RECALC_PSYS_RESET);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
-
- }
- else {
- Object *ob = (Object *)ptr->id.data;
-
- if (ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
- id_us_min(&ob->pd->tex->id);
- ob->pd->tex = NULL;
- }
-
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- }
+ if (particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->pd->forcefield != PFIELD_TEXTURE && part->pd->tex) {
+ id_us_min(&part->pd->tex->id);
+ part->pd->tex = NULL;
+ }
+
+ if (part->pd2 && part->pd2->forcefield != PFIELD_TEXTURE && part->pd2->tex) {
+ id_us_min(&part->pd2->tex->id);
+ part->pd2->tex = NULL;
+ }
+
+ DEG_id_tag_update(&part->id,
+ ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION |
+ ID_RECALC_PSYS_RESET);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ }
+ else {
+ Object *ob = (Object *)ptr->id.data;
+
+ if (ob->pd->forcefield != PFIELD_TEXTURE && ob->pd->tex) {
+ id_us_min(&ob->pd->tex->id);
+ ob->pd->tex = NULL;
+ }
+
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ }
}
static void rna_FieldSettings_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- if (!particle_id_check(ptr)) {
- Object *ob = (Object *)ptr->id.data;
- ED_object_check_force_modifiers(bmain, scene, ob);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
- }
+ if (!particle_id_check(ptr)) {
+ Object *ob = (Object *)ptr->id.data;
+ ED_object_check_force_modifiers(bmain, scene, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ }
}
static void rna_FieldSettings_type_set(PointerRNA *ptr, int value)
{
- PartDeflect *part_deflect = (PartDeflect *) ptr->data;
-
- part_deflect->forcefield = value;
-
- if (!particle_id_check(ptr)) {
- Object *ob = (Object *)ptr->id.data;
- ob->pd->forcefield = value;
- if (ELEM(value, PFIELD_WIND, PFIELD_VORTEX)) {
- ob->empty_drawtype = OB_SINGLE_ARROW;
- }
- else {
- ob->empty_drawtype = OB_PLAINAXES;
- }
- }
+ PartDeflect *part_deflect = (PartDeflect *)ptr->data;
+
+ part_deflect->forcefield = value;
+
+ if (!particle_id_check(ptr)) {
+ Object *ob = (Object *)ptr->id.data;
+ ob->pd->forcefield = value;
+ if (ELEM(value, PFIELD_WIND, PFIELD_VORTEX)) {
+ ob->empty_drawtype = OB_SINGLE_ARROW;
+ }
+ else {
+ ob->empty_drawtype = OB_PLAINAXES;
+ }
+ }
}
static void rna_FieldSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- if (particle_id_check(ptr)) {
- DEG_id_tag_update((ID *)ptr->id.data, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION | ID_RECALC_PSYS_RESET);
- }
- else {
- Object *ob = (Object *)ptr->id.data;
-
- /* do this before scene sort, that one checks for CU_PATH */
-#if 0 /* XXX */
- if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) {
- Curve *cu = ob->data;
- cu->flag |= (CU_PATH | CU_3D);
- do_curvebuts(B_CU3D); /* all curves too */
- }
-#endif
-
- rna_FieldSettings_shape_update(bmain, scene, ptr);
-
- DEG_relations_tag_update(bmain);
-
- if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- else
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
-
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
- }
+ if (particle_id_check(ptr)) {
+ DEG_id_tag_update((ID *)ptr->id.data,
+ ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION |
+ ID_RECALC_PSYS_RESET);
+ }
+ else {
+ Object *ob = (Object *)ptr->id.data;
+
+ /* do this before scene sort, that one checks for CU_PATH */
+# if 0 /* XXX */
+ if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE) {
+ Curve *cu = ob->data;
+ cu->flag |= (CU_PATH | CU_3D);
+ do_curvebuts(B_CU3D); /* all curves too */
+ }
+# endif
+
+ rna_FieldSettings_shape_update(bmain, scene, ptr);
+
+ DEG_relations_tag_update(bmain);
+
+ if (ob->type == OB_CURVE && ob->pd->forcefield == PFIELD_GUIDE)
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
+ else
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
+
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ }
}
static char *rna_FieldSettings_path(PointerRNA *ptr)
{
- PartDeflect *pd = (PartDeflect *)ptr->data;
-
- /* Check through all possible places the settings can be to find the right one */
-
- if (particle_id_check(ptr)) {
- /* particle system force field */
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
-
- if (part->pd == pd)
- return BLI_strdup("force_field_1");
- else if (part->pd2 == pd)
- return BLI_strdup("force_field_2");
- }
- else {
- /* object force field */
- Object *ob = (Object *)ptr->id.data;
-
- if (ob->pd == pd)
- return BLI_strdup("field");
- }
- return NULL;
+ PartDeflect *pd = (PartDeflect *)ptr->data;
+
+ /* Check through all possible places the settings can be to find the right one */
+
+ if (particle_id_check(ptr)) {
+ /* particle system force field */
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->pd == pd)
+ return BLI_strdup("force_field_1");
+ else if (part->pd2 == pd)
+ return BLI_strdup("force_field_2");
+ }
+ else {
+ /* object force field */
+ Object *ob = (Object *)ptr->id.data;
+
+ if (ob->pd == pd)
+ return BLI_strdup("field");
+ }
+ return NULL;
}
static void rna_EffectorWeight_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
-
- if (id && GS(id->name) == ID_SCE) {
- Scene *scene = (Scene *)id;
- FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
- {
- BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
- }
- FOREACH_SCENE_OBJECT_END;
- }
- else {
- DEG_id_tag_update(id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- }
+ ID *id = ptr->id.data;
+
+ if (id && GS(id->name) == ID_SCE) {
+ Scene *scene = (Scene *)id;
+ FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
+ BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
+ }
+ FOREACH_SCENE_OBJECT_END;
+ }
+ else {
+ DEG_id_tag_update(id, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ }
}
-static void rna_EffectorWeight_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_EffectorWeight_dependency_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
- DEG_id_tag_update((ID *)ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
+ DEG_id_tag_update((ID *)ptr->id.data, ID_RECALC_GEOMETRY | ID_RECALC_PSYS_RESET);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
static char *rna_EffectorWeight_path(PointerRNA *ptr)
{
- EffectorWeights *ew = (EffectorWeights *)ptr->data;
- /* Check through all possible places the settings can be to find the right one */
-
- if (particle_id_check(ptr)) {
- /* particle effector weights */
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
-
- if (part->effector_weights == ew) {
- return BLI_strdup("effector_weights");
- }
- }
- else {
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md;
-
- /* check softbody modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
- if (md) {
- /* no pointer from modifier data to actual softbody storage, would be good to add */
- if (ob->soft->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
- }
- }
-
- /* check cloth modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
- if (md) {
- ClothModifierData *cmd = (ClothModifierData *)md;
- if (cmd->sim_parms->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
- }
- }
-
- /* check smoke modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
- if (md) {
- SmokeModifierData *smd = (SmokeModifierData *)md;
- if (smd->domain->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
- }
- }
-
- /* check dynamic paint modifier */
- md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
- if (md) {
- DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
-
- if (pmd->canvas) {
- DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
-
- for (; surface; surface = surface->next) {
- if (surface->effector_weights == ew) {
- char name_esc[sizeof(md->name) * 2];
- char name_esc_surface[sizeof(surface->name) * 2];
-
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
- return BLI_sprintfN("modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
- ".effector_weights", name_esc, name_esc_surface);
- }
- }
- }
- }
- }
- return NULL;
+ EffectorWeights *ew = (EffectorWeights *)ptr->data;
+ /* Check through all possible places the settings can be to find the right one */
+
+ if (particle_id_check(ptr)) {
+ /* particle effector weights */
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+
+ if (part->effector_weights == ew) {
+ return BLI_strdup("effector_weights");
+ }
+ }
+ else {
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md;
+
+ /* check softbody modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_Softbody);
+ if (md) {
+ /* no pointer from modifier data to actual softbody storage, would be good to add */
+ if (ob->soft->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ }
+ }
+
+ /* check cloth modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
+ if (md) {
+ ClothModifierData *cmd = (ClothModifierData *)md;
+ if (cmd->sim_parms->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ }
+ }
+
+ /* check smoke modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_Smoke);
+ if (md) {
+ SmokeModifierData *smd = (SmokeModifierData *)md;
+ if (smd->domain->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].settings.effector_weights", name_esc);
+ }
+ }
+
+ /* check dynamic paint modifier */
+ md = (ModifierData *)modifiers_findByType(ob, eModifierType_DynamicPaint);
+ if (md) {
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
+
+ if (pmd->canvas) {
+ DynamicPaintSurface *surface = pmd->canvas->surfaces.first;
+
+ for (; surface; surface = surface->next) {
+ if (surface->effector_weights == ew) {
+ char name_esc[sizeof(md->name) * 2];
+ char name_esc_surface[sizeof(surface->name) * 2];
+
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ BLI_strescape(name_esc_surface, surface->name, sizeof(name_esc_surface));
+ return BLI_sprintfN(
+ "modifiers[\"%s\"].canvas_settings.canvas_surfaces[\"%s\"]"
+ ".effector_weights",
+ name_esc,
+ name_esc_surface);
+ }
+ }
+ }
+ }
+ }
+ return NULL;
}
static void rna_CollisionSettings_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md = modifiers_findByType(ob, eModifierType_Collision);
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md = modifiers_findByType(ob, eModifierType_Collision);
- /* add/remove modifier as needed */
- if (ob->pd->deflect && !md)
- ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision);
- else if (!ob->pd->deflect && md)
- ED_object_modifier_remove(NULL, bmain, ob, md);
+ /* add/remove modifier as needed */
+ if (ob->pd->deflect && !md)
+ ED_object_modifier_add(NULL, bmain, scene, ob, NULL, eModifierType_Collision);
+ else if (!ob->pd->deflect && md)
+ ED_object_modifier_remove(NULL, bmain, ob, md);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
-static void rna_CollisionSettings_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_CollisionSettings_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
static void rna_softbody_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
static void rna_softbody_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
- rna_softbody_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ rna_softbody_update(bmain, scene, ptr);
}
-static const EnumPropertyItem *rna_Effector_shape_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Effector_shape_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- Object *ob = NULL;
+ Object *ob = NULL;
- if (particle_id_check(ptr))
- return empty_shape_items;
+ if (particle_id_check(ptr))
+ return empty_shape_items;
- ob = (Object *)ptr->id.data;
+ ob = (Object *)ptr->id.data;
- if (ob->type == OB_CURVE) {
- if (ob->pd->forcefield == PFIELD_VORTEX)
- return curve_vortex_shape_items;
+ if (ob->type == OB_CURVE) {
+ if (ob->pd->forcefield == PFIELD_VORTEX)
+ return curve_vortex_shape_items;
- return curve_shape_items;
- }
- else if (ELEM(ob->type, OB_MESH, OB_SURF, OB_FONT)) {
- if (ob->pd->forcefield == PFIELD_VORTEX)
- return vortex_shape_items;
+ return curve_shape_items;
+ }
+ else if (ELEM(ob->type, OB_MESH, OB_SURF, OB_FONT)) {
+ if (ob->pd->forcefield == PFIELD_VORTEX)
+ return vortex_shape_items;
- return effector_shape_items;
- }
- else {
- if (ob->pd->forcefield == PFIELD_VORTEX)
- return empty_vortex_shape_items;
+ return effector_shape_items;
+ }
+ else {
+ if (ob->pd->forcefield == PFIELD_VORTEX)
+ return empty_vortex_shape_items;
- return empty_shape_items;
- }
+ return empty_shape_items;
+ }
}
#else
static void rna_def_pointcache_common(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem point_cache_compress_items[] = {
- {PTCACHE_COMPRESS_NO, "NO", 0, "None", "No compression"},
- {PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"},
- {PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "startframe");
- RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
- RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
- RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "endframe");
- RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
-
- prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "step");
- RNA_def_property_range(prop, 1, 20);
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_PointCache_frame_step_range");
- RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "index");
- RNA_def_property_range(prop, -1, 100);
- RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
-
- prop = RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, point_cache_compress_items);
- RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
-
- /* flags */
- prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
- RNA_def_property_ui_text(prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
-
- prop = RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Cache is outdated", "");
-
- prop = RNA_def_property(srna, "is_frame_skip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Name", "Cache name");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "path");
- RNA_def_property_ui_text(prop, "File Path", "Cache file path");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
-
- /* removed, see PTCACHE_QUICK_CACHE */
-#if 0
- prop = RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
- RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
-#endif
-
- prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "info");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status");
-
- prop = RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
- RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
-
- prop = RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
- RNA_def_property_ui_text(prop, "Library Path",
- "Use this file's path for the disk cache when library linked into another file "
- "(for local bakes per scene file, disable this option)");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem point_cache_compress_items[] = {
+ {PTCACHE_COMPRESS_NO, "NO", 0, "None", "No compression"},
+ {PTCACHE_COMPRESS_LZO, "LIGHT", 0, "Light", "Fast but not so effective compression"},
+ {PTCACHE_COMPRESS_LZMA, "HEAVY", 0, "Heavy", "Effective but slow compression"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "startframe");
+ RNA_def_property_range(prop, -MAXFRAME, MAXFRAME);
+ RNA_def_property_ui_range(prop, 1, MAXFRAME, 1, 1);
+ RNA_def_property_ui_text(prop, "Start", "Frame on which the simulation starts");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "endframe");
+ RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_ui_text(prop, "End", "Frame on which the simulation stops");
+
+ prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, 20);
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_PointCache_frame_step_range");
+ RNA_def_property_ui_text(prop, "Cache Step", "Number of frames between cached frames");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "index");
+ RNA_def_property_range(prop, -1, 100);
+ RNA_def_property_ui_text(prop, "Cache Index", "Index number of cache files");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ prop = RNA_def_property(srna, "compression", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, point_cache_compress_items);
+ RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
+
+ /* flags */
+ prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_baking", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_BAKING);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_disk_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_DISK_CACHE);
+ RNA_def_property_ui_text(
+ prop, "Disk Cache", "Save cache files to disk (.blend file must be saved first)");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_toggle_disk_cache");
+
+ prop = RNA_def_property(srna, "is_outdated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_OUTDATED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Cache is outdated", "");
+
+ prop = RNA_def_property(srna, "is_frame_skip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_FRAMES_SKIPPED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "Cache name");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "path");
+ RNA_def_property_ui_text(prop, "File Path", "Cache file path");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ /* removed, see PTCACHE_QUICK_CACHE */
+# if 0
+ prop = RNA_def_property(srna, "use_quick_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_QUICK_CACHE);
+ RNA_def_property_ui_text(prop, "Quick Cache", "Update simulation with cache steps");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+# endif
+
+ prop = RNA_def_property(srna, "info", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "info");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Cache Info", "Info on current cache status");
+
+ prop = RNA_def_property(srna, "use_external", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTCACHE_EXTERNAL);
+ RNA_def_property_ui_text(prop, "External", "Read cache from an external location");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
+
+ prop = RNA_def_property(srna, "use_library_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PTCACHE_IGNORE_LIBPATH);
+ RNA_def_property_ui_text(
+ prop,
+ "Library Path",
+ "Use this file's path for the disk cache when library linked into another file "
+ "(for local bakes per scene file, disable this option)");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_idname_change");
}
static void rna_def_ptcache_point_caches(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
-
- RNA_def_property_srna(cprop, "PointCaches");
- srna = RNA_def_struct(brna, "PointCaches", NULL);
- RNA_def_struct_sdna(srna, "PointCache");
- RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_Cache_active_point_cache_index_get",
- "rna_Cache_active_point_cache_index_set",
- "rna_Cache_active_point_cache_index_range");
- RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
- RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
-
- /* And define another RNA type for those collection items. */
- srna = RNA_def_struct(brna, "PointCacheItem", NULL);
- RNA_def_struct_sdna(srna, "PointCache");
- RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
- RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
-
- rna_def_pointcache_common(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
+
+ RNA_def_property_srna(cprop, "PointCaches");
+ srna = RNA_def_struct(brna, "PointCaches", NULL);
+ RNA_def_struct_sdna(srna, "PointCache");
+ RNA_def_struct_ui_text(srna, "Point Caches", "Collection of point caches");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_Cache_active_point_cache_index_get",
+ "rna_Cache_active_point_cache_index_set",
+ "rna_Cache_active_point_cache_index_range");
+ RNA_def_property_ui_text(prop, "Active Point Cache Index", "");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_Cache_change");
+
+ /* And define another RNA type for those collection items. */
+ srna = RNA_def_struct(brna, "PointCacheItem", NULL);
+ RNA_def_struct_sdna(srna, "PointCache");
+ RNA_def_struct_ui_text(srna, "Point Cache", "Point cache for physics simulations");
+ RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
+
+ rna_def_pointcache_common(srna);
}
static void rna_def_pointcache_active(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "PointCache", NULL);
- RNA_def_struct_ui_text(srna, "Active Point Cache", "Active point cache for physics simulations");
- RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
-
- rna_def_pointcache_common(srna);
-
- /* This first-level RNA pointer also has list of all caches from owning ID.
- * Those caches items have exact same content as 'active' one, except for that collection,
- * to prevent ugly recursive layout pattern.
- * Note: This shall probably be redone from scratch in a proper way at some point, but for now that will do,
- * and shall not break anything in the API. */
- prop = RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_Cache_list_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "PointCacheItem");
- RNA_def_property_ui_text(prop, "Point Cache List", "");
- rna_def_ptcache_point_caches(brna, prop);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "PointCache", NULL);
+ RNA_def_struct_ui_text(srna, "Active Point Cache", "Active point cache for physics simulations");
+ RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
+
+ rna_def_pointcache_common(srna);
+
+ /* This first-level RNA pointer also has list of all caches from owning ID.
+ * Those caches items have exact same content as 'active' one, except for that collection,
+ * to prevent ugly recursive layout pattern.
+ * Note: This shall probably be redone from scratch in a proper way at some point, but for now that will do,
+ * and shall not break anything in the API. */
+ prop = RNA_def_property(srna, "point_caches", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Cache_list_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "PointCacheItem");
+ RNA_def_property_ui_text(prop, "Point Cache List", "");
+ rna_def_ptcache_point_caches(brna, prop);
}
static void rna_def_collision(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "CollisionSettings", NULL);
- RNA_def_struct_sdna(srna, "PartDeflect");
- RNA_def_struct_path_func(srna, "rna_CollisionSettings_path");
- RNA_def_struct_ui_text(srna, "Collision Settings", "Collision settings for object in physics simulation");
-
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
- RNA_def_property_ui_text(prop, "Enabled", "Enable this objects as a collider for physics systems");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update");
-
- /* Particle Interaction */
-
- prop = RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Friction Factor", "Amount of friction during particle collision");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Permeability", "Chance that the particle will pass through the mesh");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "use_particle_kill", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
- RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "stickiness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pdef_stickness");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Stickiness", "Amount of stickiness to surface collision");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- /* Soft Body and Cloth Interaction */
-
- prop = RNA_def_property(srna, "thickness_inner", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_ui_text(prop, "Inner Thickness", "Inner face thickness (only used by softbodies)");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "thickness_outer", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
- RNA_def_property_ui_text(prop, "Absorption",
- "How much of effector force gets lost during collision with this object (in percent)");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "cloth_friction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pdef_cfrict");
- RNA_def_property_range(prop, 0.0f, 80.0f);
- RNA_def_property_ui_text(prop, "Friction", "Friction for cloth collisions");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_CLOTH_USE_CULLING);
- RNA_def_property_ui_text(prop, "Single Sided", "Cloth collision acts with respect to the collider normals (improves penetration recovery)");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
-
- prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_CLOTH_USE_NORMAL);
- RNA_def_property_ui_text(prop, "Override Normals", "Cloth collision impulses act in the direction of the collider normals (more reliable in some cases)");
- RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "CollisionSettings", NULL);
+ RNA_def_struct_sdna(srna, "PartDeflect");
+ RNA_def_struct_path_func(srna, "rna_CollisionSettings_path");
+ RNA_def_struct_ui_text(
+ srna, "Collision Settings", "Collision settings for object in physics simulation");
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "deflect", 1);
+ RNA_def_property_ui_text(
+ prop, "Enabled", "Enable this objects as a collider for physics systems");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_dependency_update");
+
+ /* Particle Interaction */
+
+ prop = RNA_def_property(srna, "damping_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_damp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Damping Factor", "Amount of damping during particle collision");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "damping_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_rdamp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Damping", "Random variation of damping");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "friction_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_frict");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Friction Factor", "Amount of friction during particle collision");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "friction_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_rfrict");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Friction", "Random variation of friction");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "permeability", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_perm");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Permeability", "Chance that the particle will pass through the mesh");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "use_particle_kill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PDEFLE_KILL_PART);
+ RNA_def_property_ui_text(prop, "Kill Particles", "Kill collided particles");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "stickiness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_stickness");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Stickiness", "Amount of stickiness to surface collision");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ /* Soft Body and Cloth Interaction */
+
+ prop = RNA_def_property(srna, "thickness_inner", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_sbift");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Inner Thickness", "Inner face thickness (only used by softbodies)");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "thickness_outer", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_sboft");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(prop, "Outer Thickness", "Outer face thickness");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_sbdamp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Damping", "Amount of damping during collision");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "absorption", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Absorption",
+ "How much of effector force gets lost during collision with this object (in percent)");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "cloth_friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pdef_cfrict");
+ RNA_def_property_range(prop, 0.0f, 80.0f);
+ RNA_def_property_ui_text(prop, "Friction", "Friction for cloth collisions");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_CLOTH_USE_CULLING);
+ RNA_def_property_ui_text(
+ prop,
+ "Single Sided",
+ "Cloth collision acts with respect to the collider normals (improves penetration recovery)");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
+
+ prop = RNA_def_property(srna, "use_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_CLOTH_USE_NORMAL);
+ RNA_def_property_ui_text(prop,
+ "Override Normals",
+ "Cloth collision impulses act in the direction of the collider normals "
+ "(more reliable in some cases)");
+ RNA_def_property_update(prop, 0, "rna_CollisionSettings_update");
}
static void rna_def_effector_weight(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "EffectorWeights", NULL);
- RNA_def_struct_sdna(srna, "EffectorWeights");
- RNA_def_struct_path_func(srna, "rna_EffectorWeight_path");
- RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation");
- RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
-
- /* Flags */
- prop = RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR);
- RNA_def_property_ui_text(prop, "Use For Growing Hair", "Use force fields when growing hair");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- /* General */
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "group");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
-
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "global_gravity");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Gravity", "Global gravity weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- /* Effector weights */
- prop = RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[0]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "All", "All effector's weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[1]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Force", "Force effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[2]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[3]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[4]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Wind", "Wind effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "curve_guide", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[5]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[6]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Texture", "Texture effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[7]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[8]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Charge", "Charge effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[9]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[10]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Boid", "Boid effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[11]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Turbulence", "Turbulence effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[12]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Drag", "Drag effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
-
- prop = RNA_def_property(srna, "smokeflow", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "weight[13]");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Smoke Flow", "Smoke Flow effector weight");
- RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "EffectorWeights", NULL);
+ RNA_def_struct_sdna(srna, "EffectorWeights");
+ RNA_def_struct_path_func(srna, "rna_EffectorWeight_path");
+ RNA_def_struct_ui_text(srna, "Effector Weights", "Effector weights for physics simulation");
+ RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
+
+ /* Flags */
+ prop = RNA_def_property(srna, "apply_to_hair_growing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", EFF_WEIGHT_DO_HAIR);
+ RNA_def_property_ui_text(prop, "Use For Growing Hair", "Use force fields when growing hair");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ /* General */
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
+
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "global_gravity");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Gravity", "Global gravity weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ /* Effector weights */
+ prop = RNA_def_property(srna, "all", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[0]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "All", "All effector's weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "force", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[1]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Force", "Force effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "vortex", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[2]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Vortex", "Vortex effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "magnetic", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[3]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Magnetic", "Magnetic effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "wind", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[4]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Wind", "Wind effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "curve_guide", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[5]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Curve Guide", "Curve guide effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "texture", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[6]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Texture", "Texture effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "harmonic", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[7]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Harmonic", "Harmonic effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "charge", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[8]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Charge", "Charge effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "lennardjones", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[9]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Lennard-Jones", "Lennard-Jones effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "boid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[10]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Boid", "Boid effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[11]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Turbulence", "Turbulence effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "drag", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[12]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Drag", "Drag effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
+
+ prop = RNA_def_property(srna, "smokeflow", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "weight[13]");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Smoke Flow", "Smoke Flow effector weight");
+ RNA_def_property_update(prop, 0, "rna_EffectorWeight_update");
}
static void rna_def_field(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem field_type_items[] = {
- {0, "NONE", 0, "None", ""},
- {PFIELD_FORCE, "FORCE", ICON_FORCE_FORCE, "Force", "Radial field toward the center of object"},
- {PFIELD_WIND, "WIND", ICON_FORCE_WIND, "Wind", "Constant force along the force object's local Z axis"},
- {PFIELD_VORTEX, "VORTEX", ICON_FORCE_VORTEX, "Vortex",
- "Spiraling force that twists the force object's local Z axis"},
- {PFIELD_MAGNET, "MAGNET", ICON_FORCE_MAGNETIC, "Magnetic", "Forcefield depends on the speed of the particles"},
- {PFIELD_HARMONIC, "HARMONIC", ICON_FORCE_HARMONIC, "Harmonic",
- "The source of this force field is the zero point of a harmonic oscillator"},
- {PFIELD_CHARGE, "CHARGE", ICON_FORCE_CHARGE, "Charge",
- "Spherical forcefield based on the charge of particles, "
- "only influences other charge force fields"},
- {PFIELD_LENNARDJ, "LENNARDJ", ICON_FORCE_LENNARDJONES, "Lennard-Jones",
- "Forcefield based on the Lennard-Jones potential"},
- {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"},
- {PFIELD_GUIDE, "GUIDE", ICON_FORCE_CURVE, "Curve Guide", "Create a force along a curve object"},
- {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""},
- {PFIELD_TURBULENCE, "TURBULENCE", ICON_FORCE_TURBULENCE, "Turbulence", "Create turbulence with a noise field"},
- {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"},
- {PFIELD_SMOKEFLOW, "SMOKE_FLOW", ICON_FORCE_SMOKEFLOW, "Smoke Flow", "Create a force based on smoke simulation air flow"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem falloff_items[] = {
- {PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""},
- {PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""},
- {PFIELD_FALL_CONE, "CONE", 0, "Cone", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem texture_items[] = {
- {PFIELD_TEX_RGB, "RGB", 0, "RGB", ""},
- {PFIELD_TEX_GRAD, "GRADIENT", 0, "Gradient", ""},
- {PFIELD_TEX_CURL, "CURL", 0, "Curl", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem zdirection_items[] = {
- {PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""},
- {PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""},
- {PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem guide_kink_items[] = {
- {0, "NONE", 0, "Nothing", ""},
- {1, "CURL", 0, "Curl", ""},
- {2, "RADIAL", 0, "Radial", ""},
- {3, "WAVE", 0, "Wave", ""},
- {4, "BRAID", 0, "Braid", ""},
- {5, "ROTATION", 0, "Rotation", ""},
- {6, "ROLL", 0, "Roll", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FieldSettings", NULL);
- RNA_def_struct_sdna(srna, "PartDeflect");
- RNA_def_struct_path_func(srna, "rna_FieldSettings_path");
- RNA_def_struct_ui_text(srna, "Field Settings", "Field settings for an object in physics simulation");
- RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
-
- /* Enums */
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "forcefield");
- RNA_def_property_enum_items(prop, field_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_FieldSettings_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type", "Type of field");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
-
- prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, effector_shape_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Effector_shape_itemf");
- RNA_def_property_ui_text(prop, "Shape", "Which direction is used to calculate the effector force");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_shape_update");
-
- prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "falloff");
- RNA_def_property_enum_items(prop, falloff_items);
- RNA_def_property_ui_text(prop, "Fall-Off", "");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
- RNA_def_property_enum_items(prop, texture_items);
- RNA_def_property_ui_text(prop, "Texture Mode",
- "How the texture effect is calculated (RGB & Curl need a RGB texture, "
- "else Gradient will be used instead)");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "zdir");
- RNA_def_property_enum_items(prop, zdirection_items);
- RNA_def_property_ui_text(prop, "Z Direction", "Effect in full or only positive/negative Z direction");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* Float */
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_strength");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* different ui range to above */
- prop = RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_strength");
- RNA_def_property_range(prop, -2.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_damp");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* different ui range to above */
- prop = RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_damp");
- RNA_def_property_range(prop, -2.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Quadratic Drag", "Drag component proportional to the square of velocity");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_flow");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* different ui range to above */
- prop = RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_flow");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_size");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1.0f, 3);
- RNA_def_property_ui_text(prop, "Size", "Size of the turbulence");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_size");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Rest Length", "Rest length of the harmonic force");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_power");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Falloff Power", "How quickly strength falls off with distance from the force field");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "mindist");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "maxdist");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1.0f, 3);
- RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "radial_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "minrad");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "radial_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "maxrad");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_power_r");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
- RNA_def_property_range(prop, 0.0001f, 1.0f);
- RNA_def_property_ui_text(prop, "Nabla",
- "Defines size of derivative offset used for calculating gradient and curl");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_noise");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Noise", "Amount of noise for the force strength");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 1, 128);
- RNA_def_property_ui_text(prop, "Seed", "Seed of the noise");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* Boolean */
-
- prop = RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
- RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
- RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
- RNA_def_property_ui_text(prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
- /* "Use a minimum angle for the field's fall-off" */
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
- RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
- /* "Use a maximum angle for the field to work" */
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_object_coords", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
- RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_global_coords", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GLOBAL_CO);
- RNA_def_property_ui_text(prop, "Use Global Coordinates", "Use effector/global coordinates for turbulence");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_2d_force", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
- RNA_def_property_ui_text(prop, "2D", "Apply force only in 2D");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_root_coords", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO);
- RNA_def_property_ui_text(prop, "Root Texture Coordinates", "Texture coordinates from root particle locations");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "apply_to_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_LOCATION);
- RNA_def_property_ui_text(prop, "Location", "Affect particle's location");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "apply_to_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_ROTATION);
- RNA_def_property_ui_text(prop, "Rotation", "Affect particle's dynamic rotation");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_absorption", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_VISIBILITY);
- RNA_def_property_ui_text(prop, "Absorption", "Force gets absorbed by collision objects");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
-
- prop = RNA_def_property(srna, "use_multiple_springs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_MULTIPLE_SPRINGS);
- RNA_def_property_ui_text(prop, "Multiple Springs", "Every point is effected by multiple springs");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_smoke_density", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY);
- RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
- prop = RNA_def_property(srna, "use_gravity_falloff", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GRAVITATION);
- RNA_def_property_ui_text(prop, "Gravity Falloff", "Multiply force by 1/distance²");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
-
- /* Pointer */
-
- prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tex");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "source_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "f_source");
- RNA_def_property_ui_text(prop, "Domain Object", "Select domain object of the smoke simulation");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /********** Curve Guide Field Settings **********/
-
- prop = RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "f_strength");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Minimum Distance", "The distance from which particles are affected fully");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "free_end");
- RNA_def_property_range(prop, 0.0f, 0.99f);
- RNA_def_property_ui_text(prop, "Free", "Guide-free time from particle life's end");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_guide_path_add", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
- RNA_def_property_ui_text(prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "use_guide_path_weight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_WEIGHT);
- RNA_def_property_ui_text(prop, "Weights", "Use curve weights to influence the particle influence along the curve");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* Clump Settings */
-
- prop = RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clump_fac");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Amount", "Amount of clumping");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clump_pow");
- RNA_def_property_range(prop, -0.999f, 0.999f);
- RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* Kink Settings */
-
- prop = RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "kink");
- RNA_def_property_enum_items(prop, guide_kink_items);
- RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the curve");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "kink_freq");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "kink_shape");
- RNA_def_property_range(prop, -0.999f, 0.999f);
- RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- prop = RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "kink_amp");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
- RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
-
- /* Variables used for Curve Guide, already wrapped, used for other fields too */
- /* falloff_power, use_max_distance, maximum_distance */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem field_type_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PFIELD_FORCE,
+ "FORCE",
+ ICON_FORCE_FORCE,
+ "Force",
+ "Radial field toward the center of object"},
+ {PFIELD_WIND,
+ "WIND",
+ ICON_FORCE_WIND,
+ "Wind",
+ "Constant force along the force object's local Z axis"},
+ {PFIELD_VORTEX,
+ "VORTEX",
+ ICON_FORCE_VORTEX,
+ "Vortex",
+ "Spiraling force that twists the force object's local Z axis"},
+ {PFIELD_MAGNET,
+ "MAGNET",
+ ICON_FORCE_MAGNETIC,
+ "Magnetic",
+ "Forcefield depends on the speed of the particles"},
+ {PFIELD_HARMONIC,
+ "HARMONIC",
+ ICON_FORCE_HARMONIC,
+ "Harmonic",
+ "The source of this force field is the zero point of a harmonic oscillator"},
+ {PFIELD_CHARGE,
+ "CHARGE",
+ ICON_FORCE_CHARGE,
+ "Charge",
+ "Spherical forcefield based on the charge of particles, "
+ "only influences other charge force fields"},
+ {PFIELD_LENNARDJ,
+ "LENNARDJ",
+ ICON_FORCE_LENNARDJONES,
+ "Lennard-Jones",
+ "Forcefield based on the Lennard-Jones potential"},
+ {PFIELD_TEXTURE, "TEXTURE", ICON_FORCE_TEXTURE, "Texture", "Forcefield based on a texture"},
+ {PFIELD_GUIDE,
+ "GUIDE",
+ ICON_FORCE_CURVE,
+ "Curve Guide",
+ "Create a force along a curve object"},
+ {PFIELD_BOID, "BOID", ICON_FORCE_BOID, "Boid", ""},
+ {PFIELD_TURBULENCE,
+ "TURBULENCE",
+ ICON_FORCE_TURBULENCE,
+ "Turbulence",
+ "Create turbulence with a noise field"},
+ {PFIELD_DRAG, "DRAG", ICON_FORCE_DRAG, "Drag", "Create a force that dampens motion"},
+ {PFIELD_SMOKEFLOW,
+ "SMOKE_FLOW",
+ ICON_FORCE_SMOKEFLOW,
+ "Smoke Flow",
+ "Create a force based on smoke simulation air flow"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem falloff_items[] = {
+ {PFIELD_FALL_SPHERE, "SPHERE", 0, "Sphere", ""},
+ {PFIELD_FALL_TUBE, "TUBE", 0, "Tube", ""},
+ {PFIELD_FALL_CONE, "CONE", 0, "Cone", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem texture_items[] = {
+ {PFIELD_TEX_RGB, "RGB", 0, "RGB", ""},
+ {PFIELD_TEX_GRAD, "GRADIENT", 0, "Gradient", ""},
+ {PFIELD_TEX_CURL, "CURL", 0, "Curl", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem zdirection_items[] = {
+ {PFIELD_Z_BOTH, "BOTH", 0, "Both Z", ""},
+ {PFIELD_Z_POS, "POSITIVE", 0, "+Z", ""},
+ {PFIELD_Z_NEG, "NEGATIVE", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem guide_kink_items[] = {
+ {0, "NONE", 0, "Nothing", ""},
+ {1, "CURL", 0, "Curl", ""},
+ {2, "RADIAL", 0, "Radial", ""},
+ {3, "WAVE", 0, "Wave", ""},
+ {4, "BRAID", 0, "Braid", ""},
+ {5, "ROTATION", 0, "Rotation", ""},
+ {6, "ROLL", 0, "Roll", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FieldSettings", NULL);
+ RNA_def_struct_sdna(srna, "PartDeflect");
+ RNA_def_struct_path_func(srna, "rna_FieldSettings_path");
+ RNA_def_struct_ui_text(
+ srna, "Field Settings", "Field settings for an object in physics simulation");
+ RNA_def_struct_ui_icon(srna, ICON_PHYSICS);
+
+ /* Enums */
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "forcefield");
+ RNA_def_property_enum_items(prop, field_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_FieldSettings_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "Type of field");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
+
+ prop = RNA_def_property(srna, "shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, effector_shape_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Effector_shape_itemf");
+ RNA_def_property_ui_text(
+ prop, "Shape", "Which direction is used to calculate the effector force");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_shape_update");
+
+ prop = RNA_def_property(srna, "falloff_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "falloff");
+ RNA_def_property_enum_items(prop, falloff_items);
+ RNA_def_property_ui_text(prop, "Fall-Off", "");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "texture_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tex_mode");
+ RNA_def_property_enum_items(prop, texture_items);
+ RNA_def_property_ui_text(prop,
+ "Texture Mode",
+ "How the texture effect is calculated (RGB & Curl need a RGB texture, "
+ "else Gradient will be used instead)");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "z_direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "zdir");
+ RNA_def_property_enum_items(prop, zdirection_items);
+ RNA_def_property_ui_text(
+ prop, "Z Direction", "Effect in full or only positive/negative Z direction");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* Float */
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_strength");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of force field");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* different ui range to above */
+ prop = RNA_def_property(srna, "linear_drag", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_strength");
+ RNA_def_property_range(prop, -2.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Linear Drag", "Drag component proportional to velocity");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "harmonic_damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_damp");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Harmonic Damping", "Damping of the harmonic force");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* different ui range to above */
+ prop = RNA_def_property(srna, "quadratic_drag", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_damp");
+ RNA_def_property_range(prop, -2.0f, 2.0f);
+ RNA_def_property_ui_text(
+ prop, "Quadratic Drag", "Drag component proportional to the square of velocity");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "flow", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_flow");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Flow", "Convert effector force into air flow velocity");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* different ui range to above */
+ prop = RNA_def_property(srna, "inflow", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_flow");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Inflow", "Inwards component of the vortex force");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_size");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1.0f, 3);
+ RNA_def_property_ui_text(prop, "Size", "Size of the turbulence");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_size");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Rest Length", "Rest length of the harmonic force");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "falloff_power", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_power");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(
+ prop, "Falloff Power", "How quickly strength falls off with distance from the force field");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "distance_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "mindist");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Minimum Distance", "Minimum distance for the field's fall-off");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "maxdist");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1.0f, 3);
+ RNA_def_property_ui_text(prop, "Maximum Distance", "Maximum distance for the field to work");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "radial_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "minrad");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop, "Minimum Radial Distance", "Minimum radial distance for the field's fall-off");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "radial_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxrad");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop, "Maximum Radial Distance", "Maximum radial distance for the field to work");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "radial_falloff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_power_r");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(
+ prop, "Radial Falloff Power", "Radial falloff power (real gravitational falloff = 2)");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "texture_nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tex_nabla");
+ RNA_def_property_range(prop, 0.0001f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Nabla", "Defines size of derivative offset used for calculating gradient and curl");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "noise", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_noise");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Noise", "Amount of noise for the force strength");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 1, 128);
+ RNA_def_property_ui_text(prop, "Seed", "Seed of the noise");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* Boolean */
+
+ prop = RNA_def_property(srna, "use_min_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMIN);
+ RNA_def_property_ui_text(prop, "Use Min", "Use a minimum distance for the field's fall-off");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_max_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAX);
+ RNA_def_property_ui_text(prop, "Use Max", "Use a maximum distance for the field to work");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_radial_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMINR);
+ RNA_def_property_ui_text(
+ prop, "Use Min", "Use a minimum radial distance for the field's fall-off");
+ /* "Use a minimum angle for the field's fall-off" */
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_radial_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_USEMAXR);
+ RNA_def_property_ui_text(prop, "Use Max", "Use a maximum radial distance for the field to work");
+ /* "Use a maximum angle for the field to work" */
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_object_coords", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_OBJECT);
+ RNA_def_property_ui_text(prop, "Use Coordinates", "Use object/global coordinates for texture");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_global_coords", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GLOBAL_CO);
+ RNA_def_property_ui_text(
+ prop, "Use Global Coordinates", "Use effector/global coordinates for turbulence");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_2d_force", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_2D);
+ RNA_def_property_ui_text(prop, "2D", "Apply force only in 2D");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_root_coords", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_TEX_ROOTCO);
+ RNA_def_property_ui_text(
+ prop, "Root Texture Coordinates", "Texture coordinates from root particle locations");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "apply_to_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_LOCATION);
+ RNA_def_property_ui_text(prop, "Location", "Affect particle's location");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "apply_to_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_DO_ROTATION);
+ RNA_def_property_ui_text(prop, "Rotation", "Affect particle's dynamic rotation");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_absorption", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_VISIBILITY);
+ RNA_def_property_ui_text(prop, "Absorption", "Force gets absorbed by collision objects");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_dependency_update");
+
+ prop = RNA_def_property(srna, "use_multiple_springs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_MULTIPLE_SPRINGS);
+ RNA_def_property_ui_text(
+ prop, "Multiple Springs", "Every point is effected by multiple springs");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_smoke_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_SMOKE_DENSITY);
+ RNA_def_property_ui_text(prop, "Apply Density", "Adjust force strength based on smoke density");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+ prop = RNA_def_property(srna, "use_gravity_falloff", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GRAVITATION);
+ RNA_def_property_ui_text(prop, "Gravity Falloff", "Multiply force by 1/distance²");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* Pointer */
+
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tex");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Texture", "Texture to use as force");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "source_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "f_source");
+ RNA_def_property_ui_text(prop, "Domain Object", "Select domain object of the smoke simulation");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /********** Curve Guide Field Settings **********/
+
+ prop = RNA_def_property(srna, "guide_minimum", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "f_strength");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(
+ prop, "Minimum Distance", "The distance from which particles are affected fully");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "guide_free", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "free_end");
+ RNA_def_property_range(prop, 0.0f, 0.99f);
+ RNA_def_property_ui_text(prop, "Free", "Guide-free time from particle life's end");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_guide_path_add", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_ADD);
+ RNA_def_property_ui_text(
+ prop, "Additive", "Based on distance/falloff it adds a portion of the entire path");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "use_guide_path_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PFIELD_GUIDE_PATH_WEIGHT);
+ RNA_def_property_ui_text(
+ prop, "Weights", "Use curve weights to influence the particle influence along the curve");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* Clump Settings */
+
+ prop = RNA_def_property(srna, "guide_clump_amount", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clump_fac");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Amount", "Amount of clumping");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "guide_clump_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clump_pow");
+ RNA_def_property_range(prop, -0.999f, 0.999f);
+ RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* Kink Settings */
+
+ prop = RNA_def_property(srna, "guide_kink_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "kink");
+ RNA_def_property_enum_items(prop, guide_kink_items);
+ RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the curve");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "guide_kink_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "kink_axis");
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "guide_kink_frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_freq");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "guide_kink_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_shape");
+ RNA_def_property_range(prop, -0.999f, 0.999f);
+ RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ prop = RNA_def_property(srna, "guide_kink_amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_amp");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
+ RNA_def_property_update(prop, 0, "rna_FieldSettings_update");
+
+ /* Variables used for Curve Guide, already wrapped, used for other fields too */
+ /* falloff_power, use_max_distance, maximum_distance */
}
static void rna_def_softbody(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem collision_type_items[] = {
- {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"},
- {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"},
- {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"},
- {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
- {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem aerodynamics_type[] = {
- {0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"},
- {1, "LIFT_FORCE", 0, "Lift Force", "Edges receive a lift force when passing through surrounding media"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SoftBodySettings", NULL);
- RNA_def_struct_sdna(srna, "SoftBody");
- RNA_def_struct_path_func(srna, "rna_SoftBodySettings_path");
- RNA_def_struct_ui_text(srna, "Soft Body Settings", "Soft body simulation settings for an object");
-
- /* General Settings */
-
- prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mediafrict");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
- RNA_def_property_float_sdna(prop, NULL, "nodemass");
- RNA_def_property_range(prop, 0.0f, 50000.0f);
- RNA_def_property_ui_text(prop, "Mass", "General Mass value");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
- RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- /* no longer used */
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
- RNA_def_property_float_sdna(prop, NULL, "grav");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "physics_speed");
- RNA_def_property_range(prop, 0.01f, 100.0f);
- RNA_def_property_ui_text(prop, "Speed", "Tweak timing for physics to control frequency and speed");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- /* Goal */
-
- prop = RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "vertgroup");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
- RNA_def_property_string_funcs(prop, "rna_SoftBodySettings_goal_vgroup_get",
- "rna_SoftBodySettings_goal_vgroup_length",
- "rna_SoftBodySettings_goal_vgroup_set");
- RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
-
- prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "mingoal");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Minimum", "Goal minimum, vertex weights are scaled to match this range");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "maxgoal");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Maximum", "Goal maximum, vertex weights are scaled to match this range");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "defgoal");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Goal Default",
- "Default Goal (vertex target position) value");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "goalspring");
- RNA_def_property_range(prop, 0.0f, 0.999f);
- RNA_def_property_ui_text(prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "goalfrict");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- /* Edge Spring Settings */
-
- prop = RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "inspring");
- RNA_def_property_range(prop, 0.0f, 0.999f);
- RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "inpush");
- RNA_def_property_range(prop, 0.0f, 0.999f);
- RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "infrict");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "springpreload");
- RNA_def_property_range(prop, 0.0f, 200.0f);
- RNA_def_property_ui_text(prop, "View Layer", "Alter spring length to shrink/blow up (unit %) 0 to disable");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "aeroedge");
- RNA_def_property_range(prop, 0.0f, 30000.0f);
- RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "plastic");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "bend", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "secondspring");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "shearstiff");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
-
- prop = RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
- RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- /* Collision */
-
- prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sbc_mode");
- RNA_def_property_enum_items(prop, collision_type_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "colball");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Ball Size", "Absolute ball size or factor if not manually adjusted");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ballstiff");
- RNA_def_property_range(prop, 0.001f, 100.0f);
- RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating pressure");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "balldamp");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- /* Solver */
-
- prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rklimit");
- RNA_def_property_range(prop, 0.001f, 10.0f);
- RNA_def_property_ui_text(prop, "Error Limit",
- "The Runge-Kutta ODE solver error limit, low value gives more precision, "
- "high values speed");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "minloops");
- RNA_def_property_range(prop, 0, 30000);
- RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "step_max", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "maxloops");
- RNA_def_property_range(prop, 0, 30000);
- RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "choke");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Fuzzy",
- "Fuzziness while on collision, high values make collision handling faster "
- "but less stable");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR);
- RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_diagnose", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
- RNA_def_property_ui_text(prop, "Print Performance to Console", "Turn on SB diagnose console prints");
-
- prop = RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO);
- RNA_def_property_ui_text(prop, "Estimate matrix", "Estimate matrix... split to COM, ROT, SCALE");
-
-
- /***********************************************************************************/
- /* these are not exactly settings, but reading calculated results*/
- /* but i did not want to start a new property struct */
- /* so rather rename this from SoftBodySettings to SoftBody */
- /* translation */
- prop = RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "lcom");
- RNA_def_property_ui_text(prop, "Center of mass", "Location of Center of mass");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- /* matrix */
- prop = RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "lrot");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
- RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix");
-
- prop = RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "lscale");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
- RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix");
- /***********************************************************************************/
-
-
- /* Flags */
-
- prop = RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Goal", "Define forces for vertices to stick to animated position");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_stiff_quads_get",
- "rna_SoftBodySettings_stiff_quads_set");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_edge_collision_get",
- "rna_SoftBodySettings_edge_collision_set");
- RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_face_collision_get",
- "rna_SoftBodySettings_face_collision_set");
- RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, aerodynamics_type);
- RNA_def_property_enum_funcs(prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set", NULL);
- RNA_def_property_ui_text(prop, "Aerodynamics Type", "Method of calculating aerodynamic interaction");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SoftBodySettings_self_collision_get",
- "rna_SoftBodySettings_self_collision_set");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision");
- RNA_def_property_update(prop, 0, "rna_softbody_update");
-
- prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
- RNA_def_property_update(prop, 0, "rna_softbody_dependency_update");
-
- prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "effector_weights");
- RNA_def_property_struct_type(prop, "EffectorWeights");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Weights", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem collision_type_items[] = {
+ {SBC_MODE_MANUAL, "MANUAL", 0, "Manual", "Manual adjust"},
+ {SBC_MODE_AVG, "AVERAGE", 0, "Average", "Average Spring length * Ball Size"},
+ {SBC_MODE_MIN, "MINIMAL", 0, "Minimal", "Minimal Spring length * Ball Size"},
+ {SBC_MODE_MAX, "MAXIMAL", 0, "Maximal", "Maximal Spring length * Ball Size"},
+ {SBC_MODE_AVGMINMAX, "MINMAX", 0, "AvMinMax", "(Min+Max)/2 * Ball Size"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem aerodynamics_type[] = {
+ {0, "SIMPLE", 0, "Simple", "Edges receive a drag force from surrounding media"},
+ {1,
+ "LIFT_FORCE",
+ 0,
+ "Lift Force",
+ "Edges receive a lift force when passing through surrounding media"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SoftBodySettings", NULL);
+ RNA_def_struct_sdna(srna, "SoftBody");
+ RNA_def_struct_path_func(srna, "rna_SoftBodySettings_path");
+ RNA_def_struct_ui_text(
+ srna, "Soft Body Settings", "Soft body simulation settings for an object");
+
+ /* General Settings */
+
+ prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mediafrict");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(prop, "Friction", "General media friction for point movements");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
+ RNA_def_property_float_sdna(prop, NULL, "nodemass");
+ RNA_def_property_range(prop, 0.0f, 50000.0f);
+ RNA_def_property_ui_text(prop, "Mass", "General Mass value");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "vertex_group_mass", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "namedVG_Mass");
+ RNA_def_property_ui_text(prop, "Mass Vertex Group", "Control point mass values");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_mass_vgroup_set");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ /* no longer used */
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+ RNA_def_property_float_sdna(prop, NULL, "grav");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Gravitation", "Apply gravitation to point movement");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "physics_speed");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(
+ prop, "Speed", "Tweak timing for physics to control frequency and speed");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ /* Goal */
+
+ prop = RNA_def_property(srna, "vertex_group_goal", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "vertgroup");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not impossible .. but not supported yet */
+ RNA_def_property_string_funcs(prop,
+ "rna_SoftBodySettings_goal_vgroup_get",
+ "rna_SoftBodySettings_goal_vgroup_length",
+ "rna_SoftBodySettings_goal_vgroup_set");
+ RNA_def_property_ui_text(prop, "Goal Vertex Group", "Control point weight values");
+
+ prop = RNA_def_property(srna, "goal_min", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "mingoal");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Goal Minimum", "Goal minimum, vertex weights are scaled to match this range");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "goal_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "maxgoal");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Goal Maximum", "Goal maximum, vertex weights are scaled to match this range");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "goal_default", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "defgoal");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Goal Default", "Default Goal (vertex target position) value");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "goal_spring", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "goalspring");
+ RNA_def_property_range(prop, 0.0f, 0.999f);
+ RNA_def_property_ui_text(
+ prop, "Goal Stiffness", "Goal (vertex target position) spring stiffness");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "goal_friction", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "goalfrict");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(prop, "Goal Damping", "Goal (vertex target position) friction");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ /* Edge Spring Settings */
+
+ prop = RNA_def_property(srna, "pull", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "inspring");
+ RNA_def_property_range(prop, 0.0f, 0.999f);
+ RNA_def_property_ui_text(prop, "Pull", "Edge spring stiffness when longer than rest length");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "push", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "inpush");
+ RNA_def_property_range(prop, 0.0f, 0.999f);
+ RNA_def_property_ui_text(prop, "Push", "Edge spring stiffness when shorter than rest length");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "infrict");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_text(prop, "Damp", "Edge spring friction");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "spring_length", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "springpreload");
+ RNA_def_property_range(prop, 0.0f, 200.0f);
+ RNA_def_property_ui_text(
+ prop, "View Layer", "Alter spring length to shrink/blow up (unit %) 0 to disable");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "aero", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "aeroedge");
+ RNA_def_property_range(prop, 0.0f, 30000.0f);
+ RNA_def_property_ui_text(prop, "Aero", "Make edges 'sail'");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "plastic", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "plastic");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Plastic", "Permanent deform");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "bend", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "secondspring");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Bending", "Bending Stiffness");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "shear", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "shearstiff");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Shear", "Shear Stiffness");
+
+ prop = RNA_def_property(srna, "vertex_group_spring", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "namedVG_Spring_K");
+ RNA_def_property_ui_text(prop, "Spring Vertex Group", "Control point spring strength values");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SoftBodySettings_spring_vgroup_set");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ /* Collision */
+
+ prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sbc_mode");
+ RNA_def_property_enum_items(prop, collision_type_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Collision Type", "Choose Collision Type");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "ball_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "colball");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* code is not ready for that yet */
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_text(
+ prop, "Ball Size", "Absolute ball size or factor if not manually adjusted");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "ball_stiff", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ballstiff");
+ RNA_def_property_range(prop, 0.001f, 100.0f);
+ RNA_def_property_ui_text(prop, "Ball Size", "Ball inflating pressure");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "ball_damp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "balldamp");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(prop, "Ball Size", "Blending to inelastic collision");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ /* Solver */
+
+ prop = RNA_def_property(srna, "error_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rklimit");
+ RNA_def_property_range(prop, 0.001f, 10.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Error Limit",
+ "The Runge-Kutta ODE solver error limit, low value gives more precision, "
+ "high values speed");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "step_min", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "minloops");
+ RNA_def_property_range(prop, 0, 30000);
+ RNA_def_property_ui_text(prop, "Min Step", "Minimal # solver steps/frame");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "step_max", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "maxloops");
+ RNA_def_property_range(prop, 0, 30000);
+ RNA_def_property_ui_text(prop, "Max Step", "Maximal # solver steps/frame");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "choke", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "choke");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Choke", "'Viscosity' inside collision target");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "fuzzy", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "fuzzyness");
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(
+ prop,
+ "Fuzzy",
+ "Fuzziness while on collision, high values make collision handling faster "
+ "but less stable");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_OLDERR);
+ RNA_def_property_ui_text(prop, "V", "Use velocities for automagic step sizes");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_diagnose", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_MONITOR);
+ RNA_def_property_ui_text(
+ prop, "Print Performance to Console", "Turn on SB diagnose console prints");
+
+ prop = RNA_def_property(srna, "use_estimate_matrix", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "solverflags", SBSO_ESTIMATEIPO);
+ RNA_def_property_ui_text(prop, "Estimate matrix", "Estimate matrix... split to COM, ROT, SCALE");
+
+ /***********************************************************************************/
+ /* these are not exactly settings, but reading calculated results*/
+ /* but i did not want to start a new property struct */
+ /* so rather rename this from SoftBodySettings to SoftBody */
+ /* translation */
+ prop = RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "lcom");
+ RNA_def_property_ui_text(prop, "Center of mass", "Location of Center of mass");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ /* matrix */
+ prop = RNA_def_property(srna, "rotation_estimate", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "lrot");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_ui_text(prop, "Rot Matrix", "Estimated rotation matrix");
+
+ prop = RNA_def_property(srna, "scale_estimate", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "lscale");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_ui_text(prop, "Scale Matrix", "Estimated scale matrix");
+ /***********************************************************************************/
+
+ /* Flags */
+
+ prop = RNA_def_property(srna, "use_goal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SoftBodySettings_use_goal_get", "rna_SoftBodySettings_use_goal_set");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Use Goal", "Define forces for vertices to stick to animated position");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SoftBodySettings_use_edges_get", "rna_SoftBodySettings_use_edges_set");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Use Edges", "Use Edges as springs");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_stiff_quads", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SoftBodySettings_stiff_quads_get", "rna_SoftBodySettings_stiff_quads_set");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Stiff Quads", "Add diagonal springs on 4-gons");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_edge_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SoftBodySettings_edge_collision_get", "rna_SoftBodySettings_edge_collision_set");
+ RNA_def_property_ui_text(prop, "Edge Collision", "Edges collide too");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_face_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SoftBodySettings_face_collision_get", "rna_SoftBodySettings_face_collision_set");
+ RNA_def_property_ui_text(prop, "Face Collision", "Faces collide too, can be very slow");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "aerodynamics_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, aerodynamics_type);
+ RNA_def_property_enum_funcs(
+ prop, "rna_SoftBodySettings_new_aero_get", "rna_SoftBodySettings_new_aero_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Aerodynamics Type", "Method of calculating aerodynamic interaction");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "use_self_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SoftBodySettings_self_collision_get", "rna_SoftBodySettings_self_collision_set");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Self Collision", "Enable naive vertex ball self collision");
+ RNA_def_property_update(prop, 0, "rna_softbody_update");
+
+ prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
+ RNA_def_property_update(prop, 0, "rna_softbody_dependency_update");
+
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "effector_weights");
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
}
void RNA_def_object_force(BlenderRNA *brna)
{
- rna_def_pointcache_active(brna);
- rna_def_collision(brna);
- rna_def_effector_weight(brna);
- rna_def_field(brna);
- rna_def_softbody(brna);
+ rna_def_pointcache_active(brna);
+ rna_def_collision(brna);
+ rna_def_effector_weight(brna);
+ rna_def_field(brna);
+ rna_def_softbody(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_packedfile.c b/source/blender/makesrna/intern/rna_packedfile.c
index 728ff163043..0b1b48b1bd3 100644
--- a/source/blender/makesrna/intern/rna_packedfile.c
+++ b/source/blender/makesrna/intern/rna_packedfile.c
@@ -30,46 +30,47 @@
#include "rna_internal.h"
const EnumPropertyItem rna_enum_unpack_method_items[] = {
- {PF_USE_LOCAL, "USE_LOCAL", 0, "Use Local File", ""},
- {PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write Local File (overwrite existing)", ""},
- {PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use Original File", ""},
- {PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write Original File (overwrite existing)", ""},
- {0, NULL, 0, NULL, NULL},
+ {PF_USE_LOCAL, "USE_LOCAL", 0, "Use Local File", ""},
+ {PF_WRITE_LOCAL, "WRITE_LOCAL", 0, "Write Local File (overwrite existing)", ""},
+ {PF_USE_ORIGINAL, "USE_ORIGINAL", 0, "Use Original File", ""},
+ {PF_WRITE_ORIGINAL, "WRITE_ORIGINAL", 0, "Write Original File (overwrite existing)", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static void rna_PackedImage_data_get(PointerRNA *ptr, char *value)
{
- PackedFile *pf = (PackedFile *)ptr->data;
- memcpy(value, pf->data, (size_t)pf->size);
- value[pf->size] = '\0';
+ PackedFile *pf = (PackedFile *)ptr->data;
+ memcpy(value, pf->data, (size_t)pf->size);
+ value[pf->size] = '\0';
}
static int rna_PackedImage_data_len(PointerRNA *ptr)
{
- PackedFile *pf = (PackedFile *)ptr->data;
- return pf->size; /* No need to include trailing NULL char here! */
+ PackedFile *pf = (PackedFile *)ptr->data;
+ return pf->size; /* No need to include trailing NULL char here! */
}
#else
void RNA_def_packedfile(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "PackedFile", NULL);
- RNA_def_struct_ui_text(srna, "Packed File", "External file packed into the .blend file");
+ srna = RNA_def_struct(brna, "PackedFile", NULL);
+ RNA_def_struct_ui_text(srna, "Packed File", "External file packed into the .blend file");
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Size", "Size of packed file in bytes");
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Size", "Size of packed file in bytes");
- prop = RNA_def_property(srna, "data", PROP_STRING, PROP_BYTESTRING);
- RNA_def_property_string_funcs(prop, "rna_PackedImage_data_get", "rna_PackedImage_data_len", NULL);
- RNA_def_property_ui_text(prop, "Data", "Raw data (bytes, exact content of the embedded file)");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "data", PROP_STRING, PROP_BYTESTRING);
+ RNA_def_property_string_funcs(
+ prop, "rna_PackedImage_data_get", "rna_PackedImage_data_len", NULL);
+ RNA_def_property_ui_text(prop, "Data", "Raw data (bytes, exact content of the embedded file)");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_palette.c b/source/blender/makesrna/intern/rna_palette.c
index 1f411a8d15d..7b35092dea4 100644
--- a/source/blender/makesrna/intern/rna_palette.c
+++ b/source/blender/makesrna/intern/rna_palette.c
@@ -31,58 +31,59 @@
#ifdef RNA_RUNTIME
-#include "DNA_brush_types.h"
+# include "DNA_brush_types.h"
-#include "BKE_paint.h"
-#include "BKE_report.h"
+# include "BKE_paint.h"
+# include "BKE_report.h"
static PaletteColor *rna_Palette_color_new(Palette *palette)
{
- PaletteColor *color = BKE_palette_color_add(palette);
- return color;
+ PaletteColor *color = BKE_palette_color_add(palette);
+ return color;
}
static void rna_Palette_color_remove(Palette *palette, ReportList *reports, PointerRNA *color_ptr)
{
- PaletteColor *color = color_ptr->data;
+ PaletteColor *color = color_ptr->data;
- if (BLI_findindex(&palette->colors, color) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Palette '%s' does not contain color given", palette->id.name + 2);
- return;
- }
+ if (BLI_findindex(&palette->colors, color) == -1) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Palette '%s' does not contain color given", palette->id.name + 2);
+ return;
+ }
- BKE_palette_color_remove(palette, color);
+ BKE_palette_color_remove(palette, color);
- RNA_POINTER_INVALIDATE(color_ptr);
+ RNA_POINTER_INVALIDATE(color_ptr);
}
static void rna_Palette_color_clear(Palette *palette)
{
- BKE_palette_clear(palette);
+ BKE_palette_clear(palette);
}
static PointerRNA rna_Palette_active_color_get(PointerRNA *ptr)
{
- Palette *palette = ptr->data;
- PaletteColor *color;
+ Palette *palette = ptr->data;
+ PaletteColor *color;
- color = BLI_findlink(&palette->colors, palette->active_color);
+ color = BLI_findlink(&palette->colors, palette->active_color);
- if (color)
- return rna_pointer_inherit_refine(ptr, &RNA_PaletteColor, color);
+ if (color)
+ return rna_pointer_inherit_refine(ptr, &RNA_PaletteColor, color);
- return rna_pointer_inherit_refine(ptr, NULL, NULL);
+ return rna_pointer_inherit_refine(ptr, NULL, NULL);
}
static void rna_Palette_active_color_set(PointerRNA *ptr, PointerRNA value)
{
- Palette *palette = ptr->data;
- PaletteColor *color = value.data;
-
- /* -1 is ok for an unset index */
- if (color == NULL)
- palette->active_color = -1;
- else
- palette->active_color = BLI_findindex(&palette->colors, color);
+ Palette *palette = ptr->data;
+ PaletteColor *color = value.data;
+
+ /* -1 is ok for an unset index */
+ if (color == NULL)
+ palette->active_color = -1;
+ else
+ palette->active_color = BLI_findindex(&palette->colors, color);
}
#else
@@ -90,90 +91,89 @@ static void rna_Palette_active_color_set(PointerRNA *ptr, PointerRNA value)
/* palette.colors */
static void rna_def_palettecolors(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "PaletteColors");
- srna = RNA_def_struct(brna, "PaletteColors", NULL);
- RNA_def_struct_sdna(srna, "Palette");
- RNA_def_struct_ui_text(srna, "Palette Splines", "Collection of palette colors");
-
- func = RNA_def_function(srna, "new", "rna_Palette_color_new");
- RNA_def_function_ui_description(func, "Add a new color to the palette");
- parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The newly created color");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_Palette_color_remove");
- RNA_def_function_ui_description(func, "Remove a color from the palette");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The color to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_Palette_color_clear");
- RNA_def_function_ui_description(func, "Remove all colors from the palette");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "PaletteColor");
- RNA_def_property_pointer_funcs(prop, "rna_Palette_active_color_get", "rna_Palette_active_color_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Palette Color", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "PaletteColors");
+ srna = RNA_def_struct(brna, "PaletteColors", NULL);
+ RNA_def_struct_sdna(srna, "Palette");
+ RNA_def_struct_ui_text(srna, "Palette Splines", "Collection of palette colors");
+
+ func = RNA_def_function(srna, "new", "rna_Palette_color_new");
+ RNA_def_function_ui_description(func, "Add a new color to the palette");
+ parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The newly created color");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Palette_color_remove");
+ RNA_def_function_ui_description(func, "Remove a color from the palette");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "color", "PaletteColor", "", "The color to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_Palette_color_clear");
+ RNA_def_function_ui_description(func, "Remove all colors from the palette");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "PaletteColor");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Palette_active_color_get", "rna_Palette_active_color_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Palette Color", "");
}
static void rna_def_palettecolor(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "PaletteColor", NULL);
- RNA_def_struct_ui_text(srna, "Palette Color", "");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "rgb");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_ui_text(prop, "Value", "");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "value");
- RNA_def_property_ui_text(prop, "Weight", "");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "PaletteColor", NULL);
+ RNA_def_struct_ui_text(srna, "Palette Color", "");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "rgb");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Value", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "value");
+ RNA_def_property_ui_text(prop, "Weight", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
static void rna_def_palette(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Palette", "ID");
- RNA_def_struct_ui_text(srna, "Palette", "");
- RNA_def_struct_ui_icon(srna, ICON_COLOR);
+ StructRNA *srna;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "colors", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "PaletteColor");
- rna_def_palettecolors(brna, prop);
+ srna = RNA_def_struct(brna, "Palette", "ID");
+ RNA_def_struct_ui_text(srna, "Palette", "");
+ RNA_def_struct_ui_icon(srna, ICON_COLOR);
+ prop = RNA_def_property(srna, "colors", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "PaletteColor");
+ rna_def_palettecolors(brna, prop);
}
void RNA_def_palette(BlenderRNA *brna)
{
- /* *** Non-Animated *** */
- RNA_define_animate_sdna(false);
- rna_def_palettecolor(brna);
- rna_def_palette(brna);
- RNA_define_animate_sdna(true);
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
+ rna_def_palettecolor(brna);
+ rna_def_palette(brna);
+ RNA_define_animate_sdna(true);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 635beed74fb..cb74055ae83 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -41,7 +41,6 @@
#include "BKE_mesh.h"
-
#include "BLT_translation.h"
#include "rna_internal.h"
@@ -51,3493 +50,3796 @@
#ifdef RNA_RUNTIME
static const EnumPropertyItem part_from_items[] = {
- {PART_FROM_VERT, "VERT", 0, "Verts", ""},
- {PART_FROM_FACE, "FACE", 0, "Faces", ""},
- {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_FROM_VERT, "VERT", 0, "Verts", ""},
+ {PART_FROM_FACE, "FACE", 0, "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifndef RNA_RUNTIME
static const EnumPropertyItem part_reactor_from_items[] = {
- {PART_FROM_VERT, "VERT", 0, "Verts", ""},
- {PART_FROM_FACE, "FACE", 0, "Faces", ""},
- {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_FROM_VERT, "VERT", 0, "Verts", ""},
+ {PART_FROM_FACE, "FACE", 0, "Faces", ""},
+ {PART_FROM_VOLUME, "VOLUME", 0, "Volume", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem part_dist_items[] = {
- {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
- {PART_DISTR_RAND, "RAND", 0, "Random", ""},
- {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
+ {PART_DISTR_RAND, "RAND", 0, "Random", ""},
+ {PART_DISTR_GRID, "GRID", 0, "Grid", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem part_hair_dist_items[] = {
- {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
- {PART_DISTR_RAND, "RAND", 0, "Random", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_DISTR_JIT, "JIT", 0, "Jittered", ""},
+ {PART_DISTR_RAND, "RAND", 0, "Random", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem part_draw_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
- {PART_DRAW_DOT, "DOT", 0, "Point", ""},
- {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
- {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
- {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
+ {PART_DRAW_DOT, "DOT", 0, "Point", ""},
+ {PART_DRAW_CIRC, "CIRC", 0, "Circle", ""},
+ {PART_DRAW_CROSS, "CROSS", 0, "Cross", ""},
+ {PART_DRAW_AXIS, "AXIS", 0, "Axis", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem part_hair_draw_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_REND, "RENDER", 0, "Rendered", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem part_ren_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
- {PART_DRAW_LINE, "LINE", 0, "Line", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
- {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_HALO, "HALO", 0, "Halo", ""},
+ {PART_DRAW_LINE, "LINE", 0, "Line", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
+ {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem part_hair_ren_as_items[] = {
- {PART_DRAW_NOT, "NONE", 0, "None", ""},
- {PART_DRAW_PATH, "PATH", 0, "Path", ""},
- {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
- {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
- {0, NULL, 0, NULL, NULL},
+ {PART_DRAW_NOT, "NONE", 0, "None", ""},
+ {PART_DRAW_PATH, "PATH", 0, "Path", ""},
+ {PART_DRAW_OB, "OBJECT", 0, "Object", ""},
+ {PART_DRAW_GR, "COLLECTION", 0, "Collection", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#include "BLI_math.h"
-#include "BLI_string_utils.h"
+# include "BLI_math.h"
+# include "BLI_string_utils.h"
-#include "BKE_boids.h"
-#include "BKE_context.h"
-#include "BKE_cloth.h"
-#include "BKE_colortools.h"
-#include "BKE_deform.h"
-#include "BKE_effect.h"
-#include "BKE_material.h"
-#include "BKE_modifier.h"
-#include "BKE_particle.h"
-#include "BKE_pointcache.h"
-#include "BKE_texture.h"
+# include "BKE_boids.h"
+# include "BKE_context.h"
+# include "BKE_cloth.h"
+# include "BKE_colortools.h"
+# include "BKE_deform.h"
+# include "BKE_effect.h"
+# include "BKE_material.h"
+# include "BKE_modifier.h"
+# include "BKE_particle.h"
+# include "BKE_pointcache.h"
+# include "BKE_texture.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
/* use for object space hair get/set */
-static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr, ParticleSystemModifierData **psmd_pt,
+static void rna_ParticleHairKey_location_object_info(PointerRNA *ptr,
+ ParticleSystemModifierData **psmd_pt,
ParticleData **pa_pt)
{
- HairKey *hkey = (HairKey *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
- ModifierData *md;
- ParticleSystemModifierData *psmd = NULL;
- ParticleSystem *psys;
- ParticleData *pa;
- int i;
-
- *psmd_pt = NULL;
- *pa_pt = NULL;
-
- /* given the pointer HairKey *hkey, we iterate over all particles in all
- * particle systems in the object "ob" in order to find
- * - the ParticleSystemData to which the HairKey (and hence the particle)
- * belongs (will be stored in psmd_pt)
- * - the ParticleData to which the HairKey belongs (will be stored in pa_pt)
- *
- * not a very efficient way of getting hair key location data,
- * but it's the best we've got at the present
- *
- * IDEAS: include additional information in pointerRNA beforehand,
- * for example a pointer to the ParticleStstemModifierData to which the
- * hairkey belongs.
- */
-
- for (md = ob->modifiers.first; md; md = md->next) {
- if (md->type == eModifierType_ParticleSystem) {
- psmd = (ParticleSystemModifierData *) md;
- if (psmd && psmd->mesh_final && psmd->psys) {
- psys = psmd->psys;
- for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
- /* hairkeys are stored sequentially in memory, so we can
- * find if it's the same particle by comparing pointers,
- * without having to iterate over them all */
- if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
- *psmd_pt = psmd;
- *pa_pt = pa;
- return;
- }
- }
- }
- }
- }
+ HairKey *hkey = (HairKey *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ModifierData *md;
+ ParticleSystemModifierData *psmd = NULL;
+ ParticleSystem *psys;
+ ParticleData *pa;
+ int i;
+
+ *psmd_pt = NULL;
+ *pa_pt = NULL;
+
+ /* given the pointer HairKey *hkey, we iterate over all particles in all
+ * particle systems in the object "ob" in order to find
+ * - the ParticleSystemData to which the HairKey (and hence the particle)
+ * belongs (will be stored in psmd_pt)
+ * - the ParticleData to which the HairKey belongs (will be stored in pa_pt)
+ *
+ * not a very efficient way of getting hair key location data,
+ * but it's the best we've got at the present
+ *
+ * IDEAS: include additional information in pointerRNA beforehand,
+ * for example a pointer to the ParticleStstemModifierData to which the
+ * hairkey belongs.
+ */
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_ParticleSystem) {
+ psmd = (ParticleSystemModifierData *)md;
+ if (psmd && psmd->mesh_final && psmd->psys) {
+ psys = psmd->psys;
+ for (i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
+ /* hairkeys are stored sequentially in memory, so we can
+ * find if it's the same particle by comparing pointers,
+ * without having to iterate over them all */
+ if ((hkey >= pa->hair) && (hkey < pa->hair + pa->totkey)) {
+ *psmd_pt = psmd;
+ *pa_pt = pa;
+ return;
+ }
+ }
+ }
+ }
+ }
}
static void rna_ParticleHairKey_location_object_get(PointerRNA *ptr, float *values)
{
- HairKey *hkey = (HairKey *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
- ParticleSystemModifierData *psmd;
- ParticleData *pa;
+ HairKey *hkey = (HairKey *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystemModifierData *psmd;
+ ParticleData *pa;
- rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
+ rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
- if (pa) {
- Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
+ if (pa) {
+ Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
- if (hair_mesh) {
- MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
- copy_v3_v3(values, mvert->co);
- }
- else {
- float hairmat[4][4];
- psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
- copy_v3_v3(values, hkey->co);
- mul_m4_v3(hairmat, values);
- }
- }
- else {
- zero_v3(values);
- }
+ if (hair_mesh) {
+ MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
+ copy_v3_v3(values, mvert->co);
+ }
+ else {
+ float hairmat[4][4];
+ psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
+ copy_v3_v3(values, hkey->co);
+ mul_m4_v3(hairmat, values);
+ }
+ }
+ else {
+ zero_v3(values);
+ }
}
static void rna_ParticleHairKey_location_object_set(PointerRNA *ptr, const float *values)
{
- HairKey *hkey = (HairKey *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
- ParticleSystemModifierData *psmd;
- ParticleData *pa;
-
- rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
-
- if (pa) {
- Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
-
- if (hair_mesh) {
- MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
- copy_v3_v3(mvert->co, values);
- }
- else {
- float hairmat[4][4];
- float imat[4][4];
-
- psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
- invert_m4_m4(imat, hairmat);
- copy_v3_v3(hkey->co, values);
- mul_m4_v3(imat, hkey->co);
- }
- }
- else {
- zero_v3(hkey->co);
- }
-}
-
-static void rna_ParticleHairKey_co_object(HairKey *hairkey, Object *object, ParticleSystemModifierData *modifier, ParticleData *particle,
- float n_co[3])
-{
-
- Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh : NULL;
- if (particle) {
- if (hair_mesh) {
- MVert *mvert = &hair_mesh->mvert[particle->hair_index + (hairkey - particle->hair)];
- copy_v3_v3(n_co, mvert->co);
- }
- else {
- float hairmat[4][4];
- psys_mat_hair_to_object(object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
- copy_v3_v3(n_co, hairkey->co);
- mul_m4_v3(hairmat, n_co);
- }
- }
- else {
- zero_v3(n_co);
- }
-}
-
-static void rna_Particle_uv_on_emitter(ParticleData *particle, ReportList *reports,
- ParticleSystemModifierData *modifier, float r_uv[2])
-{
- /*psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);*/
-
- /* get uvco & mcol */
- int num = particle->num_dmcache;
- int from = modifier->psys->part->from;
-
- if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
- BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
- return;
- }
- BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
-
- if (num == DMCACHE_NOTFOUND)
- if (particle->num < modifier->mesh_final->totface)
- num = particle->num;
-
- /* get uvco */
- if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
-
- if (num != DMCACHE_NOTFOUND) {
- MFace *mface;
- MTFace *mtface;
-
- mface = modifier->mesh_final->mface;
- mtface = modifier->mesh_final->mtface;
-
- if (mface && mtface) {
- mtface += num;
- psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv);
- return;
- }
- }
- }
-
- r_uv[0] = 0.0f;
- r_uv[1] = 0.0f;
-}
-
-static void rna_ParticleSystem_co_hair(ParticleSystem *particlesystem, Object *object,
- int particle_no, int step, float n_co[3])
-{
- ParticleSettings *part = NULL;
- ParticleData *pars = NULL;
- ParticleCacheKey *cache = NULL;
- int totchild = 0;
- int totpart;
- int max_k = 0;
-
- if (particlesystem == NULL)
- return;
-
- part = particlesystem->part;
- pars = particlesystem->particles;
- totpart = particlesystem->totcached;
- totchild = particlesystem->totchildcache;
-
- if (part == NULL || pars == NULL)
- return;
-
- if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || part->ren_as == PART_DRAW_NOT)
- return;
-
- /* can happen for disconnected/global hair */
- if (part->type == PART_HAIR && !particlesystem->childcache)
- totchild = 0;
-
- if (particle_no < totpart) {
- cache = particlesystem->pathcache[particle_no];
- max_k = (int)cache->segments;
- }
- else if (particle_no < totpart + totchild) {
- cache = particlesystem->childcache[particle_no - totpart];
-
- if (cache->segments < 0)
- max_k = 0;
- else
- max_k = (int)cache->segments;
- }
- else {
- return;
- }
-
- /* Strands key loop data stored in cache + step->co. */
- if (step >= 0 && step <= max_k) {
- copy_v3_v3(n_co, (cache + step)->co);
- mul_m4_v3(particlesystem->imat, n_co);
- mul_m4_v3(object->obmat, n_co);
- }
-}
-
-
-static const EnumPropertyItem *rna_Particle_Material_itemf(
- bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
-{
- Object *ob = CTX_data_pointer_get(C, "object").data;
- Material *ma;
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- int totitem = 0;
- int i;
-
- if (ob && ob->totcol > 0) {
- for (i = 1; i <= ob->totcol; i++) {
- ma = give_current_material(ob, i);
- tmp.value = i;
- tmp.icon = ICON_MATERIAL_DATA;
- if (ma) {
- tmp.name = ma->id.name + 2;
- tmp.identifier = tmp.name;
- }
- else {
- tmp.name = "Default Material";
- tmp.identifier = tmp.name;
- }
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- }
- else {
- tmp.value = 1;
- tmp.icon = ICON_MATERIAL_DATA;
- tmp.name = "Default Material";
- tmp.identifier = tmp.name;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ HairKey *hkey = (HairKey *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystemModifierData *psmd;
+ ParticleData *pa;
+
+ rna_ParticleHairKey_location_object_info(ptr, &psmd, &pa);
+
+ if (pa) {
+ Mesh *hair_mesh = (psmd->psys->flag & PSYS_HAIR_DYNAMICS) ? psmd->psys->hair_out_mesh : NULL;
+
+ if (hair_mesh) {
+ MVert *mvert = &hair_mesh->mvert[pa->hair_index + (hkey - pa->hair)];
+ copy_v3_v3(mvert->co, values);
+ }
+ else {
+ float hairmat[4][4];
+ float imat[4][4];
+
+ psys_mat_hair_to_object(ob, psmd->mesh_final, psmd->psys->part->from, pa, hairmat);
+ invert_m4_m4(imat, hairmat);
+ copy_v3_v3(hkey->co, values);
+ mul_m4_v3(imat, hkey->co);
+ }
+ }
+ else {
+ zero_v3(hkey->co);
+ }
+}
+
+static void rna_ParticleHairKey_co_object(HairKey *hairkey,
+ Object *object,
+ ParticleSystemModifierData *modifier,
+ ParticleData *particle,
+ float n_co[3])
+{
+
+ Mesh *hair_mesh = (modifier->psys->flag & PSYS_HAIR_DYNAMICS) ? modifier->psys->hair_out_mesh :
+ NULL;
+ if (particle) {
+ if (hair_mesh) {
+ MVert *mvert = &hair_mesh->mvert[particle->hair_index + (hairkey - particle->hair)];
+ copy_v3_v3(n_co, mvert->co);
+ }
+ else {
+ float hairmat[4][4];
+ psys_mat_hair_to_object(
+ object, modifier->mesh_final, modifier->psys->part->from, particle, hairmat);
+ copy_v3_v3(n_co, hairkey->co);
+ mul_m4_v3(hairmat, n_co);
+ }
+ }
+ else {
+ zero_v3(n_co);
+ }
+}
+
+static void rna_Particle_uv_on_emitter(ParticleData *particle,
+ ReportList *reports,
+ ParticleSystemModifierData *modifier,
+ float r_uv[2])
+{
+ /*psys_particle_on_emitter(psmd, part->from, pa->num, pa->num_dmcache, pa->fuv, pa->foffset, co, nor, 0, 0, sd.orco, 0);*/
+
+ /* get uvco & mcol */
+ int num = particle->num_dmcache;
+ int from = modifier->psys->part->from;
+
+ if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
+ BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
+ return;
+ }
+ BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+
+ if (num == DMCACHE_NOTFOUND)
+ if (particle->num < modifier->mesh_final->totface)
+ num = particle->num;
+
+ /* get uvco */
+ if (r_uv && ELEM(from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+
+ if (num != DMCACHE_NOTFOUND) {
+ MFace *mface;
+ MTFace *mtface;
+
+ mface = modifier->mesh_final->mface;
+ mtface = modifier->mesh_final->mtface;
+
+ if (mface && mtface) {
+ mtface += num;
+ psys_interpolate_uvs(mtface, mface->v4, particle->fuv, r_uv);
+ return;
+ }
+ }
+ }
+
+ r_uv[0] = 0.0f;
+ r_uv[1] = 0.0f;
+}
+
+static void rna_ParticleSystem_co_hair(
+ ParticleSystem *particlesystem, Object *object, int particle_no, int step, float n_co[3])
+{
+ ParticleSettings *part = NULL;
+ ParticleData *pars = NULL;
+ ParticleCacheKey *cache = NULL;
+ int totchild = 0;
+ int totpart;
+ int max_k = 0;
+
+ if (particlesystem == NULL)
+ return;
+
+ part = particlesystem->part;
+ pars = particlesystem->particles;
+ totpart = particlesystem->totcached;
+ totchild = particlesystem->totchildcache;
+
+ if (part == NULL || pars == NULL)
+ return;
+
+ if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR ||
+ part->ren_as == PART_DRAW_NOT)
+ return;
+
+ /* can happen for disconnected/global hair */
+ if (part->type == PART_HAIR && !particlesystem->childcache)
+ totchild = 0;
+
+ if (particle_no < totpart) {
+ cache = particlesystem->pathcache[particle_no];
+ max_k = (int)cache->segments;
+ }
+ else if (particle_no < totpart + totchild) {
+ cache = particlesystem->childcache[particle_no - totpart];
+
+ if (cache->segments < 0)
+ max_k = 0;
+ else
+ max_k = (int)cache->segments;
+ }
+ else {
+ return;
+ }
+
+ /* Strands key loop data stored in cache + step->co. */
+ if (step >= 0 && step <= max_k) {
+ copy_v3_v3(n_co, (cache + step)->co);
+ mul_m4_v3(particlesystem->imat, n_co);
+ mul_m4_v3(object->obmat, n_co);
+ }
+}
+
+static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ Object *ob = CTX_data_pointer_get(C, "object").data;
+ Material *ma;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
+ int i;
+
+ if (ob && ob->totcol > 0) {
+ for (i = 1; i <= ob->totcol; i++) {
+ ma = give_current_material(ob, i);
+ tmp.value = i;
+ tmp.icon = ICON_MATERIAL_DATA;
+ if (ma) {
+ tmp.name = ma->id.name + 2;
+ tmp.identifier = tmp.name;
+ }
+ else {
+ tmp.name = "Default Material";
+ tmp.identifier = tmp.name;
+ }
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+ else {
+ tmp.value = 1;
+ tmp.icon = ICON_MATERIAL_DATA;
+ tmp.name = "Default Material";
+ tmp.identifier = tmp.name;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
/* return < 0 means invalid (no matching tessellated face could be found). */
static int rna_ParticleSystem_tessfaceidx_on_emitter(ParticleSystem *particlesystem,
- ParticleSystemModifierData *modifier, ParticleData *particle,
- int particle_no, float (**r_fuv)[4])
-{
- ParticleSettings *part = NULL;
- int totpart;
- int totchild = 0;
- int totface;
- int totvert;
- int num = -1;
-
- BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
- totface = modifier->mesh_final->totface;
- totvert = modifier->mesh_final->totvert;
-
- /* 1. check that everything is ok & updated */
- if (!particlesystem || !totface) {
- return num;
- }
-
- part = particlesystem->part;
- totpart = particlesystem->totcached;
- totchild = particlesystem->totchildcache;
-
- /* can happen for disconnected/global hair */
- if (part->type == PART_HAIR && !particlesystem->childcache)
- totchild = 0;
-
- if (particle_no >= totpart + totchild)
- return num;
-
- /* 2. get matching face index. */
- if (particle_no < totpart) {
- num = (ELEM(particle->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? particle->num : particle->num_dmcache;
-
- if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
- if (num != DMCACHE_NOTFOUND && num < totface) {
- *r_fuv = &particle->fuv;
- return num;
- }
- }
- else if (part->from == PART_FROM_VERT) {
- if (num != DMCACHE_NOTFOUND && num < totvert) {
- MFace *mface = modifier->mesh_final->mface;
-
- *r_fuv = &particle->fuv;
-
- /* This finds the first face to contain the emitting vertex,
- * this is not ideal, but is mostly fine as UV seams generally
- * map to equal-colored parts of a texture */
- for (int i = 0; i < totface; i++, mface++) {
- if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
- return i;
- }
- }
- }
- }
- }
- else {
- ChildParticle *cpa = particlesystem->child + particle_no - totpart;
- num = cpa->num;
-
- if (part->childtype == PART_CHILD_FACES) {
- if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME, PART_FROM_VERT)) {
- if (num != DMCACHE_NOTFOUND && num < totface) {
- *r_fuv = &cpa->fuv;
- return num;
- }
- }
- }
- else {
- ParticleData *parent = particlesystem->particles + cpa->parent;
- num = parent->num_dmcache;
-
- if (num == DMCACHE_NOTFOUND)
- num = parent->num;
-
- if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
- if (num != DMCACHE_NOTFOUND && num < totface) {
- *r_fuv = &parent->fuv;
- return num;
- }
- }
- else if (part->from == PART_FROM_VERT) {
- if (num != DMCACHE_NOTFOUND && num < totvert) {
- MFace *mface = modifier->mesh_final->mface;
-
- *r_fuv = &parent->fuv;
-
- /* This finds the first face to contain the emitting vertex,
- * this is not ideal, but is mostly fine as UV seams generally
- * map to equal-colored parts of a texture */
- for (int i = 0; i < totface; i++, mface++) {
- if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
- return i;
- }
- }
- }
- }
- }
- }
-
- return -1;
-}
-
-static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
- ParticleSystemModifierData *modifier, ParticleData *particle,
- int particle_no, int uv_no, float r_uv[2])
-{
- if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
- BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
- zero_v2(r_uv);
- return;
- }
-
- {
- float (*fuv)[4];
- /* Note all sanity checks are done in this helper func. */
- const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
- particle_no, &fuv);
-
- if (num < 0) {
- /* No matching face found. */
- zero_v2(r_uv);
- }
- else {
- MFace *mface = &modifier->mesh_final->mface[num];
- MTFace *mtface = (MTFace *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MTFACE, uv_no);
-
- psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv);
- }
- }
-}
-
-static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem, ReportList *reports,
- ParticleSystemModifierData *modifier, ParticleData *particle,
- int particle_no, int vcol_no, float r_mcol[3])
-{
- if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPCOL)) {
- BKE_report(reports, RPT_ERROR, "Mesh has no VCol data");
- zero_v3(r_mcol);
- return;
- }
-
- {
- float (*fuv)[4];
- /* Note all sanity checks are done in this helper func. */
- const int num = rna_ParticleSystem_tessfaceidx_on_emitter(particlesystem, modifier, particle,
- particle_no, &fuv);
-
- if (num < 0) {
- /* No matching face found. */
- zero_v3(r_mcol);
- }
- else {
- MFace *mface = &modifier->mesh_final->mface[num];
- MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MCOL, vcol_no);
- MCol mcol;
-
- psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol);
- r_mcol[0] = (float)mcol.b / 255.0f;
- r_mcol[1] = (float)mcol.g / 255.0f;
- r_mcol[2] = (float)mcol.r / 255.0f;
- }
- }
+ ParticleSystemModifierData *modifier,
+ ParticleData *particle,
+ int particle_no,
+ float (**r_fuv)[4])
+{
+ ParticleSettings *part = NULL;
+ int totpart;
+ int totchild = 0;
+ int totface;
+ int totvert;
+ int num = -1;
+
+ BKE_mesh_tessface_ensure(modifier->mesh_final); /* BMESH - UNTIL MODIFIER IS UPDATED FOR MPoly */
+ totface = modifier->mesh_final->totface;
+ totvert = modifier->mesh_final->totvert;
+
+ /* 1. check that everything is ok & updated */
+ if (!particlesystem || !totface) {
+ return num;
+ }
+
+ part = particlesystem->part;
+ totpart = particlesystem->totcached;
+ totchild = particlesystem->totchildcache;
+
+ /* can happen for disconnected/global hair */
+ if (part->type == PART_HAIR && !particlesystem->childcache)
+ totchild = 0;
+
+ if (particle_no >= totpart + totchild)
+ return num;
+
+ /* 2. get matching face index. */
+ if (particle_no < totpart) {
+ num = (ELEM(particle->num_dmcache, DMCACHE_ISCHILD, DMCACHE_NOTFOUND)) ? particle->num :
+ particle->num_dmcache;
+
+ if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ if (num != DMCACHE_NOTFOUND && num < totface) {
+ *r_fuv = &particle->fuv;
+ return num;
+ }
+ }
+ else if (part->from == PART_FROM_VERT) {
+ if (num != DMCACHE_NOTFOUND && num < totvert) {
+ MFace *mface = modifier->mesh_final->mface;
+
+ *r_fuv = &particle->fuv;
+
+ /* This finds the first face to contain the emitting vertex,
+ * this is not ideal, but is mostly fine as UV seams generally
+ * map to equal-colored parts of a texture */
+ for (int i = 0; i < totface; i++, mface++) {
+ if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
+ return i;
+ }
+ }
+ }
+ }
+ }
+ else {
+ ChildParticle *cpa = particlesystem->child + particle_no - totpart;
+ num = cpa->num;
+
+ if (part->childtype == PART_CHILD_FACES) {
+ if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME, PART_FROM_VERT)) {
+ if (num != DMCACHE_NOTFOUND && num < totface) {
+ *r_fuv = &cpa->fuv;
+ return num;
+ }
+ }
+ }
+ else {
+ ParticleData *parent = particlesystem->particles + cpa->parent;
+ num = parent->num_dmcache;
+
+ if (num == DMCACHE_NOTFOUND)
+ num = parent->num;
+
+ if (ELEM(part->from, PART_FROM_FACE, PART_FROM_VOLUME)) {
+ if (num != DMCACHE_NOTFOUND && num < totface) {
+ *r_fuv = &parent->fuv;
+ return num;
+ }
+ }
+ else if (part->from == PART_FROM_VERT) {
+ if (num != DMCACHE_NOTFOUND && num < totvert) {
+ MFace *mface = modifier->mesh_final->mface;
+
+ *r_fuv = &parent->fuv;
+
+ /* This finds the first face to contain the emitting vertex,
+ * this is not ideal, but is mostly fine as UV seams generally
+ * map to equal-colored parts of a texture */
+ for (int i = 0; i < totface; i++, mface++) {
+ if (ELEM(num, mface->v1, mface->v2, mface->v3, mface->v4)) {
+ return i;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return -1;
+}
+
+static void rna_ParticleSystem_uv_on_emitter(ParticleSystem *particlesystem,
+ ReportList *reports,
+ ParticleSystemModifierData *modifier,
+ ParticleData *particle,
+ int particle_no,
+ int uv_no,
+ float r_uv[2])
+{
+ if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPUV)) {
+ BKE_report(reports, RPT_ERROR, "Mesh has no UV data");
+ zero_v2(r_uv);
+ return;
+ }
+
+ {
+ float(*fuv)[4];
+ /* Note all sanity checks are done in this helper func. */
+ const int num = rna_ParticleSystem_tessfaceidx_on_emitter(
+ particlesystem, modifier, particle, particle_no, &fuv);
+
+ if (num < 0) {
+ /* No matching face found. */
+ zero_v2(r_uv);
+ }
+ else {
+ MFace *mface = &modifier->mesh_final->mface[num];
+ MTFace *mtface = (MTFace *)CustomData_get_layer_n(
+ &modifier->mesh_final->fdata, CD_MTFACE, uv_no);
+
+ psys_interpolate_uvs(&mtface[num], mface->v4, *fuv, r_uv);
+ }
+ }
+}
+
+static void rna_ParticleSystem_mcol_on_emitter(ParticleSystem *particlesystem,
+ ReportList *reports,
+ ParticleSystemModifierData *modifier,
+ ParticleData *particle,
+ int particle_no,
+ int vcol_no,
+ float r_mcol[3])
+{
+ if (!CustomData_has_layer(&modifier->mesh_final->ldata, CD_MLOOPCOL)) {
+ BKE_report(reports, RPT_ERROR, "Mesh has no VCol data");
+ zero_v3(r_mcol);
+ return;
+ }
+
+ {
+ float(*fuv)[4];
+ /* Note all sanity checks are done in this helper func. */
+ const int num = rna_ParticleSystem_tessfaceidx_on_emitter(
+ particlesystem, modifier, particle, particle_no, &fuv);
+
+ if (num < 0) {
+ /* No matching face found. */
+ zero_v3(r_mcol);
+ }
+ else {
+ MFace *mface = &modifier->mesh_final->mface[num];
+ MCol *mc = (MCol *)CustomData_get_layer_n(&modifier->mesh_final->fdata, CD_MCOL, vcol_no);
+ MCol mcol;
+
+ psys_interpolate_mcol(&mc[num * 4], mface->v4, *fuv, &mcol);
+ r_mcol[0] = (float)mcol.b / 255.0f;
+ r_mcol[1] = (float)mcol.g / 255.0f;
+ r_mcol[2] = (float)mcol.r / 255.0f;
+ }
+ }
}
static void particle_recalc(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr, short flag)
{
- if (ptr->type == &RNA_ParticleSystem) {
- Object *ob = ptr->id.data;
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ if (ptr->type == &RNA_ParticleSystem) {
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- psys->recalc = flag;
+ psys->recalc = flag;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
- else
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | flag);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+ else
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY | flag);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
}
static void rna_Particle_redo(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
+ particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
}
static void rna_Particle_redo_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
- rna_Particle_redo(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ rna_Particle_redo(bmain, scene, ptr);
}
static void rna_Particle_redo_count(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->data;
- DEG_relations_tag_update(bmain);
- psys_check_group_weights(part);
- particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+ DEG_relations_tag_update(bmain);
+ psys_check_group_weights(part);
+ particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_REDO);
}
static void rna_Particle_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET);
+ particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET);
}
static void rna_Particle_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
- rna_Particle_reset(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ rna_Particle_reset(bmain, scene, ptr);
}
static void rna_Particle_change_type(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ParticleSettings *part = ptr->id.data;
+ ParticleSettings *part = ptr->id.data;
- /* Iterating over all object is slow, but no better solution exists at the moment. */
- for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
- for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
- if (psys->part == part) {
- psys_changed_type(ob, psys);
- psys->recalc |= ID_RECALC_PSYS_RESET;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
- }
- }
+ /* Iterating over all object is slow, but no better solution exists at the moment. */
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+ for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) {
+ if (psys->part == part) {
+ psys_changed_type(ob, psys);
+ psys->recalc |= ID_RECALC_PSYS_RESET;
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+ }
+ }
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
- DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ DEG_relations_tag_update(bmain);
}
static void rna_Particle_change_physics_type(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET | ID_RECALC_PSYS_PHYS);
+ particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_RESET | ID_RECALC_PSYS_PHYS);
- ParticleSettings *part = (ParticleSettings *)ptr->data;
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
- if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
- BoidState *state;
+ if (part->phystype == PART_PHYS_BOIDS && part->boids == NULL) {
+ BoidState *state;
- part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
- boid_default_settings(part->boids);
+ part->boids = MEM_callocN(sizeof(BoidSettings), "Boid Settings");
+ boid_default_settings(part->boids);
- state = boid_new_state(part->boids);
- BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
- BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
+ state = boid_new_state(part->boids);
+ BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Separate));
+ BLI_addtail(&state->rules, boid_new_rule(eBoidRuleType_Flock));
- ((BoidRule *)state->rules.first)->flag |= BOIDRULE_CURRENT;
+ ((BoidRule *)state->rules.first)->flag |= BOIDRULE_CURRENT;
- state->flag |= BOIDSTATE_CURRENT;
- BLI_addtail(&part->boids->states, state);
- }
- else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
- part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
- BKE_particlesettings_fluid_default_settings(part);
- }
+ state->flag |= BOIDSTATE_CURRENT;
+ BLI_addtail(&part->boids->states, state);
+ }
+ else if (part->phystype == PART_PHYS_FLUID && part->fluid == NULL) {
+ part->fluid = MEM_callocN(sizeof(SPHFluidSettings), "SPH Fluid Settings");
+ BKE_particlesettings_fluid_default_settings(part);
+ }
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
}
static void rna_Particle_redo_child(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_CHILD);
+ particle_recalc(bmain, scene, ptr, ID_RECALC_PSYS_CHILD);
}
static void rna_Particle_cloth_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
+ Object *ob = (Object *)ptr->id.data;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
-
static ParticleSystem *rna_particle_system_for_target(Object *ob, ParticleTarget *target)
{
- ParticleSystem *psys;
- ParticleTarget *pt;
+ ParticleSystem *psys;
+ ParticleTarget *pt;
- for (psys = ob->particlesystem.first; psys; psys = psys->next)
- for (pt = psys->targets.first; pt; pt = pt->next)
- if (pt == target)
- return psys;
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ for (pt = psys->targets.first; pt; pt = pt->next)
+ if (pt == target)
+ return psys;
- return NULL;
+ return NULL;
}
static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- if (ptr->type == &RNA_ParticleTarget) {
- Object *ob = (Object *)ptr->id.data;
- ParticleTarget *pt = (ParticleTarget *)ptr->data;
- ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt);
+ if (ptr->type == &RNA_ParticleTarget) {
+ Object *ob = (Object *)ptr->id.data;
+ ParticleTarget *pt = (ParticleTarget *)ptr->data;
+ ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt);
- if (pt->ob == ob || pt->ob == NULL) {
- kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
+ if (pt->ob == ob || pt->ob == NULL) {
+ kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
- if (kpsys)
- pt->flag |= PTARGET_VALID;
- else
- pt->flag &= ~PTARGET_VALID;
- }
- else {
- if (pt->ob)
- kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
+ if (kpsys)
+ pt->flag |= PTARGET_VALID;
+ else
+ pt->flag &= ~PTARGET_VALID;
+ }
+ else {
+ if (pt->ob)
+ kpsys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
- if (kpsys)
- pt->flag |= PTARGET_VALID;
- else
- pt->flag &= ~PTARGET_VALID;
- }
+ if (kpsys)
+ pt->flag |= PTARGET_VALID;
+ else
+ pt->flag &= ~PTARGET_VALID;
+ }
- psys->recalc = ID_RECALC_PSYS_RESET;
+ psys->recalc = ID_RECALC_PSYS_RESET;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- DEG_relations_tag_update(bmain);
- }
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ DEG_relations_tag_update(bmain);
+ }
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
}
static void rna_Particle_target_redo(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- if (ptr->type == &RNA_ParticleTarget) {
- Object *ob = (Object *)ptr->id.data;
- ParticleTarget *pt = (ParticleTarget *)ptr->data;
- ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
+ if (ptr->type == &RNA_ParticleTarget) {
+ Object *ob = (Object *)ptr->id.data;
+ ParticleTarget *pt = (ParticleTarget *)ptr->data;
+ ParticleSystem *psys = rna_particle_system_for_target(ob, pt);
- psys->recalc = ID_RECALC_PSYS_REDO;
+ psys->recalc = ID_RECALC_PSYS_REDO;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
- }
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ }
}
static void rna_Particle_hair_dynamics_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- if (psys && !psys->clmd) {
- psys->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
- psys->clmd->sim_parms->goalspring = 0.0f;
- psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS;
- psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
- rna_Particle_redo(bmain, scene, ptr);
- }
- else {
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
- }
+ if (psys && !psys->clmd) {
+ psys->clmd = (ClothModifierData *)modifier_new(eModifierType_Cloth);
+ psys->clmd->sim_parms->goalspring = 0.0f;
+ psys->clmd->sim_parms->flags |= CLOTH_SIMSETTINGS_FLAG_RESIST_SPRING_COMPRESS;
+ psys->clmd->coll_parms->flags &= ~CLOTH_COLLSETTINGS_FLAG_SELF;
+ rna_Particle_redo(bmain, scene, ptr);
+ }
+ else {
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ }
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- DEG_relations_tag_update(bmain);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ DEG_relations_tag_update(bmain);
}
static PointerRNA rna_particle_settings_get(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- ParticleSettings *part = psys->part;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleSettings *part = psys->part;
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleSettings, part);
}
static void rna_particle_settings_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = ptr->id.data;
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- int old_type = 0;
-
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ int old_type = 0;
- if (psys->part) {
- old_type = psys->part->type;
- id_us_min(&psys->part->id);
- }
+ if (psys->part) {
+ old_type = psys->part->type;
+ id_us_min(&psys->part->id);
+ }
- psys->part = (ParticleSettings *)value.data;
+ psys->part = (ParticleSettings *)value.data;
- if (psys->part) {
- id_us_plus(&psys->part->id);
- psys_check_boid_data(psys);
- if (old_type != psys->part->type) {
- psys_changed_type(ob, psys);
- }
- }
+ if (psys->part) {
+ id_us_plus(&psys->part->id);
+ psys_check_boid_data(psys);
+ if (old_type != psys->part->type) {
+ psys_changed_type(ob, psys);
+ }
+ }
}
static void rna_Particle_abspathtime_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- float delta = settings->end + settings->lifetime - settings->sta;
- if (settings->draw & PART_ABS_PATH_TIME) {
- settings->path_start = settings->sta + settings->path_start * delta;
- settings->path_end = settings->sta + settings->path_end * delta;
- }
- else {
- settings->path_start = (settings->path_start - settings->sta) / delta;
- settings->path_end = (settings->path_end - settings->sta) / delta;
- }
- rna_Particle_redo(bmain, scene, ptr);
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ float delta = settings->end + settings->lifetime - settings->sta;
+ if (settings->draw & PART_ABS_PATH_TIME) {
+ settings->path_start = settings->sta + settings->path_start * delta;
+ settings->path_end = settings->sta + settings->path_end * delta;
+ }
+ else {
+ settings->path_start = (settings->path_start - settings->sta) / delta;
+ settings->path_end = (settings->path_end - settings->sta) / delta;
+ }
+ rna_Particle_redo(bmain, scene, ptr);
}
static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
- /* check for clipping */
- if (value > settings->end)
- value = settings->end;
+ /* check for clipping */
+ if (value > settings->end)
+ value = settings->end;
- /*if (settings->type==PART_REACTOR && value < 1.0) */
- /* value = 1.0; */
- /*else */
- if (value < MINAFRAMEF)
- value = MINAFRAMEF;
+ /*if (settings->type==PART_REACTOR && value < 1.0) */
+ /* value = 1.0; */
+ /*else */
+ if (value < MINAFRAMEF)
+ value = MINAFRAMEF;
- settings->sta = value;
+ settings->sta = value;
}
static void rna_PartSettings_end_set(struct PointerRNA *ptr, float value)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
- /* check for clipping */
- if (value < settings->sta)
- value = settings->sta;
+ /* check for clipping */
+ if (value < settings->sta)
+ value = settings->sta;
- settings->end = value;
+ settings->end = value;
}
static void rna_PartSetings_timestep_set(struct PointerRNA *ptr, float value)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
- settings->timetweak = value / 0.04f;
+ settings->timetweak = value / 0.04f;
}
static float rna_PartSettings_timestep_get(struct PointerRNA *ptr)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
- return settings->timetweak * 0.04f;
+ return settings->timetweak * 0.04f;
}
static void rna_PartSetting_hairlength_set(struct PointerRNA *ptr, float value)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- settings->normfac = value / 4.f;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ settings->normfac = value / 4.f;
}
static float rna_PartSetting_hairlength_get(struct PointerRNA *ptr)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- return settings->normfac * 4.f;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ return settings->normfac * 4.f;
}
static void rna_PartSetting_linelentail_set(struct PointerRNA *ptr, float value)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- settings->draw_line[0] = value;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ settings->draw_line[0] = value;
}
static float rna_PartSetting_linelentail_get(struct PointerRNA *ptr)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- return settings->draw_line[0];
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ return settings->draw_line[0];
}
-static void rna_PartSetting_pathstartend_range(PointerRNA *ptr, float *min, float *max,
- float *UNUSED(softmin), float *UNUSED(softmax))
+static void rna_PartSetting_pathstartend_range(
+ PointerRNA *ptr, float *min, float *max, float *UNUSED(softmin), float *UNUSED(softmax))
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
- if (settings->type == PART_HAIR) {
- *min = 0.0f;
- *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
- }
- else {
- *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
- *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
- }
+ if (settings->type == PART_HAIR) {
+ *min = 0.0f;
+ *max = (settings->draw & PART_ABS_PATH_TIME) ? 100.0f : 1.0f;
+ }
+ else {
+ *min = (settings->draw & PART_ABS_PATH_TIME) ? settings->sta : 0.0f;
+ *max = (settings->draw & PART_ABS_PATH_TIME) ? MAXFRAMEF : 1.0f;
+ }
}
static void rna_PartSetting_linelenhead_set(struct PointerRNA *ptr, float value)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- settings->draw_line[1] = value;
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ settings->draw_line[1] = value;
}
static float rna_PartSetting_linelenhead_get(struct PointerRNA *ptr)
{
- ParticleSettings *settings = (ParticleSettings *)ptr->data;
- return settings->draw_line[1];
+ ParticleSettings *settings = (ParticleSettings *)ptr->data;
+ return settings->draw_line[1];
}
-
static bool rna_PartSettings_is_fluid_get(PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->data;
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
- return part->type == PART_FLUID;
+ return part->type == PART_FLUID;
}
static void rna_ParticleSettings_use_clump_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ParticleSettings *part = ptr->data;
+ ParticleSettings *part = ptr->data;
- if (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) {
- if (!part->clumpcurve) {
- BKE_particlesettings_clump_curve_init(part);
- }
- }
+ if (part->child_flag & PART_CHILD_USE_CLUMP_CURVE) {
+ if (!part->clumpcurve) {
+ BKE_particlesettings_clump_curve_init(part);
+ }
+ }
- rna_Particle_redo_child(bmain, scene, ptr);
+ rna_Particle_redo_child(bmain, scene, ptr);
}
-static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_ParticleSettings_use_roughness_curve_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *ptr)
{
- ParticleSettings *part = ptr->data;
+ ParticleSettings *part = ptr->data;
- if (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) {
- if (!part->roughcurve) {
- BKE_particlesettings_rough_curve_init(part);
- }
- }
+ if (part->child_flag & PART_CHILD_USE_ROUGH_CURVE) {
+ if (!part->roughcurve) {
+ BKE_particlesettings_rough_curve_init(part);
+ }
+ }
- rna_Particle_redo_child(bmain, scene, ptr);
+ rna_Particle_redo_child(bmain, scene, ptr);
}
static void rna_ParticleSettings_use_twist_curve_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ParticleSettings *part = ptr->data;
+ ParticleSettings *part = ptr->data;
- if (part->child_flag & PART_CHILD_USE_TWIST_CURVE) {
- if (!part->twistcurve) {
- BKE_particlesettings_twist_curve_init(part);
- }
- }
+ if (part->child_flag & PART_CHILD_USE_TWIST_CURVE) {
+ if (!part->twistcurve) {
+ BKE_particlesettings_twist_curve_init(part);
+ }
+ }
- rna_Particle_redo_child(bmain, scene, ptr);
+ rna_Particle_redo_child(bmain, scene, ptr);
}
static void rna_ParticleSystem_name_set(PointerRNA *ptr, const char *value)
{
- Object *ob = ptr->id.data;
- ParticleSystem *part = (ParticleSystem *)ptr->data;
+ Object *ob = ptr->id.data;
+ ParticleSystem *part = (ParticleSystem *)ptr->data;
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(part->name, value, sizeof(part->name));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(part->name, value, sizeof(part->name));
- BLI_uniquename(&ob->particlesystem, part, DATA_("ParticleSystem"), '.', offsetof(ParticleSystem, name),
- sizeof(part->name));
+ BLI_uniquename(&ob->particlesystem,
+ part,
+ DATA_("ParticleSystem"),
+ '.',
+ offsetof(ParticleSystem, name),
+ sizeof(part->name));
}
static PointerRNA rna_ParticleSystem_active_particle_target_get(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- ParticleTarget *pt = psys->targets.first;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleTarget *pt = psys->targets.first;
- for (; pt; pt = pt->next) {
- if (pt->flag & PTARGET_CURRENT)
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
- }
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
+ for (; pt; pt = pt->next) {
+ if (pt->flag & PTARGET_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, pt);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
}
-static void rna_ParticleSystem_active_particle_target_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_ParticleSystem_active_particle_target_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&psys->targets) - 1);
}
static int rna_ParticleSystem_active_particle_target_index_get(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- ParticleTarget *pt = psys->targets.first;
- int i = 0;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleTarget *pt = psys->targets.first;
+ int i = 0;
- for (; pt; pt = pt->next, i++)
- if (pt->flag & PTARGET_CURRENT)
- return i;
+ for (; pt; pt = pt->next, i++)
+ if (pt->flag & PTARGET_CURRENT)
+ return i;
- return 0;
+ return 0;
}
static void rna_ParticleSystem_active_particle_target_index_set(struct PointerRNA *ptr, int value)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- ParticleTarget *pt = psys->targets.first;
- int i = 0;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleTarget *pt = psys->targets.first;
+ int i = 0;
- for (; pt; pt = pt->next, i++) {
- if (i == value)
- pt->flag |= PTARGET_CURRENT;
- else
- pt->flag &= ~PTARGET_CURRENT;
- }
+ for (; pt; pt = pt->next, i++) {
+ if (i == value)
+ pt->flag |= PTARGET_CURRENT;
+ else
+ pt->flag &= ~PTARGET_CURRENT;
+ }
}
static void rna_ParticleTarget_name_get(PointerRNA *ptr, char *str)
{
- ParticleTarget *pt = ptr->data;
+ ParticleTarget *pt = ptr->data;
- if (pt->flag & PTARGET_VALID) {
- ParticleSystem *psys = NULL;
+ if (pt->flag & PTARGET_VALID) {
+ ParticleSystem *psys = NULL;
- if (pt->ob)
- psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
- else {
- Object *ob = (Object *) ptr->id.data;
- psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
- }
+ if (pt->ob)
+ psys = BLI_findlink(&pt->ob->particlesystem, pt->psys - 1);
+ else {
+ Object *ob = (Object *)ptr->id.data;
+ psys = BLI_findlink(&ob->particlesystem, pt->psys - 1);
+ }
- if (psys) {
- if (pt->ob)
- sprintf(str, "%s: %s", pt->ob->id.name + 2, psys->name);
- else
- strcpy(str, psys->name);
- }
- else
- strcpy(str, "Invalid target!");
- }
- else
- strcpy(str, "Invalid target!");
+ if (psys) {
+ if (pt->ob)
+ sprintf(str, "%s: %s", pt->ob->id.name + 2, psys->name);
+ else
+ strcpy(str, psys->name);
+ }
+ else
+ strcpy(str, "Invalid target!");
+ }
+ else
+ strcpy(str, "Invalid target!");
}
static int rna_ParticleTarget_name_length(PointerRNA *ptr)
{
- char tstr[MAX_ID_NAME + MAX_ID_NAME + 64];
+ char tstr[MAX_ID_NAME + MAX_ID_NAME + 64];
- rna_ParticleTarget_name_get(ptr, tstr);
+ rna_ParticleTarget_name_get(ptr, tstr);
- return strlen(tstr);
+ return strlen(tstr);
}
static int particle_id_check(PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- return (GS(id->name) == ID_PA);
+ return (GS(id->name) == ID_PA);
}
static char *rna_SPHFluidSettings_path(PointerRNA *ptr)
{
- SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
+ SPHFluidSettings *fluid = (SPHFluidSettings *)ptr->data;
- if (particle_id_check(ptr)) {
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ if (particle_id_check(ptr)) {
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- if (part->fluid == fluid) {
- return BLI_strdup("fluid");
- }
- }
- return NULL;
+ if (part->fluid == fluid) {
+ return BLI_strdup("fluid");
+ }
+ }
+ return NULL;
}
static bool rna_ParticleSystem_multiple_caches_get(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- return (psys->ptcaches.first != psys->ptcaches.last);
+ return (psys->ptcaches.first != psys->ptcaches.last);
}
static bool rna_ParticleSystem_editable_get(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- return psys_check_edited(psys);
+ return psys_check_edited(psys);
}
static bool rna_ParticleSystem_edited_get(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- if (psys->part && psys->part->type == PART_HAIR)
- return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
- else
- return (psys->pointcache->edit && psys->pointcache->edit->edited);
+ if (psys->part && psys->part->type == PART_HAIR)
+ return (psys->flag & PSYS_EDITED || (psys->edit && psys->edit->edited));
+ else
+ return (psys->pointcache->edit && psys->pointcache->edit->edited);
}
static PointerRNA rna_ParticleDupliWeight_active_get(PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- ParticleDupliWeight *dw = part->instance_weights.first;
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleDupliWeight *dw = part->instance_weights.first;
- for (; dw; dw = dw->next) {
- if (dw->flag & PART_DUPLIW_CURRENT)
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
- }
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
+ for (; dw; dw = dw->next) {
+ if (dw->flag & PART_DUPLIW_CURRENT)
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleDupliWeight, dw);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleTarget, NULL);
}
-static void rna_ParticleDupliWeight_active_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_ParticleDupliWeight_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&part->instance_weights) - 1);
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&part->instance_weights) - 1);
}
static int rna_ParticleDupliWeight_active_index_get(PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- ParticleDupliWeight *dw = part->instance_weights.first;
- int i = 0;
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleDupliWeight *dw = part->instance_weights.first;
+ int i = 0;
- for (; dw; dw = dw->next, i++)
- if (dw->flag & PART_DUPLIW_CURRENT)
- return i;
+ for (; dw; dw = dw->next, i++)
+ if (dw->flag & PART_DUPLIW_CURRENT)
+ return i;
- return 0;
+ return 0;
}
static void rna_ParticleDupliWeight_active_index_set(struct PointerRNA *ptr, int value)
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- ParticleDupliWeight *dw = part->instance_weights.first;
- int i = 0;
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleDupliWeight *dw = part->instance_weights.first;
+ int i = 0;
- for (; dw; dw = dw->next, i++) {
- if (i == value)
- dw->flag |= PART_DUPLIW_CURRENT;
- else
- dw->flag &= ~PART_DUPLIW_CURRENT;
- }
+ for (; dw; dw = dw->next, i++) {
+ if (i == value)
+ dw->flag |= PART_DUPLIW_CURRENT;
+ else
+ dw->flag &= ~PART_DUPLIW_CURRENT;
+ }
}
static void rna_ParticleDupliWeight_name_get(PointerRNA *ptr, char *str)
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- psys_find_group_weights(part);
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ psys_find_group_weights(part);
- ParticleDupliWeight *dw = ptr->data;
+ ParticleDupliWeight *dw = ptr->data;
- if (dw->ob)
- sprintf(str, "%s: %i", dw->ob->id.name + 2, dw->count);
- else
- strcpy(str, "No object");
+ if (dw->ob)
+ sprintf(str, "%s: %i", dw->ob->id.name + 2, dw->count);
+ else
+ strcpy(str, "No object");
}
static int rna_ParticleDupliWeight_name_length(PointerRNA *ptr)
{
- char tstr[MAX_ID_NAME + 64];
+ char tstr[MAX_ID_NAME + 64];
- rna_ParticleDupliWeight_name_get(ptr, tstr);
+ rna_ParticleDupliWeight_name_get(ptr, tstr);
- return strlen(tstr);
+ return strlen(tstr);
}
-static const EnumPropertyItem *rna_Particle_from_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- /*if (part->type==PART_REACTOR) */
- /* return part_reactor_from_items; */
- /*else */
- return part_from_items;
+ /*if (part->type==PART_REACTOR) */
+ /* return part_reactor_from_items; */
+ /*else */
+ return part_from_items;
}
-static const EnumPropertyItem *rna_Particle_dist_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Particle_dist_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- ParticleSettings *part = ptr->id.data;
+ ParticleSettings *part = ptr->id.data;
- if (part->type == PART_HAIR)
- return part_hair_dist_items;
- else
- return part_dist_items;
+ if (part->type == PART_HAIR)
+ return part_hair_dist_items;
+ else
+ return part_dist_items;
}
-static const EnumPropertyItem *rna_Particle_draw_as_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Particle_draw_as_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- ParticleSettings *part = ptr->id.data;
+ ParticleSettings *part = ptr->id.data;
- if (part->type == PART_HAIR)
- return part_hair_draw_as_items;
- else
- return part_draw_as_items;
+ if (part->type == PART_HAIR)
+ return part_hair_draw_as_items;
+ else
+ return part_draw_as_items;
}
-static const EnumPropertyItem *rna_Particle_ren_as_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_Particle_ren_as_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- ParticleSettings *part = ptr->id.data;
+ ParticleSettings *part = ptr->id.data;
- if (part->type == PART_HAIR)
- return part_hair_ren_as_items;
- else
- return part_ren_as_items;
+ if (part->type == PART_HAIR)
+ return part_hair_ren_as_items;
+ else
+ return part_ren_as_items;
}
static PointerRNA rna_Particle_field1_get(PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- /* weak */
- if (!part->pd)
- part->pd = BKE_partdeflect_new(0);
+ /* weak */
+ if (!part->pd)
+ part->pd = BKE_partdeflect_new(0);
- return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
+ return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd);
}
static PointerRNA rna_Particle_field2_get(PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->id.data;
+ ParticleSettings *part = (ParticleSettings *)ptr->id.data;
- /* weak */
- if (!part->pd2)
- part->pd2 = BKE_partdeflect_new(0);
+ /* weak */
+ if (!part->pd2)
+ part->pd2 = BKE_partdeflect_new(0);
- return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
+ return rna_pointer_inherit_refine(ptr, &RNA_FieldSettings, part->pd2);
}
static void psys_vg_name_get__internal(PointerRNA *ptr, char *value, int index)
{
- Object *ob = ptr->id.data;
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- if (psys->vgroup[index] > 0) {
- bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
+ if (psys->vgroup[index] > 0) {
+ bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
- if (defGroup) {
- strcpy(value, defGroup->name);
- return;
- }
- }
+ if (defGroup) {
+ strcpy(value, defGroup->name);
+ return;
+ }
+ }
- value[0] = '\0';
+ value[0] = '\0';
}
static int psys_vg_name_len__internal(PointerRNA *ptr, int index)
{
- Object *ob = ptr->id.data;
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- if (psys->vgroup[index] > 0) {
- bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
+ if (psys->vgroup[index] > 0) {
+ bDeformGroup *defGroup = BLI_findlink(&ob->defbase, psys->vgroup[index] - 1);
- if (defGroup) {
- return strlen(defGroup->name);
- }
- }
- return 0;
+ if (defGroup) {
+ return strlen(defGroup->name);
+ }
+ }
+ return 0;
}
static void psys_vg_name_set__internal(PointerRNA *ptr, const char *value, int index)
{
- Object *ob = ptr->id.data;
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ Object *ob = ptr->id.data;
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
- if (value[0] == '\0') {
- psys->vgroup[index] = 0;
- }
- else {
- int defgrp_index = defgroup_name_index(ob, value);
+ if (value[0] == '\0') {
+ psys->vgroup[index] = 0;
+ }
+ else {
+ int defgrp_index = defgroup_name_index(ob, value);
- if (defgrp_index == -1)
- return;
+ if (defgrp_index == -1)
+ return;
- psys->vgroup[index] = defgrp_index + 1;
- }
+ psys->vgroup[index] = defgrp_index + 1;
+ }
}
static char *rna_ParticleSystem_path(PointerRNA *ptr)
{
- ParticleSystem *psys = (ParticleSystem *)ptr->data;
- char name_esc[sizeof(psys->name) * 2];
+ ParticleSystem *psys = (ParticleSystem *)ptr->data;
+ char name_esc[sizeof(psys->name) * 2];
- BLI_strescape(name_esc, psys->name, sizeof(name_esc));
- return BLI_sprintfN("particle_systems[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, psys->name, sizeof(name_esc));
+ return BLI_sprintfN("particle_systems[\"%s\"]", name_esc);
}
static void rna_ParticleSettings_mtex_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->data;
- rna_iterator_array_begin(iter, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+ rna_iterator_array_begin(iter, (void *)part->mtex, sizeof(MTex *), MAX_MTEX, 0, NULL);
}
static PointerRNA rna_ParticleSettings_active_texture_get(PointerRNA *ptr)
{
- ParticleSettings *part = (ParticleSettings *)ptr->data;
- Tex *tex;
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
+ Tex *tex;
- tex = give_current_particle_texture(part);
- return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
+ tex = give_current_particle_texture(part);
+ return rna_pointer_inherit_refine(ptr, &RNA_Texture, tex);
}
static void rna_ParticleSettings_active_texture_set(PointerRNA *ptr, PointerRNA value)
{
- ParticleSettings *part = (ParticleSettings *)ptr->data;
+ ParticleSettings *part = (ParticleSettings *)ptr->data;
- set_current_particle_texture(part, value.data);
+ set_current_particle_texture(part, value.data);
}
/* irritating string functions for each index :/ */
-static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 0); }
-static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 1); }
-static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 2); }
-static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 3); }
-static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 4); }
-static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 5); }
-static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 6); }
-static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 7); }
-static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 8); }
-static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 9); }
-static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 10); }
-static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 11); }
-static void rna_ParticleVGroup_name_get_12(PointerRNA *ptr, char *value) { psys_vg_name_get__internal(ptr, value, 12); }
-
-static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 0); }
-static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 1); }
-static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 2); }
-static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 3); }
-static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 4); }
-static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 5); }
-static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 6); }
-static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 7); }
-static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 8); }
-static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 9); }
-static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 10); }
-static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 11); }
-static int rna_ParticleVGroup_name_len_12(PointerRNA *ptr) { return psys_vg_name_len__internal(ptr, 12); }
-
-static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 0); }
-static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 1); }
-static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 2); }
-static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 3); }
-static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 4); }
-static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 5); }
-static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 6); }
-static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 7); }
-static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 8); }
-static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 9); }
-static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 10); }
-static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 11); }
-static void rna_ParticleVGroup_name_set_12(PointerRNA *ptr, const char *value) { psys_vg_name_set__internal(ptr, value, 12); }
+static void rna_ParticleVGroup_name_get_0(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 0);
+}
+static void rna_ParticleVGroup_name_get_1(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 1);
+}
+static void rna_ParticleVGroup_name_get_2(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 2);
+}
+static void rna_ParticleVGroup_name_get_3(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 3);
+}
+static void rna_ParticleVGroup_name_get_4(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 4);
+}
+static void rna_ParticleVGroup_name_get_5(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 5);
+}
+static void rna_ParticleVGroup_name_get_6(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 6);
+}
+static void rna_ParticleVGroup_name_get_7(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 7);
+}
+static void rna_ParticleVGroup_name_get_8(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 8);
+}
+static void rna_ParticleVGroup_name_get_9(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 9);
+}
+static void rna_ParticleVGroup_name_get_10(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 10);
+}
+static void rna_ParticleVGroup_name_get_11(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 11);
+}
+static void rna_ParticleVGroup_name_get_12(PointerRNA *ptr, char *value)
+{
+ psys_vg_name_get__internal(ptr, value, 12);
+}
+static int rna_ParticleVGroup_name_len_0(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 0);
+}
+static int rna_ParticleVGroup_name_len_1(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 1);
+}
+static int rna_ParticleVGroup_name_len_2(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 2);
+}
+static int rna_ParticleVGroup_name_len_3(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 3);
+}
+static int rna_ParticleVGroup_name_len_4(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 4);
+}
+static int rna_ParticleVGroup_name_len_5(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 5);
+}
+static int rna_ParticleVGroup_name_len_6(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 6);
+}
+static int rna_ParticleVGroup_name_len_7(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 7);
+}
+static int rna_ParticleVGroup_name_len_8(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 8);
+}
+static int rna_ParticleVGroup_name_len_9(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 9);
+}
+static int rna_ParticleVGroup_name_len_10(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 10);
+}
+static int rna_ParticleVGroup_name_len_11(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 11);
+}
+static int rna_ParticleVGroup_name_len_12(PointerRNA *ptr)
+{
+ return psys_vg_name_len__internal(ptr, 12);
+}
+
+static void rna_ParticleVGroup_name_set_0(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 0);
+}
+static void rna_ParticleVGroup_name_set_1(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 1);
+}
+static void rna_ParticleVGroup_name_set_2(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 2);
+}
+static void rna_ParticleVGroup_name_set_3(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 3);
+}
+static void rna_ParticleVGroup_name_set_4(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 4);
+}
+static void rna_ParticleVGroup_name_set_5(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 5);
+}
+static void rna_ParticleVGroup_name_set_6(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 6);
+}
+static void rna_ParticleVGroup_name_set_7(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 7);
+}
+static void rna_ParticleVGroup_name_set_8(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 8);
+}
+static void rna_ParticleVGroup_name_set_9(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 9);
+}
+static void rna_ParticleVGroup_name_set_10(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 10);
+}
+static void rna_ParticleVGroup_name_set_11(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 11);
+}
+static void rna_ParticleVGroup_name_set_12(PointerRNA *ptr, const char *value)
+{
+ psys_vg_name_set__internal(ptr, value, 12);
+}
#else
static void rna_def_particle_hair_key(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
- RNA_def_struct_sdna(srna, "HairKey");
- RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
-
- prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
-
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Location (Object Space)", "Location of the hair key in object space");
- RNA_def_property_float_funcs(prop, "rna_ParticleHairKey_location_object_get",
- "rna_ParticleHairKey_location_object_set", NULL);
-
- prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "co");
- RNA_def_property_ui_text(prop, "Location",
- "Location of the hair key in its local coordinate system, "
- "relative to the emitting face");
-
- /* Aided co func */
- func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
- RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
- parm = RNA_def_pointer(func, "object", "Object", "", "Object");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co",
- "Exported hairkey location", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "ParticleHairKey", NULL);
+ RNA_def_struct_sdna(srna, "HairKey");
+ RNA_def_struct_ui_text(srna, "Particle Hair Key", "Particle key for hair particle system");
+
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Time", "Relative time of key over hair length");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Weight", "Weight for cloth simulation");
+
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Location (Object Space)", "Location of the hair key in object space");
+ RNA_def_property_float_funcs(prop,
+ "rna_ParticleHairKey_location_object_get",
+ "rna_ParticleHairKey_location_object_set",
+ NULL);
+
+ prop = RNA_def_property(srna, "co_local", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "co");
+ RNA_def_property_ui_text(prop,
+ "Location",
+ "Location of the hair key in its local coordinate system, "
+ "relative to the emitting face");
+
+ /* Aided co func */
+ func = RNA_def_function(srna, "co_object", "rna_ParticleHairKey_co_object");
+ RNA_def_function_ui_description(func, "Obtain hairkey location with particle and modifier data");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "particle", "Particle", "", "hair particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_float_vector(
+ func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
static void rna_def_particle_key(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ParticleKey", NULL);
- RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
+ srna = RNA_def_struct(brna, "ParticleKey", NULL);
+ RNA_def_struct_ui_text(srna, "Particle Key", "Key location for a particle over time");
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "co");
- RNA_def_property_ui_text(prop, "Location", "Key location");
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "co");
+ RNA_def_property_ui_text(prop, "Location", "Key location");
- prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "vel");
- RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
+ prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "vel");
+ RNA_def_property_ui_text(prop, "Velocity", "Key velocity");
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "Key rotation quaternion");
- prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "ave");
- RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
+ prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "ave");
+ RNA_def_property_ui_text(prop, "Angular Velocity", "Key angular velocity");
- prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Time", "Time of key over the simulation");
}
static void rna_def_child_particle(BlenderRNA *brna)
{
- StructRNA *srna;
- /*PropertyRNA *prop; */
+ StructRNA *srna;
+ /*PropertyRNA *prop; */
- srna = RNA_def_struct(brna, "ChildParticle", NULL);
- RNA_def_struct_ui_text(srna, "Child Particle",
- "Child particle interpolated from simulated or edited particles");
+ srna = RNA_def_struct(brna, "ChildParticle", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Child Particle", "Child particle interpolated from simulated or edited particles");
-/* int num, parent; *//* num is face index on the final derived mesh */
+ /* int num, parent; */ /* num is face index on the final derived mesh */
-/* int pa[4]; *//* nearest particles to the child, used for the interpolation */
-/* float w[4]; *//* interpolation weights for the above particles */
-/* float fuv[4], foffset; *//* face vertex weights and offset */
-/* float rand[3]; */
+ /* int pa[4]; */ /* nearest particles to the child, used for the interpolation */
+ /* float w[4]; */ /* interpolation weights for the above particles */
+ /* float fuv[4], foffset; */ /* face vertex weights and offset */
+ /* float rand[3]; */
}
static void rna_def_particle(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem alive_items[] = {
- /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
- {PARS_DEAD, "DEAD", 0, "Dead", ""},
- {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
- {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
- {PARS_DYING, "DYING", 0, "Dying", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Particle", NULL);
- RNA_def_struct_sdna(srna, "ParticleData");
- RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
-
- /* Particle State & Previous State */
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "state.co");
- RNA_def_property_ui_text(prop, "Particle Location", "");
-
- prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "state.vel");
- RNA_def_property_ui_text(prop, "Particle Velocity", "");
-
- prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "state.ave");
- RNA_def_property_ui_text(prop, "Angular Velocity", "");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "state.rot");
- RNA_def_property_ui_text(prop, "Rotation", "");
-
- prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
- RNA_def_property_ui_text(prop, "Previous Particle Location", "");
-
- prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
- RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
-
- prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
- RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
-
- prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
- RNA_def_property_ui_text(prop, "Previous Rotation", "");
-
- /* Hair & Keyed Keys */
-
- prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
- RNA_def_property_struct_type(prop, "ParticleHairKey");
- RNA_def_property_ui_text(prop, "Hair", "");
-
- prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
- RNA_def_property_struct_type(prop, "ParticleKey");
- RNA_def_property_ui_text(prop, "Keyed States", "");
-/* */
-/* float fuv[4], foffset; *//* coordinates on face/edge number "num" and depth along*/
-/* *//* face normal for volume emission */
-
- prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "time");
-/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
- RNA_def_property_ui_text(prop, "Birth Time", "");
-
- prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
-/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
- RNA_def_property_ui_text(prop, "Lifetime", "");
-
- prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "dietime");
-/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
- RNA_def_property_ui_text(prop, "Die Time", "");
-
- prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
-/* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
- RNA_def_property_ui_text(prop, "Size", "");
-
-/* */
-/* int num; *//* index to vert/edge/face */
-/* int num_dmcache; *//* index to derived mesh data (face) to avoid slow lookups */
-/* int pad; */
-/* */
-/* int totkey; */
-
- /* flag */
- prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Exists", "");
-
- prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Visible", "");
-
- prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "alive");
- RNA_def_property_enum_items(prop, alive_items);
- RNA_def_property_ui_text(prop, "Alive State", "");
-
-/* short rt2; */
-
-/* UVs */
- func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
- RNA_def_function_ui_description(func, "Obtain uv for particle on derived mesh");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_array(parm, 2);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem alive_items[] = {
+ /*{PARS_KILLED, "KILLED", 0, "Killed", ""}, */
+ {PARS_DEAD, "DEAD", 0, "Dead", ""},
+ {PARS_UNBORN, "UNBORN", 0, "Unborn", ""},
+ {PARS_ALIVE, "ALIVE", 0, "Alive", ""},
+ {PARS_DYING, "DYING", 0, "Dying", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Particle", NULL);
+ RNA_def_struct_sdna(srna, "ParticleData");
+ RNA_def_struct_ui_text(srna, "Particle", "Particle in a particle system");
+
+ /* Particle State & Previous State */
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "state.co");
+ RNA_def_property_ui_text(prop, "Particle Location", "");
+
+ prop = RNA_def_property(srna, "velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "state.vel");
+ RNA_def_property_ui_text(prop, "Particle Velocity", "");
+
+ prop = RNA_def_property(srna, "angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "state.ave");
+ RNA_def_property_ui_text(prop, "Angular Velocity", "");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "state.rot");
+ RNA_def_property_ui_text(prop, "Rotation", "");
+
+ prop = RNA_def_property(srna, "prev_location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.co");
+ RNA_def_property_ui_text(prop, "Previous Particle Location", "");
+
+ prop = RNA_def_property(srna, "prev_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.vel");
+ RNA_def_property_ui_text(prop, "Previous Particle Velocity", "");
+
+ prop = RNA_def_property(srna, "prev_angular_velocity", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.ave");
+ RNA_def_property_ui_text(prop, "Previous Angular Velocity", "");
+
+ prop = RNA_def_property(srna, "prev_rotation", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "prev_state.rot");
+ RNA_def_property_ui_text(prop, "Previous Rotation", "");
+
+ /* Hair & Keyed Keys */
+
+ prop = RNA_def_property(srna, "hair_keys", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "hair", "totkey");
+ RNA_def_property_struct_type(prop, "ParticleHairKey");
+ RNA_def_property_ui_text(prop, "Hair", "");
+
+ prop = RNA_def_property(srna, "particle_keys", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "keys", "totkey");
+ RNA_def_property_struct_type(prop, "ParticleKey");
+ RNA_def_property_ui_text(prop, "Keyed States", "");
+ /* */
+ /* float fuv[4], foffset; */ /* coordinates on face/edge number "num" and depth along*/
+ /* */ /* face normal for volume emission */
+
+ prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "time");
+ /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Birth Time", "");
+
+ prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+ /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Lifetime", "");
+
+ prop = RNA_def_property(srna, "die_time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "dietime");
+ /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Die Time", "");
+
+ prop = RNA_def_property(srna, "size", PROP_FLOAT, PROP_NONE);
+ /* RNA_def_property_range(prop, lowerLimitf, upperLimitf); */
+ RNA_def_property_ui_text(prop, "Size", "");
+
+ /* */
+ /* int num; */ /* index to vert/edge/face */
+ /* int num_dmcache; */ /* index to derived mesh data (face) to avoid slow lookups */
+ /* int pad; */
+ /* */
+ /* int totkey; */
+
+ /* flag */
+ prop = RNA_def_property(srna, "is_exist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_UNEXIST);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Exists", "");
+
+ prop = RNA_def_property(srna, "is_visible", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PARS_NO_DISP);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Visible", "");
+
+ prop = RNA_def_property(srna, "alive_state", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "alive");
+ RNA_def_property_enum_items(prop, alive_items);
+ RNA_def_property_ui_text(prop, "Alive State", "");
+
+ /* short rt2; */
+
+ /* UVs */
+ func = RNA_def_function(srna, "uv_on_emitter", "rna_Particle_uv_on_emitter");
+ RNA_def_function_ui_description(func, "Obtain uv for particle on derived mesh");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_array(parm, 2);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
static void rna_def_particle_dupliweight(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
- RNA_def_struct_ui_text(srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a collection");
- RNA_def_struct_sdna(srna, "ParticleDupliWeight");
+ srna = RNA_def_struct(brna, "ParticleDupliWeight", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Particle Dupliobject Weight", "Weight of a particle dupliobject in a collection");
+ RNA_def_struct_sdna(srna, "ParticleDupliWeight");
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleDupliWeight_name_get",
- "rna_ParticleDupliWeight_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_ParticleDupliWeight_name_get", "rna_ParticleDupliWeight_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Particle dupliobject name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
- prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Count",
- "The number of times this object is repeated with respect to other objects");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Count", "The number of times this object is repeated with respect to other objects");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
}
static void rna_def_fluid_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem sph_solver_items[] = {
- {SPH_SOLVER_DDR, "DDR", 0, "Double-Density", "An artistic solver with strong surface tension effects (original)"},
- {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
- RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
-
- /* Fluid settings */
- prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "solver");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, sph_solver_items);
- RNA_def_property_ui_text(prop, "SPH Solver", "The code used to calculate internal forces on particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_k");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
- RNA_def_property_ui_text(prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
- RNA_def_property_ui_text(prop, "Initial Rest Length",
- "Use the initial length as spring rest length instead of 2 * particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Plasticity",
- "How much the spring rest length can change after the elastic limit is crossed");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Elastic Limit",
- "How much the spring has to be stretched/compressed in order to change it's rest length");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Spring Frames",
- "Create springs for this number of frames since particles birth (0 is always)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* Viscosity */
- prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* Double density relaxation */
- prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Repulsion Factor",
- "How strongly the fluid tries to keep from clustering (factor of stiffness)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rest_density");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* Buoyancy */
- prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "buoyancy");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Buoyancy",
- "Artificial buoyancy force in negative gravity direction based on pressure "
- "differences inside the fluid");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* Factor flags */
-
- prop = RNA_def_property(srna, "use_factor_repulsion", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
- RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
- RNA_def_property_ui_text(prop, "Factor Density",
- "Density is calculated as a factor of default density (depends on particle size)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_factor_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
- RNA_def_property_ui_text(prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
- RNA_def_property_ui_text(prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_factor_rest_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
- RNA_def_property_ui_text(prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem sph_solver_items[] = {
+ {SPH_SOLVER_DDR,
+ "DDR",
+ 0,
+ "Double-Density",
+ "An artistic solver with strong surface tension effects (original)"},
+ {SPH_SOLVER_CLASSICAL, "CLASSICAL", 0, "Classical", "A more physically-accurate solver"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SPHFluidSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_SPHFluidSettings_path");
+ RNA_def_struct_ui_text(srna, "SPH Fluid Settings", "Settings for particle fluids physics");
+
+ /* Fluid settings */
+ prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "solver");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, sph_solver_items);
+ RNA_def_property_ui_text(
+ prop, "SPH Solver", "The code used to calculate internal forces on particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "spring_force", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_k");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Spring Force", "Spring force");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "fluid_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Interaction Radius", "Fluid interaction radius");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "rest_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Rest Length", "Spring rest length (factor of particle radius)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_viscoelastic_springs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_VISCOELASTIC_SPRINGS);
+ RNA_def_property_ui_text(
+ prop, "Viscoelastic Springs", "Use viscoelastic springs instead of Hooke's springs");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_initial_rest_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_CURRENT_REST_LENGTH);
+ RNA_def_property_ui_text(
+ prop,
+ "Initial Rest Length",
+ "Use the initial length as spring rest length instead of 2 * particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "plasticity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "plasticity_constant");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Plasticity",
+ "How much the spring rest length can change after the elastic limit is crossed");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "yield_ratio", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "yield_ratio");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Elastic Limit",
+ "How much the spring has to be stretched/compressed in order to change it's rest length");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "spring_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Spring Frames",
+ "Create springs for this number of frames since particles birth (0 is always)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Viscosity */
+ prop = RNA_def_property(srna, "linear_viscosity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "viscosity_omega");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Viscosity", "Linear viscosity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "stiff_viscosity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "viscosity_beta");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Stiff viscosity", "Creates viscosity for expanding fluid");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Double density relaxation */
+ prop = RNA_def_property(srna, "stiffness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness_k");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Stiffness", "How incompressible the fluid is (speed of sound)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "repulsion", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness_knear");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Repulsion Factor",
+ "How strongly the fluid tries to keep from clustering (factor of stiffness)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "rest_density", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rest_density");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Rest Density", "Fluid rest density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Buoyancy */
+ prop = RNA_def_property(srna, "buoyancy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "buoyancy");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Buoyancy",
+ "Artificial buoyancy force in negative gravity direction based on pressure "
+ "differences inside the fluid");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* Factor flags */
+
+ prop = RNA_def_property(srna, "use_factor_repulsion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REPULSION);
+ RNA_def_property_ui_text(prop, "Factor Repulsion", "Repulsion is a factor of stiffness");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_factor_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_DENSITY);
+ RNA_def_property_ui_text(
+ prop,
+ "Factor Density",
+ "Density is calculated as a factor of default density (depends on particle size)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_factor_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_RADIUS);
+ RNA_def_property_ui_text(
+ prop, "Factor Radius", "Interaction radius is a factor of 4 * particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_factor_stiff_viscosity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_VISCOSITY);
+ RNA_def_property_ui_text(
+ prop, "Factor Stiff Viscosity", "Stiff viscosity is a factor of normal viscosity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_factor_rest_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPH_FAC_REST_LENGTH);
+ RNA_def_property_ui_text(
+ prop, "Factor Rest Length", "Spring rest length is a factor of 2 * particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
}
static void rna_def_particle_settings_mtex(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem texco_items[] = {
- {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
- {TEXCO_OBJECT, "OBJECT", 0, "Object", "Use linked object's coordinates for texture coordinates"},
- {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
- {TEXCO_ORCO, "ORCO", 0, "Generated", "Use the original undeformed coordinates of the object"},
- {TEXCO_STRAND, "STRAND", 0, "Strand / Particle",
- "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_mapping_items[] = {
- {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
- {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
- {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
- {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_x_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_y_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_z_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
- RNA_def_struct_sdna(srna, "MTex");
- RNA_def_struct_ui_text(srna, "Particle Settings Texture Slot",
- "Texture slot for textures in a Particle Settings data-block");
-
- prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texco");
- RNA_def_property_enum_items(prop, texco_items);
- RNA_def_property_ui_text(prop, "Texture Coordinates",
- "Texture coordinates used to map the texture onto the background");
- RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "object");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object", "Object to use for mapping with Object texture coordinates");
- RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvname");
- RNA_def_property_ui_text(prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projx");
- RNA_def_property_enum_items(prop, prop_x_mapping_items);
- RNA_def_property_ui_text(prop, "X Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projy");
- RNA_def_property_enum_items(prop, prop_y_mapping_items);
- RNA_def_property_ui_text(prop, "Y Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projz");
- RNA_def_property_enum_items(prop, prop_z_mapping_items);
- RNA_def_property_ui_text(prop, "Z Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mapping_items);
- RNA_def_property_ui_text(prop, "Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* map to */
- prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
- RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
- RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
- RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
- RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
- RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
- RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
- RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
- RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
- RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_AMP);
- RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_FREQ);
- RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
- RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
- RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_map_twist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TWIST);
- RNA_def_property_ui_text(prop, "Twist", "Affect the child twist");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* influence factors */
- prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "timefac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Emission Time Factor", "Amount texture affects particle emission time");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "lifefac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "padensfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sizefac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ivelfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Velocity Factor", "Amount texture affects particle initial velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
-
- prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fieldfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "gravityfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dampfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
-
- prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "lengthfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clumpfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "kinkampfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "kinkfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "roughfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "twist_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "twistfac");
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Twist Factor", "Amount texture affects child twist");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem texco_items[] = {
+ {TEXCO_GLOB, "GLOBAL", 0, "Global", "Use global coordinates for the texture coordinates"},
+ {TEXCO_OBJECT,
+ "OBJECT",
+ 0,
+ "Object",
+ "Use linked object's coordinates for texture coordinates"},
+ {TEXCO_UV, "UV", 0, "UV", "Use UV coordinates for texture coordinates"},
+ {TEXCO_ORCO,
+ "ORCO",
+ 0,
+ "Generated",
+ "Use the original undeformed coordinates of the object"},
+ {TEXCO_STRAND,
+ "STRAND",
+ 0,
+ "Strand / Particle",
+ "Use normalized strand texture coordinate (1D) or particle age (X) and trail position (Y)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_mapping_items[] = {
+ {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
+ {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
+ {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
+ {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_x_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_y_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_z_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ParticleSettingsTextureSlot", "TextureSlot");
+ RNA_def_struct_sdna(srna, "MTex");
+ RNA_def_struct_ui_text(srna,
+ "Particle Settings Texture Slot",
+ "Texture slot for textures in a Particle Settings data-block");
+
+ prop = RNA_def_property(srna, "texture_coords", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texco");
+ RNA_def_property_enum_items(prop, texco_items);
+ RNA_def_property_ui_text(prop,
+ "Texture Coordinates",
+ "Texture coordinates used to map the texture onto the background");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "object");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Object", "Object to use for mapping with Object texture coordinates");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvname");
+ RNA_def_property_ui_text(
+ prop, "UV Map", "UV map to use for mapping with UV texture coordinates");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projx");
+ RNA_def_property_enum_items(prop, prop_x_mapping_items);
+ RNA_def_property_ui_text(prop, "X Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projy");
+ RNA_def_property_enum_items(prop, prop_y_mapping_items);
+ RNA_def_property_ui_text(prop, "Y Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projz");
+ RNA_def_property_enum_items(prop, prop_z_mapping_items);
+ RNA_def_property_ui_text(prop, "Z Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* map to */
+ prop = RNA_def_property(srna, "use_map_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TIME);
+ RNA_def_property_ui_text(prop, "Emission Time", "Affect the emission time of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_life", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LIFE);
+ RNA_def_property_ui_text(prop, "Life Time", "Affect the life time of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DENS);
+ RNA_def_property_ui_text(prop, "Density", "Affect the density of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_SIZE);
+ RNA_def_property_ui_text(prop, "Size", "Affect the particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_IVEL);
+ RNA_def_property_ui_text(prop, "Initial Velocity", "Affect the particle initial velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_FIELD);
+ RNA_def_property_ui_text(prop, "Force Field", "Affect the particle force fields");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_gravity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_GRAVITY);
+ RNA_def_property_ui_text(prop, "Gravity", "Affect the particle gravity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_damp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_DAMP);
+ RNA_def_property_ui_text(prop, "Damp", "Affect the particle velocity damping");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_clump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_CLUMP);
+ RNA_def_property_ui_text(prop, "Clump", "Affect the child clumping");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_map_kink_amp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_AMP);
+ RNA_def_property_ui_text(prop, "Kink Amplitude", "Affect the child kink amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_kink_freq", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_KINK_FREQ);
+ RNA_def_property_ui_text(prop, "Kink Frequency", "Affect the child kink frequency");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_rough", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_ROUGH);
+ RNA_def_property_ui_text(prop, "Rough", "Affect the child rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_LENGTH);
+ RNA_def_property_ui_text(prop, "Length", "Affect the child hair length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_map_twist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mapto", PAMAP_TWIST);
+ RNA_def_property_ui_text(prop, "Twist", "Affect the child twist");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* influence factors */
+ prop = RNA_def_property(srna, "time_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "timefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Emission Time Factor", "Amount texture affects particle emission time");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "life_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lifefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Life Time Factor", "Amount texture affects particle life time");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "density_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "padensfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Density Factor", "Amount texture affects particle density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "size_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sizefac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Size Factor", "Amount texture affects physical particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ivelfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Velocity Factor", "Amount texture affects particle initial velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "field_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fieldfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Field Factor", "Amount texture affects particle force fields");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "gravity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gravityfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Gravity Factor", "Amount texture affects particle gravity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "damp_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dampfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Damp Factor", "Amount texture affects particle damping");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "length_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "lengthfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Length Factor", "Amount texture affects child hair length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clumpfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Clump Factor", "Amount texture affects child clump");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_amp_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kinkampfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Kink Amplitude Factor", "Amount texture affects child kink amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_freq_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kinkfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Kink Frequency Factor", "Amount texture affects child kink frequency");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "rough_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "roughfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Rough Factor", "Amount texture affects child roughness");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "twist_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "twistfac");
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(prop, "Twist Factor", "Amount texture affects child twist");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
}
static void rna_def_particle_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem type_items[] = {
- {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
- /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
- {PART_HAIR, "HAIR", 0, "Hair", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem phys_type_items[] = {
- {PART_PHYS_NO, "NO", 0, "None", ""},
- {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
- {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
- {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
- {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem rot_mode_items[] = {
- {0, "NONE", 0, "None", ""},
- {PART_ROT_NOR, "NOR", 0, "Normal", ""},
- {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
- {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
- {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
- {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
- {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
- {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
- {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
- {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem ave_mode_items[] = {
- {0, "NONE", 0, "None", ""},
- {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
- {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
- {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
- {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
- {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
- {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
- {PART_AVE_RAND, "RAND", 0, "Random", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem react_event_items[] = {
- {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
- {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
- {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem child_type_items[] = {
- {0, "NONE", 0, "None", ""},
- {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
- {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /*TODO: names, tooltips */
- static const EnumPropertyItem integrator_type_items[] = {
- {PART_INT_EULER, "EULER", 0, "Euler", ""},
- {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
- {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
- {PART_INT_RK4, "RK4", 0, "RK4", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem kink_type_items[] = {
- {PART_KINK_NO, "NO", 0, "Nothing", ""},
- {PART_KINK_CURL, "CURL", 0, "Curl", ""},
- {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
- {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
- {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
- {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem draw_col_items[] = {
- {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
- {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
- {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
- {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem part_mat_items[] = {
- {0, "DUMMY", 0, "Dummy", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ParticleSettings", "ID");
- RNA_def_struct_ui_text(srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
- RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
-
- rna_def_mtex_common(brna, srna, "rna_ParticleSettings_mtex_begin", "rna_ParticleSettings_active_texture_get",
- "rna_ParticleSettings_active_texture_set", NULL, "ParticleSettingsTextureSlot",
- "ParticleSettingsTextureSlots", "rna_Particle_reset", NULL);
-
- /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
- prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
- RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
-
- /* flag */
- prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_regrow_hair", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
- RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
- RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
- RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Even Distribution",
- "Use even distribution from faces based on face areas or edge lengths");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Die on hit", "Particles die when they collide with a deflector object");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
- RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
- RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
- RNA_def_property_ui_text(prop, "Invert Grid", "Invert what is considered object and what is not");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
- RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
- RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
- RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
- RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
- RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Type", "Particle Type");
- RNA_def_property_update(prop, 0, "rna_Particle_change_type");
-
- prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "from");
- RNA_def_property_enum_items(prop, part_reactor_from_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
- RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "distr");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, part_dist_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
- RNA_def_property_ui_text(prop, "Distribution", "How to distribute particles on selected element");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* physics modes */
- prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "phystype");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, phys_type_items);
- RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
- RNA_def_property_update(prop, 0, "rna_Particle_change_physics_type");
-
- prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "rotmode");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, rot_mode_items);
- RNA_def_property_ui_text(prop, "Orientation Axis",
- "Particle orientation axis (does not affect Explode modifier's results)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "avemode");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, ave_mode_items);
- RNA_def_property_ui_text(prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "reactevent");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, react_event_items);
- RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /*draw flag*/
- prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS);
- RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HAIR_GRID);
- RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
- RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
- RNA_def_property_ui_text(prop, "Size", "Show particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
- RNA_def_property_ui_text(prop, "Health", "Draw boid health");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
- RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
- RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
-
- prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
- RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
- RNA_def_property_ui_text(prop, "Number", "Show particle number");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_collection_pick_random", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
- RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from collection randomly");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_collection_count", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
- RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collection");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
-
- prop = RNA_def_property(srna, "use_global_instance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
- RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_rotation_instance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
- RNA_def_property_ui_text(prop, "Rotation",
- "Use object's rotation for duplication (global x-axis is aligned "
- "particle rotation axis)");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_scale_instance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "draw", PART_DRAW_NO_SCALE_OB);
- RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
- RNA_def_property_ui_text(prop, "Adaptive Render", "Draw steps of the particle path");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
- RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
- RNA_def_property_ui_text(prop, "Whole Collection", "Use whole collection at once");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
- RNA_def_property_ui_text(prop, "Strand Render", "Use the strand primitive for rendering");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "display_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "draw_as");
- RNA_def_property_enum_items(prop, part_draw_as_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
- RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "ren_as");
- RNA_def_property_enum_items(prop, part_ren_as_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
- RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "display_color", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "draw_col");
- RNA_def_property_enum_items(prop, draw_col_items);
- RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "draw_size");
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_range(prop, 0, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "childtype");
- RNA_def_property_enum_items(prop, child_type_items);
- RNA_def_property_ui_text(prop, "Children From", "Create child particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "draw_step");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_range(prop, 0, 7, 1, -1);
- RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "ren_step");
- RNA_def_property_range(prop, 0, 20);
- RNA_def_property_ui_range(prop, 0, 9, 1, -1);
- RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
-
- prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 2, SHRT_MAX);
- RNA_def_property_ui_range(prop, 2, 50, 1, 1);
- RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "bending_random");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
- RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
-
- /*TODO: not found in UI, readonly? */
- prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, SHRT_MAX); /*TODO:min,max */
- RNA_def_property_ui_text(prop, "Keys Step", "");
-
- /* adaptive path rendering */
- prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
- RNA_def_property_range(prop, 0, 45);
- RNA_def_property_ui_text(prop, "Degrees", "How many degrees path has to curve to make another render segment");
-
- prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
- RNA_def_property_range(prop, 0, 50);
- RNA_def_property_ui_text(prop, "Pixel", "How many pixels path has to cover to make another render segment");
-
- prop = RNA_def_property(srna, "display_percentage", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "disp");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "omat");
- RNA_def_property_range(prop, 1, 32767);
- RNA_def_property_ui_text(prop, "Material Index", "Index of material slot used for rendering particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "omat");
- RNA_def_property_enum_items(prop, part_mat_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_Material_itemf");
- RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, integrator_type_items);
- RNA_def_property_ui_text(prop, "Integration",
- "Algorithm used to calculate physics, from the fastest to the "
- "most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, kink_type_items);
- RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
- RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
- RNA_def_property_range(prop, 0.01f, 100.0f);
- RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* general values */
- prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
- RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "end");
- RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
-
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
- RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
- RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "randlife");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "timetweak");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0, 10, 1, 3);
- RNA_def_property_ui_text(prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
- RNA_def_property_range(prop, 0.0001, 100.0);
- RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
- RNA_def_property_ui_text(prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
- RNA_def_property_ui_text(prop, "Automatic Subframes", "Automatically set the number of subframes");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Subframes",
- "Subframes to simulate for improved stability and finer granularity simulations "
- "(dt = timestep / (subframes + 1))");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0001, 10);
- RNA_def_property_float_default(prop, 0.1);
- RNA_def_property_ui_text(prop, "Adaptive Subframe Threshold",
- "The relative distance a particle can move before requiring more subframes "
- "(target Courant number); 0.01-0.3 is the recommended range");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "jitfac");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "eff_hair");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "totpart");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- /* This limit is for those freaks who have the machine power to handle it. */
- /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
- /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
- RNA_def_property_range(prop, 0, 10000000);
- RNA_def_property_ui_range(prop, 0, 100000, 1, -1);
- RNA_def_property_ui_text(prop, "Number", "Total number of particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "userjit", PROP_INT, PROP_UNSIGNED); /*TODO: can we get a better name for userjit? */
- RNA_def_property_int_sdna(prop, NULL, "userjit");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "grid_res");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
- RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
- RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "grid_rand");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
- /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
- RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
- RNA_def_property_ui_range(prop, 0, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Effector Number", "How many particles are effectors (0 is all particles)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* initial velocity factors */
- prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
- RNA_def_property_ui_range(prop, 0, 100, 1, 3);
- RNA_def_property_ui_text(prop, "Normal", "Let the surface normal give the particle a starting velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "obfac");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Object Velocity", "Let the object give the particle a starting velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "randfac"); /*optional if prop names are the same */
- RNA_def_property_range(prop, 0.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0, 100, 1, 3);
- RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "partfac");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Particle", "Let the target particle give the particle a starting velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "tanfac");
- RNA_def_property_range(prop, -1000.0f, 1000.0f);
- RNA_def_property_ui_range(prop, -100, 100, 1, 2);
- RNA_def_property_ui_text(prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "tanphase");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "reactfac");
- RNA_def_property_range(prop, -10.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Reactor",
- "Let the vector away from the target particle's location give the particle "
- "a starting velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "ob_vel");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, -100, 100, 1, 3);
- RNA_def_property_ui_text(prop, "Object Aligned",
- "Let the emitter object orientation give the particle a starting velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "avefac");
- RNA_def_property_range(prop, -200.0f, 200.0f);
- RNA_def_property_ui_range(prop, -100, 100, 10, 3);
- RNA_def_property_ui_text(prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "phasefac");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "randrotfac");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "randphasefac");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* physical properties */
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
- RNA_def_property_range(prop, 0.00000001f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
- RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_range(prop, 0.001f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
- RNA_def_property_ui_text(prop, "Size", "The size of the particles");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "randsize");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
- RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
-
- /* global physical properties */
- prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "dragfac");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "brownfac");
- RNA_def_property_range(prop, 0.0f, 200.0f);
- RNA_def_property_ui_range(prop, 0, 20, 1, 3);
- RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "dampfac");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* random length */
- prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "randlength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* children */
- prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /*optional if prop names are the same */
- RNA_def_property_range(prop, 0, 100000);
- RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
- RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children/parent");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
- RNA_def_property_range(prop, 0, 100000);
- RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
- RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
-
- prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "parents");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "childsize");
- RNA_def_property_range(prop, 0.001f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "childrandsize");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Random Child Size", "Random variation to the size of the child particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "childrad");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "childflat");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* clumping */
- prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clumpfac");
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clumppow");
- RNA_def_property_range(prop, -0.999f, 0.999f);
- RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
- RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
- RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
-
- prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clumpcurve");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
- RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clump_noise_size");
- RNA_def_property_range(prop, 0.00001f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
- RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* kink */
- prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "kink_amp");
- RNA_def_property_range(prop, -100000.0f, 100000.0f);
- RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "kink_amp_random");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "kink_freq");
- RNA_def_property_range(prop, -100000.0f, 100000.0f);
- RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -0.999f, 0.999f);
- RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Extra Steps", "Extra steps for resolution of special kink features");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* rough */
- prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rough1");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rough1_size");
- RNA_def_property_range(prop, 0.01f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rough2");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rough2_size");
- RNA_def_property_range(prop, 0.01f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by random rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rough_end");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
- RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
- RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
-
- prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "roughcurve");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "clength");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Length", "Length of child paths");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "clength_thres");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Threshold", "Amount of particles left untouched by child path length");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* parting */
- prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "parting_fac");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Parting Factor", "Create parting in the children based on parent strands");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "parting_min");
- RNA_def_property_range(prop, 0.0f, 180.0f);
- RNA_def_property_ui_text(prop, "Parting Minimum",
- "Minimum root to tip angle (tip distance/root distance for long hair)");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "parting_max");
- RNA_def_property_range(prop, 0.0f, 180.0f);
- RNA_def_property_ui_text(prop, "Parting Maximum",
- "Maximum root to tip angle (tip distance/root distance for long hair)");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* branching */
- prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "branch_thres");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* drawing stuff */
- prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_funcs(prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "path_start");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
- RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "path_end");
- RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
- RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "trail_count");
- RNA_def_property_range(prop, 1, 100000);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* keyed particles */
- prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
- RNA_def_property_range(prop, 1.0f, 10000.0f);
- RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* modified dm support */
- prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0);
- RNA_def_property_ui_text(prop, "Use Modifier Stack", "Emit particles from mesh with modifiers applied "
- "(must use same subsurf level for viewport and render for correct results)");
- RNA_def_property_update(prop, 0, "rna_Particle_change_type");
-
- /* draw objects & collections */
- prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
-
- prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "instance_weights", NULL);
- RNA_def_property_struct_type(prop, "ParticleDupliWeight");
- RNA_def_property_ui_text(prop, "Dupli Collection Weights", "Weights for all of the objects in the dupli collection");
-
- prop = RNA_def_property(srna, "active_instanceweight", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleDupliWeight");
- RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Dupli Object", "");
-
- prop = RNA_def_property(srna, "active_instanceweight_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_ParticleDupliWeight_active_index_get",
- "rna_ParticleDupliWeight_active_index_set",
- "rna_ParticleDupliWeight_active_index_range");
- RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
-
- prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Instance Object", "Show this Object in place of particles");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
-
- /* boids */
- prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoidSettings");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Boid Settings", "");
-
- /* Fluid particles */
- prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "SPHFluidSettings");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
-
- /* Effector weights */
- prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EffectorWeights");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Weights", "");
-
- /* animation here? */
- rna_def_animdata_common(srna);
-
- prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "pd");
- RNA_def_property_struct_type(prop, "FieldSettings");
- RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Force Field 1", "");
-
- prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "pd2");
- RNA_def_property_struct_type(prop, "FieldSettings");
- RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Force Field 2", "");
-
- /* twist */
- prop = RNA_def_property(srna, "twist", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -100000.0f, 100000.0f);
- RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Twist", "Number of turns around parent along the strand");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "use_twist_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_TWIST_CURVE);
- RNA_def_property_ui_text(prop, "Use Twist Curve", "Use a curve to define twist");
- RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_twist_curve_update");
-
- prop = RNA_def_property(srna, "twist_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "twistcurve");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Twist Curve", "Curve defining twist");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* hair shape */
- prop = RNA_def_property(srna, "use_close_tip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shape_flag", PART_SHAPE_CLOSE_TIP);
- RNA_def_property_ui_text(prop, "Close Tip", "Set tip radius to zero");
- RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
-
- prop = RNA_def_property(srna, "shape", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, -1.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shape", "Strand shape parameter");
- RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
-
- prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "rad_root");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
- RNA_def_property_ui_text(prop, "Root", "Strand width at the root");
- RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
-
- prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "rad_tip");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
- RNA_def_property_ui_text(prop, "Tip", "Strand width at the tip");
- RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
-
- prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rad_scale");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
- RNA_def_property_ui_text(prop, "Radius Scale", "Multiplier of radius properties");
- RNA_def_property_update(prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem type_items[] = {
+ {PART_EMITTER, "EMITTER", 0, "Emitter", ""},
+ /*{PART_REACTOR, "REACTOR", 0, "Reactor", ""}, */
+ {PART_HAIR, "HAIR", 0, "Hair", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem phys_type_items[] = {
+ {PART_PHYS_NO, "NO", 0, "None", ""},
+ {PART_PHYS_NEWTON, "NEWTON", 0, "Newtonian", ""},
+ {PART_PHYS_KEYED, "KEYED", 0, "Keyed", ""},
+ {PART_PHYS_BOIDS, "BOIDS", 0, "Boids", ""},
+ {PART_PHYS_FLUID, "FLUID", 0, "Fluid", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem rot_mode_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PART_ROT_NOR, "NOR", 0, "Normal", ""},
+ {PART_ROT_NOR_TAN, "NOR_TAN", 0, "Normal-Tangent", ""},
+ {PART_ROT_VEL, "VEL", 0, "Velocity / Hair", ""},
+ {PART_ROT_GLOB_X, "GLOB_X", 0, "Global X", ""},
+ {PART_ROT_GLOB_Y, "GLOB_Y", 0, "Global Y", ""},
+ {PART_ROT_GLOB_Z, "GLOB_Z", 0, "Global Z", ""},
+ {PART_ROT_OB_X, "OB_X", 0, "Object X", ""},
+ {PART_ROT_OB_Y, "OB_Y", 0, "Object Y", ""},
+ {PART_ROT_OB_Z, "OB_Z", 0, "Object Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem ave_mode_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PART_AVE_VELOCITY, "VELOCITY", 0, "Velocity", ""},
+ {PART_AVE_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
+ {PART_AVE_VERTICAL, "VERTICAL", 0, "Vertical", ""},
+ {PART_AVE_GLOBAL_X, "GLOBAL_X", 0, "Global X", ""},
+ {PART_AVE_GLOBAL_Y, "GLOBAL_Y", 0, "Global Y", ""},
+ {PART_AVE_GLOBAL_Z, "GLOBAL_Z", 0, "Global Z", ""},
+ {PART_AVE_RAND, "RAND", 0, "Random", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem react_event_items[] = {
+ {PART_EVENT_DEATH, "DEATH", 0, "Death", ""},
+ {PART_EVENT_COLLIDE, "COLLIDE", 0, "Collision", ""},
+ {PART_EVENT_NEAR, "NEAR", 0, "Near", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem child_type_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {PART_CHILD_PARTICLES, "SIMPLE", 0, "Simple", ""},
+ {PART_CHILD_FACES, "INTERPOLATED", 0, "Interpolated", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /*TODO: names, tooltips */
+ static const EnumPropertyItem integrator_type_items[] = {
+ {PART_INT_EULER, "EULER", 0, "Euler", ""},
+ {PART_INT_VERLET, "VERLET", 0, "Verlet", ""},
+ {PART_INT_MIDPOINT, "MIDPOINT", 0, "Midpoint", ""},
+ {PART_INT_RK4, "RK4", 0, "RK4", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem kink_type_items[] = {
+ {PART_KINK_NO, "NO", 0, "Nothing", ""},
+ {PART_KINK_CURL, "CURL", 0, "Curl", ""},
+ {PART_KINK_RADIAL, "RADIAL", 0, "Radial", ""},
+ {PART_KINK_WAVE, "WAVE", 0, "Wave", ""},
+ {PART_KINK_BRAID, "BRAID", 0, "Braid", ""},
+ {PART_KINK_SPIRAL, "SPIRAL", 0, "Spiral", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem draw_col_items[] = {
+ {PART_DRAW_COL_NONE, "NONE", 0, "None", ""},
+ {PART_DRAW_COL_MAT, "MATERIAL", 0, "Material", ""},
+ {PART_DRAW_COL_VEL, "VELOCITY", 0, "Velocity", ""},
+ {PART_DRAW_COL_ACC, "ACCELERATION", 0, "Acceleration", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem part_mat_items[] = {
+ {0, "DUMMY", 0, "Dummy", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ParticleSettings", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Particle Settings", "Particle settings, reusable by multiple particle systems");
+ RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
+
+ rna_def_mtex_common(brna,
+ srna,
+ "rna_ParticleSettings_mtex_begin",
+ "rna_ParticleSettings_active_texture_get",
+ "rna_ParticleSettings_active_texture_set",
+ NULL,
+ "ParticleSettingsTextureSlot",
+ "ParticleSettingsTextureSlots",
+ "rna_Particle_reset",
+ NULL);
+
+ /* fluid particle type can't be checked from the type value in rna as it's not shown in the menu */
+ prop = RNA_def_property(srna, "is_fluid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_PartSettings_is_fluid_get", NULL);
+ RNA_def_property_ui_text(prop, "Fluid", "Particles were created by a fluid simulation");
+
+ /* flag */
+ prop = RNA_def_property(srna, "use_react_start_end", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_STA_END);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Start/End", "Give birth to unreacted particles eventually");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_react_multiple", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_REACT_MULTIPLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Multi React", "React multiple times");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_regrow_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_REGROW);
+ RNA_def_property_ui_text(prop, "Regrow", "Regrow hair for each frame");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_unborn", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_UNBORN);
+ RNA_def_property_ui_text(prop, "Unborn", "Show particles before they are emitted");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_dead", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIED);
+ RNA_def_property_ui_text(prop, "Died", "Show particles after they have died");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_emit_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_TRAND);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Random", "Emit in random order of elements");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_even_distribution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_EDISTR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Even Distribution",
+ "Use even distribution from faces based on face areas or edge lengths");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_die_on_collision", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_DIE_ON_COL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Die on hit", "Particles die when they collide with a deflector object");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_size_deflect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZE_DEFL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Size Deflect", "Use particle's size in deflection");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_rotations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROTATIONS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Rotations", "Calculate particle rotations");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_dynamic_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_ROT_DYN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Dynamic", "Particle rotations are affected by collisions and effectors");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_multiply_size_mass", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SIZEMASS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Mass from Size", "Multiply mass by particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_advanced_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", PART_HIDE_ADVANCED_HAIR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Advanced", "Use full physics calculations for growing hair");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "lock_boids_to_surface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_BOIDS_2D);
+ RNA_def_property_ui_text(prop, "Boids 2D", "Constrain boids to a surface");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_hair_bspline", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_HAIR_BSPLINE);
+ RNA_def_property_ui_text(prop, "B-Spline", "Interpolate hair using B-Splines");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "invert_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_INVERT);
+ RNA_def_property_ui_text(
+ prop, "Invert Grid", "Invert what is considered object and what is not");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "hexagonal_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_GRID_HEXAGONAL);
+ RNA_def_property_ui_text(prop, "Hexagonal Grid", "Create the grid in a hexagonal pattern");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "apply_effector_to_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_EFFECT);
+ RNA_def_property_ui_text(prop, "Effect Children", "Apply effectors to children");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "create_long_hair_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_LONG_HAIR);
+ RNA_def_property_ui_text(prop, "Long Hair", "Calculate children that suit long hair well");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "apply_guide_to_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_CHILD_GUIDE);
+ RNA_def_property_ui_text(prop, "apply_guide_to_children", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_self_effect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PART_SELF_EFFECT);
+ RNA_def_property_ui_text(prop, "Self Effect", "Particle effectors affect themselves");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Type", "Particle Type");
+ RNA_def_property_update(prop, 0, "rna_Particle_change_type");
+
+ prop = RNA_def_property(srna, "emit_from", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "from");
+ RNA_def_property_enum_items(prop, part_reactor_from_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_from_itemf");
+ RNA_def_property_ui_text(prop, "Emit From", "Where to emit particles from");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "distribution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "distr");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, part_dist_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_dist_itemf");
+ RNA_def_property_ui_text(
+ prop, "Distribution", "How to distribute particles on selected element");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* physics modes */
+ prop = RNA_def_property(srna, "physics_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "phystype");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, phys_type_items);
+ RNA_def_property_ui_text(prop, "Physics Type", "Particle physics type");
+ RNA_def_property_update(prop, 0, "rna_Particle_change_physics_type");
+
+ prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotmode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, rot_mode_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Orientation Axis",
+ "Particle orientation axis (does not affect Explode modifier's results)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "angular_velocity_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "avemode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ave_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Angular Velocity Axis", "What axis is used to change particle rotation with time");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "react_event", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reactevent");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, react_event_items);
+ RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /*draw flag*/
+ prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS);
+ RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_hair_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HAIR_GRID);
+ RNA_def_property_ui_text(prop, "Guide Hairs", "Show hair simulation grid");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL);
+ RNA_def_property_ui_text(prop, "Velocity", "Show particle velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_SIZE);
+ RNA_def_property_ui_text(prop, "Size", "Show particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_health", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_HEALTH);
+ RNA_def_property_ui_text(prop, "Health", "Draw boid health");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_absolute_path_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_ABS_PATH_TIME);
+ RNA_def_property_ui_text(prop, "Absolute Path Time", "Path timing is in absolute frames");
+ RNA_def_property_update(prop, 0, "rna_Particle_abspathtime_update");
+
+ prop = RNA_def_property(srna, "use_parent_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_PARENT);
+ RNA_def_property_ui_text(prop, "Parents", "Render parent particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "show_number", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_NUM);
+ RNA_def_property_ui_text(prop, "Number", "Show particle number");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_collection_pick_random", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_RAND_GR);
+ RNA_def_property_ui_text(prop, "Pick Random", "Pick objects from collection randomly");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_collection_count", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_COUNT_GR);
+ RNA_def_property_ui_text(prop, "Use Count", "Use object multiple times in the same collection");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
+
+ prop = RNA_def_property(srna, "use_global_instance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GLOBAL_OB);
+ RNA_def_property_ui_text(prop, "Global", "Use object's global coordinates for duplication");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_rotation_instance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_ROTATE_OB);
+ RNA_def_property_ui_text(prop,
+ "Rotation",
+ "Use object's rotation for duplication (global x-axis is aligned "
+ "particle rotation axis)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_scale_instance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "draw", PART_DRAW_NO_SCALE_OB);
+ RNA_def_property_ui_text(prop, "Scale", "Use object's scale for duplication");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_render_adaptive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_ADAPT);
+ RNA_def_property_ui_text(prop, "Adaptive Render", "Draw steps of the particle path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_velocity_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_VEL_LENGTH);
+ RNA_def_property_ui_text(prop, "Speed", "Multiply line length by particle speed");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_whole_collection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_WHOLE_GR);
+ RNA_def_property_ui_text(prop, "Whole Collection", "Use whole collection at once");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "use_strand_primitive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_REN_STRAND);
+ RNA_def_property_ui_text(prop, "Strand Render", "Use the strand primitive for rendering");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "display_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_as");
+ RNA_def_property_enum_items(prop, part_draw_as_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_draw_as_itemf");
+ RNA_def_property_ui_text(prop, "Particle Drawing", "How particles are drawn in viewport");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "render_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "ren_as");
+ RNA_def_property_enum_items(prop, part_ren_as_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_ren_as_itemf");
+ RNA_def_property_ui_text(prop, "Particle Rendering", "How particles are rendered");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "display_color", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "draw_col");
+ RNA_def_property_enum_items(prop, draw_col_items);
+ RNA_def_property_ui_text(prop, "Draw Color", "Draw additional particle data as a color");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "display_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "draw_size");
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Draw Size", "Size of particles on viewport in BU");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "child_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "childtype");
+ RNA_def_property_enum_items(prop, child_type_items);
+ RNA_def_property_ui_text(prop, "Children From", "Create child particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "draw_step");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_range(prop, 0, 7, 1, -1);
+ RNA_def_property_ui_text(prop, "Steps", "How many steps paths are drawn with (power of 2)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "render_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "ren_step");
+ RNA_def_property_range(prop, 0, 20);
+ RNA_def_property_ui_range(prop, 0, 9, 1, -1);
+ RNA_def_property_ui_text(prop, "Render", "How many steps paths are rendered with (power of 2)");
+
+ prop = RNA_def_property(srna, "hair_step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 2, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 2, 50, 1, 1);
+ RNA_def_property_ui_text(prop, "Segments", "Number of hair segments");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "bending_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "bending_random");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs");
+ RNA_def_property_update(prop, 0, "rna_Particle_cloth_update");
+
+ /*TODO: not found in UI, readonly? */
+ prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, SHRT_MAX); /*TODO:min,max */
+ RNA_def_property_ui_text(prop, "Keys Step", "");
+
+ /* adaptive path rendering */
+ prop = RNA_def_property(srna, "adaptive_angle", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "adapt_angle");
+ RNA_def_property_range(prop, 0, 45);
+ RNA_def_property_ui_text(
+ prop, "Degrees", "How many degrees path has to curve to make another render segment");
+
+ prop = RNA_def_property(srna, "adaptive_pixel", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "adapt_pix");
+ RNA_def_property_range(prop, 0, 50);
+ RNA_def_property_ui_text(
+ prop, "Pixel", "How many pixels path has to cover to make another render segment");
+
+ prop = RNA_def_property(srna, "display_percentage", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "disp");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Display", "Percentage of particles to display in 3D view");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "material", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "omat");
+ RNA_def_property_range(prop, 1, 32767);
+ RNA_def_property_ui_text(
+ prop, "Material Index", "Index of material slot used for rendering particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "material_slot", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "omat");
+ RNA_def_property_enum_items(prop, part_mat_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_Particle_Material_itemf");
+ RNA_def_property_ui_text(prop, "Material Slot", "Material slot used for rendering particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "integrator", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, integrator_type_items);
+ RNA_def_property_ui_text(prop,
+ "Integration",
+ "Algorithm used to calculate physics, from the fastest to the "
+ "most stable/accurate: Midpoint, Euler, Verlet, RK4 (Old)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "kink", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, kink_type_items);
+ RNA_def_property_ui_text(prop, "Kink", "Type of periodic offset on the path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_axis_xyz_items);
+ RNA_def_property_ui_text(prop, "Axis", "Which axis to use for offset");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "color_maximum", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "color_vec_max");
+ RNA_def_property_range(prop, 0.01f, 100.0f);
+ RNA_def_property_ui_text(prop, "Color Maximum", "Maximum length of the particle color vector");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* general values */
+ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL);
+ RNA_def_property_ui_text(prop, "Start", "Frame number to start emitting particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "frame_end", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "end");
+ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF);
+
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_end_set", NULL);
+ RNA_def_property_ui_text(prop, "End", "Frame number to stop emitting particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "lifetime", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_range(prop, 1.0f, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Lifetime", "Life span of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "lifetime_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "randlife");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random", "Give the particle life a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "time_tweak", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "timetweak");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0, 10, 1, 3);
+ RNA_def_property_ui_text(
+ prop, "Tweak", "A multiplier for physics timestep (1.0 means one frame = 1/25 seconds)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "timestep", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_PartSettings_timestep_get", "rna_PartSetings_timestep_set", NULL);
+ RNA_def_property_range(prop, 0.0001, 100.0);
+ RNA_def_property_ui_range(prop, 0.01, 10, 1, 3);
+ RNA_def_property_ui_text(
+ prop, "Timestep", "The simulation timestep per frame (seconds per frame)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "use_adaptive_subframes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "time_flag", PART_TIME_AUTOSF);
+ RNA_def_property_ui_text(
+ prop, "Automatic Subframes", "Automatically set the number of subframes");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(
+ prop,
+ "Subframes",
+ "Subframes to simulate for improved stability and finer granularity simulations "
+ "(dt = timestep / (subframes + 1))");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "courant_target", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0001, 10);
+ RNA_def_property_float_default(prop, 0.1);
+ RNA_def_property_ui_text(
+ prop,
+ "Adaptive Subframe Threshold",
+ "The relative distance a particle can move before requiring more subframes "
+ "(target Courant number); 0.01-0.3 is the recommended range");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "jitter_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "jitfac");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Amount", "Amount of jitter applied to the sampling");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "effect_hair", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "eff_hair");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Stiffness", "Hair stiffness for effectors");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "totpart");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ /* This limit is for those freaks who have the machine power to handle it. */
+ /* 10M particles take around 2.2 Gb of memory / disk space in saved file and */
+ /* each cached frame takes around 0.5 Gb of memory / disk space depending on cache mode. */
+ RNA_def_property_range(prop, 0, 10000000);
+ RNA_def_property_ui_range(prop, 0, 100000, 1, -1);
+ RNA_def_property_ui_text(prop, "Number", "Total number of particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(
+ srna, "userjit", PROP_INT, PROP_UNSIGNED); /*TODO: can we get a better name for userjit? */
+ RNA_def_property_int_sdna(prop, NULL, "userjit");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop, "P/F", "Emission locations / face (0 = automatic)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "grid_resolution", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "grid_res");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(
+ prop, 1, 250); /* ~15M particles in a cube (ouch!), but could be very usable in a plane */
+ RNA_def_property_ui_range(prop, 1, 50, 1, -1); /* ~100k particles in a cube */
+ RNA_def_property_ui_text(prop, "Resolution", "The resolution of the particle grid");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "grid_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "grid_rand");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Grid Randomness", "Add random offset to the grid locations");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "effector_amount", PROP_INT, PROP_UNSIGNED);
+ /* in theory PROP_ANIMATABLE perhaps should be cleared, but animating this can give some interesting results! */
+ RNA_def_property_range(prop, 0, 10000); /* 10000 effectors will bel SLOW, but who knows */
+ RNA_def_property_ui_range(prop, 0, 100, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Effector Number", "How many particles are effectors (0 is all particles)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* initial velocity factors */
+ prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0, 100, 1, 3);
+ RNA_def_property_ui_text(
+ prop, "Normal", "Let the surface normal give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "object_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "obfac");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Object Velocity", "Let the object give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "randfac"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, 0.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "particle_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "partfac");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "Particle", "Let the target particle give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "tangent_factor", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "tanfac");
+ RNA_def_property_range(prop, -1000.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, -100, 100, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Tangent", "Let the surface tangent give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "tangent_phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "tanphase");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Rot", "Rotate the surface tangent");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "reactor_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "reactfac");
+ RNA_def_property_range(prop, -10.0f, 10.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Reactor",
+ "Let the vector away from the target particle's location give the particle "
+ "a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "object_align_factor", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "ob_vel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -100, 100, 1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Object Aligned",
+ "Let the emitter object orientation give the particle a starting velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "angular_velocity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "avefac");
+ RNA_def_property_range(prop, -200.0f, 200.0f);
+ RNA_def_property_ui_range(prop, -100, 100, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Angular Velocity", "Angular velocity amount (in radians per second)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "phase_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phasefac");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Phase", "Rotation around the chosen orientation axis");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "rotation_factor_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "randrotfac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Orientation", "Randomize particle orientation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "phase_factor_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "randphasefac");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(
+ prop, "Random Phase", "Randomize rotation around the chosen orientation axis");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "hair_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_PartSetting_hairlength_get", "rna_PartSetting_hairlength_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_ui_text(prop, "Hair Length", "Length of the hair");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* physical properties */
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
+ RNA_def_property_range(prop, 0.00000001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Mass", "Mass of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_range(prop, 0.001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 3);
+ RNA_def_property_ui_text(prop, "Size", "The size of the particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "size_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "randsize");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Size", "Give the particle size a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "collision_group");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
+
+ /* global physical properties */
+ prop = RNA_def_property(srna, "drag_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "dragfac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Drag", "Amount of air-drag");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "brownian_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "brownfac");
+ RNA_def_property_range(prop, 0.0f, 200.0f);
+ RNA_def_property_ui_range(prop, 0, 20, 1, 3);
+ RNA_def_property_ui_text(prop, "Brownian", "Amount of random, erratic particle movement");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "dampfac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Damp", "Amount of damping");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* random length */
+ prop = RNA_def_property(srna, "length_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "randlength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Random Length", "Give path length a random variation");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* children */
+ prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /*optional if prop names are the same */
+ RNA_def_property_range(prop, 0, 100000);
+ RNA_def_property_ui_range(prop, 0, 1000, 1, -1);
+ RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children/parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "rendered_child_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "ren_child_nbr");
+ RNA_def_property_range(prop, 0, 100000);
+ RNA_def_property_ui_range(prop, 0, 10000, 1, -1);
+ RNA_def_property_ui_text(prop, "Rendered Children", "Number of children/parent for rendering");
+
+ prop = RNA_def_property(srna, "virtual_parents", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "parents");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Virtual Parents", "Relative amount of virtual parents");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "childsize");
+ RNA_def_property_range(prop, 0.001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 100.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Child Size", "A multiplier for the child particle size");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_size_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "childrandsize");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Random Child Size", "Random variation to the size of the child particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "childrad");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Child Radius", "Radius of children around parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_roundness", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "childflat");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Child Roundness", "Roundness of children around parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* clumping */
+ prop = RNA_def_property(srna, "clump_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clumpfac");
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Clump", "Amount of clumping");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clumppow");
+ RNA_def_property_range(prop, -0.999f, 0.999f);
+ RNA_def_property_ui_text(prop, "Shape", "Shape of clumping");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_clump_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_CURVE);
+ RNA_def_property_ui_text(prop, "Use Clump Curve", "Use a curve to define clump tapering");
+ RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_clump_curve_update");
+
+ prop = RNA_def_property(srna, "clump_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clumpcurve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Clump Curve", "Curve defining clump tapering");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_clump_noise", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_CLUMP_NOISE);
+ RNA_def_property_ui_text(prop, "Use Clump Noise", "Create random clumps around the parent");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "clump_noise_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clump_noise_size");
+ RNA_def_property_range(prop, 0.00001f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Clump Noise Size", "Size of clump noise");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* kink */
+ prop = RNA_def_property(srna, "kink_amplitude", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_amp");
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Amplitude", "The amplitude of the offset");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_amplitude_clump", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "kink_amp_clump");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Amplitude Clump", "How much clump affects kink amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_amplitude_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "kink_amp_random");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Amplitude Random", "Random variation of the amplitude");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_frequency", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "kink_freq");
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Frequency", "The frequency of the offset (1/total length)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -0.999f, 0.999f);
+ RNA_def_property_ui_text(prop, "Shape", "Adjust the offset to the beginning/end");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_flat", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Flatness", "How flat the hairs are");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_extra_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Extra Steps", "Extra steps for resolution of special kink features");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "kink_axis_random", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Axis Random", "Random variation of the orientation");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* rough */
+ prop = RNA_def_property(srna, "roughness_1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough1");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rough1", "Amount of location dependent rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_1_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough1_size");
+ RNA_def_property_range(prop, 0.01f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Size1", "Size of location dependent rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough2");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rough2", "Amount of random rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_2_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough2_size");
+ RNA_def_property_range(prop, 0.01f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Size2", "Size of random rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_2_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "rough2_thres");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Threshold", "Amount of particles left untouched by random rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_endpoint", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough_end");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Rough Endpoint", "Amount of end point rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "roughness_end_shape", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rough_end_shape");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Shape", "Shape of end point rough");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_roughness_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_ROUGH_CURVE);
+ RNA_def_property_ui_text(prop, "Use Roughness Curve", "Use a curve to define roughness");
+ RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_roughness_curve_update");
+
+ prop = RNA_def_property(srna, "roughness_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "roughcurve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Roughness Curve", "Curve defining roughness");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_length", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "clength");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Length", "Length of child paths");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_length_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "clength_thres");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Threshold", "Amount of particles left untouched by child path length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* parting */
+ prop = RNA_def_property(srna, "child_parting_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "parting_fac");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Parting Factor", "Create parting in the children based on parent strands");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_parting_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "parting_min");
+ RNA_def_property_range(prop, 0.0f, 180.0f);
+ RNA_def_property_ui_text(prop,
+ "Parting Minimum",
+ "Minimum root to tip angle (tip distance/root distance for long hair)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "child_parting_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "parting_max");
+ RNA_def_property_range(prop, 0.0f, 180.0f);
+ RNA_def_property_ui_text(prop,
+ "Parting Maximum",
+ "Maximum root to tip angle (tip distance/root distance for long hair)");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* branching */
+ prop = RNA_def_property(srna, "branch_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "branch_thres");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Threshold of branching");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* drawing stuff */
+ prop = RNA_def_property(srna, "line_length_tail", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_PartSetting_linelentail_get", "rna_PartSetting_linelentail_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Tail", "Length of the line's tail");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "line_length_head", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_funcs(
+ prop, "rna_PartSetting_linelenhead_get", "rna_PartSetting_linelenhead_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Head", "Length of the line's head");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "path_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "path_start");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
+ RNA_def_property_ui_text(prop, "Path Start", "Starting time of drawn path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "path_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "path_end");
+ RNA_def_property_float_funcs(prop, NULL, NULL, "rna_PartSetting_pathstartend_range");
+ RNA_def_property_ui_text(prop, "Path End", "End time of drawn path");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "trail_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "trail_count");
+ RNA_def_property_range(prop, 1, 100000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(prop, "Trail Count", "Number of trail particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* keyed particles */
+ prop = RNA_def_property(srna, "keyed_loops", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "keyed_loops");
+ RNA_def_property_range(prop, 1.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, 1.0f, 100.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Loop count", "Number of times the keys are looped");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* modified dm support */
+ prop = RNA_def_property(srna, "use_modifier_stack", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_modifier_stack", 0);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Modifier Stack",
+ "Emit particles from mesh with modifiers applied "
+ "(must use same subsurf level for viewport and render for correct results)");
+ RNA_def_property_update(prop, 0, "rna_Particle_change_type");
+
+ /* draw objects & collections */
+ prop = RNA_def_property(srna, "instance_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "instance_collection");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(
+ prop, "Dupli Collection", "Show Objects in this collection in place of particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_count");
+
+ prop = RNA_def_property(srna, "instance_weights", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "instance_weights", NULL);
+ RNA_def_property_struct_type(prop, "ParticleDupliWeight");
+ RNA_def_property_ui_text(
+ prop, "Dupli Collection Weights", "Weights for all of the objects in the dupli collection");
+
+ prop = RNA_def_property(srna, "active_instanceweight", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleDupliWeight");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleDupliWeight_active_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Dupli Object", "");
+
+ prop = RNA_def_property(srna, "active_instanceweight_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_ParticleDupliWeight_active_index_get",
+ "rna_ParticleDupliWeight_active_index_set",
+ "rna_ParticleDupliWeight_active_index_range");
+ RNA_def_property_ui_text(prop, "Active Dupli Object Index", "");
+
+ prop = RNA_def_property(srna, "instance_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Instance Object", "Show this Object in place of particles");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_dependency");
+
+ /* boids */
+ prop = RNA_def_property(srna, "boids", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoidSettings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Boid Settings", "");
+
+ /* Fluid particles */
+ prop = RNA_def_property(srna, "fluid", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SPHFluidSettings");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "SPH Fluid Settings", "");
+
+ /* Effector weights */
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ /* animation here? */
+ rna_def_animdata_common(srna);
+
+ prop = RNA_def_property(srna, "force_field_1", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pd");
+ RNA_def_property_struct_type(prop, "FieldSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Particle_field1_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Force Field 1", "");
+
+ prop = RNA_def_property(srna, "force_field_2", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pd2");
+ RNA_def_property_struct_type(prop, "FieldSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_Particle_field2_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Force Field 2", "");
+
+ /* twist */
+ prop = RNA_def_property(srna, "twist", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -100000.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Twist", "Number of turns around parent along the strand");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "use_twist_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "child_flag", PART_CHILD_USE_TWIST_CURVE);
+ RNA_def_property_ui_text(prop, "Use Twist Curve", "Use a curve to define twist");
+ RNA_def_property_update(prop, 0, "rna_ParticleSettings_use_twist_curve_update");
+
+ prop = RNA_def_property(srna, "twist_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "twistcurve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Twist Curve", "Curve defining twist");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* hair shape */
+ prop = RNA_def_property(srna, "use_close_tip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shape_flag", PART_SHAPE_CLOSE_TIP);
+ RNA_def_property_ui_text(prop, "Close Tip", "Set tip radius to zero");
+ RNA_def_property_update(
+ prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
+
+ prop = RNA_def_property(srna, "shape", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, -1.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Shape", "Strand shape parameter");
+ RNA_def_property_update(
+ prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
+
+ prop = RNA_def_property(srna, "root_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "rad_root");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Root", "Strand width at the root");
+ RNA_def_property_update(
+ prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
+
+ prop = RNA_def_property(srna, "tip_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "rad_tip");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Tip", "Strand width at the tip");
+ RNA_def_property_update(
+ prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
+
+ prop = RNA_def_property(srna, "radius_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rad_scale");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Radius Scale", "Multiplier of radius properties");
+ RNA_def_property_update(
+ prop, 0, "rna_Particle_redo"); /* TODO: Only need to tell the render engine to update. */
}
static void rna_def_particle_target(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem mode_items[] = {
- {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
- {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
- {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
-
- srna = RNA_def_struct(brna, "ParticleTarget", NULL);
- RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Particle target name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Target Object",
- "The object that has the target particle system (empty if same object)");
- RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
-
- prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "psys");
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_ui_text(prop, "Target Particle System", "The index of particle system on the target object");
- RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
-
- prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "time");
- RNA_def_property_range(prop, 0.0, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Time", "");
- RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
-
- prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "duration");
- RNA_def_property_range(prop, 0.0, MAXFRAMEF);
- RNA_def_property_ui_text(prop, "Duration", "");
- RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
-
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
-
- prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, mode_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Mode", "");
- RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mode_items[] = {
+ {PTARGET_MODE_FRIEND, "FRIEND", 0, "Friend", ""},
+ {PTARGET_MODE_NEUTRAL, "NEUTRAL", 0, "Neutral", ""},
+ {PTARGET_MODE_ENEMY, "ENEMY", 0, "Enemy", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ParticleTarget", NULL);
+ RNA_def_struct_ui_text(srna, "Particle Target", "Target particle system");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_ParticleTarget_name_get", "rna_ParticleTarget_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Particle target name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Target Object",
+ "The object that has the target particle system (empty if same object)");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
+
+ prop = RNA_def_property(srna, "system", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "psys");
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Target Particle System", "The index of particle system on the target object");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
+
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "time");
+ RNA_def_property_range(prop, 0.0, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Time", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
+
+ prop = RNA_def_property(srna, "duration", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "duration");
+ RNA_def_property_range(prop, 0.0, MAXFRAMEF);
+ RNA_def_property_ui_text(prop, "Duration", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_redo");
+
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PTARGET_VALID);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Valid", "Keyed particles target is valid");
+
+ prop = RNA_def_property(srna, "alliance", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, mode_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Mode", "");
+ RNA_def_property_update(prop, 0, "rna_Particle_target_reset");
}
static void rna_def_particle_system(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "ParticleSystem", NULL);
- RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
- RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Particle system name");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set");
- RNA_def_struct_name_property(srna, prop);
-
- /* access to particle settings is redirected through functions */
- /* to allow proper id-buttons functionality */
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- /*RNA_def_property_pointer_sdna(prop, NULL, "part"); */
- RNA_def_property_struct_type(prop, "ParticleSettings");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_pointer_funcs(prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
- RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
-
- prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
- RNA_def_property_struct_type(prop, "Particle");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
- RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
-
- prop = RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
- RNA_def_property_struct_type(prop, "ChildParticle");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
- RNA_def_property_ui_text(prop, "Child Particles", "Child particles generated by the particle system");
-
- prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Seed", "Offset in the random number table, to get a different randomized result");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Child Seed",
- "Offset in the random number table for child particles, to get a different "
- "randomized result");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* hair */
- prop = RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
-
- prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
- RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
- RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics_update");
-
- prop = RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clmd");
- RNA_def_property_struct_type(prop, "ClothModifier");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
-
- /* reactor */
- prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Reactor Target Object",
- "For reactor systems, the object that has the target particle system "
- "(empty if same object)");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "target_psys");
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Reactor Target Particle System",
- "For reactor systems, index of particle system on the target object");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- /* keyed */
- prop = RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleTarget");
- RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
-
- prop = RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleTarget");
- RNA_def_property_pointer_funcs(prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Particle Target", "");
-
- prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_ParticleSystem_active_particle_target_index_get",
- "rna_ParticleSystem_active_particle_target_index_set",
- "rna_ParticleSystem_active_particle_target_index_range");
- RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
-
- /* vertex groups */
-
- /* note, internally store as ints, access as strings */
-#if 0 /* int access. works ok but isn't useful for the UI */
- prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
- RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-#endif
-
- prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_0", "rna_ParticleVGroup_name_len_0",
- "rna_ParticleVGroup_name_set_0");
- RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
- RNA_def_property_ui_text(prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_1", "rna_ParticleVGroup_name_len_1",
- "rna_ParticleVGroup_name_set_1");
- RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
- RNA_def_property_ui_text(prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_2", "rna_ParticleVGroup_name_len_2",
- "rna_ParticleVGroup_name_set_2");
- RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
- RNA_def_property_ui_text(prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_3", "rna_ParticleVGroup_name_len_3",
- "rna_ParticleVGroup_name_set_3");
- RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
- RNA_def_property_ui_text(prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_4", "rna_ParticleVGroup_name_len_4",
- "rna_ParticleVGroup_name_set_4");
- RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
- RNA_def_property_ui_text(prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_5", "rna_ParticleVGroup_name_len_5",
- "rna_ParticleVGroup_name_set_5");
- RNA_def_property_ui_text(prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
- RNA_def_property_ui_text(prop, "Vertex Group Roughness 1 Negate",
- "Negate the effect of the roughness 1 vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_6", "rna_ParticleVGroup_name_len_6",
- "rna_ParticleVGroup_name_set_6");
- RNA_def_property_ui_text(prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
- RNA_def_property_ui_text(prop, "Vertex Group Roughness 2 Negate",
- "Negate the effect of the roughness 2 vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_7", "rna_ParticleVGroup_name_len_7",
- "rna_ParticleVGroup_name_set_7");
- RNA_def_property_ui_text(prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
- RNA_def_property_ui_text(prop, "Vertex Group Roughness End Negate",
- "Negate the effect of the roughness end vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_8", "rna_ParticleVGroup_name_len_8",
- "rna_ParticleVGroup_name_set_8");
- RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
- RNA_def_property_ui_text(prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_9", "rna_ParticleVGroup_name_len_9",
- "rna_ParticleVGroup_name_set_9");
- RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
- RNA_def_property_ui_text(prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_10", "rna_ParticleVGroup_name_len_10",
- "rna_ParticleVGroup_name_set_10");
- RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
- RNA_def_property_ui_text(prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_11", "rna_ParticleVGroup_name_len_11",
- "rna_ParticleVGroup_name_set_11");
- RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
- RNA_def_property_ui_text(prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_reset");
-
- prop = RNA_def_property(srna, "vertex_group_twist", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ParticleVGroup_name_get_12", "rna_ParticleVGroup_name_len_12",
- "rna_ParticleVGroup_name_set_12");
- RNA_def_property_ui_text(prop, "Vertex Group Twist", "Vertex group to control twist");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- prop = RNA_def_property(srna, "invert_vertex_group_twist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TWIST));
- RNA_def_property_ui_text(prop, "Vertex Group Twist Negate",
- "Negate the effect of the twist vertex group");
- RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
-
- /* pointcache */
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
- RNA_def_property_struct_type(prop, "PointCache");
- RNA_def_property_ui_text(prop, "Point Cache", "");
-
- prop = RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
-
- /* offset ob */
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "parent");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Parent",
- "Use this object's coordinate system instead of global coordinate system");
- RNA_def_property_update(prop, 0, "rna_Particle_redo");
-
- /* hair or cache editing */
- prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
-
- prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
-
- /* Read-only: this is calculated internally. Changing it would only affect
- * the next time-step. The user should change ParticlSettings.subframes or
- * ParticleSettings.courant_target instead. */
- prop = RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 1.0f / 101.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
-
- /* extract cached hair location data */
- func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair");
- RNA_def_function_ui_description(func, "Obtain cache hair data");
- parm = RNA_def_pointer(func, "object", "Object", "", "Object");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
- RNA_def_int(func, "step", 0, INT_MIN, INT_MAX, "step no", "", INT_MIN, INT_MAX);
- parm = RNA_def_float_vector(func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co",
- "Exported hairkey location", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
- /* extract hair UVs */
- func = RNA_def_function(srna, "uv_on_emitter", "rna_ParticleSystem_uv_on_emitter");
- RNA_def_function_ui_description(func, "Obtain uv for all particles");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
- RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX);
- parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
- RNA_def_property_array(parm, 2);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
- /* extract hair mcols */
- func = RNA_def_function(srna, "mcol_on_emitter", "rna_ParticleSystem_mcol_on_emitter");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Obtain mcol for all particles");
- parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
- RNA_def_int(func, "vcol_no", 0, INT_MIN, INT_MAX, "vcol no", "", INT_MIN, INT_MAX);
- parm = RNA_def_property(func, "mcol", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(parm, 3);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "ParticleSystem", NULL);
+ RNA_def_struct_ui_text(srna, "Particle System", "Particle system in an object");
+ RNA_def_struct_ui_icon(srna, ICON_PARTICLE_DATA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Particle system name");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ParticleSystem_name_set");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* access to particle settings is redirected through functions */
+ /* to allow proper id-buttons functionality */
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ /*RNA_def_property_pointer_sdna(prop, NULL, "part"); */
+ RNA_def_property_struct_type(prop, "ParticleSettings");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_particle_settings_get", "rna_particle_settings_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Settings", "Particle system settings");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
+
+ prop = RNA_def_property(srna, "particles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "particles", "totpart");
+ RNA_def_property_struct_type(prop, "Particle");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
+ RNA_def_property_ui_text(prop, "Particles", "Particles generated by the particle system");
+
+ prop = RNA_def_property(srna, "child_particles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "child", "totchild");
+ RNA_def_property_struct_type(prop, "ChildParticle");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
+ RNA_def_property_ui_text(
+ prop, "Child Particles", "Child particles generated by the particle system");
+
+ prop = RNA_def_property(srna, "seed", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(
+ prop, "Seed", "Offset in the random number table, to get a different randomized result");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "child_seed", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(
+ prop,
+ "Child Seed",
+ "Offset in the random number table for child particles, to get a different "
+ "randomized result");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* hair */
+ prop = RNA_def_property(srna, "is_global_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_GLOBAL_HAIR);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Global Hair", "Hair keys are in global coordinate space");
+
+ prop = RNA_def_property(srna, "use_hair_dynamics", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_HAIR_DYNAMICS);
+ RNA_def_property_ui_text(prop, "Hair Dynamics", "Enable hair dynamics using cloth simulation");
+ RNA_def_property_update(prop, 0, "rna_Particle_hair_dynamics_update");
+
+ prop = RNA_def_property(srna, "cloth", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clmd");
+ RNA_def_property_struct_type(prop, "ClothModifier");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Cloth", "Cloth dynamics for hair");
+
+ /* reactor */
+ prop = RNA_def_property(srna, "reactor_target_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "target_ob");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop,
+ "Reactor Target Object",
+ "For reactor systems, the object that has the target particle system "
+ "(empty if same object)");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "reactor_target_particle_system", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "target_psys");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_text(prop,
+ "Reactor Target Particle System",
+ "For reactor systems, index of particle system on the target object");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ /* keyed */
+ prop = RNA_def_property(srna, "use_keyed_timing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PSYS_KEYED_TIMING);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Keyed timing", "Use key times");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleTarget");
+ RNA_def_property_ui_text(prop, "Targets", "Target particle systems");
+
+ prop = RNA_def_property(srna, "active_particle_target", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleTarget");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_ParticleSystem_active_particle_target_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Particle Target", "");
+
+ prop = RNA_def_property(srna, "active_particle_target_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_ParticleSystem_active_particle_target_index_get",
+ "rna_ParticleSystem_active_particle_target_index_set",
+ "rna_ParticleSystem_active_particle_target_index_range");
+ RNA_def_property_ui_text(prop, "Active Particle Target Index", "");
+
+ /* vertex groups */
+
+ /* note, internally store as ints, access as strings */
+# if 0 /* int access. works ok but isn't useful for the UI */
+ prop = RNA_def_property(srna, "vertex_group_density", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "vgroup[0]");
+ RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+# endif
+
+ prop = RNA_def_property(srna, "vertex_group_density", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_0",
+ "rna_ParticleVGroup_name_len_0",
+ "rna_ParticleVGroup_name_set_0");
+ RNA_def_property_ui_text(prop, "Vertex Group Density", "Vertex group to control density");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_density", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_DENSITY));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Density Negate", "Negate the effect of the density vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_velocity", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_1",
+ "rna_ParticleVGroup_name_len_1",
+ "rna_ParticleVGroup_name_set_1");
+ RNA_def_property_ui_text(prop, "Vertex Group Velocity", "Vertex group to control velocity");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_VEL));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Velocity Negate", "Negate the effect of the velocity vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_length", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_2",
+ "rna_ParticleVGroup_name_len_2",
+ "rna_ParticleVGroup_name_set_2");
+ RNA_def_property_ui_text(prop, "Vertex Group Length", "Vertex group to control length");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_LENGTH));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Length Negate", "Negate the effect of the length vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ prop = RNA_def_property(srna, "vertex_group_clump", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_3",
+ "rna_ParticleVGroup_name_len_3",
+ "rna_ParticleVGroup_name_set_3");
+ RNA_def_property_ui_text(prop, "Vertex Group Clump", "Vertex group to control clump");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_clump", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_CLUMP));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Clump Negate", "Negate the effect of the clump vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_kink", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_4",
+ "rna_ParticleVGroup_name_len_4",
+ "rna_ParticleVGroup_name_set_4");
+ RNA_def_property_ui_text(prop, "Vertex Group Kink", "Vertex group to control kink");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_kink", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_KINK));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Kink Negate", "Negate the effect of the kink vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_roughness_1", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_5",
+ "rna_ParticleVGroup_name_len_5",
+ "rna_ParticleVGroup_name_set_5");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Roughness 1", "Vertex group to control roughness 1");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_roughness_1", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH1));
+ RNA_def_property_ui_text(prop,
+ "Vertex Group Roughness 1 Negate",
+ "Negate the effect of the roughness 1 vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_roughness_2", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_6",
+ "rna_ParticleVGroup_name_len_6",
+ "rna_ParticleVGroup_name_set_6");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Roughness 2", "Vertex group to control roughness 2");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_roughness_2", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGH2));
+ RNA_def_property_ui_text(prop,
+ "Vertex Group Roughness 2 Negate",
+ "Negate the effect of the roughness 2 vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_roughness_end", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_7",
+ "rna_ParticleVGroup_name_len_7",
+ "rna_ParticleVGroup_name_set_7");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Roughness End", "Vertex group to control roughness end");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_roughness_end", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROUGHE));
+ RNA_def_property_ui_text(prop,
+ "Vertex Group Roughness End Negate",
+ "Negate the effect of the roughness end vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "vertex_group_size", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_8",
+ "rna_ParticleVGroup_name_len_8",
+ "rna_ParticleVGroup_name_set_8");
+ RNA_def_property_ui_text(prop, "Vertex Group Size", "Vertex group to control size");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_SIZE));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Size Negate", "Negate the effect of the size vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_tangent", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_9",
+ "rna_ParticleVGroup_name_len_9",
+ "rna_ParticleVGroup_name_set_9");
+ RNA_def_property_ui_text(prop, "Vertex Group Tangent", "Vertex group to control tangent");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_tangent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TAN));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Tangent Negate", "Negate the effect of the tangent vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_rotation", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_10",
+ "rna_ParticleVGroup_name_len_10",
+ "rna_ParticleVGroup_name_set_10");
+ RNA_def_property_ui_text(prop, "Vertex Group Rotation", "Vertex group to control rotation");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_ROT));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Rotation Negate", "Negate the effect of the rotation vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_field", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_11",
+ "rna_ParticleVGroup_name_len_11",
+ "rna_ParticleVGroup_name_set_11");
+ RNA_def_property_ui_text(prop, "Vertex Group Field", "Vertex group to control field");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_EFFECTOR));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Field Negate", "Negate the effect of the field vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_reset");
+
+ prop = RNA_def_property(srna, "vertex_group_twist", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_ParticleVGroup_name_get_12",
+ "rna_ParticleVGroup_name_len_12",
+ "rna_ParticleVGroup_name_set_12");
+ RNA_def_property_ui_text(prop, "Vertex Group Twist", "Vertex group to control twist");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ prop = RNA_def_property(srna, "invert_vertex_group_twist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "vg_neg", (1 << PSYS_VG_TWIST));
+ RNA_def_property_ui_text(
+ prop, "Vertex Group Twist Negate", "Negate the effect of the twist vertex group");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo_child");
+
+ /* pointcache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "pointcache");
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ prop = RNA_def_property(srna, "has_multiple_caches", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_multiple_caches_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Multiple Caches", "Particle system has multiple point caches");
+
+ /* offset ob */
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "parent");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Parent", "Use this object's coordinate system instead of global coordinate system");
+ RNA_def_property_update(prop, 0, "rna_Particle_redo");
+
+ /* hair or cache editing */
+ prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_editable_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Editable", "Particle system can be edited in particle mode");
+
+ prop = RNA_def_property(srna, "is_edited", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleSystem_edited_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Edited", "Particle system has been edited in particle mode");
+
+ /* Read-only: this is calculated internally. Changing it would only affect
+ * the next time-step. The user should change ParticlSettings.subframes or
+ * ParticleSettings.courant_target instead. */
+ prop = RNA_def_property(srna, "dt_frac", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0f / 101.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Timestep", "The current simulation time step size, as a fraction of a frame");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ RNA_def_struct_path_func(srna, "rna_ParticleSystem_path");
+
+ /* extract cached hair location data */
+ func = RNA_def_function(srna, "co_hair", "rna_ParticleSystem_co_hair");
+ RNA_def_function_ui_description(func, "Obtain cache hair data");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "step", 0, INT_MIN, INT_MAX, "step no", "", INT_MIN, INT_MAX);
+ parm = RNA_def_float_vector(
+ func, "co", 3, NULL, -FLT_MAX, FLT_MAX, "Co", "Exported hairkey location", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ /* extract hair UVs */
+ func = RNA_def_function(srna, "uv_on_emitter", "rna_ParticleSystem_uv_on_emitter");
+ RNA_def_function_ui_description(func, "Obtain uv for all particles");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ prop = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "uv_no", 0, INT_MIN, INT_MAX, "UV no", "", INT_MIN, INT_MAX);
+ parm = RNA_def_property(func, "uv", PROP_FLOAT, PROP_COORDS);
+ RNA_def_property_array(parm, 2);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ /* extract hair mcols */
+ func = RNA_def_function(srna, "mcol_on_emitter", "rna_ParticleSystem_mcol_on_emitter");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Obtain mcol for all particles");
+ parm = RNA_def_pointer(func, "modifier", "ParticleSystemModifier", "", "Particle modifier");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "particle", "Particle", "", "Particle");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_int(func, "particle_no", 0, INT_MIN, INT_MAX, "Particle no", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "vcol_no", 0, INT_MIN, INT_MAX, "vcol no", "", INT_MIN, INT_MAX);
+ parm = RNA_def_property(func, "mcol", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(parm, 3);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
void RNA_def_particle(BlenderRNA *brna)
{
- rna_def_particle_target(brna);
- rna_def_fluid_settings(brna);
- rna_def_particle_hair_key(brna);
- rna_def_particle_key(brna);
-
- rna_def_child_particle(brna);
- rna_def_particle(brna);
- rna_def_particle_dupliweight(brna);
- rna_def_particle_system(brna);
- rna_def_particle_settings_mtex(brna);
- rna_def_particle_settings(brna);
+ rna_def_particle_target(brna);
+ rna_def_fluid_settings(brna);
+ rna_def_particle_hair_key(brna);
+ rna_def_particle_key(brna);
+
+ rna_def_child_particle(brna);
+ rna_def_particle(brna);
+ rna_def_particle_dupliweight(brna);
+ rna_def_particle_system(brna);
+ rna_def_particle_settings_mtex(brna);
+ rna_def_particle_settings(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c
index 118943dab2e..4b764529562 100644
--- a/source/blender/makesrna/intern/rna_pose.c
+++ b/source/blender/makesrna/intern/rna_pose.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <string.h>
@@ -43,700 +42,719 @@
/* Bone and Group Color Sets */
const EnumPropertyItem rna_enum_color_sets_items[] = {
- {0, "DEFAULT", 0, "Default Colors", ""},
- {1, "THEME01", ICON_COLORSET_01_VEC, "01 - Theme Color Set", ""},
- {2, "THEME02", ICON_COLORSET_02_VEC, "02 - Theme Color Set", ""},
- {3, "THEME03", ICON_COLORSET_03_VEC, "03 - Theme Color Set", ""},
- {4, "THEME04", ICON_COLORSET_04_VEC, "04 - Theme Color Set", ""},
- {5, "THEME05", ICON_COLORSET_05_VEC, "05 - Theme Color Set", ""},
- {6, "THEME06", ICON_COLORSET_06_VEC, "06 - Theme Color Set", ""},
- {7, "THEME07", ICON_COLORSET_07_VEC, "07 - Theme Color Set", ""},
- {8, "THEME08", ICON_COLORSET_08_VEC, "08 - Theme Color Set", ""},
- {9, "THEME09", ICON_COLORSET_09_VEC, "09 - Theme Color Set", ""},
- {10, "THEME10", ICON_COLORSET_10_VEC, "10 - Theme Color Set", ""},
- {11, "THEME11", ICON_COLORSET_11_VEC, "11 - Theme Color Set", ""},
- {12, "THEME12", ICON_COLORSET_12_VEC, "12 - Theme Color Set", ""},
- {13, "THEME13", ICON_COLORSET_13_VEC, "13 - Theme Color Set", ""},
- {14, "THEME14", ICON_COLORSET_14_VEC, "14 - Theme Color Set", ""},
- {15, "THEME15", ICON_COLORSET_15_VEC, "15 - Theme Color Set", ""},
- {16, "THEME16", ICON_COLORSET_16_VEC, "16 - Theme Color Set", ""},
- {17, "THEME17", ICON_COLORSET_17_VEC, "17 - Theme Color Set", ""},
- {18, "THEME18", ICON_COLORSET_18_VEC, "18 - Theme Color Set", ""},
- {19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
- {20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
- {-1, "CUSTOM", 0, "Custom Color Set", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "DEFAULT", 0, "Default Colors", ""},
+ {1, "THEME01", ICON_COLORSET_01_VEC, "01 - Theme Color Set", ""},
+ {2, "THEME02", ICON_COLORSET_02_VEC, "02 - Theme Color Set", ""},
+ {3, "THEME03", ICON_COLORSET_03_VEC, "03 - Theme Color Set", ""},
+ {4, "THEME04", ICON_COLORSET_04_VEC, "04 - Theme Color Set", ""},
+ {5, "THEME05", ICON_COLORSET_05_VEC, "05 - Theme Color Set", ""},
+ {6, "THEME06", ICON_COLORSET_06_VEC, "06 - Theme Color Set", ""},
+ {7, "THEME07", ICON_COLORSET_07_VEC, "07 - Theme Color Set", ""},
+ {8, "THEME08", ICON_COLORSET_08_VEC, "08 - Theme Color Set", ""},
+ {9, "THEME09", ICON_COLORSET_09_VEC, "09 - Theme Color Set", ""},
+ {10, "THEME10", ICON_COLORSET_10_VEC, "10 - Theme Color Set", ""},
+ {11, "THEME11", ICON_COLORSET_11_VEC, "11 - Theme Color Set", ""},
+ {12, "THEME12", ICON_COLORSET_12_VEC, "12 - Theme Color Set", ""},
+ {13, "THEME13", ICON_COLORSET_13_VEC, "13 - Theme Color Set", ""},
+ {14, "THEME14", ICON_COLORSET_14_VEC, "14 - Theme Color Set", ""},
+ {15, "THEME15", ICON_COLORSET_15_VEC, "15 - Theme Color Set", ""},
+ {16, "THEME16", ICON_COLORSET_16_VEC, "16 - Theme Color Set", ""},
+ {17, "THEME17", ICON_COLORSET_17_VEC, "17 - Theme Color Set", ""},
+ {18, "THEME18", ICON_COLORSET_18_VEC, "18 - Theme Color Set", ""},
+ {19, "THEME19", ICON_COLORSET_19_VEC, "19 - Theme Color Set", ""},
+ {20, "THEME20", ICON_COLORSET_20_VEC, "20 - Theme Color Set", ""},
+ {-1, "CUSTOM", 0, "Custom Color Set", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_ghash.h"
-#include "BLI_string_utils.h"
+# include "BLI_ghash.h"
+# include "BLI_string_utils.h"
-#include "BIK_api.h"
-#include "BKE_action.h"
-#include "BKE_armature.h"
+# include "BIK_api.h"
+# include "BKE_action.h"
+# include "BKE_armature.h"
-#include "DNA_userdef_types.h"
+# include "DNA_userdef_types.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "BKE_context.h"
-#include "BKE_constraint.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
+# include "BKE_context.h"
+# include "BKE_constraint.h"
+# include "BKE_global.h"
+# include "BKE_idprop.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "ED_object.h"
-#include "ED_armature.h"
+# include "ED_object.h"
+# include "ED_armature.h"
-#include "WM_api.h"
+# include "WM_api.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
static void rna_Pose_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- /* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
+ /* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->id.data);
}
static void rna_Pose_dependency_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_relations_tag_update(bmain);
+ DEG_relations_tag_update(bmain);
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->id.data);
}
static void rna_Pose_IK_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- /* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
- Object *ob = ptr->id.data;
+ /* XXX when to use this? ob->pose->flag |= (POSE_LOCKED|POSE_DO_UNLOCK); */
+ Object *ob = ptr->id.data;
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->id.data);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_POSE, ptr->id.data);
- BIK_clear_data(ob->pose);
+ BIK_clear_data(ob->pose);
}
static char *rna_PoseBone_path(PointerRNA *ptr)
{
- bPoseChannel *pchan = ptr->data;
- char name_esc[sizeof(pchan->name) * 2];
+ bPoseChannel *pchan = ptr->data;
+ char name_esc[sizeof(pchan->name) * 2];
- BLI_strescape(name_esc, pchan->name, sizeof(name_esc));
- return BLI_sprintfN("pose.bones[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, pchan->name, sizeof(name_esc));
+ return BLI_sprintfN("pose.bones[\"%s\"]", name_esc);
}
/* Bone groups only. */
static bActionGroup *rna_bone_group_new(ID *id, bPose *pose, const char *name)
{
- bActionGroup *grp = BKE_pose_add_group(pose, name);
- WM_main_add_notifier(NC_OBJECT | ND_POSE | NA_ADDED, id);
- return grp;
+ bActionGroup *grp = BKE_pose_add_group(pose, name);
+ WM_main_add_notifier(NC_OBJECT | ND_POSE | NA_ADDED, id);
+ return grp;
}
static void rna_bone_group_remove(ID *id, bPose *pose, ReportList *reports, PointerRNA *grp_ptr)
{
- bActionGroup *grp = grp_ptr->data;
- const int grp_idx = BLI_findindex(&pose->agroups, grp);
+ bActionGroup *grp = grp_ptr->data;
+ const int grp_idx = BLI_findindex(&pose->agroups, grp);
- if (grp_idx == -1) {
- BKE_reportf(reports, RPT_ERROR, "Bone group '%s' not found in this object", grp->name);
- return;
- }
+ if (grp_idx == -1) {
+ BKE_reportf(reports, RPT_ERROR, "Bone group '%s' not found in this object", grp->name);
+ return;
+ }
- BKE_pose_remove_group(pose, grp, grp_idx + 1);
- WM_main_add_notifier(NC_OBJECT | ND_POSE | NA_REMOVED, id);
+ BKE_pose_remove_group(pose, grp, grp_idx + 1);
+ WM_main_add_notifier(NC_OBJECT | ND_POSE | NA_REMOVED, id);
}
-
/* shared for actions groups and bone groups */
void rna_ActionGroup_colorset_set(PointerRNA *ptr, int value)
{
- bActionGroup *grp = ptr->data;
+ bActionGroup *grp = ptr->data;
- /* ensure only valid values get set */
- if ((value >= -1) && (value < 21)) {
- grp->customCol = value;
+ /* ensure only valid values get set */
+ if ((value >= -1) && (value < 21)) {
+ grp->customCol = value;
- /* sync colors stored with theme colors based on the index specified */
- action_group_colors_sync(grp, NULL);
- }
+ /* sync colors stored with theme colors based on the index specified */
+ action_group_colors_sync(grp, NULL);
+ }
}
bool rna_ActionGroup_is_custom_colorset_get(PointerRNA *ptr)
{
- bActionGroup *grp = ptr->data;
+ bActionGroup *grp = ptr->data;
- return (grp->customCol < 0);
+ return (grp->customCol < 0);
}
static void rna_BoneGroup_name_set(PointerRNA *ptr, const char *value)
{
- Object *ob = ptr->id.data;
- bActionGroup *agrp = ptr->data;
-
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name));
-
- BLI_uniquename(&ob->pose->agroups, agrp, CTX_DATA_(BLT_I18NCONTEXT_ID_ARMATURE, "Group"), '.',
- offsetof(bActionGroup, name), sizeof(agrp->name));
+ Object *ob = ptr->id.data;
+ bActionGroup *agrp = ptr->data;
+
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(agrp->name, value, sizeof(agrp->name));
+
+ BLI_uniquename(&ob->pose->agroups,
+ agrp,
+ CTX_DATA_(BLT_I18NCONTEXT_ID_ARMATURE, "Group"),
+ '.',
+ offsetof(bActionGroup, name),
+ sizeof(agrp->name));
}
static IDProperty *rna_PoseBone_idprops(PointerRNA *ptr, bool create)
{
- bPoseChannel *pchan = ptr->data;
+ bPoseChannel *pchan = ptr->data;
- if (create && !pchan->prop) {
- IDPropertyTemplate val = {0};
- pchan->prop = IDP_New(IDP_GROUP, &val, "RNA_PoseBone group");
- }
+ if (create && !pchan->prop) {
+ IDPropertyTemplate val = {0};
+ pchan->prop = IDP_New(IDP_GROUP, &val, "RNA_PoseBone group");
+ }
- return pchan->prop;
+ return pchan->prop;
}
static void rna_Pose_ik_solver_set(struct PointerRNA *ptr, int value)
{
- bPose *pose = (bPose *)ptr->data;
-
- if (pose->iksolver != value) {
- /* the solver has changed, must clean any temporary structures */
- BIK_clear_data(pose);
- if (pose->ikparam) {
- MEM_freeN(pose->ikparam);
- pose->ikparam = NULL;
- }
- pose->iksolver = value;
- BKE_pose_ikparam_init(pose);
- }
+ bPose *pose = (bPose *)ptr->data;
+
+ if (pose->iksolver != value) {
+ /* the solver has changed, must clean any temporary structures */
+ BIK_clear_data(pose);
+ if (pose->ikparam) {
+ MEM_freeN(pose->ikparam);
+ pose->ikparam = NULL;
+ }
+ pose->iksolver = value;
+ BKE_pose_ikparam_init(pose);
+ }
}
static void rna_Pose_ik_solver_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- bPose *pose = ptr->data;
+ Object *ob = ptr->id.data;
+ bPose *pose = ptr->data;
- BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
- DEG_relations_tag_update(bmain);
+ BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
+ DEG_relations_tag_update(bmain);
- BKE_pose_update_constraint_flags(pose);
+ BKE_pose_update_constraint_flags(pose);
- object_test_constraints(bmain, ob);
+ object_test_constraints(bmain, ob);
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_TRANSFORM);
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY | ID_RECALC_TRANSFORM);
}
/* rotation - axis-angle */
static void rna_PoseChannel_rotation_axis_angle_get(PointerRNA *ptr, float *value)
{
- bPoseChannel *pchan = ptr->data;
+ bPoseChannel *pchan = ptr->data;
- /* for now, assume that rotation mode is axis-angle */
- value[0] = pchan->rotAngle;
- copy_v3_v3(&value[1], pchan->rotAxis);
+ /* for now, assume that rotation mode is axis-angle */
+ value[0] = pchan->rotAngle;
+ copy_v3_v3(&value[1], pchan->rotAxis);
}
/* rotation - axis-angle */
static void rna_PoseChannel_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
{
- bPoseChannel *pchan = ptr->data;
+ bPoseChannel *pchan = ptr->data;
- /* for now, assume that rotation mode is axis-angle */
- pchan->rotAngle = value[0];
- copy_v3_v3(pchan->rotAxis, &value[1]);
+ /* for now, assume that rotation mode is axis-angle */
+ pchan->rotAngle = value[0];
+ copy_v3_v3(pchan->rotAxis, &value[1]);
- /* TODO: validate axis? */
+ /* TODO: validate axis? */
}
static void rna_PoseChannel_rotation_mode_set(PointerRNA *ptr, int value)
{
- bPoseChannel *pchan = ptr->data;
+ bPoseChannel *pchan = ptr->data;
- /* use API Method for conversions... */
- BKE_rotMode_change_values(pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle,
- pchan->rotmode, (short)value);
+ /* use API Method for conversions... */
+ BKE_rotMode_change_values(
+ pchan->quat, pchan->eul, pchan->rotAxis, &pchan->rotAngle, pchan->rotmode, (short)value);
- /* finally, set the new rotation type */
- pchan->rotmode = value;
+ /* finally, set the new rotation type */
+ pchan->rotmode = value;
}
static void rna_PoseChannel_name_set(PointerRNA *ptr, const char *value)
{
- Object *ob = (Object *)ptr->id.data;
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
+ Object *ob = (Object *)ptr->id.data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ char oldname[sizeof(pchan->name)], newname[sizeof(pchan->name)];
- /* need to be on the stack */
- BLI_strncpy_utf8(newname, value, sizeof(pchan->name));
- BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
+ /* need to be on the stack */
+ BLI_strncpy_utf8(newname, value, sizeof(pchan->name));
+ BLI_strncpy(oldname, pchan->name, sizeof(pchan->name));
- BLI_assert(BKE_id_is_in_global_main(&ob->id));
- BLI_assert(BKE_id_is_in_global_main(ob->data));
- ED_armature_bone_rename(G_MAIN, ob->data, oldname, newname);
+ BLI_assert(BKE_id_is_in_global_main(&ob->id));
+ BLI_assert(BKE_id_is_in_global_main(ob->data));
+ ED_armature_bone_rename(G_MAIN, ob->data, oldname, newname);
}
static bool rna_PoseChannel_has_ik_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- return BKE_pose_channel_in_IK_chain(ob, pchan);
+ return BKE_pose_channel_in_IK_chain(ob, pchan);
}
static StructRNA *rna_IKParam_refine(PointerRNA *ptr)
{
- bIKParam *param = (bIKParam *)ptr->data;
-
- switch (param->iksolver) {
- case IKSOLVER_ITASC:
- return &RNA_Itasc;
- default:
- return &RNA_IKParam;
- }
+ bIKParam *param = (bIKParam *)ptr->data;
+
+ switch (param->iksolver) {
+ case IKSOLVER_ITASC:
+ return &RNA_Itasc;
+ default:
+ return &RNA_IKParam;
+ }
}
static PointerRNA rna_Pose_ikparam_get(struct PointerRNA *ptr)
{
- bPose *pose = (bPose *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_IKParam, pose->ikparam);
+ bPose *pose = (bPose *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_IKParam, pose->ikparam);
}
static StructRNA *rna_Pose_ikparam_typef(PointerRNA *ptr)
{
- bPose *pose = (bPose *)ptr->data;
-
- switch (pose->iksolver) {
- case IKSOLVER_ITASC:
- return &RNA_Itasc;
- default:
- return &RNA_IKParam;
- }
+ bPose *pose = (bPose *)ptr->data;
+
+ switch (pose->iksolver) {
+ case IKSOLVER_ITASC:
+ return &RNA_Itasc;
+ default:
+ return &RNA_IKParam;
+ }
}
static void rna_Itasc_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- bItasc *itasc = ptr->data;
-
- /* verify values */
- if (itasc->precision < 0.0001f)
- itasc->precision = 0.0001f;
- if (itasc->minstep < 0.001f)
- itasc->minstep = 0.001f;
- if (itasc->maxstep < itasc->minstep)
- itasc->maxstep = itasc->minstep;
- if (itasc->feedback < 0.01f)
- itasc->feedback = 0.01f;
- if (itasc->feedback > 100.f)
- itasc->feedback = 100.f;
- if (itasc->maxvel < 0.01f)
- itasc->maxvel = 0.01f;
- if (itasc->maxvel > 100.f)
- itasc->maxvel = 100.f;
- BIK_update_param(ob->pose);
-
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ Object *ob = ptr->id.data;
+ bItasc *itasc = ptr->data;
+
+ /* verify values */
+ if (itasc->precision < 0.0001f)
+ itasc->precision = 0.0001f;
+ if (itasc->minstep < 0.001f)
+ itasc->minstep = 0.001f;
+ if (itasc->maxstep < itasc->minstep)
+ itasc->maxstep = itasc->minstep;
+ if (itasc->feedback < 0.01f)
+ itasc->feedback = 0.01f;
+ if (itasc->feedback > 100.f)
+ itasc->feedback = 100.f;
+ if (itasc->maxvel < 0.01f)
+ itasc->maxvel = 0.01f;
+ if (itasc->maxvel > 100.f)
+ itasc->maxvel = 100.f;
+ BIK_update_param(ob->pose);
+
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
}
static void rna_Itasc_update_rebuild(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
- bPose *pose = ob->pose;
+ Object *ob = ptr->id.data;
+ bPose *pose = ob->pose;
- BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
- rna_Itasc_update(bmain, scene, ptr);
+ BKE_pose_tag_recalc(bmain, pose); /* checks & sorts pose channels */
+ rna_Itasc_update(bmain, scene, ptr);
}
static void rna_PoseChannel_bone_custom_set(PointerRNA *ptr, PointerRNA value)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ if (pchan->custom) {
+ id_us_min(&pchan->custom->id);
+ pchan->custom = NULL;
+ }
- if (pchan->custom) {
- id_us_min(&pchan->custom->id);
- pchan->custom = NULL;
- }
+ pchan->custom = value.data;
- pchan->custom = value.data;
-
- id_us_plus(&pchan->custom->id);
+ id_us_plus(&pchan->custom->id);
}
static PointerRNA rna_PoseChannel_bone_group_get(PointerRNA *ptr)
{
- Object *ob = (Object *)ptr->id.data;
- bPose *pose = (ob) ? ob->pose : NULL;
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- bActionGroup *grp;
+ Object *ob = (Object *)ptr->id.data;
+ bPose *pose = (ob) ? ob->pose : NULL;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ bActionGroup *grp;
- if (pose)
- grp = BLI_findlink(&pose->agroups, pchan->agrp_index - 1);
- else
- grp = NULL;
+ if (pose)
+ grp = BLI_findlink(&pose->agroups, pchan->agrp_index - 1);
+ else
+ grp = NULL;
- return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp);
+ return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, grp);
}
static void rna_PoseChannel_bone_group_set(PointerRNA *ptr, PointerRNA value)
{
- Object *ob = (Object *)ptr->id.data;
- bPose *pose = (ob) ? ob->pose : NULL;
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
- if (pose)
- pchan->agrp_index = BLI_findindex(&pose->agroups, value.data) + 1;
- else
- pchan->agrp_index = 0;
+ Object *ob = (Object *)ptr->id.data;
+ bPose *pose = (ob) ? ob->pose : NULL;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+
+ if (pose)
+ pchan->agrp_index = BLI_findindex(&pose->agroups, value.data) + 1;
+ else
+ pchan->agrp_index = 0;
}
static int rna_PoseChannel_bone_group_index_get(PointerRNA *ptr)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- return MAX2(pchan->agrp_index - 1, 0);
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ return MAX2(pchan->agrp_index - 1, 0);
}
static void rna_PoseChannel_bone_group_index_set(PointerRNA *ptr, int value)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- pchan->agrp_index = value + 1;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ pchan->agrp_index = value + 1;
}
-static void rna_PoseChannel_bone_group_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_PoseChannel_bone_group_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Object *ob = (Object *)ptr->id.data;
- bPose *pose = (ob) ? ob->pose : NULL;
+ Object *ob = (Object *)ptr->id.data;
+ bPose *pose = (ob) ? ob->pose : NULL;
- *min = 0;
- *max = pose ? max_ii(0, BLI_listbase_count(&pose->agroups) - 1) : 0;
+ *min = 0;
+ *max = pose ? max_ii(0, BLI_listbase_count(&pose->agroups) - 1) : 0;
}
static PointerRNA rna_Pose_active_bone_group_get(PointerRNA *ptr)
{
- bPose *pose = (bPose *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_BoneGroup, BLI_findlink(&pose->agroups, pose->active_group - 1));
+ bPose *pose = (bPose *)ptr->data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_BoneGroup, BLI_findlink(&pose->agroups, pose->active_group - 1));
}
static void rna_Pose_active_bone_group_set(PointerRNA *ptr, PointerRNA value)
{
- bPose *pose = (bPose *)ptr->data;
- pose->active_group = BLI_findindex(&pose->agroups, value.data) + 1;
+ bPose *pose = (bPose *)ptr->data;
+ pose->active_group = BLI_findindex(&pose->agroups, value.data) + 1;
}
static int rna_Pose_active_bone_group_index_get(PointerRNA *ptr)
{
- bPose *pose = (bPose *)ptr->data;
- return MAX2(pose->active_group - 1, 0);
+ bPose *pose = (bPose *)ptr->data;
+ return MAX2(pose->active_group - 1, 0);
}
static void rna_Pose_active_bone_group_index_set(PointerRNA *ptr, int value)
{
- bPose *pose = (bPose *)ptr->data;
- pose->active_group = value + 1;
+ bPose *pose = (bPose *)ptr->data;
+ pose->active_group = value + 1;
}
-static void rna_Pose_active_bone_group_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Pose_active_bone_group_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- bPose *pose = (bPose *)ptr->data;
+ bPose *pose = (bPose *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&pose->agroups) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&pose->agroups) - 1);
}
-#if 0
+# if 0
static void rna_pose_bgroup_name_index_get(PointerRNA *ptr, char *value, int index)
{
- bPose *pose = (bPose *)ptr->data;
- bActionGroup *grp;
+ bPose *pose = (bPose *)ptr->data;
+ bActionGroup *grp;
- grp = BLI_findlink(&pose->agroups, index - 1);
+ grp = BLI_findlink(&pose->agroups, index - 1);
- if (grp) BLI_strncpy(value, grp->name, sizeof(grp->name));
- else value[0] = '\0';
+ if (grp) BLI_strncpy(value, grp->name, sizeof(grp->name));
+ else value[0] = '\0';
}
static int rna_pose_bgroup_name_index_length(PointerRNA *ptr, int index)
{
- bPose *pose = (bPose *)ptr->data;
- bActionGroup *grp;
+ bPose *pose = (bPose *)ptr->data;
+ bActionGroup *grp;
- grp = BLI_findlink(&pose->agroups, index - 1);
- return (grp) ? strlen(grp->name) : 0;
+ grp = BLI_findlink(&pose->agroups, index - 1);
+ return (grp) ? strlen(grp->name) : 0;
}
static void rna_pose_bgroup_name_index_set(PointerRNA *ptr, const char *value, short *index)
{
- bPose *pose = (bPose *)ptr->data;
- bActionGroup *grp;
- int a;
-
- for (a = 1, grp = pose->agroups.first; grp; grp = grp->next, a++) {
- if (STREQ(grp->name, value)) {
- *index = a;
- return;
- }
- }
-
- *index = 0;
+ bPose *pose = (bPose *)ptr->data;
+ bActionGroup *grp;
+ int a;
+
+ for (a = 1, grp = pose->agroups.first; grp; grp = grp->next, a++) {
+ if (STREQ(grp->name, value)) {
+ *index = a;
+ return;
+ }
+ }
+
+ *index = 0;
}
static void rna_pose_pgroup_name_set(PointerRNA *ptr, const char *value, char *result, int maxlen)
{
- bPose *pose = (bPose *)ptr->data;
- bActionGroup *grp;
+ bPose *pose = (bPose *)ptr->data;
+ bActionGroup *grp;
- for (grp = pose->agroups.first; grp; grp = grp->next) {
- if (STREQ(grp->name, value)) {
- BLI_strncpy(result, value, maxlen);
- return;
- }
- }
+ for (grp = pose->agroups.first; grp; grp = grp->next) {
+ if (STREQ(grp->name, value)) {
+ BLI_strncpy(result, value, maxlen);
+ return;
+ }
+ }
- result[0] = '\0';
+ result[0] = '\0';
}
-#endif
+# endif
static PointerRNA rna_PoseChannel_active_constraint_get(PointerRNA *ptr)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- bConstraint *con = BKE_constraints_active_get(&pchan->constraints);
- return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ bConstraint *con = BKE_constraints_active_get(&pchan->constraints);
+ return rna_pointer_inherit_refine(ptr, &RNA_Constraint, con);
}
static void rna_PoseChannel_active_constraint_set(PointerRNA *ptr, PointerRNA value)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ BKE_constraints_active_set(&pchan->constraints, (bConstraint *)value.data);
}
-static bConstraint *rna_PoseChannel_constraints_new(ID *id, bPoseChannel *pchan, Main *main, int type)
+static bConstraint *rna_PoseChannel_constraints_new(ID *id,
+ bPoseChannel *pchan,
+ Main *main,
+ int type)
{
- Object *ob = (Object *)id;
- bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, NULL, type);
+ Object *ob = (Object *)id;
+ bConstraint *new_con = BKE_constraint_add_for_pose(ob, pchan, NULL, type);
- ED_object_constraint_dependency_tag_update(main, ob, new_con);
- WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, id);
+ ED_object_constraint_dependency_tag_update(main, ob, new_con);
+ WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_ADDED, id);
- return new_con;
+ return new_con;
}
static void rna_PoseChannel_constraints_remove(
- ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
+ ID *id, bPoseChannel *pchan, Main *bmain, ReportList *reports, PointerRNA *con_ptr)
{
- bConstraint *con = con_ptr->data;
- const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
- Object *ob = (Object *)id;
+ bConstraint *con = con_ptr->data;
+ const bool is_ik = ELEM(con->type, CONSTRAINT_TYPE_KINEMATIC, CONSTRAINT_TYPE_SPLINEIK);
+ Object *ob = (Object *)id;
- if (BLI_findindex(&pchan->constraints, con) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'", con->name, pchan->name);
- return;
- }
+ if (BLI_findindex(&pchan->constraints, con) == -1) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Constraint '%s' not found in pose bone '%s'", con->name, pchan->name);
+ return;
+ }
- BKE_constraint_remove(&pchan->constraints, con);
- RNA_POINTER_INVALIDATE(con_ptr);
+ BKE_constraint_remove(&pchan->constraints, con);
+ RNA_POINTER_INVALIDATE(con_ptr);
- ED_object_constraint_update(bmain, ob);
+ ED_object_constraint_update(bmain, ob);
- BKE_constraints_active_set(&pchan->constraints, NULL); /* XXX, is this really needed? - Campbell */
+ BKE_constraints_active_set(&pchan->constraints,
+ NULL); /* XXX, is this really needed? - Campbell */
- WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id);
+ WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id);
- if (is_ik) {
- BIK_clear_data(ob->pose);
- }
+ if (is_ik) {
+ BIK_clear_data(ob->pose);
+ }
}
-bool rna_PoseChannel_constraints_override_apply(
- Main *UNUSED(bmain),
- PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *UNUSED(ptr_storage),
- PropertyRNA *UNUSED(prop_dst), PropertyRNA *UNUSED(prop_src), PropertyRNA *UNUSED(prop_storage),
- const int UNUSED(len_dst), const int UNUSED(len_src), const int UNUSED(len_storage),
- PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
+bool rna_PoseChannel_constraints_override_apply(Main *UNUSED(bmain),
+ PointerRNA *ptr_dst,
+ PointerRNA *ptr_src,
+ PointerRNA *UNUSED(ptr_storage),
+ PropertyRNA *UNUSED(prop_dst),
+ PropertyRNA *UNUSED(prop_src),
+ PropertyRNA *UNUSED(prop_storage),
+ const int UNUSED(len_dst),
+ const int UNUSED(len_src),
+ const int UNUSED(len_storage),
+ PointerRNA *UNUSED(ptr_item_dst),
+ PointerRNA *UNUSED(ptr_item_src),
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
{
- BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
- "Unsupported RNA override operation on constraints collection");
-
- bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data;
- bPoseChannel *pchan_src = (bPoseChannel *)ptr_src->data;
-
- /* Remember that insertion operations are defined and stored in correct order, which means that
- * even if we insert several items in a row, we alays insert first one, then second one, etc.
- * So we should always find 'anchor' constraint in both _src *and* _dst> */
- bConstraint *con_anchor = NULL;
- if (opop->subitem_local_name && opop->subitem_local_name[0]) {
- con_anchor = BLI_findstring(&pchan_dst->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
- }
- if (con_anchor == NULL && opop->subitem_local_index >= 0) {
- con_anchor = BLI_findlink(&pchan_dst->constraints, opop->subitem_local_index);
- }
- /* Otherwise we just insert in first position. */
-
- bConstraint *con_src = NULL;
- if (opop->subitem_local_name && opop->subitem_local_name[0]) {
- con_src = BLI_findstring(&pchan_src->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
- }
- if (con_src == NULL && opop->subitem_local_index >= 0) {
- con_src = BLI_findlink(&pchan_src->constraints, opop->subitem_local_index);
- }
- con_src = con_src ? con_src->next : pchan_src->constraints.first;
-
- BLI_assert(con_src != NULL);
-
- bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
-
- /* This handles NULL anchor as expected by adding at head of list. */
- BLI_insertlinkafter(&pchan_dst->constraints, con_anchor, con_dst);
-
- /* This should actually *not* be needed in typical cases. However, if overridden source was edited,
- * we *may* have some new conflicting names. */
- BKE_constraint_unique_name(con_dst, &pchan_dst->constraints);
-
-// printf("%s: We inserted a constraint...\n", __func__);
- return true;
+ BLI_assert(opop->operation == IDOVERRIDESTATIC_OP_INSERT_AFTER &&
+ "Unsupported RNA override operation on constraints collection");
+
+ bPoseChannel *pchan_dst = (bPoseChannel *)ptr_dst->data;
+ bPoseChannel *pchan_src = (bPoseChannel *)ptr_src->data;
+
+ /* Remember that insertion operations are defined and stored in correct order, which means that
+ * even if we insert several items in a row, we alays insert first one, then second one, etc.
+ * So we should always find 'anchor' constraint in both _src *and* _dst> */
+ bConstraint *con_anchor = NULL;
+ if (opop->subitem_local_name && opop->subitem_local_name[0]) {
+ con_anchor = BLI_findstring(
+ &pchan_dst->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
+ }
+ if (con_anchor == NULL && opop->subitem_local_index >= 0) {
+ con_anchor = BLI_findlink(&pchan_dst->constraints, opop->subitem_local_index);
+ }
+ /* Otherwise we just insert in first position. */
+
+ bConstraint *con_src = NULL;
+ if (opop->subitem_local_name && opop->subitem_local_name[0]) {
+ con_src = BLI_findstring(
+ &pchan_src->constraints, opop->subitem_local_name, offsetof(bConstraint, name));
+ }
+ if (con_src == NULL && opop->subitem_local_index >= 0) {
+ con_src = BLI_findlink(&pchan_src->constraints, opop->subitem_local_index);
+ }
+ con_src = con_src ? con_src->next : pchan_src->constraints.first;
+
+ BLI_assert(con_src != NULL);
+
+ bConstraint *con_dst = BKE_constraint_duplicate_ex(con_src, 0, true);
+
+ /* This handles NULL anchor as expected by adding at head of list. */
+ BLI_insertlinkafter(&pchan_dst->constraints, con_anchor, con_dst);
+
+ /* This should actually *not* be needed in typical cases. However, if overridden source was edited,
+ * we *may* have some new conflicting names. */
+ BKE_constraint_unique_name(con_dst, &pchan_dst->constraints);
+
+ // printf("%s: We inserted a constraint...\n", __func__);
+ return true;
}
static int rna_PoseChannel_proxy_editable(PointerRNA *ptr, const char **r_info)
{
- Object *ob = (Object *)ptr->id.data;
- bArmature *arm = ob->data;
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ bArmature *arm = ob->data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- if (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) {
- *r_info = "Can't edit property of a proxy on a protected layer";
- return 0;
- }
+ if (ob->proxy && pchan->bone && (pchan->bone->layer & arm->layer_protected)) {
+ *r_info = "Can't edit property of a proxy on a protected layer";
+ return 0;
+ }
- return PROP_EDITABLE;
+ return PROP_EDITABLE;
}
static int rna_PoseChannel_location_editable(PointerRNA *ptr, int index)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX))
- return 0;
- else if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY))
- return 0;
- else if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ))
- return 0;
- else
- return PROP_EDITABLE;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (pchan->protectflag & OB_LOCK_LOCX))
+ return 0;
+ else if ((index == 1) && (pchan->protectflag & OB_LOCK_LOCY))
+ return 0;
+ else if ((index == 2) && (pchan->protectflag & OB_LOCK_LOCZ))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static int rna_PoseChannel_scale_editable(PointerRNA *ptr, int index)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX))
- return 0;
- else if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY))
- return 0;
- else if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ))
- return 0;
- else
- return PROP_EDITABLE;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (pchan->protectflag & OB_LOCK_SCALEX))
+ return 0;
+ else if ((index == 1) && (pchan->protectflag & OB_LOCK_SCALEY))
+ return 0;
+ else if ((index == 2) && (pchan->protectflag & OB_LOCK_SCALEZ))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static int rna_PoseChannel_rotation_euler_editable(PointerRNA *ptr, int index)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX))
- return 0;
- else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY))
- return 0;
- else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ))
- return 0;
- else
- return PROP_EDITABLE;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTX))
+ return 0;
+ else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTY))
+ return 0;
+ else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTZ))
+ return 0;
+ else
+ return PROP_EDITABLE;
}
static int rna_PoseChannel_rotation_4d_editable(PointerRNA *ptr, int index)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
-
- /* only consider locks if locking components individually... */
- if (pchan->protectflag & OB_LOCK_ROT4D) {
- /* only if the axis in question is locked, not editable... */
- if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW))
- return 0;
- else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX))
- return 0;
- else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY))
- return 0;
- else if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ))
- return 0;
- }
-
- return PROP_EDITABLE;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+
+ /* only consider locks if locking components individually... */
+ if (pchan->protectflag & OB_LOCK_ROT4D) {
+ /* only if the axis in question is locked, not editable... */
+ if ((index == 0) && (pchan->protectflag & OB_LOCK_ROTW))
+ return 0;
+ else if ((index == 1) && (pchan->protectflag & OB_LOCK_ROTX))
+ return 0;
+ else if ((index == 2) && (pchan->protectflag & OB_LOCK_ROTY))
+ return 0;
+ else if ((index == 3) && (pchan->protectflag & OB_LOCK_ROTZ))
+ return 0;
+ }
+
+ return PROP_EDITABLE;
}
/* not essential, but much faster then the default lookup function */
static int rna_PoseBones_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
{
- bPose *pose = (bPose *)ptr->data;
- bPoseChannel *pchan = BKE_pose_channel_find_name(pose, key);
- if (pchan) {
- RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, r_ptr);
- return true;
- }
- else {
- return false;
- }
+ bPose *pose = (bPose *)ptr->data;
+ bPoseChannel *pchan = BKE_pose_channel_find_name(pose, key);
+ if (pchan) {
+ RNA_pointer_create(ptr->id.data, &RNA_PoseBone, pchan, r_ptr);
+ return true;
+ }
+ else {
+ return false;
+ }
}
static void rna_PoseChannel_matrix_basis_get(PointerRNA *ptr, float *values)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- BKE_pchan_to_mat4(pchan, (float (*)[4])values);
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ BKE_pchan_to_mat4(pchan, (float(*)[4])values);
}
static void rna_PoseChannel_matrix_basis_set(PointerRNA *ptr, const float *values)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- BKE_pchan_apply_mat4(pchan, (float (*)[4])values, false); /* no compat for predictable result */
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ BKE_pchan_apply_mat4(pchan, (float(*)[4])values, false); /* no compat for predictable result */
}
static void rna_PoseChannel_matrix_set(PointerRNA *ptr, const float *values)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
- float tmat[4][4];
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
+ float tmat[4][4];
- BKE_armature_mat_pose_to_bone_ex(NULL, ob, pchan, (float (*)[4])values, tmat);
+ BKE_armature_mat_pose_to_bone_ex(NULL, ob, pchan, (float(*)[4])values, tmat);
- BKE_pchan_apply_mat4(pchan, tmat, false); /* no compat for predictable result */
+ BKE_pchan_apply_mat4(pchan, tmat, false); /* no compat for predictable result */
}
-static bPoseChannel *rna_PoseChannel_ensure_own_pchan(Object *ob, Object *ref_ob, bPoseChannel *ref_pchan)
+static bPoseChannel *rna_PoseChannel_ensure_own_pchan(Object *ob,
+ Object *ref_ob,
+ bPoseChannel *ref_pchan)
{
- if (ref_ob != ob) {
- /* We are trying to set a pchan from another object! Forbidden, try to find by name, or abort. */
- if (ref_pchan != NULL) {
- ref_pchan = BKE_pose_channel_find_name(ob->pose, ref_pchan->name);
- }
- }
- return ref_pchan;
+ if (ref_ob != ob) {
+ /* We are trying to set a pchan from another object! Forbidden, try to find by name, or abort. */
+ if (ref_pchan != NULL) {
+ ref_pchan = BKE_pose_channel_find_name(ob->pose, ref_pchan->name);
+ }
+ }
+ return ref_pchan;
}
static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr, PointerRNA value)
{
- bPoseChannel *pchan = (bPoseChannel *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
+ bPoseChannel *pchan = (bPoseChannel *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
- pchan->custom_tx = rna_PoseChannel_ensure_own_pchan(ob, value.id.data, value.data);
+ pchan->custom_tx = rna_PoseChannel_ensure_own_pchan(ob, value.id.data, value.data);
}
#else
@@ -744,747 +762,803 @@ static void rna_PoseChannel_custom_shape_transform_set(PointerRNA *ptr, PointerR
/* common properties for Action/Bone Groups - related to color */
void rna_def_actionbone_group_common(StructRNA *srna, int update_flag, const char *update_cb)
{
- PropertyRNA *prop;
-
- /* color set + colors */
- prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "customCol");
- RNA_def_property_enum_items(prop, rna_enum_color_sets_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ActionGroup_colorset_set", NULL);
- RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
- RNA_def_property_update(prop, update_flag, update_cb);
-
- prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
-
- /* TODO: editing the colors for this should result in changes to the color type... */
- prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
- /* NOTE: the DNA data is not really a pointer, but this code works :) */
- RNA_def_property_pointer_sdna(prop, NULL, "cs");
- RNA_def_property_ui_text(prop, "Colors", "Copy of the colors associated with the group's color set");
- RNA_def_property_update(prop, update_flag, update_cb);
+ PropertyRNA *prop;
+
+ /* color set + colors */
+ prop = RNA_def_property(srna, "color_set", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "customCol");
+ RNA_def_property_enum_items(prop, rna_enum_color_sets_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ActionGroup_colorset_set", NULL);
+ RNA_def_property_ui_text(prop, "Color Set", "Custom color set to use");
+ RNA_def_property_update(prop, update_flag, update_cb);
+
+ prop = RNA_def_property(srna, "is_custom_color_set", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ActionGroup_is_custom_colorset_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Custom Color Set", "Color set is user-defined instead of a fixed theme color set");
+
+ /* TODO: editing the colors for this should result in changes to the color type... */
+ prop = RNA_def_property(srna, "colors", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
+ /* NOTE: the DNA data is not really a pointer, but this code works :) */
+ RNA_def_property_pointer_sdna(prop, NULL, "cs");
+ RNA_def_property_ui_text(
+ prop, "Colors", "Copy of the colors associated with the group's color set");
+ RNA_def_property_update(prop, update_flag, update_cb);
}
static void rna_def_bone_group(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- /* struct */
- srna = RNA_def_struct(brna, "BoneGroup", NULL);
- RNA_def_struct_sdna(srna, "bActionGroup");
- RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)");
- RNA_def_struct_ui_icon(srna, ICON_GROUP_BONE);
+ /* struct */
+ srna = RNA_def_struct(brna, "BoneGroup", NULL);
+ RNA_def_struct_sdna(srna, "bActionGroup");
+ RNA_def_struct_ui_text(srna, "Bone Group", "Groups of Pose Channels (Bones)");
+ RNA_def_struct_ui_icon(srna, ICON_GROUP_BONE);
- /* name */
- 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_BoneGroup_name_set");
- RNA_def_struct_name_property(srna, prop);
+ /* name */
+ 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_BoneGroup_name_set");
+ RNA_def_struct_name_property(srna, prop);
- /* TODO: add some runtime-collections stuff to access grouped bones */
+ /* TODO: add some runtime-collections stuff to access grouped bones */
- /* color set */
- rna_def_actionbone_group_common(srna, NC_OBJECT | ND_POSE, "rna_Pose_update");
+ /* color set */
+ rna_def_actionbone_group_common(srna, NC_OBJECT | ND_POSE, "rna_Pose_update");
}
static const EnumPropertyItem prop_iksolver_items[] = {
- {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
- {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
- {0, NULL, 0, NULL, NULL},
+ {IKSOLVER_STANDARD, "LEGACY", 0, "Standard", "Original IK solver"},
+ {IKSOLVER_ITASC, "ITASC", 0, "iTaSC", "Multi constraint, stateful IK solver"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_solver_items[] = {
- {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
- {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
- {0, NULL, 0, NULL, NULL},
+ {ITASC_SOLVER_SDLS, "SDLS", 0, "SDLS", "Selective Damped Least Square"},
+ {ITASC_SOLVER_DLS, "DLS", 0, "DLS", "Damped Least Square with Numerical Filtering"},
+ {0, NULL, 0, NULL, NULL},
};
-
static void rna_def_pose_channel_constraints(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "PoseBoneConstraints");
- srna = RNA_def_struct(brna, "PoseBoneConstraints", NULL);
- RNA_def_struct_sdna(srna, "bPoseChannel");
- RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
-
- /* Collection active property */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Constraint");
- RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_active_constraint_get",
- "rna_PoseChannel_active_constraint_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
-
-
- /* Constraint collection */
- func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
- RNA_def_function_ui_description(func, "Add a constraint to this object");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */
- /* return type */
- parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
- RNA_def_function_return(func, parm);
- /* constraint to add */
- parm = RNA_def_enum(func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
- RNA_def_function_ui_description(func, "Remove a constraint from this object");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS ); /* ID needed for refresh */
- /* constraint to remove */
- parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "PoseBoneConstraints");
+ srna = RNA_def_struct(brna, "PoseBoneConstraints", NULL);
+ RNA_def_struct_sdna(srna, "bPoseChannel");
+ RNA_def_struct_ui_text(srna, "PoseBone Constraints", "Collection of pose bone constraints");
+
+ /* Collection active property */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Constraint");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_PoseChannel_active_constraint_get",
+ "rna_PoseChannel_active_constraint_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Constraint", "Active PoseChannel constraint");
+
+ /* Constraint collection */
+ func = RNA_def_function(srna, "new", "rna_PoseChannel_constraints_new");
+ RNA_def_function_ui_description(func, "Add a constraint to this object");
+ RNA_def_function_flag(func,
+ FUNC_USE_MAIN | FUNC_USE_SELF_ID); /* ID and Main needed for refresh */
+ /* return type */
+ parm = RNA_def_pointer(func, "constraint", "Constraint", "", "New constraint");
+ RNA_def_function_return(func, parm);
+ /* constraint to add */
+ parm = RNA_def_enum(
+ func, "type", rna_enum_constraint_type_items, 1, "", "Constraint type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "remove", "rna_PoseChannel_constraints_remove");
+ RNA_def_function_ui_description(func, "Remove a constraint from this object");
+ RNA_def_function_flag(
+ func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS); /* ID needed for refresh */
+ /* constraint to remove */
+ parm = RNA_def_pointer(func, "constraint", "Constraint", "", "Removed constraint");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_pose_channel(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "PoseBone", NULL);
- RNA_def_struct_sdna(srna, "bPoseChannel");
- RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
- RNA_def_struct_path_func(srna, "rna_PoseBone_path");
- RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
- RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
-
- /* Bone Constraints */
- prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Constraint");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION);
- RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel");
- RNA_def_property_override_funcs(prop, NULL, NULL, "rna_PoseChannel_constraints_override_apply");
-
- rna_def_pose_channel_constraints(brna, prop);
-
- /* Name + Selection Status */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_struct_name_property(srna, prop);
-
- /* Baked Bone Path cache data */
- rna_def_motionpath_common(srna);
-
- /* Relationships to other bones */
- prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "Bone");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
-
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "PoseBone");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
-
- prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "PoseBone");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
-
- /* Transformation settings */
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
- RNA_def_property_float_array_default(prop, rna_default_scale_3d);
- RNA_def_property_ui_text(prop, "Scale", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_float_sdna(prop, NULL, "quat");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
- RNA_def_property_float_array_default(prop, rna_default_quaternion);
- RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
- * having a single one is better for Keyframing and other property-management situations...
- */
- prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_PoseChannel_rotation_axis_angle_get",
- "rna_PoseChannel_rotation_axis_angle_set", NULL);
- RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
- RNA_def_property_float_array_default(prop, rna_default_axis_angle);
- RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "eul");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
- RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "rotmode");
- RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
- /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_ui_text(prop, "Rotation Mode", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* Curved bones settings - Applied on top of restpose values */
- rna_def_bone_curved_common(srna, true);
-
- /* Custom BBone next/prev sources */
- prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
- RNA_def_property_struct_type(prop, "PoseBone");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
- RNA_def_property_ui_text(prop, "B-Bone Start Handle",
- "Bone that serves as the start handle for the B-Bone curve");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
-
- prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
- RNA_def_property_struct_type(prop, "PoseBone");
- RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
- RNA_def_property_ui_text(prop, "B-Bone End Handle",
- "Bone that serves as the end handle for the B-Bone curve");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
-
- /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
- prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "chan_mat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
-
- /* writable because it touches loc/scale/rot directly */
- prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Basis Matrix",
- "Alternative access to location/scale/rotation relative to the parent and own rest bone");
- RNA_def_property_float_funcs(prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* final matrix */
- prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "pose_mat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
- RNA_def_property_ui_text(prop, "Pose Matrix",
- "Final 4x4 matrix after constraints and drivers are applied (object space)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
- prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "pose_head");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "pose_tail");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- /* IK Settings */
- prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
- RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
- RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
- RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
- RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
- RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
- RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ROTCTL);
- RNA_def_property_ui_text(prop, "IK rot control", "Apply channel rotation as IK constraint");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_LINCTL);
- RNA_def_property_ui_text(prop, "IK rot control", "Apply channel size as IK constraint if stretching is enabled");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
- RNA_def_property_range(prop, -M_PI, 0.0f);
- RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
- RNA_def_property_range(prop, 0.0f, M_PI);
- RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limitmin[1]");
- RNA_def_property_range(prop, -M_PI, 0.0f);
- RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limitmax[1]");
- RNA_def_property_range(prop, 0.0f, M_PI);
- RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limitmin[2]");
- RNA_def_property_range(prop, -M_PI, 0.0f);
- RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limitmax[2]");
- RNA_def_property_range(prop, 0.0f, M_PI);
- RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "stiffness[0]");
- RNA_def_property_range(prop, 0.0f, 0.99f);
- RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "stiffness[1]");
- RNA_def_property_range(prop, 0.0f, 0.99f);
- RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "stiffness[2]");
- RNA_def_property_range(prop, 0.0f, 0.99f);
- RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "ikstretch");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
-
- prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "IK Rot Weight", "Weight of rotation constraint for IK");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "iklinweight");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* custom bone shapes */
- prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "custom");
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_PoseChannel_bone_custom_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Custom Object", "Object that defines custom draw type for this bone");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "custom_shape_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "custom_scale");
- RNA_def_property_range(prop, 0.0f, 1000.0f);
- RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
- RNA_def_property_ui_text(prop, "Use Bone Size", "Scale the custom object by the bone length");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
- RNA_def_property_struct_type(prop, "PoseBone");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Custom Shape Transform",
- "Bone that defines the display transform of this custom shape");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_PoseChannel_custom_shape_transform_set", NULL, NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* bone groups */
- prop = RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "agrp_index");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_PoseChannel_bone_group_index_get", "rna_PoseChannel_bone_group_index_set",
- "rna_PoseChannel_bone_group_index_range");
- RNA_def_property_ui_text(prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoneGroup");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_PoseChannel_bone_group_get",
- "rna_PoseChannel_bone_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Bone Group", "Bone Group this pose channel belongs to");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* transform locks */
- prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* XXX this is sub-optimal - it really should be included above, but due to technical reasons
- * we can't do this! */
- prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
- RNA_def_property_ui_text(prop, "Lock Rotation (4D Angle)",
- "Lock editing of 'angle' component of four-component rotations in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- /* XXX this needs a better name */
- prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
- RNA_def_property_ui_text(prop, "Lock Rotations (4D)",
- "Lock editing of four component rotations by components (instead of as Eulers)");
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
- RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- RNA_api_pose_channel(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "PoseBone", NULL);
+ RNA_def_struct_sdna(srna, "bPoseChannel");
+ RNA_def_struct_ui_text(srna, "Pose Bone", "Channel defining pose data for a bone in a Pose");
+ RNA_def_struct_path_func(srna, "rna_PoseBone_path");
+ RNA_def_struct_idprops_func(srna, "rna_PoseBone_idprops");
+ RNA_def_struct_ui_icon(srna, ICON_BONE_DATA);
+
+ /* Bone Constraints */
+ prop = RNA_def_property(srna, "constraints", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Constraint");
+ RNA_def_property_override_flag(prop,
+ PROPOVERRIDE_OVERRIDABLE_STATIC | PROPOVERRIDE_STATIC_INSERTION);
+ RNA_def_property_ui_text(prop, "Constraints", "Constraints that act on this PoseChannel");
+ RNA_def_property_override_funcs(prop, NULL, NULL, "rna_PoseChannel_constraints_override_apply");
+
+ rna_def_pose_channel_constraints(brna, prop);
+
+ /* Name + Selection Status */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_PoseChannel_name_set");
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_struct_name_property(srna, prop);
+
+ /* Baked Bone Path cache data */
+ rna_def_motionpath_common(srna);
+
+ /* Relationships to other bones */
+ prop = RNA_def_property(srna, "bone", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Bone");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Bone", "Bone associated with this PoseBone");
+
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "PoseBone");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Parent", "Parent of this pose bone");
+
+ prop = RNA_def_property(srna, "child", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "PoseBone");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Child", "Child of this pose bone");
+
+ /* Transformation settings */
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_array_func(prop, "rna_PoseChannel_location_editable");
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_array_func(prop, "rna_PoseChannel_scale_editable");
+ RNA_def_property_float_array_default(prop, rna_default_scale_3d);
+ RNA_def_property_ui_text(prop, "Scale", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_float_sdna(prop, NULL, "quat");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
+ RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in Quaternions");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* XXX: for axis-angle, it would have been nice to have 2 separate fields for UI purposes, but
+ * having a single one is better for Keyframing and other property-management situations...
+ */
+ prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_float_funcs(prop,
+ "rna_PoseChannel_rotation_axis_angle_get",
+ "rna_PoseChannel_rotation_axis_angle_set",
+ NULL);
+ RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_4d_editable");
+ RNA_def_property_float_array_default(prop, rna_default_axis_angle);
+ RNA_def_property_ui_text(
+ prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "eul");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_editable_array_func(prop, "rna_PoseChannel_rotation_euler_editable");
+ RNA_def_property_ui_text(prop, "Euler Rotation", "Rotation in Eulers");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotmode");
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_PoseChannel_rotation_mode_set", NULL);
+ /* XXX... disabled, since proxy-locked layers are currently used for ensuring proxy-syncing too */
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_ui_text(prop, "Rotation Mode", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* Curved bones settings - Applied on top of restpose values */
+ rna_def_bone_curved_common(srna, true);
+
+ /* Custom BBone next/prev sources */
+ prop = RNA_def_property(srna, "bbone_custom_handle_start", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "bbone_prev");
+ RNA_def_property_struct_type(prop, "PoseBone");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
+ RNA_def_property_ui_text(
+ prop, "B-Bone Start Handle", "Bone that serves as the start handle for the B-Bone curve");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
+
+ prop = RNA_def_property(srna, "bbone_custom_handle_end", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "bbone_next");
+ RNA_def_property_struct_type(prop, "PoseBone");
+ RNA_def_property_flag(prop, PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
+ RNA_def_property_ui_text(
+ prop, "B-Bone End Handle", "Bone that serves as the end handle for the B-Bone curve");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_dependency_update");
+
+ /* transform matrices - should be read-only since these are set directly by AnimSys evaluation */
+ prop = RNA_def_property(srna, "matrix_channel", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "chan_mat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Channel Matrix", "4x4 matrix, before constraints");
+
+ /* writable because it touches loc/scale/rot directly */
+ prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ prop,
+ "Basis Matrix",
+ "Alternative access to location/scale/rotation relative to the parent and own rest bone");
+ RNA_def_property_float_funcs(
+ prop, "rna_PoseChannel_matrix_basis_get", "rna_PoseChannel_matrix_basis_set", NULL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* final matrix */
+ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "pose_mat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_float_funcs(prop, NULL, "rna_PoseChannel_matrix_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Pose Matrix",
+ "Final 4x4 matrix after constraints and drivers are applied (object space)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* Head/Tail Coordinates (in Pose Space) - Automatically calculated... */
+ prop = RNA_def_property(srna, "head", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "pose_head");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Pose Head Position", "Location of head of the channel's bone");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ prop = RNA_def_property(srna, "tail", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "pose_tail");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Pose Tail Position", "Location of tail of the channel's bone");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ /* IK Settings */
+ prop = RNA_def_property(srna, "is_in_ik_chain", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_PoseChannel_has_ik_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has IK", "Is part of an IK chain");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "lock_ik_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_XDOF);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
+ RNA_def_property_ui_text(prop, "IK X Lock", "Disallow movement around the X axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "lock_ik_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_YDOF);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
+ RNA_def_property_ui_text(prop, "IK Y Lock", "Disallow movement around the Y axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "lock_ik_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_NO_ZDOF);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
+ RNA_def_property_ui_text(prop, "IK Z Lock", "Disallow movement around the Z axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "use_ik_limit_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_XLIMIT);
+ RNA_def_property_ui_text(prop, "IK X Limit", "Limit movement around the X axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "use_ik_limit_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_YLIMIT);
+ RNA_def_property_ui_text(prop, "IK Y Limit", "Limit movement around the Y axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "use_ik_limit_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ZLIMIT);
+ RNA_def_property_ui_text(prop, "IK Z Limit", "Limit movement around the Z axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "use_ik_rotation_control", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_ROTCTL);
+ RNA_def_property_ui_text(prop, "IK rot control", "Apply channel rotation as IK constraint");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "use_ik_linear_control", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ikflag", BONE_IK_LINCTL);
+ RNA_def_property_ui_text(
+ prop, "IK rot control", "Apply channel size as IK constraint if stretching is enabled");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_min_x", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limitmin[0]");
+ RNA_def_property_range(prop, -M_PI, 0.0f);
+ RNA_def_property_ui_text(prop, "IK X Minimum", "Minimum angles for IK Limit");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_max_x", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limitmax[0]");
+ RNA_def_property_range(prop, 0.0f, M_PI);
+ RNA_def_property_ui_text(prop, "IK X Maximum", "Maximum angles for IK Limit");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_min_y", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limitmin[1]");
+ RNA_def_property_range(prop, -M_PI, 0.0f);
+ RNA_def_property_ui_text(prop, "IK Y Minimum", "Minimum angles for IK Limit");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_max_y", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limitmax[1]");
+ RNA_def_property_range(prop, 0.0f, M_PI);
+ RNA_def_property_ui_text(prop, "IK Y Maximum", "Maximum angles for IK Limit");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_min_z", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limitmin[2]");
+ RNA_def_property_range(prop, -M_PI, 0.0f);
+ RNA_def_property_ui_text(prop, "IK Z Minimum", "Minimum angles for IK Limit");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_max_z", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limitmax[2]");
+ RNA_def_property_range(prop, 0.0f, M_PI);
+ RNA_def_property_ui_text(prop, "IK Z Maximum", "Maximum angles for IK Limit");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_stiffness_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness[0]");
+ RNA_def_property_range(prop, 0.0f, 0.99f);
+ RNA_def_property_ui_text(prop, "IK X Stiffness", "IK stiffness around the X axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_stiffness_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness[1]");
+ RNA_def_property_range(prop, 0.0f, 0.99f);
+ RNA_def_property_ui_text(prop, "IK Y Stiffness", "IK stiffness around the Y axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_stiffness_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "stiffness[2]");
+ RNA_def_property_range(prop, 0.0f, 0.99f);
+ RNA_def_property_ui_text(prop, "IK Z Stiffness", "IK stiffness around the Z axis");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_stretch", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "ikstretch");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "IK Stretch", "Allow scaling of the bone for IK");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_IK_update");
+
+ prop = RNA_def_property(srna, "ik_rotation_weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "ikrotweight");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "IK Rot Weight", "Weight of rotation constraint for IK");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "ik_linear_weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "iklinweight");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "IK Lin Weight", "Weight of scale constraint for IK");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* custom bone shapes */
+ prop = RNA_def_property(srna, "custom_shape", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "custom");
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_PoseChannel_bone_custom_set", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Custom Object", "Object that defines custom draw type for this bone");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "custom_shape_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "custom_scale");
+ RNA_def_property_range(prop, 0.0f, 1000.0f);
+ RNA_def_property_ui_text(prop, "Custom Shape Scale", "Adjust the size of the custom shape");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "use_custom_shape_bone_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "drawflag", PCHAN_DRAW_NO_CUSTOM_BONE_SIZE);
+ RNA_def_property_ui_text(prop, "Use Bone Size", "Scale the custom object by the bone length");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "custom_shape_transform", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "custom_tx");
+ RNA_def_property_struct_type(prop, "PoseBone");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_PTR_NO_OWNERSHIP);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop,
+ "Custom Shape Transform",
+ "Bone that defines the display transform of this custom shape");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_PoseChannel_custom_shape_transform_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* bone groups */
+ prop = RNA_def_property(srna, "bone_group_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "agrp_index");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_PoseChannel_bone_group_index_get",
+ "rna_PoseChannel_bone_group_index_set",
+ "rna_PoseChannel_bone_group_index_range");
+ RNA_def_property_ui_text(
+ prop, "Bone Group Index", "Bone Group this pose channel belongs to (0=no group)");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "bone_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoneGroup");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_PoseChannel_bone_group_get", "rna_PoseChannel_bone_group_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Bone Group", "Bone Group this pose channel belongs to");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* transform locks */
+ prop = RNA_def_property(srna, "lock_location", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_LOCX);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Lock Location", "Lock editing of location in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTX);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Lock Rotation", "Lock editing of rotation in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* XXX this is sub-optimal - it really should be included above, but due to technical reasons
+ * we can't do this! */
+ prop = RNA_def_property(srna, "lock_rotation_w", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROTW);
+ RNA_def_property_ui_text(
+ prop,
+ "Lock Rotation (4D Angle)",
+ "Lock editing of 'angle' component of four-component rotations in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ /* XXX this needs a better name */
+ prop = RNA_def_property(srna, "lock_rotations_4d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_ROT4D);
+ RNA_def_property_ui_text(
+ prop,
+ "Lock Rotations (4D)",
+ "Lock editing of four component rotations by components (instead of as Eulers)");
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "lock_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "protectflag", OB_LOCK_SCALEX);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Lock Scale", "Lock editing of scale in the interface");
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, 1);
+ RNA_def_property_editable_func(prop, "rna_PoseChannel_proxy_editable");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ RNA_api_pose_channel(srna);
}
static void rna_def_pose_itasc(BlenderRNA *brna)
{
- static const EnumPropertyItem prop_itasc_mode_items[] = {
- {0, "ANIMATION", 0, "Animation",
- "Stateless solver computing pose starting from current action and non-IK constraints"},
- {ITASC_SIMULATION, "SIMULATION", 0, "Simulation",
- "State-full solver running in real-time context and ignoring actions "
- "and non-IK constraints"},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem prop_itasc_reiteration_items[] = {
- {0, "NEVER", 0, "Never", "The solver does not reiterate, not even on first frame (starts from rest pose)"},
- {ITASC_INITIAL_REITERATION, "INITIAL", 0, "Initial",
- "The solver reiterates (converges) on the first frame but not on "
- "subsequent frame"},
- {ITASC_INITIAL_REITERATION | ITASC_REITERATION, "ALWAYS", 0, "Always",
- "The solver reiterates (converges) on all frames"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Itasc", "IKParam");
- RNA_def_struct_sdna(srna, "bItasc");
- RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
-
- prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "precision");
- RNA_def_property_range(prop, 0.0f, 0.1f);
- RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "numiter");
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Iterations",
- "Maximum number of iterations for convergence in case of reiteration");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "numstep");
- RNA_def_property_range(prop, 1.f, 50.f);
- RNA_def_property_ui_text(prop, "Num steps", "Divide the frame interval into this many steps");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_itasc_mode_items);
- RNA_def_property_ui_text(prop, "Mode", NULL);
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
-
- prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
- RNA_def_property_ui_text(prop, "Reiteration",
- "Defines if the solver is allowed to reiterate (converge until "
- "precision is met) on none, first or all frames");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP);
- RNA_def_property_ui_text(prop, "Auto step",
- "Automatically determine the optimal number of steps for best "
- "performance/accuracy trade off");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "minstep");
- RNA_def_property_range(prop, 0.0f, 0.1f);
- RNA_def_property_ui_text(prop, "Min step", "Lower bound for timestep in second in case of automatic substeps");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "maxstep");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Max step", "Higher bound for timestep in second in case of automatic substeps");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "feedback");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Feedback",
- "Feedback coefficient for error correction, average response time is 1/feedback "
- "(default=20)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "maxvel");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in rad/s (default=50)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "solver");
- RNA_def_property_enum_items(prop, prop_solver_items);
- RNA_def_property_ui_text(prop, "Solver", "Solving method selection: automatic damping or manual damping");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
-
- prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "dampmax");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Damp",
- "Maximum damping coefficient when singular value is nearly 0 "
- "(higher values=more stability, less reactivity - default=0.5)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
-
- prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "dampeps");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Epsilon",
- "Singular value under which damping is progressively applied "
- "(higher values=more stability, less reactivity - default=0.1)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+ static const EnumPropertyItem prop_itasc_mode_items[] = {
+ {0,
+ "ANIMATION",
+ 0,
+ "Animation",
+ "Stateless solver computing pose starting from current action and non-IK constraints"},
+ {ITASC_SIMULATION,
+ "SIMULATION",
+ 0,
+ "Simulation",
+ "State-full solver running in real-time context and ignoring actions "
+ "and non-IK constraints"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem prop_itasc_reiteration_items[] = {
+ {0,
+ "NEVER",
+ 0,
+ "Never",
+ "The solver does not reiterate, not even on first frame (starts from rest pose)"},
+ {ITASC_INITIAL_REITERATION,
+ "INITIAL",
+ 0,
+ "Initial",
+ "The solver reiterates (converges) on the first frame but not on "
+ "subsequent frame"},
+ {ITASC_INITIAL_REITERATION | ITASC_REITERATION,
+ "ALWAYS",
+ 0,
+ "Always",
+ "The solver reiterates (converges) on all frames"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Itasc", "IKParam");
+ RNA_def_struct_sdna(srna, "bItasc");
+ RNA_def_struct_ui_text(srna, "bItasc", "Parameters for the iTaSC IK solver");
+
+ prop = RNA_def_property(srna, "precision", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "precision");
+ RNA_def_property_range(prop, 0.0f, 0.1f);
+ RNA_def_property_ui_text(prop, "Precision", "Precision of convergence in case of reiteration");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "numiter");
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(
+ prop, "Iterations", "Maximum number of iterations for convergence in case of reiteration");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "step_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "numstep");
+ RNA_def_property_range(prop, 1.f, 50.f);
+ RNA_def_property_ui_text(prop, "Num steps", "Divide the frame interval into this many steps");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_itasc_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", NULL);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
+
+ prop = RNA_def_property(srna, "reiteration_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_itasc_reiteration_items);
+ RNA_def_property_ui_text(prop,
+ "Reiteration",
+ "Defines if the solver is allowed to reiterate (converge until "
+ "precision is met) on none, first or all frames");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "use_auto_step", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", ITASC_AUTO_STEP);
+ RNA_def_property_ui_text(prop,
+ "Auto step",
+ "Automatically determine the optimal number of steps for best "
+ "performance/accuracy trade off");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "step_min", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "minstep");
+ RNA_def_property_range(prop, 0.0f, 0.1f);
+ RNA_def_property_ui_text(
+ prop, "Min step", "Lower bound for timestep in second in case of automatic substeps");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "step_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "maxstep");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Max step", "Higher bound for timestep in second in case of automatic substeps");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "feedback", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "feedback");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Feedback",
+ "Feedback coefficient for error correction, average response time is 1/feedback "
+ "(default=20)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "velocity_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "maxvel");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Max Velocity", "Maximum joint velocity in rad/s (default=50)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "solver", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "solver");
+ RNA_def_property_enum_items(prop, prop_solver_items);
+ RNA_def_property_ui_text(
+ prop, "Solver", "Solving method selection: automatic damping or manual damping");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update_rebuild");
+
+ prop = RNA_def_property(srna, "damping_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "dampmax");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Damp",
+ "Maximum damping coefficient when singular value is nearly 0 "
+ "(higher values=more stability, less reactivity - default=0.5)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
+
+ prop = RNA_def_property(srna, "damping_epsilon", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "dampeps");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Epsilon",
+ "Singular value under which damping is progressively applied "
+ "(higher values=more stability, less reactivity - default=0.1)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Itasc_update");
}
static void rna_def_pose_ikparam(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "IKParam", NULL);
- RNA_def_struct_sdna(srna, "bIKParam");
- RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
- RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
-
- prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "iksolver");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, prop_iksolver_items);
- RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "IKParam", NULL);
+ RNA_def_struct_sdna(srna, "bIKParam");
+ RNA_def_struct_ui_text(srna, "IKParam", "Base type for IK solver parameters");
+ RNA_def_struct_refine_func(srna, "rna_IKParam_refine");
+
+ prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "iksolver");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, prop_iksolver_items);
+ RNA_def_property_ui_text(prop, "IK Solver", "IK solver for which these parameters are defined");
}
/* pose.bone_groups */
static void rna_def_bone_groups(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "BoneGroups");
- srna = RNA_def_struct(brna, "BoneGroups", NULL);
- RNA_def_struct_sdna(srna, "bPose");
- RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
-
- func = RNA_def_function(srna, "new", "rna_bone_group_new");
- RNA_def_function_ui_description(func, "Add a new bone group to the object");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID); /* ID needed for refresh */
- RNA_def_string(func, "name", "Group", MAX_NAME, "", "Name of the new group");
- /* return type */
- parm = RNA_def_pointer(func, "group", "BoneGroup", "", "New bone group");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_bone_group_remove");
- RNA_def_function_ui_description(func, "Remove a bone group from this object");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); /* ID needed for refresh */
- /* bone group to remove */
- parm = RNA_def_pointer(func, "group", "BoneGroup", "", "Removed bone group");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BoneGroup");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Pose_active_bone_group_get",
- "rna_Pose_active_bone_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "active_group");
- RNA_def_property_int_funcs(prop, "rna_Pose_active_bone_group_index_get", "rna_Pose_active_bone_group_index_set",
- "rna_Pose_active_bone_group_index_range");
- RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "BoneGroups");
+ srna = RNA_def_struct(brna, "BoneGroups", NULL);
+ RNA_def_struct_sdna(srna, "bPose");
+ RNA_def_struct_ui_text(srna, "Bone Groups", "Collection of bone groups");
+
+ func = RNA_def_function(srna, "new", "rna_bone_group_new");
+ RNA_def_function_ui_description(func, "Add a new bone group to the object");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID); /* ID needed for refresh */
+ RNA_def_string(func, "name", "Group", MAX_NAME, "", "Name of the new group");
+ /* return type */
+ parm = RNA_def_pointer(func, "group", "BoneGroup", "", "New bone group");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_bone_group_remove");
+ RNA_def_function_ui_description(func, "Remove a bone group from this object");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID); /* ID needed for refresh */
+ /* bone group to remove */
+ parm = RNA_def_pointer(func, "group", "BoneGroup", "", "Removed bone group");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BoneGroup");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Pose_active_bone_group_get", "rna_Pose_active_bone_group_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Bone Group", "Active bone group for this pose");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "active_group");
+ RNA_def_property_int_funcs(prop,
+ "rna_Pose_active_bone_group_index_get",
+ "rna_Pose_active_bone_group_index_set",
+ "rna_Pose_active_bone_group_index_range");
+ RNA_def_property_ui_text(prop, "Active Bone Group Index", "Active index in bone groups array");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_update");
}
static void rna_def_pose(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* struct definition */
- srna = RNA_def_struct(brna, "Pose", NULL);
- RNA_def_struct_sdna(srna, "bPose");
- RNA_def_struct_ui_text(srna, "Pose", "A collection of pose channels, including settings for animating bones");
-
- /* pose channels */
- prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
- RNA_def_property_struct_type(prop, "PoseBone");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
- /* can be removed, only for fast lookup */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL);
-
- /* bone groups */
- prop = RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
- RNA_def_property_struct_type(prop, "BoneGroup");
- RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
- rna_def_bone_groups(brna, prop);
-
- /* ik solvers */
- prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "iksolver");
- RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
- RNA_def_property_enum_items(prop, prop_iksolver_items);
- RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
- RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
-
- prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "IKParam");
- RNA_def_property_pointer_funcs(prop, "rna_Pose_ikparam_get", NULL, "rna_Pose_ikparam_typef", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
-
- /* animviz */
- rna_def_animviz_common(srna);
-
- RNA_api_pose(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* struct definition */
+ srna = RNA_def_struct(brna, "Pose", NULL);
+ RNA_def_struct_sdna(srna, "bPose");
+ RNA_def_struct_ui_text(
+ srna, "Pose", "A collection of pose channels, including settings for animating bones");
+
+ /* pose channels */
+ prop = RNA_def_property(srna, "bones", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "chanbase", NULL);
+ RNA_def_property_struct_type(prop, "PoseBone");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Pose Bones", "Individual pose bones for the armature");
+ /* can be removed, only for fast lookup */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, NULL, NULL, NULL, "rna_PoseBones_lookup_string", NULL);
+
+ /* bone groups */
+ prop = RNA_def_property(srna, "bone_groups", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "agroups", NULL);
+ RNA_def_property_struct_type(prop, "BoneGroup");
+ RNA_def_property_ui_text(prop, "Bone Groups", "Groups of the bones");
+ rna_def_bone_groups(brna, prop);
+
+ /* ik solvers */
+ prop = RNA_def_property(srna, "ik_solver", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "iksolver");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Pose_ik_solver_set", NULL);
+ RNA_def_property_enum_items(prop, prop_iksolver_items);
+ RNA_def_property_ui_text(prop, "IK Solver", "Selection of IK solver for IK chain");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POSE, "rna_Pose_ik_solver_update");
+
+ prop = RNA_def_property(srna, "ik_param", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "IKParam");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Pose_ikparam_get", NULL, "rna_Pose_ikparam_typef", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "IK Param", "Parameters for IK solver");
+
+ /* animviz */
+ rna_def_animviz_common(srna);
+
+ RNA_api_pose(srna);
}
void RNA_def_pose(BlenderRNA *brna)
{
- rna_def_pose(brna);
- rna_def_pose_channel(brna);
- rna_def_pose_ikparam(brna);
- rna_def_pose_itasc(brna);
- rna_def_bone_group(brna);
+ rna_def_pose(brna);
+ rna_def_pose_channel(brna);
+ rna_def_pose_ikparam(brna);
+ rna_def_pose_itasc(brna);
+ rna_def_bone_group(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_pose_api.c b/source/blender/makesrna/intern/rna_pose_api.c
index 4366b18c049..42b5c762c62 100644
--- a/source/blender/makesrna/intern/rna_pose_api.c
+++ b/source/blender/makesrna/intern/rna_pose_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -35,116 +34,142 @@
/* #include "BLI_sys_types.h" */
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
/* #include "DNA_anim_types.h" */
-#include "DNA_action_types.h" /* bPose */
-#include "BKE_armature.h"
+# include "DNA_action_types.h" /* bPose */
+# include "BKE_armature.h"
static float rna_PoseBone_do_envelope(bPoseChannel *chan, float *vec)
{
- Bone *bone = chan->bone;
+ Bone *bone = chan->bone;
- float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
+ float scale = (bone->flag & BONE_MULT_VG_ENV) == BONE_MULT_VG_ENV ? bone->weight : 1.0f;
- return distfactor_to_bone(vec, chan->pose_head, chan->pose_tail, bone->rad_head * scale,
- bone->rad_tail * scale, bone->dist * scale);
+ return distfactor_to_bone(vec,
+ chan->pose_head,
+ chan->pose_tail,
+ bone->rad_head * scale,
+ bone->rad_tail * scale,
+ bone->dist * scale);
}
-static void rna_PoseBone_bbone_segment_matrix(bPoseChannel *pchan, ReportList *reports, float mat_ret[16], int index, bool rest)
+static void rna_PoseBone_bbone_segment_matrix(
+ bPoseChannel *pchan, ReportList *reports, float mat_ret[16], int index, bool rest)
{
- if (!pchan->bone || pchan->bone->segments <= 1) {
- BKE_reportf(reports, RPT_ERROR, "Bone '%s' is not a B-Bone!", pchan->name);
- return;
- }
- if (pchan->runtime.bbone_segments != pchan->bone->segments) {
- BKE_reportf(reports, RPT_ERROR, "Bone '%s' has out of date B-Bone segment data!", pchan->name);
- return;
- }
- if (index < 0 || index > pchan->runtime.bbone_segments) {
- BKE_reportf(reports, RPT_ERROR, "Invalid index %d for B-Bone segments of '%s'!", index, pchan->name);
- return;
- }
-
- if (rest) {
- copy_m4_m4((float (*)[4])mat_ret, pchan->runtime.bbone_rest_mats[index].mat);
- }
- else {
- copy_m4_m4((float (*)[4])mat_ret, pchan->runtime.bbone_pose_mats[index].mat);
- }
+ if (!pchan->bone || pchan->bone->segments <= 1) {
+ BKE_reportf(reports, RPT_ERROR, "Bone '%s' is not a B-Bone!", pchan->name);
+ return;
+ }
+ if (pchan->runtime.bbone_segments != pchan->bone->segments) {
+ BKE_reportf(reports, RPT_ERROR, "Bone '%s' has out of date B-Bone segment data!", pchan->name);
+ return;
+ }
+ if (index < 0 || index > pchan->runtime.bbone_segments) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Invalid index %d for B-Bone segments of '%s'!", index, pchan->name);
+ return;
+ }
+
+ if (rest) {
+ copy_m4_m4((float(*)[4])mat_ret, pchan->runtime.bbone_rest_mats[index].mat);
+ }
+ else {
+ copy_m4_m4((float(*)[4])mat_ret, pchan->runtime.bbone_pose_mats[index].mat);
+ }
}
-static void rna_PoseBone_compute_bbone_handles(
- bPoseChannel *pchan, ReportList *reports,
- float ret_h1[3], float *ret_roll1, float ret_h2[3], float *ret_roll2,
- bool rest, bool ease, bool offsets)
+static void rna_PoseBone_compute_bbone_handles(bPoseChannel *pchan,
+ ReportList *reports,
+ float ret_h1[3],
+ float *ret_roll1,
+ float ret_h2[3],
+ float *ret_roll2,
+ bool rest,
+ bool ease,
+ bool offsets)
{
- if (!pchan->bone || pchan->bone->segments <= 1) {
- BKE_reportf(reports, RPT_ERROR, "Bone '%s' is not a B-Bone!", pchan->name);
- return;
- }
+ if (!pchan->bone || pchan->bone->segments <= 1) {
+ BKE_reportf(reports, RPT_ERROR, "Bone '%s' is not a B-Bone!", pchan->name);
+ return;
+ }
- BBoneSplineParameters params;
+ BBoneSplineParameters params;
- BKE_pchan_bbone_spline_params_get(pchan, rest, &params);
- BKE_pchan_bbone_handles_compute(&params, ret_h1, ret_roll1, ret_h2, ret_roll2, ease || offsets, offsets);
+ BKE_pchan_bbone_spline_params_get(pchan, rest, &params);
+ BKE_pchan_bbone_handles_compute(
+ &params, ret_h1, ret_roll1, ret_h2, ret_roll2, ease || offsets, offsets);
}
#else
void RNA_api_pose(StructRNA *UNUSED(srna))
{
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
}
void RNA_api_pose_channel(StructRNA *srna)
{
- PropertyRNA *parm;
- FunctionRNA *func;
-
- func = RNA_def_function(srna, "evaluate_envelope", "rna_PoseBone_do_envelope");
- RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
- parm = RNA_def_float_vector_xyz(func, "point", 3, NULL, -FLT_MAX, FLT_MAX, "Point",
- "Position in 3d space to evaluate", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return value */
- parm = RNA_def_float(func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
- RNA_def_function_return(func, parm);
-
- /* B-Bone segment matrices */
- func = RNA_def_function(srna, "bbone_segment_matrix", "rna_PoseBone_bbone_segment_matrix");
- RNA_def_function_ui_description(func, "Retrieve the matrix of the joint between B-Bone segments if available");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The resulting matrix in bone local space");
- RNA_def_function_output(func, parm);
- parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the segment endpoint", 0, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose matrix");
-
- /* B-Bone custom handle positions */
- func = RNA_def_function(srna, "compute_bbone_handles", "rna_PoseBone_compute_bbone_handles");
- RNA_def_function_ui_description(func, "Retrieve the vectors and rolls coming from B-Bone custom handles");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_property(func, "handle1", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(parm, 3);
- RNA_def_property_ui_text(parm, "", "The direction vector of the start handle in bone local space");
- RNA_def_function_output(func, parm);
- parm = RNA_def_float(func, "roll1", 0, -FLT_MAX, FLT_MAX, "", "Roll of the start handle", -FLT_MAX, FLT_MAX);
- RNA_def_function_output(func, parm);
- parm = RNA_def_property(func, "handle2", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(parm, 3);
- RNA_def_property_ui_text(parm, "", "The direction vector of the end handle in bone local space");
- RNA_def_function_output(func, parm);
- parm = RNA_def_float(func, "roll2", 0, -FLT_MAX, FLT_MAX, "", "Roll of the end handle", -FLT_MAX, FLT_MAX);
- RNA_def_function_output(func, parm);
- parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose state");
- parm = RNA_def_boolean(func, "ease", false, "", "Apply scale from ease values");
- parm = RNA_def_boolean(func, "offsets", false, "", "Apply roll and curve offsets from bone properties");
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ func = RNA_def_function(srna, "evaluate_envelope", "rna_PoseBone_do_envelope");
+ RNA_def_function_ui_description(func, "Calculate bone envelope at given point");
+ parm = RNA_def_float_vector_xyz(func,
+ "point",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Point",
+ "Position in 3d space to evaluate",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return value */
+ parm = RNA_def_float(
+ func, "factor", 0, -FLT_MAX, FLT_MAX, "Factor", "Envelope factor", -FLT_MAX, FLT_MAX);
+ RNA_def_function_return(func, parm);
+
+ /* B-Bone segment matrices */
+ func = RNA_def_function(srna, "bbone_segment_matrix", "rna_PoseBone_bbone_segment_matrix");
+ RNA_def_function_ui_description(
+ func, "Retrieve the matrix of the joint between B-Bone segments if available");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_property(func, "matrix_return", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The resulting matrix in bone local space");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the segment endpoint", 0, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose matrix");
+
+ /* B-Bone custom handle positions */
+ func = RNA_def_function(srna, "compute_bbone_handles", "rna_PoseBone_compute_bbone_handles");
+ RNA_def_function_ui_description(
+ func, "Retrieve the vectors and rolls coming from B-Bone custom handles");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_property(func, "handle1", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(parm, 3);
+ RNA_def_property_ui_text(
+ parm, "", "The direction vector of the start handle in bone local space");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float(
+ func, "roll1", 0, -FLT_MAX, FLT_MAX, "", "Roll of the start handle", -FLT_MAX, FLT_MAX);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_property(func, "handle2", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(parm, 3);
+ RNA_def_property_ui_text(parm, "", "The direction vector of the end handle in bone local space");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float(
+ func, "roll2", 0, -FLT_MAX, FLT_MAX, "", "Roll of the end handle", -FLT_MAX, FLT_MAX);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_boolean(func, "rest", false, "", "Return the rest pose state");
+ parm = RNA_def_boolean(func, "ease", false, "", "Apply scale from ease values");
+ parm = RNA_def_boolean(
+ func, "offsets", false, "", "Apply roll and curve offsets from bone properties");
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c
index 46eb0a8d7bc..81ec7857487 100644
--- a/source/blender/makesrna/intern/rna_render.c
+++ b/source/blender/makesrna/intern/rna_render.c
@@ -44,966 +44,1100 @@
/* Deprecated, only provided for API compatibility. */
const EnumPropertyItem rna_enum_render_pass_type_items[] = {
- {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
- {SCE_PASS_Z, "Z", 0, "Z", ""},
- {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
- {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""},
- {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""},
- {SCE_PASS_VECTOR, "VECTOR", 0, "Vector", ""},
- {SCE_PASS_INDEXOB, "OBJECT_INDEX", 0, "Object Index", ""},
- {SCE_PASS_UV, "UV", 0, "UV", ""},
- {SCE_PASS_MIST, "MIST", 0, "Mist", ""},
- {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""},
- {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
- {SCE_PASS_INDEXMA, "MATERIAL_INDEX", 0, "Material Index", ""},
- {SCE_PASS_DIFFUSE_DIRECT, "DIFFUSE_DIRECT", 0, "Diffuse Direct", ""},
- {SCE_PASS_DIFFUSE_INDIRECT, "DIFFUSE_INDIRECT", 0, "Diffuse Indirect", ""},
- {SCE_PASS_DIFFUSE_COLOR, "DIFFUSE_COLOR", 0, "Diffuse Color", ""},
- {SCE_PASS_GLOSSY_DIRECT, "GLOSSY_DIRECT", 0, "Glossy Direct", ""},
- {SCE_PASS_GLOSSY_INDIRECT, "GLOSSY_INDIRECT", 0, "Glossy Indirect", ""},
- {SCE_PASS_GLOSSY_COLOR, "GLOSSY_COLOR", 0, "Glossy Color", ""},
- {SCE_PASS_TRANSM_DIRECT, "TRANSMISSION_DIRECT", 0, "Transmission Direct", ""},
- {SCE_PASS_TRANSM_INDIRECT, "TRANSMISSION_INDIRECT", 0, "Transmission Indirect", ""},
- {SCE_PASS_TRANSM_COLOR, "TRANSMISSION_COLOR", 0, "Transmission Color", ""},
- {SCE_PASS_SUBSURFACE_DIRECT, "SUBSURFACE_DIRECT", 0, "Subsurface Direct", ""},
- {SCE_PASS_SUBSURFACE_INDIRECT, "SUBSURFACE_INDIRECT", 0, "Subsurface Indirect", ""},
- {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE_COLOR", 0, "Subsurface Color", ""},
+ {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
+ {SCE_PASS_Z, "Z", 0, "Z", ""},
+ {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
+ {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""},
+ {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""},
+ {SCE_PASS_VECTOR, "VECTOR", 0, "Vector", ""},
+ {SCE_PASS_INDEXOB, "OBJECT_INDEX", 0, "Object Index", ""},
+ {SCE_PASS_UV, "UV", 0, "UV", ""},
+ {SCE_PASS_MIST, "MIST", 0, "Mist", ""},
+ {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""},
+ {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
+ {SCE_PASS_INDEXMA, "MATERIAL_INDEX", 0, "Material Index", ""},
+ {SCE_PASS_DIFFUSE_DIRECT, "DIFFUSE_DIRECT", 0, "Diffuse Direct", ""},
+ {SCE_PASS_DIFFUSE_INDIRECT, "DIFFUSE_INDIRECT", 0, "Diffuse Indirect", ""},
+ {SCE_PASS_DIFFUSE_COLOR, "DIFFUSE_COLOR", 0, "Diffuse Color", ""},
+ {SCE_PASS_GLOSSY_DIRECT, "GLOSSY_DIRECT", 0, "Glossy Direct", ""},
+ {SCE_PASS_GLOSSY_INDIRECT, "GLOSSY_INDIRECT", 0, "Glossy Indirect", ""},
+ {SCE_PASS_GLOSSY_COLOR, "GLOSSY_COLOR", 0, "Glossy Color", ""},
+ {SCE_PASS_TRANSM_DIRECT, "TRANSMISSION_DIRECT", 0, "Transmission Direct", ""},
+ {SCE_PASS_TRANSM_INDIRECT, "TRANSMISSION_INDIRECT", 0, "Transmission Indirect", ""},
+ {SCE_PASS_TRANSM_COLOR, "TRANSMISSION_COLOR", 0, "Transmission Color", ""},
+ {SCE_PASS_SUBSURFACE_DIRECT, "SUBSURFACE_DIRECT", 0, "Subsurface Direct", ""},
+ {SCE_PASS_SUBSURFACE_INDIRECT, "SUBSURFACE_INDIRECT", 0, "Subsurface Indirect", ""},
+ {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE_COLOR", 0, "Subsurface Color", ""},
#ifdef WITH_CYCLES_DEBUG
- {SCE_PASS_DEBUG, "DEBUG", 0, "Pass used for render engine debugging", ""},
+ {SCE_PASS_DEBUG, "DEBUG", 0, "Pass used for render engine debugging", ""},
#endif
- {0, NULL, 0, NULL, NULL},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_bake_pass_type_items[] = {
- {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
- {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""},
- {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
- {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""},
- {SCE_PASS_UV, "UV", 0, "UV", ""},
- {SCE_PASS_ROUGHNESS, "ROUGHNESS", 0, "ROUGHNESS", ""},
- {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""},
- {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
- {SCE_PASS_DIFFUSE_COLOR, "DIFFUSE", 0, "Diffuse", ""},
- {SCE_PASS_GLOSSY_COLOR, "GLOSSY", 0, "Glossy", ""},
- {SCE_PASS_TRANSM_COLOR, "TRANSMISSION", 0, "Transmission", ""},
- {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE", 0, "Subsurface", ""},
- {0, NULL, 0, NULL, NULL},
+ {SCE_PASS_COMBINED, "COMBINED", 0, "Combined", ""},
+ {SCE_PASS_AO, "AO", 0, "Ambient Occlusion", ""},
+ {SCE_PASS_SHADOW, "SHADOW", 0, "Shadow", ""},
+ {SCE_PASS_NORMAL, "NORMAL", 0, "Normal", ""},
+ {SCE_PASS_UV, "UV", 0, "UV", ""},
+ {SCE_PASS_ROUGHNESS, "ROUGHNESS", 0, "ROUGHNESS", ""},
+ {SCE_PASS_EMIT, "EMIT", 0, "Emit", ""},
+ {SCE_PASS_ENVIRONMENT, "ENVIRONMENT", 0, "Environment", ""},
+ {SCE_PASS_DIFFUSE_COLOR, "DIFFUSE", 0, "Diffuse", ""},
+ {SCE_PASS_GLOSSY_COLOR, "GLOSSY", 0, "Glossy", ""},
+ {SCE_PASS_TRANSM_COLOR, "TRANSMISSION", 0, "Transmission", ""},
+ {SCE_PASS_SUBSURFACE_COLOR, "SUBSURFACE", 0, "Subsurface", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "BKE_context.h"
-#include "BKE_report.h"
+# include "BKE_context.h"
+# include "BKE_report.h"
-#include "IMB_colormanagement.h"
-#include "GPU_extensions.h"
+# include "IMB_colormanagement.h"
+# include "GPU_extensions.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph_query.h"
/* RenderEngine Callbacks */
static void engine_tag_redraw(RenderEngine *engine)
{
- engine->flag |= RE_ENGINE_DO_DRAW;
+ engine->flag |= RE_ENGINE_DO_DRAW;
}
static void engine_tag_update(RenderEngine *engine)
{
- engine->flag |= RE_ENGINE_DO_UPDATE;
+ engine->flag |= RE_ENGINE_DO_UPDATE;
}
static bool engine_support_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene)
{
- return IMB_colormanagement_support_glsl_draw(&scene->view_settings);
+ return IMB_colormanagement_support_glsl_draw(&scene->view_settings);
}
static int engine_get_preview_pixel_size(RenderEngine *UNUSED(engine), Scene *scene)
{
- return BKE_render_preview_pixel_size(&scene->r);
+ return BKE_render_preview_pixel_size(&scene->r);
}
static void engine_bind_display_space_shader(RenderEngine *UNUSED(engine), Scene *scene)
{
- IMB_colormanagement_setup_glsl_draw(&scene->view_settings,
- &scene->display_settings,
- scene->r.dither_intensity,
- false);
+ IMB_colormanagement_setup_glsl_draw(
+ &scene->view_settings, &scene->display_settings, scene->r.dither_intensity, false);
}
static void engine_unbind_display_space_shader(RenderEngine *UNUSED(engine))
{
- IMB_colormanagement_finish_glsl_draw();
+ IMB_colormanagement_finish_glsl_draw();
}
static void engine_update(RenderEngine *engine, Main *bmain, Depsgraph *depsgraph)
{
- extern FunctionRNA rna_RenderEngine_update_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ extern FunctionRNA rna_RenderEngine_update_func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- func = &rna_RenderEngine_update_func;
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ func = &rna_RenderEngine_update_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "data", &bmain);
- RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph);
- engine->type->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "data", &bmain);
+ RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph);
+ engine->type->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void engine_render(RenderEngine *engine, Depsgraph *depsgraph)
{
- extern FunctionRNA rna_RenderEngine_render_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ extern FunctionRNA rna_RenderEngine_render_func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- func = &rna_RenderEngine_render_func;
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ func = &rna_RenderEngine_render_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph);
- engine->type->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph);
+ engine->type->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void engine_bake(RenderEngine *engine, struct Depsgraph *depsgraph,
- struct Object *object, const int pass_type, const int pass_filter,
- const int object_id, const struct BakePixel *pixel_array,
- const int num_pixels, const int depth, void *result)
+static void engine_bake(RenderEngine *engine,
+ struct Depsgraph *depsgraph,
+ struct Object *object,
+ const int pass_type,
+ const int pass_filter,
+ const int object_id,
+ const struct BakePixel *pixel_array,
+ const int num_pixels,
+ const int depth,
+ void *result)
{
- extern FunctionRNA rna_RenderEngine_bake_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
-
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- func = &rna_RenderEngine_bake_func;
-
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph);
- RNA_parameter_set_lookup(&list, "object", &object);
- RNA_parameter_set_lookup(&list, "pass_type", &pass_type);
- RNA_parameter_set_lookup(&list, "pass_filter", &pass_filter);
- RNA_parameter_set_lookup(&list, "object_id", &object_id);
- RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array);
- RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels);
- RNA_parameter_set_lookup(&list, "depth", &depth);
- RNA_parameter_set_lookup(&list, "result", &result);
- engine->type->ext.call(NULL, &ptr, func, &list);
-
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_RenderEngine_bake_func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ func = &rna_RenderEngine_bake_func;
+
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "depsgraph", &depsgraph);
+ RNA_parameter_set_lookup(&list, "object", &object);
+ RNA_parameter_set_lookup(&list, "pass_type", &pass_type);
+ RNA_parameter_set_lookup(&list, "pass_filter", &pass_filter);
+ RNA_parameter_set_lookup(&list, "object_id", &object_id);
+ RNA_parameter_set_lookup(&list, "pixel_array", &pixel_array);
+ RNA_parameter_set_lookup(&list, "num_pixels", &num_pixels);
+ RNA_parameter_set_lookup(&list, "depth", &depth);
+ RNA_parameter_set_lookup(&list, "result", &result);
+ engine->type->ext.call(NULL, &ptr, func, &list);
+
+ RNA_parameter_list_free(&list);
}
static void engine_view_update(RenderEngine *engine, const struct bContext *context)
{
- extern FunctionRNA rna_RenderEngine_view_update_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ extern FunctionRNA rna_RenderEngine_view_update_func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- func = &rna_RenderEngine_view_update_func;
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ func = &rna_RenderEngine_view_update_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &context);
- engine->type->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &context);
+ engine->type->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void engine_view_draw(RenderEngine *engine, const struct bContext *context)
{
- extern FunctionRNA rna_RenderEngine_view_draw_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ extern FunctionRNA rna_RenderEngine_view_draw_func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- func = &rna_RenderEngine_view_draw_func;
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ func = &rna_RenderEngine_view_draw_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &context);
- engine->type->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &context);
+ engine->type->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void engine_update_script_node(RenderEngine *engine, struct bNodeTree *ntree, struct bNode *node)
+static void engine_update_script_node(RenderEngine *engine,
+ struct bNodeTree *ntree,
+ struct bNode *node)
{
- extern FunctionRNA rna_RenderEngine_update_script_node_func;
- PointerRNA ptr, nodeptr;
- ParameterList list;
- FunctionRNA *func;
+ extern FunctionRNA rna_RenderEngine_update_script_node_func;
+ PointerRNA ptr, nodeptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- RNA_pointer_create((ID *)ntree, &RNA_Node, node, &nodeptr);
- func = &rna_RenderEngine_update_script_node_func;
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ RNA_pointer_create((ID *)ntree, &RNA_Node, node, &nodeptr);
+ func = &rna_RenderEngine_update_script_node_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "node", &nodeptr);
- engine->type->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "node", &nodeptr);
+ engine->type->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
-static void engine_update_render_passes(RenderEngine *engine, struct Scene *scene, struct ViewLayer *view_layer)
+static void engine_update_render_passes(RenderEngine *engine,
+ struct Scene *scene,
+ struct ViewLayer *view_layer)
{
- extern FunctionRNA rna_RenderEngine_update_render_passes_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ extern FunctionRNA rna_RenderEngine_update_render_passes_func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
- func = &rna_RenderEngine_update_render_passes_func;
+ RNA_pointer_create(NULL, engine->type->ext.srna, engine, &ptr);
+ func = &rna_RenderEngine_update_render_passes_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "scene", &scene);
- RNA_parameter_set_lookup(&list, "renderlayer", &view_layer);
- engine->type->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "scene", &scene);
+ RNA_parameter_set_lookup(&list, "renderlayer", &view_layer);
+ engine->type->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
/* RenderEngine registration */
static void rna_RenderEngine_unregister(Main *bmain, StructRNA *type)
{
- RenderEngineType *et = RNA_struct_blender_type_get(type);
+ RenderEngineType *et = RNA_struct_blender_type_get(type);
- if (!et)
- return;
+ if (!et)
+ return;
- RNA_struct_free_extension(type, &et->ext);
- RNA_struct_free(&BLENDER_RNA, type);
- BLI_freelinkN(&R_engines, et);
+ RNA_struct_free_extension(type, &et->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
+ BLI_freelinkN(&R_engines, et);
- /* Stop all renders in case we were using this one. */
- ED_render_engine_changed(bmain);
+ /* Stop all renders in case we were using this one. */
+ ED_render_engine_changed(bmain);
}
-static StructRNA *rna_RenderEngine_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_RenderEngine_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- RenderEngineType *et, dummyet = {NULL};
- RenderEngine dummyengine = {NULL};
- PointerRNA dummyptr;
- int have_function[8];
-
- /* setup dummy engine & engine type to store static properties in */
- dummyengine.type = &dummyet;
- dummyet.flag |= RE_USE_SHADING_NODES_CUSTOM;
- RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr);
-
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummyet.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering render engine class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyet.idname));
- return NULL;
- }
-
- /* check if we have registered this engine type before, and remove it */
- for (et = R_engines.first; et; et = et->next) {
- if (STREQ(et->idname, dummyet.idname)) {
- if (et->ext.srna)
- rna_RenderEngine_unregister(bmain, et->ext.srna);
- break;
- }
- }
-
- /* create a new engine type */
- et = MEM_callocN(sizeof(RenderEngineType), "python render engine");
- memcpy(et, &dummyet, sizeof(dummyet));
-
- et->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, et->idname, &RNA_RenderEngine);
- et->ext.data = data;
- et->ext.call = call;
- et->ext.free = free;
- RNA_struct_blender_type_set(et->ext.srna, et);
-
- et->update = (have_function[0]) ? engine_update : NULL;
- et->render = (have_function[1]) ? engine_render : NULL;
- et->bake = (have_function[2]) ? engine_bake : NULL;
- et->view_update = (have_function[3]) ? engine_view_update : NULL;
- et->view_draw = (have_function[4]) ? engine_view_draw : NULL;
- et->update_script_node = (have_function[5]) ? engine_update_script_node : NULL;
- et->update_render_passes = (have_function[6]) ? engine_update_render_passes : NULL;
-
- RE_engines_register(et);
-
- return et->ext.srna;
+ RenderEngineType *et, dummyet = {NULL};
+ RenderEngine dummyengine = {NULL};
+ PointerRNA dummyptr;
+ int have_function[8];
+
+ /* setup dummy engine & engine type to store static properties in */
+ dummyengine.type = &dummyet;
+ dummyet.flag |= RE_USE_SHADING_NODES_CUSTOM;
+ RNA_pointer_create(NULL, &RNA_RenderEngine, &dummyengine, &dummyptr);
+
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummyet.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering render engine class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummyet.idname));
+ return NULL;
+ }
+
+ /* check if we have registered this engine type before, and remove it */
+ for (et = R_engines.first; et; et = et->next) {
+ if (STREQ(et->idname, dummyet.idname)) {
+ if (et->ext.srna)
+ rna_RenderEngine_unregister(bmain, et->ext.srna);
+ break;
+ }
+ }
+
+ /* create a new engine type */
+ et = MEM_callocN(sizeof(RenderEngineType), "python render engine");
+ memcpy(et, &dummyet, sizeof(dummyet));
+
+ et->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, et->idname, &RNA_RenderEngine);
+ et->ext.data = data;
+ et->ext.call = call;
+ et->ext.free = free;
+ RNA_struct_blender_type_set(et->ext.srna, et);
+
+ et->update = (have_function[0]) ? engine_update : NULL;
+ et->render = (have_function[1]) ? engine_render : NULL;
+ et->bake = (have_function[2]) ? engine_bake : NULL;
+ et->view_update = (have_function[3]) ? engine_view_update : NULL;
+ et->view_draw = (have_function[4]) ? engine_view_draw : NULL;
+ et->update_script_node = (have_function[5]) ? engine_update_script_node : NULL;
+ et->update_render_passes = (have_function[6]) ? engine_update_render_passes : NULL;
+
+ RE_engines_register(et);
+
+ return et->ext.srna;
}
static void **rna_RenderEngine_instance(PointerRNA *ptr)
{
- RenderEngine *engine = ptr->data;
- return &engine->py_instance;
+ RenderEngine *engine = ptr->data;
+ return &engine->py_instance;
}
static StructRNA *rna_RenderEngine_refine(PointerRNA *ptr)
{
- RenderEngine *engine = (RenderEngine *)ptr->data;
- return (engine->type && engine->type->ext.srna) ? engine->type->ext.srna : &RNA_RenderEngine;
+ RenderEngine *engine = (RenderEngine *)ptr->data;
+ return (engine->type && engine->type->ext.srna) ? engine->type->ext.srna : &RNA_RenderEngine;
}
static PointerRNA rna_RenderEngine_render_get(PointerRNA *ptr)
{
- RenderEngine *engine = (RenderEngine *)ptr->data;
+ RenderEngine *engine = (RenderEngine *)ptr->data;
- if (engine->re) {
- RenderData *r = RE_engine_get_render_data(engine->re);
+ if (engine->re) {
+ RenderData *r = RE_engine_get_render_data(engine->re);
- return rna_pointer_inherit_refine(ptr, &RNA_RenderSettings, r);
- }
- else {
- return rna_pointer_inherit_refine(ptr, &RNA_RenderSettings, NULL);
- }
+ return rna_pointer_inherit_refine(ptr, &RNA_RenderSettings, r);
+ }
+ else {
+ return rna_pointer_inherit_refine(ptr, &RNA_RenderSettings, NULL);
+ }
}
static PointerRNA rna_RenderEngine_camera_override_get(PointerRNA *ptr)
{
- RenderEngine *engine = (RenderEngine *)ptr->data;
- /* TODO(sergey): Shouldn't engine point to an evaluated datablocks already? */
- if (engine->re) {
- Object *cam = RE_GetCamera(engine->re);
- Object *cam_eval = DEG_get_evaluated_object(engine->depsgraph, cam);
- return rna_pointer_inherit_refine(ptr, &RNA_Object, cam_eval);
- }
- else {
- return rna_pointer_inherit_refine(ptr, &RNA_Object, engine->camera_override);
- }
+ RenderEngine *engine = (RenderEngine *)ptr->data;
+ /* TODO(sergey): Shouldn't engine point to an evaluated datablocks already? */
+ if (engine->re) {
+ Object *cam = RE_GetCamera(engine->re);
+ Object *cam_eval = DEG_get_evaluated_object(engine->depsgraph, cam);
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, cam_eval);
+ }
+ else {
+ return rna_pointer_inherit_refine(ptr, &RNA_Object, engine->camera_override);
+ }
}
static void rna_RenderResult_views_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- RenderResult *rr = (RenderResult *)ptr->data;
- rna_iterator_listbase_begin(iter, &rr->views, NULL);
+ RenderResult *rr = (RenderResult *)ptr->data;
+ rna_iterator_listbase_begin(iter, &rr->views, NULL);
}
static void rna_RenderResult_layers_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- RenderResult *rr = (RenderResult *)ptr->data;
- rna_iterator_listbase_begin(iter, &rr->layers, NULL);
+ RenderResult *rr = (RenderResult *)ptr->data;
+ rna_iterator_listbase_begin(iter, &rr->layers, NULL);
}
-static void rna_RenderResult_stamp_data_add_field(RenderResult *rr, const char *field, const char *value)
+static void rna_RenderResult_stamp_data_add_field(RenderResult *rr,
+ const char *field,
+ const char *value)
{
- BKE_render_result_stamp_data(rr, field, value);
+ BKE_render_result_stamp_data(rr, field, value);
}
-
static void rna_RenderLayer_passes_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- RenderLayer *rl = (RenderLayer *)ptr->data;
- rna_iterator_listbase_begin(iter, &rl->passes, NULL);
+ RenderLayer *rl = (RenderLayer *)ptr->data;
+ rna_iterator_listbase_begin(iter, &rl->passes, NULL);
}
static int rna_RenderPass_rect_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
- RenderPass *rpass = (RenderPass *)ptr->data;
+ RenderPass *rpass = (RenderPass *)ptr->data;
- length[0] = rpass->rectx * rpass->recty;
- length[1] = rpass->channels;
+ length[0] = rpass->rectx * rpass->recty;
+ length[1] = rpass->channels;
- return length[0] * length[1];
+ return length[0] * length[1];
}
static void rna_RenderPass_rect_get(PointerRNA *ptr, float *values)
{
- RenderPass *rpass = (RenderPass *)ptr->data;
- memcpy(values, rpass->rect, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels);
+ RenderPass *rpass = (RenderPass *)ptr->data;
+ memcpy(values, rpass->rect, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels);
}
void rna_RenderPass_rect_set(PointerRNA *ptr, const float *values)
{
- RenderPass *rpass = (RenderPass *)ptr->data;
- memcpy(rpass->rect, values, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels);
+ RenderPass *rpass = (RenderPass *)ptr->data;
+ memcpy(rpass->rect, values, sizeof(float) * rpass->rectx * rpass->recty * rpass->channels);
}
static PointerRNA rna_BakePixel_next_get(PointerRNA *ptr)
{
- BakePixel *bp = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_BakePixel, bp + 1);
+ BakePixel *bp = ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_BakePixel, bp + 1);
}
static RenderPass *rna_RenderPass_find_by_type(RenderLayer *rl, int passtype, const char *view)
{
- return RE_pass_find_by_type(rl, passtype, view);
+ return RE_pass_find_by_type(rl, passtype, view);
}
static RenderPass *rna_RenderPass_find_by_name(RenderLayer *rl, const char *name, const char *view)
{
- return RE_pass_find_by_name(rl, name, view);
+ return RE_pass_find_by_name(rl, name, view);
}
#else /* RNA_RUNTIME */
static void rna_def_render_engine(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem render_pass_type_items[] = {
- {SOCK_FLOAT, "VALUE", 0, "Value", ""},
- {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
- {SOCK_RGBA, "COLOR", 0, "Color", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "RenderEngine", NULL);
- RNA_def_struct_sdna(srna, "RenderEngine");
- RNA_def_struct_ui_text(srna, "Render Engine", "Render engine");
- RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine");
- RNA_def_struct_register_funcs(srna, "rna_RenderEngine_register", "rna_RenderEngine_unregister",
- "rna_RenderEngine_instance");
-
- /* final render callbacks */
- func = RNA_def_function(srna, "update", NULL);
- RNA_def_function_ui_description(func, "Export scene data for render");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- RNA_def_pointer(func, "data", "BlendData", "", "");
- RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
-
- func = RNA_def_function(srna, "render", NULL);
- RNA_def_function_ui_description(func, "Render scene into an image");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "bake", NULL);
- RNA_def_function_ui_description(func, "Bake passes");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "object", "Object", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "pass_type", rna_enum_bake_pass_type_items, 0, "Pass", "Pass to bake");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "pass_filter", 0, 0, INT_MAX, "Pass Filter", "Filter to combined, diffuse, glossy, transmission and subsurface passes", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "object_id", 0, 0, INT_MAX, "Object Id", "Id of the current object being baked in relation to the others", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "pixel_array", "BakePixel", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "num_pixels", 0, 0, INT_MAX, "Number of Pixels", "Size of the baking batch", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "depth", 0, 0, INT_MAX, "Pixels depth", "Number of channels", 1, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* TODO, see how array size of 0 works, this shouldnt be used */
- parm = RNA_def_pointer(func, "result", "AnyType", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* viewport render callbacks */
- func = RNA_def_function(srna, "view_update", NULL);
- RNA_def_function_ui_description(func, "Update on data changes for viewport render");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- RNA_def_pointer(func, "context", "Context", "", "");
-
- func = RNA_def_function(srna, "view_draw", NULL);
- RNA_def_function_ui_description(func, "Draw viewport render");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- RNA_def_pointer(func, "context", "Context", "", "");
-
- /* shader script callbacks */
- func = RNA_def_function(srna, "update_script_node", NULL);
- RNA_def_function_ui_description(func, "Compile shader script node");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "node", "Node", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
-
- func = RNA_def_function(srna, "update_render_passes", NULL);
- RNA_def_function_ui_description(func, "Update the render passes that will be generated");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "scene", "Scene", "", "");
- parm = RNA_def_pointer(func, "renderlayer", "ViewLayer", "", "");
-
- /* tag for redraw */
- func = RNA_def_function(srna, "tag_redraw", "engine_tag_redraw");
- RNA_def_function_ui_description(func, "Request redraw for viewport rendering");
-
- /* tag for update */
- func = RNA_def_function(srna, "tag_update", "engine_tag_update");
- RNA_def_function_ui_description(func, "Request update call for viewport rendering");
-
- func = RNA_def_function(srna, "begin_result", "RE_engine_begin_result");
- RNA_def_function_ui_description(func, "Create render result to write linear floating point render layers and passes");
- parm = RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "layer", NULL, 0, "Layer", "Single layer to get render result for"); /* NULL ok here */
- RNA_def_string(func, "view", NULL, 0, "View", "Single view to get render result for"); /* NULL ok here */
- parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "update_result", "RE_engine_update_result");
- RNA_def_function_ui_description(func, "Signal that pixels have been updated and can be redrawn in the user interface");
- parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "end_result", "RE_engine_end_result");
- RNA_def_function_ui_description(func, "All pixels in the render result have been set and are final");
- parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "cancel", 0, "Cancel", "Don't mark tile as done, don't merge results unless forced");
- RNA_def_boolean(func, "highlight", 0, "Highlight", "Don't mark tile as done yet");
- RNA_def_boolean(func, "do_merge_results", 0, "Merge Results", "Merge results even if cancel=true");
-
- func = RNA_def_function(srna, "add_pass", "RE_engine_add_pass");
- RNA_def_function_ui_description(func, "Add a pass to the render layer");
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of the Pass, without view or channel tag");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "channels", 0, 0, INT_MAX, "Channels", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "chan_id", NULL, 0, "Channel IDs", "Channel names, one character per channel");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "layer", NULL, 0, "Layer", "Single layer to add render pass to"); /* NULL ok here */
-
- func = RNA_def_function(srna, "get_result", "RE_engine_get_result");
- RNA_def_function_ui_description(func, "Get final result for non-pixel operations");
- parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "test_break", "RE_engine_test_break");
- RNA_def_function_ui_description(func, "Test if the render operation should been canceled, this is a fast call that should be used regularly for responsiveness");
- parm = RNA_def_boolean(func, "do_break", 0, "Break", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "active_view_get", "RE_engine_active_view_get");
- parm = RNA_def_string(func, "view", NULL, 0, "View", "Single view active");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "active_view_set", "RE_engine_active_view_set");
- parm = RNA_def_string(func, "view", NULL, 0, "View", "Single view to set as active"); /* NULL ok here */
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "camera_shift_x", "RE_engine_get_camera_shift_x");
- parm = RNA_def_pointer(func, "camera", "Object", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", "");
- parm = RNA_def_float(func, "shift_x", 0.0f, 0.0f, FLT_MAX, "Shift X", "", 0.0f, FLT_MAX);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "camera_model_matrix", "RE_engine_get_camera_model_matrix");
- parm = RNA_def_pointer(func, "camera", "Object", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", "");
- parm = RNA_def_float_matrix(func, "r_model_matrix", 4, 4, NULL, 0.0f, 0.0f, "Model Matrix", "Normalized camera model matrix", 0.0f, 0.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_output(func, parm);
-
- func = RNA_def_function(srna, "use_spherical_stereo", "RE_engine_get_spherical_stereo");
- parm = RNA_def_pointer(func, "camera", "Object", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "update_stats", "RE_engine_update_stats");
- RNA_def_function_ui_description(func, "Update and signal to redraw render status text");
- parm = RNA_def_string(func, "stats", NULL, 0, "Stats", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "info", NULL, 0, "Info", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "frame_set", "RE_engine_frame_set");
- RNA_def_function_ui_description(func, "Evaluate scene at a different frame (for motion blur)");
- parm = RNA_def_int(func, "frame", 0, INT_MIN, INT_MAX, "Frame", "", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "subframe", 0.0f, 0.0f, 1.0f, "Subframe", "", 0.0f, 1.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
- RNA_def_function_ui_description(func, "Update progress percentage of render");
- parm = RNA_def_float(func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "update_memory_stats", "RE_engine_update_memory_stats");
- RNA_def_function_ui_description(func, "Update memory usage statistics");
- RNA_def_float(func, "memory_used", 0, 0.0f, FLT_MAX, "", "Current memory usage in megabytes", 0.0f, FLT_MAX);
- RNA_def_float(func, "memory_peak", 0, 0.0f, FLT_MAX, "", "Peak memory usage in megabytes", 0.0f, FLT_MAX);
-
- func = RNA_def_function(srna, "report", "RE_engine_report");
- RNA_def_function_ui_description(func, "Report info, warning or error messages");
- parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "error_set", "RE_engine_set_error_message");
- RNA_def_function_ui_description(func, "Set error message displaying after the render is finished");
- parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "bind_display_space_shader", "engine_bind_display_space_shader");
- RNA_def_function_ui_description(func, "Bind GLSL fragment shader that converts linear colors to display space colors using scene color management settings");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "unbind_display_space_shader", "engine_unbind_display_space_shader");
- RNA_def_function_ui_description(func, "Unbind GLSL display space shader, must always be called after binding the shader");
-
- func = RNA_def_function(srna, "support_display_space_shader", "engine_support_display_space_shader");
- RNA_def_function_ui_description(func, "Test if GLSL display space shader is supported for the combination of graphics card and scene settings");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "supported", 0, "Supported", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "get_preview_pixel_size", "engine_get_preview_pixel_size");
- RNA_def_function_ui_description(func, "Get the pixel size that should be used for preview rendering");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "pixel_size", 0, 1, 8, "Pixel Size", "", 1, 8);
- RNA_def_function_return(func, parm);
-
- RNA_def_function(srna, "free_blender_memory", "RE_engine_free_blender_memory");
- RNA_def_function_ui_description(func, "Free Blender side memory of render engine");
-
- RNA_define_verify_sdna(0);
-
- prop = RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION);
-
- prop = RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW);
-
- prop = RNA_def_property(srna, "camera_override", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_camera_override_get", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "Object");
-
- prop = RNA_def_property(srna, "layer_override", PROP_BOOLEAN, PROP_LAYER_MEMBER);
- RNA_def_property_boolean_sdna(prop, NULL, "layer_override", 1);
- RNA_def_property_array(prop, 20);
-
- prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "tile_x");
- prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "tile_y");
-
- prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "resolution_x");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "resolution_y");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* Render Data */
- prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderSettings");
- RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_render_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Render Data", "");
-
- prop = RNA_def_property(srna, "use_highlight_tiles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_HIGHLIGHT_TILES);
-
- func = RNA_def_function(srna, "register_pass", "RE_engine_register_pass");
- RNA_def_function_ui_description(func, "Register a render pass that will be part of the render with the current settings");
- parm = RNA_def_pointer(func, "scene", "Scene", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "channels", 1, 1, 8, "Channels", "", 1, 4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "chanid", NULL, 8, "Channel IDs", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", render_pass_type_items, SOCK_FLOAT, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* registration */
-
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->name");
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- prop = RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_use_shading_nodes_custom", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES_CUSTOM);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_use_exclude_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_EXCLUDE_LAYERS);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_use_save_buffers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SAVE_BUFFERS);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SPHERICAL_STEREO);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem render_pass_type_items[] = {
+ {SOCK_FLOAT, "VALUE", 0, "Value", ""},
+ {SOCK_VECTOR, "VECTOR", 0, "Vector", ""},
+ {SOCK_RGBA, "COLOR", 0, "Color", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "RenderEngine", NULL);
+ RNA_def_struct_sdna(srna, "RenderEngine");
+ RNA_def_struct_ui_text(srna, "Render Engine", "Render engine");
+ RNA_def_struct_refine_func(srna, "rna_RenderEngine_refine");
+ RNA_def_struct_register_funcs(srna,
+ "rna_RenderEngine_register",
+ "rna_RenderEngine_unregister",
+ "rna_RenderEngine_instance");
+
+ /* final render callbacks */
+ func = RNA_def_function(srna, "update", NULL);
+ RNA_def_function_ui_description(func, "Export scene data for render");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ RNA_def_pointer(func, "data", "BlendData", "", "");
+ RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
+
+ func = RNA_def_function(srna, "render", NULL);
+ RNA_def_function_ui_description(func, "Render scene into an image");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "bake", NULL);
+ RNA_def_function_ui_description(func, "Bake passes");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "object", "Object", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "pass_type", rna_enum_bake_pass_type_items, 0, "Pass", "Pass to bake");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "pass_filter",
+ 0,
+ 0,
+ INT_MAX,
+ "Pass Filter",
+ "Filter to combined, diffuse, glossy, transmission and subsurface passes",
+ 0,
+ INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "object_id",
+ 0,
+ 0,
+ INT_MAX,
+ "Object Id",
+ "Id of the current object being baked in relation to the others",
+ 0,
+ INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "pixel_array", "BakePixel", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "num_pixels",
+ 0,
+ 0,
+ INT_MAX,
+ "Number of Pixels",
+ "Size of the baking batch",
+ 0,
+ INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "depth", 0, 0, INT_MAX, "Pixels depth", "Number of channels", 1, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* TODO, see how array size of 0 works, this shouldnt be used */
+ parm = RNA_def_pointer(func, "result", "AnyType", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* viewport render callbacks */
+ func = RNA_def_function(srna, "view_update", NULL);
+ RNA_def_function_ui_description(func, "Update on data changes for viewport render");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ RNA_def_pointer(func, "context", "Context", "", "");
+
+ func = RNA_def_function(srna, "view_draw", NULL);
+ RNA_def_function_ui_description(func, "Draw viewport render");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ RNA_def_pointer(func, "context", "Context", "", "");
+
+ /* shader script callbacks */
+ func = RNA_def_function(srna, "update_script_node", NULL);
+ RNA_def_function_ui_description(func, "Compile shader script node");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "node", "Node", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "update_render_passes", NULL);
+ RNA_def_function_ui_description(func, "Update the render passes that will be generated");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "");
+ parm = RNA_def_pointer(func, "renderlayer", "ViewLayer", "", "");
+
+ /* tag for redraw */
+ func = RNA_def_function(srna, "tag_redraw", "engine_tag_redraw");
+ RNA_def_function_ui_description(func, "Request redraw for viewport rendering");
+
+ /* tag for update */
+ func = RNA_def_function(srna, "tag_update", "engine_tag_update");
+ RNA_def_function_ui_description(func, "Request update call for viewport rendering");
+
+ func = RNA_def_function(srna, "begin_result", "RE_engine_begin_result");
+ RNA_def_function_ui_description(
+ func, "Create render result to write linear floating point render layers and passes");
+ parm = RNA_def_int(func, "x", 0, 0, INT_MAX, "X", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "y", 0, 0, INT_MAX, "Y", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "w", 0, 0, INT_MAX, "Width", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "h", 0, 0, INT_MAX, "Height", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(
+ func, "layer", NULL, 0, "Layer", "Single layer to get render result for"); /* NULL ok here */
+ RNA_def_string(
+ func, "view", NULL, 0, "View", "Single view to get render result for"); /* NULL ok here */
+ parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "update_result", "RE_engine_update_result");
+ RNA_def_function_ui_description(
+ func, "Signal that pixels have been updated and can be redrawn in the user interface");
+ parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "end_result", "RE_engine_end_result");
+ RNA_def_function_ui_description(func,
+ "All pixels in the render result have been set and are final");
+ parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(
+ func, "cancel", 0, "Cancel", "Don't mark tile as done, don't merge results unless forced");
+ RNA_def_boolean(func, "highlight", 0, "Highlight", "Don't mark tile as done yet");
+ RNA_def_boolean(
+ func, "do_merge_results", 0, "Merge Results", "Merge results even if cancel=true");
+
+ func = RNA_def_function(srna, "add_pass", "RE_engine_add_pass");
+ RNA_def_function_ui_description(func, "Add a pass to the render layer");
+ parm = RNA_def_string(
+ func, "name", NULL, 0, "Name", "Name of the Pass, without view or channel tag");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "channels", 0, 0, INT_MAX, "Channels", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(
+ func, "chan_id", NULL, 0, "Channel IDs", "Channel names, one character per channel");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(
+ func, "layer", NULL, 0, "Layer", "Single layer to add render pass to"); /* NULL ok here */
+
+ func = RNA_def_function(srna, "get_result", "RE_engine_get_result");
+ RNA_def_function_ui_description(func, "Get final result for non-pixel operations");
+ parm = RNA_def_pointer(func, "result", "RenderResult", "Result", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "test_break", "RE_engine_test_break");
+ RNA_def_function_ui_description(func,
+ "Test if the render operation should been canceled, this is a "
+ "fast call that should be used regularly for responsiveness");
+ parm = RNA_def_boolean(func, "do_break", 0, "Break", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "active_view_get", "RE_engine_active_view_get");
+ parm = RNA_def_string(func, "view", NULL, 0, "View", "Single view active");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "active_view_set", "RE_engine_active_view_set");
+ parm = RNA_def_string(
+ func, "view", NULL, 0, "View", "Single view to set as active"); /* NULL ok here */
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "camera_shift_x", "RE_engine_get_camera_shift_x");
+ parm = RNA_def_pointer(func, "camera", "Object", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", "");
+ parm = RNA_def_float(func, "shift_x", 0.0f, 0.0f, FLT_MAX, "Shift X", "", 0.0f, FLT_MAX);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "camera_model_matrix", "RE_engine_get_camera_model_matrix");
+ parm = RNA_def_pointer(func, "camera", "Object", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", "");
+ parm = RNA_def_float_matrix(func,
+ "r_model_matrix",
+ 4,
+ 4,
+ NULL,
+ 0.0f,
+ 0.0f,
+ "Model Matrix",
+ "Normalized camera model matrix",
+ 0.0f,
+ 0.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(srna, "use_spherical_stereo", "RE_engine_get_spherical_stereo");
+ parm = RNA_def_pointer(func, "camera", "Object", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "use_spherical_stereo", 0, "Spherical Stereo", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "update_stats", "RE_engine_update_stats");
+ RNA_def_function_ui_description(func, "Update and signal to redraw render status text");
+ parm = RNA_def_string(func, "stats", NULL, 0, "Stats", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "info", NULL, 0, "Info", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "frame_set", "RE_engine_frame_set");
+ RNA_def_function_ui_description(func, "Evaluate scene at a different frame (for motion blur)");
+ parm = RNA_def_int(func, "frame", 0, INT_MIN, INT_MAX, "Frame", "", INT_MIN, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(func, "subframe", 0.0f, 0.0f, 1.0f, "Subframe", "", 0.0f, 1.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "update_progress", "RE_engine_update_progress");
+ RNA_def_function_ui_description(func, "Update progress percentage of render");
+ parm = RNA_def_float(
+ func, "progress", 0, 0.0f, 1.0f, "", "Percentage of render that's done", 0.0f, 1.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "update_memory_stats", "RE_engine_update_memory_stats");
+ RNA_def_function_ui_description(func, "Update memory usage statistics");
+ RNA_def_float(func,
+ "memory_used",
+ 0,
+ 0.0f,
+ FLT_MAX,
+ "",
+ "Current memory usage in megabytes",
+ 0.0f,
+ FLT_MAX);
+ RNA_def_float(
+ func, "memory_peak", 0, 0.0f, FLT_MAX, "", "Peak memory usage in megabytes", 0.0f, FLT_MAX);
+
+ func = RNA_def_function(srna, "report", "RE_engine_report");
+ RNA_def_function_ui_description(func, "Report info, warning or error messages");
+ parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "error_set", "RE_engine_set_error_message");
+ RNA_def_function_ui_description(func,
+ "Set error message displaying after the render is finished");
+ parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "bind_display_space_shader", "engine_bind_display_space_shader");
+ RNA_def_function_ui_description(func,
+ "Bind GLSL fragment shader that converts linear colors to "
+ "display space colors using scene color management settings");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(
+ srna, "unbind_display_space_shader", "engine_unbind_display_space_shader");
+ RNA_def_function_ui_description(
+ func, "Unbind GLSL display space shader, must always be called after binding the shader");
+
+ func = RNA_def_function(
+ srna, "support_display_space_shader", "engine_support_display_space_shader");
+ RNA_def_function_ui_description(func,
+ "Test if GLSL display space shader is supported for the "
+ "combination of graphics card and scene settings");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "supported", 0, "Supported", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "get_preview_pixel_size", "engine_get_preview_pixel_size");
+ RNA_def_function_ui_description(func,
+ "Get the pixel size that should be used for preview rendering");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "pixel_size", 0, 1, 8, "Pixel Size", "", 1, 8);
+ RNA_def_function_return(func, parm);
+
+ RNA_def_function(srna, "free_blender_memory", "RE_engine_free_blender_memory");
+ RNA_def_function_ui_description(func, "Free Blender side memory of render engine");
+
+ RNA_define_verify_sdna(0);
+
+ prop = RNA_def_property(srna, "is_animation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_ANIMATION);
+
+ prop = RNA_def_property(srna, "is_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_PREVIEW);
+
+ prop = RNA_def_property(srna, "camera_override", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_camera_override_get", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "Object");
+
+ prop = RNA_def_property(srna, "layer_override", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "layer_override", 1);
+ RNA_def_property_array(prop, 20);
+
+ prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "tile_x");
+ prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "tile_y");
+
+ prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "resolution_x");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "resolution_y");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* Render Data */
+ prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_RenderEngine_render_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Render Data", "");
+
+ prop = RNA_def_property(srna, "use_highlight_tiles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RE_ENGINE_HIGHLIGHT_TILES);
+
+ func = RNA_def_function(srna, "register_pass", "RE_engine_register_pass");
+ RNA_def_function_ui_description(
+ func, "Register a render pass that will be part of the render with the current settings");
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "name", NULL, MAX_NAME, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "channels", 1, 1, 8, "Channels", "", 1, 4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "chanid", NULL, 8, "Channel IDs", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", render_pass_type_items, SOCK_FLOAT, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* registration */
+
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->name");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ prop = RNA_def_property(srna, "bl_use_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_PREVIEW);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_use_postprocess", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_POSTPROCESS);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_use_shading_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_use_shading_nodes_custom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SHADING_NODES_CUSTOM);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_use_exclude_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_EXCLUDE_LAYERS);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_use_save_buffers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SAVE_BUFFERS);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "type->flag", RE_USE_SPHERICAL_STEREO);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ RNA_define_verify_sdna(1);
}
static void rna_def_render_result(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "RenderResult", NULL);
- RNA_def_struct_ui_text(srna, "Render Result", "Result of rendering, including all layers and passes");
-
- func = RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
- RNA_def_function_ui_description(func, "Copies the pixels of this render result from an image file");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string_file_name(func, "filename", NULL, FILE_MAX, "File Name",
- "Filename to load into this render tile, must be no smaller than "
- "the render result");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "stamp_data_add_field", "rna_RenderResult_stamp_data_add_field");
- RNA_def_function_ui_description(func, "Add engine-specific stamp data to the result");
- parm = RNA_def_string(func, "field", NULL, 1024, "Field", "Name of the stamp field to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "value", NULL, 0, "Value", "Value of the stamp data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- RNA_define_verify_sdna(0);
-
- prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "rectx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "recty");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderLayer");
- RNA_def_property_collection_funcs(prop, "rna_RenderResult_layers_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderView");
- RNA_def_property_collection_funcs(prop, "rna_RenderResult_views_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "RenderResult", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Render Result", "Result of rendering, including all layers and passes");
+
+ func = RNA_def_function(srna, "load_from_file", "RE_result_load_from_file");
+ RNA_def_function_ui_description(func,
+ "Copies the pixels of this render result from an image file");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string_file_name(
+ func,
+ "filename",
+ NULL,
+ FILE_MAX,
+ "File Name",
+ "Filename to load into this render tile, must be no smaller than "
+ "the render result");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "stamp_data_add_field", "rna_RenderResult_stamp_data_add_field");
+ RNA_def_function_ui_description(func, "Add engine-specific stamp data to the result");
+ parm = RNA_def_string(func, "field", NULL, 1024, "Field", "Name of the stamp field to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "value", NULL, 0, "Value", "Value of the stamp data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ RNA_define_verify_sdna(0);
+
+ prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "rectx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "recty");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderLayer");
+ RNA_def_property_collection_funcs(prop,
+ "rna_RenderResult_layers_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderView");
+ RNA_def_property_collection_funcs(prop,
+ "rna_RenderResult_views_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ RNA_define_verify_sdna(1);
}
static void rna_def_render_view(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "RenderView", NULL);
- RNA_def_struct_ui_text(srna, "Render View", "");
+ srna = RNA_def_struct(brna, "RenderView", NULL);
+ RNA_def_struct_ui_text(srna, "Render View", "");
- RNA_define_verify_sdna(0);
+ RNA_define_verify_sdna(0);
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
- RNA_define_verify_sdna(1);
+ RNA_define_verify_sdna(1);
}
static void rna_def_render_passes(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "RenderPasses");
- srna = RNA_def_struct(brna, "RenderPasses", NULL);
- RNA_def_struct_sdna(srna, "RenderLayer");
- RNA_def_struct_ui_text(srna, "Render Passes", "Collection of render passes");
-
- func = RNA_def_function(srna, "find_by_type", "rna_RenderPass_find_by_type");
- RNA_def_function_ui_description(func, "Get the render pass for a given type and view");
- parm = RNA_def_enum(func, "pass_type", rna_enum_render_pass_type_items, SCE_PASS_COMBINED, "Pass", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "view", NULL, 0, "View", "Render view to get pass from"); /* NULL ok here */
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "find_by_name", "rna_RenderPass_find_by_name");
- RNA_def_function_ui_description(func, "Get the render pass for a given name and view");
- parm = RNA_def_string(func, "name", RE_PASSNAME_COMBINED, 0, "Pass", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "view", NULL, 0, "View", "Render view to get pass from"); /* NULL ok here */
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "RenderPasses");
+ srna = RNA_def_struct(brna, "RenderPasses", NULL);
+ RNA_def_struct_sdna(srna, "RenderLayer");
+ RNA_def_struct_ui_text(srna, "Render Passes", "Collection of render passes");
+
+ func = RNA_def_function(srna, "find_by_type", "rna_RenderPass_find_by_type");
+ RNA_def_function_ui_description(func, "Get the render pass for a given type and view");
+ parm = RNA_def_enum(
+ func, "pass_type", rna_enum_render_pass_type_items, SCE_PASS_COMBINED, "Pass", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(
+ func, "view", NULL, 0, "View", "Render view to get pass from"); /* NULL ok here */
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "find_by_name", "rna_RenderPass_find_by_name");
+ RNA_def_function_ui_description(func, "Get the render pass for a given name and view");
+ parm = RNA_def_string(func, "name", RE_PASSNAME_COMBINED, 0, "Pass", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(
+ func, "view", NULL, 0, "View", "Render view to get pass from"); /* NULL ok here */
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "render_pass", "RenderPass", "", "The matching render pass");
+ RNA_def_function_return(func, parm);
}
static void rna_def_render_layer(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "RenderLayer", NULL);
- RNA_def_struct_ui_text(srna, "Render Layer", "");
-
- func = RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file");
- RNA_def_function_ui_description(func, "Copies the pixels of this renderlayer from an image file");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "filename", NULL, 0, "Filename",
- "Filename to load into this render tile, must be no smaller than the renderlayer");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "x", 0, 0, INT_MAX, "Offset X",
- "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX);
- RNA_def_int(func, "y", 0, 0, INT_MAX, "Offset Y",
- "Offset the position to copy from if the image is larger than the render layer", 0, INT_MAX);
-
- RNA_define_verify_sdna(0);
-
- rna_def_view_layer_common(srna, false);
-
- prop = RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RenderPass");
- RNA_def_property_collection_funcs(prop, "rna_RenderLayer_passes_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- rna_def_render_passes(brna, prop);
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "RenderLayer", NULL);
+ RNA_def_struct_ui_text(srna, "Render Layer", "");
+
+ func = RNA_def_function(srna, "load_from_file", "RE_layer_load_from_file");
+ RNA_def_function_ui_description(func,
+ "Copies the pixels of this renderlayer from an image file");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(
+ func,
+ "filename",
+ NULL,
+ 0,
+ "Filename",
+ "Filename to load into this render tile, must be no smaller than the renderlayer");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func,
+ "x",
+ 0,
+ 0,
+ INT_MAX,
+ "Offset X",
+ "Offset the position to copy from if the image is larger than the render layer",
+ 0,
+ INT_MAX);
+ RNA_def_int(func,
+ "y",
+ 0,
+ 0,
+ INT_MAX,
+ "Offset Y",
+ "Offset the position to copy from if the image is larger than the render layer",
+ 0,
+ INT_MAX);
+
+ RNA_define_verify_sdna(0);
+
+ rna_def_view_layer_common(srna, false);
+
+ prop = RNA_def_property(srna, "passes", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RenderPass");
+ RNA_def_property_collection_funcs(prop,
+ "rna_RenderLayer_passes_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ rna_def_render_passes(brna, prop);
+
+ RNA_define_verify_sdna(1);
}
static void rna_def_render_pass(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "RenderPass", NULL);
- RNA_def_struct_ui_text(srna, "Render Pass", "");
+ srna = RNA_def_struct(brna, "RenderPass", NULL);
+ RNA_def_struct_ui_text(srna, "Render Pass", "");
- RNA_define_verify_sdna(0);
+ RNA_define_verify_sdna(0);
- prop = RNA_def_property(srna, "fullname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "fullname");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "fullname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "fullname");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
- prop = RNA_def_property(srna, "channel_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "chan_id");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "channel_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "chan_id");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "channels", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "channels");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "channels", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "channels");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_multi_array(prop, 2, NULL);
- RNA_def_property_dynamic_array_funcs(prop, "rna_RenderPass_rect_get_length");
- RNA_def_property_float_funcs(prop, "rna_RenderPass_rect_get", "rna_RenderPass_rect_set", NULL);
+ prop = RNA_def_property(srna, "rect", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_multi_array(prop, 2, NULL);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_RenderPass_rect_get_length");
+ RNA_def_property_float_funcs(prop, "rna_RenderPass_rect_get", "rna_RenderPass_rect_set", NULL);
- prop = RNA_def_property(srna, "view_id", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "view_id");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "view_id", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "view_id");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_define_verify_sdna(1);
+ RNA_define_verify_sdna(1);
}
static void rna_def_render_bake_pixel(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "BakePixel", NULL);
- RNA_def_struct_ui_text(srna, "Bake Pixel", "");
+ srna = RNA_def_struct(brna, "BakePixel", NULL);
+ RNA_def_struct_ui_text(srna, "Bake Pixel", "");
- RNA_define_verify_sdna(0);
+ RNA_define_verify_sdna(0);
- prop = RNA_def_property(srna, "primitive_id", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "primitive_id");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "primitive_id", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "primitive_id");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "object_id", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "object_id");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "object_id", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "object_id");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_sdna(prop, NULL, "uv");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "uv", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_sdna(prop, NULL, "uv");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "du_dx", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "du_dx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "du_dx", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "du_dx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "du_dy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "du_dy");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "du_dy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "du_dy");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "dv_dx", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dv_dx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "dv_dx", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dv_dx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "dv_dy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dv_dy");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "dv_dy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dv_dy");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "next", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "BakePixel");
- RNA_def_property_pointer_funcs(prop, "rna_BakePixel_next_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "next", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "BakePixel");
+ RNA_def_property_pointer_funcs(prop, "rna_BakePixel_next_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_define_verify_sdna(1);
+ RNA_define_verify_sdna(1);
}
void RNA_def_render(BlenderRNA *brna)
{
- rna_def_render_engine(brna);
- rna_def_render_result(brna);
- rna_def_render_view(brna);
- rna_def_render_layer(brna);
- rna_def_render_pass(brna);
- rna_def_render_bake_pixel(brna);
+ rna_def_render_engine(brna);
+ rna_def_render_result(brna);
+ rna_def_render_view(brna);
+ rna_def_render_layer(brna);
+ rna_def_render_pass(brna);
+ rna_def_render_bake_pixel(brna);
}
#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index 169db8cf246..242bc63c09f 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -39,1401 +39,1543 @@
/* roles of objects in RigidBody Sims */
const EnumPropertyItem rna_enum_rigidbody_object_type_items[] = {
- {RBO_TYPE_ACTIVE, "ACTIVE", 0, "Active", "Object is directly controlled by simulation results"},
- {RBO_TYPE_PASSIVE, "PASSIVE", 0, "Passive", "Object is directly controlled by animation system"},
- {0, NULL, 0, NULL, NULL},
+ {RBO_TYPE_ACTIVE,
+ "ACTIVE",
+ 0,
+ "Active",
+ "Object is directly controlled by simulation results"},
+ {RBO_TYPE_PASSIVE,
+ "PASSIVE",
+ 0,
+ "Passive",
+ "Object is directly controlled by animation system"},
+ {0, NULL, 0, NULL, NULL},
};
/* collision shapes of objects in rigid body sim */
const EnumPropertyItem rna_enum_rigidbody_object_shape_items[] = {
- {RB_SHAPE_BOX, "BOX", ICON_MESH_CUBE, "Box", "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"},
- {RB_SHAPE_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""},
- {RB_SHAPE_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""},
- {RB_SHAPE_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""},
- {RB_SHAPE_CONE, "CONE", ICON_MESH_CONE, "Cone", ""},
- {RB_SHAPE_CONVEXH, "CONVEX_HULL", ICON_MESH_ICOSPHERE, "Convex Hull",
- "A mesh-like surface encompassing (i.e. shrinkwrap over) all vertices (best results with "
- "fewer vertices)"},
- {RB_SHAPE_TRIMESH, "MESH", ICON_MESH_MONKEY, "Mesh",
- "Mesh consisting of triangles only, allowing for more detailed interactions than convex hulls"},
- {0, NULL, 0, NULL, NULL},
+ {RB_SHAPE_BOX,
+ "BOX",
+ ICON_MESH_CUBE,
+ "Box",
+ "Box-like shapes (i.e. cubes), including planes (i.e. ground planes)"},
+ {RB_SHAPE_SPHERE, "SPHERE", ICON_MESH_UVSPHERE, "Sphere", ""},
+ {RB_SHAPE_CAPSULE, "CAPSULE", ICON_MESH_CAPSULE, "Capsule", ""},
+ {RB_SHAPE_CYLINDER, "CYLINDER", ICON_MESH_CYLINDER, "Cylinder", ""},
+ {RB_SHAPE_CONE, "CONE", ICON_MESH_CONE, "Cone", ""},
+ {RB_SHAPE_CONVEXH,
+ "CONVEX_HULL",
+ ICON_MESH_ICOSPHERE,
+ "Convex Hull",
+ "A mesh-like surface encompassing (i.e. shrinkwrap over) all vertices (best results with "
+ "fewer vertices)"},
+ {RB_SHAPE_TRIMESH,
+ "MESH",
+ ICON_MESH_MONKEY,
+ "Mesh",
+ "Mesh consisting of triangles only, allowing for more detailed interactions than convex "
+ "hulls"},
+ {0, NULL, 0, NULL, NULL},
};
/* collision shapes of constraints in rigid body sim */
const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = {
- {RBC_TYPE_FIXED, "FIXED", ICON_NONE, "Fixed", "Glue rigid bodies together"},
- {RBC_TYPE_POINT, "POINT", ICON_NONE, "Point", "Constrain rigid bodies to move around common pivot point"},
- {RBC_TYPE_HINGE, "HINGE", ICON_NONE, "Hinge", "Restrict rigid body rotation to one axis"},
- {RBC_TYPE_SLIDER, "SLIDER", ICON_NONE, "Slider", "Restrict rigid body translation to one axis"},
- {RBC_TYPE_PISTON, "PISTON", ICON_NONE, "Piston", "Restrict rigid body translation and rotation to one axis"},
- {RBC_TYPE_6DOF, "GENERIC", ICON_NONE, "Generic", "Restrict translation and rotation to specified axes"},
- {RBC_TYPE_6DOF_SPRING, "GENERIC_SPRING", ICON_NONE, "Generic Spring",
- "Restrict translation and rotation to specified axes with springs"},
- {RBC_TYPE_MOTOR, "MOTOR", ICON_NONE, "Motor", "Drive rigid body around or along an axis"},
- {0, NULL, 0, NULL, NULL},
+ {RBC_TYPE_FIXED, "FIXED", ICON_NONE, "Fixed", "Glue rigid bodies together"},
+ {RBC_TYPE_POINT,
+ "POINT",
+ ICON_NONE,
+ "Point",
+ "Constrain rigid bodies to move around common pivot point"},
+ {RBC_TYPE_HINGE, "HINGE", ICON_NONE, "Hinge", "Restrict rigid body rotation to one axis"},
+ {RBC_TYPE_SLIDER,
+ "SLIDER",
+ ICON_NONE,
+ "Slider",
+ "Restrict rigid body translation to one axis"},
+ {RBC_TYPE_PISTON,
+ "PISTON",
+ ICON_NONE,
+ "Piston",
+ "Restrict rigid body translation and rotation to one axis"},
+ {RBC_TYPE_6DOF,
+ "GENERIC",
+ ICON_NONE,
+ "Generic",
+ "Restrict translation and rotation to specified axes"},
+ {RBC_TYPE_6DOF_SPRING,
+ "GENERIC_SPRING",
+ ICON_NONE,
+ "Generic Spring",
+ "Restrict translation and rotation to specified axes with springs"},
+ {RBC_TYPE_MOTOR, "MOTOR", ICON_NONE, "Motor", "Drive rigid body around or along an axis"},
+ {0, NULL, 0, NULL, NULL},
};
/* bullet spring type */
static const EnumPropertyItem rna_enum_rigidbody_constraint_spring_type_items[] = {
- {RBC_SPRING_TYPE1, "SPRING1", ICON_NONE, "Blender 2.7", "Spring implementation used in blender 2.7. Damping is capped at 1.0"},
- {RBC_SPRING_TYPE2, "SPRING2", ICON_NONE, "Blender 2.8", "New implementation available since 2.8"},
- {0, NULL, 0, NULL, NULL},
+ {RBC_SPRING_TYPE1,
+ "SPRING1",
+ ICON_NONE,
+ "Blender 2.7",
+ "Spring implementation used in blender 2.7. Damping is capped at 1.0"},
+ {RBC_SPRING_TYPE2,
+ "SPRING2",
+ ICON_NONE,
+ "Blender 2.8",
+ "New implementation available since 2.8"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
/* mesh source for collision shape creation */
static const EnumPropertyItem rigidbody_mesh_source_items[] = {
- {RBO_MESH_BASE, "BASE", 0, "Base", "Base mesh"},
- {RBO_MESH_DEFORM, "DEFORM", 0, "Deform", "Deformations (shape keys, deform modifiers)"},
- {RBO_MESH_FINAL, "FINAL", 0, "Final", "All modifiers"},
- {0, NULL, 0, NULL, NULL},
+ {RBO_MESH_BASE, "BASE", 0, "Base", "Base mesh"},
+ {RBO_MESH_DEFORM, "DEFORM", 0, "Deform", "Deformations (shape keys, deform modifiers)"},
+ {RBO_MESH_FINAL, "FINAL", 0, "Final", "All modifiers"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#ifdef WITH_BULLET
-# include "RBI_api.h"
-#endif
-
-#include "BKE_rigidbody.h"
+# ifdef WITH_BULLET
+# include "RBI_api.h"
+# endif
-#include "WM_api.h"
+# include "BKE_rigidbody.h"
-#define RB_FLAG_SET(dest, value, flag) { \
- if (value) \
- dest |= flag; \
- else \
- dest &= ~flag; \
-}
+# include "WM_api.h"
+# define RB_FLAG_SET(dest, value, flag) \
+ { \
+ if (value) \
+ dest |= flag; \
+ else \
+ dest &= ~flag; \
+ }
/* ******************************** */
static void rna_RigidBodyWorld_reset(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
- BKE_rigidbody_cache_reset(rbw);
+ BKE_rigidbody_cache_reset(rbw);
}
static char *rna_RigidBodyWorld_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("rigidbody_world");
+ return BLI_strdup("rigidbody_world");
}
static void rna_RigidBodyWorld_num_solver_iterations_set(PointerRNA *ptr, int value)
{
- RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
- rbw->num_solver_iterations = value;
+ rbw->num_solver_iterations = value;
-#ifdef WITH_BULLET
- if (rbw->shared->physics_world) {
- RB_dworld_set_solver_iterations(rbw->shared->physics_world, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbw->shared->physics_world) {
+ RB_dworld_set_solver_iterations(rbw->shared->physics_world, value);
+ }
+# endif
}
static void rna_RigidBodyWorld_split_impulse_set(PointerRNA *ptr, bool value)
{
- RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
- RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
+ RB_FLAG_SET(rbw->flag, value, RBW_FLAG_USE_SPLIT_IMPULSE);
-#ifdef WITH_BULLET
- if (rbw->shared->physics_world) {
- RB_dworld_set_split_impulse(rbw->shared->physics_world, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbw->shared->physics_world) {
+ RB_dworld_set_split_impulse(rbw->shared->physics_world, value);
+ }
+# endif
}
-static void rna_RigidBodyWorld_objects_collection_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_RigidBodyWorld_objects_collection_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *ptr)
{
- RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
- BKE_rigidbody_objects_collection_validate(scene, rbw);
- rna_RigidBodyWorld_reset(bmain, scene, ptr);
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+ BKE_rigidbody_objects_collection_validate(scene, rbw);
+ rna_RigidBodyWorld_reset(bmain, scene, ptr);
}
-static void rna_RigidBodyWorld_constraints_collection_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+static void rna_RigidBodyWorld_constraints_collection_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *ptr)
{
- RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
- BKE_rigidbody_constraints_collection_validate(scene, rbw);
- rna_RigidBodyWorld_reset(bmain, scene, ptr);
+ RigidBodyWorld *rbw = (RigidBodyWorld *)ptr->data;
+ BKE_rigidbody_constraints_collection_validate(scene, rbw);
+ rna_RigidBodyWorld_reset(bmain, scene, ptr);
}
/* ******************************** */
static void rna_RigidBodyOb_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- RigidBodyWorld *rbw = scene->rigidbody_world;
+ RigidBodyWorld *rbw = scene->rigidbody_world;
- BKE_rigidbody_cache_reset(rbw);
+ BKE_rigidbody_cache_reset(rbw);
}
static void rna_RigidBodyOb_shape_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob = ptr->id.data;
+ Object *ob = ptr->id.data;
- rna_RigidBodyOb_reset(bmain, scene, ptr);
+ rna_RigidBodyOb_reset(bmain, scene, ptr);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
}
static void rna_RigidBodyOb_shape_reset(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
- RigidBodyWorld *rbw = scene->rigidbody_world;
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyWorld *rbw = scene->rigidbody_world;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- BKE_rigidbody_cache_reset(rbw);
- if (rbo->shared->physics_shape)
- rbo->flag |= RBO_FLAG_NEEDS_RESHAPE;
+ BKE_rigidbody_cache_reset(rbw);
+ if (rbo->shared->physics_shape)
+ rbo->flag |= RBO_FLAG_NEEDS_RESHAPE;
}
static char *rna_RigidBodyOb_path(PointerRNA *UNUSED(ptr))
{
- /* NOTE: this hardcoded path should work as long as only Objects have this */
- return BLI_strdup("rigid_body");
+ /* NOTE: this hardcoded path should work as long as only Objects have this */
+ return BLI_strdup("rigid_body");
}
static void rna_RigidBodyOb_type_set(PointerRNA *ptr, int value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->type = value;
- rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ rbo->type = value;
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
static void rna_RigidBodyOb_shape_set(PointerRNA *ptr, int value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->shape = value;
- rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ rbo->shape = value;
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
static void rna_RigidBodyOb_disabled_set(PointerRNA *ptr, bool value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
-
- RB_FLAG_SET(rbo->flag, !value, RBO_FLAG_DISABLED);
-
-#ifdef WITH_BULLET
- /* update kinematic state if necessary - only needed for active bodies */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
- RB_body_set_kinematic_state(rbo->shared->physics_object, !value);
- rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
- }
-#endif
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ RB_FLAG_SET(rbo->flag, !value, RBO_FLAG_DISABLED);
+
+# ifdef WITH_BULLET
+ /* update kinematic state if necessary - only needed for active bodies */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->shared->physics_object, !value);
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ }
+# endif
}
static void rna_RigidBodyOb_mass_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->mass = value;
+ rbo->mass = value;
-#ifdef WITH_BULLET
- /* only active bodies need mass update */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
- }
-#endif
+# ifdef WITH_BULLET
+ /* only active bodies need mass update */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
+ }
+# endif
}
static void rna_RigidBodyOb_friction_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->friction = value;
+ rbo->friction = value;
-#ifdef WITH_BULLET
- if (rbo->shared->physics_object) {
- RB_body_set_friction(rbo->shared->physics_object, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbo->shared->physics_object) {
+ RB_body_set_friction(rbo->shared->physics_object, value);
+ }
+# endif
}
static void rna_RigidBodyOb_restitution_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
-
- rbo->restitution = value;
-#ifdef WITH_BULLET
- if (rbo->shared->physics_object) {
- RB_body_set_restitution(rbo->shared->physics_object, value);
- }
-#endif
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ rbo->restitution = value;
+# ifdef WITH_BULLET
+ if (rbo->shared->physics_object) {
+ RB_body_set_restitution(rbo->shared->physics_object, value);
+ }
+# endif
}
static void rna_RigidBodyOb_collision_margin_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->margin = value;
+ rbo->margin = value;
-#ifdef WITH_BULLET
- if (rbo->shared->physics_shape) {
- RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo));
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbo->shared->physics_shape) {
+ RB_shape_set_margin(rbo->shared->physics_shape, RBO_GET_MARGIN(rbo));
+ }
+# endif
}
static void rna_RigidBodyOb_collision_collections_set(PointerRNA *ptr, const bool *values)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- int i;
-
- for (i = 0; i < 20; i++) {
- if (values[i])
- rbo->col_groups |= (1 << i);
- else
- rbo->col_groups &= ~(1 << i);
- }
- rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ int i;
+
+ for (i = 0; i < 20; i++) {
+ if (values[i])
+ rbo->col_groups |= (1 << i);
+ else
+ rbo->col_groups &= ~(1 << i);
+ }
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
}
static void rna_RigidBodyOb_kinematic_state_set(PointerRNA *ptr, bool value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
-
- RB_FLAG_SET(rbo->flag, value, RBO_FLAG_KINEMATIC);
-
-#ifdef WITH_BULLET
- /* update kinematic state if necessary */
- if (rbo->shared->physics_object) {
- RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
- RB_body_set_kinematic_state(rbo->shared->physics_object, value);
- rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
- }
-#endif
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+
+ RB_FLAG_SET(rbo->flag, value, RBO_FLAG_KINEMATIC);
+
+# ifdef WITH_BULLET
+ /* update kinematic state if necessary */
+ if (rbo->shared->physics_object) {
+ RB_body_set_mass(rbo->shared->physics_object, RBO_GET_MASS(rbo));
+ RB_body_set_kinematic_state(rbo->shared->physics_object, value);
+ rbo->flag |= RBO_FLAG_NEEDS_VALIDATE;
+ }
+# endif
}
static void rna_RigidBodyOb_activation_state_set(PointerRNA *ptr, bool value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- RB_FLAG_SET(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
+ RB_FLAG_SET(rbo->flag, value, RBO_FLAG_USE_DEACTIVATION);
-#ifdef WITH_BULLET
- /* update activation state if necessary - only active bodies can be deactivated */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_activation_state(rbo->shared->physics_object, value);
- }
-#endif
+# ifdef WITH_BULLET
+ /* update activation state if necessary - only active bodies can be deactivated */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_activation_state(rbo->shared->physics_object, value);
+ }
+# endif
}
static void rna_RigidBodyOb_linear_sleepThresh_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->lin_sleep_thresh = value;
+ rbo->lin_sleep_thresh = value;
-#ifdef WITH_BULLET
- /* only active bodies need sleep threshold update */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_linear_sleep_thresh(rbo->shared->physics_object, value);
- }
-#endif
+# ifdef WITH_BULLET
+ /* only active bodies need sleep threshold update */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_linear_sleep_thresh(rbo->shared->physics_object, value);
+ }
+# endif
}
static void rna_RigidBodyOb_angular_sleepThresh_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->ang_sleep_thresh = value;
+ rbo->ang_sleep_thresh = value;
-#ifdef WITH_BULLET
- /* only active bodies need sleep threshold update */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_angular_sleep_thresh(rbo->shared->physics_object, value);
- }
-#endif
+# ifdef WITH_BULLET
+ /* only active bodies need sleep threshold update */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_angular_sleep_thresh(rbo->shared->physics_object, value);
+ }
+# endif
}
static void rna_RigidBodyOb_linear_damping_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->lin_damping = value;
+ rbo->lin_damping = value;
-#ifdef WITH_BULLET
- /* only active bodies need damping update */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_linear_damping(rbo->shared->physics_object, value);
- }
-#endif
+# ifdef WITH_BULLET
+ /* only active bodies need damping update */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_linear_damping(rbo->shared->physics_object, value);
+ }
+# endif
}
static void rna_RigidBodyOb_angular_damping_set(PointerRNA *ptr, float value)
{
- RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
+ RigidBodyOb *rbo = (RigidBodyOb *)ptr->data;
- rbo->ang_damping = value;
+ rbo->ang_damping = value;
-#ifdef WITH_BULLET
- /* only active bodies need damping update */
- if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
- RB_body_set_angular_damping(rbo->shared->physics_object, value);
- }
-#endif
+# ifdef WITH_BULLET
+ /* only active bodies need damping update */
+ if ((rbo->shared->physics_object) && (rbo->type == RBO_TYPE_ACTIVE)) {
+ RB_body_set_angular_damping(rbo->shared->physics_object, value);
+ }
+# endif
}
static char *rna_RigidBodyCon_path(PointerRNA *UNUSED(ptr))
{
- /* NOTE: this hardcoded path should work as long as only Objects have this */
- return BLI_strdup("rigid_body_constraint");
+ /* NOTE: this hardcoded path should work as long as only Objects have this */
+ return BLI_strdup("rigid_body_constraint");
}
static void rna_RigidBodyCon_type_set(PointerRNA *ptr, int value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->type = value;
- rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+ rbc->type = value;
+ rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
}
static void rna_RigidBodyCon_spring_type_set(PointerRNA *ptr, int value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_type = value;
- rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+ rbc->spring_type = value;
+ rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
}
static void rna_RigidBodyCon_enabled_set(PointerRNA *ptr, bool value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- RB_FLAG_SET(rbc->flag, value, RBC_FLAG_ENABLED);
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_ENABLED);
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_enabled(rbc->physics_constraint, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_enabled(rbc->physics_constraint, value);
+ }
+# endif
}
static void rna_RigidBodyCon_disable_collisions_set(PointerRNA *ptr, bool value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- RB_FLAG_SET(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_DISABLE_COLLISIONS);
- rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
+ rbc->flag |= RBC_FLAG_NEEDS_VALIDATE;
}
static void rna_RigidBodyCon_use_breaking_set(PointerRNA *ptr, bool value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
-
- if (value) {
- rbc->flag |= RBC_FLAG_USE_BREAKING;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_breaking_threshold(rbc->physics_constraint, rbc->breaking_threshold);
- }
-#endif
- }
- else {
- rbc->flag &= ~RBC_FLAG_USE_BREAKING;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_breaking_threshold(rbc->physics_constraint, FLT_MAX);
- }
-#endif
- }
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ if (value) {
+ rbc->flag |= RBC_FLAG_USE_BREAKING;
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_breaking_threshold(rbc->physics_constraint, rbc->breaking_threshold);
+ }
+# endif
+ }
+ else {
+ rbc->flag &= ~RBC_FLAG_USE_BREAKING;
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_breaking_threshold(rbc->physics_constraint, FLT_MAX);
+ }
+# endif
+ }
}
static void rna_RigidBodyCon_breaking_threshold_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->breaking_threshold = value;
+ rbc->breaking_threshold = value;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_USE_BREAKING)) {
- RB_constraint_set_breaking_threshold(rbc->physics_constraint, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_USE_BREAKING)) {
+ RB_constraint_set_breaking_threshold(rbc->physics_constraint, value);
+ }
+# endif
}
static void rna_RigidBodyCon_override_solver_iterations_set(PointerRNA *ptr, bool value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
-
- if (value) {
- rbc->flag |= RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_solver_iterations(rbc->physics_constraint, rbc->num_solver_iterations);
- }
-#endif
- }
- else {
- rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_solver_iterations(rbc->physics_constraint, -1);
- }
-#endif
- }
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+
+ if (value) {
+ rbc->flag |= RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_solver_iterations(rbc->physics_constraint, rbc->num_solver_iterations);
+ }
+# endif
+ }
+ else {
+ rbc->flag &= ~RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS;
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_solver_iterations(rbc->physics_constraint, -1);
+ }
+# endif
+ }
}
static void rna_RigidBodyCon_num_solver_iterations_set(PointerRNA *ptr, int value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->num_solver_iterations = value;
+ rbc->num_solver_iterations = value;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS)) {
- RB_constraint_set_solver_iterations(rbc->physics_constraint, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint && (rbc->flag & RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS)) {
+ RB_constraint_set_solver_iterations(rbc->physics_constraint, value);
+ }
+# endif
}
-#ifdef WITH_BULLET
-static void rna_RigidBodyCon_do_set_spring_stiffness(RigidBodyCon *rbc, float value, int flag, int axis)
+# ifdef WITH_BULLET
+static void rna_RigidBodyCon_do_set_spring_stiffness(RigidBodyCon *rbc,
+ float value,
+ int flag,
+ int axis)
{
- if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & flag)) {
- switch (rbc->spring_type) {
- case RBC_SPRING_TYPE1:
- RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, axis, value);
- break;
- case RBC_SPRING_TYPE2:
- RB_constraint_set_stiffness_6dof_spring2(rbc->physics_constraint, axis, value);
- break;
- }
- }
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & flag)) {
+ switch (rbc->spring_type) {
+ case RBC_SPRING_TYPE1:
+ RB_constraint_set_stiffness_6dof_spring(rbc->physics_constraint, axis, value);
+ break;
+ case RBC_SPRING_TYPE2:
+ RB_constraint_set_stiffness_6dof_spring2(rbc->physics_constraint, axis, value);
+ break;
+ }
+ }
}
-#endif
+# endif
static void rna_RigidBodyCon_spring_stiffness_x_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_stiffness_x = value;
+ rbc->spring_stiffness_x = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_X, RB_LIMIT_LIN_X);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_X, RB_LIMIT_LIN_X);
+# endif
}
static void rna_RigidBodyCon_spring_stiffness_y_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_stiffness_y = value;
+ rbc->spring_stiffness_y = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_Y, RB_LIMIT_LIN_Y);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_Y, RB_LIMIT_LIN_Y);
+# endif
}
static void rna_RigidBodyCon_spring_stiffness_z_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_stiffness_z = value;
+ rbc->spring_stiffness_z = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_Z, RB_LIMIT_LIN_Z);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_Z, RB_LIMIT_LIN_Z);
+# endif
}
static void rna_RigidBodyCon_spring_stiffness_ang_x_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_stiffness_ang_x = value;
+ rbc->spring_stiffness_ang_x = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_ANG_X, RB_LIMIT_ANG_X);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_ANG_X, RB_LIMIT_ANG_X);
+# endif
}
static void rna_RigidBodyCon_spring_stiffness_ang_y_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_stiffness_ang_y = value;
+ rbc->spring_stiffness_ang_y = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_ANG_Y, RB_LIMIT_ANG_Y);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_ANG_Y, RB_LIMIT_ANG_Y);
+# endif
}
static void rna_RigidBodyCon_spring_stiffness_ang_z_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_stiffness_ang_z = value;
+ rbc->spring_stiffness_ang_z = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_ANG_Z, RB_LIMIT_ANG_Z);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_stiffness(rbc, value, RBC_FLAG_USE_SPRING_ANG_Z, RB_LIMIT_ANG_Z);
+# endif
}
-#ifdef WITH_BULLET
-static void rna_RigidBodyCon_do_set_spring_damping(RigidBodyCon *rbc, float value, int flag, int axis)
+# ifdef WITH_BULLET
+static void rna_RigidBodyCon_do_set_spring_damping(RigidBodyCon *rbc,
+ float value,
+ int flag,
+ int axis)
{
- if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & flag)) {
- switch (rbc->spring_type) {
- case RBC_SPRING_TYPE1:
- RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, axis, value);
- break;
- case RBC_SPRING_TYPE2:
- RB_constraint_set_damping_6dof_spring2(rbc->physics_constraint, axis, value);
- break;
- }
- }
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_6DOF_SPRING && (rbc->flag & flag)) {
+ switch (rbc->spring_type) {
+ case RBC_SPRING_TYPE1:
+ RB_constraint_set_damping_6dof_spring(rbc->physics_constraint, axis, value);
+ break;
+ case RBC_SPRING_TYPE2:
+ RB_constraint_set_damping_6dof_spring2(rbc->physics_constraint, axis, value);
+ break;
+ }
+ }
}
-#endif
+# endif
static void rna_RigidBodyCon_spring_damping_x_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_damping_x = value;
+ rbc->spring_damping_x = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_X, RB_LIMIT_LIN_X);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_X, RB_LIMIT_LIN_X);
+# endif
}
static void rna_RigidBodyCon_spring_damping_y_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_damping_y = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_Y, RB_LIMIT_LIN_Y);
-#endif
+ rbc->spring_damping_y = value;
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_Y, RB_LIMIT_LIN_Y);
+# endif
}
static void rna_RigidBodyCon_spring_damping_z_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_damping_z = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_Z, RB_LIMIT_LIN_Z);
-#endif
+ rbc->spring_damping_z = value;
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_Z, RB_LIMIT_LIN_Z);
+# endif
}
static void rna_RigidBodyCon_spring_damping_ang_x_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_damping_ang_x = value;
+ rbc->spring_damping_ang_x = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_ANG_X, RB_LIMIT_ANG_X);
-#endif
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_ANG_X, RB_LIMIT_ANG_X);
+# endif
}
static void rna_RigidBodyCon_spring_damping_ang_y_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_damping_ang_y = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_ANG_Y, RB_LIMIT_ANG_Y);
-#endif
+ rbc->spring_damping_ang_y = value;
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_ANG_Y, RB_LIMIT_ANG_Y);
+# endif
}
static void rna_RigidBodyCon_spring_damping_ang_z_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->spring_damping_ang_z = value;
-#ifdef WITH_BULLET
- rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_ANG_Z, RB_LIMIT_ANG_Z);
-#endif
+ rbc->spring_damping_ang_z = value;
+# ifdef WITH_BULLET
+ rna_RigidBodyCon_do_set_spring_damping(rbc, value, RBC_FLAG_USE_SPRING_ANG_Z, RB_LIMIT_ANG_Z);
+# endif
}
static void rna_RigidBodyCon_motor_lin_max_impulse_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->motor_lin_max_impulse = value;
+ rbc->motor_lin_max_impulse = value;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
- RB_constraint_set_max_impulse_motor(rbc->physics_constraint, value, rbc->motor_ang_max_impulse);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_max_impulse_motor(
+ rbc->physics_constraint, value, rbc->motor_ang_max_impulse);
+ }
+# endif
}
static void rna_RigidBodyCon_use_motor_lin_set(PointerRNA *ptr, bool value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_LIN);
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_enable_motor(rbc->physics_constraint,
+ rbc->flag & RBC_FLAG_USE_MOTOR_LIN,
+ rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
+ }
+# endif
}
static void rna_RigidBodyCon_use_motor_ang_set(PointerRNA *ptr, bool value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
+ RB_FLAG_SET(rbc->flag, value, RBC_FLAG_USE_MOTOR_ANG);
-#ifdef WITH_BULLET
- if (rbc->physics_constraint) {
- RB_constraint_set_enable_motor(rbc->physics_constraint, rbc->flag & RBC_FLAG_USE_MOTOR_LIN, rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint) {
+ RB_constraint_set_enable_motor(rbc->physics_constraint,
+ rbc->flag & RBC_FLAG_USE_MOTOR_LIN,
+ rbc->flag & RBC_FLAG_USE_MOTOR_ANG);
+ }
+# endif
}
static void rna_RigidBodyCon_motor_lin_target_velocity_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->motor_lin_target_velocity = value;
+ rbc->motor_lin_target_velocity = value;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
- RB_constraint_set_target_velocity_motor(rbc->physics_constraint, value, rbc->motor_ang_target_velocity);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_target_velocity_motor(
+ rbc->physics_constraint, value, rbc->motor_ang_target_velocity);
+ }
+# endif
}
static void rna_RigidBodyCon_motor_ang_max_impulse_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->motor_ang_max_impulse = value;
+ rbc->motor_ang_max_impulse = value;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
- RB_constraint_set_max_impulse_motor(rbc->physics_constraint, rbc->motor_lin_max_impulse, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_max_impulse_motor(
+ rbc->physics_constraint, rbc->motor_lin_max_impulse, value);
+ }
+# endif
}
static void rna_RigidBodyCon_motor_ang_target_velocity_set(PointerRNA *ptr, float value)
{
- RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
+ RigidBodyCon *rbc = (RigidBodyCon *)ptr->data;
- rbc->motor_ang_target_velocity = value;
+ rbc->motor_ang_target_velocity = value;
-#ifdef WITH_BULLET
- if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
- RB_constraint_set_target_velocity_motor(rbc->physics_constraint, rbc->motor_lin_target_velocity, value);
- }
-#endif
+# ifdef WITH_BULLET
+ if (rbc->physics_constraint && rbc->type == RBC_TYPE_MOTOR) {
+ RB_constraint_set_target_velocity_motor(
+ rbc->physics_constraint, rbc->motor_lin_target_velocity, value);
+ }
+# endif
}
/* Sweep test */
-static void rna_RigidBodyWorld_convex_sweep_test(
- RigidBodyWorld *rbw, ReportList *reports,
- Object *object, float ray_start[3], float ray_end[3],
- float r_location[3], float r_hitpoint[3], float r_normal[3], int *r_hit)
+static void rna_RigidBodyWorld_convex_sweep_test(RigidBodyWorld *rbw,
+ ReportList *reports,
+ Object *object,
+ float ray_start[3],
+ float ray_end[3],
+ float r_location[3],
+ float r_hitpoint[3],
+ float r_normal[3],
+ int *r_hit)
{
-#ifdef WITH_BULLET
- RigidBodyOb *rob = object->rigidbody_object;
-
- if (rbw->shared->physics_world != NULL && rob->shared->physics_object != NULL) {
- RB_world_convex_sweep_test(rbw->shared->physics_world, rob->shared->physics_object, ray_start, ray_end,
- r_location, r_hitpoint, r_normal, r_hit);
- if (*r_hit == -2) {
- BKE_report(reports, RPT_ERROR,
- "A non convex collision shape was passed to the function, use only convex collision shapes");
- }
- }
- else {
- *r_hit = -1;
- BKE_report(reports, RPT_ERROR, "Rigidbody world was not properly initialized, need to step the simulation first");
- }
-#else
- UNUSED_VARS(rbw, reports, object, ray_start, ray_end, r_location, r_hitpoint, r_normal, r_hit);
-#endif
+# ifdef WITH_BULLET
+ RigidBodyOb *rob = object->rigidbody_object;
+
+ if (rbw->shared->physics_world != NULL && rob->shared->physics_object != NULL) {
+ RB_world_convex_sweep_test(rbw->shared->physics_world,
+ rob->shared->physics_object,
+ ray_start,
+ ray_end,
+ r_location,
+ r_hitpoint,
+ r_normal,
+ r_hit);
+ if (*r_hit == -2) {
+ BKE_report(reports,
+ RPT_ERROR,
+ "A non convex collision shape was passed to the function, use only convex "
+ "collision shapes");
+ }
+ }
+ else {
+ *r_hit = -1;
+ BKE_report(reports,
+ RPT_ERROR,
+ "Rigidbody world was not properly initialized, need to step the simulation first");
+ }
+# else
+ UNUSED_VARS(rbw, reports, object, ray_start, ray_end, r_location, r_hitpoint, r_normal, r_hit);
+# endif
}
static PointerRNA rna_RigidBodyWorld_PointCache_get(PointerRNA *ptr)
{
- RigidBodyWorld *rbw = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_PointCache, rbw->shared->pointcache);
+ RigidBodyWorld *rbw = ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_PointCache, rbw->shared->pointcache);
}
-
#else
static void rna_def_rigidbody_world(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "RigidBodyWorld", NULL);
- RNA_def_struct_sdna(srna, "RigidBodyWorld");
- RNA_def_struct_ui_text(srna, "Rigid Body World", "Self-contained rigid body simulation environment and settings");
- RNA_def_struct_path_func(srna, "rna_RigidBodyWorld_path");
-
- /* groups */
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_pointer_sdna(prop, NULL, "group");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Collection", "Collection containing objects participating in this simulation");
- RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_objects_collection_update");
-
- prop = RNA_def_property(srna, "constraints", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Constraints", "Collection containing rigid body constraint objects");
- RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_constraints_collection_update");
-
- /* booleans */
- prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBW_FLAG_MUTED);
- RNA_def_property_ui_text(prop, "Enabled", "Simulation will be evaluated");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
- /* time scale */
- prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "time_scale");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Time Scale", "Change the speed of the simulation");
- RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
-
- /* timestep */
- prop = RNA_def_property(srna, "steps_per_second", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "steps_per_second");
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_range(prop, 60, 1000, 1, -1);
- RNA_def_property_int_default(prop, 60);
- RNA_def_property_ui_text(prop, "Steps Per Second",
- "Number of simulation steps taken per second (higher values are more accurate "
- "but slower)");
- RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
-
- /* constraint solver iterations */
- prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_range(prop, 10, 100, 1, -1);
- RNA_def_property_int_default(prop, 10);
- RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyWorld_num_solver_iterations_set", NULL);
- RNA_def_property_ui_text(prop, "Solver Iterations",
- "Number of constraint solver iterations made per simulation step (higher values are more "
- "accurate but slower)");
- RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
-
- /* split impulse */
- prop = RNA_def_property(srna, "use_split_impulse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBW_FLAG_USE_SPLIT_IMPULSE);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyWorld_split_impulse_set");
- RNA_def_property_ui_text(prop, "Split Impulse",
- "Reduce extra velocity that can build up when objects collide (lowers simulation "
- "stability a little so use only when necessary)");
- RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
-
- /* cache */
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_funcs(prop, "rna_RigidBodyWorld_PointCache_get", NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "PointCache");
- RNA_def_property_ui_text(prop, "Point Cache", "");
-
- /* effector weights */
- prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EffectorWeights");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Weights", "");
-
- /* Sweep test */
- func = RNA_def_function(srna, "convex_sweep_test", "rna_RigidBodyWorld_convex_sweep_test");
- RNA_def_function_ui_description(func, "Sweep test convex rigidbody against the current rigidbody world");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "object", "Object", "", "Rigidbody object with a convex collision shape");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- /* ray start and end */
- parm = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float_vector(func, "object_location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
- "The hit location of this sweep test", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "hitpoint", 3, NULL, -FLT_MAX, FLT_MAX, "Hitpoint",
- "The hit location of this sweep test", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
- "The face normal at the sweep test hit location", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_int(func, "has_hit", 0, 0, 0, "", "If the function has found collision point, value is 1, otherwise 0", 0, 0);
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "RigidBodyWorld", NULL);
+ RNA_def_struct_sdna(srna, "RigidBodyWorld");
+ RNA_def_struct_ui_text(
+ srna, "Rigid Body World", "Self-contained rigid body simulation environment and settings");
+ RNA_def_struct_path_func(srna, "rna_RigidBodyWorld_path");
+
+ /* groups */
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_sdna(prop, NULL, "group");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(
+ prop, "Collection", "Collection containing objects participating in this simulation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_objects_collection_update");
+
+ prop = RNA_def_property(srna, "constraints", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(
+ prop, "Constraints", "Collection containing rigid body constraint objects");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_constraints_collection_update");
+
+ /* booleans */
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBW_FLAG_MUTED);
+ RNA_def_property_ui_text(prop, "Enabled", "Simulation will be evaluated");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ /* time scale */
+ prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "time_scale");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Time Scale", "Change the speed of the simulation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* timestep */
+ prop = RNA_def_property(srna, "steps_per_second", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "steps_per_second");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 60, 1000, 1, -1);
+ RNA_def_property_int_default(prop, 60);
+ RNA_def_property_ui_text(
+ prop,
+ "Steps Per Second",
+ "Number of simulation steps taken per second (higher values are more accurate "
+ "but slower)");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* constraint solver iterations */
+ prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 10, 100, 1, -1);
+ RNA_def_property_int_default(prop, 10);
+ RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyWorld_num_solver_iterations_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Solver Iterations",
+ "Number of constraint solver iterations made per simulation step (higher values are more "
+ "accurate but slower)");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* split impulse */
+ prop = RNA_def_property(srna, "use_split_impulse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBW_FLAG_USE_SPLIT_IMPULSE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyWorld_split_impulse_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Split Impulse",
+ "Reduce extra velocity that can build up when objects collide (lowers simulation "
+ "stability a little so use only when necessary)");
+ RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
+
+ /* cache */
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_funcs(prop, "rna_RigidBodyWorld_PointCache_get", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ /* effector weights */
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ /* Sweep test */
+ func = RNA_def_function(srna, "convex_sweep_test", "rna_RigidBodyWorld_convex_sweep_test");
+ RNA_def_function_ui_description(
+ func, "Sweep test convex rigidbody against the current rigidbody world");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "object", "Object", "", "Rigidbody object with a convex collision shape");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ /* ray start and end */
+ parm = RNA_def_float_vector(func, "start", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float_vector(func, "end", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float_vector(func,
+ "object_location",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Location",
+ "The hit location of this sweep test",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "hitpoint",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Hitpoint",
+ "The hit location of this sweep test",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "normal",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Normal",
+ "The face normal at the sweep test hit location",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_int(func,
+ "has_hit",
+ 0,
+ 0,
+ 0,
+ "",
+ "If the function has found collision point, value is 1, otherwise 0",
+ 0,
+ 0);
+ RNA_def_function_output(func, parm);
}
static void rna_def_rigidbody_object(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
-
- srna = RNA_def_struct(brna, "RigidBodyObject", NULL);
- RNA_def_struct_sdna(srna, "RigidBodyOb");
- RNA_def_struct_ui_text(srna, "Rigid Body Object", "Settings for object participating in Rigid Body Simulation");
- RNA_def_struct_path_func(srna, "rna_RigidBodyOb_path");
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_rigidbody_object_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type", "Role of object in Rigid Body Simulations");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "mesh_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mesh_source");
- RNA_def_property_enum_items(prop, rigidbody_mesh_source_items);
- RNA_def_property_ui_text(prop, "Mesh Source", "Source of the mesh used to create collision shape");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* booleans */
- prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBO_FLAG_DISABLED);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_disabled_set");
- RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participates to the simulation");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shape");
- RNA_def_property_enum_items(prop, rna_enum_rigidbody_object_shape_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL);
- RNA_def_property_ui_text(prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_update");
-
- prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_KINEMATIC);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_kinematic_state_set");
- RNA_def_property_ui_text(prop, "Kinematic", "Allow rigid body to be controlled by the animation system");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEFORM);
- RNA_def_property_ui_text(prop, "Deforming", "Rigid body deforms during simulation");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Physics Parameters */
- prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
- RNA_def_property_float_sdna(prop, NULL, "mass");
- RNA_def_property_range(prop, 0.001f, FLT_MAX); // range must always be positive (and non-zero)
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_mass_set", NULL);
- RNA_def_property_ui_text(prop, "Mass", "How much the object 'weighs' irrespective of gravity");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Dynamics Parameters - Activation */
- // TODO: define and figure out how to implement these
-
- /* Dynamics Parameters - Deactivation */
- prop = RNA_def_property(srna, "use_deactivation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEACTIVATION);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_activation_state_set");
- RNA_def_property_ui_text(prop, "Enable Deactivation",
- "Enable deactivation of resting rigid bodies (increases performance and stability "
- "but can cause glitches)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_start_deactivated", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_START_DEACTIVATED);
- RNA_def_property_ui_text(prop, "Start Deactivated", "Deactivate rigid body at the start of the simulation");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "deactivate_linear_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "lin_sleep_thresh");
- RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
- RNA_def_property_float_default(prop, 0.4f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_sleepThresh_set", NULL);
- RNA_def_property_ui_text(prop, "Linear Velocity Deactivation Threshold",
- "Linear Velocity below which simulation stops simulating object");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "deactivate_angular_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "ang_sleep_thresh");
- RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_sleepThresh_set", NULL);
- RNA_def_property_ui_text(prop, "Angular Velocity Deactivation Threshold",
- "Angular Velocity below which simulation stops simulating object");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Dynamics Parameters - Damping Parameters */
- prop = RNA_def_property(srna, "linear_damping", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "lin_damping");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 0.04f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_damping_set", NULL);
- RNA_def_property_ui_text(prop, "Linear Damping", "Amount of linear velocity that is lost over time");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "angular_damping", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "ang_damping");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_damping_set", NULL);
- RNA_def_property_ui_text(prop, "Angular Damping", "Amount of angular velocity that is lost over time");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Collision Parameters - Surface Parameters */
- prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "friction");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_friction_set", NULL);
- RNA_def_property_ui_text(prop, "Friction", "Resistance of object to movement");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "restitution", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "restitution");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_restitution_set", NULL);
- RNA_def_property_ui_text(prop, "Restitution",
- "Tendency of object to bounce after colliding with another "
- "(0 = stays still, 1 = perfectly elastic)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Collision Parameters - Sensitivity */
- prop = RNA_def_property(srna, "use_margin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_MARGIN);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Collision Margin",
- "Use custom collision margin (some shapes will have a visible gap around them)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
-
- prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "margin");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
- RNA_def_property_float_default(prop, 0.04f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_collision_margin_set", NULL);
- RNA_def_property_ui_text(prop, "Collision Margin",
- "Threshold of distance near surface where collisions are still considered "
- "(best results when non-zero)");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
-
- prop = RNA_def_property(srna, "collision_collections", PROP_BOOLEAN, PROP_LAYER_MEMBER);
- RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
- RNA_def_property_array(prop, 20);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_collision_collections_set");
- RNA_def_property_ui_text(prop, "Collision Collections", "Collision collections rigid body belongs to");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "RigidBodyObject", NULL);
+ RNA_def_struct_sdna(srna, "RigidBodyOb");
+ RNA_def_struct_ui_text(
+ srna, "Rigid Body Object", "Settings for object participating in Rigid Body Simulation");
+ RNA_def_struct_path_func(srna, "rna_RigidBodyOb_path");
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_rigidbody_object_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "Role of object in Rigid Body Simulations");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "mesh_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mesh_source");
+ RNA_def_property_enum_items(prop, rigidbody_mesh_source_items);
+ RNA_def_property_ui_text(
+ prop, "Mesh Source", "Source of the mesh used to create collision shape");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* booleans */
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", RBO_FLAG_DISABLED);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_disabled_set");
+ RNA_def_property_ui_text(prop, "Enabled", "Rigid Body actively participates to the simulation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "collision_shape", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shape");
+ RNA_def_property_enum_items(prop, rna_enum_rigidbody_object_shape_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyOb_shape_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Collision Shape", "Collision Shape of object in Rigid Body Simulations");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_update");
+
+ prop = RNA_def_property(srna, "kinematic", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_KINEMATIC);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_kinematic_state_set");
+ RNA_def_property_ui_text(
+ prop, "Kinematic", "Allow rigid body to be controlled by the animation system");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_deform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEFORM);
+ RNA_def_property_ui_text(prop, "Deforming", "Rigid body deforms during simulation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Physics Parameters */
+ prop = RNA_def_property(srna, "mass", PROP_FLOAT, PROP_UNIT_MASS);
+ RNA_def_property_float_sdna(prop, NULL, "mass");
+ RNA_def_property_range(prop, 0.001f, FLT_MAX); // range must always be positive (and non-zero)
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_mass_set", NULL);
+ RNA_def_property_ui_text(prop, "Mass", "How much the object 'weighs' irrespective of gravity");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Dynamics Parameters - Activation */
+ // TODO: define and figure out how to implement these
+
+ /* Dynamics Parameters - Deactivation */
+ prop = RNA_def_property(srna, "use_deactivation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_DEACTIVATION);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_activation_state_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Enable Deactivation",
+ "Enable deactivation of resting rigid bodies (increases performance and stability "
+ "but can cause glitches)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_start_deactivated", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_START_DEACTIVATED);
+ RNA_def_property_ui_text(
+ prop, "Start Deactivated", "Deactivate rigid body at the start of the simulation");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "deactivate_linear_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "lin_sleep_thresh");
+ RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
+ RNA_def_property_float_default(prop, 0.4f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_sleepThresh_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "Linear Velocity Deactivation Threshold",
+ "Linear Velocity below which simulation stops simulating object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "deactivate_angular_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "ang_sleep_thresh");
+ RNA_def_property_range(prop, FLT_MIN, FLT_MAX); // range must always be positive (and non-zero)
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_sleepThresh_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "Angular Velocity Deactivation Threshold",
+ "Angular Velocity below which simulation stops simulating object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Dynamics Parameters - Damping Parameters */
+ prop = RNA_def_property(srna, "linear_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "lin_damping");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.04f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_linear_damping_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Linear Damping", "Amount of linear velocity that is lost over time");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "angular_damping", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "ang_damping");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_angular_damping_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Angular Damping", "Amount of angular velocity that is lost over time");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Collision Parameters - Surface Parameters */
+ prop = RNA_def_property(srna, "friction", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "friction");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_friction_set", NULL);
+ RNA_def_property_ui_text(prop, "Friction", "Resistance of object to movement");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "restitution", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "restitution");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 3);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_restitution_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "Restitution",
+ "Tendency of object to bounce after colliding with another "
+ "(0 = stays still, 1 = perfectly elastic)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Collision Parameters - Sensitivity */
+ prop = RNA_def_property(srna, "use_margin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBO_FLAG_USE_MARGIN);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(
+ prop,
+ "Collision Margin",
+ "Use custom collision margin (some shapes will have a visible gap around them)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
+
+ prop = RNA_def_property(srna, "collision_margin", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "margin");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 3);
+ RNA_def_property_float_default(prop, 0.04f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyOb_collision_margin_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Collision Margin",
+ "Threshold of distance near surface where collisions are still considered "
+ "(best results when non-zero)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_shape_reset");
+
+ prop = RNA_def_property(srna, "collision_collections", PROP_BOOLEAN, PROP_LAYER_MEMBER);
+ RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
+ RNA_def_property_array(prop, 20);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_collision_collections_set");
+ RNA_def_property_ui_text(
+ prop, "Collision Collections", "Collision collections rigid body belongs to");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
}
static void rna_def_rigidbody_constraint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "RigidBodyConstraint", NULL);
- RNA_def_struct_sdna(srna, "RigidBodyCon");
- RNA_def_struct_ui_text(srna, "Rigid Body Constraint",
- "Constraint influencing Objects inside Rigid Body Simulation");
- RNA_def_struct_path_func(srna, "rna_RigidBodyCon_path");
-
- /* Enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type", "Type of Rigid Body Constraint");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "spring_type");
- RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_spring_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_spring_type_set", NULL);
- RNA_def_property_ui_text(prop, "Spring Type", "Which implementation of spring to use");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_ENABLED);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_enabled_set");
- RNA_def_property_ui_text(prop, "Enabled", "Enable this constraint");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "disable_collisions", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_DISABLE_COLLISIONS);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_disable_collisions_set");
- RNA_def_property_ui_text(prop, "Disable Collisions", "Disable collisions between constrained rigid bodies");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "object1", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob1");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object 1", "First Rigid Body Object to be constrained");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "object2", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob2");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object 2", "Second Rigid Body Object to be constrained");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Breaking Threshold */
- prop = RNA_def_property(srna, "use_breaking", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_BREAKING);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_breaking_set");
- RNA_def_property_ui_text(prop, "Breakable",
- "Constraint can be broken if it receives an impulse above the threshold");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "breaking_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "breaking_threshold");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 100.0, 2);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_breaking_threshold_set", NULL);
- RNA_def_property_ui_text(prop, "Breaking Threshold",
- "Impulse threshold that must be reached for the constraint to break");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- /* Solver Iterations */
- prop = RNA_def_property(srna, "use_override_solver_iterations", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_override_solver_iterations_set");
- RNA_def_property_ui_text(prop, "Override Solver Iterations",
- "Override the number of solver iterations for this constraint");
- RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_int_default(prop, 10);
- RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyCon_num_solver_iterations_set", NULL);
- RNA_def_property_ui_text(prop, "Solver Iterations",
- "Number of constraint solver iterations made per simulation step (higher values are more "
- "accurate but slower)");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- /* Limits */
- prop = RNA_def_property(srna, "use_limit_lin_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_X);
- RNA_def_property_ui_text(prop, "X Axis", "Limit translation on X axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_limit_lin_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Y);
- RNA_def_property_ui_text(prop, "Y Axis", "Limit translation on Y axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_limit_lin_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Z);
- RNA_def_property_ui_text(prop, "Z Axis", "Limit translation on Z axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_limit_ang_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_X);
- RNA_def_property_ui_text(prop, "X Angle", "Limit rotation around X axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_limit_ang_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Y);
- RNA_def_property_ui_text(prop, "Y Angle", "Limit rotation around Y axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_limit_ang_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Z);
- RNA_def_property_ui_text(prop, "Z Angle", "Limit rotation around Z axis");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_spring_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_X);
- RNA_def_property_ui_text(prop, "X Spring", "Enable spring on X axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_spring_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Y);
- RNA_def_property_ui_text(prop, "Y Spring", "Enable spring on Y axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_spring_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Z);
- RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_spring_ang_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_X);
- RNA_def_property_ui_text(prop, "X Angle Spring", "Enable spring on X rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_spring_ang_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_Y);
- RNA_def_property_ui_text(prop, "Y Angle Spring", "Enable spring on Y rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_spring_ang_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_Z);
- RNA_def_property_ui_text(prop, "Z Angle Spring", "Enable spring on Z rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_motor_lin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_LIN);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_lin_set");
- RNA_def_property_ui_text(prop, "Linear Motor", "Enable linear motor");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "use_motor_ang", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_ANG);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_ang_set");
- RNA_def_property_ui_text(prop, "Angular Motor", "Enable angular motor");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower");
- RNA_def_property_float_default(prop, -1.0f);
- RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of X axis translation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_lin_x_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_upper");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of X axis translation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_lin_y_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_lower");
- RNA_def_property_float_default(prop, -1.0f);
- RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of Y axis translation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_lin_y_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_upper");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of Y axis translation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_lin_z_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_lower");
- RNA_def_property_float_default(prop, -1.0f);
- RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of Z axis translation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_lin_z_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_upper");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of Z axis translation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_ang_x_lower", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_lower");
- RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
- RNA_def_property_float_default(prop, -M_PI_4);
- RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of X axis rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_ang_x_upper", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_upper");
- RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
- RNA_def_property_float_default(prop, M_PI_4);
- RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of X axis rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_ang_y_lower", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_lower");
- RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
- RNA_def_property_float_default(prop, -M_PI_4);
- RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of Y axis rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_ang_y_upper", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_upper");
- RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
- RNA_def_property_float_default(prop, M_PI_4);
- RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of Y axis rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_ang_z_lower", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_lower");
- RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
- RNA_def_property_float_default(prop, -M_PI_4);
- RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of Z axis rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "limit_ang_z_upper", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_upper");
- RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
- RNA_def_property_float_default(prop, M_PI_4);
- RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of Z axis rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_x");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_x_set", NULL);
- RNA_def_property_ui_text(prop, "X Axis Stiffness", "Stiffness on the X axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_y");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_y_set", NULL);
- RNA_def_property_ui_text(prop, "Y Axis Stiffness", "Stiffness on the Y axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_z");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_z_set", NULL);
- RNA_def_property_ui_text(prop, "Z Axis Stiffness", "Stiffness on the Z axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_stiffness_ang_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_x");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_x_set", NULL);
- RNA_def_property_ui_text(prop, "X Angle Stiffness", "Stiffness on the X rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_stiffness_ang_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_y");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_y_set", NULL);
- RNA_def_property_ui_text(prop, "Y Angle Stiffness", "Stiffness on the Y rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_stiffness_ang_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_z");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_z_set", NULL);
- RNA_def_property_ui_text(prop, "Z Angle Stiffness", "Stiffness on the Z rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_damping_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_damping_x");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_x_set", NULL);
- RNA_def_property_ui_text(prop, "Damping X", "Damping on the X axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_damping_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_damping_y");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_y_set", NULL);
- RNA_def_property_ui_text(prop, "Damping Y", "Damping on the Y axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_damping_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_damping_z");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL);
- RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_damping_ang_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_x");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_x_set", NULL);
- RNA_def_property_ui_text(prop, "Damping X Angle", "Damping on the X rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_damping_ang_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_y");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_y_set", NULL);
- RNA_def_property_ui_text(prop, "Damping Y Angle", "Damping on the Y rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "spring_damping_ang_z", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_z");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_z_set", NULL);
- RNA_def_property_ui_text(prop, "Damping Z Angle", "Damping on the Z rotational axis");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "motor_lin_target_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
- RNA_def_property_float_sdna(prop, NULL, "motor_lin_target_velocity");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_target_velocity_set", NULL);
- RNA_def_property_ui_text(prop, "Target Velocity", "Target linear motor velocity");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "motor_lin_max_impulse", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "motor_lin_max_impulse");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_max_impulse_set", NULL);
- RNA_def_property_ui_text(prop, "Max Impulse", "Maximum linear motor impulse");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "motor_ang_target_velocity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "motor_ang_target_velocity");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_target_velocity_set", NULL);
- RNA_def_property_ui_text(prop, "Target Velocity", "Target angular motor velocity");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
-
- prop = RNA_def_property(srna, "motor_ang_max_impulse", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "motor_ang_max_impulse");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_max_impulse_set", NULL);
- RNA_def_property_ui_text(prop, "Max Impulse", "Maximum angular motor impulse");
- RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "RigidBodyConstraint", NULL);
+ RNA_def_struct_sdna(srna, "RigidBodyCon");
+ RNA_def_struct_ui_text(srna,
+ "Rigid Body Constraint",
+ "Constraint influencing Objects inside Rigid Body Simulation");
+ RNA_def_struct_path_func(srna, "rna_RigidBodyCon_path");
+
+ /* Enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "Type of Rigid Body Constraint");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "spring_type");
+ RNA_def_property_enum_items(prop, rna_enum_rigidbody_constraint_spring_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RigidBodyCon_spring_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Spring Type", "Which implementation of spring to use");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_ENABLED);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_enabled_set");
+ RNA_def_property_ui_text(prop, "Enabled", "Enable this constraint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "disable_collisions", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_DISABLE_COLLISIONS);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_disable_collisions_set");
+ RNA_def_property_ui_text(
+ prop, "Disable Collisions", "Disable collisions between constrained rigid bodies");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "object1", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob1");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object 1", "First Rigid Body Object to be constrained");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "object2", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob2");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object 2", "Second Rigid Body Object to be constrained");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Breaking Threshold */
+ prop = RNA_def_property(srna, "use_breaking", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_BREAKING);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_breaking_set");
+ RNA_def_property_ui_text(
+ prop, "Breakable", "Constraint can be broken if it receives an impulse above the threshold");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "breaking_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "breaking_threshold");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 100.0, 2);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_breaking_threshold_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "Breaking Threshold",
+ "Impulse threshold that must be reached for the constraint to break");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ /* Solver Iterations */
+ prop = RNA_def_property(srna, "use_override_solver_iterations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_OVERRIDE_SOLVER_ITERATIONS);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_override_solver_iterations_set");
+ RNA_def_property_ui_text(prop,
+ "Override Solver Iterations",
+ "Override the number of solver iterations for this constraint");
+ RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "solver_iterations", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "num_solver_iterations");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_int_default(prop, 10);
+ RNA_def_property_int_funcs(prop, NULL, "rna_RigidBodyCon_num_solver_iterations_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Solver Iterations",
+ "Number of constraint solver iterations made per simulation step (higher values are more "
+ "accurate but slower)");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ /* Limits */
+ prop = RNA_def_property(srna, "use_limit_lin_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_X);
+ RNA_def_property_ui_text(prop, "X Axis", "Limit translation on X axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_lin_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Y);
+ RNA_def_property_ui_text(prop, "Y Axis", "Limit translation on Y axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_lin_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_LIN_Z);
+ RNA_def_property_ui_text(prop, "Z Axis", "Limit translation on Z axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_ang_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_X);
+ RNA_def_property_ui_text(prop, "X Angle", "Limit rotation around X axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_ang_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Y);
+ RNA_def_property_ui_text(prop, "Y Angle", "Limit rotation around Y axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_limit_ang_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_LIMIT_ANG_Z);
+ RNA_def_property_ui_text(prop, "Z Angle", "Limit rotation around Z axis");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_X);
+ RNA_def_property_ui_text(prop, "X Spring", "Enable spring on X axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Y);
+ RNA_def_property_ui_text(prop, "Y Spring", "Enable spring on Y axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_Z);
+ RNA_def_property_ui_text(prop, "Z Spring", "Enable spring on Z axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_ang_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_X);
+ RNA_def_property_ui_text(prop, "X Angle Spring", "Enable spring on X rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_ang_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_Y);
+ RNA_def_property_ui_text(prop, "Y Angle Spring", "Enable spring on Y rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_spring_ang_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_SPRING_ANG_Z);
+ RNA_def_property_ui_text(prop, "Z Angle Spring", "Enable spring on Z rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_motor_lin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_LIN);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_lin_set");
+ RNA_def_property_ui_text(prop, "Linear Motor", "Enable linear motor");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "use_motor_ang", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", RBC_FLAG_USE_MOTOR_ANG);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyCon_use_motor_ang_set");
+ RNA_def_property_ui_text(prop, "Angular Motor", "Enable angular motor");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_x_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_lower");
+ RNA_def_property_float_default(prop, -1.0f);
+ RNA_def_property_ui_text(prop, "Lower X Limit", "Lower limit of X axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_x_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_x_upper");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Upper X Limit", "Upper limit of X axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_y_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_lower");
+ RNA_def_property_float_default(prop, -1.0f);
+ RNA_def_property_ui_text(prop, "Lower Y Limit", "Lower limit of Y axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_y_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_y_upper");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Upper Y Limit", "Upper limit of Y axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_z_lower", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_lower");
+ RNA_def_property_float_default(prop, -1.0f);
+ RNA_def_property_ui_text(prop, "Lower Z Limit", "Lower limit of Z axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_lin_z_upper", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_float_sdna(prop, NULL, "limit_lin_z_upper");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Upper Z Limit", "Upper limit of Z axis translation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_x_lower", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_lower");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, -M_PI_4);
+ RNA_def_property_ui_text(prop, "Lower X Angle Limit", "Lower limit of X axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_x_upper", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_x_upper");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, M_PI_4);
+ RNA_def_property_ui_text(prop, "Upper X Angle Limit", "Upper limit of X axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_y_lower", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_lower");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, -M_PI_4);
+ RNA_def_property_ui_text(prop, "Lower Y Angle Limit", "Lower limit of Y axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_y_upper", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_y_upper");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, M_PI_4);
+ RNA_def_property_ui_text(prop, "Upper Y Angle Limit", "Upper limit of Y axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_z_lower", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_lower");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, -M_PI_4);
+ RNA_def_property_ui_text(prop, "Lower Z Angle Limit", "Lower limit of Z axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "limit_ang_z_upper", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "limit_ang_z_upper");
+ RNA_def_property_range(prop, -M_PI * 2, M_PI * 2);
+ RNA_def_property_float_default(prop, M_PI_4);
+ RNA_def_property_ui_text(prop, "Upper Z Angle Limit", "Upper limit of Z axis rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_x");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_x_set", NULL);
+ RNA_def_property_ui_text(prop, "X Axis Stiffness", "Stiffness on the X axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_y");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_y_set", NULL);
+ RNA_def_property_ui_text(prop, "Y Axis Stiffness", "Stiffness on the Y axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_z");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_z_set", NULL);
+ RNA_def_property_ui_text(prop, "Z Axis Stiffness", "Stiffness on the Z axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_ang_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_x");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_x_set", NULL);
+ RNA_def_property_ui_text(prop, "X Angle Stiffness", "Stiffness on the X rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_ang_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_y");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_y_set", NULL);
+ RNA_def_property_ui_text(prop, "Y Angle Stiffness", "Stiffness on the Y rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_stiffness_ang_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_stiffness_ang_z");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_stiffness_ang_z_set", NULL);
+ RNA_def_property_ui_text(prop, "Z Angle Stiffness", "Stiffness on the Z rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_x");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_x_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping X", "Damping on the X axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_y");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_y_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping Y", "Damping on the Y axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_z");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_z_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping Z", "Damping on the Z axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_ang_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_x");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_x_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping X Angle", "Damping on the X rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_ang_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_y");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_y_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping Y Angle", "Damping on the Y rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "spring_damping_ang_z", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "spring_damping_ang_z");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_spring_damping_ang_z_set", NULL);
+ RNA_def_property_ui_text(prop, "Damping Z Angle", "Damping on the Z rotational axis");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_lin_target_velocity", PROP_FLOAT, PROP_UNIT_VELOCITY);
+ RNA_def_property_float_sdna(prop, NULL, "motor_lin_target_velocity");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_target_velocity_set", NULL);
+ RNA_def_property_ui_text(prop, "Target Velocity", "Target linear motor velocity");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_lin_max_impulse", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "motor_lin_max_impulse");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_lin_max_impulse_set", NULL);
+ RNA_def_property_ui_text(prop, "Max Impulse", "Maximum linear motor impulse");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_ang_target_velocity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "motor_ang_target_velocity");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -100.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_target_velocity_set", NULL);
+ RNA_def_property_ui_text(prop, "Target Velocity", "Target angular motor velocity");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
+
+ prop = RNA_def_property(srna, "motor_ang_max_impulse", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "motor_ang_max_impulse");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RigidBodyCon_motor_ang_max_impulse_set", NULL);
+ RNA_def_property_ui_text(prop, "Max Impulse", "Maximum angular motor impulse");
+ RNA_def_property_update(prop, NC_OBJECT, "rna_RigidBodyOb_reset");
}
void RNA_def_rigidbody(BlenderRNA *brna)
{
- rna_def_rigidbody_world(brna);
- rna_def_rigidbody_object(brna);
- rna_def_rigidbody_constraint(brna);
+ rna_def_rigidbody_world(brna);
+ rna_def_rigidbody_object(brna);
+ rna_def_rigidbody_constraint(brna);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c
index c980c306843..aa5ea62657b 100644
--- a/source/blender/makesrna/intern/rna_rna.c
+++ b/source/blender/makesrna/intern/rna_rna.c
@@ -36,13 +36,13 @@
/* Reuse for dynamic types */
const EnumPropertyItem DummyRNA_NULL_items[] = {
- {0, NULL, 0, NULL, NULL},
+ {0, NULL, 0, NULL, NULL},
};
/* Reuse for dynamic types with default value */
const EnumPropertyItem DummyRNA_DEFAULT_items[] = {
- {0, "DEFAULT", 0, "Default", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "DEFAULT", 0, "Default", ""},
+ {0, NULL, 0, NULL, NULL},
};
/** \} */
@@ -51,140 +51,139 @@ const EnumPropertyItem DummyRNA_DEFAULT_items[] = {
/** \name RNA Enum's
* \{ */
-
const EnumPropertyItem rna_enum_property_type_items[] = {
- {PROP_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
- {PROP_INT, "INT", 0, "Integer", ""},
- {PROP_FLOAT, "FLOAT", 0, "Float", ""},
- {PROP_STRING, "STRING", 0, "String", ""},
- {PROP_ENUM, "ENUM", 0, "Enumeration", ""},
- {PROP_POINTER, "POINTER", 0, "Pointer", ""},
- {PROP_COLLECTION, "COLLECTION", 0, "Collection", ""},
- {0, NULL, 0, NULL, NULL},
+ {PROP_BOOLEAN, "BOOLEAN", 0, "Boolean", ""},
+ {PROP_INT, "INT", 0, "Integer", ""},
+ {PROP_FLOAT, "FLOAT", 0, "Float", ""},
+ {PROP_STRING, "STRING", 0, "String", ""},
+ {PROP_ENUM, "ENUM", 0, "Enumeration", ""},
+ {PROP_POINTER, "POINTER", 0, "Pointer", ""},
+ {PROP_COLLECTION, "COLLECTION", 0, "Collection", ""},
+ {0, NULL, 0, NULL, NULL},
};
/* XXX Keep in sync with bpy_props.c's property_subtype_xxx_items ???
* Currently it is not...
*/
const EnumPropertyItem rna_enum_property_subtype_items[] = {
- {PROP_NONE, "NONE", 0, "None", ""},
-
- /* strings */
- {PROP_FILEPATH, "FILEPATH", 0, "File Path", ""},
- {PROP_DIRPATH, "DIRPATH", 0, "Directory Path", ""},
- {PROP_FILENAME, "FILENAME", 0, "File Name", ""},
- {PROP_PASSWORD, "PASSWORD", 0, "Password", "A string that is displayed hidden ('********')"},
-
- /* numbers */
- {PROP_PIXEL, "PIXEL", 0, "Pixel", ""},
- {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
- {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
- {PROP_FACTOR, "FACTOR", 0, "Factor", ""},
- {PROP_ANGLE, "ANGLE", 0, "Angle", ""},
- {PROP_TIME, "TIME", 0, "Time", ""},
- {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {PROP_DISTANCE_CAMERA, "DISTANCE_CAMERA", 0, "Camera Distance", ""},
-
- /* number arrays */
- {PROP_COLOR, "COLOR", 0, "Color", ""},
- {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
- {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
- {PROP_VELOCITY, "VELOCITY", 0, "Velocity", ""},
- {PROP_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
- {PROP_MATRIX, "MATRIX", 0, "Matrix", ""},
- {PROP_EULER, "EULER", 0, "Euler Angles", ""},
- {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
- {PROP_AXISANGLE, "AXISANGLE", 0, "Axis-Angle", ""},
- {PROP_XYZ, "XYZ", 0, "XYZ", ""},
- {PROP_XYZ_LENGTH, "XYZ_LENGTH", 0, "XYZ Length", ""},
- {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Color", ""},
- {PROP_COORDS, "COORDS", 0, "Coordinates", ""},
-
- /* booleans */
- {PROP_LAYER, "LAYER", 0, "Layer", ""},
- {PROP_LAYER_MEMBER, "LAYER_MEMBER", 0, "Layer Member", ""},
- {0, NULL, 0, NULL, NULL},
+ {PROP_NONE, "NONE", 0, "None", ""},
+
+ /* strings */
+ {PROP_FILEPATH, "FILEPATH", 0, "File Path", ""},
+ {PROP_DIRPATH, "DIRPATH", 0, "Directory Path", ""},
+ {PROP_FILENAME, "FILENAME", 0, "File Name", ""},
+ {PROP_PASSWORD, "PASSWORD", 0, "Password", "A string that is displayed hidden ('********')"},
+
+ /* numbers */
+ {PROP_PIXEL, "PIXEL", 0, "Pixel", ""},
+ {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned", ""},
+ {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
+ {PROP_FACTOR, "FACTOR", 0, "Factor", ""},
+ {PROP_ANGLE, "ANGLE", 0, "Angle", ""},
+ {PROP_TIME, "TIME", 0, "Time", ""},
+ {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
+ {PROP_DISTANCE_CAMERA, "DISTANCE_CAMERA", 0, "Camera Distance", ""},
+
+ /* number arrays */
+ {PROP_COLOR, "COLOR", 0, "Color", ""},
+ {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
+ {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
+ {PROP_VELOCITY, "VELOCITY", 0, "Velocity", ""},
+ {PROP_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
+ {PROP_MATRIX, "MATRIX", 0, "Matrix", ""},
+ {PROP_EULER, "EULER", 0, "Euler Angles", ""},
+ {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
+ {PROP_AXISANGLE, "AXISANGLE", 0, "Axis-Angle", ""},
+ {PROP_XYZ, "XYZ", 0, "XYZ", ""},
+ {PROP_XYZ_LENGTH, "XYZ_LENGTH", 0, "XYZ Length", ""},
+ {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Color", ""},
+ {PROP_COORDS, "COORDS", 0, "Coordinates", ""},
+
+ /* booleans */
+ {PROP_LAYER, "LAYER", 0, "Layer", ""},
+ {PROP_LAYER_MEMBER, "LAYER_MEMBER", 0, "Layer Member", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_property_unit_items[] = {
- {PROP_UNIT_NONE, "NONE", 0, "None", ""},
- {PROP_UNIT_LENGTH, "LENGTH", 0, "Length", ""},
- {PROP_UNIT_AREA, "AREA", 0, "Area", ""},
- {PROP_UNIT_VOLUME, "VOLUME", 0, "Volume", ""},
- {PROP_UNIT_ROTATION, "ROTATION", 0, "Rotation", ""},
- {PROP_UNIT_TIME, "TIME", 0, "Time", ""},
- {PROP_UNIT_VELOCITY, "VELOCITY", 0, "Velocity", ""},
- {PROP_UNIT_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
- {PROP_UNIT_MASS, "MASS", 0, "Mass", ""},
- {PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""},
- {PROP_UNIT_POWER, "POWER", 0, "Power", ""},
- {0, NULL, 0, NULL, NULL},
+ {PROP_UNIT_NONE, "NONE", 0, "None", ""},
+ {PROP_UNIT_LENGTH, "LENGTH", 0, "Length", ""},
+ {PROP_UNIT_AREA, "AREA", 0, "Area", ""},
+ {PROP_UNIT_VOLUME, "VOLUME", 0, "Volume", ""},
+ {PROP_UNIT_ROTATION, "ROTATION", 0, "Rotation", ""},
+ {PROP_UNIT_TIME, "TIME", 0, "Time", ""},
+ {PROP_UNIT_VELOCITY, "VELOCITY", 0, "Velocity", ""},
+ {PROP_UNIT_ACCELERATION, "ACCELERATION", 0, "Acceleration", ""},
+ {PROP_UNIT_MASS, "MASS", 0, "Mass", ""},
+ {PROP_UNIT_CAMERA, "CAMERA", 0, "Camera", ""},
+ {PROP_UNIT_POWER, "POWER", 0, "Power", ""},
+ {0, NULL, 0, NULL, NULL},
};
/** \} */
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
-#include "BLI_ghash.h"
-#include "BLI_string.h"
+# include "MEM_guardedalloc.h"
+# include "BLI_ghash.h"
+# include "BLI_string.h"
-#include "BKE_library_override.h"
+# include "BKE_library_override.h"
/* Struct */
static void rna_Struct_identifier_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((StructRNA *)ptr->data)->identifier);
+ strcpy(value, ((StructRNA *)ptr->data)->identifier);
}
static int rna_Struct_identifier_length(PointerRNA *ptr)
{
- return strlen(((StructRNA *)ptr->data)->identifier);
+ return strlen(((StructRNA *)ptr->data)->identifier);
}
static void rna_Struct_description_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((StructRNA *)ptr->data)->description);
+ strcpy(value, ((StructRNA *)ptr->data)->description);
}
static int rna_Struct_description_length(PointerRNA *ptr)
{
- return strlen(((StructRNA *)ptr->data)->description);
+ return strlen(((StructRNA *)ptr->data)->description);
}
static void rna_Struct_name_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((StructRNA *)ptr->data)->name);
+ strcpy(value, ((StructRNA *)ptr->data)->name);
}
static int rna_Struct_name_length(PointerRNA *ptr)
{
- return strlen(((StructRNA *)ptr->data)->name);
+ return strlen(((StructRNA *)ptr->data)->name);
}
static void rna_Struct_translation_context_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((StructRNA *)ptr->data)->translation_context);
+ strcpy(value, ((StructRNA *)ptr->data)->translation_context);
}
static int rna_Struct_translation_context_length(PointerRNA *ptr)
{
- return strlen(((StructRNA *)ptr->data)->translation_context);
+ return strlen(((StructRNA *)ptr->data)->translation_context);
}
static PointerRNA rna_Struct_base_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA *)ptr->data)->base);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA *)ptr->data)->base);
}
static PointerRNA rna_Struct_nested_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA *)ptr->data)->nested);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((StructRNA *)ptr->data)->nested);
}
static PointerRNA rna_Struct_name_property_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_Property, ((StructRNA *)ptr->data)->nameproperty);
+ return rna_pointer_inherit_refine(ptr, &RNA_Property, ((StructRNA *)ptr->data)->nameproperty);
}
/* Struct property iteration. This is quite complicated, the purpose is to
@@ -193,174 +192,182 @@ static PointerRNA rna_Struct_name_property_get(PointerRNA *ptr)
static int rna_idproperty_known(CollectionPropertyIterator *iter, void *data)
{
- IDProperty *idprop = (IDProperty *)data;
- PropertyRNA *prop;
- StructRNA *ptype = iter->builtin_parent.type;
+ IDProperty *idprop = (IDProperty *)data;
+ PropertyRNA *prop;
+ StructRNA *ptype = iter->builtin_parent.type;
- /* function to skip any id properties that are already known by RNA,
- * for the second loop where we go over unknown id properties */
- do {
- for (prop = ptype->cont.properties.first; prop; prop = prop->next)
- if ((prop->flag_internal & PROP_INTERN_BUILTIN) == 0 && STREQ(prop->identifier, idprop->name))
- return 1;
- } while ((ptype = ptype->base));
+ /* function to skip any id properties that are already known by RNA,
+ * for the second loop where we go over unknown id properties */
+ do {
+ for (prop = ptype->cont.properties.first; prop; prop = prop->next)
+ if ((prop->flag_internal & PROP_INTERN_BUILTIN) == 0 &&
+ STREQ(prop->identifier, idprop->name))
+ return 1;
+ } while ((ptype = ptype->base));
- return 0;
+ return 0;
}
static int rna_property_builtin(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- PropertyRNA *prop = (PropertyRNA *)data;
+ PropertyRNA *prop = (PropertyRNA *)data;
- /* function to skip builtin rna properties */
+ /* function to skip builtin rna properties */
- return (prop->flag_internal & PROP_INTERN_BUILTIN);
+ return (prop->flag_internal & PROP_INTERN_BUILTIN);
}
static int rna_function_builtin(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- FunctionRNA *func = (FunctionRNA *)data;
+ FunctionRNA *func = (FunctionRNA *)data;
- /* function to skip builtin rna functions */
+ /* function to skip builtin rna functions */
- return (func->flag & FUNC_BUILTIN);
+ return (func->flag & FUNC_BUILTIN);
}
-static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter, IteratorSkipFunc skip, int funcs)
+static void rna_inheritance_next_level_restart(CollectionPropertyIterator *iter,
+ IteratorSkipFunc skip,
+ int funcs)
{
- /* RNA struct inheritance */
- while (!iter->valid && iter->level > 0) {
- StructRNA *srna;
- int i;
+ /* RNA struct inheritance */
+ while (!iter->valid && iter->level > 0) {
+ StructRNA *srna;
+ int i;
- srna = (StructRNA *)iter->parent.data;
- iter->level--;
- for (i = iter->level; i > 0; i--)
- srna = srna->base;
+ srna = (StructRNA *)iter->parent.data;
+ iter->level--;
+ for (i = iter->level; i > 0; i--)
+ srna = srna->base;
- rna_iterator_listbase_end(iter);
+ rna_iterator_listbase_end(iter);
- if (funcs)
- rna_iterator_listbase_begin(iter, &srna->functions, skip);
- else
- rna_iterator_listbase_begin(iter, &srna->cont.properties, skip);
- }
+ if (funcs)
+ rna_iterator_listbase_begin(iter, &srna->functions, skip);
+ else
+ rna_iterator_listbase_begin(iter, &srna->cont.properties, skip);
+ }
}
-static void rna_inheritance_properties_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
+static void rna_inheritance_properties_listbase_begin(CollectionPropertyIterator *iter,
+ ListBase *lb,
IteratorSkipFunc skip)
{
- rna_iterator_listbase_begin(iter, lb, skip);
- rna_inheritance_next_level_restart(iter, skip, 0);
+ rna_iterator_listbase_begin(iter, lb, skip);
+ rna_inheritance_next_level_restart(iter, skip, 0);
}
-static void rna_inheritance_properties_listbase_next(CollectionPropertyIterator *iter, IteratorSkipFunc skip)
+static void rna_inheritance_properties_listbase_next(CollectionPropertyIterator *iter,
+ IteratorSkipFunc skip)
{
- rna_iterator_listbase_next(iter);
- rna_inheritance_next_level_restart(iter, skip, 0);
+ rna_iterator_listbase_next(iter);
+ rna_inheritance_next_level_restart(iter, skip, 0);
}
-static void rna_inheritance_functions_listbase_begin(CollectionPropertyIterator *iter, ListBase *lb,
+static void rna_inheritance_functions_listbase_begin(CollectionPropertyIterator *iter,
+ ListBase *lb,
IteratorSkipFunc skip)
{
- rna_iterator_listbase_begin(iter, lb, skip);
- rna_inheritance_next_level_restart(iter, skip, 1);
+ rna_iterator_listbase_begin(iter, lb, skip);
+ rna_inheritance_next_level_restart(iter, skip, 1);
}
-static void rna_inheritance_functions_listbase_next(CollectionPropertyIterator *iter, IteratorSkipFunc skip)
+static void rna_inheritance_functions_listbase_next(CollectionPropertyIterator *iter,
+ IteratorSkipFunc skip)
{
- rna_iterator_listbase_next(iter);
- rna_inheritance_next_level_restart(iter, skip, 1);
+ rna_iterator_listbase_next(iter);
+ rna_inheritance_next_level_restart(iter, skip, 1);
}
static void rna_Struct_properties_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- IDProperty *group;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ IDProperty *group;
- if (internal->flag) {
- /* id properties */
- rna_iterator_listbase_next(iter);
- }
- else {
- /* regular properties */
- rna_inheritance_properties_listbase_next(iter, rna_property_builtin);
+ if (internal->flag) {
+ /* id properties */
+ rna_iterator_listbase_next(iter);
+ }
+ else {
+ /* regular properties */
+ rna_inheritance_properties_listbase_next(iter, rna_property_builtin);
- /* try id properties */
- if (!iter->valid) {
- group = RNA_struct_idprops(&iter->builtin_parent, 0);
+ /* try id properties */
+ if (!iter->valid) {
+ group = RNA_struct_idprops(&iter->builtin_parent, 0);
- if (group) {
- rna_iterator_listbase_end(iter);
- rna_iterator_listbase_begin(iter, &group->data.group, rna_idproperty_known);
- internal = &iter->internal.listbase;
- internal->flag = 1;
- }
- }
- }
+ if (group) {
+ rna_iterator_listbase_end(iter);
+ rna_iterator_listbase_begin(iter, &group->data.group, rna_idproperty_known);
+ internal = &iter->internal.listbase;
+ internal->flag = 1;
+ }
+ }
+ }
}
static void rna_Struct_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- StructRNA *srna;
+ StructRNA *srna;
- /* here ptr->data should always be the same as iter->parent.type */
- srna = (StructRNA *)ptr->data;
+ /* here ptr->data should always be the same as iter->parent.type */
+ srna = (StructRNA *)ptr->data;
- while (srna->base) {
- iter->level++;
- srna = srna->base;
- }
+ while (srna->base) {
+ iter->level++;
+ srna = srna->base;
+ }
- rna_inheritance_properties_listbase_begin(iter, &srna->cont.properties, rna_property_builtin);
+ rna_inheritance_properties_listbase_begin(iter, &srna->cont.properties, rna_property_builtin);
}
static PointerRNA rna_Struct_properties_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- /* we return either PropertyRNA* or IDProperty*, the rna_access.c
- * functions can handle both as PropertyRNA* with some tricks */
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Property, internal->link);
+ /* we return either PropertyRNA* or IDProperty*, the rna_access.c
+ * functions can handle both as PropertyRNA* with some tricks */
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Property, internal->link);
}
static void rna_Struct_functions_next(CollectionPropertyIterator *iter)
{
- rna_inheritance_functions_listbase_next(iter, rna_function_builtin);
+ rna_inheritance_functions_listbase_next(iter, rna_function_builtin);
}
static void rna_Struct_functions_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- StructRNA *srna;
+ StructRNA *srna;
- /* here ptr->data should always be the same as iter->parent.type */
- srna = (StructRNA *)ptr->data;
+ /* here ptr->data should always be the same as iter->parent.type */
+ srna = (StructRNA *)ptr->data;
- while (srna->base) {
- iter->level++;
- srna = srna->base;
- }
+ while (srna->base) {
+ iter->level++;
+ srna = srna->base;
+ }
- rna_inheritance_functions_listbase_begin(iter, &srna->functions, rna_function_builtin);
+ rna_inheritance_functions_listbase_begin(iter, &srna->functions, rna_function_builtin);
}
static PointerRNA rna_Struct_functions_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- /* we return either PropertyRNA* or IDProperty*, the rna_access.c
- * functions can handle both as PropertyRNA* with some tricks */
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Function, internal->link);
+ /* we return either PropertyRNA* or IDProperty*, the rna_access.c
+ * functions can handle both as PropertyRNA* with some tricks */
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Function, internal->link);
}
static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- /* here ptr->data should always be the same as iter->parent.type */
- StructRNA *srna = (StructRNA *)ptr->data;
- const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna);
- unsigned int tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0;
+ /* here ptr->data should always be the same as iter->parent.type */
+ StructRNA *srna = (StructRNA *)ptr->data;
+ const EnumPropertyItem *tag_defines = RNA_struct_property_tag_defines(srna);
+ unsigned int tag_count = tag_defines ? RNA_enum_items_count(tag_defines) : 0;
- rna_iterator_array_begin(iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL);
+ rna_iterator_array_begin(
+ iter, (void *)tag_defines, sizeof(EnumPropertyItem), tag_count, 0, NULL);
}
/* Builtin properties iterator re-uses the Struct properties iterator, only
@@ -369,2429 +376,2688 @@ static void rna_Struct_property_tags_begin(CollectionPropertyIterator *iter, Poi
void rna_builtin_properties_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- PointerRNA newptr;
+ PointerRNA newptr;
- /* we create a new pointer with the type as the data */
- newptr.type = &RNA_Struct;
- newptr.data = ptr->type;
+ /* we create a new pointer with the type as the data */
+ newptr.type = &RNA_Struct;
+ newptr.data = ptr->type;
- if (ptr->type->flag & STRUCT_ID)
- newptr.id.data = ptr->data;
- else
- newptr.id.data = NULL;
+ if (ptr->type->flag & STRUCT_ID)
+ newptr.id.data = ptr->data;
+ else
+ newptr.id.data = NULL;
- iter->parent = newptr;
- iter->builtin_parent = *ptr;
+ iter->parent = newptr;
+ iter->builtin_parent = *ptr;
- rna_Struct_properties_begin(iter, &newptr);
+ rna_Struct_properties_begin(iter, &newptr);
}
void rna_builtin_properties_next(CollectionPropertyIterator *iter)
{
- rna_Struct_properties_next(iter);
+ rna_Struct_properties_next(iter);
}
PointerRNA rna_builtin_properties_get(CollectionPropertyIterator *iter)
{
- return rna_Struct_properties_get(iter);
+ return rna_Struct_properties_get(iter);
}
int rna_builtin_properties_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PointerRNA propptr = {{NULL}};
-
- srna = ptr->type;
-
- do {
- if (srna->cont.prophash) {
- prop = BLI_ghash_lookup(srna->cont.prophash, (void *)key);
-
- if (prop) {
- propptr.type = &RNA_Property;
- propptr.data = prop;
-
- *r_ptr = propptr;
- return true;
- }
- }
- else {
- for (prop = srna->cont.properties.first; prop; prop = prop->next) {
- if (!(prop->flag_internal & PROP_INTERN_BUILTIN) && STREQ(prop->identifier, key)) {
- propptr.type = &RNA_Property;
- propptr.data = prop;
-
- *r_ptr = propptr;
- return true;
- }
- }
- }
- } while ((srna = srna->base));
-
- /* this was used pre 2.5beta0, now ID property access uses python's
- * getitem style access
- * - ob["foo"] rather than ob.foo */
-#if 0
- if (ptr->data) {
- IDProperty *group, *idp;
-
- group = RNA_struct_idprops(ptr, 0);
-
- if (group) {
- for (idp = group->data.group.first; idp; idp = idp->next) {
- if (STREQ(idp->name, key)) {
- propptr.type = &RNA_Property;
- propptr.data = idp;
-
- *r_ptr = propptr;
- return true;
- }
- }
- }
- }
-#endif
- return false;
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PointerRNA propptr = {{NULL}};
+
+ srna = ptr->type;
+
+ do {
+ if (srna->cont.prophash) {
+ prop = BLI_ghash_lookup(srna->cont.prophash, (void *)key);
+
+ if (prop) {
+ propptr.type = &RNA_Property;
+ propptr.data = prop;
+
+ *r_ptr = propptr;
+ return true;
+ }
+ }
+ else {
+ for (prop = srna->cont.properties.first; prop; prop = prop->next) {
+ if (!(prop->flag_internal & PROP_INTERN_BUILTIN) && STREQ(prop->identifier, key)) {
+ propptr.type = &RNA_Property;
+ propptr.data = prop;
+
+ *r_ptr = propptr;
+ return true;
+ }
+ }
+ }
+ } while ((srna = srna->base));
+
+ /* this was used pre 2.5beta0, now ID property access uses python's
+ * getitem style access
+ * - ob["foo"] rather than ob.foo */
+# if 0
+ if (ptr->data) {
+ IDProperty *group, *idp;
+
+ group = RNA_struct_idprops(ptr, 0);
+
+ if (group) {
+ for (idp = group->data.group.first; idp; idp = idp->next) {
+ if (STREQ(idp->name, key)) {
+ propptr.type = &RNA_Property;
+ propptr.data = idp;
+
+ *r_ptr = propptr;
+ return true;
+ }
+ }
+ }
+ }
+# endif
+ return false;
}
PointerRNA rna_builtin_type_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_Struct, ptr->type);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, ptr->type);
}
/* Property */
static StructRNA *rna_Property_refine(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
-
- rna_idproperty_check(&prop, ptr); /* XXX ptr? */
-
- switch (prop->type) {
- case PROP_BOOLEAN: return &RNA_BoolProperty;
- case PROP_INT: return &RNA_IntProperty;
- case PROP_FLOAT: return &RNA_FloatProperty;
- case PROP_STRING: return &RNA_StringProperty;
- case PROP_ENUM: return &RNA_EnumProperty;
- case PROP_POINTER: return &RNA_PointerProperty;
- case PROP_COLLECTION: return &RNA_CollectionProperty;
- default: return &RNA_Property;
- }
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+
+ rna_idproperty_check(&prop, ptr); /* XXX ptr? */
+
+ switch (prop->type) {
+ case PROP_BOOLEAN:
+ return &RNA_BoolProperty;
+ case PROP_INT:
+ return &RNA_IntProperty;
+ case PROP_FLOAT:
+ return &RNA_FloatProperty;
+ case PROP_STRING:
+ return &RNA_StringProperty;
+ case PROP_ENUM:
+ return &RNA_EnumProperty;
+ case PROP_POINTER:
+ return &RNA_PointerProperty;
+ case PROP_COLLECTION:
+ return &RNA_CollectionProperty;
+ default:
+ return &RNA_Property;
+ }
}
static void rna_Property_identifier_get(PointerRNA *ptr, char *value)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- strcpy(value, ((PropertyRNA *)prop)->identifier);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, ((PropertyRNA *)prop)->identifier);
}
static int rna_Property_identifier_length(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return strlen(prop->identifier);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return strlen(prop->identifier);
}
static void rna_Property_name_get(PointerRNA *ptr, char *value)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- strcpy(value, prop->name ? prop->name : "");
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, prop->name ? prop->name : "");
}
static int rna_Property_name_length(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return prop->name ? strlen(prop->name) : 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->name ? strlen(prop->name) : 0;
}
static void rna_Property_description_get(PointerRNA *ptr, char *value)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- strcpy(value, prop->description ? prop->description : "");
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, prop->description ? prop->description : "");
}
static int rna_Property_description_length(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return prop->description ? strlen(prop->description) : 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->description ? strlen(prop->description) : 0;
}
static void rna_Property_translation_context_get(PointerRNA *ptr, char *value)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- strcpy(value, prop->translation_context);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, prop->translation_context);
}
static int rna_Property_translation_context_length(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return strlen(prop->translation_context);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return strlen(prop->translation_context);
}
static int rna_Property_type_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return prop->type;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->type;
}
static int rna_Property_subtype_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return prop->subtype;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->subtype;
}
static PointerRNA rna_Property_srna_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return rna_pointer_inherit_refine(ptr, &RNA_Struct, prop->srna);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, prop->srna);
}
static int rna_Property_unit_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return RNA_SUBTYPE_UNIT(prop->subtype);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return RNA_SUBTYPE_UNIT(prop->subtype);
}
static int rna_Property_icon_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return prop->icon;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->icon;
}
static bool rna_Property_readonly_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
- /* don't use this because it will call functions that check the internal
- * data for introspection we only need to know if it can be edited so the
- * flag is better for this */
-/* return RNA_property_editable(ptr, prop); */
- return (prop->flag & PROP_EDITABLE) == 0;
+ /* don't use this because it will call functions that check the internal
+ * data for introspection we only need to know if it can be edited so the
+ * flag is better for this */
+ /* return RNA_property_editable(ptr, prop); */
+ return (prop->flag & PROP_EDITABLE) == 0;
}
static bool rna_Property_animatable_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_ANIMATABLE) != 0;
+ return (prop->flag & PROP_ANIMATABLE) != 0;
}
static bool rna_Property_overridable_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC) != 0;
+ return (prop->flag_override & PROPOVERRIDE_OVERRIDABLE_STATIC) != 0;
}
static bool rna_Property_use_output_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag_parameter & PARM_OUTPUT) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag_parameter & PARM_OUTPUT) != 0;
}
static bool rna_Property_is_required_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag_parameter & PARM_REQUIRED) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag_parameter & PARM_REQUIRED) != 0;
}
static bool rna_Property_is_argument_optional_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag_parameter & PARM_PYFUNC_OPTIONAL) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag_parameter & PARM_PYFUNC_OPTIONAL) != 0;
}
static bool rna_Property_is_never_none_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_NEVER_NULL) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_NEVER_NULL) != 0;
}
static bool rna_Property_is_hidden_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_HIDDEN) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_HIDDEN) != 0;
}
static bool rna_Property_is_skip_save_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_SKIP_SAVE) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_SKIP_SAVE) != 0;
}
-
static bool rna_Property_is_enum_flag_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_ENUM_FLAG) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_ENUM_FLAG) != 0;
}
static bool rna_Property_is_library_editable_flag_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_LIB_EXCEPTION) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_LIB_EXCEPTION) != 0;
}
static int rna_Property_tags_get(PointerRNA *ptr)
{
- return RNA_property_tags(ptr->data);
+ return RNA_property_tags(ptr->data);
}
-static const EnumPropertyItem *rna_Property_tags_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Property_tags_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- PropertyRNA *this_prop = (PropertyRNA *)ptr->data;
- const StructRNA *srna = RNA_property_pointer_type(ptr, this_prop);
- EnumPropertyItem *prop_tags;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- int totitem = 0;
+ PropertyRNA *this_prop = (PropertyRNA *)ptr->data;
+ const StructRNA *srna = RNA_property_pointer_type(ptr, this_prop);
+ EnumPropertyItem *prop_tags;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int totitem = 0;
- for (const EnumPropertyItem *struct_tags = RNA_struct_property_tag_defines(srna);
- struct_tags != NULL && struct_tags->identifier != NULL;
- struct_tags++)
- {
- memcpy(&tmp, struct_tags, sizeof(tmp));
- RNA_enum_item_add(&prop_tags, &totitem, &tmp);
- }
- RNA_enum_item_end(&prop_tags, &totitem);
- *r_free = true;
+ for (const EnumPropertyItem *struct_tags = RNA_struct_property_tag_defines(srna);
+ struct_tags != NULL && struct_tags->identifier != NULL;
+ struct_tags++) {
+ memcpy(&tmp, struct_tags, sizeof(tmp));
+ RNA_enum_item_add(&prop_tags, &totitem, &tmp);
+ }
+ RNA_enum_item_end(&prop_tags, &totitem);
+ *r_free = true;
- return prop_tags;
+ return prop_tags;
}
static int rna_Property_array_length_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return prop->totarraylength;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return prop->totarraylength;
}
-static void rna_Property_array_dimensions_get(PointerRNA *ptr, int dimensions[RNA_MAX_ARRAY_DIMENSION])
+static void rna_Property_array_dimensions_get(PointerRNA *ptr,
+ int dimensions[RNA_MAX_ARRAY_DIMENSION])
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
- if (prop->arraydimension > 1) {
- for (int i = RNA_MAX_ARRAY_DIMENSION; i--; ) {
- dimensions[i] = (i >= prop->arraydimension) ? 0 : prop->arraylength[i];
- }
- }
- else {
- memset(dimensions, 0, sizeof(*dimensions) * RNA_MAX_ARRAY_DIMENSION);
- dimensions[0] = prop->totarraylength;
- }
+ if (prop->arraydimension > 1) {
+ for (int i = RNA_MAX_ARRAY_DIMENSION; i--;) {
+ dimensions[i] = (i >= prop->arraydimension) ? 0 : prop->arraylength[i];
+ }
+ }
+ else {
+ memset(dimensions, 0, sizeof(*dimensions) * RNA_MAX_ARRAY_DIMENSION);
+ dimensions[0] = prop->totarraylength;
+ }
}
static bool rna_Property_is_registered_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_REGISTER) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_REGISTER) != 0;
}
static bool rna_Property_is_registered_optional_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag & PROP_REGISTER_OPTIONAL) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag & PROP_REGISTER_OPTIONAL) != 0;
}
static bool rna_Property_is_runtime_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return (prop->flag_internal & PROP_INTERN_RUNTIME) != 0;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ return (prop->flag_internal & PROP_INTERN_RUNTIME) != 0;
}
-
static bool rna_BoolProperty_default_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((BoolPropertyRNA *)prop)->defaultvalue;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((BoolPropertyRNA *)prop)->defaultvalue;
}
static int rna_IntProperty_default_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((IntPropertyRNA *)prop)->defaultvalue;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA *)prop)->defaultvalue;
}
/* int/float/bool */
-static int rna_NumberProperty_default_array_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_NumberProperty_default_array_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
- length[0] = prop->totarraylength;
+ length[0] = prop->totarraylength;
- return length[0];
+ return length[0];
}
static bool rna_NumberProperty_is_array_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
- return RNA_property_array_check(prop);
+ return RNA_property_array_check(prop);
}
static void rna_IntProperty_default_array_get(PointerRNA *ptr, int *values)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- if (prop->totarraylength > 0) {
- RNA_property_int_get_default_array(ptr, prop, values);
- }
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ if (prop->totarraylength > 0) {
+ RNA_property_int_get_default_array(ptr, prop, values);
+ }
}
static void rna_BoolProperty_default_array_get(PointerRNA *ptr, bool *values)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- if (prop->totarraylength > 0) {
- RNA_property_boolean_get_default_array(ptr, prop, values);
- }
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ if (prop->totarraylength > 0) {
+ RNA_property_boolean_get_default_array(ptr, prop, values);
+ }
}
static void rna_FloatProperty_default_array_get(PointerRNA *ptr, float *values)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- if (prop->totarraylength > 0) {
- RNA_property_float_get_default_array(ptr, prop, values);
- }
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ if (prop->totarraylength > 0) {
+ RNA_property_float_get_default_array(ptr, prop, values);
+ }
}
static int rna_IntProperty_hard_min_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((IntPropertyRNA *)prop)->hardmin;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA *)prop)->hardmin;
}
static int rna_IntProperty_hard_max_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((IntPropertyRNA *)prop)->hardmax;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA *)prop)->hardmax;
}
static int rna_IntProperty_soft_min_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((IntPropertyRNA *)prop)->softmin;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA *)prop)->softmin;
}
static int rna_IntProperty_soft_max_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((IntPropertyRNA *)prop)->softmax;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA *)prop)->softmax;
}
static int rna_IntProperty_step_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((IntPropertyRNA *)prop)->step;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((IntPropertyRNA *)prop)->step;
}
static float rna_FloatProperty_default_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->defaultvalue;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->defaultvalue;
}
static float rna_FloatProperty_hard_min_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->hardmin;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->hardmin;
}
static float rna_FloatProperty_hard_max_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->hardmax;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->hardmax;
}
static float rna_FloatProperty_soft_min_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->softmin;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->softmin;
}
static float rna_FloatProperty_soft_max_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->softmax;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->softmax;
}
static float rna_FloatProperty_step_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->step;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->step;
}
static int rna_FloatProperty_precision_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((FloatPropertyRNA *)prop)->precision;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((FloatPropertyRNA *)prop)->precision;
}
static void rna_StringProperty_default_get(PointerRNA *ptr, char *value)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- strcpy(value, ((StringPropertyRNA *)prop)->defaultvalue);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ strcpy(value, ((StringPropertyRNA *)prop)->defaultvalue);
}
static int rna_StringProperty_default_length(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return strlen(((StringPropertyRNA *)prop)->defaultvalue);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return strlen(((StringPropertyRNA *)prop)->defaultvalue);
}
static int rna_StringProperty_max_length_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((StringPropertyRNA *)prop)->maxlength;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((StringPropertyRNA *)prop)->maxlength;
}
-static const EnumPropertyItem *rna_EnumProperty_default_itemf(
- bContext *C, PointerRNA *ptr,
- PropertyRNA *prop_parent, bool *r_free)
+static const EnumPropertyItem *rna_EnumProperty_default_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *prop_parent,
+ bool *r_free)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- EnumPropertyRNA *eprop;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ EnumPropertyRNA *eprop;
- rna_idproperty_check(&prop, ptr);
- eprop = (EnumPropertyRNA *)prop;
+ rna_idproperty_check(&prop, ptr);
+ eprop = (EnumPropertyRNA *)prop;
- /* incompatible default attributes */
- if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) {
- return DummyRNA_NULL_items;
- }
+ /* incompatible default attributes */
+ if ((prop_parent->flag & PROP_ENUM_FLAG) != (prop->flag & PROP_ENUM_FLAG)) {
+ return DummyRNA_NULL_items;
+ }
- if ((eprop->itemf == NULL) ||
- (eprop->itemf == rna_EnumProperty_default_itemf) ||
- (ptr->type == &RNA_EnumProperty) ||
- (C == NULL))
- {
- if (eprop->item) {
- return eprop->item;
- }
- }
+ if ((eprop->itemf == NULL) || (eprop->itemf == rna_EnumProperty_default_itemf) ||
+ (ptr->type == &RNA_EnumProperty) || (C == NULL)) {
+ if (eprop->item) {
+ return eprop->item;
+ }
+ }
- return eprop->itemf(C, ptr, prop, r_free);
+ return eprop->itemf(C, ptr, prop, r_free);
}
/* XXX - not sure this is needed? */
static int rna_EnumProperty_default_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return ((EnumPropertyRNA *)prop)->defaultvalue;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return ((EnumPropertyRNA *)prop)->defaultvalue;
}
static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- EnumPropertyItem *item = (EnumPropertyItem *)data;
+ EnumPropertyItem *item = (EnumPropertyItem *)data;
- return (item->identifier[0] == 0);
+ return (item->identifier[0] == 0);
}
static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- /* EnumPropertyRNA *eprop; *//* UNUSED */
- const EnumPropertyItem *item = NULL;
- int totitem;
- bool free;
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ /* EnumPropertyRNA *eprop; */ /* UNUSED */
+ const EnumPropertyItem *item = NULL;
+ int totitem;
+ bool free;
- rna_idproperty_check(&prop, ptr);
- /* eprop = (EnumPropertyRNA *)prop; */
+ rna_idproperty_check(&prop, ptr);
+ /* eprop = (EnumPropertyRNA *)prop; */
- RNA_property_enum_items_ex(
- NULL, ptr, prop, STREQ(iter->prop->identifier, "enum_items_static"), &item, &totitem, &free);
- rna_iterator_array_begin(iter, (void *)item, sizeof(EnumPropertyItem), totitem, free, rna_enum_check_separator);
+ RNA_property_enum_items_ex(
+ NULL, ptr, prop, STREQ(iter->prop->identifier, "enum_items_static"), &item, &totitem, &free);
+ rna_iterator_array_begin(
+ iter, (void *)item, sizeof(EnumPropertyItem), totitem, free, rna_enum_check_separator);
}
static void rna_EnumPropertyItem_identifier_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((EnumPropertyItem *)ptr->data)->identifier);
+ strcpy(value, ((EnumPropertyItem *)ptr->data)->identifier);
}
static int rna_EnumPropertyItem_identifier_length(PointerRNA *ptr)
{
- return strlen(((EnumPropertyItem *)ptr->data)->identifier);
+ return strlen(((EnumPropertyItem *)ptr->data)->identifier);
}
static void rna_EnumPropertyItem_name_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((EnumPropertyItem *)ptr->data)->name);
+ strcpy(value, ((EnumPropertyItem *)ptr->data)->name);
}
static int rna_EnumPropertyItem_name_length(PointerRNA *ptr)
{
- return strlen(((EnumPropertyItem *)ptr->data)->name);
+ return strlen(((EnumPropertyItem *)ptr->data)->name);
}
static void rna_EnumPropertyItem_description_get(PointerRNA *ptr, char *value)
{
- EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data;
+ EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data;
- if (eprop->description)
- strcpy(value, eprop->description);
- else
- value[0] = '\0';
+ if (eprop->description)
+ strcpy(value, eprop->description);
+ else
+ value[0] = '\0';
}
static int rna_EnumPropertyItem_description_length(PointerRNA *ptr)
{
- EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data;
+ EnumPropertyItem *eprop = (EnumPropertyItem *)ptr->data;
- if (eprop->description)
- return strlen(eprop->description);
- else
- return 0;
+ if (eprop->description)
+ return strlen(eprop->description);
+ else
+ return 0;
}
static int rna_EnumPropertyItem_value_get(PointerRNA *ptr)
{
- return ((EnumPropertyItem *)ptr->data)->value;
+ return ((EnumPropertyItem *)ptr->data)->value;
}
static int rna_EnumPropertyItem_icon_get(PointerRNA *ptr)
{
- return ((EnumPropertyItem *)ptr->data)->icon;
+ return ((EnumPropertyItem *)ptr->data)->icon;
}
static PointerRNA rna_PointerProperty_fixed_type_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((PointerPropertyRNA *)prop)->type);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((PointerPropertyRNA *)prop)->type);
}
static PointerRNA rna_CollectionProperty_fixed_type_get(PointerRNA *ptr)
{
- PropertyRNA *prop = (PropertyRNA *)ptr->data;
- rna_idproperty_check(&prop, ptr);
- return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA *)prop)->item_type);
+ PropertyRNA *prop = (PropertyRNA *)ptr->data;
+ rna_idproperty_check(&prop, ptr);
+ return rna_pointer_inherit_refine(ptr, &RNA_Struct, ((CollectionPropertyRNA *)prop)->item_type);
}
/* Function */
static void rna_Function_identifier_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((FunctionRNA *)ptr->data)->identifier);
+ strcpy(value, ((FunctionRNA *)ptr->data)->identifier);
}
static int rna_Function_identifier_length(PointerRNA *ptr)
{
- return strlen(((FunctionRNA *)ptr->data)->identifier);
+ return strlen(((FunctionRNA *)ptr->data)->identifier);
}
static void rna_Function_description_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ((FunctionRNA *)ptr->data)->description);
+ strcpy(value, ((FunctionRNA *)ptr->data)->description);
}
static int rna_Function_description_length(PointerRNA *ptr)
{
- return strlen(((FunctionRNA *)ptr->data)->description);
+ return strlen(((FunctionRNA *)ptr->data)->description);
}
static void rna_Function_parameters_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- rna_iterator_listbase_begin(iter, &((FunctionRNA *)ptr->data)->cont.properties, rna_property_builtin);
+ rna_iterator_listbase_begin(
+ iter, &((FunctionRNA *)ptr->data)->cont.properties, rna_property_builtin);
}
static bool rna_Function_registered_get(PointerRNA *ptr)
{
- FunctionRNA *func = (FunctionRNA *)ptr->data;
- return 0 != (func->flag & FUNC_REGISTER);
+ FunctionRNA *func = (FunctionRNA *)ptr->data;
+ return 0 != (func->flag & FUNC_REGISTER);
}
static bool rna_Function_registered_optional_get(PointerRNA *ptr)
{
- FunctionRNA *func = (FunctionRNA *)ptr->data;
- return 0 != (func->flag & (FUNC_REGISTER_OPTIONAL & ~FUNC_REGISTER));
+ FunctionRNA *func = (FunctionRNA *)ptr->data;
+ return 0 != (func->flag & (FUNC_REGISTER_OPTIONAL & ~FUNC_REGISTER));
}
static bool rna_Function_no_self_get(PointerRNA *ptr)
{
- FunctionRNA *func = (FunctionRNA *)ptr->data;
- return !(func->flag & FUNC_NO_SELF);
+ FunctionRNA *func = (FunctionRNA *)ptr->data;
+ return !(func->flag & FUNC_NO_SELF);
}
static int rna_Function_use_self_type_get(PointerRNA *ptr)
{
- FunctionRNA *func = (FunctionRNA *)ptr->data;
- return 0 != (func->flag & FUNC_USE_SELF_TYPE);
+ FunctionRNA *func = (FunctionRNA *)ptr->data;
+ return 0 != (func->flag & FUNC_USE_SELF_TYPE);
}
/* Blender RNA */
static int rna_struct_is_publc(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- StructRNA *srna = data;
+ StructRNA *srna = data;
- return !(srna->flag & STRUCT_PUBLIC_NAMESPACE);
+ return !(srna->flag & STRUCT_PUBLIC_NAMESPACE);
}
-
static void rna_BlenderRNA_structs_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- BlenderRNA *brna = ptr->data;
- rna_iterator_listbase_begin(iter, &brna->structs, rna_struct_is_publc);
+ BlenderRNA *brna = ptr->data;
+ rna_iterator_listbase_begin(iter, &brna->structs, rna_struct_is_publc);
}
/* optional, for faster lookups */
static int rna_BlenderRNA_structs_length(PointerRNA *ptr)
{
- BlenderRNA *brna = ptr->data;
- BLI_assert(brna->structs_len == BLI_listbase_count(&brna->structs));
- return brna->structs_len;
+ BlenderRNA *brna = ptr->data;
+ BLI_assert(brna->structs_len == BLI_listbase_count(&brna->structs));
+ return brna->structs_len;
}
static int rna_BlenderRNA_structs_lookup_int(PointerRNA *ptr, int index, PointerRNA *r_ptr)
{
- BlenderRNA *brna = ptr->data;
- StructRNA *srna = index < brna->structs_len ? BLI_findlink(&brna->structs, index) : NULL;
- if (srna != NULL) {
- RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
- return true;
- }
- else {
- return false;
- }
+ BlenderRNA *brna = ptr->data;
+ StructRNA *srna = index < brna->structs_len ? BLI_findlink(&brna->structs, index) : NULL;
+ if (srna != NULL) {
+ RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
+ return true;
+ }
+ else {
+ return false;
+ }
}
-static int rna_BlenderRNA_structs_lookup_string(PointerRNA *ptr, const char *key, PointerRNA *r_ptr)
+static int rna_BlenderRNA_structs_lookup_string(PointerRNA *ptr,
+ const char *key,
+ PointerRNA *r_ptr)
{
- BlenderRNA *brna = ptr->data;
- StructRNA *srna = BLI_ghash_lookup(brna->structs_map, (void *)key);
- if (srna != NULL) {
- RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
- return true;
- }
+ BlenderRNA *brna = ptr->data;
+ StructRNA *srna = BLI_ghash_lookup(brna->structs_map, (void *)key);
+ if (srna != NULL) {
+ RNA_pointer_create(NULL, &RNA_Struct, srna, r_ptr);
+ return true;
+ }
- return false;
+ return false;
}
/* Default override (and compare) callbacks. */
/* Ensures it makes sense to go inside the pointers to compare their content
* (if they are IDs, or have different names or RNA type, then this would be meaningless). */
-static bool rna_property_override_diff_propptr_validate_diffing(
- PointerRNA *propptr_a, PointerRNA *propptr_b, const bool no_prop_name,
- bool *r_is_id, bool *r_is_null, bool *r_is_type_diff,
- char **r_propname_a, char *propname_a_buff, size_t propname_a_buff_size,
- char **r_propname_b, char *propname_b_buff, size_t propname_b_buff_size)
-{
- BLI_assert(propptr_a != NULL);
-
- bool is_valid_for_diffing = true;
- const bool do_force_name = !no_prop_name && r_propname_a != NULL;
-
- if (do_force_name) {
- BLI_assert(r_propname_a != NULL);
- BLI_assert(r_propname_b != NULL);
- }
-
- *r_is_id = *r_is_null = *r_is_type_diff = false;
-
- /* Beware, PointerRNA_NULL has no type and is considered a 'blank page'! */
- if (propptr_a->type == NULL) {
- if (propptr_b == NULL || propptr_b->type == NULL) {
- *r_is_null = true;
- }
- else {
- *r_is_id = RNA_struct_is_ID(propptr_b->type);
- *r_is_null = true;
- *r_is_type_diff = true;
- }
- is_valid_for_diffing = false;
- }
- else {
- *r_is_id = RNA_struct_is_ID(propptr_a->type);
- *r_is_null = *r_is_type_diff = (ELEM(NULL, propptr_b, propptr_b->type));
- is_valid_for_diffing = !(*r_is_id || *r_is_null);
- }
-
- if (propptr_b == NULL || propptr_a->type != propptr_b->type) {
- *r_is_type_diff = true;
- is_valid_for_diffing = false;
-// printf("%s: different pointer RNA types\n", rna_path ? rna_path : "<UNKNOWN>");
- }
-
- /* We do a generic quick first comparison checking for "name" and/or "type" properties.
- * We assume that is any of those are false, then we are not handling the same data.
- * This helps a lot in static override case, especially to detect inserted items in collections. */
- if (!no_prop_name && (is_valid_for_diffing || do_force_name)) {
- PropertyRNA *nameprop_a = RNA_struct_name_property(propptr_a->type);
- PropertyRNA *nameprop_b = (propptr_b != NULL) ? RNA_struct_name_property(propptr_b->type) : NULL;
-
- int propname_a_len = 0, propname_b_len = 0;
- char *propname_a = NULL;
- char *propname_b = NULL;
- char buff_a[4096];
- char buff_b[4096];
- if (nameprop_a != NULL) {
- if (r_propname_a == NULL && propname_a_buff == NULL) {
- propname_a_buff = buff_a;
- propname_a_buff_size = sizeof(buff_a);
- }
-
- propname_a = RNA_property_string_get_alloc(
- propptr_a, nameprop_a, propname_a_buff, propname_a_buff_size, &propname_a_len);
-// printf("propname_a = %s\n", propname_a ? propname_a : "<NONE>");
-
- if (r_propname_a != NULL) {
- *r_propname_a = propname_a;
- }
- }
-// else printf("item of type %s a has no name property!\n", propptr_a->type->name);
- if (nameprop_b != NULL) {
- if (r_propname_b == NULL && propname_b_buff == NULL) {
- propname_b_buff = buff_b;
- propname_b_buff_size = sizeof(buff_b);
- }
-
- propname_b = RNA_property_string_get_alloc(
- propptr_b, nameprop_b, propname_b_buff, propname_b_buff_size, &propname_b_len);
-
- if (r_propname_b != NULL) {
- *r_propname_b = propname_b;
- }
- }
- if (propname_a != NULL && propname_b != NULL) {
- if (propname_a_len != propname_b_len ||
- propname_a[0] != propname_b[0] ||
- !STREQ(propname_a, propname_b))
- {
- is_valid_for_diffing = false;
-// printf("%s: different names\n", rna_path ? rna_path : "<UNKNOWN>");
- }
- }
- }
-
- if (*r_is_id) {
- BLI_assert(propptr_a->data == propptr_a->id.data && propptr_b->data == propptr_b->id.data);
- }
-
- return is_valid_for_diffing;
+static bool rna_property_override_diff_propptr_validate_diffing(PointerRNA *propptr_a,
+ PointerRNA *propptr_b,
+ const bool no_prop_name,
+ bool *r_is_id,
+ bool *r_is_null,
+ bool *r_is_type_diff,
+ char **r_propname_a,
+ char *propname_a_buff,
+ size_t propname_a_buff_size,
+ char **r_propname_b,
+ char *propname_b_buff,
+ size_t propname_b_buff_size)
+{
+ BLI_assert(propptr_a != NULL);
+
+ bool is_valid_for_diffing = true;
+ const bool do_force_name = !no_prop_name && r_propname_a != NULL;
+
+ if (do_force_name) {
+ BLI_assert(r_propname_a != NULL);
+ BLI_assert(r_propname_b != NULL);
+ }
+
+ *r_is_id = *r_is_null = *r_is_type_diff = false;
+
+ /* Beware, PointerRNA_NULL has no type and is considered a 'blank page'! */
+ if (propptr_a->type == NULL) {
+ if (propptr_b == NULL || propptr_b->type == NULL) {
+ *r_is_null = true;
+ }
+ else {
+ *r_is_id = RNA_struct_is_ID(propptr_b->type);
+ *r_is_null = true;
+ *r_is_type_diff = true;
+ }
+ is_valid_for_diffing = false;
+ }
+ else {
+ *r_is_id = RNA_struct_is_ID(propptr_a->type);
+ *r_is_null = *r_is_type_diff = (ELEM(NULL, propptr_b, propptr_b->type));
+ is_valid_for_diffing = !(*r_is_id || *r_is_null);
+ }
+
+ if (propptr_b == NULL || propptr_a->type != propptr_b->type) {
+ *r_is_type_diff = true;
+ is_valid_for_diffing = false;
+ // printf("%s: different pointer RNA types\n", rna_path ? rna_path : "<UNKNOWN>");
+ }
+
+ /* We do a generic quick first comparison checking for "name" and/or "type" properties.
+ * We assume that is any of those are false, then we are not handling the same data.
+ * This helps a lot in static override case, especially to detect inserted items in collections. */
+ if (!no_prop_name && (is_valid_for_diffing || do_force_name)) {
+ PropertyRNA *nameprop_a = RNA_struct_name_property(propptr_a->type);
+ PropertyRNA *nameprop_b = (propptr_b != NULL) ? RNA_struct_name_property(propptr_b->type) :
+ NULL;
+
+ int propname_a_len = 0, propname_b_len = 0;
+ char *propname_a = NULL;
+ char *propname_b = NULL;
+ char buff_a[4096];
+ char buff_b[4096];
+ if (nameprop_a != NULL) {
+ if (r_propname_a == NULL && propname_a_buff == NULL) {
+ propname_a_buff = buff_a;
+ propname_a_buff_size = sizeof(buff_a);
+ }
+
+ propname_a = RNA_property_string_get_alloc(
+ propptr_a, nameprop_a, propname_a_buff, propname_a_buff_size, &propname_a_len);
+ // printf("propname_a = %s\n", propname_a ? propname_a : "<NONE>");
+
+ if (r_propname_a != NULL) {
+ *r_propname_a = propname_a;
+ }
+ }
+ // else printf("item of type %s a has no name property!\n", propptr_a->type->name);
+ if (nameprop_b != NULL) {
+ if (r_propname_b == NULL && propname_b_buff == NULL) {
+ propname_b_buff = buff_b;
+ propname_b_buff_size = sizeof(buff_b);
+ }
+
+ propname_b = RNA_property_string_get_alloc(
+ propptr_b, nameprop_b, propname_b_buff, propname_b_buff_size, &propname_b_len);
+
+ if (r_propname_b != NULL) {
+ *r_propname_b = propname_b;
+ }
+ }
+ if (propname_a != NULL && propname_b != NULL) {
+ if (propname_a_len != propname_b_len || propname_a[0] != propname_b[0] ||
+ !STREQ(propname_a, propname_b)) {
+ is_valid_for_diffing = false;
+ // printf("%s: different names\n", rna_path ? rna_path : "<UNKNOWN>");
+ }
+ }
+ }
+
+ if (*r_is_id) {
+ BLI_assert(propptr_a->data == propptr_a->id.data && propptr_b->data == propptr_b->id.data);
+ }
+
+ return is_valid_for_diffing;
}
/* Used for both Pointer and Collection properties. */
-static int rna_property_override_diff_propptr(
- Main *bmain,
- PointerRNA *propptr_a, PointerRNA *propptr_b,
- eRNACompareMode mode, const bool no_ownership, const bool no_prop_name,
- IDOverrideStatic *override, const char *rna_path, const int flags, bool *r_override_changed)
-{
- const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != NULL;
-
- bool is_id = false;
- bool is_null = false;
- bool is_type_diff = false;
- /* If false, it means that the whole data itself is different, so no point in going inside of it at all! */
- bool is_valid_for_diffing = rna_property_override_diff_propptr_validate_diffing(
- propptr_a, propptr_b, no_prop_name, &is_id, &is_null, &is_type_diff,
- NULL, NULL, 0, NULL, NULL, 0);
-
- if (is_id) {
- BLI_assert(no_ownership); /* For now, once we deal with nodetrees we'll want to get rid of that one. */
- }
-
- if (override) {
- if (no_ownership /* || is_id */ || is_null || is_type_diff || !is_valid_for_diffing) {
- /* In case this pointer prop does not own its data (or one is NULL), do not compare structs!
- * This is a quite safe path to infinite loop, among other nasty issues.
- * Instead, just compare pointers themselves. */
- const int comp = (propptr_a->data != propptr_b->data);
-
- if (do_create && comp != 0) {
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- }
-
- return comp;
- }
- else {
- eRNAOverrideMatchResult report_flags = 0;
- const bool match = RNA_struct_override_matches(
- bmain, propptr_a, propptr_b, rna_path, override, flags, &report_flags);
- if (r_override_changed && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) != 0) {
- *r_override_changed = true;
- }
- return !match;
- }
- }
- else {
- /* We could also use is_diff_pointer, but then we potentially lose the gt/lt info -
- * and don't think performances are critical here for now anyway... */
- return !RNA_struct_equals(bmain, propptr_a, propptr_b, mode);
- }
-}
-
-
-
-#define RNA_PROPERTY_GET_SINGLE(_typename, _ptr, _prop, _index) \
- (is_array ? RNA_property_##_typename##_get_index((_ptr), (_prop), (_index)) : \
- RNA_property_##_typename##_get((_ptr), (_prop)))
-#define RNA_PROPERTY_SET_SINGLE(_typename, _ptr, _prop, _index, _value) \
- (is_array ? RNA_property_##_typename##_set_index((_ptr), (_prop), (_index), (_value)) : \
- RNA_property_##_typename##_set((_ptr), (_prop), (_value)))
-
-int rna_property_override_diff_default(
- Main *bmain,
- PointerRNA *ptr_a, PointerRNA *ptr_b,
- PropertyRNA *prop_a, PropertyRNA *prop_b,
- const int len_a, const int len_b,
- const int mode,
- IDOverrideStatic *override, const char *rna_path,
- const int flags, bool *r_override_changed)
-{
- BLI_assert(len_a == len_b);
-
- /* Note: at this point, we are sure that when len_a is zero, we are not handling an (empty) array. */
-
- const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 && rna_path != NULL;
-
- switch (RNA_property_type(prop_a)) {
- case PROP_BOOLEAN:
- {
- if (len_a) {
- bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- bool *array_a, *array_b;
-
- array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_a, "RNA equals") : array_stack_a;
- array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") : array_stack_b;
-
- RNA_property_boolean_get_array(ptr_a, prop_a, array_a);
- RNA_property_boolean_get_array(ptr_b, prop_b, array_b);
-
- const int comp = memcmp(array_a, array_b, sizeof(bool) * len_a);
-
- if (do_create && comp != 0) {
- /* XXX TODO this will have to be refined to handle array items */
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) {
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- else {
- /* Already overridden prop, we'll have to check arrays items etc. */
- }
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- if (array_b != array_stack_b) MEM_freeN(array_b);
-
- return comp;
- }
- else {
- const bool value_a = RNA_property_boolean_get(ptr_a, prop_a);
- const bool value_b = RNA_property_boolean_get(ptr_b, prop_b);
- const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
-
- if (do_create && comp != 0) {
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- }
-
- return comp;
- }
- }
-
- case PROP_INT:
- {
- if (len_a) {
- int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- int *array_a, *array_b;
-
- array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_a, "RNA equals") : array_stack_a;
- array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") : array_stack_b;
-
- RNA_property_int_get_array(ptr_a, prop_a, array_a);
- RNA_property_int_get_array(ptr_b, prop_b, array_b);
-
- const int comp = memcmp(array_a, array_b, sizeof(int) * len_a);
-
- if (do_create && comp != 0) {
- /* XXX TODO this will have to be refined to handle array items */
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) {
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- else {
- /* Already overridden prop, we'll have to check arrays items etc. */
- }
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- if (array_b != array_stack_b) MEM_freeN(array_b);
-
- return comp;
- }
- else {
- const int value_a = RNA_property_int_get(ptr_a, prop_a);
- const int value_b = RNA_property_int_get(ptr_b, prop_b);
- const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
-
- if (do_create && comp != 0) {
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- }
-
- return comp;
- }
- }
-
- case PROP_FLOAT:
- {
- if (len_a) {
- float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- float *array_a, *array_b;
-
- array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_a, "RNA equals") : array_stack_a;
- array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_b, "RNA equals") : array_stack_b;
-
- RNA_property_float_get_array(ptr_a, prop_a, array_a);
- RNA_property_float_get_array(ptr_b, prop_b, array_b);
-
- const int comp = memcmp(array_a, array_b, sizeof(float) * len_a);
-
- if (do_create && comp != 0) {
- /* XXX TODO this will have to be refined to handle array items */
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) {
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE,
- NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- else {
- /* Already overridden prop, we'll have to check arrays items etc. */
- }
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- if (array_b != array_stack_b) MEM_freeN(array_b);
-
- return comp;
- }
- else {
- const float value_a = RNA_property_float_get(ptr_a, prop_a);
- const float value_b = RNA_property_float_get(ptr_b, prop_b);
- const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
-
- if (do_create && comp != 0) {
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE,
- NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- }
-
- return comp ;
- }
- }
-
- case PROP_ENUM:
- {
- const int value_a = RNA_property_enum_get(ptr_a, prop_a);
- const int value_b = RNA_property_enum_get(ptr_b, prop_b);
- const int comp = value_a != value_b;
-
- if (do_create && comp != 0) {
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- }
-
- return comp;
- }
-
- case PROP_STRING:
- {
- char fixed_a[4096], fixed_b[4096];
- int len_str_a, len_str_b;
- char *value_a = RNA_property_string_get_alloc(ptr_a, prop_a, fixed_a, sizeof(fixed_a), &len_str_a);
- char *value_b = RNA_property_string_get_alloc(ptr_b, prop_b, fixed_b, sizeof(fixed_b), &len_str_b);
- /* TODO we could do a check on length too, but then we would not have a 'real' string comparison...
- * Maybe behind a eRNAOverrideMatch flag? */
-// const int comp = len_str_a < len_str_b ? -1 : len_str_a > len_str_b ? 1 : strcmp(value_a, value_b);
- const int comp = strcmp(value_a, value_b);
-
- if (do_create && comp != 0) {
- bool created = false;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (op != NULL && created) { /* If not yet overridden... */
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
- if (r_override_changed) {
- *r_override_changed = created;
- }
- }
- }
-
- if (value_a != fixed_a) MEM_freeN(value_a);
- if (value_b != fixed_b) MEM_freeN(value_b);
-
- return comp;
- }
-
- case PROP_POINTER:
- {
- if (STREQ(RNA_property_identifier(prop_a), "rna_type")) {
- /* Dummy 'pass' answer, this is a meta-data and must be ignored... */
- return 0;
- }
- else {
- PointerRNA propptr_a = RNA_property_pointer_get(ptr_a, prop_a);
- PointerRNA propptr_b = RNA_property_pointer_get(ptr_b, prop_b);
- const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
- const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) != 0;
- return rna_property_override_diff_propptr(
- bmain,
- &propptr_a, &propptr_b, mode, no_ownership, no_prop_name,
- override, rna_path, flags, r_override_changed);
- }
- break;
- }
-
- case PROP_COLLECTION:
- {
- /* Note: we assume we only insert in ptr_a (i.e. we can only get new items in ptr_a),
- * and that we never remove anything. */
- const bool use_insertion = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_STATIC_INSERTION) && do_create;
- const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) != 0;
- bool equals = true;
- bool abort = false;
- bool is_first_insert = true;
- int idx_a = 0;
- int idx_b = 0;
-
-#define RNA_PATH_BUFFSIZE 8192
-
- char extended_rna_path_buffer[RNA_PATH_BUFFSIZE];
- char *extended_rna_path = extended_rna_path_buffer;
-
-#define RNA_PATH_PRINTF(_str, ...) \
- if (BLI_snprintf(extended_rna_path_buffer, RNA_PATH_BUFFSIZE, \
- (_str), __VA_ARGS__) >= RNA_PATH_BUFFSIZE - 1) \
- { extended_rna_path = BLI_sprintfN((_str), __VA_ARGS__); }(void)0
-#define RNA_PATH_FREE() \
- if (extended_rna_path != extended_rna_path_buffer) MEM_freeN(extended_rna_path)
-
- CollectionPropertyIterator iter_a, iter_b;
- RNA_property_collection_begin(ptr_a, prop_a, &iter_a);
- RNA_property_collection_begin(ptr_b, prop_b, &iter_b);
-
- char buff_a[4096];
- char buff_prev_a[4096] = {0};
- char buff_b[4096];
- char *propname_a = NULL;
- char *prev_propname_a = buff_prev_a;
- char *propname_b = NULL;
-
- for (; iter_a.valid && !abort; ) {
- bool is_valid_for_diffing;
- bool is_valid_for_insertion;
- do {
- bool is_id = false, is_null = false, is_type_diff = false;
-
- is_valid_for_insertion = use_insertion;
-
- /* If false, it means that the whole data itself is different, so no point in going inside of it at all! */
- if (iter_b.valid) {
- is_valid_for_diffing = rna_property_override_diff_propptr_validate_diffing(
- &iter_a.ptr, &iter_b.ptr, no_prop_name,
- &is_id, &is_null, &is_type_diff,
- &propname_a, buff_a, sizeof(buff_a),
- &propname_b, buff_b, sizeof(buff_b));
- }
- else {
- is_valid_for_diffing = false;
- if (is_valid_for_insertion) {
- /* We still need propname from 'a' item... */
- rna_property_override_diff_propptr_validate_diffing(
- &iter_a.ptr, NULL, no_prop_name,
- &is_id, &is_null, &is_type_diff,
- &propname_a, buff_a, sizeof(buff_a),
- &propname_b, buff_b, sizeof(buff_b));
- }
- }
-
- /* We do not support insertion of IDs for now, neither handle NULL pointers. */
- if (is_id || is_valid_for_diffing) {
- is_valid_for_insertion = false;
- }
-
-#if 0
- if (rna_path) {
- printf("Checking %s, %s [%d] vs %s [%d]; is_id: %d, diffing: %d; "
- "insert: %d (could be used: %d, do_create: %d)\n",
- rna_path, propname_a ? propname_a : "", idx_a, propname_b ? propname_b : "", idx_b,
- is_id, is_valid_for_diffing, is_valid_for_insertion,
- (RNA_property_override_flag(prop_a) & PROPOVERRIDE_STATIC_INSERTION) != 0, do_create);
- }
-#endif
-
- if (!(is_id || is_valid_for_diffing || is_valid_for_insertion)) {
- /* Differences we cannot handle, we can break here
- * (we do not support replacing ID pointers in collections e.g.). */
- equals = false;
- abort = true;
- break;
- }
-
- /* There may be a propname defined in some cases, while no actual name set
- * (e.g. happens with point cache), in that case too we want to fall back to index.
- * Note that we do not need the RNA path for insertion operations. */
- if (is_id || is_valid_for_diffing) {
- if ((propname_a != NULL && propname_a[0] != '\0') &&
- (propname_b != NULL && propname_b[0] != '\0'))
- {
- if (rna_path) {
- /* In case of name, either it is valid for diffing, and _a and _b are identical,
- * or it is valid for insertion, and we need to use _a. */
- char esc_item_name[RNA_PATH_BUFFSIZE];
- BLI_strescape(esc_item_name, propname_a, RNA_PATH_BUFFSIZE);
- RNA_PATH_PRINTF("%s[\"%s\"]", rna_path, esc_item_name);
- }
- }
- else { /* Based on index... */
- if (rna_path) {
- /* In case of indices, we need _a one for insertion, but _b ones for in-depth diffing.
- * Insertion always happen once all 'replace' operations have been done,
- * otherwise local and reference paths for those would have to be different! */
- RNA_PATH_PRINTF("%s[%d]", rna_path, is_valid_for_insertion ? idx_a : idx_b);
- }
- }
- }
-
- /* Collections do not support replacement of their data (since they do not support removing),
- * only in *some* cases, insertion.
- * We also assume then that _a data is the one where things are inserted. */
- if (is_valid_for_insertion && use_insertion) {
- bool created;
- IDOverrideStaticProperty *op = BKE_override_static_property_get(override, rna_path, &created);
-
- if (is_first_insert) {
- /* We need to clean up all possible existing insertion operations, otherwise we'd end up
- * with a mess of ops everytime something changes. */
- for (IDOverrideStaticPropertyOperation *opop = op->operations.first;
- opop != NULL;)
- {
- IDOverrideStaticPropertyOperation *opop_next = opop->next;
- if (ELEM(opop->operation,
- IDOVERRIDESTATIC_OP_INSERT_AFTER, IDOVERRIDESTATIC_OP_INSERT_BEFORE))
- {
- BKE_override_static_property_operation_delete(op, opop);
- }
- opop = opop_next;
- }
- is_first_insert = false;
- }
-
- BKE_override_static_property_operation_get(
- op, IDOVERRIDESTATIC_OP_INSERT_AFTER,
- NULL, prev_propname_a, -1, idx_a - 1, true, NULL, NULL);
-// printf("%s: Adding insertion op override after '%s'/%d\n", rna_path, prev_propname_a, idx_a - 1);
- }
- else if (is_id || is_valid_for_diffing) {
- if (equals || do_create) {
- const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
- const int eq = rna_property_override_diff_propptr(
- bmain,
- &iter_a.ptr, &iter_b.ptr, mode, no_ownership, no_prop_name,
- override, extended_rna_path, flags, r_override_changed);
- equals = equals && eq;
- }
- }
-
- if (prev_propname_a != buff_prev_a) {
- MEM_freeN(prev_propname_a);
- prev_propname_a = buff_prev_a;
- }
- prev_propname_a[0] = '\0';
- if (propname_a != NULL &&
- BLI_strncpy_rlen(prev_propname_a, propname_a, sizeof(buff_prev_a)) >= sizeof(buff_prev_a) - 1)
- {
- prev_propname_a = BLI_strdup(propname_a);
- }
- if (propname_a != buff_a) {
- MEM_SAFE_FREE(propname_a);
- propname_a = buff_a;
- }
- propname_a[0] = '\0';
- if (propname_b != buff_b) {
- MEM_SAFE_FREE(propname_b);
- propname_b = buff_b;
- }
- propname_b[0] = '\0';
- RNA_PATH_FREE();
-
- if (!do_create && !equals) {
- abort = true; /* Early out in case we do not want to loop over whole collection. */
- break;
- }
-
- if (!(use_insertion && !(is_id || is_valid_for_diffing))) {
- break;
- }
-
- if (iter_a.valid) {
- RNA_property_collection_next(&iter_a);
- idx_a++;
- }
- } while (iter_a.valid);
-
- if (iter_a.valid) {
- RNA_property_collection_next(&iter_a);
- idx_a++;
- }
- if (iter_b.valid) {
- RNA_property_collection_next(&iter_b);
- idx_b++;
- }
-
-#undef RNA_PATH_BUFFSIZE
-#undef RNA_PATH_PRINTF
-#undef RNA_PATH_FREE
- }
-
- equals = equals && !(iter_a.valid || iter_b.valid) && !abort; /* Not same number of items in both collections... */
- RNA_property_collection_end(&iter_a);
- RNA_property_collection_end(&iter_b);
-
- return (equals == false);
- }
-
- default:
- break;
- }
-
- return 0;
-}
-
-bool rna_property_override_store_default(
- Main *UNUSED(bmain),
- PointerRNA *ptr_local, PointerRNA *ptr_reference, PointerRNA *ptr_storage,
- PropertyRNA *prop_local, PropertyRNA *prop_reference, PropertyRNA *prop_storage,
- const int len_local, const int len_reference, const int len_storage,
- IDOverrideStaticPropertyOperation *opop)
-{
- BLI_assert(len_local == len_reference && (!ptr_storage || len_local == len_storage));
- UNUSED_VARS_NDEBUG(len_reference, len_storage);
-
- bool changed = false;
- const bool is_array = len_local > 0;
- const int index = is_array ? opop->subitem_reference_index : 0;
-
- if (!ELEM(opop->operation, IDOVERRIDESTATIC_OP_ADD, IDOVERRIDESTATIC_OP_SUBTRACT, IDOVERRIDESTATIC_OP_MULTIPLY)) {
- return changed;
- }
-
- /* XXX TODO About range limits.
- * Ideally, it would be great to get rid of RNA range in that specific case.
- * However, this won't be that easy and will add yet another layer of complexity in generated code,
- * not to mention that we could most likely *not* bypass custom setters anyway.
- * So for now, if needed second operand value is not in valid range, we simply fall back
- * to a mere REPLACE operation.
- * Time will say whether this is acceptable limitation or not. */
- switch (RNA_property_type(prop_local)) {
- case PROP_BOOLEAN:
- /* TODO support boolean ops? Really doubt this would ever be useful though... */
- BLI_assert(0 && "Boolean properties support no override diff operation");
- break;
- case PROP_INT:
- {
- int prop_min, prop_max;
- RNA_property_int_range(ptr_local, prop_local, &prop_min, &prop_max);
-
- if (is_array && index == -1) {
- int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- int *array_a, *array_b;
-
- array_a = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_local, __func__) : array_stack_a;
- RNA_property_int_get_array(ptr_reference, prop_reference, array_a);
-
- switch (opop->operation) {
- case IDOVERRIDESTATIC_OP_ADD:
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- {
- const int fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1 : -1;
- const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? IDOVERRIDESTATIC_OP_SUBTRACT : IDOVERRIDESTATIC_OP_ADD;
- bool do_set = true;
- array_b = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : array_stack_b;
- RNA_property_int_get_array(ptr_local, prop_local, array_b);
- for (int i = len_local; i--;) {
- array_b[i] = fac * (array_b[i] - array_a[i]);
- if (array_b[i] < prop_min || array_b[i] > prop_max) {
- opop->operation = other_op;
- for (int j = len_local; j--;) {
- array_b[j] = j >= i ? -array_b[j] : fac * (array_a[j] - array_b[j]);
- if (array_b[j] < prop_min || array_b[j] > prop_max) {
- /* We failed to find a suitable diff op,
- * fall back to plain REPLACE one. */
- opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
- do_set = false;
- break;
- }
- }
- break;
- }
- }
- if (do_set) {
- changed = true;
- RNA_property_int_set_array(ptr_storage, prop_storage, array_b);
- }
- if (array_b != array_stack_b) MEM_freeN(array_b);
- break;
- }
- default:
- BLI_assert(0 && "Unsupported RNA override diff operation on integer");
- break;
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- }
- else {
- const int value = RNA_PROPERTY_GET_SINGLE(int, ptr_reference, prop_reference, index);
-
- switch (opop->operation) {
- case IDOVERRIDESTATIC_OP_ADD:
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- {
- const int fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1 : -1;
- const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? IDOVERRIDESTATIC_OP_SUBTRACT : IDOVERRIDESTATIC_OP_ADD;
- int b = fac * (RNA_PROPERTY_GET_SINGLE(int, ptr_local, prop_local, index) - value);
- if (b < prop_min || b > prop_max) {
- opop->operation = other_op;
- b = -b;
- if (b < prop_min || b > prop_max) {
- opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
- break;
- }
- }
- changed = true;
- RNA_PROPERTY_SET_SINGLE(int, ptr_storage, prop_storage, index, b);
- break;
- }
- default:
- BLI_assert(0 && "Unsupported RNA override diff operation on integer");
- break;
- }
- }
- break;
- }
- case PROP_FLOAT:
- {
- float prop_min, prop_max;
- RNA_property_float_range(ptr_local, prop_local, &prop_min, &prop_max);
-
- if (is_array && index == -1) {
- float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- float *array_a, *array_b;
-
- array_a = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_local, __func__) : array_stack_a;
-
- RNA_property_float_get_array(ptr_reference, prop_reference, array_a);
- switch (opop->operation) {
- case IDOVERRIDESTATIC_OP_ADD:
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- {
- const float fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1.0 : -1.0;
- const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? IDOVERRIDESTATIC_OP_SUBTRACT : IDOVERRIDESTATIC_OP_ADD;
- bool do_set = true;
- array_b = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : array_stack_b;
- RNA_property_float_get_array(ptr_local, prop_local, array_b);
- for (int i = len_local; i--;) {
- array_b[i] = fac * (array_b[i] - array_a[i]);
- if (array_b[i] < prop_min || array_b[i] > prop_max) {
- opop->operation = other_op;
- for (int j = len_local; j--;) {
- array_b[j] = j >= i ? -array_b[j] : fac * (array_a[j] - array_b[j]);
- if (array_b[j] < prop_min || array_b[j] > prop_max) {
- /* We failed to find a suitable diff op,
- * fall back to plain REPLACE one. */
- opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
- do_set = false;
- break;
- }
- }
- break;
- }
- }
- if (do_set) {
- changed = true;
- RNA_property_float_set_array(ptr_storage, prop_storage, array_b);
- }
- if (array_b != array_stack_b) MEM_freeN(array_b);
- break;
- }
- case IDOVERRIDESTATIC_OP_MULTIPLY:
- {
- bool do_set = true;
- array_b = (len_local > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_local, __func__) : array_stack_b;
- RNA_property_float_get_array(ptr_local, prop_local, array_b);
- for (int i = len_local; i--;) {
- array_b[i] = array_a[i] == 0.0f ? array_b[i] : array_b[i] / array_a[i];
- if (array_b[i] < prop_min || array_b[i] > prop_max) {
- opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
- do_set = false;
- break;
- }
- }
- if (do_set) {
- changed = true;
- RNA_property_float_set_array(ptr_storage, prop_storage, array_b);
- }
- if (array_b != array_stack_b) MEM_freeN(array_b);
- break;
- }
- default:
- BLI_assert(0 && "Unsupported RNA override diff operation on float");
- break;
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- }
- else {
- const float value = RNA_PROPERTY_GET_SINGLE(float, ptr_reference, prop_reference, index);
-
- switch (opop->operation) {
- case IDOVERRIDESTATIC_OP_ADD:
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- {
- const float fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1.0f : -1.0f;
- const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ? IDOVERRIDESTATIC_OP_SUBTRACT : IDOVERRIDESTATIC_OP_ADD;
- float b = fac * (RNA_PROPERTY_GET_SINGLE(float, ptr_local, prop_local, index) - value);
- if (b < prop_min || b > prop_max) {
- opop->operation = other_op;
- b = -b;
- if (b < prop_min || b > prop_max) {
- opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
- break;
- }
- }
- changed = true;
- RNA_PROPERTY_SET_SINGLE(float, ptr_storage, prop_storage, index, b);
- break;
- }
- case IDOVERRIDESTATIC_OP_MULTIPLY:
- {
- const float b = RNA_property_float_get_index(ptr_local, prop_local, index) / (value == 0.0f ? 1.0f : value);
- if (b < prop_min || b > prop_max) {
- opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
- break;
- }
- changed = true;
- RNA_property_float_set_index(ptr_storage, prop_storage, index, b);
- break;
- }
- default:
- BLI_assert(0 && "Unsupported RNA override diff operation on float");
- break;
- }
- }
- return true;
- }
- case PROP_ENUM:
- /* TODO support add/sub, for bitflags? */
- BLI_assert(0 && "Enum properties support no override diff operation");
- break;
- case PROP_POINTER:
- BLI_assert(0 && "Pointer properties support no override diff operation");
- break;
- case PROP_STRING:
- BLI_assert(0 && "String properties support no override diff operation");
- break;
- case PROP_COLLECTION:
- /* XXX TODO support this of course... */
- BLI_assert(0 && "Collection properties support no override diff operation");
- break;
- default:
- break;
- }
-
- return changed;
-}
-
-bool rna_property_override_apply_default(
- Main *UNUSED(bmain),
- PointerRNA *ptr_dst, PointerRNA *ptr_src, PointerRNA *ptr_storage,
- PropertyRNA *prop_dst, PropertyRNA *prop_src, PropertyRNA *prop_storage,
- const int len_dst, const int len_src, const int len_storage,
- PointerRNA *UNUSED(ptr_item_dst), PointerRNA *UNUSED(ptr_item_src), PointerRNA *UNUSED(ptr_item_storage),
- IDOverrideStaticPropertyOperation *opop)
-{
- BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage));
- UNUSED_VARS_NDEBUG(len_src, len_storage);
-
- const bool is_array = len_dst > 0;
- const int index = is_array ? opop->subitem_reference_index : 0;
- const short override_op = opop->operation;
-
- switch (RNA_property_type(prop_dst)) {
- case PROP_BOOLEAN:
- if (is_array && index == -1) {
- bool array_stack_a[RNA_STACK_ARRAY];
- bool *array_a;
-
- array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : array_stack_a;
-
- RNA_property_boolean_get_array(ptr_src, prop_src, array_a);
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_property_boolean_set_array(ptr_dst, prop_dst, array_a);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on boolean");
- return false;
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- }
- else {
- const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index);
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_PROPERTY_SET_SINGLE(boolean, ptr_dst, prop_dst, index, value);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on boolean");
- return false;
- }
- }
- return true;
- case PROP_INT:
- if (is_array && index == -1) {
- int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- int *array_a, *array_b;
-
- array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : array_stack_a;
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_property_int_get_array(ptr_src, prop_src, array_a);
- RNA_property_int_set_array(ptr_dst, prop_dst, array_a);
- break;
- case IDOVERRIDESTATIC_OP_ADD:
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- RNA_property_int_get_array(ptr_dst, prop_dst, array_a);
- array_b = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_dst, __func__) : array_stack_b;
- RNA_property_int_get_array(ptr_storage, prop_storage, array_b);
- if (override_op == IDOVERRIDESTATIC_OP_ADD) {
- for (int i = len_dst; i--;) array_a[i] += array_b[i];
- }
- else {
- for (int i = len_dst; i--;) array_a[i] -= array_b[i];
- }
- RNA_property_int_set_array(ptr_dst, prop_dst, array_a);
- if (array_b != array_stack_b) MEM_freeN(array_b);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on integer");
- return false;
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- }
- else {
- const int storage_value = ptr_storage ? RNA_PROPERTY_GET_SINGLE(int, ptr_storage, prop_storage, index) : 0;
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_PROPERTY_SET_SINGLE(int, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(int, ptr_src, prop_src, index));
- break;
- case IDOVERRIDESTATIC_OP_ADD:
- RNA_PROPERTY_SET_SINGLE(int, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(int, ptr_dst, prop_dst, index) - storage_value);
- break;
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- RNA_PROPERTY_SET_SINGLE(int, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(int, ptr_dst, prop_dst, index) - storage_value);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on integer");
- return false;
- }
- }
- return true;
- case PROP_FLOAT:
- if (is_array && index == -1) {
- float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
- float *array_a, *array_b;
-
- array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) : array_stack_a;
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_property_float_get_array(ptr_src, prop_src, array_a);
- RNA_property_float_set_array(ptr_dst, prop_dst, array_a);
- break;
- case IDOVERRIDESTATIC_OP_ADD:
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- case IDOVERRIDESTATIC_OP_MULTIPLY:
- RNA_property_float_get_array(ptr_dst, prop_dst, array_a);
- array_b = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_b) * len_dst, __func__) : array_stack_b;
- RNA_property_float_get_array(ptr_storage, prop_storage, array_b);
- if (override_op == IDOVERRIDESTATIC_OP_ADD) {
- for (int i = len_dst; i--;) array_a[i] += array_b[i];
- }
- else if (override_op == IDOVERRIDESTATIC_OP_SUBTRACT) {
- for (int i = len_dst; i--;) array_a[i] -= array_b[i];
- }
- else {
- for (int i = len_dst; i--;) array_a[i] *= array_b[i];
- }
- RNA_property_float_set_array(ptr_dst, prop_dst, array_a);
- if (array_b != array_stack_b) MEM_freeN(array_b);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on float");
- return false;
- }
-
- if (array_a != array_stack_a) MEM_freeN(array_a);
- }
- else {
- const float storage_value = ptr_storage ? RNA_PROPERTY_GET_SINGLE(float, ptr_storage, prop_storage, index) : 0.0f;
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(float, ptr_src, prop_src, index));
- break;
- case IDOVERRIDESTATIC_OP_ADD:
- RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) + storage_value);
- break;
- case IDOVERRIDESTATIC_OP_SUBTRACT:
- RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) - storage_value);
- break;
- case IDOVERRIDESTATIC_OP_MULTIPLY:
- RNA_PROPERTY_SET_SINGLE(float, ptr_dst, prop_dst, index,
- RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) * storage_value);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on float");
- return false;
- }
- }
- return true;
- case PROP_ENUM:
- {
- const int value = RNA_property_enum_get(ptr_src, prop_src);
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_property_enum_set(ptr_dst, prop_dst, value);
- break;
- /* TODO support add/sub, for bitflags? */
- default:
- BLI_assert(0 && "Unsupported RNA override operation on enum");
- return false;
- }
- return true;
- }
- case PROP_POINTER:
- {
- PointerRNA value = RNA_property_pointer_get(ptr_src, prop_src);
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_property_pointer_set(ptr_dst, prop_dst, value);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on pointer");
- return false;
- }
- return true;
- }
- case PROP_STRING:
- {
- char buff[256];
- char *value = RNA_property_string_get_alloc(ptr_src, prop_src, buff, sizeof(buff), NULL);
-
- switch (override_op) {
- case IDOVERRIDESTATIC_OP_REPLACE:
- RNA_property_string_set(ptr_dst, prop_dst, value);
- break;
- default:
- BLI_assert(0 && "Unsupported RNA override operation on string");
- return false;
- }
-
- if (value != buff) MEM_freeN(value);
- return true;
- }
- case PROP_COLLECTION:
- {
- BLI_assert(!"You need to define a specific override apply callback for enums.");
- return false;
- }
- default:
- BLI_assert(0);
- return false;
- }
-
- return false;
-}
-
-#undef RNA_PROPERTY_GET_SINGLE
-#undef RNA_PROPERTY_SET_SINGLE
-
+static int rna_property_override_diff_propptr(Main *bmain,
+ PointerRNA *propptr_a,
+ PointerRNA *propptr_b,
+ eRNACompareMode mode,
+ const bool no_ownership,
+ const bool no_prop_name,
+ IDOverrideStatic *override,
+ const char *rna_path,
+ const int flags,
+ bool *r_override_changed)
+{
+ const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 &&
+ rna_path != NULL;
+
+ bool is_id = false;
+ bool is_null = false;
+ bool is_type_diff = false;
+ /* If false, it means that the whole data itself is different, so no point in going inside of it at all! */
+ bool is_valid_for_diffing = rna_property_override_diff_propptr_validate_diffing(propptr_a,
+ propptr_b,
+ no_prop_name,
+ &is_id,
+ &is_null,
+ &is_type_diff,
+ NULL,
+ NULL,
+ 0,
+ NULL,
+ NULL,
+ 0);
+
+ if (is_id) {
+ BLI_assert(
+ no_ownership); /* For now, once we deal with nodetrees we'll want to get rid of that one. */
+ }
+
+ if (override) {
+ if (no_ownership /* || is_id */ || is_null || is_type_diff || !is_valid_for_diffing) {
+ /* In case this pointer prop does not own its data (or one is NULL), do not compare structs!
+ * This is a quite safe path to infinite loop, among other nasty issues.
+ * Instead, just compare pointers themselves. */
+ const int comp = (propptr_a->data != propptr_b->data);
+
+ if (do_create && comp != 0) {
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) { /* If not yet overridden... */
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ }
+
+ return comp;
+ }
+ else {
+ eRNAOverrideMatchResult report_flags = 0;
+ const bool match = RNA_struct_override_matches(
+ bmain, propptr_a, propptr_b, rna_path, override, flags, &report_flags);
+ if (r_override_changed && (report_flags & RNA_OVERRIDE_MATCH_RESULT_CREATED) != 0) {
+ *r_override_changed = true;
+ }
+ return !match;
+ }
+ }
+ else {
+ /* We could also use is_diff_pointer, but then we potentially lose the gt/lt info -
+ * and don't think performances are critical here for now anyway... */
+ return !RNA_struct_equals(bmain, propptr_a, propptr_b, mode);
+ }
+}
+
+# define RNA_PROPERTY_GET_SINGLE(_typename, _ptr, _prop, _index) \
+ (is_array ? RNA_property_##_typename##_get_index((_ptr), (_prop), (_index)) : \
+ RNA_property_##_typename##_get((_ptr), (_prop)))
+# define RNA_PROPERTY_SET_SINGLE(_typename, _ptr, _prop, _index, _value) \
+ (is_array ? RNA_property_##_typename##_set_index((_ptr), (_prop), (_index), (_value)) : \
+ RNA_property_##_typename##_set((_ptr), (_prop), (_value)))
+
+int rna_property_override_diff_default(Main *bmain,
+ PointerRNA *ptr_a,
+ PointerRNA *ptr_b,
+ PropertyRNA *prop_a,
+ PropertyRNA *prop_b,
+ const int len_a,
+ const int len_b,
+ const int mode,
+ IDOverrideStatic *override,
+ const char *rna_path,
+ const int flags,
+ bool *r_override_changed)
+{
+ BLI_assert(len_a == len_b);
+
+ /* Note: at this point, we are sure that when len_a is zero, we are not handling an (empty) array. */
+
+ const bool do_create = override != NULL && (flags & RNA_OVERRIDE_COMPARE_CREATE) != 0 &&
+ rna_path != NULL;
+
+ switch (RNA_property_type(prop_a)) {
+ case PROP_BOOLEAN: {
+ if (len_a) {
+ bool array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ bool *array_a, *array_b;
+
+ array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_a, "RNA equals") :
+ array_stack_a;
+ array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(bool) * len_b, "RNA equals") :
+ array_stack_b;
+
+ RNA_property_boolean_get_array(ptr_a, prop_a, array_a);
+ RNA_property_boolean_get_array(ptr_b, prop_b, array_b);
+
+ const int comp = memcmp(array_a, array_b, sizeof(bool) * len_a);
+
+ if (do_create && comp != 0) {
+ /* XXX TODO this will have to be refined to handle array items */
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) {
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ else {
+ /* Already overridden prop, we'll have to check arrays items etc. */
+ }
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+
+ return comp;
+ }
+ else {
+ const bool value_a = RNA_property_boolean_get(ptr_a, prop_a);
+ const bool value_b = RNA_property_boolean_get(ptr_b, prop_b);
+ const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
+
+ if (do_create && comp != 0) {
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) { /* If not yet overridden... */
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ }
+
+ return comp;
+ }
+ }
+
+ case PROP_INT: {
+ if (len_a) {
+ int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ int *array_a, *array_b;
+
+ array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_a, "RNA equals") :
+ array_stack_a;
+ array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(int) * len_b, "RNA equals") :
+ array_stack_b;
+
+ RNA_property_int_get_array(ptr_a, prop_a, array_a);
+ RNA_property_int_get_array(ptr_b, prop_b, array_b);
+
+ const int comp = memcmp(array_a, array_b, sizeof(int) * len_a);
+
+ if (do_create && comp != 0) {
+ /* XXX TODO this will have to be refined to handle array items */
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) {
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ else {
+ /* Already overridden prop, we'll have to check arrays items etc. */
+ }
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+
+ return comp;
+ }
+ else {
+ const int value_a = RNA_property_int_get(ptr_a, prop_a);
+ const int value_b = RNA_property_int_get(ptr_b, prop_b);
+ const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
+
+ if (do_create && comp != 0) {
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) { /* If not yet overridden... */
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ }
+
+ return comp;
+ }
+ }
+
+ case PROP_FLOAT: {
+ if (len_a) {
+ float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ float *array_a, *array_b;
+
+ array_a = (len_a > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_a, "RNA equals") :
+ array_stack_a;
+ array_b = (len_b > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(float) * len_b, "RNA equals") :
+ array_stack_b;
+
+ RNA_property_float_get_array(ptr_a, prop_a, array_a);
+ RNA_property_float_get_array(ptr_b, prop_b, array_b);
+
+ const int comp = memcmp(array_a, array_b, sizeof(float) * len_a);
+
+ if (do_create && comp != 0) {
+ /* XXX TODO this will have to be refined to handle array items */
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) {
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ else {
+ /* Already overridden prop, we'll have to check arrays items etc. */
+ }
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+
+ return comp;
+ }
+ else {
+ const float value_a = RNA_property_float_get(ptr_a, prop_a);
+ const float value_b = RNA_property_float_get(ptr_b, prop_b);
+ const int comp = (value_a < value_b) ? -1 : (value_a > value_b) ? 1 : 0;
+
+ if (do_create && comp != 0) {
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) { /* If not yet overridden... */
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ }
+
+ return comp;
+ }
+ }
+
+ case PROP_ENUM: {
+ const int value_a = RNA_property_enum_get(ptr_a, prop_a);
+ const int value_b = RNA_property_enum_get(ptr_b, prop_b);
+ const int comp = value_a != value_b;
+
+ if (do_create && comp != 0) {
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) { /* If not yet overridden... */
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ }
+
+ return comp;
+ }
+
+ case PROP_STRING: {
+ char fixed_a[4096], fixed_b[4096];
+ int len_str_a, len_str_b;
+ char *value_a = RNA_property_string_get_alloc(
+ ptr_a, prop_a, fixed_a, sizeof(fixed_a), &len_str_a);
+ char *value_b = RNA_property_string_get_alloc(
+ ptr_b, prop_b, fixed_b, sizeof(fixed_b), &len_str_b);
+ /* TODO we could do a check on length too, but then we would not have a 'real' string comparison...
+ * Maybe behind a eRNAOverrideMatch flag? */
+ // const int comp = len_str_a < len_str_b ? -1 : len_str_a > len_str_b ? 1 : strcmp(value_a, value_b);
+ const int comp = strcmp(value_a, value_b);
+
+ if (do_create && comp != 0) {
+ bool created = false;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (op != NULL && created) { /* If not yet overridden... */
+ BKE_override_static_property_operation_get(
+ op, IDOVERRIDESTATIC_OP_REPLACE, NULL, NULL, -1, -1, true, NULL, NULL);
+ if (r_override_changed) {
+ *r_override_changed = created;
+ }
+ }
+ }
+
+ if (value_a != fixed_a)
+ MEM_freeN(value_a);
+ if (value_b != fixed_b)
+ MEM_freeN(value_b);
+
+ return comp;
+ }
+
+ case PROP_POINTER: {
+ if (STREQ(RNA_property_identifier(prop_a), "rna_type")) {
+ /* Dummy 'pass' answer, this is a meta-data and must be ignored... */
+ return 0;
+ }
+ else {
+ PointerRNA propptr_a = RNA_property_pointer_get(ptr_a, prop_a);
+ PointerRNA propptr_b = RNA_property_pointer_get(ptr_b, prop_b);
+ const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
+ const bool no_prop_name = (RNA_property_override_flag(prop_a) &
+ PROPOVERRIDE_NO_PROP_NAME) != 0;
+ return rna_property_override_diff_propptr(bmain,
+ &propptr_a,
+ &propptr_b,
+ mode,
+ no_ownership,
+ no_prop_name,
+ override,
+ rna_path,
+ flags,
+ r_override_changed);
+ }
+ break;
+ }
+
+ case PROP_COLLECTION: {
+ /* Note: we assume we only insert in ptr_a (i.e. we can only get new items in ptr_a),
+ * and that we never remove anything. */
+ const bool use_insertion = (RNA_property_override_flag(prop_a) &
+ PROPOVERRIDE_STATIC_INSERTION) &&
+ do_create;
+ const bool no_prop_name = (RNA_property_override_flag(prop_a) & PROPOVERRIDE_NO_PROP_NAME) !=
+ 0;
+ bool equals = true;
+ bool abort = false;
+ bool is_first_insert = true;
+ int idx_a = 0;
+ int idx_b = 0;
+
+# define RNA_PATH_BUFFSIZE 8192
+
+ char extended_rna_path_buffer[RNA_PATH_BUFFSIZE];
+ char *extended_rna_path = extended_rna_path_buffer;
+
+# define RNA_PATH_PRINTF(_str, ...) \
+ if (BLI_snprintf(extended_rna_path_buffer, RNA_PATH_BUFFSIZE, (_str), __VA_ARGS__) >= \
+ RNA_PATH_BUFFSIZE - 1) { \
+ extended_rna_path = BLI_sprintfN((_str), __VA_ARGS__); \
+ } \
+ (void)0
+# define RNA_PATH_FREE() \
+ if (extended_rna_path != extended_rna_path_buffer) \
+ MEM_freeN(extended_rna_path)
+
+ CollectionPropertyIterator iter_a, iter_b;
+ RNA_property_collection_begin(ptr_a, prop_a, &iter_a);
+ RNA_property_collection_begin(ptr_b, prop_b, &iter_b);
+
+ char buff_a[4096];
+ char buff_prev_a[4096] = {0};
+ char buff_b[4096];
+ char *propname_a = NULL;
+ char *prev_propname_a = buff_prev_a;
+ char *propname_b = NULL;
+
+ for (; iter_a.valid && !abort;) {
+ bool is_valid_for_diffing;
+ bool is_valid_for_insertion;
+ do {
+ bool is_id = false, is_null = false, is_type_diff = false;
+
+ is_valid_for_insertion = use_insertion;
+
+ /* If false, it means that the whole data itself is different, so no point in going inside of it at all! */
+ if (iter_b.valid) {
+ is_valid_for_diffing = rna_property_override_diff_propptr_validate_diffing(
+ &iter_a.ptr,
+ &iter_b.ptr,
+ no_prop_name,
+ &is_id,
+ &is_null,
+ &is_type_diff,
+ &propname_a,
+ buff_a,
+ sizeof(buff_a),
+ &propname_b,
+ buff_b,
+ sizeof(buff_b));
+ }
+ else {
+ is_valid_for_diffing = false;
+ if (is_valid_for_insertion) {
+ /* We still need propname from 'a' item... */
+ rna_property_override_diff_propptr_validate_diffing(&iter_a.ptr,
+ NULL,
+ no_prop_name,
+ &is_id,
+ &is_null,
+ &is_type_diff,
+ &propname_a,
+ buff_a,
+ sizeof(buff_a),
+ &propname_b,
+ buff_b,
+ sizeof(buff_b));
+ }
+ }
+
+ /* We do not support insertion of IDs for now, neither handle NULL pointers. */
+ if (is_id || is_valid_for_diffing) {
+ is_valid_for_insertion = false;
+ }
+
+# if 0
+ if (rna_path) {
+ printf("Checking %s, %s [%d] vs %s [%d]; is_id: %d, diffing: %d; "
+ "insert: %d (could be used: %d, do_create: %d)\n",
+ rna_path, propname_a ? propname_a : "", idx_a, propname_b ? propname_b : "", idx_b,
+ is_id, is_valid_for_diffing, is_valid_for_insertion,
+ (RNA_property_override_flag(prop_a) & PROPOVERRIDE_STATIC_INSERTION) != 0, do_create);
+ }
+# endif
+
+ if (!(is_id || is_valid_for_diffing || is_valid_for_insertion)) {
+ /* Differences we cannot handle, we can break here
+ * (we do not support replacing ID pointers in collections e.g.). */
+ equals = false;
+ abort = true;
+ break;
+ }
+
+ /* There may be a propname defined in some cases, while no actual name set
+ * (e.g. happens with point cache), in that case too we want to fall back to index.
+ * Note that we do not need the RNA path for insertion operations. */
+ if (is_id || is_valid_for_diffing) {
+ if ((propname_a != NULL && propname_a[0] != '\0') &&
+ (propname_b != NULL && propname_b[0] != '\0')) {
+ if (rna_path) {
+ /* In case of name, either it is valid for diffing, and _a and _b are identical,
+ * or it is valid for insertion, and we need to use _a. */
+ char esc_item_name[RNA_PATH_BUFFSIZE];
+ BLI_strescape(esc_item_name, propname_a, RNA_PATH_BUFFSIZE);
+ RNA_PATH_PRINTF("%s[\"%s\"]", rna_path, esc_item_name);
+ }
+ }
+ else { /* Based on index... */
+ if (rna_path) {
+ /* In case of indices, we need _a one for insertion, but _b ones for in-depth diffing.
+ * Insertion always happen once all 'replace' operations have been done,
+ * otherwise local and reference paths for those would have to be different! */
+ RNA_PATH_PRINTF("%s[%d]", rna_path, is_valid_for_insertion ? idx_a : idx_b);
+ }
+ }
+ }
+
+ /* Collections do not support replacement of their data (since they do not support removing),
+ * only in *some* cases, insertion.
+ * We also assume then that _a data is the one where things are inserted. */
+ if (is_valid_for_insertion && use_insertion) {
+ bool created;
+ IDOverrideStaticProperty *op = BKE_override_static_property_get(
+ override, rna_path, &created);
+
+ if (is_first_insert) {
+ /* We need to clean up all possible existing insertion operations, otherwise we'd end up
+ * with a mess of ops everytime something changes. */
+ for (IDOverrideStaticPropertyOperation *opop = op->operations.first; opop != NULL;) {
+ IDOverrideStaticPropertyOperation *opop_next = opop->next;
+ if (ELEM(opop->operation,
+ IDOVERRIDESTATIC_OP_INSERT_AFTER,
+ IDOVERRIDESTATIC_OP_INSERT_BEFORE)) {
+ BKE_override_static_property_operation_delete(op, opop);
+ }
+ opop = opop_next;
+ }
+ is_first_insert = false;
+ }
+
+ BKE_override_static_property_operation_get(op,
+ IDOVERRIDESTATIC_OP_INSERT_AFTER,
+ NULL,
+ prev_propname_a,
+ -1,
+ idx_a - 1,
+ true,
+ NULL,
+ NULL);
+ // printf("%s: Adding insertion op override after '%s'/%d\n", rna_path, prev_propname_a, idx_a - 1);
+ }
+ else if (is_id || is_valid_for_diffing) {
+ if (equals || do_create) {
+ const bool no_ownership = (RNA_property_flag(prop_a) & PROP_PTR_NO_OWNERSHIP) != 0;
+ const int eq = rna_property_override_diff_propptr(bmain,
+ &iter_a.ptr,
+ &iter_b.ptr,
+ mode,
+ no_ownership,
+ no_prop_name,
+ override,
+ extended_rna_path,
+ flags,
+ r_override_changed);
+ equals = equals && eq;
+ }
+ }
+
+ if (prev_propname_a != buff_prev_a) {
+ MEM_freeN(prev_propname_a);
+ prev_propname_a = buff_prev_a;
+ }
+ prev_propname_a[0] = '\0';
+ if (propname_a != NULL &&
+ BLI_strncpy_rlen(prev_propname_a, propname_a, sizeof(buff_prev_a)) >=
+ sizeof(buff_prev_a) - 1) {
+ prev_propname_a = BLI_strdup(propname_a);
+ }
+ if (propname_a != buff_a) {
+ MEM_SAFE_FREE(propname_a);
+ propname_a = buff_a;
+ }
+ propname_a[0] = '\0';
+ if (propname_b != buff_b) {
+ MEM_SAFE_FREE(propname_b);
+ propname_b = buff_b;
+ }
+ propname_b[0] = '\0';
+ RNA_PATH_FREE();
+
+ if (!do_create && !equals) {
+ abort = true; /* Early out in case we do not want to loop over whole collection. */
+ break;
+ }
+
+ if (!(use_insertion && !(is_id || is_valid_for_diffing))) {
+ break;
+ }
+
+ if (iter_a.valid) {
+ RNA_property_collection_next(&iter_a);
+ idx_a++;
+ }
+ } while (iter_a.valid);
+
+ if (iter_a.valid) {
+ RNA_property_collection_next(&iter_a);
+ idx_a++;
+ }
+ if (iter_b.valid) {
+ RNA_property_collection_next(&iter_b);
+ idx_b++;
+ }
+
+# undef RNA_PATH_BUFFSIZE
+# undef RNA_PATH_PRINTF
+# undef RNA_PATH_FREE
+ }
+
+ equals = equals && !(iter_a.valid || iter_b.valid) &&
+ !abort; /* Not same number of items in both collections... */
+ RNA_property_collection_end(&iter_a);
+ RNA_property_collection_end(&iter_b);
+
+ return (equals == false);
+ }
+
+ default:
+ break;
+ }
+
+ return 0;
+}
+
+bool rna_property_override_store_default(Main *UNUSED(bmain),
+ PointerRNA *ptr_local,
+ PointerRNA *ptr_reference,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_local,
+ PropertyRNA *prop_reference,
+ PropertyRNA *prop_storage,
+ const int len_local,
+ const int len_reference,
+ const int len_storage,
+ IDOverrideStaticPropertyOperation *opop)
+{
+ BLI_assert(len_local == len_reference && (!ptr_storage || len_local == len_storage));
+ UNUSED_VARS_NDEBUG(len_reference, len_storage);
+
+ bool changed = false;
+ const bool is_array = len_local > 0;
+ const int index = is_array ? opop->subitem_reference_index : 0;
+
+ if (!ELEM(opop->operation,
+ IDOVERRIDESTATIC_OP_ADD,
+ IDOVERRIDESTATIC_OP_SUBTRACT,
+ IDOVERRIDESTATIC_OP_MULTIPLY)) {
+ return changed;
+ }
+
+ /* XXX TODO About range limits.
+ * Ideally, it would be great to get rid of RNA range in that specific case.
+ * However, this won't be that easy and will add yet another layer of complexity in generated code,
+ * not to mention that we could most likely *not* bypass custom setters anyway.
+ * So for now, if needed second operand value is not in valid range, we simply fall back
+ * to a mere REPLACE operation.
+ * Time will say whether this is acceptable limitation or not. */
+ switch (RNA_property_type(prop_local)) {
+ case PROP_BOOLEAN:
+ /* TODO support boolean ops? Really doubt this would ever be useful though... */
+ BLI_assert(0 && "Boolean properties support no override diff operation");
+ break;
+ case PROP_INT: {
+ int prop_min, prop_max;
+ RNA_property_int_range(ptr_local, prop_local, &prop_min, &prop_max);
+
+ if (is_array && index == -1) {
+ int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ int *array_a, *array_b;
+
+ array_a = (len_local > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_a) * len_local, __func__) :
+ array_stack_a;
+ RNA_property_int_get_array(ptr_reference, prop_reference, array_a);
+
+ switch (opop->operation) {
+ case IDOVERRIDESTATIC_OP_ADD:
+ case IDOVERRIDESTATIC_OP_SUBTRACT: {
+ const int fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1 : -1;
+ const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ?
+ IDOVERRIDESTATIC_OP_SUBTRACT :
+ IDOVERRIDESTATIC_OP_ADD;
+ bool do_set = true;
+ array_b = (len_local > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
+ array_stack_b;
+ RNA_property_int_get_array(ptr_local, prop_local, array_b);
+ for (int i = len_local; i--;) {
+ array_b[i] = fac * (array_b[i] - array_a[i]);
+ if (array_b[i] < prop_min || array_b[i] > prop_max) {
+ opop->operation = other_op;
+ for (int j = len_local; j--;) {
+ array_b[j] = j >= i ? -array_b[j] : fac * (array_a[j] - array_b[j]);
+ if (array_b[j] < prop_min || array_b[j] > prop_max) {
+ /* We failed to find a suitable diff op,
+ * fall back to plain REPLACE one. */
+ opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
+ do_set = false;
+ break;
+ }
+ }
+ break;
+ }
+ }
+ if (do_set) {
+ changed = true;
+ RNA_property_int_set_array(ptr_storage, prop_storage, array_b);
+ }
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+ break;
+ }
+ default:
+ BLI_assert(0 && "Unsupported RNA override diff operation on integer");
+ break;
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ }
+ else {
+ const int value = RNA_PROPERTY_GET_SINGLE(int, ptr_reference, prop_reference, index);
+
+ switch (opop->operation) {
+ case IDOVERRIDESTATIC_OP_ADD:
+ case IDOVERRIDESTATIC_OP_SUBTRACT: {
+ const int fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1 : -1;
+ const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ?
+ IDOVERRIDESTATIC_OP_SUBTRACT :
+ IDOVERRIDESTATIC_OP_ADD;
+ int b = fac * (RNA_PROPERTY_GET_SINGLE(int, ptr_local, prop_local, index) - value);
+ if (b < prop_min || b > prop_max) {
+ opop->operation = other_op;
+ b = -b;
+ if (b < prop_min || b > prop_max) {
+ opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
+ break;
+ }
+ }
+ changed = true;
+ RNA_PROPERTY_SET_SINGLE(int, ptr_storage, prop_storage, index, b);
+ break;
+ }
+ default:
+ BLI_assert(0 && "Unsupported RNA override diff operation on integer");
+ break;
+ }
+ }
+ break;
+ }
+ case PROP_FLOAT: {
+ float prop_min, prop_max;
+ RNA_property_float_range(ptr_local, prop_local, &prop_min, &prop_max);
+
+ if (is_array && index == -1) {
+ float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ float *array_a, *array_b;
+
+ array_a = (len_local > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_a) * len_local, __func__) :
+ array_stack_a;
+
+ RNA_property_float_get_array(ptr_reference, prop_reference, array_a);
+ switch (opop->operation) {
+ case IDOVERRIDESTATIC_OP_ADD:
+ case IDOVERRIDESTATIC_OP_SUBTRACT: {
+ const float fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1.0 : -1.0;
+ const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ?
+ IDOVERRIDESTATIC_OP_SUBTRACT :
+ IDOVERRIDESTATIC_OP_ADD;
+ bool do_set = true;
+ array_b = (len_local > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
+ array_stack_b;
+ RNA_property_float_get_array(ptr_local, prop_local, array_b);
+ for (int i = len_local; i--;) {
+ array_b[i] = fac * (array_b[i] - array_a[i]);
+ if (array_b[i] < prop_min || array_b[i] > prop_max) {
+ opop->operation = other_op;
+ for (int j = len_local; j--;) {
+ array_b[j] = j >= i ? -array_b[j] : fac * (array_a[j] - array_b[j]);
+ if (array_b[j] < prop_min || array_b[j] > prop_max) {
+ /* We failed to find a suitable diff op,
+ * fall back to plain REPLACE one. */
+ opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
+ do_set = false;
+ break;
+ }
+ }
+ break;
+ }
+ }
+ if (do_set) {
+ changed = true;
+ RNA_property_float_set_array(ptr_storage, prop_storage, array_b);
+ }
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+ break;
+ }
+ case IDOVERRIDESTATIC_OP_MULTIPLY: {
+ bool do_set = true;
+ array_b = (len_local > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_b) * len_local, __func__) :
+ array_stack_b;
+ RNA_property_float_get_array(ptr_local, prop_local, array_b);
+ for (int i = len_local; i--;) {
+ array_b[i] = array_a[i] == 0.0f ? array_b[i] : array_b[i] / array_a[i];
+ if (array_b[i] < prop_min || array_b[i] > prop_max) {
+ opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
+ do_set = false;
+ break;
+ }
+ }
+ if (do_set) {
+ changed = true;
+ RNA_property_float_set_array(ptr_storage, prop_storage, array_b);
+ }
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+ break;
+ }
+ default:
+ BLI_assert(0 && "Unsupported RNA override diff operation on float");
+ break;
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ }
+ else {
+ const float value = RNA_PROPERTY_GET_SINGLE(float, ptr_reference, prop_reference, index);
+
+ switch (opop->operation) {
+ case IDOVERRIDESTATIC_OP_ADD:
+ case IDOVERRIDESTATIC_OP_SUBTRACT: {
+ const float fac = opop->operation == IDOVERRIDESTATIC_OP_ADD ? 1.0f : -1.0f;
+ const int other_op = opop->operation == IDOVERRIDESTATIC_OP_ADD ?
+ IDOVERRIDESTATIC_OP_SUBTRACT :
+ IDOVERRIDESTATIC_OP_ADD;
+ float b = fac * (RNA_PROPERTY_GET_SINGLE(float, ptr_local, prop_local, index) - value);
+ if (b < prop_min || b > prop_max) {
+ opop->operation = other_op;
+ b = -b;
+ if (b < prop_min || b > prop_max) {
+ opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
+ break;
+ }
+ }
+ changed = true;
+ RNA_PROPERTY_SET_SINGLE(float, ptr_storage, prop_storage, index, b);
+ break;
+ }
+ case IDOVERRIDESTATIC_OP_MULTIPLY: {
+ const float b = RNA_property_float_get_index(ptr_local, prop_local, index) /
+ (value == 0.0f ? 1.0f : value);
+ if (b < prop_min || b > prop_max) {
+ opop->operation = IDOVERRIDESTATIC_OP_REPLACE;
+ break;
+ }
+ changed = true;
+ RNA_property_float_set_index(ptr_storage, prop_storage, index, b);
+ break;
+ }
+ default:
+ BLI_assert(0 && "Unsupported RNA override diff operation on float");
+ break;
+ }
+ }
+ return true;
+ }
+ case PROP_ENUM:
+ /* TODO support add/sub, for bitflags? */
+ BLI_assert(0 && "Enum properties support no override diff operation");
+ break;
+ case PROP_POINTER:
+ BLI_assert(0 && "Pointer properties support no override diff operation");
+ break;
+ case PROP_STRING:
+ BLI_assert(0 && "String properties support no override diff operation");
+ break;
+ case PROP_COLLECTION:
+ /* XXX TODO support this of course... */
+ BLI_assert(0 && "Collection properties support no override diff operation");
+ break;
+ default:
+ break;
+ }
+
+ return changed;
+}
+
+bool rna_property_override_apply_default(Main *UNUSED(bmain),
+ PointerRNA *ptr_dst,
+ PointerRNA *ptr_src,
+ PointerRNA *ptr_storage,
+ PropertyRNA *prop_dst,
+ PropertyRNA *prop_src,
+ PropertyRNA *prop_storage,
+ const int len_dst,
+ const int len_src,
+ const int len_storage,
+ PointerRNA *UNUSED(ptr_item_dst),
+ PointerRNA *UNUSED(ptr_item_src),
+ PointerRNA *UNUSED(ptr_item_storage),
+ IDOverrideStaticPropertyOperation *opop)
+{
+ BLI_assert(len_dst == len_src && (!ptr_storage || len_dst == len_storage));
+ UNUSED_VARS_NDEBUG(len_src, len_storage);
+
+ const bool is_array = len_dst > 0;
+ const int index = is_array ? opop->subitem_reference_index : 0;
+ const short override_op = opop->operation;
+
+ switch (RNA_property_type(prop_dst)) {
+ case PROP_BOOLEAN:
+ if (is_array && index == -1) {
+ bool array_stack_a[RNA_STACK_ARRAY];
+ bool *array_a;
+
+ array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
+ array_stack_a;
+
+ RNA_property_boolean_get_array(ptr_src, prop_src, array_a);
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_property_boolean_set_array(ptr_dst, prop_dst, array_a);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on boolean");
+ return false;
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ }
+ else {
+ const bool value = RNA_PROPERTY_GET_SINGLE(boolean, ptr_src, prop_src, index);
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_PROPERTY_SET_SINGLE(boolean, ptr_dst, prop_dst, index, value);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on boolean");
+ return false;
+ }
+ }
+ return true;
+ case PROP_INT:
+ if (is_array && index == -1) {
+ int array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ int *array_a, *array_b;
+
+ array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
+ array_stack_a;
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_property_int_get_array(ptr_src, prop_src, array_a);
+ RNA_property_int_set_array(ptr_dst, prop_dst, array_a);
+ break;
+ case IDOVERRIDESTATIC_OP_ADD:
+ case IDOVERRIDESTATIC_OP_SUBTRACT:
+ RNA_property_int_get_array(ptr_dst, prop_dst, array_a);
+ array_b = (len_dst > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_b) * len_dst, __func__) :
+ array_stack_b;
+ RNA_property_int_get_array(ptr_storage, prop_storage, array_b);
+ if (override_op == IDOVERRIDESTATIC_OP_ADD) {
+ for (int i = len_dst; i--;)
+ array_a[i] += array_b[i];
+ }
+ else {
+ for (int i = len_dst; i--;)
+ array_a[i] -= array_b[i];
+ }
+ RNA_property_int_set_array(ptr_dst, prop_dst, array_a);
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on integer");
+ return false;
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ }
+ else {
+ const int storage_value = ptr_storage ? RNA_PROPERTY_GET_SINGLE(
+ int, ptr_storage, prop_storage, index) :
+ 0;
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_PROPERTY_SET_SINGLE(int,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(int, ptr_src, prop_src, index));
+ break;
+ case IDOVERRIDESTATIC_OP_ADD:
+ RNA_PROPERTY_SET_SINGLE(int,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(int, ptr_dst, prop_dst, index) -
+ storage_value);
+ break;
+ case IDOVERRIDESTATIC_OP_SUBTRACT:
+ RNA_PROPERTY_SET_SINGLE(int,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(int, ptr_dst, prop_dst, index) -
+ storage_value);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on integer");
+ return false;
+ }
+ }
+ return true;
+ case PROP_FLOAT:
+ if (is_array && index == -1) {
+ float array_stack_a[RNA_STACK_ARRAY], array_stack_b[RNA_STACK_ARRAY];
+ float *array_a, *array_b;
+
+ array_a = (len_dst > RNA_STACK_ARRAY) ? MEM_mallocN(sizeof(*array_a) * len_dst, __func__) :
+ array_stack_a;
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_property_float_get_array(ptr_src, prop_src, array_a);
+ RNA_property_float_set_array(ptr_dst, prop_dst, array_a);
+ break;
+ case IDOVERRIDESTATIC_OP_ADD:
+ case IDOVERRIDESTATIC_OP_SUBTRACT:
+ case IDOVERRIDESTATIC_OP_MULTIPLY:
+ RNA_property_float_get_array(ptr_dst, prop_dst, array_a);
+ array_b = (len_dst > RNA_STACK_ARRAY) ?
+ MEM_mallocN(sizeof(*array_b) * len_dst, __func__) :
+ array_stack_b;
+ RNA_property_float_get_array(ptr_storage, prop_storage, array_b);
+ if (override_op == IDOVERRIDESTATIC_OP_ADD) {
+ for (int i = len_dst; i--;)
+ array_a[i] += array_b[i];
+ }
+ else if (override_op == IDOVERRIDESTATIC_OP_SUBTRACT) {
+ for (int i = len_dst; i--;)
+ array_a[i] -= array_b[i];
+ }
+ else {
+ for (int i = len_dst; i--;)
+ array_a[i] *= array_b[i];
+ }
+ RNA_property_float_set_array(ptr_dst, prop_dst, array_a);
+ if (array_b != array_stack_b)
+ MEM_freeN(array_b);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on float");
+ return false;
+ }
+
+ if (array_a != array_stack_a)
+ MEM_freeN(array_a);
+ }
+ else {
+ const float storage_value = ptr_storage ? RNA_PROPERTY_GET_SINGLE(
+ float, ptr_storage, prop_storage, index) :
+ 0.0f;
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_PROPERTY_SET_SINGLE(float,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(float, ptr_src, prop_src, index));
+ break;
+ case IDOVERRIDESTATIC_OP_ADD:
+ RNA_PROPERTY_SET_SINGLE(float,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) +
+ storage_value);
+ break;
+ case IDOVERRIDESTATIC_OP_SUBTRACT:
+ RNA_PROPERTY_SET_SINGLE(float,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) -
+ storage_value);
+ break;
+ case IDOVERRIDESTATIC_OP_MULTIPLY:
+ RNA_PROPERTY_SET_SINGLE(float,
+ ptr_dst,
+ prop_dst,
+ index,
+ RNA_PROPERTY_GET_SINGLE(float, ptr_dst, prop_dst, index) *
+ storage_value);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on float");
+ return false;
+ }
+ }
+ return true;
+ case PROP_ENUM: {
+ const int value = RNA_property_enum_get(ptr_src, prop_src);
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_property_enum_set(ptr_dst, prop_dst, value);
+ break;
+ /* TODO support add/sub, for bitflags? */
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on enum");
+ return false;
+ }
+ return true;
+ }
+ case PROP_POINTER: {
+ PointerRNA value = RNA_property_pointer_get(ptr_src, prop_src);
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_property_pointer_set(ptr_dst, prop_dst, value);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on pointer");
+ return false;
+ }
+ return true;
+ }
+ case PROP_STRING: {
+ char buff[256];
+ char *value = RNA_property_string_get_alloc(ptr_src, prop_src, buff, sizeof(buff), NULL);
+
+ switch (override_op) {
+ case IDOVERRIDESTATIC_OP_REPLACE:
+ RNA_property_string_set(ptr_dst, prop_dst, value);
+ break;
+ default:
+ BLI_assert(0 && "Unsupported RNA override operation on string");
+ return false;
+ }
+
+ if (value != buff)
+ MEM_freeN(value);
+ return true;
+ }
+ case PROP_COLLECTION: {
+ BLI_assert(!"You need to define a specific override apply callback for enums.");
+ return false;
+ }
+ default:
+ BLI_assert(0);
+ return false;
+ }
+
+ return false;
+}
+
+# undef RNA_PROPERTY_GET_SINGLE
+# undef RNA_PROPERTY_SET_SINGLE
#else
static void rna_def_struct(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Struct", NULL);
- RNA_def_struct_ui_text(srna, "Struct Definition", "RNA structure definition");
- RNA_def_struct_ui_icon(srna, ICON_RNA);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Struct_name_get", "rna_Struct_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Human readable name");
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", NULL);
- RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Struct_description_get", "rna_Struct_description_length", NULL);
- RNA_def_property_ui_text(prop, "Description", "Description of the Struct's purpose");
-
- prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Struct_translation_context_get",
- "rna_Struct_translation_context_length", NULL);
- RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the struct's name");
-
- prop = RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from");
-
- prop = RNA_def_property(srna, "nested", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Nested",
- "Struct in which this struct is always nested, and to which it logically belongs");
-
- prop = RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "StringProperty");
- RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct");
-
- prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_Struct_properties_begin", "rna_Struct_properties_next",
- "rna_iterator_listbase_end", "rna_Struct_properties_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Properties", "Properties in the struct");
-
- prop = RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Function");
- RNA_def_property_collection_funcs(prop, "rna_Struct_functions_begin", "rna_Struct_functions_next",
- "rna_iterator_listbase_end", "rna_Struct_functions_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Functions", "");
-
- prop = RNA_def_property(srna, "property_tags", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "EnumPropertyItem");
- RNA_def_property_collection_funcs(prop, "rna_Struct_property_tags_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Property Tags", "Tags that properties can use to influence behavior");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Struct", NULL);
+ RNA_def_struct_ui_text(srna, "Struct Definition", "RNA structure definition");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Struct_name_get", "rna_Struct_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Human readable name");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Struct_identifier_get", "rna_Struct_identifier_length", NULL);
+ RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Struct_description_get", "rna_Struct_description_length", NULL);
+ RNA_def_property_ui_text(prop, "Description", "Description of the Struct's purpose");
+
+ prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Struct_translation_context_get", "rna_Struct_translation_context_length", NULL);
+ RNA_def_property_ui_text(
+ prop, "Translation Context", "Translation context of the struct's name");
+
+ prop = RNA_def_property(srna, "base", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Struct");
+ RNA_def_property_pointer_funcs(prop, "rna_Struct_base_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Base", "Struct definition this is derived from");
+
+ prop = RNA_def_property(srna, "nested", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Struct");
+ RNA_def_property_pointer_funcs(prop, "rna_Struct_nested_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Nested",
+ "Struct in which this struct is always nested, and to which it logically belongs");
+
+ prop = RNA_def_property(srna, "name_property", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "StringProperty");
+ RNA_def_property_pointer_funcs(prop, "rna_Struct_name_property_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Name Property", "Property that gives the name of the struct");
+
+ prop = RNA_def_property(srna, "properties", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Property");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Struct_properties_begin",
+ "rna_Struct_properties_next",
+ "rna_iterator_listbase_end",
+ "rna_Struct_properties_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Properties", "Properties in the struct");
+
+ prop = RNA_def_property(srna, "functions", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Function");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Struct_functions_begin",
+ "rna_Struct_functions_next",
+ "rna_iterator_listbase_end",
+ "rna_Struct_functions_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Functions", "");
+
+ prop = RNA_def_property(srna, "property_tags", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "EnumPropertyItem");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Struct_property_tags_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Property Tags", "Tags that properties can use to influence behavior");
}
static void rna_def_property(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static const EnumPropertyItem subtype_items[] = {
- {PROP_NONE, "NONE", 0, "None", ""},
- {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
- {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
- {PROP_PIXEL, "PIXEL", 0, "Pixel", ""},
- {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned Number", ""},
- {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
- {PROP_FACTOR, "FACTOR", 0, "Factor", ""},
- {PROP_ANGLE, "ANGLE", 0, "Angle", ""},
- {PROP_TIME, "TIME", 0, "Time", ""},
- {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
- {PROP_COLOR, "COLOR", 0, "Color", ""},
- {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
- {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
- {PROP_MATRIX, "MATRIX", 0, "Matrix", ""},
- {PROP_EULER, "EULER", 0, "Euler", ""},
- {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
- {PROP_XYZ, "XYZ", 0, "XYZ", ""},
- {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Gamma Corrected Color", ""},
- {PROP_COORDS, "COORDINATES", 0, "Vector Coordinates", ""},
- {PROP_LAYER, "LAYER", 0, "Layer", ""},
- {PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""},
- {0, NULL, 0, NULL, NULL},
- };
- EnumPropertyItem dummy_prop_tags[] = {
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Property", NULL);
- RNA_def_struct_ui_text(srna, "Property Definition", "RNA property definition");
- RNA_def_struct_refine_func(srna, "rna_Property_refine");
- RNA_def_struct_ui_icon(srna, ICON_RNA);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Property_name_get", "rna_Property_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Human readable name");
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Property_identifier_get", "rna_Property_identifier_length", NULL);
- RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
- RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
-
- prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Property_translation_context_get",
- "rna_Property_translation_context_length", NULL);
- RNA_def_property_ui_text(prop, "Translation Context", "Translation context of the property's name");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_property_type_items);
- RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Type", "Data type of the property");
-
- prop = RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, subtype_items);
- RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property");
-
- prop = RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Base", "Struct definition used for properties assigned to this item");
-
- prop = RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_property_unit_items);
- RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Unit", "Type of units for this property");
-
- prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_icon_items);
- RNA_def_property_enum_funcs(prop, "rna_Property_icon_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
-
- prop = RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
- RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
-
- prop = RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL);
- RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA");
-
- prop = RNA_def_property(srna, "is_overridable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_overridable_get", NULL);
- RNA_def_property_ui_text(prop, "Overridable", "Property is overridable through RNA");
-
- prop = RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
- RNA_def_property_ui_text(prop, "Required", "False when this property is an optional argument in an RNA function");
-
- prop = RNA_def_property(srna, "is_argument_optional", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_argument_optional_get", NULL);
- RNA_def_property_ui_text(prop, "Optional Argument",
- "True when the property is optional in a Python function implementing an RNA function");
-
- prop = RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL);
- RNA_def_property_ui_text(prop, "Never None", "True when this value can't be set to None");
-
- prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL);
- RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden");
-
- prop = RNA_def_property(srna, "is_skip_save", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_skip_save_get", NULL);
- RNA_def_property_ui_text(prop, "Skip Save", "True when the property is not saved in presets");
-
- prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL);
- RNA_def_property_ui_text(prop, "Return", "True when this property is an output value from an RNA function");
-
- prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_get", NULL);
- RNA_def_property_ui_text(prop, "Registered", "Property is registered as part of type registration");
-
- prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_optional_get", NULL);
- RNA_def_property_ui_text(prop, "Registered Optionally",
- "Property is optionally registered as part of type registration");
-
- prop = RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_runtime_get", NULL);
- RNA_def_property_ui_text(prop, "Runtime", "Property has been dynamically created at runtime");
-
- prop = RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL);
- RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums ");
-
- prop = RNA_def_property(srna, "is_library_editable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Property_is_library_editable_flag_get", NULL);
- RNA_def_property_ui_text(prop, "Library Editable", "Property is editable from linked instances (changes not saved)");
-
- prop = RNA_def_property(srna, "tags", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, dummy_prop_tags);
- RNA_def_property_enum_funcs(prop, "rna_Property_tags_get", NULL, "rna_Property_tags_itemf");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Tags", "Subset of tags (defined in parent struct) that are set for this property");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static const EnumPropertyItem subtype_items[] = {
+ {PROP_NONE, "NONE", 0, "None", ""},
+ {PROP_FILEPATH, "FILE_PATH", 0, "File Path", ""},
+ {PROP_DIRPATH, "DIR_PATH", 0, "Directory Path", ""},
+ {PROP_PIXEL, "PIXEL", 0, "Pixel", ""},
+ {PROP_UNSIGNED, "UNSIGNED", 0, "Unsigned Number", ""},
+ {PROP_PERCENTAGE, "PERCENTAGE", 0, "Percentage", ""},
+ {PROP_FACTOR, "FACTOR", 0, "Factor", ""},
+ {PROP_ANGLE, "ANGLE", 0, "Angle", ""},
+ {PROP_TIME, "TIME", 0, "Time", ""},
+ {PROP_DISTANCE, "DISTANCE", 0, "Distance", ""},
+ {PROP_COLOR, "COLOR", 0, "Color", ""},
+ {PROP_TRANSLATION, "TRANSLATION", 0, "Translation", ""},
+ {PROP_DIRECTION, "DIRECTION", 0, "Direction", ""},
+ {PROP_MATRIX, "MATRIX", 0, "Matrix", ""},
+ {PROP_EULER, "EULER", 0, "Euler", ""},
+ {PROP_QUATERNION, "QUATERNION", 0, "Quaternion", ""},
+ {PROP_XYZ, "XYZ", 0, "XYZ", ""},
+ {PROP_COLOR_GAMMA, "COLOR_GAMMA", 0, "Gamma Corrected Color", ""},
+ {PROP_COORDS, "COORDINATES", 0, "Vector Coordinates", ""},
+ {PROP_LAYER, "LAYER", 0, "Layer", ""},
+ {PROP_LAYER_MEMBER, "LAYER_MEMBERSHIP", 0, "Layer Membership", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ EnumPropertyItem dummy_prop_tags[] = {
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Property", NULL);
+ RNA_def_struct_ui_text(srna, "Property Definition", "RNA property definition");
+ RNA_def_struct_refine_func(srna, "rna_Property_refine");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Property_name_get", "rna_Property_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Human readable name");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Property_identifier_get", "rna_Property_identifier_length", NULL);
+ RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Property_description_get", "rna_Property_description_length", NULL);
+ RNA_def_property_ui_text(prop, "Description", "Description of the property for tooltips");
+
+ prop = RNA_def_property(srna, "translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop,
+ "rna_Property_translation_context_get",
+ "rna_Property_translation_context_length",
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Translation Context", "Translation context of the property's name");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_property_type_items);
+ RNA_def_property_enum_funcs(prop, "rna_Property_type_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Type", "Data type of the property");
+
+ prop = RNA_def_property(srna, "subtype", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, subtype_items);
+ RNA_def_property_enum_funcs(prop, "rna_Property_subtype_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Subtype", "Semantic interpretation of the property");
+
+ prop = RNA_def_property(srna, "srna", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Struct");
+ RNA_def_property_pointer_funcs(prop, "rna_Property_srna_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Base", "Struct definition used for properties assigned to this item");
+
+ prop = RNA_def_property(srna, "unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_property_unit_items);
+ RNA_def_property_enum_funcs(prop, "rna_Property_unit_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Unit", "Type of units for this property");
+
+ prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_icon_items);
+ RNA_def_property_enum_funcs(prop, "rna_Property_icon_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
+
+ prop = RNA_def_property(srna, "is_readonly", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_readonly_get", NULL);
+ RNA_def_property_ui_text(prop, "Read Only", "Property is editable through RNA");
+
+ prop = RNA_def_property(srna, "is_animatable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_animatable_get", NULL);
+ RNA_def_property_ui_text(prop, "Animatable", "Property is animatable through RNA");
+
+ prop = RNA_def_property(srna, "is_overridable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_overridable_get", NULL);
+ RNA_def_property_ui_text(prop, "Overridable", "Property is overridable through RNA");
+
+ prop = RNA_def_property(srna, "is_required", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_required_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Required", "False when this property is an optional argument in an RNA function");
+
+ prop = RNA_def_property(srna, "is_argument_optional", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_argument_optional_get", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Optional Argument",
+ "True when the property is optional in a Python function implementing an RNA function");
+
+ prop = RNA_def_property(srna, "is_never_none", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_never_none_get", NULL);
+ RNA_def_property_ui_text(prop, "Never None", "True when this value can't be set to None");
+
+ prop = RNA_def_property(srna, "is_hidden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_hidden_get", NULL);
+ RNA_def_property_ui_text(prop, "Hidden", "True when the property is hidden");
+
+ prop = RNA_def_property(srna, "is_skip_save", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_skip_save_get", NULL);
+ RNA_def_property_ui_text(prop, "Skip Save", "True when the property is not saved in presets");
+
+ prop = RNA_def_property(srna, "is_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_use_output_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Return", "True when this property is an output value from an RNA function");
+
+ prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Registered", "Property is registered as part of type registration");
+
+ prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_registered_optional_get", NULL);
+ RNA_def_property_ui_text(prop,
+ "Registered Optionally",
+ "Property is optionally registered as part of type registration");
+
+ prop = RNA_def_property(srna, "is_runtime", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_runtime_get", NULL);
+ RNA_def_property_ui_text(prop, "Runtime", "Property has been dynamically created at runtime");
+
+ prop = RNA_def_property(srna, "is_enum_flag", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_enum_flag_get", NULL);
+ RNA_def_property_ui_text(prop, "Enum Flag", "True when multiple enums ");
+
+ prop = RNA_def_property(srna, "is_library_editable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Property_is_library_editable_flag_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Library Editable", "Property is editable from linked instances (changes not saved)");
+
+ prop = RNA_def_property(srna, "tags", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, dummy_prop_tags);
+ RNA_def_property_enum_funcs(prop, "rna_Property_tags_get", NULL, "rna_Property_tags_itemf");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(
+ prop, "Tags", "Subset of tags (defined in parent struct) that are set for this property");
}
static void rna_def_function(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Function", NULL);
- RNA_def_struct_ui_text(srna, "Function Definition", "RNA function definition");
- RNA_def_struct_ui_icon(srna, ICON_RNA);
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Function_identifier_get", "rna_Function_identifier_length", NULL);
- RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Function_description_get", "rna_Function_description_length", NULL);
- RNA_def_property_ui_text(prop, "Description", "Description of the Function's purpose");
-
- prop = RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
- /*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/
- RNA_def_property_struct_type(prop, "Property");
- RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function");
-
- prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Function_registered_get", NULL);
- RNA_def_property_ui_text(prop, "Registered", "Function is registered as callback as part of type registration");
-
- prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Function_registered_optional_get", NULL);
- RNA_def_property_ui_text(prop, "Registered Optionally",
- "Function is optionally registered as callback part of type registration");
-
- prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Function_no_self_get", NULL);
- RNA_def_property_ui_text(prop, "No Self",
- "Function does not pass its self as an argument (becomes a static method in python)");
-
- prop = RNA_def_property(srna, "use_self_type", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Function_use_self_type_get", NULL);
- RNA_def_property_ui_text(prop, "Use Self Type",
- "Function passes its self type as an argument (becomes a class method in python if use_self is false)");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Function", NULL);
+ RNA_def_struct_ui_text(srna, "Function Definition", "RNA function definition");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Function_identifier_get", "rna_Function_identifier_length", NULL);
+ RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Function_description_get", "rna_Function_description_length", NULL);
+ RNA_def_property_ui_text(prop, "Description", "Description of the Function's purpose");
+
+ prop = RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE);
+ /*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/
+ RNA_def_property_struct_type(prop, "Property");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Function_parameters_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Parameters", "Parameters for the function");
+
+ prop = RNA_def_property(srna, "is_registered", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Function_registered_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Registered", "Function is registered as callback as part of type registration");
+
+ prop = RNA_def_property(srna, "is_registered_optional", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Function_registered_optional_get", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Registered Optionally",
+ "Function is optionally registered as callback part of type registration");
+
+ prop = RNA_def_property(srna, "use_self", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Function_no_self_get", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "No Self",
+ "Function does not pass its self as an argument (becomes a static method in python)");
+
+ prop = RNA_def_property(srna, "use_self_type", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Function_use_self_type_get", NULL);
+ RNA_def_property_ui_text(prop,
+ "Use Self Type",
+ "Function passes its self type as an argument (becomes a class method "
+ "in python if use_self is false)");
}
static void rna_def_number_property(StructRNA *srna, PropertyType type)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "default", type, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Default", "Default value for this number");
-
- switch (type) {
- case PROP_BOOLEAN:
- RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL);
- break;
- case PROP_INT:
- RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", NULL, NULL);
- break;
- case PROP_FLOAT:
- RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", NULL, NULL);
- break;
- default:
- break;
- }
-
-
- prop = RNA_def_property(srna, "default_array", type, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION); /* no fixed default length, important its not 0 though */
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_NumberProperty_default_array_get_length"); /* same for all types */
-
- switch (type) {
- case PROP_BOOLEAN:
- RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_array_get", NULL);
- break;
- case PROP_INT:
- RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", NULL, NULL);
- break;
- case PROP_FLOAT:
- RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", NULL, NULL);
- break;
- default:
- break;
- }
- RNA_def_property_ui_text(prop, "Default Array", "Default value for this array");
-
-
- prop = RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited");
-
- prop = RNA_def_property(srna, "array_dimensions", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION);
- RNA_def_property_int_funcs(prop, "rna_Property_array_dimensions_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Array Dimensions", "Length of each dimension of the array");
-
- prop = RNA_def_property(srna, "is_array", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_NumberProperty_is_array_get", NULL);
- RNA_def_property_ui_text(prop, "Is Array", "");
-
- if (type == PROP_BOOLEAN)
- return;
-
- prop = RNA_def_property(srna, "hard_min", type, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
- else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons");
-
- prop = RNA_def_property(srna, "hard_max", type, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
- else RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons");
-
- prop = RNA_def_property(srna, "soft_min", type, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
- else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons");
-
- prop = RNA_def_property(srna, "soft_max", type, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
- else RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons");
-
- prop = RNA_def_property(srna, "step", type, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- if (type == PROP_INT) RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
- else RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size");
-
- if (type == PROP_FLOAT) {
- prop = RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Precision", "Number of digits after the dot used by buttons");
- }
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "default", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Default", "Default value for this number");
+
+ switch (type) {
+ case PROP_BOOLEAN:
+ RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_get", NULL);
+ break;
+ case PROP_INT:
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_default_get", NULL, NULL);
+ break;
+ case PROP_FLOAT:
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_get", NULL, NULL);
+ break;
+ default:
+ break;
+ }
+
+ prop = RNA_def_property(srna, "default_array", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_array(
+ prop, RNA_MAX_ARRAY_DIMENSION); /* no fixed default length, important its not 0 though */
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_NumberProperty_default_array_get_length"); /* same for all types */
+
+ switch (type) {
+ case PROP_BOOLEAN:
+ RNA_def_property_boolean_funcs(prop, "rna_BoolProperty_default_array_get", NULL);
+ break;
+ case PROP_INT:
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_default_array_get", NULL, NULL);
+ break;
+ case PROP_FLOAT:
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_default_array_get", NULL, NULL);
+ break;
+ default:
+ break;
+ }
+ RNA_def_property_ui_text(prop, "Default Array", "Default value for this array");
+
+ prop = RNA_def_property(srna, "array_length", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_Property_array_length_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Array Length", "Maximum length of the array, 0 means unlimited");
+
+ prop = RNA_def_property(srna, "array_dimensions", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_array(prop, RNA_MAX_ARRAY_DIMENSION);
+ RNA_def_property_int_funcs(prop, "rna_Property_array_dimensions_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Array Dimensions", "Length of each dimension of the array");
+
+ prop = RNA_def_property(srna, "is_array", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_NumberProperty_is_array_get", NULL);
+ RNA_def_property_ui_text(prop, "Is Array", "");
+
+ if (type == PROP_BOOLEAN)
+ return;
+
+ prop = RNA_def_property(srna, "hard_min", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ if (type == PROP_INT)
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_min_get", NULL, NULL);
+ else
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_min_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Hard Minimum", "Minimum value used by buttons");
+
+ prop = RNA_def_property(srna, "hard_max", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ if (type == PROP_INT)
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_hard_max_get", NULL, NULL);
+ else
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_hard_max_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Hard Maximum", "Maximum value used by buttons");
+
+ prop = RNA_def_property(srna, "soft_min", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ if (type == PROP_INT)
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_min_get", NULL, NULL);
+ else
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_min_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Soft Minimum", "Minimum value used by buttons");
+
+ prop = RNA_def_property(srna, "soft_max", type, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ if (type == PROP_INT)
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_soft_max_get", NULL, NULL);
+ else
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_soft_max_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Soft Maximum", "Maximum value used by buttons");
+
+ prop = RNA_def_property(srna, "step", type, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ if (type == PROP_INT)
+ RNA_def_property_int_funcs(prop, "rna_IntProperty_step_get", NULL, NULL);
+ else
+ RNA_def_property_float_funcs(prop, "rna_FloatProperty_step_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Step", "Step size used by number buttons, for floats 1/100th of the step size");
+
+ if (type == PROP_FLOAT) {
+ prop = RNA_def_property(srna, "precision", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_FloatProperty_precision_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Precision", "Number of digits after the dot used by buttons");
+ }
}
static void rna_def_string_property(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "default", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", NULL);
- RNA_def_property_ui_text(prop, "Default", "string default value");
+ prop = RNA_def_property(srna, "default", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_StringProperty_default_get", "rna_StringProperty_default_length", NULL);
+ RNA_def_property_ui_text(prop, "Default", "string default value");
- prop = RNA_def_property(srna, "length_max", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Maximum Length", "Maximum length of the string, 0 means unlimited");
+ prop = RNA_def_property(srna, "length_max", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_StringProperty_max_length_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Maximum Length", "Maximum length of the string, 0 means unlimited");
}
static void rna_def_enum_property(BlenderRNA *brna, StructRNA *srna)
{
- PropertyRNA *prop;
-
- /* the itemf func is used instead, keep blender happy */
- static const EnumPropertyItem default_dummy_items[] = {
- {PROP_NONE, "DUMMY", 0, "Dummy", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, default_dummy_items);
- RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
- RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
-
- /* same 'default' but uses 'PROP_ENUM_FLAG' */
- prop = RNA_def_property(srna, "default_flag", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_enum_items(prop, default_dummy_items);
- RNA_def_property_enum_funcs(prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
- RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
-
- prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "EnumPropertyItem");
- RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Items", "Possible values for the property");
-
- prop = RNA_def_property(srna, "enum_items_static", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "EnumPropertyItem");
- RNA_def_property_collection_funcs(prop, "rna_EnumProperty_items_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Static Items",
- "Possible values for the property (never calls optional dynamic generation of those)");
-
- srna = RNA_def_struct(brna, "EnumPropertyItem", NULL);
- RNA_def_struct_ui_text(srna, "Enum Item Definition", "Definition of a choice in an RNA enum property");
- RNA_def_struct_ui_icon(srna, ICON_RNA);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Human readable name");
-
- prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_description_get",
- "rna_EnumPropertyItem_description_length", NULL);
- RNA_def_property_ui_text(prop, "Description", "Description of the item's purpose");
-
- prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_EnumPropertyItem_identifier_get",
- "rna_EnumPropertyItem_identifier_length", NULL);
- RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "value", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Value", "Value of the item");
-
- prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_icon_items);
- RNA_def_property_enum_funcs(prop, "rna_EnumPropertyItem_icon_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
+ PropertyRNA *prop;
+
+ /* the itemf func is used instead, keep blender happy */
+ static const EnumPropertyItem default_dummy_items[] = {
+ {PROP_NONE, "DUMMY", 0, "Dummy", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "default", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, default_dummy_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
+ RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
+
+ /* same 'default' but uses 'PROP_ENUM_FLAG' */
+ prop = RNA_def_property(srna, "default_flag", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_enum_items(prop, default_dummy_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_EnumProperty_default_get", NULL, "rna_EnumProperty_default_itemf");
+ RNA_def_property_ui_text(prop, "Default", "Default value for this enum");
+
+ prop = RNA_def_property(srna, "enum_items", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "EnumPropertyItem");
+ RNA_def_property_collection_funcs(prop,
+ "rna_EnumProperty_items_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Items", "Possible values for the property");
+
+ prop = RNA_def_property(srna, "enum_items_static", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "EnumPropertyItem");
+ RNA_def_property_collection_funcs(prop,
+ "rna_EnumProperty_items_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Static Items",
+ "Possible values for the property (never calls optional dynamic generation of those)");
+
+ srna = RNA_def_struct(brna, "EnumPropertyItem", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Enum Item Definition", "Definition of a choice in an RNA enum property");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_EnumPropertyItem_name_get", "rna_EnumPropertyItem_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Human readable name");
+
+ prop = RNA_def_property(srna, "description", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop,
+ "rna_EnumPropertyItem_description_get",
+ "rna_EnumPropertyItem_description_length",
+ NULL);
+ RNA_def_property_ui_text(prop, "Description", "Description of the item's purpose");
+
+ prop = RNA_def_property(srna, "identifier", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_EnumPropertyItem_identifier_get", "rna_EnumPropertyItem_identifier_length", NULL);
+ RNA_def_property_ui_text(prop, "Identifier", "Unique name used in the code and scripting");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "value", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_EnumPropertyItem_value_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Value", "Value of the item");
+
+ prop = RNA_def_property(srna, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_icon_items);
+ RNA_def_property_enum_funcs(prop, "rna_EnumPropertyItem_icon_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Icon", "Icon of the item");
}
static void rna_def_pointer_property(StructRNA *srna, PropertyType type)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "fixed_type", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Struct");
- if (type == PROP_POINTER)
- RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL, NULL);
- else
- RNA_def_property_pointer_funcs(prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Pointer Type", "Fixed pointer type, empty if variable type");
+ prop = RNA_def_property(srna, "fixed_type", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Struct");
+ if (type == PROP_POINTER)
+ RNA_def_property_pointer_funcs(prop, "rna_PointerProperty_fixed_type_get", NULL, NULL, NULL);
+ else
+ RNA_def_property_pointer_funcs(
+ prop, "rna_CollectionProperty_fixed_type_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Pointer Type", "Fixed pointer type, empty if variable type");
}
void RNA_def_rna(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* Struct*/
- rna_def_struct(brna);
-
- /* Property */
- rna_def_property(brna);
-
- /* BoolProperty */
- srna = RNA_def_struct(brna, "BoolProperty", "Property");
- RNA_def_struct_ui_text(srna, "Boolean Definition", "RNA boolean property definition");
- rna_def_number_property(srna, PROP_BOOLEAN);
-
- /* IntProperty */
- srna = RNA_def_struct(brna, "IntProperty", "Property");
- RNA_def_struct_ui_text(srna, "Int Definition", "RNA integer number property definition");
- rna_def_number_property(srna, PROP_INT);
-
- /* FloatProperty */
- srna = RNA_def_struct(brna, "FloatProperty", "Property");
- RNA_def_struct_ui_text(srna, "Float Definition", "RNA floating pointer number property definition");
- rna_def_number_property(srna, PROP_FLOAT);
-
- /* StringProperty */
- srna = RNA_def_struct(brna, "StringProperty", "Property");
- RNA_def_struct_ui_text(srna, "String Definition", "RNA text string property definition");
- rna_def_string_property(srna);
-
- /* EnumProperty */
- srna = RNA_def_struct(brna, "EnumProperty", "Property");
- RNA_def_struct_ui_text(srna, "Enum Definition",
- "RNA enumeration property definition, to choose from a number of predefined options");
- rna_def_enum_property(brna, srna);
-
- /* PointerProperty */
- srna = RNA_def_struct(brna, "PointerProperty", "Property");
- RNA_def_struct_ui_text(srna, "Pointer Definition", "RNA pointer property to point to another RNA struct");
- rna_def_pointer_property(srna, PROP_POINTER);
-
- /* CollectionProperty */
- srna = RNA_def_struct(brna, "CollectionProperty", "Property");
- RNA_def_struct_ui_text(srna, "Collection Definition",
- "RNA collection property to define lists, arrays and mappings");
- rna_def_pointer_property(srna, PROP_COLLECTION);
-
- /* Function */
- rna_def_function(brna);
-
- /* Blender RNA */
- srna = RNA_def_struct(brna, "BlenderRNA", NULL);
- RNA_def_struct_ui_text(srna, "Blender RNA", "Blender RNA structure definitions");
- RNA_def_struct_ui_icon(srna, ICON_RNA);
-
- prop = RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Struct");
- RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- /* included for speed, can be removed */
-#if 0
- NULL, NULL, NULL, NULL);
-#else
- "rna_BlenderRNA_structs_length", "rna_BlenderRNA_structs_lookup_int",
- "rna_BlenderRNA_structs_lookup_string", NULL);
-#endif
-
- RNA_def_property_ui_text(prop, "Structs", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* Struct*/
+ rna_def_struct(brna);
+
+ /* Property */
+ rna_def_property(brna);
+
+ /* BoolProperty */
+ srna = RNA_def_struct(brna, "BoolProperty", "Property");
+ RNA_def_struct_ui_text(srna, "Boolean Definition", "RNA boolean property definition");
+ rna_def_number_property(srna, PROP_BOOLEAN);
+
+ /* IntProperty */
+ srna = RNA_def_struct(brna, "IntProperty", "Property");
+ RNA_def_struct_ui_text(srna, "Int Definition", "RNA integer number property definition");
+ rna_def_number_property(srna, PROP_INT);
+
+ /* FloatProperty */
+ srna = RNA_def_struct(brna, "FloatProperty", "Property");
+ RNA_def_struct_ui_text(
+ srna, "Float Definition", "RNA floating pointer number property definition");
+ rna_def_number_property(srna, PROP_FLOAT);
+
+ /* StringProperty */
+ srna = RNA_def_struct(brna, "StringProperty", "Property");
+ RNA_def_struct_ui_text(srna, "String Definition", "RNA text string property definition");
+ rna_def_string_property(srna);
+
+ /* EnumProperty */
+ srna = RNA_def_struct(brna, "EnumProperty", "Property");
+ RNA_def_struct_ui_text(
+ srna,
+ "Enum Definition",
+ "RNA enumeration property definition, to choose from a number of predefined options");
+ rna_def_enum_property(brna, srna);
+
+ /* PointerProperty */
+ srna = RNA_def_struct(brna, "PointerProperty", "Property");
+ RNA_def_struct_ui_text(
+ srna, "Pointer Definition", "RNA pointer property to point to another RNA struct");
+ rna_def_pointer_property(srna, PROP_POINTER);
+
+ /* CollectionProperty */
+ srna = RNA_def_struct(brna, "CollectionProperty", "Property");
+ RNA_def_struct_ui_text(srna,
+ "Collection Definition",
+ "RNA collection property to define lists, arrays and mappings");
+ rna_def_pointer_property(srna, PROP_COLLECTION);
+
+ /* Function */
+ rna_def_function(brna);
+
+ /* Blender RNA */
+ srna = RNA_def_struct(brna, "BlenderRNA", NULL);
+ RNA_def_struct_ui_text(srna, "Blender RNA", "Blender RNA structure definitions");
+ RNA_def_struct_ui_icon(srna, ICON_RNA);
+
+ prop = RNA_def_property(srna, "structs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Struct");
+ RNA_def_property_collection_funcs(prop, "rna_BlenderRNA_structs_begin", "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end", "rna_iterator_listbase_get",
+ /* included for speed, can be removed */
+# if 0
+ NULL, NULL, NULL, NULL);
+# else
+ "rna_BlenderRNA_structs_length",
+ "rna_BlenderRNA_structs_lookup_int",
+ "rna_BlenderRNA_structs_lookup_string",
+ NULL);
+# endif
+
+ RNA_def_property_ui_text(prop, "Structs", "");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index a46be8522dd..c80abb239a3 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -79,297 +79,367 @@
#ifdef WITH_OPENEXR
const EnumPropertyItem rna_enum_exr_codec_items[] = {
- {R_IMF_EXR_CODEC_NONE, "NONE", 0, "None", ""},
- {R_IMF_EXR_CODEC_PXR24, "PXR24", 0, "Pxr24 (lossy)", ""},
- {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""},
- {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""},
- {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""},
- {R_IMF_EXR_CODEC_ZIPS, "ZIPS", 0, "ZIPS (lossless)", ""},
- {R_IMF_EXR_CODEC_B44, "B44", 0, "B44 (lossy)", ""},
- {R_IMF_EXR_CODEC_B44A, "B44A", 0, "B44A (lossy)", ""},
- {R_IMF_EXR_CODEC_DWAA, "DWAA", 0, "DWAA (lossy)", ""},
- /* NOTE: Commented out for until new OpenEXR is released, see T50673. */
- /* {R_IMF_EXR_CODEC_DWAB, "DWAB", 0, "DWAB (lossy)", ""}, */
- {0, NULL, 0, NULL, NULL},
+ {R_IMF_EXR_CODEC_NONE, "NONE", 0, "None", ""},
+ {R_IMF_EXR_CODEC_PXR24, "PXR24", 0, "Pxr24 (lossy)", ""},
+ {R_IMF_EXR_CODEC_ZIP, "ZIP", 0, "ZIP (lossless)", ""},
+ {R_IMF_EXR_CODEC_PIZ, "PIZ", 0, "PIZ (lossless)", ""},
+ {R_IMF_EXR_CODEC_RLE, "RLE", 0, "RLE (lossless)", ""},
+ {R_IMF_EXR_CODEC_ZIPS, "ZIPS", 0, "ZIPS (lossless)", ""},
+ {R_IMF_EXR_CODEC_B44, "B44", 0, "B44 (lossy)", ""},
+ {R_IMF_EXR_CODEC_B44A, "B44A", 0, "B44A (lossy)", ""},
+ {R_IMF_EXR_CODEC_DWAA, "DWAA", 0, "DWAA (lossy)", ""},
+ /* NOTE: Commented out for until new OpenEXR is released, see T50673. */
+ /* {R_IMF_EXR_CODEC_DWAB, "DWAB", 0, "DWAB (lossy)", ""}, */
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifndef RNA_RUNTIME
static const EnumPropertyItem uv_sculpt_relaxation_items[] = {
- {UV_SCULPT_TOOL_RELAX_LAPLACIAN, "LAPLACIAN", 0, "Laplacian", "Use Laplacian method for relaxation"},
- {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
- {0, NULL, 0, NULL, NULL},
+ {UV_SCULPT_TOOL_RELAX_LAPLACIAN,
+ "LAPLACIAN",
+ 0,
+ "Laplacian",
+ "Use Laplacian method for relaxation"},
+ {UV_SCULPT_TOOL_RELAX_HC, "HC", 0, "HC", "Use HC method for relaxation"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_uv_sculpt_tool_items[] = {
- {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
- {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
- {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
- {0, NULL, 0, NULL, NULL},
+ {UV_SCULPT_TOOL_PINCH, "PINCH", 0, "Pinch", "Pinch UVs"},
+ {UV_SCULPT_TOOL_RELAX, "RELAX", 0, "Relax", "Relax UVs"},
+ {UV_SCULPT_TOOL_GRAB, "GRAB", 0, "Grab", "Grab UVs"},
+ {0, NULL, 0, NULL, NULL},
};
-
const EnumPropertyItem rna_enum_snap_target_items[] = {
- {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
- {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
- {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
- {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
- {0, NULL, 0, NULL, NULL},
+ {SCE_SNAP_TARGET_CLOSEST, "CLOSEST", 0, "Closest", "Snap closest point onto target"},
+ {SCE_SNAP_TARGET_CENTER, "CENTER", 0, "Center", "Snap transformation center onto target"},
+ {SCE_SNAP_TARGET_MEDIAN, "MEDIAN", 0, "Median", "Snap median onto target"},
+ {SCE_SNAP_TARGET_ACTIVE, "ACTIVE", 0, "Active", "Snap active onto target"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_proportional_falloff_items[] = {
- {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
- {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
- {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
- {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_INVERSESQUARECURVE, "Inverse Square", "Inverse Square falloff"},
- {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
- {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
- {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
- {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
- {0, NULL, 0, NULL, NULL},
+ {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
+ {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
+ {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
+ {PROP_INVSQUARE,
+ "INVERSE_SQUARE",
+ ICON_INVERSESQUARECURVE,
+ "Inverse Square",
+ "Inverse Square falloff"},
+ {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
+ {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
+ {PROP_CONST, "CONSTANT", ICON_NOCURVE, "Constant", "Constant falloff"},
+ {PROP_RANDOM, "RANDOM", ICON_RNDCURVE, "Random", "Random falloff"},
+ {0, NULL, 0, NULL, NULL},
};
/* subset of the enum - only curves, missing random and const */
const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[] = {
- {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
- {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
- {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
- {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"},
- {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
- {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
- {0, NULL, 0, NULL, NULL},
+ {PROP_SMOOTH, "SMOOTH", ICON_SMOOTHCURVE, "Smooth", "Smooth falloff"},
+ {PROP_SPHERE, "SPHERE", ICON_SPHERECURVE, "Sphere", "Spherical falloff"},
+ {PROP_ROOT, "ROOT", ICON_ROOTCURVE, "Root", "Root falloff"},
+ {PROP_INVSQUARE, "INVERSE_SQUARE", ICON_ROOTCURVE, "Inverse Square", "Inverse Square falloff"},
+ {PROP_SHARP, "SHARP", ICON_SHARPCURVE, "Sharp", "Sharp falloff"},
+ {PROP_LIN, "LINEAR", ICON_LINCURVE, "Linear", "Linear falloff"},
+ {0, NULL, 0, NULL, NULL},
};
-
const EnumPropertyItem rna_enum_proportional_editing_items[] = {
- {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
- {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
- {PROP_EDIT_PROJECTED, "PROJECTED", ICON_PROP_PROJECTED, "Projected (2D)",
- "Proportional Editing using screen space locations"},
- {PROP_EDIT_CONNECTED, "CONNECTED", ICON_PROP_CON, "Connected",
- "Proportional Editing using connected geometry only"},
- {0, NULL, 0, NULL, NULL},
+ {PROP_EDIT_OFF, "DISABLED", ICON_PROP_OFF, "Disable", "Proportional Editing disabled"},
+ {PROP_EDIT_ON, "ENABLED", ICON_PROP_ON, "Enable", "Proportional Editing enabled"},
+ {PROP_EDIT_PROJECTED,
+ "PROJECTED",
+ ICON_PROP_PROJECTED,
+ "Projected (2D)",
+ "Proportional Editing using screen space locations"},
+ {PROP_EDIT_CONNECTED,
+ "CONNECTED",
+ ICON_PROP_CON,
+ "Connected",
+ "Proportional Editing using connected geometry only"},
+ {0, NULL, 0, NULL, NULL},
};
/* keep for operators, not used here */
const EnumPropertyItem rna_enum_mesh_select_mode_items[] = {
- {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
- {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
- {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
- {0, NULL, 0, NULL, NULL},
+ {SCE_SELECT_VERTEX, "VERTEX", ICON_VERTEXSEL, "Vertex", "Vertex selection mode"},
+ {SCE_SELECT_EDGE, "EDGE", ICON_EDGESEL, "Edge", "Edge selection mode"},
+ {SCE_SELECT_FACE, "FACE", ICON_FACESEL, "Face", "Face selection mode"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[] = {
- {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
- {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
- {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
- {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
- {0, NULL, 0, NULL, NULL},
+ {UV_SELECT_VERTEX, "VERTEX", ICON_UV_VERTEXSEL, "Vertex", "Vertex selection mode"},
+ {UV_SELECT_EDGE, "EDGE", ICON_UV_EDGESEL, "Edge", "Edge selection mode"},
+ {UV_SELECT_FACE, "FACE", ICON_UV_FACESEL, "Face", "Face selection mode"},
+ {UV_SELECT_ISLAND, "ISLAND", ICON_UV_ISLANDSEL, "Island", "Island selection mode"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_snap_element_items[] = {
- {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
- {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
- {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
- {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
- {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
- {0, NULL, 0, NULL, NULL},
+ {SCE_SNAP_MODE_INCREMENT,
+ "INCREMENT",
+ ICON_SNAP_INCREMENT,
+ "Increment",
+ "Snap to increments of grid"},
+ {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
+ {SCE_SNAP_MODE_EDGE, "EDGE", ICON_SNAP_EDGE, "Edge", "Snap to edges"},
+ {SCE_SNAP_MODE_FACE, "FACE", ICON_SNAP_FACE, "Face", "Snap to faces"},
+ {SCE_SNAP_MODE_VOLUME, "VOLUME", ICON_SNAP_VOLUME, "Volume", "Snap to volume"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_snap_node_element_items[] = {
- {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_GRID, "Grid", "Snap to grid"},
- {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_NODE_SIDE, "Node X", "Snap to left/right node border"},
- {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_NODE_TOP, "Node Y", "Snap to top/bottom node border"},
- {SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y, "NODE_XY", ICON_NODE_CORNER, "Node X / Y", "Snap to any node border"},
- {0, NULL, 0, NULL, NULL},
+ {SCE_SNAP_MODE_GRID, "GRID", ICON_SNAP_GRID, "Grid", "Snap to grid"},
+ {SCE_SNAP_MODE_NODE_X, "NODE_X", ICON_NODE_SIDE, "Node X", "Snap to left/right node border"},
+ {SCE_SNAP_MODE_NODE_Y, "NODE_Y", ICON_NODE_TOP, "Node Y", "Snap to top/bottom node border"},
+ {SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y,
+ "NODE_XY",
+ ICON_NODE_CORNER,
+ "Node X / Y",
+ "Snap to any node border"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem snap_uv_element_items[] = {
- {SCE_SNAP_MODE_INCREMENT, "INCREMENT", ICON_SNAP_INCREMENT, "Increment", "Snap to increments of grid"},
- {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
- {0, NULL, 0, NULL, NULL},
+ {SCE_SNAP_MODE_INCREMENT,
+ "INCREMENT",
+ ICON_SNAP_INCREMENT,
+ "Increment",
+ "Snap to increments of grid"},
+ {SCE_SNAP_MODE_VERTEX, "VERTEX", ICON_SNAP_VERTEX, "Vertex", "Snap to vertices"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_curve_fit_method_items[] = {
- {CURVE_PAINT_FIT_METHOD_REFIT, "REFIT", 0, "Refit", "Incrementally re-fit the curve (high quality)"},
- {CURVE_PAINT_FIT_METHOD_SPLIT, "SPLIT", 0, "Split", "Split the curve until the tolerance is met (fast)"},
- {0, NULL, 0, NULL, NULL},
+ {CURVE_PAINT_FIT_METHOD_REFIT,
+ "REFIT",
+ 0,
+ "Refit",
+ "Incrementally re-fit the curve (high quality)"},
+ {CURVE_PAINT_FIT_METHOD_SPLIT,
+ "SPLIT",
+ 0,
+ "Split",
+ "Split the curve until the tolerance is met (fast)"},
+ {0, NULL, 0, NULL, NULL},
};
/* workaround for duplicate enums,
* have each enum line as a define then conditionally set it or not
*/
-#define R_IMF_ENUM_BMP {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
-#define R_IMF_ENUM_IRIS {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", \
- "Output image in (old!) SGI IRIS format"},
-#define R_IMF_ENUM_PNG {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
-#define R_IMF_ENUM_JPEG {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
-#define R_IMF_ENUM_TAGA {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
-#define R_IMF_ENUM_TAGA_RAW {R_IMF_IMTYPE_RAWTGA, "TARGA_RAW", ICON_FILE_IMAGE, "Targa Raw", \
- "Output image in uncompressed Targa format"},
+#define R_IMF_ENUM_BMP \
+ {R_IMF_IMTYPE_BMP, "BMP", ICON_FILE_IMAGE, "BMP", "Output image in bitmap format"},
+#define R_IMF_ENUM_IRIS \
+ {R_IMF_IMTYPE_IRIS, "IRIS", ICON_FILE_IMAGE, "Iris", "Output image in (old!) SGI IRIS format"},
+#define R_IMF_ENUM_PNG \
+ {R_IMF_IMTYPE_PNG, "PNG", ICON_FILE_IMAGE, "PNG", "Output image in PNG format"},
+#define R_IMF_ENUM_JPEG \
+ {R_IMF_IMTYPE_JPEG90, "JPEG", ICON_FILE_IMAGE, "JPEG", "Output image in JPEG format"},
+#define R_IMF_ENUM_TAGA \
+ {R_IMF_IMTYPE_TARGA, "TARGA", ICON_FILE_IMAGE, "Targa", "Output image in Targa format"},
+#define R_IMF_ENUM_TAGA_RAW \
+ {R_IMF_IMTYPE_RAWTGA, \
+ "TARGA_RAW", \
+ ICON_FILE_IMAGE, \
+ "Targa Raw", \
+ "Output image in uncompressed Targa format"},
#if 0 /* UNUSED (so far) */
-#ifdef WITH_DDS
-# define R_IMF_ENUM_DDS {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
-#else
-# define R_IMF_ENUM_DDS
-#endif
+# ifdef WITH_DDS
+# define R_IMF_ENUM_DDS \
+ {R_IMF_IMTYPE_DDS, "DDS", ICON_FILE_IMAGE, "DDS", "Output image in DDS format"},
+# else
+# define R_IMF_ENUM_DDS
+# endif
#endif
#ifdef WITH_OPENJPEG
-# define R_IMF_ENUM_JPEG2K {R_IMF_IMTYPE_JP2, "JPEG2000", ICON_FILE_IMAGE, "JPEG 2000", \
- "Output image in JPEG 2000 format"},
+# define R_IMF_ENUM_JPEG2K \
+ {R_IMF_IMTYPE_JP2, \
+ "JPEG2000", \
+ ICON_FILE_IMAGE, \
+ "JPEG 2000", \
+ "Output image in JPEG 2000 format"},
#else
# define R_IMF_ENUM_JPEG2K
#endif
#ifdef WITH_CINEON
-# define R_IMF_ENUM_CINEON {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", \
- "Output image in Cineon format"},
-# define R_IMF_ENUM_DPX {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
+# define R_IMF_ENUM_CINEON \
+ {R_IMF_IMTYPE_CINEON, "CINEON", ICON_FILE_IMAGE, "Cineon", "Output image in Cineon format"},
+# define R_IMF_ENUM_DPX \
+ {R_IMF_IMTYPE_DPX, "DPX", ICON_FILE_IMAGE, "DPX", "Output image in DPX format"},
#else
# define R_IMF_ENUM_CINEON
# define R_IMF_ENUM_DPX
#endif
#ifdef WITH_OPENEXR
-# define R_IMF_ENUM_EXR_MULTILAYER {R_IMF_IMTYPE_MULTILAYER, "OPEN_EXR_MULTILAYER", ICON_FILE_IMAGE, \
- "OpenEXR MultiLayer", \
- "Output image in multilayer OpenEXR format"},
-# define R_IMF_ENUM_EXR {R_IMF_IMTYPE_OPENEXR, "OPEN_EXR", ICON_FILE_IMAGE, "OpenEXR", \
- "Output image in OpenEXR format"},
+# define R_IMF_ENUM_EXR_MULTILAYER \
+ {R_IMF_IMTYPE_MULTILAYER, \
+ "OPEN_EXR_MULTILAYER", \
+ ICON_FILE_IMAGE, \
+ "OpenEXR MultiLayer", \
+ "Output image in multilayer OpenEXR format"},
+# define R_IMF_ENUM_EXR \
+ {R_IMF_IMTYPE_OPENEXR, \
+ "OPEN_EXR", \
+ ICON_FILE_IMAGE, \
+ "OpenEXR", \
+ "Output image in OpenEXR format"},
#else
# define R_IMF_ENUM_EXR_MULTILAYER
# define R_IMF_ENUM_EXR
#endif
#ifdef WITH_HDR
-# define R_IMF_ENUM_HDR {R_IMF_IMTYPE_RADHDR, "HDR", ICON_FILE_IMAGE, "Radiance HDR", \
- "Output image in Radiance HDR format"},
+# define R_IMF_ENUM_HDR \
+ {R_IMF_IMTYPE_RADHDR, \
+ "HDR", \
+ ICON_FILE_IMAGE, \
+ "Radiance HDR", \
+ "Output image in Radiance HDR format"},
#else
# define R_IMF_ENUM_HDR
#endif
#ifdef WITH_TIFF
-# define R_IMF_ENUM_TIFF {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
+# define R_IMF_ENUM_TIFF \
+ {R_IMF_IMTYPE_TIFF, "TIFF", ICON_FILE_IMAGE, "TIFF", "Output image in TIFF format"},
#else
# define R_IMF_ENUM_TIFF
#endif
-#define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
- R_IMF_ENUM_BMP \
- /* DDS save not supported yet R_IMF_ENUM_DDS */ \
- R_IMF_ENUM_IRIS \
- R_IMF_ENUM_PNG \
- R_IMF_ENUM_JPEG \
- R_IMF_ENUM_JPEG2K \
- R_IMF_ENUM_TAGA \
- R_IMF_ENUM_TAGA_RAW \
- {0, "", 0, " ", NULL}, \
- R_IMF_ENUM_CINEON \
- R_IMF_ENUM_DPX \
- R_IMF_ENUM_EXR_MULTILAYER \
- R_IMF_ENUM_EXR \
- R_IMF_ENUM_HDR \
- R_IMF_ENUM_TIFF \
-
+#define IMAGE_TYPE_ITEMS_IMAGE_ONLY \
+ R_IMF_ENUM_BMP \
+ /* DDS save not supported yet R_IMF_ENUM_DDS */ \
+ R_IMF_ENUM_IRIS \
+ R_IMF_ENUM_PNG \
+ R_IMF_ENUM_JPEG \
+ R_IMF_ENUM_JPEG2K \
+ R_IMF_ENUM_TAGA \
+ R_IMF_ENUM_TAGA_RAW{0, "", 0, " ", NULL}, \
+ R_IMF_ENUM_CINEON R_IMF_ENUM_DPX R_IMF_ENUM_EXR_MULTILAYER R_IMF_ENUM_EXR R_IMF_ENUM_HDR \
+ R_IMF_ENUM_TIFF
#ifdef RNA_RUNTIME
static const EnumPropertyItem image_only_type_items[] = {
- IMAGE_TYPE_ITEMS_IMAGE_ONLY
+ IMAGE_TYPE_ITEMS_IMAGE_ONLY
- {0, NULL, 0, NULL, NULL},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_image_type_items[] = {
- {0, "", 0, N_("Image"), NULL},
+ {0, "", 0, N_("Image"), NULL},
- IMAGE_TYPE_ITEMS_IMAGE_ONLY
+ IMAGE_TYPE_ITEMS_IMAGE_ONLY
- {0, "", 0, N_("Movie"), NULL},
- {R_IMF_IMTYPE_AVIJPEG, "AVI_JPEG", ICON_FILE_MOVIE, "AVI JPEG", "Output video in AVI JPEG format"},
- {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
+ {0, "", 0, N_("Movie"), NULL},
+ {R_IMF_IMTYPE_AVIJPEG,
+ "AVI_JPEG",
+ ICON_FILE_MOVIE,
+ "AVI JPEG",
+ "Output video in AVI JPEG format"},
+ {R_IMF_IMTYPE_AVIRAW, "AVI_RAW", ICON_FILE_MOVIE, "AVI Raw", "Output video in AVI Raw format"},
#ifdef WITH_FFMPEG
- {R_IMF_IMTYPE_FFMPEG, "FFMPEG", ICON_FILE_MOVIE, "FFmpeg video", "The most versatile way to output video files"},
+ {R_IMF_IMTYPE_FFMPEG,
+ "FFMPEG",
+ ICON_FILE_MOVIE,
+ "FFmpeg video",
+ "The most versatile way to output video files"},
#endif
- {0, NULL, 0, NULL, NULL},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_image_color_mode_items[] = {
- {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
- {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
- {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
- {0, NULL, 0, NULL, NULL},
+ {R_IMF_PLANES_BW,
+ "BW",
+ 0,
+ "BW",
+ "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
+ {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
+ {R_IMF_PLANES_RGBA,
+ "RGBA",
+ 0,
+ "RGBA",
+ "Images are saved with RGB and Alpha data (if supported)"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#define IMAGE_COLOR_MODE_BW rna_enum_image_color_mode_items[0]
-#define IMAGE_COLOR_MODE_RGB rna_enum_image_color_mode_items[1]
-#define IMAGE_COLOR_MODE_RGBA rna_enum_image_color_mode_items[2]
+# define IMAGE_COLOR_MODE_BW rna_enum_image_color_mode_items[0]
+# define IMAGE_COLOR_MODE_RGB rna_enum_image_color_mode_items[1]
+# define IMAGE_COLOR_MODE_RGBA rna_enum_image_color_mode_items[2]
#endif
const EnumPropertyItem rna_enum_image_color_depth_items[] = {
- /* 1 (monochrome) not used */
- {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
- {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
- {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
- {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
- /* 24 not used */
- {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
- {0, NULL, 0, NULL, NULL},
+ /* 1 (monochrome) not used */
+ {R_IMF_CHAN_DEPTH_8, "8", 0, "8", "8 bit color channels"},
+ {R_IMF_CHAN_DEPTH_10, "10", 0, "10", "10 bit color channels"},
+ {R_IMF_CHAN_DEPTH_12, "12", 0, "12", "12 bit color channels"},
+ {R_IMF_CHAN_DEPTH_16, "16", 0, "16", "16 bit color channels"},
+ /* 24 not used */
+ {R_IMF_CHAN_DEPTH_32, "32", 0, "32", "32 bit color channels"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_normal_space_items[] = {
- {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"},
- {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"},
- {0, NULL, 0, NULL, NULL},
+ {R_BAKE_SPACE_OBJECT, "OBJECT", 0, "Object", "Bake the normals in object space"},
+ {R_BAKE_SPACE_TANGENT, "TANGENT", 0, "Tangent", "Bake the normals in tangent space"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_normal_swizzle_items[] = {
- {R_BAKE_POSX, "POS_X", 0, "+X", ""},
- {R_BAKE_POSY, "POS_Y", 0, "+Y", ""},
- {R_BAKE_POSZ, "POS_Z", 0, "+Z", ""},
- {R_BAKE_NEGX, "NEG_X", 0, "-X", ""},
- {R_BAKE_NEGY, "NEG_Y", 0, "-Y", ""},
- {R_BAKE_NEGZ, "NEG_Z", 0, "-Z", ""},
- {0, NULL, 0, NULL, NULL},
+ {R_BAKE_POSX, "POS_X", 0, "+X", ""},
+ {R_BAKE_POSY, "POS_Y", 0, "+Y", ""},
+ {R_BAKE_POSZ, "POS_Z", 0, "+Z", ""},
+ {R_BAKE_NEGX, "NEG_X", 0, "-X", ""},
+ {R_BAKE_NEGY, "NEG_Y", 0, "-Y", ""},
+ {R_BAKE_NEGZ, "NEG_Z", 0, "-Z", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_bake_save_mode_items[] = {
- {R_BAKE_SAVE_INTERNAL, "INTERNAL", 0, "Internal", "Save the baking map in an internal image data-block"},
- {R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"},
- {0, NULL, 0, NULL, NULL},
+ {R_BAKE_SAVE_INTERNAL,
+ "INTERNAL",
+ 0,
+ "Internal",
+ "Save the baking map in an internal image data-block"},
+ {R_BAKE_SAVE_EXTERNAL, "EXTERNAL", 0, "External", "Save the baking map in an external file"},
+ {0, NULL, 0, NULL, NULL},
};
-#define R_IMF_VIEWS_ENUM_IND {R_IMF_VIEWS_INDIVIDUAL, "INDIVIDUAL", 0, "Individual", \
- "Individual files for each view with the prefix as defined by the scene views"},
-#define R_IMF_VIEWS_ENUM_S3D {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", \
- "Single file with an encoded stereo pair"},
-#define R_IMF_VIEWS_ENUM_MV {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"},
+#define R_IMF_VIEWS_ENUM_IND \
+ {R_IMF_VIEWS_INDIVIDUAL, \
+ "INDIVIDUAL", \
+ 0, \
+ "Individual", \
+ "Individual files for each view with the prefix as defined by the scene views"},
+#define R_IMF_VIEWS_ENUM_S3D \
+ {R_IMF_VIEWS_STEREO_3D, "STEREO_3D", 0, "Stereo 3D", "Single file with an encoded stereo pair"},
+#define R_IMF_VIEWS_ENUM_MV \
+ {R_IMF_VIEWS_MULTIVIEW, "MULTIVIEW", 0, "Multi-View", "Single file with all the views"},
const EnumPropertyItem rna_enum_views_format_items[] = {
- R_IMF_VIEWS_ENUM_IND
- R_IMF_VIEWS_ENUM_S3D
- {0, NULL, 0, NULL, NULL},
+ R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D{0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_views_format_multilayer_items[] = {
- R_IMF_VIEWS_ENUM_IND
- R_IMF_VIEWS_ENUM_MV
- {0, NULL, 0, NULL, NULL},
+ R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_MV{0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_views_format_multiview_items[] = {
- R_IMF_VIEWS_ENUM_IND
- R_IMF_VIEWS_ENUM_S3D
- R_IMF_VIEWS_ENUM_MV
- {0, NULL, 0, NULL, NULL},
+ R_IMF_VIEWS_ENUM_IND R_IMF_VIEWS_ENUM_S3D R_IMF_VIEWS_ENUM_MV{0, NULL, 0, NULL, NULL},
};
#undef R_IMF_VIEWS_ENUM_IND
@@ -377,442 +447,525 @@ const EnumPropertyItem rna_enum_views_format_multiview_items[] = {
#undef R_IMF_VIEWS_ENUM_MV
const EnumPropertyItem rna_enum_stereo3d_display_items[] = {
- {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph",
- "Render views for left and right eyes as two differently filtered colors in a single image "
- "(anaglyph glasses are required)"},
- {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace",
- "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"},
- {S3D_DISPLAY_PAGEFLIP, "TIMESEQUENTIAL", 0, "Time Sequential",
- "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is required)"},
- {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"},
- {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"},
- {0, NULL, 0, NULL, NULL},
+ {S3D_DISPLAY_ANAGLYPH,
+ "ANAGLYPH",
+ 0,
+ "Anaglyph",
+ "Render views for left and right eyes as two differently filtered colors in a single image "
+ "(anaglyph glasses are required)"},
+ {S3D_DISPLAY_INTERLACE,
+ "INTERLACE",
+ 0,
+ "Interlace",
+ "Render views for left and right eyes interlaced in a single image (3D-ready monitor is "
+ "required)"},
+ {S3D_DISPLAY_PAGEFLIP,
+ "TIMESEQUENTIAL",
+ 0,
+ "Time Sequential",
+ "Render alternate eyes (also known as page flip, quad buffer support in the graphic card is "
+ "required)"},
+ {S3D_DISPLAY_SIDEBYSIDE,
+ "SIDEBYSIDE",
+ 0,
+ "Side-by-Side",
+ "Render views for left and right eyes side-by-side"},
+ {S3D_DISPLAY_TOPBOTTOM,
+ "TOPBOTTOM",
+ 0,
+ "Top-Bottom",
+ "Render views for left and right eyes one above another"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[] = {
- {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
- {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
- {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
- {0, NULL, 0, NULL, NULL},
+ {S3D_ANAGLYPH_REDCYAN, "RED_CYAN", 0, "Red-Cyan", ""},
+ {S3D_ANAGLYPH_GREENMAGENTA, "GREEN_MAGENTA", 0, "Green-Magenta", ""},
+ {S3D_ANAGLYPH_YELLOWBLUE, "YELLOW_BLUE", 0, "Yellow-Blue", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[] = {
- {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
- {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
- {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
- {0, NULL, 0, NULL, NULL},
+ {S3D_INTERLACE_ROW, "ROW_INTERLEAVED", 0, "Row Interleaved", ""},
+ {S3D_INTERLACE_COLUMN, "COLUMN_INTERLEAVED", 0, "Column Interleaved", ""},
+ {S3D_INTERLACE_CHECKERBOARD, "CHECKERBOARD_INTERLEAVED", 0, "Checkerboard Interleaved", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_bake_pass_filter_type_items[] = {
- {R_BAKE_PASS_FILTER_NONE, "NONE", 0, "None", ""},
- {R_BAKE_PASS_FILTER_AO, "AO", 0, "Ambient Occlusion", ""},
- {R_BAKE_PASS_FILTER_EMIT, "EMIT", 0, "Emit", ""},
- {R_BAKE_PASS_FILTER_DIRECT, "DIRECT", 0, "Direct", ""},
- {R_BAKE_PASS_FILTER_INDIRECT, "INDIRECT", 0, "Indirect", ""},
- {R_BAKE_PASS_FILTER_COLOR, "COLOR", 0, "Color", ""},
- {R_BAKE_PASS_FILTER_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
- {R_BAKE_PASS_FILTER_GLOSSY, "GLOSSY", 0, "Glossy", ""},
- {R_BAKE_PASS_FILTER_TRANSM, "TRANSMISSION", 0, "Transmission", ""},
- {R_BAKE_PASS_FILTER_SUBSURFACE, "SUBSURFACE", 0, "Subsurface", ""},
- {0, NULL, 0, NULL, NULL},
+ {R_BAKE_PASS_FILTER_NONE, "NONE", 0, "None", ""},
+ {R_BAKE_PASS_FILTER_AO, "AO", 0, "Ambient Occlusion", ""},
+ {R_BAKE_PASS_FILTER_EMIT, "EMIT", 0, "Emit", ""},
+ {R_BAKE_PASS_FILTER_DIRECT, "DIRECT", 0, "Direct", ""},
+ {R_BAKE_PASS_FILTER_INDIRECT, "INDIRECT", 0, "Indirect", ""},
+ {R_BAKE_PASS_FILTER_COLOR, "COLOR", 0, "Color", ""},
+ {R_BAKE_PASS_FILTER_DIFFUSE, "DIFFUSE", 0, "Diffuse", ""},
+ {R_BAKE_PASS_FILTER_GLOSSY, "GLOSSY", 0, "Glossy", ""},
+ {R_BAKE_PASS_FILTER_TRANSM, "TRANSMISSION", 0, "Transmission", ""},
+ {R_BAKE_PASS_FILTER_SUBSURFACE, "SUBSURFACE", 0, "Subsurface", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem rna_enum_gpencil_interpolation_mode_items[] = {
- /* interpolation */
- {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
- {GP_IPO_LINEAR, "LINEAR", ICON_IPO_LINEAR, "Linear", "Straight-line interpolation between A and B (i.e. no ease in/out)"},
- {GP_IPO_CURVEMAP, "CUSTOM", ICON_IPO_BEZIER, "Custom", "Custom interpolation defined using a curve map"},
-
- /* easing */
- {0, "", 0, N_("Easing (by strength)"), "Predefined inertial transitions, useful for motion graphics (from least to most ''dramatic'')"},
- {GP_IPO_SINE, "SINE", ICON_IPO_SINE, "Sinusoidal", "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
- {GP_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
- {GP_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
- {GP_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
- {GP_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
- {GP_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
- {GP_IPO_CIRC, "CIRC", ICON_IPO_CIRC, "Circular", "Circular easing (strongest and most dynamic)"},
-
- {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
- {GP_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
- {GP_IPO_BOUNCE, "BOUNCE", ICON_IPO_BOUNCE, "Bounce", "Exponentially decaying parabolic bounce, like when objects collide"},
- {GP_IPO_ELASTIC, "ELASTIC", ICON_IPO_ELASTIC, "Elastic", "Exponentially decaying sine wave, like an elastic band"},
-
- {0, NULL, 0, NULL, NULL},
+ /* interpolation */
+ {0, "", 0, N_("Interpolation"), "Standard transitions between keyframes"},
+ {GP_IPO_LINEAR,
+ "LINEAR",
+ ICON_IPO_LINEAR,
+ "Linear",
+ "Straight-line interpolation between A and B (i.e. no ease in/out)"},
+ {GP_IPO_CURVEMAP,
+ "CUSTOM",
+ ICON_IPO_BEZIER,
+ "Custom",
+ "Custom interpolation defined using a curve map"},
+
+ /* easing */
+ {0,
+ "",
+ 0,
+ N_("Easing (by strength)"),
+ "Predefined inertial transitions, useful for motion graphics (from least to most "
+ "''dramatic'')"},
+ {GP_IPO_SINE,
+ "SINE",
+ ICON_IPO_SINE,
+ "Sinusoidal",
+ "Sinusoidal easing (weakest, almost linear but with a slight curvature)"},
+ {GP_IPO_QUAD, "QUAD", ICON_IPO_QUAD, "Quadratic", "Quadratic easing"},
+ {GP_IPO_CUBIC, "CUBIC", ICON_IPO_CUBIC, "Cubic", "Cubic easing"},
+ {GP_IPO_QUART, "QUART", ICON_IPO_QUART, "Quartic", "Quartic easing"},
+ {GP_IPO_QUINT, "QUINT", ICON_IPO_QUINT, "Quintic", "Quintic easing"},
+ {GP_IPO_EXPO, "EXPO", ICON_IPO_EXPO, "Exponential", "Exponential easing (dramatic)"},
+ {GP_IPO_CIRC,
+ "CIRC",
+ ICON_IPO_CIRC,
+ "Circular",
+ "Circular easing (strongest and most dynamic)"},
+
+ {0, "", 0, N_("Dynamic Effects"), "Simple physics-inspired easing effects"},
+ {GP_IPO_BACK, "BACK", ICON_IPO_BACK, "Back", "Cubic easing with overshoot and settle"},
+ {GP_IPO_BOUNCE,
+ "BOUNCE",
+ ICON_IPO_BOUNCE,
+ "Bounce",
+ "Exponentially decaying parabolic bounce, like when objects collide"},
+ {GP_IPO_ELASTIC,
+ "ELASTIC",
+ ICON_IPO_ELASTIC,
+ "Elastic",
+ "Exponentially decaying sine wave, like an elastic band"},
+
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_transform_pivot_items_full[] = {
- {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center",
- "Pivot around bounding box center of selected object(s)"},
- {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
- {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
- "Individual Origins", "Pivot around each object's own origin"},
- {V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
- "Pivot around the median point of selected objects"},
- {V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", ICON_PIVOT_ACTIVE, "Active Element", "Pivot around active object"},
- {0, NULL, 0, NULL, NULL},
+ {V3D_AROUND_CENTER_BOUNDS,
+ "BOUNDING_BOX_CENTER",
+ ICON_PIVOT_BOUNDBOX,
+ "Bounding Box Center",
+ "Pivot around bounding box center of selected object(s)"},
+ {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Pivot around the 3D cursor"},
+ {V3D_AROUND_LOCAL_ORIGINS,
+ "INDIVIDUAL_ORIGINS",
+ ICON_PIVOT_INDIVIDUAL,
+ "Individual Origins",
+ "Pivot around each object's own origin"},
+ {V3D_AROUND_CENTER_MEDIAN,
+ "MEDIAN_POINT",
+ ICON_PIVOT_MEDIAN,
+ "Median Point",
+ "Pivot around the median point of selected objects"},
+ {V3D_AROUND_ACTIVE,
+ "ACTIVE_ELEMENT",
+ ICON_PIVOT_ACTIVE,
+ "Active Element",
+ "Pivot around active object"},
+ {0, NULL, 0, NULL, NULL},
};
/* Icons could be made a consistent set of images. */
const EnumPropertyItem rna_enum_transform_orientation_items[] = {
- {V3D_ORIENT_GLOBAL, "GLOBAL", ICON_ORIENTATION_GLOBAL, "Global", "Align the transformation axes to world space"},
- {V3D_ORIENT_LOCAL, "LOCAL", ICON_ORIENTATION_LOCAL, "Local", "Align the transformation axes to the selected objects' local space"},
- {V3D_ORIENT_NORMAL, "NORMAL", ICON_ORIENTATION_NORMAL, "Normal",
- "Align the transformation axes to average normal of selected elements "
- "(bone Y axis for pose mode)"},
- {V3D_ORIENT_GIMBAL, "GIMBAL", ICON_ORIENTATION_GIMBAL, "Gimbal", "Align each axis to the Euler rotation axis as used for input"},
- {V3D_ORIENT_VIEW, "VIEW", ICON_ORIENTATION_VIEW, "View", "Align the transformation axes to the window"},
- {V3D_ORIENT_CURSOR, "CURSOR", ICON_ORIENTATION_CURSOR, "Cursor", "Align the transformation axes to the 3D cursor"},
- // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
- {0, NULL, 0, NULL, NULL},
+ {V3D_ORIENT_GLOBAL,
+ "GLOBAL",
+ ICON_ORIENTATION_GLOBAL,
+ "Global",
+ "Align the transformation axes to world space"},
+ {V3D_ORIENT_LOCAL,
+ "LOCAL",
+ ICON_ORIENTATION_LOCAL,
+ "Local",
+ "Align the transformation axes to the selected objects' local space"},
+ {V3D_ORIENT_NORMAL,
+ "NORMAL",
+ ICON_ORIENTATION_NORMAL,
+ "Normal",
+ "Align the transformation axes to average normal of selected elements "
+ "(bone Y axis for pose mode)"},
+ {V3D_ORIENT_GIMBAL,
+ "GIMBAL",
+ ICON_ORIENTATION_GIMBAL,
+ "Gimbal",
+ "Align each axis to the Euler rotation axis as used for input"},
+ {V3D_ORIENT_VIEW,
+ "VIEW",
+ ICON_ORIENTATION_VIEW,
+ "View",
+ "Align the transformation axes to the window"},
+ {V3D_ORIENT_CURSOR,
+ "CURSOR",
+ ICON_ORIENTATION_CURSOR,
+ "Cursor",
+ "Align the transformation axes to the 3D cursor"},
+ // {V3D_ORIENT_CUSTOM, "CUSTOM", 0, "Custom", "Use a custom transform orientation"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BLI_string_utils.h"
-
-#include "DNA_anim_types.h"
-#include "DNA_color_types.h"
-#include "DNA_node_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-#include "DNA_text_types.h"
-#include "DNA_workspace_types.h"
-
-#include "RNA_access.h"
-
-#include "MEM_guardedalloc.h"
-
-#include "BKE_brush.h"
-#include "BKE_collection.h"
-#include "BKE_colortools.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
-#include "BKE_image.h"
-#include "BKE_layer.h"
-#include "BKE_main.h"
-#include "BKE_node.h"
-#include "BKE_pointcache.h"
-#include "BKE_scene.h"
-#include "BKE_mesh.h"
-#include "BKE_sound.h"
-#include "BKE_screen.h"
-#include "BKE_sequencer.h"
-#include "BKE_animsys.h"
-#include "BKE_freestyle.h"
-#include "BKE_gpencil.h"
-#include "BKE_unit.h"
-
-#include "ED_info.h"
-#include "ED_node.h"
-#include "ED_view3d.h"
-#include "ED_mesh.h"
-#include "ED_keyframing.h"
-#include "ED_image.h"
-#include "ED_scene.h"
-
-#include "DEG_depsgraph_build.h"
-#include "DEG_depsgraph_query.h"
-
-#ifdef WITH_FREESTYLE
-#include "FRS_freestyle.h"
-#endif
+# include "BLI_string_utils.h"
+
+# include "DNA_anim_types.h"
+# include "DNA_color_types.h"
+# include "DNA_node_types.h"
+# include "DNA_object_types.h"
+# include "DNA_mesh_types.h"
+# include "DNA_text_types.h"
+# include "DNA_workspace_types.h"
+
+# include "RNA_access.h"
+
+# include "MEM_guardedalloc.h"
+
+# include "BKE_brush.h"
+# include "BKE_collection.h"
+# include "BKE_colortools.h"
+# include "BKE_context.h"
+# include "BKE_global.h"
+# include "BKE_idprop.h"
+# include "BKE_image.h"
+# include "BKE_layer.h"
+# include "BKE_main.h"
+# include "BKE_node.h"
+# include "BKE_pointcache.h"
+# include "BKE_scene.h"
+# include "BKE_mesh.h"
+# include "BKE_sound.h"
+# include "BKE_screen.h"
+# include "BKE_sequencer.h"
+# include "BKE_animsys.h"
+# include "BKE_freestyle.h"
+# include "BKE_gpencil.h"
+# include "BKE_unit.h"
+
+# include "ED_info.h"
+# include "ED_node.h"
+# include "ED_view3d.h"
+# include "ED_mesh.h"
+# include "ED_keyframing.h"
+# include "ED_image.h"
+# include "ED_scene.h"
+
+# include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph_query.h"
+
+# ifdef WITH_FREESTYLE
+# include "FRS_freestyle.h"
+# endif
static void rna_ToolSettings_snap_mode_set(struct PointerRNA *ptr, int value)
{
- ToolSettings *ts = (ToolSettings *)ptr->data;
- if (value != 0) {
- ts->snap_mode = value;
- }
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ if (value != 0) {
+ ts->snap_mode = value;
+ }
}
/* Grease Pencil update cache */
static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- /* mark all grease pencil datablocks of the scene */
- FOREACH_SCENE_COLLECTION_BEGIN(scene, collection)
- {
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, ob)
- {
- if (ob->type == OB_GPENCIL) {
- bGPdata *gpd = (bGPdata *)ob->data;
- gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- }
- }
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- }
- FOREACH_SCENE_COLLECTION_END;
+ /* mark all grease pencil datablocks of the scene */
+ FOREACH_SCENE_COLLECTION_BEGIN (scene, collection) {
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) {
+ if (ob->type == OB_GPENCIL) {
+ bGPdata *gpd = (bGPdata *)ob->data;
+ gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ }
+ }
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ }
+ FOREACH_SCENE_COLLECTION_END;
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
/* Grease Pencil Interpolation settings */
static char *rna_GPencilInterpolateSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.gpencil_interpolate");
+ return BLI_strdup("tool_settings.gpencil_interpolate");
}
static void rna_GPencilInterpolateSettings_type_set(PointerRNA *ptr, int value)
{
- GP_Interpolate_Settings *settings = (GP_Interpolate_Settings *)ptr->data;
+ GP_Interpolate_Settings *settings = (GP_Interpolate_Settings *)ptr->data;
- /* NOTE: This cast should be fine, as we have a small + finite set of values (eGP_Interpolate_Type)
- * that should fit well within a char
- */
- settings->type = (char)value;
-
- /* init custom interpolation curve here now the first time it's used */
- if ((settings->type == GP_IPO_CURVEMAP) &&
- (settings->custom_ipo == NULL))
- {
- settings->custom_ipo = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
- }
+ /* NOTE: This cast should be fine, as we have a small + finite set of values (eGP_Interpolate_Type)
+ * that should fit well within a char
+ */
+ settings->type = (char)value;
+ /* init custom interpolation curve here now the first time it's used */
+ if ((settings->type == GP_IPO_CURVEMAP) && (settings->custom_ipo == NULL)) {
+ settings->custom_ipo = curvemapping_add(1, 0.0f, 0.0f, 1.0f, 1.0f);
+ }
}
-static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
+static void rna_SpaceImageEditor_uv_sculpt_update(Main *bmain,
+ Scene *scene,
+ PointerRNA *UNUSED(ptr))
{
- ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene);
+ ED_space_image_uv_sculpt_update(bmain, bmain->wm.first, scene);
}
/* Read-only Iterator of all the scene objects. */
static void rna_Scene_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
- iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
+ Scene *scene = (Scene *)ptr->data;
+ iter->internal.custom = MEM_callocN(sizeof(BLI_Iterator), __func__);
- ((BLI_Iterator *)iter->internal.custom)->valid = true;
- BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ ((BLI_Iterator *)iter->internal.custom)->valid = true;
+ BKE_scene_objects_iterator_begin(iter->internal.custom, (void *)scene);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static void rna_Scene_objects_next(CollectionPropertyIterator *iter)
{
- BKE_scene_objects_iterator_next(iter->internal.custom);
- iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
+ BKE_scene_objects_iterator_next(iter->internal.custom);
+ iter->valid = ((BLI_Iterator *)iter->internal.custom)->valid;
}
static void rna_Scene_objects_end(CollectionPropertyIterator *iter)
{
- BKE_scene_objects_iterator_end(iter->internal.custom);
- MEM_freeN(iter->internal.custom);
+ BKE_scene_objects_iterator_end(iter->internal.custom);
+ MEM_freeN(iter->internal.custom);
}
static PointerRNA rna_Scene_objects_get(CollectionPropertyIterator *iter)
{
- Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
+ Object *ob = ((BLI_Iterator *)iter->internal.custom)->current;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ob);
}
/* End of read-only Iterator of all the scene objects. */
static void rna_Scene_set_set(PointerRNA *ptr, PointerRNA value)
{
- Scene *scene = (Scene *)ptr->data;
- Scene *set = (Scene *)value.data;
- Scene *nested_set;
+ Scene *scene = (Scene *)ptr->data;
+ Scene *set = (Scene *)value.data;
+ Scene *nested_set;
- for (nested_set = set; nested_set; nested_set = nested_set->set) {
- if (nested_set == scene)
- return;
- /* prevent eternal loops, set can point to next, and next to set, without problems usually */
- if (nested_set->set == set)
- return;
- }
+ for (nested_set = set; nested_set; nested_set = nested_set->set) {
+ if (nested_set == scene)
+ return;
+ /* prevent eternal loops, set can point to next, and next to set, without problems usually */
+ if (nested_set->set == set)
+ return;
+ }
- id_lib_extern((ID *)set);
- scene->set = set;
+ id_lib_extern((ID *)set);
+ scene->set = set;
}
void rna_Scene_set_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
+ Scene *scene = (Scene *)ptr->id.data;
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update_ex(bmain, &scene->id, 0);
- if (scene->set != NULL) {
- /* Objects which are pulled into main scene's depsgraph needs to have
- * their base flags updated.
- */
- DEG_id_tag_update_ex(bmain, &scene->set->id, 0);
- }
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, &scene->id, 0);
+ if (scene->set != NULL) {
+ /* Objects which are pulled into main scene's depsgraph needs to have
+ * their base flags updated.
+ */
+ DEG_id_tag_update_ex(bmain, &scene->set->id, 0);
+ }
}
static void rna_Scene_camera_update(Main *bmain, Scene *UNUSED(scene_unused), PointerRNA *ptr)
{
- wmWindowManager *wm = bmain->wm.first;
- Scene *scene = (Scene *)ptr->data;
+ wmWindowManager *wm = bmain->wm.first;
+ Scene *scene = (Scene *)ptr->data;
- WM_windows_scene_data_sync(&wm->windows, scene);
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+ WM_windows_scene_data_sync(&wm->windows, scene);
+ DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
}
static void rna_Scene_fps_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- BKE_sound_update_fps(scene);
- BKE_sequencer_update_sound_bounds_all(scene);
+ BKE_sound_update_fps(scene);
+ BKE_sequencer_update_sound_bounds_all(scene);
}
static void rna_Scene_listener_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- BKE_sound_update_scene_listener(scene);
+ BKE_sound_update_scene_listener(scene);
}
static void rna_Scene_volume_set(PointerRNA *ptr, float value)
{
- Scene *scene = (Scene *)(ptr->data);
+ Scene *scene = (Scene *)(ptr->data);
- scene->audio.volume = value;
- if (scene->sound_scene)
- BKE_sound_set_scene_volume(scene, value);
+ scene->audio.volume = value;
+ if (scene->sound_scene)
+ BKE_sound_set_scene_volume(scene, value);
}
-static const char *rna_Scene_statistics_string_get(Scene *scene, Main *bmain, ViewLayer *view_layer)
+static const char *rna_Scene_statistics_string_get(Scene *scene,
+ Main *bmain,
+ ViewLayer *view_layer)
{
- return ED_info_stats_string(bmain, scene, view_layer);
+ return ED_info_stats_string(bmain, scene, view_layer);
}
static void rna_Scene_framelen_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
+ scene->r.framelen = (float)scene->r.framapto / (float)scene->r.images;
}
-
static void rna_Scene_frame_current_set(PointerRNA *ptr, int value)
{
- Scene *data = (Scene *)ptr->data;
+ Scene *data = (Scene *)ptr->data;
- /* if negative frames aren't allowed, then we can't use them */
- FRAMENUMBER_MIN_CLAMP(value);
- data->r.cfra = value;
+ /* if negative frames aren't allowed, then we can't use them */
+ FRAMENUMBER_MIN_CLAMP(value);
+ data->r.cfra = value;
}
static float rna_Scene_frame_float_get(PointerRNA *ptr)
{
- Scene *data = (Scene *)ptr->data;
- return (float)data->r.cfra + data->r.subframe;
+ Scene *data = (Scene *)ptr->data;
+ return (float)data->r.cfra + data->r.subframe;
}
static void rna_Scene_frame_float_set(PointerRNA *ptr, float value)
{
- Scene *data = (Scene *)ptr->data;
- /* if negative frames aren't allowed, then we can't use them */
- FRAMENUMBER_MIN_CLAMP(value);
- data->r.cfra = (int)value;
- data->r.subframe = value - data->r.cfra;
+ Scene *data = (Scene *)ptr->data;
+ /* if negative frames aren't allowed, then we can't use them */
+ FRAMENUMBER_MIN_CLAMP(value);
+ data->r.cfra = (int)value;
+ data->r.subframe = value - data->r.cfra;
}
static float rna_Scene_frame_current_final_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
+ Scene *scene = (Scene *)ptr->data;
- return BKE_scene_frame_get_from_ctime(scene, (float)scene->r.cfra);
+ return BKE_scene_frame_get_from_ctime(scene, (float)scene->r.cfra);
}
static void rna_Scene_start_frame_set(PointerRNA *ptr, int value)
{
- Scene *data = (Scene *)ptr->data;
- /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
- CLAMP(value, MINFRAME, MAXFRAME);
- data->r.sfra = value;
+ Scene *data = (Scene *)ptr->data;
+ /* MINFRAME not MINAFRAME, since some output formats can't taken negative frames */
+ CLAMP(value, MINFRAME, MAXFRAME);
+ data->r.sfra = value;
- if (data->r.sfra >= data->r.efra) {
- data->r.efra = MIN2(data->r.sfra, MAXFRAME);
- }
+ if (data->r.sfra >= data->r.efra) {
+ data->r.efra = MIN2(data->r.sfra, MAXFRAME);
+ }
}
static void rna_Scene_end_frame_set(PointerRNA *ptr, int value)
{
- Scene *data = (Scene *)ptr->data;
- CLAMP(value, MINFRAME, MAXFRAME);
- data->r.efra = value;
+ Scene *data = (Scene *)ptr->data;
+ CLAMP(value, MINFRAME, MAXFRAME);
+ data->r.efra = value;
- if (data->r.sfra >= data->r.efra) {
- data->r.sfra = MAX2(data->r.efra, MINFRAME);
- }
+ if (data->r.sfra >= data->r.efra) {
+ data->r.sfra = MAX2(data->r.efra, MINFRAME);
+ }
}
static void rna_Scene_use_preview_range_set(PointerRNA *ptr, bool value)
{
- Scene *data = (Scene *)ptr->data;
+ Scene *data = (Scene *)ptr->data;
- if (value) {
- /* copy range from scene if not set before */
- if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
- data->r.psfra = data->r.sfra;
- data->r.pefra = data->r.efra;
- }
+ if (value) {
+ /* copy range from scene if not set before */
+ if ((data->r.psfra == data->r.pefra) && (data->r.psfra == 0)) {
+ data->r.psfra = data->r.sfra;
+ data->r.pefra = data->r.efra;
+ }
- data->r.flag |= SCER_PRV_RANGE;
- }
- else
- data->r.flag &= ~SCER_PRV_RANGE;
+ data->r.flag |= SCER_PRV_RANGE;
+ }
+ else
+ data->r.flag &= ~SCER_PRV_RANGE;
}
-
static void rna_Scene_preview_range_start_frame_set(PointerRNA *ptr, int value)
{
- Scene *data = (Scene *)ptr->data;
+ Scene *data = (Scene *)ptr->data;
- /* check if enabled already */
- if ((data->r.flag & SCER_PRV_RANGE) == 0) {
- /* set end of preview range to end frame, then clamp as per normal */
- /* TODO: or just refuse to set instead? */
- data->r.pefra = data->r.efra;
- }
+ /* check if enabled already */
+ if ((data->r.flag & SCER_PRV_RANGE) == 0) {
+ /* set end of preview range to end frame, then clamp as per normal */
+ /* TODO: or just refuse to set instead? */
+ data->r.pefra = data->r.efra;
+ }
- /* now set normally */
- CLAMP(value, MINAFRAME, data->r.pefra);
- data->r.psfra = value;
+ /* now set normally */
+ CLAMP(value, MINAFRAME, data->r.pefra);
+ data->r.psfra = value;
}
static void rna_Scene_preview_range_end_frame_set(PointerRNA *ptr, int value)
{
- Scene *data = (Scene *)ptr->data;
+ Scene *data = (Scene *)ptr->data;
- /* check if enabled already */
- if ((data->r.flag & SCER_PRV_RANGE) == 0) {
- /* set start of preview range to start frame, then clamp as per normal */
- /* TODO: or just refuse to set instead? */
- data->r.psfra = data->r.sfra;
- }
+ /* check if enabled already */
+ if ((data->r.flag & SCER_PRV_RANGE) == 0) {
+ /* set start of preview range to start frame, then clamp as per normal */
+ /* TODO: or just refuse to set instead? */
+ data->r.psfra = data->r.sfra;
+ }
- /* now set normally */
- CLAMP(value, data->r.psfra, MAXFRAME);
- data->r.pefra = value;
+ /* now set normally */
+ CLAMP(value, data->r.psfra, MAXFRAME);
+ data->r.pefra = value;
}
-static void rna_Scene_show_subframe_update(Main *UNUSED(bmain), Scene *UNUSED(current_scene), PointerRNA *ptr)
+static void rna_Scene_show_subframe_update(Main *UNUSED(bmain),
+ Scene *UNUSED(current_scene),
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- scene->r.subframe = 0.0f;
+ Scene *scene = (Scene *)ptr->id.data;
+ scene->r.subframe = 0.0f;
}
static void rna_Scene_frame_update(Main *bmain, Scene *UNUSED(current_scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- BKE_sound_seek_scene(bmain, scene);
- WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
+ Scene *scene = (Scene *)ptr->id.data;
+ BKE_sound_seek_scene(bmain, scene);
+ WM_main_add_notifier(NC_SCENE | ND_FRAME, scene);
}
static PointerRNA rna_Scene_active_keying_set_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
+ Scene *scene = (Scene *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_KeyingSet, ANIM_scene_get_active_keyingset(scene));
}
static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
{
- Scene *scene = (Scene *)ptr->data;
- KeyingSet *ks = (KeyingSet *)value.data;
+ Scene *scene = (Scene *)ptr->data;
+ KeyingSet *ks = (KeyingSet *)value.data;
- scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
+ scene->active_keyingset = ANIM_scene_get_keyingset_index(scene, ks);
}
/* get KeyingSet index stuff for list of Keying Sets editing UI
@@ -821,8 +974,8 @@ static void rna_Scene_active_keying_set_set(PointerRNA *ptr, PointerRNA value)
*/
static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
- return scene->active_keyingset - 1;
+ Scene *scene = (Scene *)ptr->data;
+ return scene->active_keyingset - 1;
}
/* get KeyingSet index stuff for list of Keying Sets editing UI
@@ -830,8 +983,8 @@ static int rna_Scene_active_keying_set_index_get(PointerRNA *ptr)
*/
static void rna_Scene_active_keying_set_index_set(PointerRNA *ptr, int value)
{
- Scene *scene = (Scene *)ptr->data;
- scene->active_keyingset = value + 1;
+ Scene *scene = (Scene *)ptr->data;
+ scene->active_keyingset = value + 1;
}
/* XXX: evil... builtin_keyingsets is defined in keyingsets.c! */
@@ -840,935 +993,975 @@ extern ListBase builtin_keyingsets;
static void rna_Scene_all_keyingsets_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
+ Scene *scene = (Scene *)ptr->data;
- /* start going over the scene KeyingSets first, while we still have pointer to it
- * but only if we have any Keying Sets to use...
- */
- if (scene->keyingsets.first)
- rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
- else
- rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
+ /* start going over the scene KeyingSets first, while we still have pointer to it
+ * but only if we have any Keying Sets to use...
+ */
+ if (scene->keyingsets.first)
+ rna_iterator_listbase_begin(iter, &scene->keyingsets, NULL);
+ else
+ rna_iterator_listbase_begin(iter, &builtin_keyingsets, NULL);
}
static void rna_Scene_all_keyingsets_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- KeyingSet *ks = (KeyingSet *)internal->link;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ KeyingSet *ks = (KeyingSet *)internal->link;
- /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
- if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
- internal->link = (Link *)builtin_keyingsets.first;
- else
- internal->link = (Link *)ks->next;
+ /* if we've run out of links in Scene list, jump over to the builtins list unless we're there already */
+ if ((ks->next == NULL) && (ks != builtin_keyingsets.last))
+ internal->link = (Link *)builtin_keyingsets.first;
+ else
+ internal->link = (Link *)ks->next;
- iter->valid = (internal->link != NULL);
+ iter->valid = (internal->link != NULL);
}
static char *rna_SceneEEVEE_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("eevee");
+ return BLI_strdup("eevee");
}
-static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter, void *UNUSED(data))
+static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter,
+ void *UNUSED(data))
{
- ListBaseIterator *internal = &iter->internal.listbase;
- SceneRenderView *srv = (SceneRenderView *)internal->link;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ SceneRenderView *srv = (SceneRenderView *)internal->link;
- if ((STREQ(srv->name, STEREO_LEFT_NAME)) ||
- (STREQ(srv->name, STEREO_RIGHT_NAME)))
- {
- return 0;
- }
+ if ((STREQ(srv->name, STEREO_LEFT_NAME)) || (STREQ(srv->name, STEREO_RIGHT_NAME))) {
+ return 0;
+ }
- return 1;
+ return 1;
};
static void rna_RenderSettings_stereoViews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip);
+ RenderData *rd = (RenderData *)ptr->data;
+ rna_iterator_listbase_begin(iter, &rd->views, rna_RenderSettings_stereoViews_skip);
}
static char *rna_RenderSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("render");
+ return BLI_strdup("render");
}
static char *rna_BakeSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("render.bake");
+ return BLI_strdup("render.bake");
}
static char *rna_ImageFormatSettings_path(PointerRNA *ptr)
{
- ImageFormatData *imf = (ImageFormatData *)ptr->data;
- ID *id = ptr->id.data;
-
- switch (GS(id->name)) {
- case ID_SCE:
- {
- Scene *scene = (Scene *)id;
-
- if (&scene->r.im_format == imf) {
- return BLI_strdup("render.image_settings");
- }
- else if (&scene->r.bake.im_format == imf) {
- return BLI_strdup("render.bake.image_settings");
- }
- return BLI_strdup("..");
- }
- case ID_NT:
- {
- bNodeTree *ntree = (bNodeTree *)id;
- bNode *node;
-
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->type == CMP_NODE_OUTPUT_FILE) {
- if (&((NodeImageMultiFile *)node->storage)->format == imf) {
- return BLI_sprintfN("nodes['%s'].format", node->name);
- }
- else {
- bNodeSocket *sock;
-
- for (sock = node->inputs.first; sock; sock = sock->next) {
- NodeImageMultiFileSocket *sockdata = sock->storage;
- if (&sockdata->format == imf) {
- return BLI_sprintfN("nodes['%s'].file_slots['%s'].format", node->name, sockdata->path);
- }
- }
- }
- }
- }
- return BLI_strdup("..");
- }
- default:
- return BLI_strdup("..");
- }
+ ImageFormatData *imf = (ImageFormatData *)ptr->data;
+ ID *id = ptr->id.data;
+
+ switch (GS(id->name)) {
+ case ID_SCE: {
+ Scene *scene = (Scene *)id;
+
+ if (&scene->r.im_format == imf) {
+ return BLI_strdup("render.image_settings");
+ }
+ else if (&scene->r.bake.im_format == imf) {
+ return BLI_strdup("render.bake.image_settings");
+ }
+ return BLI_strdup("..");
+ }
+ case ID_NT: {
+ bNodeTree *ntree = (bNodeTree *)id;
+ bNode *node;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == CMP_NODE_OUTPUT_FILE) {
+ if (&((NodeImageMultiFile *)node->storage)->format == imf) {
+ return BLI_sprintfN("nodes['%s'].format", node->name);
+ }
+ else {
+ bNodeSocket *sock;
+
+ for (sock = node->inputs.first; sock; sock = sock->next) {
+ NodeImageMultiFileSocket *sockdata = sock->storage;
+ if (&sockdata->format == imf) {
+ return BLI_sprintfN(
+ "nodes['%s'].file_slots['%s'].format", node->name, sockdata->path);
+ }
+ }
+ }
+ }
+ }
+ return BLI_strdup("..");
+ }
+ default:
+ return BLI_strdup("..");
+ }
}
static int rna_RenderSettings_threads_get(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- return BKE_render_num_threads(rd);
+ RenderData *rd = (RenderData *)ptr->data;
+ return BKE_render_num_threads(rd);
}
static int rna_RenderSettings_threads_mode_get(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- int override = BLI_system_num_threads_override_get();
+ RenderData *rd = (RenderData *)ptr->data;
+ int override = BLI_system_num_threads_override_get();
- if (override > 0)
- return R_FIXED_THREADS;
- else
- return (rd->mode & R_FIXED_THREADS);
+ if (override > 0)
+ return R_FIXED_THREADS;
+ else
+ return (rd->mode & R_FIXED_THREADS);
}
static bool rna_RenderSettings_is_movie_format_get(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- return BKE_imtype_is_movie(rd->im_format.imtype);
+ RenderData *rd = (RenderData *)ptr->data;
+ return BKE_imtype_is_movie(rd->im_format.imtype);
}
static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
{
- ImageFormatData *imf = (ImageFormatData *)ptr->data;
- ID *id = ptr->id.data;
- const bool is_render = (id && GS(id->name) == ID_SCE);
- /* see note below on why this is */
- const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0);
-
- imf->imtype = value;
-
- /* ensure depth and color settings match */
- if ( ((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
- ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA)))
- {
- imf->planes = R_IMF_PLANES_RGB;
- }
-
- /* ensure usable depth */
- {
- const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
- if ((imf->depth & depth_ok) == 0) {
- /* set first available depth */
- char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
- R_IMF_CHAN_DEPTH_24,
- R_IMF_CHAN_DEPTH_16,
- R_IMF_CHAN_DEPTH_12,
- R_IMF_CHAN_DEPTH_10,
- R_IMF_CHAN_DEPTH_8,
- R_IMF_CHAN_DEPTH_1,
- 0};
- int i;
-
- for (i = 0; depth_ls[i]; i++) {
- if (depth_ok & depth_ls[i]) {
- imf->depth = depth_ls[i];
- break;
- }
- }
- }
- }
-
- if (id && GS(id->name) == ID_SCE) {
- Scene *scene = ptr->id.data;
- RenderData *rd = &scene->r;
-#ifdef WITH_FFMPEG
- BKE_ffmpeg_image_type_verify(rd, imf);
-#endif
- (void)rd;
- }
-}
-
-static const EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
-{
- ID *id = ptr->id.data;
- if (id && GS(id->name) == ID_SCE) {
- return rna_enum_image_type_items;
- }
- else {
- return image_only_type_items;
- }
-}
-
-static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
-{
- ImageFormatData *imf = (ImageFormatData *)ptr->data;
- ID *id = ptr->id.data;
- const bool is_render = (id && GS(id->name) == ID_SCE);
-
- /* note, we need to act differently for render
- * where 'BW' will force grayscale even if the output format writes
- * as RGBA, this is age old blender convention and not sure how useful
- * it really is but keep it for now - campbell */
- char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) | (is_render ? IMA_CHAN_FLAG_BW : 0);
-
-#ifdef WITH_FFMPEG
- /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
- * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
- * the same MPEG format with QTRLE codec can easily handle alpha channel.
- * not sure how to deal with such cases in a nicer way (sergey) */
- if (is_render) {
- Scene *scene = ptr->id.data;
- RenderData *rd = &scene->r;
-
- if (BKE_ffmpeg_alpha_channel_is_supported(rd))
- chan_flag |= IMA_CHAN_FLAG_ALPHA;
- }
-#endif
-
- if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
- return rna_enum_image_color_mode_items;
- }
- else {
- int totitem = 0;
- EnumPropertyItem *item = NULL;
-
- if (chan_flag & IMA_CHAN_FLAG_BW) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
- if (chan_flag & IMA_CHAN_FLAG_RGB) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
- if (chan_flag & IMA_CHAN_FLAG_ALPHA) RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
- }
-}
-
-static const EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
-{
- ImageFormatData *imf = (ImageFormatData *)ptr->data;
-
- if (imf == NULL) {
- return rna_enum_image_color_depth_items;
- }
- else {
- const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
- const int is_float = ELEM(imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
-
- const EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0];
- const EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1];
- const EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2];
- const EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3];
- const EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4];
-
- int totitem = 0;
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
-
- if (depth_ok & R_IMF_CHAN_DEPTH_8) {
- RNA_enum_item_add(&item, &totitem, item_8bit);
- }
-
- if (depth_ok & R_IMF_CHAN_DEPTH_10) {
- RNA_enum_item_add(&item, &totitem, item_10bit);
- }
-
- if (depth_ok & R_IMF_CHAN_DEPTH_12) {
- RNA_enum_item_add(&item, &totitem, item_12bit);
- }
-
- if (depth_ok & R_IMF_CHAN_DEPTH_16) {
- if (is_float) {
- tmp = *item_16bit;
- tmp.name = "Float (Half)";
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- else {
- RNA_enum_item_add(&item, &totitem, item_16bit);
- }
- }
-
- if (depth_ok & R_IMF_CHAN_DEPTH_32) {
- if (is_float) {
- tmp = *item_32bit;
- tmp.name = "Float (Full)";
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- else {
- RNA_enum_item_add(&item, &totitem, item_32bit);
- }
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
- }
+ ImageFormatData *imf = (ImageFormatData *)ptr->data;
+ ID *id = ptr->id.data;
+ const bool is_render = (id && GS(id->name) == ID_SCE);
+ /* see note below on why this is */
+ const char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) |
+ (is_render ? IMA_CHAN_FLAG_BW : 0);
+
+ imf->imtype = value;
+
+ /* ensure depth and color settings match */
+ if (((imf->planes == R_IMF_PLANES_BW) && !(chan_flag & IMA_CHAN_FLAG_BW)) ||
+ ((imf->planes == R_IMF_PLANES_RGBA) && !(chan_flag & IMA_CHAN_FLAG_ALPHA))) {
+ imf->planes = R_IMF_PLANES_RGB;
+ }
+
+ /* ensure usable depth */
+ {
+ const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
+ if ((imf->depth & depth_ok) == 0) {
+ /* set first available depth */
+ char depth_ls[] = {R_IMF_CHAN_DEPTH_32,
+ R_IMF_CHAN_DEPTH_24,
+ R_IMF_CHAN_DEPTH_16,
+ R_IMF_CHAN_DEPTH_12,
+ R_IMF_CHAN_DEPTH_10,
+ R_IMF_CHAN_DEPTH_8,
+ R_IMF_CHAN_DEPTH_1,
+ 0};
+ int i;
+
+ for (i = 0; depth_ls[i]; i++) {
+ if (depth_ok & depth_ls[i]) {
+ imf->depth = depth_ls[i];
+ break;
+ }
+ }
+ }
+ }
+
+ if (id && GS(id->name) == ID_SCE) {
+ Scene *scene = ptr->id.data;
+ RenderData *rd = &scene->r;
+# ifdef WITH_FFMPEG
+ BKE_ffmpeg_image_type_verify(rd, imf);
+# endif
+ (void)rd;
+ }
+}
+
+static const EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ ID *id = ptr->id.data;
+ if (id && GS(id->name) == ID_SCE) {
+ return rna_enum_image_type_items;
+ }
+ else {
+ return image_only_type_items;
+ }
+}
+
+static const EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ ImageFormatData *imf = (ImageFormatData *)ptr->data;
+ ID *id = ptr->id.data;
+ const bool is_render = (id && GS(id->name) == ID_SCE);
+
+ /* note, we need to act differently for render
+ * where 'BW' will force grayscale even if the output format writes
+ * as RGBA, this is age old blender convention and not sure how useful
+ * it really is but keep it for now - campbell */
+ char chan_flag = BKE_imtype_valid_channels(imf->imtype, true) |
+ (is_render ? IMA_CHAN_FLAG_BW : 0);
+
+# ifdef WITH_FFMPEG
+ /* a WAY more crappy case than B&W flag: depending on codec, file format MIGHT support
+ * alpha channel. for example MPEG format with h264 codec can't do alpha channel, but
+ * the same MPEG format with QTRLE codec can easily handle alpha channel.
+ * not sure how to deal with such cases in a nicer way (sergey) */
+ if (is_render) {
+ Scene *scene = ptr->id.data;
+ RenderData *rd = &scene->r;
+
+ if (BKE_ffmpeg_alpha_channel_is_supported(rd))
+ chan_flag |= IMA_CHAN_FLAG_ALPHA;
+ }
+# endif
+
+ if (chan_flag == (IMA_CHAN_FLAG_BW | IMA_CHAN_FLAG_RGB | IMA_CHAN_FLAG_ALPHA)) {
+ return rna_enum_image_color_mode_items;
+ }
+ else {
+ int totitem = 0;
+ EnumPropertyItem *item = NULL;
+
+ if (chan_flag & IMA_CHAN_FLAG_BW)
+ RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_BW);
+ if (chan_flag & IMA_CHAN_FLAG_RGB)
+ RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGB);
+ if (chan_flag & IMA_CHAN_FLAG_ALPHA)
+ RNA_enum_item_add(&item, &totitem, &IMAGE_COLOR_MODE_RGBA);
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+ }
+}
+
+static const EnumPropertyItem *rna_ImageFormatSettings_color_depth_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ ImageFormatData *imf = (ImageFormatData *)ptr->data;
+
+ if (imf == NULL) {
+ return rna_enum_image_color_depth_items;
+ }
+ else {
+ const int depth_ok = BKE_imtype_valid_depths(imf->imtype);
+ const int is_float = ELEM(
+ imf->imtype, R_IMF_IMTYPE_RADHDR, R_IMF_IMTYPE_OPENEXR, R_IMF_IMTYPE_MULTILAYER);
+
+ const EnumPropertyItem *item_8bit = &rna_enum_image_color_depth_items[0];
+ const EnumPropertyItem *item_10bit = &rna_enum_image_color_depth_items[1];
+ const EnumPropertyItem *item_12bit = &rna_enum_image_color_depth_items[2];
+ const EnumPropertyItem *item_16bit = &rna_enum_image_color_depth_items[3];
+ const EnumPropertyItem *item_32bit = &rna_enum_image_color_depth_items[4];
+
+ int totitem = 0;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_8) {
+ RNA_enum_item_add(&item, &totitem, item_8bit);
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_10) {
+ RNA_enum_item_add(&item, &totitem, item_10bit);
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_12) {
+ RNA_enum_item_add(&item, &totitem, item_12bit);
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_16) {
+ if (is_float) {
+ tmp = *item_16bit;
+ tmp.name = "Float (Half)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else {
+ RNA_enum_item_add(&item, &totitem, item_16bit);
+ }
+ }
+
+ if (depth_ok & R_IMF_CHAN_DEPTH_32) {
+ if (is_float) {
+ tmp = *item_32bit;
+ tmp.name = "Float (Full)";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ else {
+ RNA_enum_item_add(&item, &totitem, item_32bit);
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
+ }
}
static const EnumPropertyItem *rna_ImageFormatSettings_views_format_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+ bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
{
- ImageFormatData *imf = (ImageFormatData *)ptr->data;
+ ImageFormatData *imf = (ImageFormatData *)ptr->data;
- if (imf == NULL) {
- return rna_enum_views_format_items;
- }
- else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) {
- return rna_enum_views_format_multiview_items;
- }
- else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) {
- return rna_enum_views_format_multilayer_items;
- }
- else {
- return rna_enum_views_format_items;
- }
+ if (imf == NULL) {
+ return rna_enum_views_format_items;
+ }
+ else if (imf->imtype == R_IMF_IMTYPE_OPENEXR) {
+ return rna_enum_views_format_multiview_items;
+ }
+ else if (imf->imtype == R_IMF_IMTYPE_MULTILAYER) {
+ return rna_enum_views_format_multilayer_items;
+ }
+ else {
+ return rna_enum_views_format_items;
+ }
}
-#ifdef WITH_OPENEXR
- /* OpenEXR */
+# ifdef WITH_OPENEXR
+/* OpenEXR */
-static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- ImageFormatData *imf = (ImageFormatData *)ptr->data;
+ ImageFormatData *imf = (ImageFormatData *)ptr->data;
- EnumPropertyItem *item = NULL;
- int i = 1, totitem = 0;
+ EnumPropertyItem *item = NULL;
+ int i = 1, totitem = 0;
- if (imf->depth == 16)
- return rna_enum_exr_codec_items; /* All compression types are defined for halfs */
+ if (imf->depth == 16)
+ return rna_enum_exr_codec_items; /* All compression types are defined for halfs */
- for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) {
- if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) {
- continue; /* B44 and B44A are not defined for 32 bit floats */
- }
+ for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) {
+ if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) {
+ continue; /* B44 and B44A are not defined for 32 bit floats */
+ }
- RNA_enum_item_add(&item, &totitem, &rna_enum_exr_codec_items[i]);
- }
+ RNA_enum_item_add(&item, &totitem, &rna_enum_exr_codec_items[i]);
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
-#endif
+# endif
static int rna_SceneRender_file_ext_length(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- char ext[8];
- ext[0] = '\0';
- BKE_image_path_ensure_ext_from_imformat(ext, &rd->im_format);
- return strlen(ext);
+ RenderData *rd = (RenderData *)ptr->data;
+ char ext[8];
+ ext[0] = '\0';
+ BKE_image_path_ensure_ext_from_imformat(ext, &rd->im_format);
+ return strlen(ext);
}
static void rna_SceneRender_file_ext_get(PointerRNA *ptr, char *str)
{
- RenderData *rd = (RenderData *)ptr->data;
- str[0] = '\0';
- BKE_image_path_ensure_ext_from_imformat(str, &rd->im_format);
+ RenderData *rd = (RenderData *)ptr->data;
+ str[0] = '\0';
+ BKE_image_path_ensure_ext_from_imformat(str, &rd->im_format);
}
-#ifdef WITH_FFMPEG
+# ifdef WITH_FFMPEG
static void rna_FFmpegSettings_lossless_output_set(PointerRNA *ptr, bool value)
{
- Scene *scene = (Scene *) ptr->id.data;
- RenderData *rd = &scene->r;
+ Scene *scene = (Scene *)ptr->id.data;
+ RenderData *rd = &scene->r;
- if (value)
- rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
- else
- rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
+ if (value)
+ rd->ffcodecdata.flags |= FFMPEG_LOSSLESS_OUTPUT;
+ else
+ rd->ffcodecdata.flags &= ~FFMPEG_LOSSLESS_OUTPUT;
- BKE_ffmpeg_codec_settings_verify(rd);
+ BKE_ffmpeg_codec_settings_verify(rd);
}
-static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain), Scene *UNUSED(scene_unused), PointerRNA *ptr)
+static void rna_FFmpegSettings_codec_settings_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene_unused),
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- RenderData *rd = &scene->r;
+ Scene *scene = (Scene *)ptr->id.data;
+ RenderData *rd = &scene->r;
- BKE_ffmpeg_codec_settings_verify(rd);
+ BKE_ffmpeg_codec_settings_verify(rd);
}
-#endif
+# endif
static int rna_RenderSettings_active_view_index_get(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- return rd->actview;
+ RenderData *rd = (RenderData *)ptr->data;
+ return rd->actview;
}
static void rna_RenderSettings_active_view_index_set(PointerRNA *ptr, int value)
{
- RenderData *rd = (RenderData *)ptr->data;
- rd->actview = value;
+ RenderData *rd = (RenderData *)ptr->data;
+ rd->actview = value;
}
static void rna_RenderSettings_active_view_index_range(
- PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- RenderData *rd = (RenderData *)ptr->data;
+ RenderData *rd = (RenderData *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&rd->views) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&rd->views) - 1);
}
static PointerRNA rna_RenderSettings_active_view_get(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview);
+ RenderData *rd = (RenderData *)ptr->data;
+ SceneRenderView *srv = BLI_findlink(&rd->views, rd->actview);
- return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv);
+ return rna_pointer_inherit_refine(ptr, &RNA_SceneRenderView, srv);
}
static void rna_RenderSettings_active_view_set(PointerRNA *ptr, PointerRNA value)
{
- RenderData *rd = (RenderData *)ptr->data;
- SceneRenderView *srv = (SceneRenderView *)value.data;
- const int index = BLI_findindex(&rd->views, srv);
- if (index != -1) rd->actview = index;
+ RenderData *rd = (RenderData *)ptr->data;
+ SceneRenderView *srv = (SceneRenderView *)value.data;
+ const int index = BLI_findindex(&rd->views, srv);
+ if (index != -1)
+ rd->actview = index;
}
static SceneRenderView *rna_RenderView_new(ID *id, RenderData *UNUSED(rd), const char *name)
{
- Scene *scene = (Scene *)id;
- SceneRenderView *srv = BKE_scene_add_render_view(scene, name);
+ Scene *scene = (Scene *)id;
+ SceneRenderView *srv = BKE_scene_add_render_view(scene, name);
- WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
- return srv;
+ return srv;
}
static void rna_RenderView_remove(
- ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr)
+ ID *id, RenderData *UNUSED(rd), Main *UNUSED(bmain), ReportList *reports, PointerRNA *srv_ptr)
{
- SceneRenderView *srv = srv_ptr->data;
- Scene *scene = (Scene *)id;
+ SceneRenderView *srv = srv_ptr->data;
+ Scene *scene = (Scene *)id;
- if (!BKE_scene_remove_render_view(scene, srv)) {
- BKE_reportf(reports, RPT_ERROR, "Render view '%s' could not be removed from scene '%s'",
- srv->name, scene->id.name + 2);
- return;
- }
+ if (!BKE_scene_remove_render_view(scene, srv)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Render view '%s' could not be removed from scene '%s'",
+ srv->name,
+ scene->id.name + 2);
+ return;
+ }
- RNA_POINTER_INVALIDATE(srv_ptr);
+ RNA_POINTER_INVALIDATE(srv_ptr);
- WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
}
static void rna_RenderSettings_views_format_set(PointerRNA *ptr, int value)
{
- RenderData *rd = (RenderData *)ptr->data;
+ RenderData *rd = (RenderData *)ptr->data;
- if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW &&
- value == SCE_VIEWS_FORMAT_STEREO_3D)
- {
- /* make sure the actview is visible */
- if (rd->actview > 1) rd->actview = 1;
- }
+ if (rd->views_format == SCE_VIEWS_FORMAT_MULTIVIEW && value == SCE_VIEWS_FORMAT_STEREO_3D) {
+ /* make sure the actview is visible */
+ if (rd->actview > 1)
+ rd->actview = 1;
+ }
- rd->views_format = value;
+ rd->views_format = value;
}
static void rna_RenderSettings_engine_set(PointerRNA *ptr, int value)
{
- RenderData *rd = (RenderData *)ptr->data;
- RenderEngineType *type = BLI_findlink(&R_engines, value);
+ RenderData *rd = (RenderData *)ptr->data;
+ RenderEngineType *type = BLI_findlink(&R_engines, value);
- if (type) {
- BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
- DEG_id_tag_update(ptr->id.data, ID_RECALC_COPY_ON_WRITE);
- }
+ if (type) {
+ BLI_strncpy_utf8(rd->engine, type->idname, sizeof(rd->engine));
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_COPY_ON_WRITE);
+ }
}
-static const EnumPropertyItem *rna_RenderSettings_engine_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_RenderSettings_engine_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- RenderEngineType *type;
- EnumPropertyItem *item = NULL;
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- int a = 0, totitem = 0;
+ RenderEngineType *type;
+ EnumPropertyItem *item = NULL;
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ int a = 0, totitem = 0;
- for (type = R_engines.first; type; type = type->next, a++) {
- tmp.value = a;
- tmp.identifier = type->idname;
- tmp.name = type->name;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
+ for (type = R_engines.first; type; type = type->next, a++) {
+ tmp.value = a;
+ tmp.identifier = type->idname;
+ tmp.name = type->name;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static int rna_RenderSettings_engine_get(PointerRNA *ptr)
{
- RenderData *rd = (RenderData *)ptr->data;
- RenderEngineType *type;
- int a = 0;
+ RenderData *rd = (RenderData *)ptr->data;
+ RenderEngineType *type;
+ int a = 0;
- for (type = R_engines.first; type; type = type->next, a++)
- if (STREQ(type->idname, rd->engine))
- return a;
+ for (type = R_engines.first; type; type = type->next, a++)
+ if (STREQ(type->idname, rd->engine))
+ return a;
- return 0;
+ return 0;
}
-static void rna_RenderSettings_engine_update(Main *bmain, Scene *UNUSED(unused), PointerRNA *UNUSED(ptr))
+static void rna_RenderSettings_engine_update(Main *bmain,
+ Scene *UNUSED(unused),
+ PointerRNA *UNUSED(ptr))
{
- ED_render_engine_changed(bmain);
+ ED_render_engine_changed(bmain);
}
static bool rna_RenderSettings_multiple_engines_get(PointerRNA *UNUSED(ptr))
{
- return (BLI_listbase_count(&R_engines) > 1);
+ return (BLI_listbase_count(&R_engines) > 1);
}
static bool rna_RenderSettings_use_spherical_stereo_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- return BKE_scene_use_spherical_stereo(scene);
+ Scene *scene = (Scene *)ptr->id.data;
+ return BKE_scene_use_spherical_stereo(scene);
}
void rna_Scene_glsl_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
+ Scene *scene = (Scene *)ptr->id.data;
- DEG_id_tag_update(&scene->id, 0);
+ DEG_id_tag_update(&scene->id, 0);
}
static void rna_Scene_world_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Scene *sc = (Scene *)ptr->id.data;
+ Scene *sc = (Scene *)ptr->id.data;
- rna_Scene_glsl_update(bmain, scene, ptr);
- WM_main_add_notifier(NC_WORLD | ND_WORLD, &sc->id);
- DEG_relations_tag_update(bmain);
+ rna_Scene_glsl_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_WORLD | ND_WORLD, &sc->id);
+ DEG_relations_tag_update(bmain);
}
void rna_Scene_freestyle_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
+ Scene *scene = (Scene *)ptr->id.data;
- DEG_id_tag_update(&scene->id, 0);
+ DEG_id_tag_update(&scene->id, 0);
}
-void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+void rna_Scene_use_view_map_cache_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
-#ifdef WITH_FREESTYLE
- FRS_free_view_map_cache();
-#endif
+# ifdef WITH_FREESTYLE
+ FRS_free_view_map_cache();
+# endif
}
void rna_ViewLayer_name_set(PointerRNA *ptr, const char *value)
{
- Scene *scene = (Scene *)ptr->id.data;
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- BLI_assert(BKE_id_is_in_global_main(&scene->id));
- BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
+ Scene *scene = (Scene *)ptr->id.data;
+ ViewLayer *view_layer = (ViewLayer *)ptr->data;
+ BLI_assert(BKE_id_is_in_global_main(&scene->id));
+ BKE_view_layer_rename(G_MAIN, scene, view_layer, value);
}
static void rna_SceneRenderView_name_set(PointerRNA *ptr, const char *value)
{
- Scene *scene = (Scene *)ptr->id.data;
- SceneRenderView *rv = (SceneRenderView *)ptr->data;
- BLI_strncpy_utf8(rv->name, value, sizeof(rv->name));
- BLI_uniquename(&scene->r.views, rv, DATA_("RenderView"), '.', offsetof(SceneRenderView, name), sizeof(rv->name));
+ Scene *scene = (Scene *)ptr->id.data;
+ SceneRenderView *rv = (SceneRenderView *)ptr->data;
+ BLI_strncpy_utf8(rv->name, value, sizeof(rv->name));
+ BLI_uniquename(&scene->r.views,
+ rv,
+ DATA_("RenderView"),
+ '.',
+ offsetof(SceneRenderView, name),
+ sizeof(rv->name));
}
void rna_ViewLayer_material_override_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- rna_Scene_glsl_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
+ Scene *scene = (Scene *)ptr->id.data;
+ rna_Scene_glsl_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
}
void rna_ViewLayer_pass_update(Main *bmain, Scene *activescene, PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
+ Scene *scene = (Scene *)ptr->id.data;
- if (scene->nodetree)
- ntreeCompositUpdateRLayers(scene->nodetree);
+ if (scene->nodetree)
+ ntreeCompositUpdateRLayers(scene->nodetree);
- rna_Scene_glsl_update(bmain, activescene, ptr);
+ rna_Scene_glsl_update(bmain, activescene, ptr);
}
static char *rna_SceneRenderView_path(PointerRNA *ptr)
{
- SceneRenderView *srv = (SceneRenderView *)ptr->data;
- return BLI_sprintfN("render.views[\"%s\"]", srv->name);
+ SceneRenderView *srv = (SceneRenderView *)ptr->data;
+ return BLI_sprintfN("render.views[\"%s\"]", srv->name);
}
static void rna_Scene_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
- if (scene->use_nodes && scene->nodetree == NULL) {
- ED_node_composit_default(C, scene);
- }
- DEG_relations_tag_update(CTX_data_main(C));
+ Scene *scene = (Scene *)ptr->data;
+ if (scene->use_nodes && scene->nodetree == NULL) {
+ ED_node_composit_default(C, scene);
+ }
+ DEG_relations_tag_update(CTX_data_main(C));
}
static void rna_Physics_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- FOREACH_SCENE_OBJECT_BEGIN(scene, ob)
- {
- BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
- }
- FOREACH_SCENE_OBJECT_END;
+ Scene *scene = (Scene *)ptr->id.data;
+ FOREACH_SCENE_OBJECT_BEGIN (scene, ob) {
+ BKE_ptcache_object_reset(scene, ob, PTCACHE_RESET_DEPSGRAPH);
+ }
+ FOREACH_SCENE_OBJECT_END;
- DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
+ DEG_id_tag_update(&scene->id, ID_RECALC_COPY_ON_WRITE);
}
static void rna_Scene_editmesh_select_mode_set(PointerRNA *ptr, const bool *value)
{
- ToolSettings *ts = (ToolSettings *)ptr->data;
- int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) | (value[2] ? SCE_SELECT_FACE : 0);
+ ToolSettings *ts = (ToolSettings *)ptr->data;
+ int flag = (value[0] ? SCE_SELECT_VERTEX : 0) | (value[1] ? SCE_SELECT_EDGE : 0) |
+ (value[2] ? SCE_SELECT_FACE : 0);
- if (flag) {
- ts->selectmode = flag;
+ if (flag) {
+ ts->selectmode = flag;
- /* Update select mode in all the workspaces in mesh edit mode. */
- wmWindowManager *wm = G_MAIN->wm.first;
- for (wmWindow *win = wm->windows.first; win; win = win->next) {
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ /* Update select mode in all the workspaces in mesh edit mode. */
+ wmWindowManager *wm = G_MAIN->wm.first;
+ for (wmWindow *win = wm->windows.first; win; win = win->next) {
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- if (view_layer && view_layer->basact) {
- Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
- me->edit_mesh->selectmode = flag;
- EDBM_selectmode_set(me->edit_mesh);
- }
- }
- }
- }
+ if (view_layer && view_layer->basact) {
+ Mesh *me = BKE_mesh_from_object(view_layer->basact->object);
+ if (me && me->edit_mesh && me->edit_mesh->selectmode != flag) {
+ me->edit_mesh->selectmode = flag;
+ EDBM_selectmode_set(me->edit_mesh);
+ }
+ }
+ }
+ }
}
static void rna_Scene_editmesh_select_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Mesh *me = NULL;
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Mesh *me = NULL;
- if (view_layer->basact) {
- me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_mesh == NULL)
- me = NULL;
- }
+ if (view_layer->basact) {
+ me = BKE_mesh_from_object(view_layer->basact->object);
+ if (me && me->edit_mesh == NULL)
+ me = NULL;
+ }
- if (me) {
- DEG_id_tag_update(&me->id, ID_RECALC_SELECT);
- WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
- }
+ if (me) {
+ DEG_id_tag_update(&me->id, ID_RECALC_SELECT);
+ WM_main_add_notifier(NC_SCENE | ND_TOOLSETTINGS, NULL);
+ }
}
static void object_simplify_update(Object *ob)
{
- ModifierData *md;
- ParticleSystem *psys;
+ ModifierData *md;
+ ParticleSystem *psys;
- if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
- return;
- }
+ if ((ob->id.tag & LIB_TAG_DOIT) == 0) {
+ return;
+ }
- ob->id.tag &= ~LIB_TAG_DOIT;
+ ob->id.tag &= ~LIB_TAG_DOIT;
- for (md = ob->modifiers.first; md; md = md->next) {
- if (ELEM(md->type, eModifierType_Subsurf, eModifierType_Multires, eModifierType_ParticleSystem)) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
- }
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (ELEM(md->type,
+ eModifierType_Subsurf,
+ eModifierType_Multires,
+ eModifierType_ParticleSystem)) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+ }
- for (psys = ob->particlesystem.first; psys; psys = psys->next)
- psys->recalc |= ID_RECALC_PSYS_CHILD;
+ for (psys = ob->particlesystem.first; psys; psys = psys->next)
+ psys->recalc |= ID_RECALC_PSYS_CHILD;
- if (ob->instance_collection) {
- CollectionObject *cob;
+ if (ob->instance_collection) {
+ CollectionObject *cob;
- for (cob = ob->instance_collection->gobject.first; cob; cob = cob->next)
- object_simplify_update(cob->ob);
- }
+ for (cob = ob->instance_collection->gobject.first; cob; cob = cob->next)
+ object_simplify_update(cob->ob);
+ }
}
static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *sce = ptr->id.data;
- Scene *sce_iter;
- Base *base;
+ Scene *sce = ptr->id.data;
+ Scene *sce_iter;
+ Base *base;
- BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
- FOREACH_SCENE_OBJECT_BEGIN(sce, ob)
- {
- object_simplify_update(ob);
- }
- FOREACH_SCENE_OBJECT_END;
+ BKE_main_id_tag_listbase(&bmain->objects, LIB_TAG_DOIT, true);
+ FOREACH_SCENE_OBJECT_BEGIN (sce, ob) {
+ object_simplify_update(ob);
+ }
+ FOREACH_SCENE_OBJECT_END;
- for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) {
- object_simplify_update(base->object);
- }
+ for (SETLOOPER_SET_ONLY(sce, sce_iter, base)) {
+ object_simplify_update(base->object);
+ }
- WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- DEG_id_tag_update(&sce->id, 0);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ DEG_id_tag_update(&sce->id, 0);
}
static void rna_Scene_simplify_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Scene *sce = ptr->id.data;
+ Scene *sce = ptr->id.data;
- if (sce->r.mode & R_SIMPLIFY)
- rna_Scene_use_simplify_update(bmain, scene, ptr);
+ if (sce->r.mode & R_SIMPLIFY)
+ rna_Scene_use_simplify_update(bmain, scene, ptr);
}
-static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Scene_use_persistent_data_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Scene *sce = ptr->id.data;
+ Scene *sce = ptr->id.data;
- if (!(sce->r.mode & R_PERSISTENT_DATA))
- RE_FreePersistentData();
+ if (!(sce->r.mode & R_PERSISTENT_DATA))
+ RE_FreePersistentData();
}
/* Scene.transform_orientation_slots */
-static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_Scene_transform_orientation_slots_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- TransformOrientationSlot *orient_slot = &scene->orientation_slots[0];
- rna_iterator_array_begin(iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL);
+ Scene *scene = (Scene *)ptr->id.data;
+ TransformOrientationSlot *orient_slot = &scene->orientation_slots[0];
+ rna_iterator_array_begin(
+ iter, orient_slot, sizeof(*orient_slot), ARRAY_SIZE(scene->orientation_slots), 0, NULL);
}
static int rna_Scene_transform_orientation_slots_length(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- return ARRAY_SIZE(scene->orientation_slots);
+ Scene *scene = (Scene *)ptr->id.data;
+ return ARRAY_SIZE(scene->orientation_slots);
}
static bool rna_Scene_use_audio_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
- return (scene->audio.flag & AUDIO_MUTE) != 0;
+ Scene *scene = (Scene *)ptr->data;
+ return (scene->audio.flag & AUDIO_MUTE) != 0;
}
static void rna_Scene_use_audio_set(PointerRNA *ptr, bool value)
{
- Scene *scene = (Scene *)ptr->data;
+ Scene *scene = (Scene *)ptr->data;
- if (value)
- scene->audio.flag |= AUDIO_MUTE;
- else
- scene->audio.flag &= ~AUDIO_MUTE;
+ if (value)
+ scene->audio.flag |= AUDIO_MUTE;
+ else
+ scene->audio.flag &= ~AUDIO_MUTE;
- BKE_sound_mute_scene(scene, value);
+ BKE_sound_mute_scene(scene, value);
}
static int rna_Scene_sync_mode_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->data;
- if (scene->audio.flag & AUDIO_SYNC)
- return AUDIO_SYNC;
- return scene->flag & SCE_FRAME_DROP;
+ Scene *scene = (Scene *)ptr->data;
+ if (scene->audio.flag & AUDIO_SYNC)
+ return AUDIO_SYNC;
+ return scene->flag & SCE_FRAME_DROP;
}
static void rna_Scene_sync_mode_set(PointerRNA *ptr, int value)
{
- Scene *scene = (Scene *)ptr->data;
+ Scene *scene = (Scene *)ptr->data;
- if (value == AUDIO_SYNC) {
- scene->audio.flag |= AUDIO_SYNC;
- }
- else if (value == SCE_FRAME_DROP) {
- scene->audio.flag &= ~AUDIO_SYNC;
- scene->flag |= SCE_FRAME_DROP;
- }
- else {
- scene->audio.flag &= ~AUDIO_SYNC;
- scene->flag &= ~SCE_FRAME_DROP;
- }
+ if (value == AUDIO_SYNC) {
+ scene->audio.flag |= AUDIO_SYNC;
+ }
+ else if (value == SCE_FRAME_DROP) {
+ scene->audio.flag &= ~AUDIO_SYNC;
+ scene->flag |= SCE_FRAME_DROP;
+ }
+ else {
+ scene->audio.flag &= ~AUDIO_SYNC;
+ scene->flag &= ~SCE_FRAME_DROP;
+ }
}
static void rna_View3DCursor_rotation_mode_set(PointerRNA *ptr, int value)
{
- View3DCursor *cursor = ptr->data;
+ View3DCursor *cursor = ptr->data;
- /* use API Method for conversions... */
- BKE_rotMode_change_values(
- cursor->rotation_quaternion,
- cursor->rotation_euler,
- cursor->rotation_axis, &cursor->rotation_angle, cursor->rotation_mode, (short)value);
+ /* use API Method for conversions... */
+ BKE_rotMode_change_values(cursor->rotation_quaternion,
+ cursor->rotation_euler,
+ cursor->rotation_axis,
+ &cursor->rotation_angle,
+ cursor->rotation_mode,
+ (short)value);
- /* finally, set the new rotation type */
- cursor->rotation_mode = value;
+ /* finally, set the new rotation type */
+ cursor->rotation_mode = value;
}
static void rna_View3DCursor_rotation_axis_angle_get(PointerRNA *ptr, float *value)
{
- View3DCursor *cursor = ptr->data;
- value[0] = cursor->rotation_angle;
- copy_v3_v3(&value[1], cursor->rotation_axis);
+ View3DCursor *cursor = ptr->data;
+ value[0] = cursor->rotation_angle;
+ copy_v3_v3(&value[1], cursor->rotation_axis);
}
static void rna_View3DCursor_rotation_axis_angle_set(PointerRNA *ptr, const float *value)
{
- View3DCursor *cursor = ptr->data;
- cursor->rotation_angle = value[0];
- copy_v3_v3(cursor->rotation_axis, &value[1]);
+ View3DCursor *cursor = ptr->data;
+ cursor->rotation_angle = value[0];
+ copy_v3_v3(cursor->rotation_axis, &value[1]);
}
static TimeMarker *rna_TimeLine_add(Scene *scene, const char name[], int frame)
{
- TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
- marker->flag = SELECT;
- marker->frame = frame;
- BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
- BLI_addtail(&scene->markers, marker);
+ TimeMarker *marker = MEM_callocN(sizeof(TimeMarker), "TimeMarker");
+ marker->flag = SELECT;
+ marker->frame = frame;
+ BLI_strncpy_utf8(marker->name, name, sizeof(marker->name));
+ BLI_addtail(&scene->markers, marker);
- WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
- WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
- return marker;
+ return marker;
}
static void rna_TimeLine_remove(Scene *scene, ReportList *reports, PointerRNA *marker_ptr)
{
- TimeMarker *marker = marker_ptr->data;
- if (BLI_remlink_safe(&scene->markers, marker) == false) {
- BKE_reportf(reports, RPT_ERROR, "Timeline marker '%s' not found in scene '%s'",
- marker->name, scene->id.name + 2);
- return;
- }
+ TimeMarker *marker = marker_ptr->data;
+ if (BLI_remlink_safe(&scene->markers, marker) == false) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Timeline marker '%s' not found in scene '%s'",
+ marker->name,
+ scene->id.name + 2);
+ return;
+ }
- MEM_freeN(marker);
- RNA_POINTER_INVALIDATE(marker_ptr);
+ MEM_freeN(marker);
+ RNA_POINTER_INVALIDATE(marker_ptr);
- WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
- WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
}
static void rna_TimeLine_clear(Scene *scene)
{
- BLI_freelistN(&scene->markers);
+ BLI_freelistN(&scene->markers);
- WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
- WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
}
-static KeyingSet *rna_Scene_keying_set_new(Scene *sce, ReportList *reports, const char idname[], const char name[])
+static KeyingSet *rna_Scene_keying_set_new(Scene *sce,
+ ReportList *reports,
+ const char idname[],
+ const char name[])
{
- KeyingSet *ks = NULL;
+ KeyingSet *ks = NULL;
- /* call the API func, and set the active keyingset index */
- ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
+ /* call the API func, and set the active keyingset index */
+ ks = BKE_keyingset_add(&sce->keyingsets, idname, name, KEYINGSET_ABSOLUTE, 0);
- if (ks) {
- sce->active_keyingset = BLI_listbase_count(&sce->keyingsets);
- return ks;
- }
- else {
- BKE_report(reports, RPT_ERROR, "Keying set could not be added");
- return NULL;
- }
+ if (ks) {
+ sce->active_keyingset = BLI_listbase_count(&sce->keyingsets);
+ return ks;
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Keying set could not be added");
+ return NULL;
+ }
}
static void rna_UnifiedPaintSettings_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
- WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Brush *br = BKE_paint_brush(BKE_paint_get_active(scene, view_layer));
+ WM_main_add_notifier(NC_BRUSH | NA_EDITED, br);
}
static void rna_UnifiedPaintSettings_size_set(PointerRNA *ptr, int value)
{
- UnifiedPaintSettings *ups = ptr->data;
+ UnifiedPaintSettings *ups = ptr->data;
- /* scale unprojected radius so it stays consistent with brush size */
- BKE_brush_scale_unprojected_radius(&ups->unprojected_radius,
- value, ups->size);
- ups->size = value;
+ /* scale unprojected radius so it stays consistent with brush size */
+ BKE_brush_scale_unprojected_radius(&ups->unprojected_radius, value, ups->size);
+ ups->size = value;
}
static void rna_UnifiedPaintSettings_unprojected_radius_set(PointerRNA *ptr, float value)
{
- UnifiedPaintSettings *ups = ptr->data;
+ UnifiedPaintSettings *ups = ptr->data;
- /* scale brush size so it stays consistent with unprojected_radius */
- BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
- ups->unprojected_radius = value;
+ /* scale brush size so it stays consistent with unprojected_radius */
+ BKE_brush_scale_size(&ups->size, value, ups->unprojected_radius);
+ ups->unprojected_radius = value;
}
static void rna_UnifiedPaintSettings_radius_update(bContext *C, PointerRNA *ptr)
{
- /* changing the unified size should invalidate the overlay but also update the brush */
- BKE_paint_invalidate_overlay_all();
- rna_UnifiedPaintSettings_update(C, ptr);
+ /* changing the unified size should invalidate the overlay but also update the brush */
+ BKE_paint_invalidate_overlay_all();
+ rna_UnifiedPaintSettings_update(C, ptr);
}
static char *rna_UnifiedPaintSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.unified_paint_settings");
+ return BLI_strdup("tool_settings.unified_paint_settings");
}
static char *rna_CurvePaintSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.curve_paint_settings");
+ return BLI_strdup("tool_settings.curve_paint_settings");
}
/* generic function to recalc geometry */
static void rna_EditMesh_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Mesh *me = NULL;
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Mesh *me = NULL;
- if (view_layer->basact) {
- me = BKE_mesh_from_object(view_layer->basact->object);
- if (me && me->edit_mesh == NULL)
- me = NULL;
- }
+ if (view_layer->basact) {
+ me = BKE_mesh_from_object(view_layer->basact->object);
+ if (me && me->edit_mesh == NULL)
+ me = NULL;
+ }
- if (me) {
- DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_GEOM | ND_DATA, me);
- }
+ if (me) {
+ DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_GEOM | ND_DATA, me);
+ }
}
static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.statvis");
+ return BLI_strdup("tool_settings.statvis");
}
/* note: without this, when Multi-Paint is activated/deactivated, the colors
@@ -1778,404 +1971,427 @@ static char *rna_MeshStatVis_path(PointerRNA *UNUSED(ptr))
* given its own notifier. */
static void rna_Scene_update_active_object_data(bContext *C, PointerRNA *UNUSED(ptr))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
- if (ob) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
- }
+ if (ob) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &ob->id);
+ }
}
static void rna_SceneCamera_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- Object *camera = scene->camera;
+ Scene *scene = (Scene *)ptr->id.data;
+ Object *camera = scene->camera;
- if (camera && (camera->type == OB_CAMERA)) {
- DEG_id_tag_update(&camera->id, ID_RECALC_GEOMETRY);
- }
+ if (camera && (camera->type == OB_CAMERA)) {
+ DEG_id_tag_update(&camera->id, ID_RECALC_GEOMETRY);
+ }
}
-static void rna_SceneSequencer_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_SceneSequencer_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- BKE_sequencer_cache_cleanup();
- BKE_sequencer_preprocessed_cache_cleanup();
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
}
static char *rna_ToolSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings");
+ return BLI_strdup("tool_settings");
}
PointerRNA rna_FreestyleLineSet_linestyle_get(PointerRNA *ptr)
{
- FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
+ FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
+ return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineStyle, lineset->linestyle);
}
void rna_FreestyleLineSet_linestyle_set(PointerRNA *ptr, PointerRNA value)
{
- FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
+ FreestyleLineSet *lineset = (FreestyleLineSet *)ptr->data;
- if (lineset->linestyle)
- id_us_min(&lineset->linestyle->id);
- lineset->linestyle = (FreestyleLineStyle *)value.data;
- id_us_plus(&lineset->linestyle->id);
+ if (lineset->linestyle)
+ id_us_min(&lineset->linestyle->id);
+ lineset->linestyle = (FreestyleLineStyle *)value.data;
+ id_us_plus(&lineset->linestyle->id);
}
-FreestyleLineSet *rna_FreestyleSettings_lineset_add(
- ID *id, FreestyleSettings *config, Main *bmain, const char *name)
+FreestyleLineSet *rna_FreestyleSettings_lineset_add(ID *id,
+ FreestyleSettings *config,
+ Main *bmain,
+ const char *name)
{
- Scene *scene = (Scene *)id;
- FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name);
+ Scene *scene = (Scene *)id;
+ FreestyleLineSet *lineset = BKE_freestyle_lineset_add(bmain, (FreestyleConfig *)config, name);
- DEG_id_tag_update(&scene->id, 0);
- WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ DEG_id_tag_update(&scene->id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
- return lineset;
+ return lineset;
}
-void rna_FreestyleSettings_lineset_remove(
- ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *lineset_ptr)
+void rna_FreestyleSettings_lineset_remove(ID *id,
+ FreestyleSettings *config,
+ ReportList *reports,
+ PointerRNA *lineset_ptr)
{
- FreestyleLineSet *lineset = lineset_ptr->data;
- Scene *scene = (Scene *)id;
+ FreestyleLineSet *lineset = lineset_ptr->data;
+ Scene *scene = (Scene *)id;
- if (!BKE_freestyle_lineset_delete((FreestyleConfig *)config, lineset)) {
- BKE_reportf(reports, RPT_ERROR, "Line set '%s' could not be removed", lineset->name);
- return;
- }
+ if (!BKE_freestyle_lineset_delete((FreestyleConfig *)config, lineset)) {
+ BKE_reportf(reports, RPT_ERROR, "Line set '%s' could not be removed", lineset->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(lineset_ptr);
+ RNA_POINTER_INVALIDATE(lineset_ptr);
- DEG_id_tag_update(&scene->id, 0);
- WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ DEG_id_tag_update(&scene->id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
}
PointerRNA rna_FreestyleSettings_active_lineset_get(PointerRNA *ptr)
{
- FreestyleConfig *config = (FreestyleConfig *)ptr->data;
- FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
- return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+ FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
+ return rna_pointer_inherit_refine(ptr, &RNA_FreestyleLineSet, lineset);
}
void rna_FreestyleSettings_active_lineset_index_range(
- PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1);
+ *min = 0;
+ *max = max_ii(0, BLI_listbase_count(&config->linesets) - 1);
}
int rna_FreestyleSettings_active_lineset_index_get(PointerRNA *ptr)
{
- FreestyleConfig *config = (FreestyleConfig *)ptr->data;
- return BKE_freestyle_lineset_get_active_index(config);
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+ return BKE_freestyle_lineset_get_active_index(config);
}
void rna_FreestyleSettings_active_lineset_index_set(PointerRNA *ptr, int value)
{
- FreestyleConfig *config = (FreestyleConfig *)ptr->data;
- BKE_freestyle_lineset_set_active_index(config, value);
+ FreestyleConfig *config = (FreestyleConfig *)ptr->data;
+ BKE_freestyle_lineset_set_active_index(config, value);
}
FreestyleModuleConfig *rna_FreestyleSettings_module_add(ID *id, FreestyleSettings *config)
{
- Scene *scene = (Scene *)id;
- FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config);
+ Scene *scene = (Scene *)id;
+ FreestyleModuleConfig *module = BKE_freestyle_module_add((FreestyleConfig *)config);
- DEG_id_tag_update(&scene->id, 0);
- WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ DEG_id_tag_update(&scene->id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
- return module;
+ return module;
}
-void rna_FreestyleSettings_module_remove(
- ID *id, FreestyleSettings *config, ReportList *reports, PointerRNA *module_ptr)
+void rna_FreestyleSettings_module_remove(ID *id,
+ FreestyleSettings *config,
+ ReportList *reports,
+ PointerRNA *module_ptr)
{
- Scene *scene = (Scene *)id;
- FreestyleModuleConfig *module = module_ptr->data;
+ Scene *scene = (Scene *)id;
+ FreestyleModuleConfig *module = module_ptr->data;
- if (!BKE_freestyle_module_delete((FreestyleConfig *)config, module)) {
- if (module->script)
- BKE_reportf(reports, RPT_ERROR, "Style module '%s' could not be removed", module->script->id.name + 2);
- else
- BKE_report(reports, RPT_ERROR, "Style module could not be removed");
- return;
- }
+ if (!BKE_freestyle_module_delete((FreestyleConfig *)config, module)) {
+ if (module->script)
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Style module '%s' could not be removed",
+ module->script->id.name + 2);
+ else
+ BKE_report(reports, RPT_ERROR, "Style module could not be removed");
+ return;
+ }
- RNA_POINTER_INVALIDATE(module_ptr);
+ RNA_POINTER_INVALIDATE(module_ptr);
- DEG_id_tag_update(&scene->id, 0);
- WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ DEG_id_tag_update(&scene->id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_RENDER_OPTIONS, NULL);
}
char *rna_GPUDOF_path(PointerRNA *ptr)
{
- /* if there is ID-data, resolve the path using the index instead of by name,
- * since the name used is the name of the texture assigned, but the texture
- * may be used multiple times in the same stack
- */
- if (ptr->id.data) {
- if (GS(((ID *)ptr->id.data)->name) == ID_CA) {
- return BLI_strdup("gpu_dof");
- }
- }
+ /* if there is ID-data, resolve the path using the index instead of by name,
+ * since the name used is the name of the texture assigned, but the texture
+ * may be used multiple times in the same stack
+ */
+ if (ptr->id.data) {
+ if (GS(((ID *)ptr->id.data)->name) == ID_CA) {
+ return BLI_strdup("gpu_dof");
+ }
+ }
- return BLI_strdup("");
+ return BLI_strdup("");
}
static void rna_GPUDOFSettings_blades_set(PointerRNA *ptr, const int value)
{
- GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data;
+ GPUDOFSettings *dofsettings = (GPUDOFSettings *)ptr->data;
- if (value == 1 || value == 2) {
- if (dofsettings->num_blades == 0) {
- dofsettings->num_blades = 3;
- }
- else {
- dofsettings->num_blades = 0;
- }
- }
- else {
- dofsettings->num_blades = value;
- }
+ if (value == 1 || value == 2) {
+ if (dofsettings->num_blades == 0) {
+ dofsettings->num_blades = 3;
+ }
+ else {
+ dofsettings->num_blades = 0;
+ }
+ }
+ else {
+ dofsettings->num_blades = value;
+ }
}
static void rna_GPUDOFSettings_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- /* TODO(sergey): Can be more selective here. */
- BKE_sequencer_cache_cleanup();
- BKE_sequencer_preprocessed_cache_cleanup();
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ /* TODO(sergey): Can be more selective here. */
+ BKE_sequencer_cache_cleanup();
+ BKE_sequencer_preprocessed_cache_cleanup();
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
}
static void rna_Stereo3dFormat_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
+ ID *id = ptr->id.data;
- if (id && GS(id->name) == ID_IM) {
- Image *ima = (Image *)id;
- ImBuf *ibuf;
- void *lock;
+ if (id && GS(id->name) == ID_IM) {
+ Image *ima = (Image *)id;
+ ImBuf *ibuf;
+ void *lock;
- if (!BKE_image_is_stereo(ima))
- return;
+ if (!BKE_image_is_stereo(ima))
+ return;
- ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
+ ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (ibuf) {
- BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
- }
- BKE_image_release_ibuf(ima, ibuf, lock);
- }
+ if (ibuf) {
+ BKE_image_signal(bmain, ima, NULL, IMA_SIGNAL_FREE);
+ }
+ BKE_image_release_ibuf(ima, ibuf, lock);
+ }
}
-static ViewLayer *rna_ViewLayer_new(
- ID *id, Scene *UNUSED(sce), Main *bmain, const char *name)
+static ViewLayer *rna_ViewLayer_new(ID *id, Scene *UNUSED(sce), Main *bmain, const char *name)
{
- Scene *scene = (Scene *)id;
- ViewLayer *view_layer = BKE_view_layer_add(scene, name);
+ Scene *scene = (Scene *)id;
+ ViewLayer *view_layer = BKE_view_layer_add(scene, name);
- DEG_id_tag_update(&scene->id, 0);
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
+ DEG_id_tag_update(&scene->id, 0);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
- return view_layer;
+ return view_layer;
}
static void rna_ViewLayer_remove(
- ID *id, Scene *UNUSED(sce), Main *bmain, ReportList *reports, PointerRNA *sl_ptr)
+ ID *id, Scene *UNUSED(sce), Main *bmain, ReportList *reports, PointerRNA *sl_ptr)
{
- Scene *scene = (Scene *)id;
- ViewLayer *view_layer = sl_ptr->data;
+ Scene *scene = (Scene *)id;
+ ViewLayer *view_layer = sl_ptr->data;
- if (ED_scene_view_layer_delete(bmain, scene, view_layer, reports)) {
- RNA_POINTER_INVALIDATE(sl_ptr);
- }
+ if (ED_scene_view_layer_delete(bmain, scene, view_layer, reports)) {
+ RNA_POINTER_INVALIDATE(sl_ptr);
+ }
}
/* Fake value, used internally (not saved to DNA). */
-#define V3D_ORIENT_DEFAULT -1
+# define V3D_ORIENT_DEFAULT -1
static int rna_TransformOrientationSlot_type_get(PointerRNA *ptr)
{
- Scene *scene = ptr->id.data;
- TransformOrientationSlot *orient_slot = ptr->data;
- if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
- if ((orient_slot->flag & SELECT) == 0) {
- return V3D_ORIENT_DEFAULT;
- }
- }
- return BKE_scene_orientation_slot_get_index(orient_slot);
+ Scene *scene = ptr->id.data;
+ TransformOrientationSlot *orient_slot = ptr->data;
+ if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
+ if ((orient_slot->flag & SELECT) == 0) {
+ return V3D_ORIENT_DEFAULT;
+ }
+ }
+ return BKE_scene_orientation_slot_get_index(orient_slot);
}
void rna_TransformOrientationSlot_type_set(PointerRNA *ptr, int value)
{
- Scene *scene = ptr->id.data;
- TransformOrientationSlot *orient_slot = ptr->data;
+ Scene *scene = ptr->id.data;
+ TransformOrientationSlot *orient_slot = ptr->data;
- if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
- if (value == V3D_ORIENT_DEFAULT) {
- orient_slot->flag &= ~SELECT;
- return;
- }
- else {
- orient_slot->flag |= SELECT;
- }
- }
+ if (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]) {
+ if (value == V3D_ORIENT_DEFAULT) {
+ orient_slot->flag &= ~SELECT;
+ return;
+ }
+ else {
+ orient_slot->flag |= SELECT;
+ }
+ }
- BKE_scene_orientation_slot_set_index(orient_slot, value);
+ BKE_scene_orientation_slot_set_index(orient_slot, value);
}
static PointerRNA rna_TransformOrientationSlot_get(PointerRNA *ptr)
{
- Scene *scene = ptr->id.data;
- TransformOrientationSlot *orient_slot = ptr->data;
- TransformOrientation *orientation;
- if (orient_slot->type < V3D_ORIENT_CUSTOM) {
- orientation = NULL;
- }
- else {
- orientation = BKE_scene_transform_orientation_find(scene, orient_slot->index_custom);
- }
- return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
-}
+ Scene *scene = ptr->id.data;
+ TransformOrientationSlot *orient_slot = ptr->data;
+ TransformOrientation *orientation;
+ if (orient_slot->type < V3D_ORIENT_CUSTOM) {
+ orientation = NULL;
+ }
+ else {
+ orientation = BKE_scene_transform_orientation_find(scene, orient_slot->index_custom);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_TransformOrientation, orientation);
+}
+
+static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(Scene *scene,
+ const bool include_default,
+ bool *r_free)
+{
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ EnumPropertyItem *item = NULL;
+ int i = V3D_ORIENT_CUSTOM, totitem = 0;
-static const EnumPropertyItem *rna_TransformOrientation_impl_itemf(
- Scene *scene, const bool include_default,
- bool *r_free)
-{
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- EnumPropertyItem *item = NULL;
- int i = V3D_ORIENT_CUSTOM, totitem = 0;
-
- if (include_default) {
- tmp.identifier = "DEFAULT";
- tmp.name = "Default";
- tmp.description = "Use the scene orientation";
- tmp.value = V3D_ORIENT_DEFAULT;
- tmp.icon = ICON_OBJECT_ORIGIN;
- RNA_enum_item_add(&item, &totitem, &tmp);
- tmp.icon = 0;
+ if (include_default) {
+ tmp.identifier = "DEFAULT";
+ tmp.name = "Default";
+ tmp.description = "Use the scene orientation";
+ tmp.value = V3D_ORIENT_DEFAULT;
+ tmp.icon = ICON_OBJECT_ORIGIN;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ tmp.icon = 0;
- RNA_enum_item_add_separator(&item, &totitem);
- }
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
- RNA_enum_items_add(&item, &totitem, rna_enum_transform_orientation_items);
+ RNA_enum_items_add(&item, &totitem, rna_enum_transform_orientation_items);
- const ListBase *transform_orientations = scene ? &scene->transform_spaces : NULL;
+ const ListBase *transform_orientations = scene ? &scene->transform_spaces : NULL;
- if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) {
- RNA_enum_item_add_separator(&item, &totitem);
+ if (transform_orientations && (BLI_listbase_is_empty(transform_orientations) == false)) {
+ RNA_enum_item_add_separator(&item, &totitem);
- for (TransformOrientation *ts = transform_orientations->first; ts; ts = ts->next) {
- tmp.identifier = ts->name;
- tmp.name = ts->name;
- tmp.value = i++;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- }
+ for (TransformOrientation *ts = transform_orientations->first; ts; ts = ts->next) {
+ tmp.identifier = ts->name;
+ tmp.name = ts->name;
+ tmp.value = i++;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
-const EnumPropertyItem *rna_TransformOrientation_itemf(
- bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+const EnumPropertyItem *rna_TransformOrientation_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- Scene *scene;
- if (ptr->id.data && (GS(((ID *)ptr->id.data)->name) == ID_SCE)) {
- scene = ptr->id.data;
- }
- else {
- scene = CTX_data_scene(C);
- }
- return rna_TransformOrientation_impl_itemf(scene, false, r_free);
+ Scene *scene;
+ if (ptr->id.data && (GS(((ID *)ptr->id.data)->name) == ID_SCE)) {
+ scene = ptr->id.data;
+ }
+ else {
+ scene = CTX_data_scene(C);
+ }
+ return rna_TransformOrientation_impl_itemf(scene, false, r_free);
}
-const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+const EnumPropertyItem *rna_TransformOrientation_with_scene_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- Scene *scene = ptr->id.data;
- TransformOrientationSlot *orient_slot = ptr->data;
- bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);
- return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
+ Scene *scene = ptr->id.data;
+ TransformOrientationSlot *orient_slot = ptr->data;
+ bool include_default = (orient_slot != &scene->orientation_slots[SCE_ORIENT_DEFAULT]);
+ return rna_TransformOrientation_impl_itemf(scene, include_default, r_free);
}
-#undef V3D_ORIENT_DEFAULT
+# undef V3D_ORIENT_DEFAULT
-static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(
- const int system, const int type, bool *r_free)
+static const EnumPropertyItem *rna_UnitSettings_itemf_wrapper(const int system,
+ const int type,
+ bool *r_free)
{
- const void *usys;
- int len;
- bUnit_GetSystem(system, type, &usys, &len);
+ const void *usys;
+ int len;
+ bUnit_GetSystem(system, type, &usys, &len);
- EnumPropertyItem *items = NULL;
- int totitem = 0;
+ EnumPropertyItem *items = NULL;
+ int totitem = 0;
- EnumPropertyItem adaptive = { 0 };
- adaptive.identifier = "ADAPTIVE";
- adaptive.name = "Adaptive";
- adaptive.value = USER_UNIT_ADAPTIVE;
- RNA_enum_item_add(&items, &totitem, &adaptive);
+ EnumPropertyItem adaptive = {0};
+ adaptive.identifier = "ADAPTIVE";
+ adaptive.name = "Adaptive";
+ adaptive.value = USER_UNIT_ADAPTIVE;
+ RNA_enum_item_add(&items, &totitem, &adaptive);
- for (int i = 0; i < len; i++) {
- if (!bUnit_IsSuppressed(usys, i)) {
- EnumPropertyItem tmp = { 0 };
- tmp.identifier = bUnit_GetIdentifier(usys, i);
- tmp.name = bUnit_GetNameDisplay(usys, i);
- tmp.value = i;
- RNA_enum_item_add(&items, &totitem, &tmp);
- }
- }
+ for (int i = 0; i < len; i++) {
+ if (!bUnit_IsSuppressed(usys, i)) {
+ EnumPropertyItem tmp = {0};
+ tmp.identifier = bUnit_GetIdentifier(usys, i);
+ tmp.name = bUnit_GetNameDisplay(usys, i);
+ tmp.value = i;
+ RNA_enum_item_add(&items, &totitem, &tmp);
+ }
+ }
- *r_free = true;
- return items;
+ *r_free = true;
+ return items;
}
-const EnumPropertyItem *rna_UnitSettings_length_unit_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+const EnumPropertyItem *rna_UnitSettings_length_unit_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- UnitSettings *units = ptr->data;
- return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_LENGTH, r_free);
+ UnitSettings *units = ptr->data;
+ return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_LENGTH, r_free);
}
-const EnumPropertyItem *rna_UnitSettings_mass_unit_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+const EnumPropertyItem *rna_UnitSettings_mass_unit_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- UnitSettings *units = ptr->data;
- return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_MASS, r_free);
+ UnitSettings *units = ptr->data;
+ return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_MASS, r_free);
}
-const EnumPropertyItem *rna_UnitSettings_time_unit_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+const EnumPropertyItem *rna_UnitSettings_time_unit_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- UnitSettings *units = ptr->data;
- return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free);
+ UnitSettings *units = ptr->data;
+ return rna_UnitSettings_itemf_wrapper(units->system, B_UNIT_TIME, r_free);
}
-static void rna_UnitSettings_system_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+static void rna_UnitSettings_system_update(Main *UNUSED(bmain),
+ Scene *scene,
+ PointerRNA *UNUSED(ptr))
{
- UnitSettings *unit = &scene->unit;
- if (unit->system == USER_UNIT_NONE) {
- unit->length_unit = USER_UNIT_ADAPTIVE;
- unit->mass_unit = USER_UNIT_ADAPTIVE;
- }
- else {
- unit->length_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_LENGTH);
- unit->mass_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_MASS);
- }
+ UnitSettings *unit = &scene->unit;
+ if (unit->system == USER_UNIT_NONE) {
+ unit->length_unit = USER_UNIT_ADAPTIVE;
+ unit->mass_unit = USER_UNIT_ADAPTIVE;
+ }
+ else {
+ unit->length_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_LENGTH);
+ unit->mass_unit = bUnit_GetBaseUnitOfType(unit->system, B_UNIT_MASS);
+ }
}
static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("unit_settings");
+ return BLI_strdup("unit_settings");
}
#else
@@ -2183,2204 +2399,2534 @@ static char *rna_UnitSettings_path(PointerRNA *UNUSED(ptr))
/* Grease Pencil Interpolation tool settings */
static void rna_def_gpencil_interpolate(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "GPencilInterpolateSettings", NULL);
- RNA_def_struct_sdna(srna, "GP_Interpolate_Settings");
- RNA_def_struct_path_func(srna, "rna_GPencilInterpolateSettings_path");
- RNA_def_struct_ui_text(srna, "Grease Pencil Interpolate Settings",
- "Settings for Grease Pencil interpolation tools");
-
- /* flags */
- prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS);
- RNA_def_property_ui_text(prop, "Interpolate All Layers", "Interpolate all layers, not only active");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED);
- RNA_def_property_ui_text(prop, "Interpolate Selected Strokes", "Interpolate only selected strokes in the original frame");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* interpolation type */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_interpolation_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilInterpolateSettings_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type",
- "Interpolation method to use the next time 'Interpolate Sequence' is run");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* easing */
- prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "easing");
- RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
- RNA_def_property_ui_text(prop, "Easing",
- "Which ends of the segment between the preceding and following grease pencil frames "
- "easing interpolation is applied to");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* easing options */
- prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "back");
- RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
- RNA_def_property_ui_text(prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* custom curvemap */
- prop = RNA_def_property(srna, "interpolation_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "custom_ipo");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Interpolation Curve",
- "Custom curve to control 'sequence' interpolation between Grease Pencil frames");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GPencilInterpolateSettings", NULL);
+ RNA_def_struct_sdna(srna, "GP_Interpolate_Settings");
+ RNA_def_struct_path_func(srna, "rna_GPencilInterpolateSettings_path");
+ RNA_def_struct_ui_text(srna,
+ "Grease Pencil Interpolate Settings",
+ "Settings for Grease Pencil interpolation tools");
+
+ /* flags */
+ prop = RNA_def_property(srna, "interpolate_all_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ALL_LAYERS);
+ RNA_def_property_ui_text(
+ prop, "Interpolate All Layers", "Interpolate all layers, not only active");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "interpolate_selected_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_TOOLFLAG_INTERPOLATE_ONLY_SELECTED);
+ RNA_def_property_ui_text(prop,
+ "Interpolate Selected Strokes",
+ "Interpolate only selected strokes in the original frame");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* interpolation type */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_interpolation_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_GPencilInterpolateSettings_type_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Type", "Interpolation method to use the next time 'Interpolate Sequence' is run");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* easing */
+ prop = RNA_def_property(srna, "easing", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "easing");
+ RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_easing_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Easing",
+ "Which ends of the segment between the preceding and following grease pencil frames "
+ "easing interpolation is applied to");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* easing options */
+ prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "back");
+ RNA_def_property_ui_text(prop, "Back", "Amount of overshoot for 'back' easing");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX); /* only positive values... */
+ RNA_def_property_ui_text(
+ prop, "Amplitude", "Amount to boost elastic bounces for 'elastic' easing");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_ui_text(prop, "Period", "Time between bounces for elastic easing");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* custom curvemap */
+ prop = RNA_def_property(srna, "interpolation_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "custom_ipo");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(
+ prop,
+ "Interpolation Curve",
+ "Custom curve to control 'sequence' interpolation between Grease Pencil frames");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
static void rna_def_transform_orientation(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "TransformOrientation", NULL);
+ srna = RNA_def_struct(brna, "TransformOrientation", NULL);
- prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "mat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "mat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_3x3);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_ui_text(prop, "Name", "Name of the custom transform orientation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
static void rna_def_transform_orientation_slot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "TransformOrientationSlot", NULL);
- RNA_def_struct_sdna(srna, "TransformOrientationSlot");
- RNA_def_struct_ui_text(srna, "Orientation Slot", "");
+ srna = RNA_def_struct(brna, "TransformOrientationSlot", NULL);
+ RNA_def_struct_sdna(srna, "TransformOrientationSlot");
+ RNA_def_struct_ui_text(srna, "Orientation Slot", "");
- /* Orientations */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_transform_orientation_items);
- RNA_def_property_enum_funcs(
- prop,
- "rna_TransformOrientationSlot_type_get",
- "rna_TransformOrientationSlot_type_set",
- "rna_TransformOrientation_with_scene_itemf");
- RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ /* Orientations */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_transform_orientation_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_TransformOrientationSlot_type_get",
+ "rna_TransformOrientationSlot_type_set",
+ "rna_TransformOrientation_with_scene_itemf");
+ RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "custom_orientation", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "TransformOrientation");
- RNA_def_property_pointer_funcs(prop, "rna_TransformOrientationSlot_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Current Transform Orientation", "");
+ prop = RNA_def_property(srna, "custom_orientation", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "TransformOrientation");
+ RNA_def_property_pointer_funcs(prop, "rna_TransformOrientationSlot_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Current Transform Orientation", "");
- /* flag */
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Use", "Use scene orientation instead of a custom setting");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ /* flag */
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Use", "Use scene orientation instead of a custom setting");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
static void rna_def_view3d_cursor(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "View3DCursor", NULL);
- RNA_def_struct_sdna(srna, "View3DCursor");
- RNA_def_struct_ui_text(srna, "3D Cursor", "");
-
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "location");
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation_quaternion");
- RNA_def_property_float_array_default(prop, rna_default_quaternion);
- RNA_def_property_ui_text(prop, "Quaternion Rotation", "Rotation in quaternions (keep normalized)");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_View3DCursor_rotation_axis_angle_get",
- "rna_View3DCursor_rotation_axis_angle_set", NULL);
- RNA_def_property_float_array_default(prop, rna_default_axis_angle);
- RNA_def_property_ui_text(prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation_euler");
- RNA_def_property_ui_text(prop, "Euler Rotation", "3D rotation");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "rotation_mode");
- RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_View3DCursor_rotation_mode_set", NULL);
- RNA_def_property_ui_text(prop, "Rotation Mode", "");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-}
-
-static void rna_def_tool_settings(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* the construction of this enum is quite special - everything is stored as bitflags,
- * with 1st position only for for on/off (and exposed as boolean), while others are mutually
- * exclusive options but which will only have any effect when autokey is enabled
- */
- static const EnumPropertyItem auto_key_items[] = {
- {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
- {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem edge_tag_items[] = {
- {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
- {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
- {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
- {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
- {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
- {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static EnumPropertyItem mod_weighted_strength[] = {
- {FACE_STRENGTH_WEAK, "Weak", 0, "Weak", ""},
- {FACE_STRENGTH_MEDIUM, "Medium", 0, "Medium", ""},
- {FACE_STRENGTH_STRONG, "Strong", 0, "Strong", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem draw_groupuser_items[] = {
- {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
- {OB_DRAW_GROUPUSER_ACTIVE, "ACTIVE", 0, "Active", "Show vertices with no weights in the active group"},
- {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem vertex_group_select_items[] = {
- {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
- {WT_VGROUP_BONE_DEFORM, "BONE_DEFORM", 0, "Deform", "Vertex Groups assigned to Deform Bones"},
- {WT_VGROUP_BONE_DEFORM_OFF, "OTHER_DEFORM", 0, "Other", "Vertex Groups assigned to non Deform Bones"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem gpencil_stroke_placement_items[] = {
- {GP_PROJECT_VIEWSPACE, "ORIGIN", ICON_OBJECT_ORIGIN, "Origin", "Draw stroke at Object origin"},
- {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
- {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_SNAP_FACE, "Surface", "Stick stroke to surfaces"},
- {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE, "STROKE", ICON_STROKE, "Stroke", "Stick stroke to other strokes"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem gpencil_stroke_snap_items[] = {
- {0, "NONE", 0, "All points", "Snap to all points"},
- {GP_PROJECT_DEPTH_STROKE_ENDPOINTS, "ENDS", 0, "End points", "Snap to first and last points and interpolate" },
- {GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First point", "Snap to first point" },
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem gpencil_selectmode_items[] = {
- {GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
- {GP_SELECTMODE_STROKE, "STROKE", ICON_GP_SELECT_STROKES, "Stroke", "Select all stroke points" },
- {GP_SELECTMODE_SEGMENT, "SEGMENT", ICON_GP_SELECT_BETWEEN_STROKES, "Segment", "Select all stroke points between other strokes" },
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem annotation_stroke_placement_items[] = {
- {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "3D Cursor", "Draw stroke at 3D cursor location" },
- {0, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
- {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW, "SURFACE", ICON_FACESEL, "Surface", "Stick stroke to surfaces"},
- {0, NULL, 0, NULL, NULL},
- };
-
-
- srna = RNA_def_struct(brna, "ToolSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
- RNA_def_struct_ui_text(srna, "Tool Settings", "");
-
- prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Sculpt");
- RNA_def_property_ui_text(prop, "Sculpt", "");
-
- prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
- RNA_def_property_ui_text(prop, "WPaint Auto-Normalize",
- "Ensure all bone-deforming vertex groups add up "
- "to 1.0 while weight painting");
- RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
-
- prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
- RNA_def_property_ui_text(prop, "WPaint Multi-Paint",
- "Paint across the weights of all selected bones, "
- "maintaining their relative influence");
- RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
-
- prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_enum_sdna(prop, NULL, "weightuser");
- RNA_def_property_enum_items(prop, draw_groupuser_items);
- RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices");
- RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
-
- prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset");
- RNA_def_property_enum_items(prop, vertex_group_select_items);
- RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display");
- RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
-
- prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
- RNA_def_property_ui_text(prop, "Vertex Paint", "");
-
- prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
- RNA_def_property_ui_text(prop, "Weight Paint", "");
-
- prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
- RNA_def_property_ui_text(prop, "Image Paint", "");
-
- prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
- RNA_def_property_ui_text(prop, "UV Sculpt", "");
-
- prop = RNA_def_property(srna, "gpencil_paint", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gp_paint");
- RNA_def_property_ui_text(prop, "Grease Pencil Paint", "");
-
- prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "particle");
- RNA_def_property_ui_text(prop, "Particle Edit", "");
-
- prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
- RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
- RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
-
- prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
- RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
-
- prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
- RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
-
- prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
- RNA_def_property_enum_items(prop, rna_enum_uv_sculpt_tool_items);
- RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
-
- prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
- RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
- RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
-
- prop = RNA_def_property(srna, "lock_object_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "object_flag", SCE_OBJECT_MODE_LOCK);
- RNA_def_property_ui_text(prop, "Lock Object Modes", "Restrict select to the current mode");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* Transform */
- prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "proportional");
- RNA_def_property_enum_items(prop, rna_enum_proportional_editing_items);
- RNA_def_property_ui_text(prop, "Proportional Editing",
- "Proportional Editing mode, allows transforms with distance fall-off");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
- RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object mode");
- RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
- RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
- RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0);
- RNA_def_property_ui_text(prop, "Proportional Editing Actions", "Proportional editing in action editor");
- RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0);
- RNA_def_property_ui_text(prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor");
- RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0);
- RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing");
-
- prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
- RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_items);
- RNA_def_property_ui_text(prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "proportional_size");
- RNA_def_property_ui_text(prop, "Proportional Size", "Display size for proportional editing circle");
- RNA_def_property_range(prop, 0.00001, 5000.0);
-
- prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "doublimit");
- RNA_def_property_ui_text(prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
-
- /* Pivot Point */
- prop = RNA_def_property(srna, "transform_pivot_point", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "transform_pivot_point");
- RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
- RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_transform_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_AXIS_ALIGN);
- RNA_def_property_ui_text(prop, "Only Origins", "Manipulate center points (object, pose and weight paint mode only)");
- RNA_def_property_ui_icon(prop, ICON_CENTER_ONLY, 0);
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
- prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
- RNA_def_property_ui_text(prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
- RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
- RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
- RNA_def_property_ui_text(prop, "Align Rotation to Target", "Align rotation with the snapping target");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_grid_absolute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_GRID);
- RNA_def_property_ui_text(prop, "Absolute Grid Snap",
- "Absolute grid alignment while translating (based on the pivot center)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "snap_elements", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode");
- RNA_def_property_enum_items(prop, rna_enum_snap_element_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ToolSettings_snap_mode_set", NULL);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- /* node editor uses own set of snap modes */
- prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_node_mode");
- RNA_def_property_enum_items(prop, rna_enum_snap_node_element_items);
- RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- /* image editor uses own set of snap modes */
- prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_uv_mode");
- RNA_def_property_enum_items(prop, snap_uv_element_items);
- RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "snap_target");
- RNA_def_property_enum_items(prop, rna_enum_snap_target_items);
- RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
- RNA_def_property_ui_text(prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
- RNA_def_property_ui_text(prop, "Project Individual Elements",
- "Project individual elements on the surface of other objects");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
- RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_TRANSLATE);
- RNA_def_property_ui_text(prop, "Use Snap for Translation",
- "Move is affected by snapping settings");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Use Snap for Rotation",
- "Rotate is affected by the snapping settings");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Use Snap for Scale",
- "Scale is affected by snapping settings");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
-
- /* Grease Pencil */
- prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
- RNA_def_property_ui_text(prop, "Use Additive Drawing",
- "When creating new frames, the strokes from the previous/active frame "
- "are included as the basis for the new one");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINT_ONBACK);
- RNA_def_property_ui_text(
- prop, "Draw Strokes on Back",
- "When draw new strokes, the new stroke is drawn below of all strokes in the layer");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_thumbnail_list", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_THUMBNAIL_LIST);
- RNA_def_property_ui_text(
- prop, "Compact List",
- "Show compact list of color instead of thumbnails");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_weight_data_add", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_CREATE_WEIGHTS);
- RNA_def_property_ui_text(
- prop, "Add weight data for new strokes",
- "When creating new strokes, the weight data is added according to the current vertex group and weight, "
- "if no vertex group selected, weight is not added");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt");
- RNA_def_property_struct_type(prop, "GPencilSculptSettings");
- RNA_def_property_ui_text(prop, "Grease Pencil Sculpt",
- "Settings for stroke sculpting tools and brushes");
-
- prop = RNA_def_property(srna, "gpencil_interpolate", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gp_interpolate");
- RNA_def_property_struct_type(prop, "GPencilInterpolateSettings");
- RNA_def_property_ui_text(prop, "Grease Pencil Interpolate",
- "Settings for Grease Pencil Interpolation tools");
-
- /* Grease Pencil - 3D View Stroke Placement */
- prop = RNA_def_property(srna, "gpencil_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
- RNA_def_property_enum_items(prop, gpencil_stroke_placement_items);
- RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "gpencil_stroke_snap_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
- RNA_def_property_enum_items(prop, gpencil_stroke_snap_items);
- RNA_def_property_ui_text(prop, "Stroke Snap", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS);
- RNA_def_property_ui_text(prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Grease Pencil - Select mode */
- prop = RNA_def_property(srna, "gpencil_selectmode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gpencil_selectmode");
- RNA_def_property_enum_items(prop, gpencil_selectmode_items);
- RNA_def_property_ui_text(prop, "Select Mode", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- /* Annotations - 2D Views Stroke Placement */
- prop = RNA_def_property(srna, "annotation_stroke_placement_view2d", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align");
- RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
- RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Annotations - Sequencer Preview Stroke Placement */
- prop = RNA_def_property(srna, "annotation_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align");
- RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
- RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Annotations - Image Editor Stroke Placement */
- prop = RNA_def_property(srna, "annotation_stroke_placement_image_editor", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align");
- RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
- RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Annotations - 3D View Stroke Placement */
- /* XXX: Do we need to decouple the stroke_endpoints setting too? */
- prop = RNA_def_property(srna, "annotation_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "annotate_v3d_align");
- RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
- RNA_def_property_enum_default(prop, GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR);
- RNA_def_property_ui_text(prop, "Annotation Stroke Placement (3D View)", "How annotation strokes are orientated in 3D space");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- /* Annotations - Stroke Thickness */
- prop = RNA_def_property(srna, "annotation_thickness", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "annotate_thickness");
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_text(prop, "Annotation Stroke Thickness", "Thickness of annotation strokes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* Auto Keying */
- prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
- RNA_def_property_ui_text(prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
- RNA_def_property_ui_icon(prop, ICON_REC, 0);
-
- prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
- RNA_def_property_enum_items(prop, auto_key_items);
- RNA_def_property_ui_text(prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
-
- prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
- RNA_def_property_ui_text(prop, "Layered",
- "Add a new NLA Track + Strip for every loop/pass made over the animation "
- "to allow non-destructive tweaking");
-
- prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
- RNA_def_property_ui_text(prop, "Auto Keyframe Insert Keying Set",
- "Automatic keyframe insertion using active Keying Set only");
- RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
-
- prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_CYCLEAWARE);
- RNA_def_property_ui_text(prop, "Cycle-Aware Keying",
- "For channels with cyclic extrapolation, keyframe insertion is automatically "
- "remapped inside the cycle time range, and keeps ends in sync");
-
- /* Keyframing */
- prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "keyframe_type");
- RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
- RNA_def_property_ui_text(prop, "New Keyframe Type", "Type of keyframes to create when inserting keyframes");
-
- /* UV */
- prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
- RNA_def_property_enum_items(prop, rna_enum_mesh_select_mode_uv_items);
- RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
- RNA_def_property_ui_text(prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
- RNA_def_property_ui_icon(prop, ICON_UV_SYNC_SELECT, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
- RNA_def_property_ui_text(prop, "UV Local View", "Display only faces with the currently displayed image assigned");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- /* Mesh */
- prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
- RNA_def_property_array(prop, 3);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
- RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
-
- prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
- RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
-
- /* use with MESH_OT_shortest_path_pick */
- prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
- RNA_def_property_enum_items(prop, edge_tag_items);
- RNA_def_property_ui_text(prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
-
- prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
- RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
-
- prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
- RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, 3);
-
- prop = RNA_def_property(srna, "face_strength", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, mod_weighted_strength);
- RNA_def_property_ui_text(prop, "Face Strength", "Set strength of face to specified value");
-
- /* Unified Paint Settings */
- prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
- RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
-
- /* Curve Paint Settings */
- prop = RNA_def_property(srna, "curve_paint_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "CurvePaintSettings");
- RNA_def_property_ui_text(prop, "Curve Paint Settings", NULL);
-
- /* Mesh Statistics */
- prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "MeshStatVis");
- RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL);
-}
-
-static void rna_def_unified_paint_settings(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem brush_size_unit_items[] = {
- {0, "VIEW", 0, "View", "Measure brush size relateve to the view"},
- {UNIFIED_PAINT_BRUSH_LOCK_SIZE, "SCENE", 0, "Scene", "Measure brush size relateve to the scene"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
- RNA_def_struct_ui_text(srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
-
- /* high-level flags to enable or disable unified paint settings */
- prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
- RNA_def_property_ui_text(prop, "Use Unified Radius",
- "Instead of per-brush radius, the radius is shared across brushes");
-
- prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
- RNA_def_property_ui_text(prop, "Use Unified Strength",
- "Instead of per-brush strength, the strength is shared across brushes");
-
- prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
- RNA_def_property_ui_text(prop, "Use Unified Weight",
- "Instead of per-brush weight, the weight is shared across brushes");
-
- prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_COLOR);
- RNA_def_property_ui_text(prop, "Use Unified Color",
- "Instead of per-brush color, the color is shared across brushes");
-
- /* unified paint settings that override the equivalent settings
- * from the active brush */
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
- RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
- RNA_def_property_ui_text(prop, "Radius", "Radius of the brush");
- RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
-
- prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_funcs(prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_range(prop, 0.001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001, 1, 0, -1);
- RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
- RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Strength", "How powerful the effect of the brush is when applied");
- RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
- RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
- RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "rgb");
- RNA_def_property_ui_text(prop, "Color", "");
- RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
-
- prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
- RNA_def_property_ui_text(prop, "Secondary Color", "");
- RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
-
- prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
-
- prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
-
- prop = RNA_def_property(srna, "use_locked_size", PROP_ENUM, PROP_NONE); /* as an enum */
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, brush_size_unit_items);
- RNA_def_property_ui_text(prop, "Radius Unit", "Measure brush size relative to the view or the scene ");
-
-}
-
-
-static void rna_def_curve_paint_settings(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "CurvePaintSettings", NULL);
- RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path");
- RNA_def_struct_ui_text(srna, "Curve Paint Settings", "");
-
- static const EnumPropertyItem curve_type_items[] = {
- {CU_POLY, "POLY", 0, "Poly", ""},
- {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "curve_type");
- RNA_def_property_enum_items(prop, curve_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of curve to use for new strokes");
-
- prop = RNA_def_property(srna, "use_corners_detect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_CORNERS_DETECT);
- RNA_def_property_ui_text(prop, "Detect Corners", "Detect corners and use non-aligned handles");
-
- prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_PRESSURE_RADIUS);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Use Pressure", "Map tablet pressure to curve radius");
-
- prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS);
- RNA_def_property_ui_text(prop, "Only First", "Use the start of the stroke for the depth");
-
- prop = RNA_def_property(srna, "use_offset_absolute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_OFFSET_ABS);
- RNA_def_property_ui_text(prop, "Absolute Offset", "Apply a fixed offset (don't scale by the radius)");
-
- prop = RNA_def_property(srna, "error_threshold", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Tolerance", "Allow deviation for a smoother, less precise line");
-
- prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_PIXEL);
- RNA_def_property_enum_sdna(prop, NULL, "fit_method");
- RNA_def_property_enum_items(prop, rna_enum_curve_fit_method_items);
- RNA_def_property_ui_text(prop, "Method", "Curve fitting method");
-
- prop = RNA_def_property(srna, "corner_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, 0, M_PI);
- RNA_def_property_ui_text(prop, "Corner Angle", "Angles above this are considered corners");
-
- prop = RNA_def_property(srna, "radius_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
- RNA_def_property_ui_text(prop, "Radius Min",
- "Minimum radius when the minimum pressure is applied (also the minimum when tapering)");
-
- prop = RNA_def_property(srna, "radius_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
- RNA_def_property_ui_text(prop, "Radius Max",
- "Radius to use when the maximum pressure is applied (or when a tablet isn't used)");
-
- prop = RNA_def_property(srna, "radius_taper_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Radius Min", "Taper factor for the radius of each point along the curve");
-
- prop = RNA_def_property(srna, "radius_taper_end", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Radius Max", "Taper factor for the radius of each point along the curve");
-
- prop = RNA_def_property(srna, "surface_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2);
- RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface");
-
- static const EnumPropertyItem depth_mode_items[] = {
- {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""},
- {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "depth_mode");
- RNA_def_property_enum_items(prop, depth_mode_items);
- RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth");
-
- static const EnumPropertyItem surface_plane_items[] = {
- {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, "NORMAL_VIEW", 0, "Normal/View", "Display perpendicular to the surface"},
- {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE, "NORMAL_SURFACE", 0, "Normal/Surface", "Display aligned to the surface"},
- {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Display aligned to the viewport"},
- {0, NULL, 0, NULL, NULL},};
-
- prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "surface_plane");
- RNA_def_property_enum_items(prop, surface_plane_items);
- RNA_def_property_ui_text(prop, "Plane", "Plane for projected stroke");
-}
-
-static void rna_def_statvis(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem stat_type[] = {
- {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""},
- {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""},
- {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
- {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
- {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MeshStatVis", NULL);
- RNA_def_struct_path_func(srna, "rna_MeshStatVis_path");
- RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", "");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, stat_type);
- RNA_def_property_ui_text(prop, "Type", "Type of data to visualize/check");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
-
- /* overhang */
- prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "overhang_min");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
- RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "overhang_max");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "overhang_axis");
- RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
- RNA_def_property_ui_text(prop, "Axis", "");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
-
- /* thickness */
- prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "thickness_min");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1000.0);
- RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
- RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "thickness_max");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1000.0);
- RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
- RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "thickness_samples");
- RNA_def_property_range(prop, 1, 32);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- /* distort */
- prop = RNA_def_property(srna, "distort_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "distort_min");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "distort_max");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- /* sharp */
- prop = RNA_def_property(srna, "sharp_min", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "sharp_min");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
-
- prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "sharp_max");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
- RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
- RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "View3DCursor", NULL);
+ RNA_def_struct_sdna(srna, "View3DCursor");
+ RNA_def_struct_ui_text(srna, "3D Cursor", "");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ_LENGTH);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "location");
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, 4);
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_quaternion", PROP_FLOAT, PROP_QUATERNION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation_quaternion");
+ RNA_def_property_float_array_default(prop, rna_default_quaternion);
+ RNA_def_property_ui_text(
+ prop, "Quaternion Rotation", "Rotation in quaternions (keep normalized)");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_axis_angle", PROP_FLOAT, PROP_AXISANGLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_float_funcs(prop,
+ "rna_View3DCursor_rotation_axis_angle_get",
+ "rna_View3DCursor_rotation_axis_angle_set",
+ NULL);
+ RNA_def_property_float_array_default(prop, rna_default_axis_angle);
+ RNA_def_property_ui_text(
+ prop, "Axis-Angle Rotation", "Angle of Rotation for Axis-Angle rotation representation");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_euler", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation_euler");
+ RNA_def_property_ui_text(prop, "Euler Rotation", "3D rotation");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "rotation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "rotation_mode");
+ RNA_def_property_enum_items(prop, rna_enum_object_rotation_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_View3DCursor_rotation_mode_set", NULL);
+ RNA_def_property_ui_text(prop, "Rotation Mode", "");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+}
+
+static void rna_def_tool_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* the construction of this enum is quite special - everything is stored as bitflags,
+ * with 1st position only for for on/off (and exposed as boolean), while others are mutually
+ * exclusive options but which will only have any effect when autokey is enabled
+ */
+ static const EnumPropertyItem auto_key_items[] = {
+ {AUTOKEY_MODE_NORMAL & ~AUTOKEY_ON, "ADD_REPLACE_KEYS", 0, "Add & Replace", ""},
+ {AUTOKEY_MODE_EDITKEYS & ~AUTOKEY_ON, "REPLACE_KEYS", 0, "Replace", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem edge_tag_items[] = {
+ {EDGE_MODE_SELECT, "SELECT", 0, "Select", ""},
+ {EDGE_MODE_TAG_SEAM, "SEAM", 0, "Tag Seam", ""},
+ {EDGE_MODE_TAG_SHARP, "SHARP", 0, "Tag Sharp", ""},
+ {EDGE_MODE_TAG_CREASE, "CREASE", 0, "Tag Crease", ""},
+ {EDGE_MODE_TAG_BEVEL, "BEVEL", 0, "Tag Bevel", ""},
+ {EDGE_MODE_TAG_FREESTYLE, "FREESTYLE", 0, "Tag Freestyle Edge Mark", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static EnumPropertyItem mod_weighted_strength[] = {
+ {FACE_STRENGTH_WEAK, "Weak", 0, "Weak", ""},
+ {FACE_STRENGTH_MEDIUM, "Medium", 0, "Medium", ""},
+ {FACE_STRENGTH_STRONG, "Strong", 0, "Strong", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem draw_groupuser_items[] = {
+ {OB_DRAW_GROUPUSER_NONE, "NONE", 0, "None", ""},
+ {OB_DRAW_GROUPUSER_ACTIVE,
+ "ACTIVE",
+ 0,
+ "Active",
+ "Show vertices with no weights in the active group"},
+ {OB_DRAW_GROUPUSER_ALL, "ALL", 0, "All", "Show vertices with no weights in any group"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem vertex_group_select_items[] = {
+ {WT_VGROUP_ALL, "ALL", 0, "All", "All Vertex Groups"},
+ {WT_VGROUP_BONE_DEFORM,
+ "BONE_DEFORM",
+ 0,
+ "Deform",
+ "Vertex Groups assigned to Deform Bones"},
+ {WT_VGROUP_BONE_DEFORM_OFF,
+ "OTHER_DEFORM",
+ 0,
+ "Other",
+ "Vertex Groups assigned to non Deform Bones"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem gpencil_stroke_placement_items[] = {
+ {GP_PROJECT_VIEWSPACE,
+ "ORIGIN",
+ ICON_OBJECT_ORIGIN,
+ "Origin",
+ "Draw stroke at Object origin"},
+ {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR,
+ "CURSOR",
+ ICON_PIVOT_CURSOR,
+ "3D Cursor",
+ "Draw stroke at 3D cursor location"},
+ {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW,
+ "SURFACE",
+ ICON_SNAP_FACE,
+ "Surface",
+ "Stick stroke to surfaces"},
+ {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_STROKE,
+ "STROKE",
+ ICON_STROKE,
+ "Stroke",
+ "Stick stroke to other strokes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem gpencil_stroke_snap_items[] = {
+ {0, "NONE", 0, "All points", "Snap to all points"},
+ {GP_PROJECT_DEPTH_STROKE_ENDPOINTS,
+ "ENDS",
+ 0,
+ "End points",
+ "Snap to first and last points and interpolate"},
+ {GP_PROJECT_DEPTH_STROKE_FIRST, "FIRST", 0, "First point", "Snap to first point"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem gpencil_selectmode_items[] = {
+ {GP_SELECTMODE_POINT, "POINT", ICON_GP_SELECT_POINTS, "Point", "Select only points"},
+ {GP_SELECTMODE_STROKE,
+ "STROKE",
+ ICON_GP_SELECT_STROKES,
+ "Stroke",
+ "Select all stroke points"},
+ {GP_SELECTMODE_SEGMENT,
+ "SEGMENT",
+ ICON_GP_SELECT_BETWEEN_STROKES,
+ "Segment",
+ "Select all stroke points between other strokes"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem annotation_stroke_placement_items[] = {
+ {GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR,
+ "CURSOR",
+ ICON_PIVOT_CURSOR,
+ "3D Cursor",
+ "Draw stroke at 3D cursor location"},
+ {0,
+ "VIEW",
+ ICON_RESTRICT_VIEW_ON,
+ "View",
+ "Stick stroke to the view "}, /* weird, GP_PROJECT_VIEWALIGN is inverted */
+ {GP_PROJECT_VIEWSPACE | GP_PROJECT_DEPTH_VIEW,
+ "SURFACE",
+ ICON_FACESEL,
+ "Surface",
+ "Stick stroke to surfaces"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ToolSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
+ RNA_def_struct_ui_text(srna, "Tool Settings", "");
+
+ prop = RNA_def_property(srna, "sculpt", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Sculpt");
+ RNA_def_property_ui_text(prop, "Sculpt", "");
+
+ prop = RNA_def_property(srna, "use_auto_normalize", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "auto_normalize", 1);
+ RNA_def_property_ui_text(prop,
+ "WPaint Auto-Normalize",
+ "Ensure all bone-deforming vertex groups add up "
+ "to 1.0 while weight painting");
+ RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
+
+ prop = RNA_def_property(srna, "use_multipaint", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "multipaint", 1);
+ RNA_def_property_ui_text(prop,
+ "WPaint Multi-Paint",
+ "Paint across the weights of all selected bones, "
+ "maintaining their relative influence");
+ RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
+
+ prop = RNA_def_property(srna, "vertex_group_user", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_sdna(prop, NULL, "weightuser");
+ RNA_def_property_enum_items(prop, draw_groupuser_items);
+ RNA_def_property_ui_text(prop, "Mask Non-Group Vertices", "Display unweighted vertices");
+ RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
+
+ prop = RNA_def_property(srna, "vertex_group_subset", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_sdna(prop, NULL, "vgroupsubset");
+ RNA_def_property_enum_items(prop, vertex_group_select_items);
+ RNA_def_property_ui_text(prop, "Subset", "Filter Vertex groups for Display");
+ RNA_def_property_update(prop, 0, "rna_Scene_update_active_object_data");
+
+ prop = RNA_def_property(srna, "vertex_paint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "vpaint");
+ RNA_def_property_ui_text(prop, "Vertex Paint", "");
+
+ prop = RNA_def_property(srna, "weight_paint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "wpaint");
+ RNA_def_property_ui_text(prop, "Weight Paint", "");
+
+ prop = RNA_def_property(srna, "image_paint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "imapaint");
+ RNA_def_property_ui_text(prop, "Image Paint", "");
+
+ prop = RNA_def_property(srna, "uv_sculpt", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "uvsculpt");
+ RNA_def_property_ui_text(prop, "UV Sculpt", "");
+
+ prop = RNA_def_property(srna, "gpencil_paint", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gp_paint");
+ RNA_def_property_ui_text(prop, "Grease Pencil Paint", "");
+
+ prop = RNA_def_property(srna, "particle_edit", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "particle");
+ RNA_def_property_ui_text(prop, "Particle Edit", "");
+
+ prop = RNA_def_property(srna, "use_uv_sculpt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_uv_sculpt", 1);
+ RNA_def_property_ui_text(prop, "UV Sculpt", "Enable brush for UV sculpting");
+ RNA_def_property_ui_icon(prop, ICON_TPAINT_HLT, 0);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_uv_sculpt_update");
+
+ prop = RNA_def_property(srna, "uv_sculpt_lock_borders", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_LOCK_BORDERS);
+ RNA_def_property_ui_text(prop, "Lock Borders", "Disable editing of boundary edges");
+
+ prop = RNA_def_property(srna, "uv_sculpt_all_islands", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uv_sculpt_settings", UV_SCULPT_ALL_ISLANDS);
+ RNA_def_property_ui_text(prop, "Sculpt All Islands", "Brush operates on all islands");
+
+ prop = RNA_def_property(srna, "uv_sculpt_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "uv_sculpt_tool");
+ RNA_def_property_enum_items(prop, rna_enum_uv_sculpt_tool_items);
+ RNA_def_property_ui_text(prop, "UV Sculpt Tools", "Select Tools for the UV sculpt brushes");
+
+ prop = RNA_def_property(srna, "uv_relax_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "uv_relax_method");
+ RNA_def_property_enum_items(prop, uv_sculpt_relaxation_items);
+ RNA_def_property_ui_text(prop, "Relaxation Method", "Algorithm used for UV relaxation");
+
+ prop = RNA_def_property(srna, "lock_object_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "object_flag", SCE_OBJECT_MODE_LOCK);
+ RNA_def_property_ui_text(prop, "Lock Object Modes", "Restrict select to the current mode");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* Transform */
+ prop = RNA_def_property(srna, "proportional_edit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "proportional");
+ RNA_def_property_enum_items(prop, rna_enum_proportional_editing_items);
+ RNA_def_property_ui_text(prop,
+ "Proportional Editing",
+ "Proportional Editing mode, allows transforms with distance fall-off");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_proportional_edit_objects", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
+ RNA_def_property_ui_text(
+ prop, "Proportional Editing Objects", "Proportional editing object mode");
+ RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
+ RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
+ RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_proportional_action", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proportional_action", 0);
+ RNA_def_property_ui_text(
+ prop, "Proportional Editing Actions", "Proportional editing in action editor");
+ RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_proportional_fcurve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "proportional_fcurve", 0);
+ RNA_def_property_ui_text(
+ prop, "Proportional Editing FCurves", "Proportional editing in FCurve editor");
+ RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "lock_markers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "lock_markers", 0);
+ RNA_def_property_ui_text(prop, "Lock Markers", "Prevent marker editing");
+
+ prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
+ RNA_def_property_enum_items(prop, rna_enum_proportional_falloff_items);
+ RNA_def_property_ui_text(
+ prop, "Proportional Editing Falloff", "Falloff type for proportional editing mode");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "proportional_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "proportional_size");
+ RNA_def_property_ui_text(
+ prop, "Proportional Size", "Display size for proportional editing circle");
+ RNA_def_property_range(prop, 0.00001, 5000.0);
+
+ prop = RNA_def_property(srna, "double_threshold", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "doublimit");
+ RNA_def_property_ui_text(
+ prop, "Double Threshold", "Limit for removing duplicates and 'Auto Merge'");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 0.1, 0.01, 6);
+
+ /* Pivot Point */
+ prop = RNA_def_property(srna, "transform_pivot_point", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "transform_pivot_point");
+ RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
+ RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_transform_pivot_point_align", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transform_flag", SCE_XFORM_AXIS_ALIGN);
+ RNA_def_property_ui_text(
+ prop, "Only Origins", "Manipulate center points (object, pose and weight paint mode only)");
+ RNA_def_property_ui_icon(prop, ICON_CENTER_ONLY, 0);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "use_mesh_automerge", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "automerge", 0);
+ RNA_def_property_ui_text(
+ prop, "AutoMerge Editing", "Automatically merge vertices moved to the same location");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP);
+ RNA_def_property_ui_text(prop, "Snap", "Snap during transform");
+ RNA_def_property_ui_icon(prop, ICON_SNAP_OFF, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_align_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ROTATE);
+ RNA_def_property_ui_text(
+ prop, "Align Rotation to Target", "Align rotation with the snapping target");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_grid_absolute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_ABS_GRID);
+ RNA_def_property_ui_text(
+ prop,
+ "Absolute Grid Snap",
+ "Absolute grid alignment while translating (based on the pivot center)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "snap_elements", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_mode");
+ RNA_def_property_enum_items(prop, rna_enum_snap_element_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_ToolSettings_snap_mode_set", NULL);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Snap Element", "Type of element to snap to");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ /* node editor uses own set of snap modes */
+ prop = RNA_def_property(srna, "snap_node_element", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_node_mode");
+ RNA_def_property_enum_items(prop, rna_enum_snap_node_element_items);
+ RNA_def_property_ui_text(prop, "Snap Node Element", "Type of element to snap to");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ /* image editor uses own set of snap modes */
+ prop = RNA_def_property(srna, "snap_uv_element", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "snap_uv_mode");
+ RNA_def_property_enum_items(prop, snap_uv_element_items);
+ RNA_def_property_ui_text(prop, "Snap UV Element", "Type of element to snap to");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "snap_target", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "snap_target");
+ RNA_def_property_enum_items(prop, rna_enum_snap_target_items);
+ RNA_def_property_ui_text(prop, "Snap Target", "Which part to snap onto the target");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_peel_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PEEL_OBJECT);
+ RNA_def_property_ui_text(
+ prop, "Snap Peel Object", "Consider objects as whole when finding volume center");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_project", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT);
+ RNA_def_property_ui_text(prop,
+ "Project Individual Elements",
+ "Project individual elements on the surface of other objects");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
+ RNA_def_property_ui_text(prop, "Project onto Self", "Snap onto itself (Edit Mode Only)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_translate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_TRANSLATE);
+ RNA_def_property_ui_text(
+ prop, "Use Snap for Translation", "Move is affected by snapping settings");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_rotate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_ROTATE);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(
+ prop, "Use Snap for Rotation", "Rotate is affected by the snapping settings");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ prop = RNA_def_property(srna, "use_snap_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "snap_transform_mode_flag", SCE_SNAP_TRANSFORM_MODE_SCALE);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Use Snap for Scale", "Scale is affected by snapping settings");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
+ /* Grease Pencil */
+ prop = RNA_def_property(srna, "use_gpencil_draw_additive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_RETAIN_LAST);
+ RNA_def_property_ui_text(prop,
+ "Use Additive Drawing",
+ "When creating new frames, the strokes from the previous/active frame "
+ "are included as the basis for the new one");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_draw_onback", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_PAINT_ONBACK);
+ RNA_def_property_ui_text(
+ prop,
+ "Draw Strokes on Back",
+ "When draw new strokes, the new stroke is drawn below of all strokes in the layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_thumbnail_list", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_THUMBNAIL_LIST);
+ RNA_def_property_ui_text(
+ prop, "Compact List", "Show compact list of color instead of thumbnails");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_weight_data_add", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gpencil_flags", GP_TOOL_FLAG_CREATE_WEIGHTS);
+ RNA_def_property_ui_text(prop,
+ "Add weight data for new strokes",
+ "When creating new strokes, the weight data is added according to the "
+ "current vertex group and weight, "
+ "if no vertex group selected, weight is not added");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "gpencil_sculpt", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gp_sculpt");
+ RNA_def_property_struct_type(prop, "GPencilSculptSettings");
+ RNA_def_property_ui_text(
+ prop, "Grease Pencil Sculpt", "Settings for stroke sculpting tools and brushes");
+
+ prop = RNA_def_property(srna, "gpencil_interpolate", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gp_interpolate");
+ RNA_def_property_struct_type(prop, "GPencilInterpolateSettings");
+ RNA_def_property_ui_text(
+ prop, "Grease Pencil Interpolate", "Settings for Grease Pencil Interpolation tools");
+
+ /* Grease Pencil - 3D View Stroke Placement */
+ prop = RNA_def_property(srna, "gpencil_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
+ RNA_def_property_enum_items(prop, gpencil_stroke_placement_items);
+ RNA_def_property_ui_text(prop, "Stroke Placement (3D View)", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "gpencil_stroke_snap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v3d_align");
+ RNA_def_property_enum_items(prop, gpencil_stroke_snap_items);
+ RNA_def_property_ui_text(prop, "Stroke Snap", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "gpencil_v3d_align", GP_PROJECT_DEPTH_STROKE_ENDPOINTS);
+ RNA_def_property_ui_text(
+ prop, "Only Endpoints", "Only use the first and last parts of the stroke for snapping");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Grease Pencil - Select mode */
+ prop = RNA_def_property(srna, "gpencil_selectmode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gpencil_selectmode");
+ RNA_def_property_enum_items(prop, gpencil_selectmode_items);
+ RNA_def_property_ui_text(prop, "Select Mode", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ /* Annotations - 2D Views Stroke Placement */
+ prop = RNA_def_property(srna, "annotation_stroke_placement_view2d", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_v2d_align");
+ RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
+ RNA_def_property_ui_text(prop, "Stroke Placement (2D View)", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Annotations - Sequencer Preview Stroke Placement */
+ prop = RNA_def_property(
+ srna, "annotation_stroke_placement_sequencer_preview", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_seq_align");
+ RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
+ RNA_def_property_ui_text(prop, "Stroke Placement (Sequencer Preview)", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Annotations - Image Editor Stroke Placement */
+ prop = RNA_def_property(srna, "annotation_stroke_placement_image_editor", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_ima_align");
+ RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
+ RNA_def_property_ui_text(prop, "Stroke Placement (Image Editor)", "");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Annotations - 3D View Stroke Placement */
+ /* XXX: Do we need to decouple the stroke_endpoints setting too? */
+ prop = RNA_def_property(srna, "annotation_stroke_placement_view3d", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "annotate_v3d_align");
+ RNA_def_property_enum_items(prop, annotation_stroke_placement_items);
+ RNA_def_property_enum_default(prop, GP_PROJECT_VIEWSPACE | GP_PROJECT_CURSOR);
+ RNA_def_property_ui_text(prop,
+ "Annotation Stroke Placement (3D View)",
+ "How annotation strokes are orientated in 3D space");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Annotations - Stroke Thickness */
+ prop = RNA_def_property(srna, "annotation_thickness", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "annotate_thickness");
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(prop, "Annotation Stroke Thickness", "Thickness of annotation strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* Auto Keying */
+ prop = RNA_def_property(srna, "use_keyframe_insert_auto", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
+ RNA_def_property_ui_text(
+ prop, "Auto Keying", "Automatic keyframe insertion for Objects and Bones");
+ RNA_def_property_ui_icon(prop, ICON_REC, 0);
+
+ prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "autokey_mode");
+ RNA_def_property_enum_items(prop, auto_key_items);
+ RNA_def_property_ui_text(
+ prop, "Auto-Keying Mode", "Mode of automatic keyframe insertion for Objects and Bones");
+
+ prop = RNA_def_property(srna, "use_record_with_nla", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", ANIMRECORD_FLAG_WITHNLA);
+ RNA_def_property_ui_text(
+ prop,
+ "Layered",
+ "Add a new NLA Track + Strip for every loop/pass made over the animation "
+ "to allow non-destructive tweaking");
+
+ prop = RNA_def_property(srna, "use_keyframe_insert_keyingset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_ONLYKEYINGSET);
+ RNA_def_property_ui_text(prop,
+ "Auto Keyframe Insert Keying Set",
+ "Automatic keyframe insertion using active Keying Set only");
+ RNA_def_property_ui_icon(prop, ICON_KEYINGSET, 0);
+
+ prop = RNA_def_property(srna, "use_keyframe_cycle_aware", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_CYCLEAWARE);
+ RNA_def_property_ui_text(
+ prop,
+ "Cycle-Aware Keying",
+ "For channels with cyclic extrapolation, keyframe insertion is automatically "
+ "remapped inside the cycle time range, and keeps ends in sync");
+
+ /* Keyframing */
+ prop = RNA_def_property(srna, "keyframe_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "keyframe_type");
+ RNA_def_property_enum_items(prop, rna_enum_beztriple_keyframe_type_items);
+ RNA_def_property_ui_text(
+ prop, "New Keyframe Type", "Type of keyframes to create when inserting keyframes");
+
+ /* UV */
+ prop = RNA_def_property(srna, "uv_select_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "uv_selectmode");
+ RNA_def_property_enum_items(prop, rna_enum_mesh_select_mode_uv_items);
+ RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
+ RNA_def_property_ui_text(
+ prop, "UV Sync Selection", "Keep UV and edit mode mesh selection in sync");
+ RNA_def_property_ui_icon(prop, ICON_UV_SYNC_SELECT, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_uv_local_view", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SHOW_SAME_IMAGE);
+ RNA_def_property_ui_text(
+ prop, "UV Local View", "Display only faces with the currently displayed image assigned");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ /* Mesh */
+ prop = RNA_def_property(srna, "mesh_select_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selectmode", 1);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_editmesh_select_mode_set");
+ RNA_def_property_ui_text(prop, "Mesh Selection Mode", "Which mesh elements selection works on");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_Scene_editmesh_select_mode_update");
+
+ prop = RNA_def_property(srna, "vertex_group_weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "vgroup_weight");
+ RNA_def_property_ui_text(prop, "Vertex Group Weight", "Weight to assign in vertex groups");
+
+ /* use with MESH_OT_shortest_path_pick */
+ prop = RNA_def_property(srna, "edge_path_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "edge_mode");
+ RNA_def_property_enum_items(prop, edge_tag_items);
+ RNA_def_property_ui_text(
+ prop, "Edge Tag Mode", "The edge flag to tag when selecting the shortest path");
+
+ prop = RNA_def_property(srna, "use_edge_path_live_unwrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_mode_live_unwrap", 1);
+ RNA_def_property_ui_text(prop, "Live Unwrap", "Changing edges seam re-calculates UV unwrap");
+
+ prop = RNA_def_property(srna, "normal_vector", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_ui_text(prop, "Normal Vector", "Normal Vector used to copy, add or multiply");
+ RNA_def_property_ui_range(prop, -10000.0, 10000.0, 1, 3);
+
+ prop = RNA_def_property(srna, "face_strength", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, mod_weighted_strength);
+ RNA_def_property_ui_text(prop, "Face Strength", "Set strength of face to specified value");
+
+ /* Unified Paint Settings */
+ prop = RNA_def_property(srna, "unified_paint_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "UnifiedPaintSettings");
+ RNA_def_property_ui_text(prop, "Unified Paint Settings", NULL);
+
+ /* Curve Paint Settings */
+ prop = RNA_def_property(srna, "curve_paint_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "CurvePaintSettings");
+ RNA_def_property_ui_text(prop, "Curve Paint Settings", NULL);
+
+ /* Mesh Statistics */
+ prop = RNA_def_property(srna, "statvis", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "MeshStatVis");
+ RNA_def_property_ui_text(prop, "Mesh Statistics Visualization", NULL);
+}
+
+static void rna_def_unified_paint_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem brush_size_unit_items[] = {
+ {0, "VIEW", 0, "View", "Measure brush size relateve to the view"},
+ {UNIFIED_PAINT_BRUSH_LOCK_SIZE,
+ "SCENE",
+ 0,
+ "Scene",
+ "Measure brush size relateve to the scene"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "UnifiedPaintSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_UnifiedPaintSettings_path");
+ RNA_def_struct_ui_text(
+ srna, "Unified Paint Settings", "Overrides for some of the active brush's settings");
+
+ /* high-level flags to enable or disable unified paint settings */
+ prop = RNA_def_property(srna, "use_unified_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_SIZE);
+ RNA_def_property_ui_text(prop,
+ "Use Unified Radius",
+ "Instead of per-brush radius, the radius is shared across brushes");
+
+ prop = RNA_def_property(srna, "use_unified_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_ALPHA);
+ RNA_def_property_ui_text(prop,
+ "Use Unified Strength",
+ "Instead of per-brush strength, the strength is shared across brushes");
+
+ prop = RNA_def_property(srna, "use_unified_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_WEIGHT);
+ RNA_def_property_ui_text(prop,
+ "Use Unified Weight",
+ "Instead of per-brush weight, the weight is shared across brushes");
+
+ prop = RNA_def_property(srna, "use_unified_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_COLOR);
+ RNA_def_property_ui_text(
+ prop, "Use Unified Color", "Instead of per-brush color, the color is shared across brushes");
+
+ /* unified paint settings that override the equivalent settings
+ * from the active brush */
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_funcs(prop, NULL, "rna_UnifiedPaintSettings_size_set", NULL);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS * 10);
+ RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 1, -1);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the brush");
+ RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
+
+ prop = RNA_def_property(srna, "unprojected_radius", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_funcs(
+ prop, NULL, "rna_UnifiedPaintSettings_unprojected_radius_set", NULL);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_range(prop, 0.001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001, 1, 0, -1);
+ RNA_def_property_ui_text(prop, "Unprojected Radius", "Radius of brush in Blender units");
+ RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_radius_update");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(
+ prop, "Strength", "How powerful the effect of the brush is when applied");
+ RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Weight", "Weight to assign in vertex groups");
+ RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "rgb");
+ RNA_def_property_ui_text(prop, "Color", "");
+ RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
+
+ prop = RNA_def_property(srna, "secondary_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "secondary_rgb");
+ RNA_def_property_ui_text(prop, "Secondary Color", "");
+ RNA_def_property_update(prop, 0, "rna_UnifiedPaintSettings_update");
+
+ prop = RNA_def_property(srna, "use_pressure_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_SIZE_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(prop, "Size Pressure", "Enable tablet pressure sensitivity for size");
+
+ prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", UNIFIED_PAINT_BRUSH_ALPHA_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
+
+ prop = RNA_def_property(srna, "use_locked_size", PROP_ENUM, PROP_NONE); /* as an enum */
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, brush_size_unit_items);
+ RNA_def_property_ui_text(
+ prop, "Radius Unit", "Measure brush size relative to the view or the scene ");
+}
+
+static void rna_def_curve_paint_settings(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "CurvePaintSettings", NULL);
+ RNA_def_struct_path_func(srna, "rna_CurvePaintSettings_path");
+ RNA_def_struct_ui_text(srna, "Curve Paint Settings", "");
+
+ static const EnumPropertyItem curve_type_items[] = {
+ {CU_POLY, "POLY", 0, "Poly", ""},
+ {CU_BEZIER, "BEZIER", 0, "Bezier", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "curve_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "curve_type");
+ RNA_def_property_enum_items(prop, curve_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of curve to use for new strokes");
+
+ prop = RNA_def_property(srna, "use_corners_detect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_CORNERS_DETECT);
+ RNA_def_property_ui_text(prop, "Detect Corners", "Detect corners and use non-aligned handles");
+
+ prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_PRESSURE_RADIUS);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(prop, "Use Pressure", "Map tablet pressure to curve radius");
+
+ prop = RNA_def_property(srna, "use_stroke_endpoints", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_ENDPOINTS);
+ RNA_def_property_ui_text(prop, "Only First", "Use the start of the stroke for the depth");
+
+ prop = RNA_def_property(srna, "use_offset_absolute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", CURVE_PAINT_FLAG_DEPTH_STROKE_OFFSET_ABS);
+ RNA_def_property_ui_text(
+ prop, "Absolute Offset", "Apply a fixed offset (don't scale by the radius)");
+
+ prop = RNA_def_property(srna, "error_threshold", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(prop, "Tolerance", "Allow deviation for a smoother, less precise line");
+
+ prop = RNA_def_property(srna, "fit_method", PROP_ENUM, PROP_PIXEL);
+ RNA_def_property_enum_sdna(prop, NULL, "fit_method");
+ RNA_def_property_enum_items(prop, rna_enum_curve_fit_method_items);
+ RNA_def_property_ui_text(prop, "Method", "Curve fitting method");
+
+ prop = RNA_def_property(srna, "corner_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, 0, M_PI);
+ RNA_def_property_ui_text(prop, "Corner Angle", "Angles above this are considered corners");
+
+ prop = RNA_def_property(srna, "radius_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Radius Min",
+ "Minimum radius when the minimum pressure is applied (also the minimum when tapering)");
+
+ prop = RNA_def_property(srna, "radius_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0, 10, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Radius Max",
+ "Radius to use when the maximum pressure is applied (or when a tablet isn't used)");
+
+ prop = RNA_def_property(srna, "radius_taper_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Radius Min", "Taper factor for the radius of each point along the curve");
+
+ prop = RNA_def_property(srna, "radius_taper_end", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Radius Max", "Taper factor for the radius of each point along the curve");
+
+ prop = RNA_def_property(srna, "surface_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Offset", "Offset the stroke from the surface");
+
+ static const EnumPropertyItem depth_mode_items[] = {
+ {CURVE_PAINT_PROJECT_CURSOR, "CURSOR", 0, "Cursor", ""},
+ {CURVE_PAINT_PROJECT_SURFACE, "SURFACE", 0, "Surface", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "depth_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "depth_mode");
+ RNA_def_property_enum_items(prop, depth_mode_items);
+ RNA_def_property_ui_text(prop, "Depth", "Method of projecting depth");
+
+ static const EnumPropertyItem surface_plane_items[] = {
+ {CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW,
+ "NORMAL_VIEW",
+ 0,
+ "Normal/View",
+ "Display perpendicular to the surface"},
+ {CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE,
+ "NORMAL_SURFACE",
+ 0,
+ "Normal/Surface",
+ "Display aligned to the surface"},
+ {CURVE_PAINT_SURFACE_PLANE_VIEW, "VIEW", 0, "View", "Display aligned to the viewport"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "surface_plane", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "surface_plane");
+ RNA_def_property_enum_items(prop, surface_plane_items);
+ RNA_def_property_ui_text(prop, "Plane", "Plane for projected stroke");
+}
+
+static void rna_def_statvis(BlenderRNA *brna)
+{
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem stat_type[] = {
+ {SCE_STATVIS_OVERHANG, "OVERHANG", 0, "Overhang", ""},
+ {SCE_STATVIS_THICKNESS, "THICKNESS", 0, "Thickness", ""},
+ {SCE_STATVIS_INTERSECT, "INTERSECT", 0, "Intersect", ""},
+ {SCE_STATVIS_DISTORT, "DISTORT", 0, "Distortion", ""},
+ {SCE_STATVIS_SHARP, "SHARP", 0, "Sharp", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MeshStatVis", NULL);
+ RNA_def_struct_path_func(srna, "rna_MeshStatVis_path");
+ RNA_def_struct_ui_text(srna, "Mesh Visualize Statistics", "");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, stat_type);
+ RNA_def_property_ui_text(prop, "Type", "Type of data to visualize/check");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ /* overhang */
+ prop = RNA_def_property(srna, "overhang_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "overhang_min");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 0.001, 3);
+ RNA_def_property_ui_text(prop, "Overhang Min", "Minimum angle to display");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ prop = RNA_def_property(srna, "overhang_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "overhang_max");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "Overhang Max", "Maximum angle to display");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ prop = RNA_def_property(srna, "overhang_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "overhang_axis");
+ RNA_def_property_enum_items(prop, rna_enum_object_axis_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ /* thickness */
+ prop = RNA_def_property(srna, "thickness_min", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "thickness_min");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1000.0);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Thickness Min", "Minimum for measuring thickness");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ prop = RNA_def_property(srna, "thickness_max", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "thickness_max");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1000.0);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0, 0.001, 3);
+ RNA_def_property_ui_text(prop, "Thickness Max", "Maximum for measuring thickness");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ prop = RNA_def_property(srna, "thickness_samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "thickness_samples");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples to test per face");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ /* distort */
+ prop = RNA_def_property(srna, "distort_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "distort_min");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ prop = RNA_def_property(srna, "distort_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "distort_max");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, 0.0f, DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ /* sharp */
+ prop = RNA_def_property(srna, "sharp_min", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "sharp_min");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "Distort Min", "Minimum angle to display");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
+
+ prop = RNA_def_property(srna, "sharp_max", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "sharp_max");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f));
+ RNA_def_property_ui_range(prop, -DEG2RADF(180.0f), DEG2RADF(180.0f), 10, 3);
+ RNA_def_property_ui_text(prop, "Distort Max", "Maximum angle to display");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_EditMesh_update");
}
static void rna_def_unit_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem unit_systems[] = {
- {USER_UNIT_NONE, "NONE", 0, "None", ""},
- {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
- {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem rotation_units[] = {
- {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
- {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "UnitSettings", NULL);
- RNA_def_struct_ui_text(srna, "Unit Settings", "");
- RNA_def_struct_nested(brna, srna, "Scene");
- RNA_def_struct_path_func(srna, "rna_UnitSettings_path");
-
- /* Units */
- prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, unit_systems);
- RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
- RNA_def_property_update(prop, NC_WINDOW, "rna_UnitSettings_system_update");
-
- prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rotation_units);
- RNA_def_property_ui_text(prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Unit Scale", "Scale to use when converting between blender units and dimensions."
- " When working at microscopic or astronomical scale, a small or large unit scale"
- " respectively can be used to avoid numerical precision problems");
- RNA_def_property_range(prop, 0.00001, 100000.0);
- RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 6);
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
- RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "length_unit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_length_unit_itemf");
- RNA_def_property_ui_text(prop, "Length Unit", "Unit that will be used to display length values");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "mass_unit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_mass_unit_itemf");
- RNA_def_property_ui_text(prop, "Mass Unit", "Unit that will be used to display mass values");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "time_unit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf");
- RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem unit_systems[] = {
+ {USER_UNIT_NONE, "NONE", 0, "None", ""},
+ {USER_UNIT_METRIC, "METRIC", 0, "Metric", ""},
+ {USER_UNIT_IMPERIAL, "IMPERIAL", 0, "Imperial", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem rotation_units[] = {
+ {0, "DEGREES", 0, "Degrees", "Use degrees for measuring angles and rotations"},
+ {USER_UNIT_ROT_RADIANS, "RADIANS", 0, "Radians", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "UnitSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Unit Settings", "");
+ RNA_def_struct_nested(brna, srna, "Scene");
+ RNA_def_struct_path_func(srna, "rna_UnitSettings_path");
+
+ /* Units */
+ prop = RNA_def_property(srna, "system", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, unit_systems);
+ RNA_def_property_ui_text(prop, "Unit System", "The unit system to use for button display");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_UnitSettings_system_update");
+
+ prop = RNA_def_property(srna, "system_rotation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rotation_units);
+ RNA_def_property_ui_text(
+ prop, "Rotation Units", "Unit to use for displaying/editing rotation values");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "scale_length", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(
+ prop,
+ "Unit Scale",
+ "Scale to use when converting between blender units and dimensions."
+ " When working at microscopic or astronomical scale, a small or large unit scale"
+ " respectively can be used to avoid numerical precision problems");
+ RNA_def_property_range(prop, 0.00001, 100000.0);
+ RNA_def_property_ui_range(prop, 0.001, 100.0, 0.1, 6);
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "use_separate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_UNIT_OPT_SPLIT);
+ RNA_def_property_ui_text(prop, "Separate Units", "Display units in pairs (e.g. 1m 0cm)");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "length_unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_length_unit_itemf");
+ RNA_def_property_ui_text(prop, "Length Unit", "Unit that will be used to display length values");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "mass_unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_mass_unit_itemf");
+ RNA_def_property_ui_text(prop, "Mass Unit", "Unit that will be used to display mass values");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "time_unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UnitSettings_time_unit_itemf");
+ RNA_def_property_ui_text(prop, "Time Unit", "Unit that will be used to display time values");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
}
void rna_def_view_layer_common(StructRNA *srna, const bool scene)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- if (scene) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set");
- else RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Name", "View layer name");
- RNA_def_struct_name_property(srna, prop);
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- if (scene) {
- prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
- RNA_def_property_struct_type(prop, "Material");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Material Override",
- "Material to override all other materials in this view layer");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_material_override_update");
-
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Samples", "Override number of render samples for this view layer, "
- "0 will use the scene setting");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Alpha Threshold",
- "Z, Index, normal, UV and vector passes are only affected by surfaces with "
- "alpha transparency equal to or higher than this threshold");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- }
-
- /* layer options */
- prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
- RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
- RNA_def_property_ui_text(prop, "Zmask Negate",
- "For Zmask, only render what is behind solid z values instead of in front");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
- RNA_def_property_ui_text(prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
- RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
- RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
- RNA_def_property_ui_text(prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
- RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_ao", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_AO);
- RNA_def_property_ui_text(prop, "Ambient Occlusion", "Render Ambient Occlusion in this Layer");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
- RNA_def_property_ui_text(prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
- RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* passes */
- prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
- RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
- RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
- RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
- RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
- RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
- RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
- RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
- RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
- RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
- RNA_def_property_ui_text(prop, "Ambient Occlusion", "Deliver Ambient Occlusion pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
- RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
- RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
- RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
- RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
- RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
- RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
- RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
- RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
- RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
- RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
- RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT);
- RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT);
- RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR);
- RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass");
- if (scene) RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
- else RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ if (scene)
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ViewLayer_name_set");
+ else
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Name", "View layer name");
+ RNA_def_struct_name_property(srna, prop);
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ if (scene) {
+ prop = RNA_def_property(srna, "material_override", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mat_override");
+ RNA_def_property_struct_type(prop, "Material");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Material Override", "Material to override all other materials in this view layer");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_material_override_update");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop,
+ "Samples",
+ "Override number of render samples for this view layer, "
+ "0 will use the scene setting");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "pass_alpha_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(
+ prop,
+ "Alpha Threshold",
+ "Z, Index, normal, UV and vector passes are only affected by surfaces with "
+ "alpha transparency equal to or higher than this threshold");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ }
+
+ /* layer options */
+ prop = RNA_def_property(srna, "use_zmask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZMASK);
+ RNA_def_property_ui_text(prop, "Zmask", "Only render what's in front of the solid z values");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "invert_zmask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_NEG_ZMASK);
+ RNA_def_property_ui_text(
+ prop,
+ "Zmask Negate",
+ "For Zmask, only render what is behind solid z values instead of in front");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_all_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ALL_Z);
+ RNA_def_property_ui_text(
+ prop, "All Z", "Fill in Z values for solid faces in invisible layers, for masking");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_solid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SOLID);
+ RNA_def_property_ui_text(prop, "Solid", "Render Solid faces in this Layer");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_halo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_HALO);
+ RNA_def_property_ui_text(prop, "Halo", "Render Halos in this Layer (on top of Solid)");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_ztransp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_ZTRA);
+ RNA_def_property_ui_text(
+ prop, "ZTransp", "Render Z-Transparent faces in this Layer (on top of Solid and Halos)");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_sky", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_SKY);
+ RNA_def_property_ui_text(prop, "Sky", "Render Sky in this Layer");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_ao", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_AO);
+ RNA_def_property_ui_text(prop, "Ambient Occlusion", "Render Ambient Occlusion in this Layer");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_edge_enhance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_EDGE);
+ RNA_def_property_ui_text(
+ prop, "Edge", "Render Edge-enhance in this Layer (only works for Solid faces)");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_strand", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_STRAND);
+ RNA_def_property_ui_text(prop, "Strand", "Render Strands in this Layer");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* passes */
+ prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED);
+ RNA_def_property_ui_text(prop, "Combined", "Deliver full combined RGBA buffer");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_Z);
+ RNA_def_property_ui_text(prop, "Z", "Deliver Z values pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_vector", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_VECTOR);
+ RNA_def_property_ui_text(prop, "Vector", "Deliver speed vector pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_normal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_NORMAL);
+ RNA_def_property_ui_text(prop, "Normal", "Deliver normal pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_UV);
+ RNA_def_property_ui_text(prop, "UV", "Deliver texture UV pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_mist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_MIST);
+ RNA_def_property_ui_text(prop, "Mist", "Deliver mist factor pass (0.0-1.0)");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_object_index", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXOB);
+ RNA_def_property_ui_text(prop, "Object Index", "Deliver object index pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_material_index", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_INDEXMA);
+ RNA_def_property_ui_text(prop, "Material Index", "Deliver material index pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_shadow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SHADOW);
+ RNA_def_property_ui_text(prop, "Shadow", "Deliver shadow pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_AO);
+ RNA_def_property_ui_text(prop, "Ambient Occlusion", "Deliver Ambient Occlusion pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_EMIT);
+ RNA_def_property_ui_text(prop, "Emit", "Deliver emission pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_environment", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_ENVIRONMENT);
+ RNA_def_property_ui_text(prop, "Environment", "Deliver environment lighting pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_diffuse_direct", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_DIRECT);
+ RNA_def_property_ui_text(prop, "Diffuse Direct", "Deliver diffuse direct pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_diffuse_indirect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_INDIRECT);
+ RNA_def_property_ui_text(prop, "Diffuse Indirect", "Deliver diffuse indirect pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_diffuse_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_DIFFUSE_COLOR);
+ RNA_def_property_ui_text(prop, "Diffuse Color", "Deliver diffuse color pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_glossy_direct", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_DIRECT);
+ RNA_def_property_ui_text(prop, "Glossy Direct", "Deliver glossy direct pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_glossy_indirect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_INDIRECT);
+ RNA_def_property_ui_text(prop, "Glossy Indirect", "Deliver glossy indirect pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_glossy_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_GLOSSY_COLOR);
+ RNA_def_property_ui_text(prop, "Glossy Color", "Deliver glossy color pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_transmission_direct", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_DIRECT);
+ RNA_def_property_ui_text(prop, "Transmission Direct", "Deliver transmission direct pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_transmission_indirect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_INDIRECT);
+ RNA_def_property_ui_text(prop, "Transmission Indirect", "Deliver transmission indirect pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_transmission_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_TRANSM_COLOR);
+ RNA_def_property_ui_text(prop, "Transmission Color", "Deliver transmission color pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_subsurface_direct", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_DIRECT);
+ RNA_def_property_ui_text(prop, "Subsurface Direct", "Deliver subsurface direct pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_subsurface_indirect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_INDIRECT);
+ RNA_def_property_ui_text(prop, "Subsurface Indirect", "Deliver subsurface indirect pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "use_pass_subsurface_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_SUBSURFACE_COLOR);
+ RNA_def_property_ui_text(prop, "Subsurface Color", "Deliver subsurface color pass");
+ if (scene)
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_ViewLayer_pass_update");
+ else
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_freestyle_modules(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "FreestyleModules");
- srna = RNA_def_struct(brna, "FreestyleModules", NULL);
- RNA_def_struct_sdna(srna, "FreestyleSettings");
- RNA_def_struct_ui_text(srna, "Style Modules", "A list of style modules (to be applied from top to bottom)");
-
- func = RNA_def_function(srna, "new", "rna_FreestyleSettings_module_add");
- RNA_def_function_ui_description(func, "Add a style module to scene render layer Freestyle settings");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_pointer(func, "module", "FreestyleModuleSettings", "", "Newly created style module");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_FreestyleSettings_module_remove");
- RNA_def_function_ui_description(func, "Remove a style module from scene render layer Freestyle settings");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "module", "FreestyleModuleSettings", "", "Style module to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "FreestyleModules");
+ srna = RNA_def_struct(brna, "FreestyleModules", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleSettings");
+ RNA_def_struct_ui_text(
+ srna, "Style Modules", "A list of style modules (to be applied from top to bottom)");
+
+ func = RNA_def_function(srna, "new", "rna_FreestyleSettings_module_add");
+ RNA_def_function_ui_description(func,
+ "Add a style module to scene render layer Freestyle settings");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_pointer(
+ func, "module", "FreestyleModuleSettings", "", "Newly created style module");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_FreestyleSettings_module_remove");
+ RNA_def_function_ui_description(
+ func, "Remove a style module from scene render layer Freestyle settings");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "module", "FreestyleModuleSettings", "", "Style module to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_freestyle_linesets(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "Linesets");
- srna = RNA_def_struct(brna, "Linesets", NULL);
- RNA_def_struct_sdna(srna, "FreestyleSettings");
- RNA_def_struct_ui_text(srna, "Line Sets", "Line sets for associating lines and style parameters");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "FreestyleLineSet");
- RNA_def_property_pointer_funcs(prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_FreestyleSettings_active_lineset_index_get",
- "rna_FreestyleSettings_active_lineset_index_set",
- "rna_FreestyleSettings_active_lineset_index_range");
- RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- func = RNA_def_function(srna, "new", "rna_FreestyleSettings_lineset_add");
- RNA_def_function_ui_description(func, "Add a line set to scene render layer Freestyle settings");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID);
- parm = RNA_def_string(func, "name", "LineSet", 0, "", "New name for the line set (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Newly created line set");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_FreestyleSettings_lineset_remove");
- RNA_def_function_ui_description(func, "Remove a line set from scene render layer Freestyle settings");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Line set to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "Linesets");
+ srna = RNA_def_struct(brna, "Linesets", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleSettings");
+ RNA_def_struct_ui_text(
+ srna, "Line Sets", "Line sets for associating lines and style parameters");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FreestyleLineSet");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_FreestyleSettings_active_lineset_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Active Line Set", "Active line set being displayed");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_funcs(prop,
+ "rna_FreestyleSettings_active_lineset_index_get",
+ "rna_FreestyleSettings_active_lineset_index_set",
+ "rna_FreestyleSettings_active_lineset_index_range");
+ RNA_def_property_ui_text(prop, "Active Line Set Index", "Index of active line set slot");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ func = RNA_def_function(srna, "new", "rna_FreestyleSettings_lineset_add");
+ RNA_def_function_ui_description(func, "Add a line set to scene render layer Freestyle settings");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_SELF_ID);
+ parm = RNA_def_string(func, "name", "LineSet", 0, "", "New name for the line set (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Newly created line set");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_FreestyleSettings_lineset_remove");
+ RNA_def_function_ui_description(func,
+ "Remove a line set from scene render layer Freestyle settings");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "lineset", "FreestyleLineSet", "", "Line set to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
void rna_def_freestyle_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem edge_type_negation_items[] = {
- {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given edge type conditions"},
- {FREESTYLE_LINESET_FE_NOT, "EXCLUSIVE", 0, "Exclusive",
- "Select feature edges not satisfying the given edge type conditions"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem edge_type_combination_items[] = {
- {0, "OR", 0, "Logical OR", "Select feature edges satisfying at least one of edge type conditions"},
- {FREESTYLE_LINESET_FE_AND, "AND", 0, "Logical AND",
- "Select feature edges satisfying all edge type conditions"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem collection_negation_items[] = {
- {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges belonging to some object in the group"},
- {FREESTYLE_LINESET_GR_NOT, "EXCLUSIVE", 0, "Exclusive",
- "Select feature edges not belonging to any object in the group"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem face_mark_negation_items[] = {
- {0, "INCLUSIVE", 0, "Inclusive", "Select feature edges satisfying the given face mark conditions"},
- {FREESTYLE_LINESET_FM_NOT, "EXCLUSIVE", 0, "Exclusive",
- "Select feature edges not satisfying the given face mark conditions"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem face_mark_condition_items[] = {
- {0, "ONE", 0, "One Face", "Select a feature edge if either of its adjacent faces is marked"},
- {FREESTYLE_LINESET_FM_BOTH, "BOTH", 0, "Both Faces",
- "Select a feature edge if both of its adjacent faces are marked"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem freestyle_ui_mode_items[] = {
- {FREESTYLE_CONTROL_SCRIPT_MODE, "SCRIPT", 0, "Python Scripting Mode",
- "Advanced mode for using style modules written in Python"},
- {FREESTYLE_CONTROL_EDITOR_MODE, "EDITOR", 0, "Parameter Editor Mode",
- "Basic mode for interactive style parameter editing"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem visibility_items[] = {
- {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
- {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
- {FREESTYLE_QI_RANGE, "RANGE", 0, "QI Range",
- "Select feature edges within a range of quantitative invisibility (QI) values"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* FreestyleLineSet */
-
- srna = RNA_def_struct(brna, "FreestyleLineSet", NULL);
- RNA_def_struct_ui_text(srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
-
- /* access to line style settings is redirected through functions
- * to allow proper id-buttons functionality
- */
- prop = RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "FreestyleLineStyle");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_pointer_funcs(prop, "rna_FreestyleLineSet_linestyle_get",
- "rna_FreestyleLineSet_linestyle_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
- RNA_def_property_ui_text(prop, "Render", "Enable or disable this line set during stroke rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
- RNA_def_property_ui_text(prop, "Selection by Visibility", "Select feature edges based on visibility");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
- RNA_def_property_ui_text(prop, "Selection by Edge Types", "Select feature edges based on edge types");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_by_collection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
- RNA_def_property_ui_text(prop, "Selection by Collection", "Select feature edges based on a collection of objects");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
- RNA_def_property_ui_text(prop, "Selection by Image Border",
- "Select feature edges by image border (less memory consumption)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
- RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, edge_type_negation_items);
- RNA_def_property_ui_text(prop, "Edge Type Negation",
- "Specify either inclusion or exclusion of feature edges selected by edge types");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, edge_type_combination_items);
- RNA_def_property_ui_text(prop, "Edge Type Combination",
- "Specify a logical combination of selection conditions on feature edge types");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "group");
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collection", "A collection of objects based on which feature edges are selected");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "collection_negation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, collection_negation_items);
- RNA_def_property_ui_text(prop, "Collection Negation",
- "Specify either inclusion or exclusion of feature edges belonging to a collection of objects");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, face_mark_negation_items);
- RNA_def_property_ui_text(prop, "Face Mark Negation",
- "Specify either inclusion or exclusion of feature edges selected by face marks");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, face_mark_condition_items);
- RNA_def_property_ui_text(prop, "Face Mark Condition",
- "Specify a feature edge selection condition based on face marks");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
- RNA_def_property_ui_text(prop, "Silhouette",
- "Select silhouettes (edges at the boundary of visible and hidden faces)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
- RNA_def_property_ui_text(prop, "Border", "Select border edges (open mesh edges)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
- RNA_def_property_ui_text(prop, "Crease",
- "Select crease edges (those between two faces making an angle smaller than the Crease Angle)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
- RNA_def_property_ui_text(prop, "Ridge & Valley",
- "Select ridges and valleys (boundary lines between convex and concave areas of surface)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
- RNA_def_property_ui_text(prop, "Suggestive Contour", "Select suggestive contours (almost silhouette/contour edges)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
- RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
- RNA_def_property_ui_text(prop, "Contour", "Select contours (outer silhouettes of each object)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
- RNA_def_property_ui_text(prop, "External Contour",
- "Select external contours (outer silhouettes of occluding and occluded objects)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
- RNA_def_property_ui_text(prop, "Edge Mark", "Select edge marks (edges annotated by Freestyle edge marks)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
- RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette edges");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
- RNA_def_property_ui_text(prop, "Border", "Exclude border edges");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_crease", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
- RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_ridge_valley", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
- RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
- RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_material_boundary", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
- RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_contour", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
- RNA_def_property_ui_text(prop, "Contour", "Exclude contours");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_external_contour", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
- RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
- RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
- RNA_def_property_ui_icon(prop, ICON_X, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "qi");
- RNA_def_property_enum_items(prop, visibility_items);
- RNA_def_property_ui_text(prop, "Visibility", "Determine how to use visibility for feature edge selection");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "qi_start");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "qi_end");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- /* FreestyleModuleSettings */
-
- srna = RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
- RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
- RNA_def_struct_ui_text(srna, "Freestyle Module", "Style module configuration for specifying a style module");
-
- prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Text");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Style Module", "Python script to define a style module");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
- RNA_def_property_ui_text(prop, "Use", "Enable or disable this style module during stroke rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- /* FreestyleSettings */
-
- srna = RNA_def_struct(brna, "FreestyleSettings", NULL);
- RNA_def_struct_sdna(srna, "FreestyleConfig");
- RNA_def_struct_nested(brna, srna, "ViewLayer");
- RNA_def_struct_ui_text(srna, "Freestyle Settings", "Freestyle settings for a ViewLayer data-block");
-
- prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
- RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
- RNA_def_property_ui_text(prop, "Style Modules", "A list of style modules (to be applied from top to bottom)");
- rna_def_freestyle_modules(brna, prop);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
- RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
- RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
- RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
- RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
- RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
- RNA_def_property_ui_text(prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
- RNA_def_property_ui_text(prop, "Advanced Options",
- "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "use_view_map_cache", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_VIEW_MAP_CACHE);
- RNA_def_property_ui_text(prop, "View Map Cache",
- "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update");
-
- prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
- RNA_def_property_range(prop, 0.0, 1000.0);
- RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
- RNA_def_property_range(prop, -1000.0, 1000.0);
- RNA_def_property_ui_text(prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "crease_angle");
- RNA_def_property_range(prop, 0.0, DEG2RAD(180.0));
- RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold for detecting crease edges");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
- RNA_def_property_struct_type(prop, "FreestyleLineSet");
- RNA_def_property_ui_text(prop, "Line Sets", "");
- rna_def_freestyle_linesets(brna, prop);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem edge_type_negation_items[] = {
+ {0,
+ "INCLUSIVE",
+ 0,
+ "Inclusive",
+ "Select feature edges satisfying the given edge type conditions"},
+ {FREESTYLE_LINESET_FE_NOT,
+ "EXCLUSIVE",
+ 0,
+ "Exclusive",
+ "Select feature edges not satisfying the given edge type conditions"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem edge_type_combination_items[] = {
+ {0,
+ "OR",
+ 0,
+ "Logical OR",
+ "Select feature edges satisfying at least one of edge type conditions"},
+ {FREESTYLE_LINESET_FE_AND,
+ "AND",
+ 0,
+ "Logical AND",
+ "Select feature edges satisfying all edge type conditions"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem collection_negation_items[] = {
+ {0,
+ "INCLUSIVE",
+ 0,
+ "Inclusive",
+ "Select feature edges belonging to some object in the group"},
+ {FREESTYLE_LINESET_GR_NOT,
+ "EXCLUSIVE",
+ 0,
+ "Exclusive",
+ "Select feature edges not belonging to any object in the group"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem face_mark_negation_items[] = {
+ {0,
+ "INCLUSIVE",
+ 0,
+ "Inclusive",
+ "Select feature edges satisfying the given face mark conditions"},
+ {FREESTYLE_LINESET_FM_NOT,
+ "EXCLUSIVE",
+ 0,
+ "Exclusive",
+ "Select feature edges not satisfying the given face mark conditions"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem face_mark_condition_items[] = {
+ {0, "ONE", 0, "One Face", "Select a feature edge if either of its adjacent faces is marked"},
+ {FREESTYLE_LINESET_FM_BOTH,
+ "BOTH",
+ 0,
+ "Both Faces",
+ "Select a feature edge if both of its adjacent faces are marked"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem freestyle_ui_mode_items[] = {
+ {FREESTYLE_CONTROL_SCRIPT_MODE,
+ "SCRIPT",
+ 0,
+ "Python Scripting Mode",
+ "Advanced mode for using style modules written in Python"},
+ {FREESTYLE_CONTROL_EDITOR_MODE,
+ "EDITOR",
+ 0,
+ "Parameter Editor Mode",
+ "Basic mode for interactive style parameter editing"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem visibility_items[] = {
+ {FREESTYLE_QI_VISIBLE, "VISIBLE", 0, "Visible", "Select visible feature edges"},
+ {FREESTYLE_QI_HIDDEN, "HIDDEN", 0, "Hidden", "Select hidden feature edges"},
+ {FREESTYLE_QI_RANGE,
+ "RANGE",
+ 0,
+ "QI Range",
+ "Select feature edges within a range of quantitative invisibility (QI) values"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* FreestyleLineSet */
+
+ srna = RNA_def_struct(brna, "FreestyleLineSet", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Freestyle Line Set", "Line set for associating lines and style parameters");
+
+ /* access to line style settings is redirected through functions
+ * to allow proper id-buttons functionality
+ */
+ prop = RNA_def_property(srna, "linestyle", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FreestyleLineStyle");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_pointer_funcs(prop,
+ "rna_FreestyleLineSet_linestyle_get",
+ "rna_FreestyleLineSet_linestyle_set",
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Line Style", "Line style settings");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Line Set Name", "Line set name");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_LINESET_ENABLED);
+ RNA_def_property_ui_text(
+ prop, "Render", "Enable or disable this line set during stroke rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_by_visibility", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_VISIBILITY);
+ RNA_def_property_ui_text(
+ prop, "Selection by Visibility", "Select feature edges based on visibility");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_by_edge_types", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_EDGE_TYPES);
+ RNA_def_property_ui_text(
+ prop, "Selection by Edge Types", "Select feature edges based on edge types");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_by_collection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_GROUP);
+ RNA_def_property_ui_text(
+ prop, "Selection by Collection", "Select feature edges based on a collection of objects");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_by_image_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_IMAGE_BORDER);
+ RNA_def_property_ui_text(prop,
+ "Selection by Image Border",
+ "Select feature edges by image border (less memory consumption)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_by_face_marks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "selection", FREESTYLE_SEL_FACE_MARK);
+ RNA_def_property_ui_text(prop, "Selection by Face Marks", "Select feature edges by face marks");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "edge_type_negation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, edge_type_negation_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Edge Type Negation",
+ "Specify either inclusion or exclusion of feature edges selected by edge types");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "edge_type_combination", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, edge_type_combination_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Edge Type Combination",
+ "Specify a logical combination of selection conditions on feature edge types");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "group");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Collection", "A collection of objects based on which feature edges are selected");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "collection_negation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, collection_negation_items);
+ RNA_def_property_ui_text(prop,
+ "Collection Negation",
+ "Specify either inclusion or exclusion of feature edges belonging to a "
+ "collection of objects");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, face_mark_negation_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Face Mark Negation",
+ "Specify either inclusion or exclusion of feature edges selected by face marks");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "face_mark_condition", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, face_mark_condition_items);
+ RNA_def_property_ui_text(prop,
+ "Face Mark Condition",
+ "Specify a feature edge selection condition based on face marks");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_silhouette", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SILHOUETTE);
+ RNA_def_property_ui_text(
+ prop,
+ "Silhouette",
+ "Select silhouettes (edges at the boundary of visible and hidden faces)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_BORDER);
+ RNA_def_property_ui_text(prop, "Border", "Select border edges (open mesh edges)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CREASE);
+ RNA_def_property_ui_text(prop,
+ "Crease",
+ "Select crease edges (those between two faces making an angle smaller "
+ "than the Crease Angle)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_ridge_valley", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_RIDGE_VALLEY);
+ RNA_def_property_ui_text(
+ prop,
+ "Ridge & Valley",
+ "Select ridges and valleys (boundary lines between convex and concave areas of surface)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
+ RNA_def_property_ui_text(
+ prop, "Suggestive Contour", "Select suggestive contours (almost silhouette/contour edges)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Material Boundary", "Select edges at material boundaries");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Contour", "Select contours (outer silhouettes of each object)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_external_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
+ RNA_def_property_ui_text(
+ prop,
+ "External Contour",
+ "Select external contours (outer silhouettes of occluding and occluded objects)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "select_edge_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edge_types", FREESTYLE_FE_EDGE_MARK);
+ RNA_def_property_ui_text(
+ prop, "Edge Mark", "Select edge marks (edges annotated by Freestyle edge marks)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_silhouette", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SILHOUETTE);
+ RNA_def_property_ui_text(prop, "Silhouette", "Exclude silhouette edges");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_BORDER);
+ RNA_def_property_ui_text(prop, "Border", "Exclude border edges");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CREASE);
+ RNA_def_property_ui_text(prop, "Crease", "Exclude crease edges");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_ridge_valley", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_RIDGE_VALLEY);
+ RNA_def_property_ui_text(prop, "Ridge & Valley", "Exclude ridges and valleys");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_suggestive_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_SUGGESTIVE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Suggestive Contour", "Exclude suggestive contours");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_material_boundary", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_MATERIAL_BOUNDARY);
+ RNA_def_property_ui_text(prop, "Material Boundary", "Exclude edges at material boundaries");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_CONTOUR);
+ RNA_def_property_ui_text(prop, "Contour", "Exclude contours");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_external_contour", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EXTERNAL_CONTOUR);
+ RNA_def_property_ui_text(prop, "External Contour", "Exclude external contours");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "exclude_edge_mark", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "exclude_edge_types", FREESTYLE_FE_EDGE_MARK);
+ RNA_def_property_ui_text(prop, "Edge Mark", "Exclude edge marks");
+ RNA_def_property_ui_icon(prop, ICON_X, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "visibility", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "qi");
+ RNA_def_property_enum_items(prop, visibility_items);
+ RNA_def_property_ui_text(
+ prop, "Visibility", "Determine how to use visibility for feature edge selection");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "qi_start", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "qi_start");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Start", "First QI value of the QI range");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "qi_end", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "qi_end");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "End", "Last QI value of the QI range");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ /* FreestyleModuleSettings */
+
+ srna = RNA_def_struct(brna, "FreestyleModuleSettings", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleModuleConfig");
+ RNA_def_struct_ui_text(
+ srna, "Freestyle Module", "Style module configuration for specifying a style module");
+
+ prop = RNA_def_property(srna, "script", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Text");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Style Module", "Python script to define a style module");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "is_displayed", 1);
+ RNA_def_property_ui_text(
+ prop, "Use", "Enable or disable this style module during stroke rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ /* FreestyleSettings */
+
+ srna = RNA_def_struct(brna, "FreestyleSettings", NULL);
+ RNA_def_struct_sdna(srna, "FreestyleConfig");
+ RNA_def_struct_nested(brna, srna, "ViewLayer");
+ RNA_def_struct_ui_text(
+ srna, "Freestyle Settings", "Freestyle settings for a ViewLayer data-block");
+
+ prop = RNA_def_property(srna, "modules", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "modules", NULL);
+ RNA_def_property_struct_type(prop, "FreestyleModuleSettings");
+ RNA_def_property_ui_text(
+ prop, "Style Modules", "A list of style modules (to be applied from top to bottom)");
+ rna_def_freestyle_modules(brna, prop);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, freestyle_ui_mode_items);
+ RNA_def_property_ui_text(prop, "Control Mode", "Select the Freestyle control mode");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_culling", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_CULLING);
+ RNA_def_property_ui_text(prop, "Culling", "If enabled, out-of-view edges are ignored");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_suggestive_contours", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_SUGGESTIVE_CONTOURS_FLAG);
+ RNA_def_property_ui_text(prop, "Suggestive Contours", "Enable suggestive contours");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_ridges_and_valleys", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_RIDGES_AND_VALLEYS_FLAG);
+ RNA_def_property_ui_text(prop, "Ridges and Valleys", "Enable ridges and valleys");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_material_boundaries", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_MATERIAL_BOUNDARIES_FLAG);
+ RNA_def_property_ui_text(prop, "Material Boundaries", "Enable material boundaries");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_smoothness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_FACE_SMOOTHNESS_FLAG);
+ RNA_def_property_ui_text(
+ prop, "Face Smoothness", "Take face smoothness into account in view map calculation");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_advanced_options", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_ADVANCED_OPTIONS_FLAG);
+ RNA_def_property_ui_text(
+ prop,
+ "Advanced Options",
+ "Enable advanced edge detection options (sphere radius and Kr derivative epsilon)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "use_view_map_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FREESTYLE_VIEW_MAP_CACHE);
+ RNA_def_property_ui_text(
+ prop,
+ "View Map Cache",
+ "Keep the computed view map and avoid re-calculating it if mesh geometry is unchanged");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_view_map_cache_update");
+
+ prop = RNA_def_property(srna, "sphere_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sphere_radius");
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_text(prop, "Sphere Radius", "Sphere radius for computing curvatures");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "kr_derivative_epsilon", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dkr_epsilon");
+ RNA_def_property_range(prop, -1000.0, 1000.0);
+ RNA_def_property_ui_text(
+ prop, "Kr Derivative Epsilon", "Kr derivative epsilon for computing suggestive contours");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "crease_angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "crease_angle");
+ RNA_def_property_range(prop, 0.0, DEG2RAD(180.0));
+ RNA_def_property_ui_text(prop, "Crease Angle", "Angular threshold for detecting crease edges");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "linesets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "linesets", NULL);
+ RNA_def_property_struct_type(prop, "FreestyleLineSet");
+ RNA_def_property_ui_text(prop, "Line Sets", "");
+ rna_def_freestyle_linesets(brna, prop);
}
static void rna_def_bake_data(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "BakeSettings", NULL);
- RNA_def_struct_sdna(srna, "BakeData");
- RNA_def_struct_nested(brna, srna, "RenderSettings");
- RNA_def_struct_ui_text(srna, "Bake Data", "Bake data for a Scene data-block");
- RNA_def_struct_path_func(srna, "rna_BakeSettings_path");
-
- prop = RNA_def_property(srna, "cage_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Cage Object", "Object to use as cage "
- "instead of calculating the cage from the active object with cage extrusion");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "File Path", "Image filepath to use when saving externally");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "width", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 4, 10000);
- RNA_def_property_ui_text(prop, "Width", "Horizontal dimension of the baking map");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "height", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 4, 10000);
- RNA_def_property_ui_text(prop, "Height", "Vertical dimension of the baking map");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "margin", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_range(prop, 0, 64, 1, 1);
- RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "cage_extrusion", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
- RNA_def_property_ui_text(prop, "Cage Extrusion",
- "Distance to use for the inward ray cast when using selected to active");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "normal_space", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_space");
- RNA_def_property_enum_items(prop, rna_enum_normal_space_items);
- RNA_def_property_ui_text(prop, "Normal Space", "Choose normal space for baking");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "normal_r", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[0]");
- RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
- RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in red channel");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "normal_g", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[1]");
- RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
- RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in green channel");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "normal_b", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[2]");
- RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
- RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in blue channel");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "im_format");
- RNA_def_property_struct_type(prop, "ImageFormatSettings");
- RNA_def_property_ui_text(prop, "Image Format", "");
-
- prop = RNA_def_property(srna, "save_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "save_mode");
- RNA_def_property_enum_items(prop, rna_enum_bake_save_mode_items);
- RNA_def_property_ui_text(prop, "Save Mode", "Choose how to save the baking map");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* flags */
- prop = RNA_def_property(srna, "use_selected_to_active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_TO_ACTIVE);
- RNA_def_property_ui_text(prop, "Selected to Active",
- "Bake shading on the surface of selected objects to the active object");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_clear", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_CLEAR);
- RNA_def_property_ui_text(prop, "Clear",
- "Clear Images before baking (internal only)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_split_materials", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_SPLIT_MAT);
- RNA_def_property_ui_text(prop, "Split Materials",
- "Split external images per material (external only)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_automatic_name", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_AUTO_NAME);
- RNA_def_property_ui_text(prop, "Automatic Name",
- "Automatically name the output file with the pass type (external only)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_cage", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_CAGE);
- RNA_def_property_ui_text(prop, "Cage",
- "Cast rays to active object from a cage");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* custom passes flags */
- prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_AO);
- RNA_def_property_ui_text(prop, "Ambient Occlusion", "Add ambient occlusion contribution");
-
- prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_EMIT);
- RNA_def_property_ui_text(prop, "Emit", "Add emission contribution");
-
- prop = RNA_def_property(srna, "use_pass_direct", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_DIRECT);
- RNA_def_property_ui_text(prop, "Direct", "Add direct lighting contribution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_INDIRECT);
- RNA_def_property_ui_text(prop, "Indirect", "Add indirect lighting contribution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_COLOR);
- RNA_def_property_ui_text(prop, "Color", "Color the pass");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_DIFFUSE);
- RNA_def_property_ui_text(prop, "Diffuse", "Add diffuse contribution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_pass_glossy", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_GLOSSY);
- RNA_def_property_ui_text(prop, "Glossy", "Add glossy contribution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_pass_transmission", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_TRANSM);
- RNA_def_property_ui_text(prop, "Transmission", "Add transmission contribution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_pass_subsurface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_SUBSURFACE);
- RNA_def_property_ui_text(prop, "Subsurface", "Add subsurface contribution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "pass_filter", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "pass_filter");
- RNA_def_property_enum_items(prop, rna_enum_bake_pass_filter_type_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Pass Filter", "Passes to include in the active baking pass");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "BakeSettings", NULL);
+ RNA_def_struct_sdna(srna, "BakeData");
+ RNA_def_struct_nested(brna, srna, "RenderSettings");
+ RNA_def_struct_ui_text(srna, "Bake Data", "Bake data for a Scene data-block");
+ RNA_def_struct_path_func(srna, "rna_BakeSettings_path");
+
+ prop = RNA_def_property(srna, "cage_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Cage Object",
+ "Object to use as cage "
+ "instead of calculating the cage from the active object with cage extrusion");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "File Path", "Image filepath to use when saving externally");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "width", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 4, 10000);
+ RNA_def_property_ui_text(prop, "Width", "Horizontal dimension of the baking map");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "height", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 4, 10000);
+ RNA_def_property_ui_text(prop, "Height", "Vertical dimension of the baking map");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "margin", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 0, 64, 1, 1);
+ RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "cage_extrusion", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Cage Extrusion",
+ "Distance to use for the inward ray cast when using selected to active");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "normal_space", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_space");
+ RNA_def_property_enum_items(prop, rna_enum_normal_space_items);
+ RNA_def_property_ui_text(prop, "Normal Space", "Choose normal space for baking");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "normal_r", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[0]");
+ RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
+ RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in red channel");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "normal_g", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[1]");
+ RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
+ RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in green channel");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "normal_b", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "normal_swizzle[2]");
+ RNA_def_property_enum_items(prop, rna_enum_normal_swizzle_items);
+ RNA_def_property_ui_text(prop, "Normal Space", "Axis to bake in blue channel");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "im_format");
+ RNA_def_property_struct_type(prop, "ImageFormatSettings");
+ RNA_def_property_ui_text(prop, "Image Format", "");
+
+ prop = RNA_def_property(srna, "save_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "save_mode");
+ RNA_def_property_enum_items(prop, rna_enum_bake_save_mode_items);
+ RNA_def_property_ui_text(prop, "Save Mode", "Choose how to save the baking map");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* flags */
+ prop = RNA_def_property(srna, "use_selected_to_active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_TO_ACTIVE);
+ RNA_def_property_ui_text(prop,
+ "Selected to Active",
+ "Bake shading on the surface of selected objects to the active object");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_clear", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_CLEAR);
+ RNA_def_property_ui_text(prop, "Clear", "Clear Images before baking (internal only)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_split_materials", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_SPLIT_MAT);
+ RNA_def_property_ui_text(
+ prop, "Split Materials", "Split external images per material (external only)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_automatic_name", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_AUTO_NAME);
+ RNA_def_property_ui_text(
+ prop,
+ "Automatic Name",
+ "Automatically name the output file with the pass type (external only)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_cage", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_BAKE_CAGE);
+ RNA_def_property_ui_text(prop, "Cage", "Cast rays to active object from a cage");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* custom passes flags */
+ prop = RNA_def_property(srna, "use_pass_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_AO);
+ RNA_def_property_ui_text(prop, "Ambient Occlusion", "Add ambient occlusion contribution");
+
+ prop = RNA_def_property(srna, "use_pass_emit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_EMIT);
+ RNA_def_property_ui_text(prop, "Emit", "Add emission contribution");
+
+ prop = RNA_def_property(srna, "use_pass_direct", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_DIRECT);
+ RNA_def_property_ui_text(prop, "Direct", "Add direct lighting contribution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_pass_indirect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_INDIRECT);
+ RNA_def_property_ui_text(prop, "Indirect", "Add indirect lighting contribution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_pass_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_COLOR);
+ RNA_def_property_ui_text(prop, "Color", "Color the pass");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_pass_diffuse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_DIFFUSE);
+ RNA_def_property_ui_text(prop, "Diffuse", "Add diffuse contribution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_pass_glossy", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_GLOSSY);
+ RNA_def_property_ui_text(prop, "Glossy", "Add glossy contribution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_pass_transmission", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_TRANSM);
+ RNA_def_property_ui_text(prop, "Transmission", "Add transmission contribution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_pass_subsurface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pass_filter", R_BAKE_PASS_FILTER_SUBSURFACE);
+ RNA_def_property_ui_text(prop, "Subsurface", "Add subsurface contribution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "pass_filter", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "pass_filter");
+ RNA_def_property_enum_items(prop, rna_enum_bake_pass_filter_type_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Pass Filter", "Passes to include in the active baking pass");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_gpu_dof_fx(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "GPUDOFSettings", NULL);
- RNA_def_struct_ui_text(srna, "GPU DOF", "Settings for GPU based depth of field");
- RNA_def_struct_path_func(srna, "rna_GPUDOF_path");
-
- prop = RNA_def_property(srna, "focus_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_ui_text(prop, "Focus distance", "Viewport depth of field focus distance");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
-
- prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_DISTANCE_CAMERA);
- RNA_def_property_ui_text(prop, "Focal Length", "Focal length for dof effect");
- RNA_def_property_range(prop, 1.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
-
- prop = RNA_def_property(srna, "sensor", PROP_FLOAT, PROP_DISTANCE_CAMERA);
- RNA_def_property_ui_text(prop, "Sensor", "Size of sensor");
- RNA_def_property_range(prop, 1.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
-
- prop = RNA_def_property(srna, "fstop", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "F-stop", "F-stop for dof effect");
- RNA_def_property_float_default(prop, 128.0f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
-
- prop = RNA_def_property(srna, "blades", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "num_blades");
- RNA_def_property_ui_text(prop, "Blades", "Blades for dof effect");
- RNA_def_property_range(prop, 0, 16);
- RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_ui_text(prop, "Rotation", "Rotation of blades in aperture");
- RNA_def_property_range(prop, -M_PI, M_PI);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Ratio", "Distortion to simulate anamorphic lens bokeh");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.01f, FLT_MAX);
- RNA_def_property_ui_range(prop, 1.0f, 2.0f, 0.1, 3);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GPUDOFSettings", NULL);
+ RNA_def_struct_ui_text(srna, "GPU DOF", "Settings for GPU based depth of field");
+ RNA_def_struct_path_func(srna, "rna_GPUDOF_path");
+
+ prop = RNA_def_property(srna, "focus_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_ui_text(prop, "Focus distance", "Viewport depth of field focus distance");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 5000.0f, 1, 2);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
+
+ prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_DISTANCE_CAMERA);
+ RNA_def_property_ui_text(prop, "Focal Length", "Focal length for dof effect");
+ RNA_def_property_range(prop, 1.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
+
+ prop = RNA_def_property(srna, "sensor", PROP_FLOAT, PROP_DISTANCE_CAMERA);
+ RNA_def_property_ui_text(prop, "Sensor", "Size of sensor");
+ RNA_def_property_range(prop, 1.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1.0f, 5000.0f, 1, 2);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
+
+ prop = RNA_def_property(srna, "fstop", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "F-stop", "F-stop for dof effect");
+ RNA_def_property_float_default(prop, 128.0f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.1f, 128.0f, 10, 1);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
+
+ prop = RNA_def_property(srna, "blades", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "num_blades");
+ RNA_def_property_ui_text(prop, "Blades", "Blades for dof effect");
+ RNA_def_property_range(prop, 0, 16);
+ RNA_def_property_int_funcs(prop, NULL, "rna_GPUDOFSettings_blades_set", NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPUDOFSettings_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_ui_text(prop, "Rotation", "Rotation of blades in aperture");
+ RNA_def_property_range(prop, -M_PI, M_PI);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "ratio", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Ratio", "Distortion to simulate anamorphic lens bokeh");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.01f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1.0f, 2.0f, 0.1, 3);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
static void rna_def_gpu_ssao_fx(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "GPUSSAOSettings", NULL);
- RNA_def_struct_ui_text(srna, "GPU SSAO", "Settings for GPU based screen space ambient occlusion");
+ srna = RNA_def_struct(brna, "GPUSSAOSettings", NULL);
+ RNA_def_struct_ui_text(
+ srna, "GPU SSAO", "Settings for GPU based screen space ambient occlusion");
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Strength", "Strength of the SSAO effect");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of the SSAO effect");
+ RNA_def_property_range(prop, 0.0f, 250.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the SSAO effect");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Distance", "Distance of object that contribute to the SSAO effect");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
- RNA_def_property_range(prop, 1.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
+ RNA_def_property_range(prop, 1.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples");
- RNA_def_property_range(prop, 1, 500);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples");
+ RNA_def_property_range(prop, 1, 500);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Color", "Color for screen space ambient occlusion effect");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Color", "Color for screen space ambient occlusion effect");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
-
static void rna_def_gpu_fx(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_gpu_ssao_fx(brna);
- rna_def_gpu_dof_fx(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "GPUFXSettings", NULL);
- RNA_def_struct_ui_text(srna, "GPU FX Settings", "Settings for GPU based compositing");
+ rna_def_gpu_ssao_fx(brna);
+ rna_def_gpu_dof_fx(brna);
- prop = RNA_def_property(srna, "dof", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "GPUDOFSettings");
- RNA_def_property_ui_text(prop, "Depth Of Field settings", "");
+ srna = RNA_def_struct(brna, "GPUFXSettings", NULL);
+ RNA_def_struct_ui_text(srna, "GPU FX Settings", "Settings for GPU based compositing");
- prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_DOF);
- RNA_def_property_ui_text(prop, "Depth Of Field",
- "Use depth of field on viewport using the values from active camera");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "dof", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "GPUDOFSettings");
+ RNA_def_property_ui_text(prop, "Depth Of Field settings", "");
+ prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_DOF);
+ RNA_def_property_ui_text(prop,
+ "Depth Of Field",
+ "Use depth of field on viewport using the values from active camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
- prop = RNA_def_property(srna, "ssao", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "GPUSSAOSettings");
- RNA_def_property_ui_text(prop, "Screen Space Ambient Occlusion settings", "");
+ prop = RNA_def_property(srna, "ssao", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "GPUSSAOSettings");
+ RNA_def_property_ui_text(prop, "Screen Space Ambient Occlusion settings", "");
- prop = RNA_def_property(srna, "use_ssao", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_SSAO);
- RNA_def_property_ui_text(prop, "SSAO", "Use screen space ambient occlusion of field on viewport");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ prop = RNA_def_property(srna, "use_ssao", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "fx_flag", GPU_FX_FLAG_SSAO);
+ RNA_def_property_ui_text(
+ prop, "SSAO", "Use screen space ambient occlusion of field on viewport");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
static void rna_def_view_layers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "ViewLayers");
- srna = RNA_def_struct(brna, "ViewLayers", NULL);
- RNA_def_struct_sdna(srna, "Scene");
- RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
+ RNA_def_property_srna(cprop, "ViewLayers");
+ srna = RNA_def_struct(brna, "ViewLayers", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Render Layers", "Collection of render layers");
- func = RNA_def_function(srna, "new", "rna_ViewLayer_new");
- RNA_def_function_ui_description(func, "Add a view layer to scene");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_string(func, "name", "ViewLayer", 0, "", "New name for the view layer (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "result", "ViewLayer", "", "Newly created view layer");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_ViewLayer_new");
+ RNA_def_function_ui_description(func, "Add a view layer to scene");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ parm = RNA_def_string(
+ func, "name", "ViewLayer", 0, "", "New name for the view layer (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "result", "ViewLayer", "", "Newly created view layer");
+ RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "remove", "rna_ViewLayer_remove");
- RNA_def_function_ui_description(func, "Remove a view layer");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer", "ViewLayer", "", "View layer to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ func = RNA_def_function(srna, "remove", "rna_ViewLayer_remove");
+ RNA_def_function_ui_description(func, "Remove a view layer");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "layer", "ViewLayer", "", "View layer to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
/* Render Views - MultiView */
static void rna_def_scene_render_view(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SceneRenderView", NULL);
- RNA_def_struct_ui_text(srna, "Scene Render View", "Render viewpoint for 3D stereo and multiview rendering");
- RNA_def_struct_ui_icon(srna, ICON_RESTRICT_RENDER_OFF);
- RNA_def_struct_path_func(srna, "rna_SceneRenderView_path");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderView_name_set");
- RNA_def_property_ui_text(prop, "Name", "Render view name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "file_suffix", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "suffix");
- RNA_def_property_ui_text(prop, "File Suffix", "Suffix added to the render images for this view");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "camera_suffix", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "suffix");
- RNA_def_property_ui_text(prop, "Camera Suffix",
- "Suffix to identify the cameras to use, and added to the render images for this view");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "viewflag", SCE_VIEW_DISABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render view");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SceneRenderView", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Scene Render View", "Render viewpoint for 3D stereo and multiview rendering");
+ RNA_def_struct_ui_icon(srna, ICON_RESTRICT_RENDER_OFF);
+ RNA_def_struct_path_func(srna, "rna_SceneRenderView_path");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneRenderView_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Render view name");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "file_suffix", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "suffix");
+ RNA_def_property_ui_text(prop, "File Suffix", "Suffix added to the render images for this view");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "camera_suffix", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "suffix");
+ RNA_def_property_ui_text(
+ prop,
+ "Camera Suffix",
+ "Suffix to identify the cameras to use, and added to the render images for this view");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "viewflag", SCE_VIEW_DISABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Enabled", "Disable or enable the render view");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
}
static void rna_def_render_views(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "RenderViews");
- srna = RNA_def_struct(brna, "RenderViews", NULL);
- RNA_def_struct_sdna(srna, "RenderData");
- RNA_def_struct_ui_text(srna, "Render Views", "Collection of render views");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "actview");
- RNA_def_property_int_funcs(prop, "rna_RenderSettings_active_view_index_get",
- "rna_RenderSettings_active_view_index_set",
- "rna_RenderSettings_active_view_index_range");
- RNA_def_property_ui_text(prop, "Active View Index", "Active index in render view array");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "SceneRenderView");
- RNA_def_property_pointer_funcs(prop, "rna_RenderSettings_active_view_get",
- "rna_RenderSettings_active_view_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Active Render View", "Active Render View");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- func = RNA_def_function(srna, "new", "rna_RenderView_new");
- RNA_def_function_ui_description(func, "Add a render view to scene");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_string(func, "name", "RenderView", 0, "", "New name for the marker (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "result", "SceneRenderView", "", "Newly created render view");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_RenderView_remove");
- RNA_def_function_ui_description(func, "Remove a render view");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- parm = RNA_def_pointer(func, "view", "SceneRenderView", "", "Render view to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "RenderViews");
+ srna = RNA_def_struct(brna, "RenderViews", NULL);
+ RNA_def_struct_sdna(srna, "RenderData");
+ RNA_def_struct_ui_text(srna, "Render Views", "Collection of render views");
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "actview");
+ RNA_def_property_int_funcs(prop,
+ "rna_RenderSettings_active_view_index_get",
+ "rna_RenderSettings_active_view_index_set",
+ "rna_RenderSettings_active_view_index_range");
+ RNA_def_property_ui_text(prop, "Active View Index", "Active index in render view array");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SceneRenderView");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_RenderSettings_active_view_get",
+ "rna_RenderSettings_active_view_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Active Render View", "Active Render View");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ func = RNA_def_function(srna, "new", "rna_RenderView_new");
+ RNA_def_function_ui_description(func, "Add a render view to scene");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_string(func, "name", "RenderView", 0, "", "New name for the marker (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "result", "SceneRenderView", "", "Newly created render view");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_RenderView_remove");
+ RNA_def_function_ui_description(func, "Remove a render view");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ parm = RNA_def_pointer(func, "view", "SceneRenderView", "", "Render view to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_image_format_stereo3d_format(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* rna_enum_stereo3d_display_items, without (S3D_DISPLAY_PAGEFLIP) */
- static const EnumPropertyItem stereo3d_display_items[] = {
- {S3D_DISPLAY_ANAGLYPH, "ANAGLYPH", 0, "Anaglyph",
- "Render views for left and right eyes as two differently filtered colors in a single image "
- "(anaglyph glasses are required)"},
- {S3D_DISPLAY_INTERLACE, "INTERLACE", 0, "Interlace",
- "Render views for left and right eyes interlaced in a single image (3D-ready monitor is required)"},
- {S3D_DISPLAY_SIDEBYSIDE, "SIDEBYSIDE", 0, "Side-by-Side", "Render views for left and right eyes side-by-side"},
- {S3D_DISPLAY_TOPBOTTOM, "TOPBOTTOM", 0, "Top-Bottom", "Render views for left and right eyes one above another"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Stereo3dFormat", NULL);
- RNA_def_struct_sdna(srna, "Stereo3dFormat");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Stereo Output", "Settings for stereo output");
-
- prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "display_mode");
- RNA_def_property_enum_items(prop, stereo3d_display_items);
- RNA_def_property_ui_text(prop, "Stereo Mode", "");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
-
- prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
- RNA_def_property_ui_text(prop, "Anaglyph Type", "");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
-
- prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
- RNA_def_property_ui_text(prop, "Interlace Type", "");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
-
- prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
- RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
-
- prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
- RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
-
- prop = RNA_def_property(srna, "use_squeezed_frame", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SQUEEZED_FRAME);
- RNA_def_property_ui_text(prop, "Squeezed Frame", "Combine both views in a squeezed image");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* rna_enum_stereo3d_display_items, without (S3D_DISPLAY_PAGEFLIP) */
+ static const EnumPropertyItem stereo3d_display_items[] = {
+ {S3D_DISPLAY_ANAGLYPH,
+ "ANAGLYPH",
+ 0,
+ "Anaglyph",
+ "Render views for left and right eyes as two differently filtered colors in a single image "
+ "(anaglyph glasses are required)"},
+ {S3D_DISPLAY_INTERLACE,
+ "INTERLACE",
+ 0,
+ "Interlace",
+ "Render views for left and right eyes interlaced in a single image (3D-ready monitor is "
+ "required)"},
+ {S3D_DISPLAY_SIDEBYSIDE,
+ "SIDEBYSIDE",
+ 0,
+ "Side-by-Side",
+ "Render views for left and right eyes side-by-side"},
+ {S3D_DISPLAY_TOPBOTTOM,
+ "TOPBOTTOM",
+ 0,
+ "Top-Bottom",
+ "Render views for left and right eyes one above another"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Stereo3dFormat", NULL);
+ RNA_def_struct_sdna(srna, "Stereo3dFormat");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Stereo Output", "Settings for stereo output");
+
+ prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "display_mode");
+ RNA_def_property_enum_items(prop, stereo3d_display_items);
+ RNA_def_property_ui_text(prop, "Stereo Mode", "");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
+
+ prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
+ RNA_def_property_ui_text(prop, "Anaglyph Type", "");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
+
+ prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
+ RNA_def_property_ui_text(prop, "Interlace Type", "");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
+
+ prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
+ RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
+
+ prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
+ RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
+
+ prop = RNA_def_property(srna, "use_squeezed_frame", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SQUEEZED_FRAME);
+ RNA_def_property_ui_text(prop, "Squeezed Frame", "Combine both views in a squeezed image");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Stereo3dFormat_update");
}
/* use for render output and image save operator,
@@ -4391,2426 +4937,2665 @@ static void rna_def_image_format_stereo3d_format(BlenderRNA *brna)
static void rna_def_scene_image_format_data(BlenderRNA *brna)
{
-#ifdef WITH_OPENJPEG
- static const EnumPropertyItem jp2_codec_items[] = {
- {R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""},
- {R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""},
- {0, NULL, 0, NULL, NULL},
- };
-#endif
-
-#ifdef WITH_TIFF
- static const EnumPropertyItem tiff_codec_items[] = {
- {R_IMF_TIFF_CODEC_NONE, "NONE", 0, "None", ""},
- {R_IMF_TIFF_CODEC_DEFLATE, "DEFLATE", 0, "Deflate", ""},
- {R_IMF_TIFF_CODEC_LZW, "LZW", 0, "LZW", ""},
- {R_IMF_TIFF_CODEC_PACKBITS, "PACKBITS", 0, "Pack Bits", ""},
- {0, NULL, 0, NULL, NULL},
- };
-#endif
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_image_format_stereo3d_format(brna);
-
- srna = RNA_def_struct(brna, "ImageFormatSettings", NULL);
- RNA_def_struct_sdna(srna, "ImageFormatData");
- RNA_def_struct_nested(brna, srna, "Scene");
- RNA_def_struct_path_func(srna, "rna_ImageFormatSettings_path");
- RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
-
- prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "imtype");
- RNA_def_property_enum_items(prop, rna_enum_image_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ImageFormatSettings_file_format_set",
- "rna_ImageFormatSettings_file_format_itemf");
- RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
- RNA_def_property_enum_items(prop, rna_enum_image_color_mode_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
- RNA_def_property_ui_text(prop, "Color Mode",
- "Choose BW for saving grayscale images, RGB for saving red, green and blue channels, "
- "and RGBA for saving red, green, blue and alpha channels");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
- RNA_def_property_enum_items(prop, rna_enum_image_color_depth_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
- RNA_def_property_ui_text(prop, "Color Depth", "Bit depth per channel");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* was 'file_quality' */
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "quality");
- RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
- RNA_def_property_ui_text(prop, "Quality", "Quality for image formats that support lossy compression");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* was shared with file_quality */
- prop = RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "compress");
- RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
- RNA_def_property_ui_text(prop, "Compression", "Amount of time to determine best compression: "
- "0 = no compression with fast file output, "
- "100 = maximum lossless compression with slow file output");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* flag */
- prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
- RNA_def_property_ui_text(prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
- RNA_def_property_ui_text(prop, "Preview", "When rendering animations, save JPG preview images in same directory");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* format specific */
-
-#ifdef WITH_OPENEXR
- /* OpenEXR */
-
- prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
- RNA_def_property_enum_items(prop, rna_enum_exr_codec_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_exr_codec_itemf");
- RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
-
-#ifdef WITH_OPENJPEG
- /* Jpeg 2000 */
- prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
- RNA_def_property_ui_text(prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
- RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48);
- RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "jpeg2k_codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "jp2_codec");
- RNA_def_property_enum_items(prop, jp2_codec_items);
- RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpeg2000");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
-
-#ifdef WITH_TIFF
- /* TIFF */
- prop = RNA_def_property(srna, "tiff_codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tiff_codec");
- RNA_def_property_enum_items(prop, tiff_codec_items);
- RNA_def_property_ui_text(prop, "Compression", "Compression mode for TIFF");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
-
- /* Cineon and DPX */
-
- prop = RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_IMF_CINEON_FLAG_LOG);
- RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "cineon_black");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "cineon_white");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* multiview */
- prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "views_format");
- RNA_def_property_enum_items(prop, rna_enum_views_format_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_views_format_itemf");
- RNA_def_property_ui_text(prop, "Views Format", "Format of multiview media");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "Stereo3dFormat");
- RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
-
- /* color management */
- prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
- RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
- RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
-
- prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
- RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
- RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
+# ifdef WITH_OPENJPEG
+ static const EnumPropertyItem jp2_codec_items[] = {
+ {R_IMF_JP2_CODEC_JP2, "JP2", 0, "JP2", ""},
+ {R_IMF_JP2_CODEC_J2K, "J2K", 0, "J2K", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif
+
+# ifdef WITH_TIFF
+ static const EnumPropertyItem tiff_codec_items[] = {
+ {R_IMF_TIFF_CODEC_NONE, "NONE", 0, "None", ""},
+ {R_IMF_TIFF_CODEC_DEFLATE, "DEFLATE", 0, "Deflate", ""},
+ {R_IMF_TIFF_CODEC_LZW, "LZW", 0, "LZW", ""},
+ {R_IMF_TIFF_CODEC_PACKBITS, "PACKBITS", 0, "Pack Bits", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_image_format_stereo3d_format(brna);
+
+ srna = RNA_def_struct(brna, "ImageFormatSettings", NULL);
+ RNA_def_struct_sdna(srna, "ImageFormatData");
+ RNA_def_struct_nested(brna, srna, "Scene");
+ RNA_def_struct_path_func(srna, "rna_ImageFormatSettings_path");
+ RNA_def_struct_ui_text(srna, "Image Format", "Settings for image formats");
+
+ prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "imtype");
+ RNA_def_property_enum_items(prop, rna_enum_image_type_items);
+ RNA_def_property_enum_funcs(prop,
+ NULL,
+ "rna_ImageFormatSettings_file_format_set",
+ "rna_ImageFormatSettings_file_format_itemf");
+ RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "planes");
+ RNA_def_property_enum_items(prop, rna_enum_image_color_mode_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_mode_itemf");
+ RNA_def_property_ui_text(
+ prop,
+ "Color Mode",
+ "Choose BW for saving grayscale images, RGB for saving red, green and blue channels, "
+ "and RGBA for saving red, green, blue and alpha channels");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "color_depth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "depth");
+ RNA_def_property_enum_items(prop, rna_enum_image_color_depth_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_color_depth_itemf");
+ RNA_def_property_ui_text(prop, "Color Depth", "Bit depth per channel");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* was 'file_quality' */
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
+ RNA_def_property_ui_text(
+ prop, "Quality", "Quality for image formats that support lossy compression");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* was shared with file_quality */
+ prop = RNA_def_property(srna, "compression", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "compress");
+ RNA_def_property_range(prop, 0, 100); /* 0 is needed for compression. */
+ RNA_def_property_ui_text(prop,
+ "Compression",
+ "Amount of time to determine best compression: "
+ "0 = no compression with fast file output, "
+ "100 = maximum lossless compression with slow file output");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* flag */
+ prop = RNA_def_property(srna, "use_zbuffer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_ZBUF);
+ RNA_def_property_ui_text(
+ prop, "Z Buffer", "Save the z-depth per pixel (32 bit unsigned int z-buffer)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", R_IMF_FLAG_PREVIEW_JPG);
+ RNA_def_property_ui_text(
+ prop, "Preview", "When rendering animations, save JPG preview images in same directory");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* format specific */
+
+# ifdef WITH_OPENEXR
+ /* OpenEXR */
+
+ prop = RNA_def_property(srna, "exr_codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "exr_codec");
+ RNA_def_property_enum_items(prop, rna_enum_exr_codec_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_exr_codec_itemf");
+ RNA_def_property_ui_text(prop, "Codec", "Codec settings for OpenEXR");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+# endif
+
+# ifdef WITH_OPENJPEG
+ /* Jpeg 2000 */
+ prop = RNA_def_property(srna, "use_jpeg2k_ycc", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_YCC);
+ RNA_def_property_ui_text(
+ prop, "YCC", "Save luminance-chrominance-chrominance channels instead of RGB colors");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_jpeg2k_cinema_preset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_PRESET);
+ RNA_def_property_ui_text(prop, "Cinema", "Use Openjpeg Cinema Preset");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_jpeg2k_cinema_48", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "jp2_flag", R_IMF_JP2_FLAG_CINE_48);
+ RNA_def_property_ui_text(prop, "Cinema (48)", "Use Openjpeg Cinema Preset (48fps)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "jpeg2k_codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "jp2_codec");
+ RNA_def_property_enum_items(prop, jp2_codec_items);
+ RNA_def_property_ui_text(prop, "Codec", "Codec settings for Jpeg2000");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+# endif
+
+# ifdef WITH_TIFF
+ /* TIFF */
+ prop = RNA_def_property(srna, "tiff_codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tiff_codec");
+ RNA_def_property_enum_items(prop, tiff_codec_items);
+ RNA_def_property_ui_text(prop, "Compression", "Compression mode for TIFF");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+# endif
+
+ /* Cineon and DPX */
+
+ prop = RNA_def_property(srna, "use_cineon_log", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cineon_flag", R_IMF_CINEON_FLAG_LOG);
+ RNA_def_property_ui_text(prop, "Log", "Convert to logarithmic color space");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "cineon_black", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "cineon_black");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(prop, "B", "Log conversion reference blackpoint");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "cineon_white", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "cineon_white");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(prop, "W", "Log conversion reference whitepoint");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "cineon_gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cineon_gamma");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "G", "Log conversion gamma");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* multiview */
+ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "views_format");
+ RNA_def_property_enum_items(prop, rna_enum_views_format_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_ImageFormatSettings_views_format_itemf");
+ RNA_def_property_ui_text(prop, "Views Format", "Format of multiview media");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Stereo3dFormat");
+ RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
+
+ /* color management */
+ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
+ RNA_def_property_ui_text(
+ prop, "View Settings", "Color management settings applied on image before saving");
+
+ prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
+ RNA_def_property_ui_text(
+ prop, "Display Settings", "Settings of device saved image would be displayed on");
}
static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
-#ifdef WITH_FFMPEG
- /* Container types */
- static const EnumPropertyItem ffmpeg_format_items[] = {
- {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""},
- {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""},
- {FFMPEG_MPEG4, "MPEG4", 0, "MPEG-4", ""},
- {FFMPEG_AVI, "AVI", 0, "AVI", ""},
- {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""},
- {FFMPEG_DV, "DV", 0, "DV", ""},
- {FFMPEG_OGG, "OGG", 0, "Ogg", ""},
- {FFMPEG_MKV, "MKV", 0, "Matroska", ""},
- {FFMPEG_FLV, "FLASH", 0, "Flash", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem ffmpeg_codec_items[] = {
- {AV_CODEC_ID_NONE, "NONE", 0, "No Video", "Disables video output, for audio-only renders"},
- {AV_CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},
- {AV_CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
- {AV_CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
- {AV_CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
- {AV_CODEC_ID_H264, "H264", 0, "H.264", ""},
- {AV_CODEC_ID_HUFFYUV, "HUFFYUV", 0, "HuffYUV", ""},
- {AV_CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
- {AV_CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
- {AV_CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4 (divx)", ""},
- {AV_CODEC_ID_PNG, "PNG", 0, "PNG", ""},
- {AV_CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""},
- {AV_CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
- {AV_CODEC_ID_VP9, "WEBM", 0, "WEBM / VP9", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Recommendations come from the FFmpeg wiki, https://trac.ffmpeg.org/wiki/Encode/VP9.
- * The label for BEST has been changed to "Slowest" so that it fits the "Encoding Speed"
- * property label in the UI. */
- static const EnumPropertyItem ffmpeg_preset_items[] = {
- {FFM_PRESET_BEST, "BEST", 0, "Slowest",
- "Recommended if you have lots of time and want the best compression efficiency"},
- {FFM_PRESET_GOOD, "GOOD", 0, "Good", "The default and recommended for most applications"},
- {FFM_PRESET_REALTIME, "REALTIME", 0, "Realtime", "Recommended for fast encoding"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem ffmpeg_crf_items[] = {
- {FFM_CRF_NONE, "NONE", 0, "Constant Bitrate",
- "Configure constant bit rate, rather than constant output quality"},
- {FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""},
- {FFM_CRF_PERC_LOSSLESS, "PERC_LOSSLESS", 0, "Perceptually lossless", ""},
- {FFM_CRF_HIGH, "HIGH", 0, "High quality", ""},
- {FFM_CRF_MEDIUM, "MEDIUM", 0, "Medium quality", ""},
- {FFM_CRF_LOW, "LOW", 0, "Low quality", ""},
- {FFM_CRF_VERYLOW, "VERYLOW", 0, "Very low quality", ""},
- {FFM_CRF_LOWEST, "LOWEST", 0, "Lowest quality", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem ffmpeg_audio_codec_items[] = {
- {AV_CODEC_ID_NONE, "NONE", 0, "No Audio", "Disables audio output, for video-only renders"},
- {AV_CODEC_ID_AAC, "AAC", 0, "AAC", ""},
- {AV_CODEC_ID_AC3, "AC3", 0, "AC3", ""},
- {AV_CODEC_ID_FLAC, "FLAC", 0, "FLAC", ""},
- {AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""},
- {AV_CODEC_ID_MP3, "MP3", 0, "MP3", ""},
- {AV_CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
- {AV_CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
- {0, NULL, 0, NULL, NULL},
- };
-#endif
-
- static const EnumPropertyItem audio_channel_items[] = {
- {FFM_CHANNELS_MONO, "MONO", 0, "Mono", "Set audio channels to mono"},
- {FFM_CHANNELS_STEREO, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
- {FFM_CHANNELS_SURROUND4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
- {FFM_CHANNELS_SURROUND51, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
- {FFM_CHANNELS_SURROUND71, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FFmpegSettings", NULL);
- RNA_def_struct_sdna(srna, "FFMpegCodecData");
- RNA_def_struct_ui_text(srna, "FFmpeg Settings", "FFmpeg related settings for the scene");
-
-#ifdef WITH_FFMPEG
- prop = RNA_def_property(srna, "format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, ffmpeg_format_items);
- RNA_def_property_enum_default(prop, FFMPEG_MKV);
- RNA_def_property_ui_text(prop, "Container", "Output file container");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
-
- prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, ffmpeg_codec_items);
- RNA_def_property_enum_default(prop, AV_CODEC_ID_H264);
- RNA_def_property_ui_text(prop, "Video Codec", "FFmpeg codec to use for video output");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
-
- prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "video_bitrate");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "minrate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rc_min_rate");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "maxrate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rc_max_rate");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mux_rate");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 100000000);
- RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/s(!))");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gop_size");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 500);
- RNA_def_property_int_default(prop, 25);
- RNA_def_property_ui_text(prop, "Keyframe interval",
- "Distance between key frames, also known as GOP size; "
- "influences file size and seekability");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "max_b_frames", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "max_b_frames");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 16);
- RNA_def_property_ui_text(prop, "Max B-frames",
- "Maximum number of B-frames between non-B-frames; influences file size and seekability");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_max_b_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_USE_MAX_B_FRAMES);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use max B-frames", "Set a maximum number of B-frames");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rc_buffer_size");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 2000);
- RNA_def_property_ui_text(prop, "Buffersize", "Rate control: buffer size (kb)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "packetsize", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mux_packet_size");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 16384);
- RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "constant_rate_factor", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "constant_rate_factor");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, ffmpeg_crf_items);
- RNA_def_property_enum_default(prop, FFM_CRF_MEDIUM);
- RNA_def_property_ui_text(prop, "Output quality",
- "Constant Rate Factor (CRF); tradeoff between video quality and file size");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "ffmpeg_preset", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffmpeg_preset");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, ffmpeg_preset_items);
- RNA_def_property_enum_default(prop, FFM_PRESET_GOOD);
- RNA_def_property_ui_text(prop, "Encoding speed",
- "Tradeoff between encoding speed and compression ratio");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_lossless_output", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_LOSSLESS_OUTPUT);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_FFmpegSettings_lossless_output_set");
- RNA_def_property_ui_text(prop, "Lossless Output", "Use lossless output for video streams");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* FFMPEG Audio*/
- prop = RNA_def_property(srna, "audio_codec", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio_codec");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, ffmpeg_audio_codec_items);
- RNA_def_property_ui_text(prop, "Audio Codec", "FFmpeg audio codec to use");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "audio_bitrate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "audio_bitrate");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 32, 384);
- RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "audio_volume");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Volume", "Audio volume");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
-
- /* the following two "ffmpeg" settings are general audio settings */
- prop = RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "audio_mixrate");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 8000, 192000);
- RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "audio_channels");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, audio_channel_items);
- RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+# ifdef WITH_FFMPEG
+ /* Container types */
+ static const EnumPropertyItem ffmpeg_format_items[] = {
+ {FFMPEG_MPEG1, "MPEG1", 0, "MPEG-1", ""},
+ {FFMPEG_MPEG2, "MPEG2", 0, "MPEG-2", ""},
+ {FFMPEG_MPEG4, "MPEG4", 0, "MPEG-4", ""},
+ {FFMPEG_AVI, "AVI", 0, "AVI", ""},
+ {FFMPEG_MOV, "QUICKTIME", 0, "Quicktime", ""},
+ {FFMPEG_DV, "DV", 0, "DV", ""},
+ {FFMPEG_OGG, "OGG", 0, "Ogg", ""},
+ {FFMPEG_MKV, "MKV", 0, "Matroska", ""},
+ {FFMPEG_FLV, "FLASH", 0, "Flash", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem ffmpeg_codec_items[] = {
+ {AV_CODEC_ID_NONE, "NONE", 0, "No Video", "Disables video output, for audio-only renders"},
+ {AV_CODEC_ID_DNXHD, "DNXHD", 0, "DNxHD", ""},
+ {AV_CODEC_ID_DVVIDEO, "DV", 0, "DV", ""},
+ {AV_CODEC_ID_FFV1, "FFV1", 0, "FFmpeg video codec #1", ""},
+ {AV_CODEC_ID_FLV1, "FLASH", 0, "Flash Video", ""},
+ {AV_CODEC_ID_H264, "H264", 0, "H.264", ""},
+ {AV_CODEC_ID_HUFFYUV, "HUFFYUV", 0, "HuffYUV", ""},
+ {AV_CODEC_ID_MPEG1VIDEO, "MPEG1", 0, "MPEG-1", ""},
+ {AV_CODEC_ID_MPEG2VIDEO, "MPEG2", 0, "MPEG-2", ""},
+ {AV_CODEC_ID_MPEG4, "MPEG4", 0, "MPEG-4 (divx)", ""},
+ {AV_CODEC_ID_PNG, "PNG", 0, "PNG", ""},
+ {AV_CODEC_ID_QTRLE, "QTRLE", 0, "QT rle / QT Animation", ""},
+ {AV_CODEC_ID_THEORA, "THEORA", 0, "Theora", ""},
+ {AV_CODEC_ID_VP9, "WEBM", 0, "WEBM / VP9", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Recommendations come from the FFmpeg wiki, https://trac.ffmpeg.org/wiki/Encode/VP9.
+ * The label for BEST has been changed to "Slowest" so that it fits the "Encoding Speed"
+ * property label in the UI. */
+ static const EnumPropertyItem ffmpeg_preset_items[] = {
+ {FFM_PRESET_BEST,
+ "BEST",
+ 0,
+ "Slowest",
+ "Recommended if you have lots of time and want the best compression efficiency"},
+ {FFM_PRESET_GOOD, "GOOD", 0, "Good", "The default and recommended for most applications"},
+ {FFM_PRESET_REALTIME, "REALTIME", 0, "Realtime", "Recommended for fast encoding"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem ffmpeg_crf_items[] = {
+ {FFM_CRF_NONE,
+ "NONE",
+ 0,
+ "Constant Bitrate",
+ "Configure constant bit rate, rather than constant output quality"},
+ {FFM_CRF_LOSSLESS, "LOSSLESS", 0, "Lossless", ""},
+ {FFM_CRF_PERC_LOSSLESS, "PERC_LOSSLESS", 0, "Perceptually lossless", ""},
+ {FFM_CRF_HIGH, "HIGH", 0, "High quality", ""},
+ {FFM_CRF_MEDIUM, "MEDIUM", 0, "Medium quality", ""},
+ {FFM_CRF_LOW, "LOW", 0, "Low quality", ""},
+ {FFM_CRF_VERYLOW, "VERYLOW", 0, "Very low quality", ""},
+ {FFM_CRF_LOWEST, "LOWEST", 0, "Lowest quality", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem ffmpeg_audio_codec_items[] = {
+ {AV_CODEC_ID_NONE, "NONE", 0, "No Audio", "Disables audio output, for video-only renders"},
+ {AV_CODEC_ID_AAC, "AAC", 0, "AAC", ""},
+ {AV_CODEC_ID_AC3, "AC3", 0, "AC3", ""},
+ {AV_CODEC_ID_FLAC, "FLAC", 0, "FLAC", ""},
+ {AV_CODEC_ID_MP2, "MP2", 0, "MP2", ""},
+ {AV_CODEC_ID_MP3, "MP3", 0, "MP3", ""},
+ {AV_CODEC_ID_PCM_S16LE, "PCM", 0, "PCM", ""},
+ {AV_CODEC_ID_VORBIS, "VORBIS", 0, "Vorbis", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif
+
+ static const EnumPropertyItem audio_channel_items[] = {
+ {FFM_CHANNELS_MONO, "MONO", 0, "Mono", "Set audio channels to mono"},
+ {FFM_CHANNELS_STEREO, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
+ {FFM_CHANNELS_SURROUND4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
+ {FFM_CHANNELS_SURROUND51,
+ "SURROUND51",
+ 0,
+ "5.1 Surround",
+ "Set audio channels to 5.1 surround sound"},
+ {FFM_CHANNELS_SURROUND71,
+ "SURROUND71",
+ 0,
+ "7.1 Surround",
+ "Set audio channels to 7.1 surround sound"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FFmpegSettings", NULL);
+ RNA_def_struct_sdna(srna, "FFMpegCodecData");
+ RNA_def_struct_ui_text(srna, "FFmpeg Settings", "FFmpeg related settings for the scene");
+
+# ifdef WITH_FFMPEG
+ prop = RNA_def_property(srna, "format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "type");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ffmpeg_format_items);
+ RNA_def_property_enum_default(prop, FFMPEG_MKV);
+ RNA_def_property_ui_text(prop, "Container", "Output file container");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
+
+ prop = RNA_def_property(srna, "codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "codec");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ffmpeg_codec_items);
+ RNA_def_property_enum_default(prop, AV_CODEC_ID_H264);
+ RNA_def_property_ui_text(prop, "Video Codec", "FFmpeg codec to use for video output");
+ RNA_def_property_update(
+ prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_FFmpegSettings_codec_settings_update");
+
+ prop = RNA_def_property(srna, "video_bitrate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "video_bitrate");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Bitrate", "Video bitrate (kb/s)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "minrate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rc_min_rate");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Min Rate", "Rate control: min rate (kb/s)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "maxrate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rc_max_rate");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Max Rate", "Rate control: max rate (kb/s)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "muxrate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mux_rate");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 100000000);
+ RNA_def_property_ui_text(prop, "Mux Rate", "Mux rate (bits/s(!))");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gopsize", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gop_size");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 500);
+ RNA_def_property_int_default(prop, 25);
+ RNA_def_property_ui_text(prop,
+ "Keyframe interval",
+ "Distance between key frames, also known as GOP size; "
+ "influences file size and seekability");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "max_b_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "max_b_frames");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 16);
+ RNA_def_property_ui_text(
+ prop,
+ "Max B-frames",
+ "Maximum number of B-frames between non-B-frames; influences file size and seekability");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_max_b_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_USE_MAX_B_FRAMES);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Use max B-frames", "Set a maximum number of B-frames");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "buffersize", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rc_buffer_size");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 2000);
+ RNA_def_property_ui_text(prop, "Buffersize", "Rate control: buffer size (kb)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "packetsize", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mux_packet_size");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 16384);
+ RNA_def_property_ui_text(prop, "Mux Packet Size", "Mux packet size (byte)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "constant_rate_factor", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "constant_rate_factor");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ffmpeg_crf_items);
+ RNA_def_property_enum_default(prop, FFM_CRF_MEDIUM);
+ RNA_def_property_ui_text(
+ prop,
+ "Output quality",
+ "Constant Rate Factor (CRF); tradeoff between video quality and file size");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "ffmpeg_preset", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ffmpeg_preset");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ffmpeg_preset_items);
+ RNA_def_property_enum_default(prop, FFM_PRESET_GOOD);
+ RNA_def_property_ui_text(
+ prop, "Encoding speed", "Tradeoff between encoding speed and compression ratio");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_autosplit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_AUTOSPLIT_OUTPUT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Autosplit Output", "Autosplit output at 2GB boundary");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_lossless_output", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", FFMPEG_LOSSLESS_OUTPUT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_FFmpegSettings_lossless_output_set");
+ RNA_def_property_ui_text(prop, "Lossless Output", "Use lossless output for video streams");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* FFMPEG Audio*/
+ prop = RNA_def_property(srna, "audio_codec", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio_codec");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, ffmpeg_audio_codec_items);
+ RNA_def_property_ui_text(prop, "Audio Codec", "FFmpeg audio codec to use");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "audio_bitrate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "audio_bitrate");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 32, 384);
+ RNA_def_property_ui_text(prop, "Bitrate", "Audio bitrate (kb/s)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "audio_volume");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Volume", "Audio volume");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+# endif
+
+ /* the following two "ffmpeg" settings are general audio settings */
+ prop = RNA_def_property(srna, "audio_mixrate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "audio_mixrate");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 8000, 192000);
+ RNA_def_property_ui_text(prop, "Samplerate", "Audio samplerate(samples/s)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "audio_channels");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, audio_channel_items);
+ RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
}
static void rna_def_scene_render_data(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem alpha_mode_items[] = {
- {R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"},
- {R_ALPHAPREMUL, "TRANSPARENT", 0, "Transparent", "World background is transparent with premultiplied alpha"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem display_mode_items[] = {
- {R_OUTPUT_SCREEN, "SCREEN", 0, "Full Screen", "Images are rendered in a maximized Image Editor"},
- {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in an Image Editor"},
- {R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in a new window"},
- {R_OUTPUT_NONE, "NONE", 0, "Keep User Interface", "Images are rendered without changing the user interface"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Bake */
- static const EnumPropertyItem bake_mode_items[] = {
- //{RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"},
- {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"},
- {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem pixel_size_items[] = {
- {0, "AUTO", 0, "Automatic", "Automatic pixel size, depends on the user interface scale"},
- {1, "1", 0, "1x", "Render at full resolution"},
- {2, "2", 0, "2x", "Render at 50% resolution"},
- {4, "4", 0, "4x", "Render at 25% resolution"},
- {8, "8", 0, "8x", "Render at 12.5% resolution"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem fixed_oversample_items[] = {
- {5, "5", 0, "5", ""},
- {8, "8", 0, "8", ""},
- {11, "11", 0, "11", ""},
- {16, "16", 0, "16", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem threads_mode_items[] = {
- {0, "AUTO", 0, "Auto-detect", "Automatically determine the number of threads, based on CPUs"},
- {R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem engine_items[] = {
- {0, "BLENDER_EEVEE", 0, "Eevee", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem freestyle_thickness_items[] = {
- {R_LINE_THICKNESS_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Specify unit line thickness in pixels"},
- {R_LINE_THICKNESS_RELATIVE, "RELATIVE", 0, "Relative",
- "Unit line thickness is scaled by the proportion of the present vertical image "
- "resolution to 480 pixels"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem views_format_items[] = {
- {SCE_VIEWS_FORMAT_STEREO_3D, "STEREO_3D", 0, "Stereo 3D",
- "Single stereo camera system, adjust the stereo settings in the camera panel"},
- {SCE_VIEWS_FORMAT_MULTIVIEW, "MULTIVIEW", 0, "Multi-View",
- "Multi camera system, adjust the cameras individually"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem hair_shape_type_items[] = {
- {SCE_HAIR_SHAPE_STRAND, "STRAND", 0, "Strand", ""},
- {SCE_HAIR_SHAPE_STRIP, "STRIP", 0, "Strip", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- rna_def_scene_ffmpeg_settings(brna);
-
- srna = RNA_def_struct(brna, "RenderSettings", NULL);
- RNA_def_struct_sdna(srna, "RenderData");
- RNA_def_struct_nested(brna, srna, "Scene");
- RNA_def_struct_path_func(srna, "rna_RenderSettings_path");
- RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene data-block");
-
- /* Render Data */
- prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "im_format");
- RNA_def_property_struct_type(prop, "ImageFormatSettings");
- RNA_def_property_ui_text(prop, "Image Format", "");
-
- prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "xsch");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 4, 65536);
- RNA_def_property_ui_text(prop, "Resolution X", "Number of horizontal pixels in the rendered image");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
-
- prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "ysch");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 4, 65536);
- RNA_def_property_ui_text(prop, "Resolution Y", "Number of vertical pixels in the rendered image");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
-
- prop = RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
- RNA_def_property_int_sdna(prop, NULL, "size");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_range(prop, 1, 100, 10, 1);
- RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "tilex");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 8, 65536);
- RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "tiley");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 8, 65536);
- RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "preview_start_resolution", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 8, 16384);
- RNA_def_property_int_default(prop, 64);
- RNA_def_property_ui_text(prop, "Start Resolution", "Resolution to start rendering preview at, "
- "progressively increasing it to the full viewport size");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "preview_pixel_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "preview_pixel_size");
- RNA_def_property_enum_items(prop, pixel_size_items);
- RNA_def_property_ui_text(prop, "Pixel Size", "Pixel size for viewport rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xasp");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1.0f, 200.0f);
- RNA_def_property_ui_text(prop, "Pixel Aspect X",
- "Horizontal aspect ratio - for anamorphic or non-square pixel output");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
-
- prop = RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "yasp");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1.0f, 200.0f);
- RNA_def_property_ui_text(prop, "Pixel Aspect Y",
- "Vertical aspect ratio - for anamorphic or non-square pixel output");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
-
- prop = RNA_def_property(srna, "ffmpeg", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "FFmpegSettings");
- RNA_def_property_pointer_sdna(prop, NULL, "ffcodecdata");
- RNA_def_property_flag(prop, PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "FFmpeg Settings", "FFmpeg related settings for the scene");
-
- prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "frs_sec");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_range(prop, 1, 120, 1, -1);
- RNA_def_property_ui_text(prop, "FPS", "Framerate, expressed in frames per second");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update");
-
- prop = RNA_def_property(srna, "fps_base", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "frs_sec_base");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1e-5f, 1e6f);
- RNA_def_property_ui_range(prop, 0.1f, 120.0f, 2, -1);
- RNA_def_property_ui_text(prop, "FPS Base", "Framerate base");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update");
-
- /* frame mapping */
- prop = RNA_def_property(srna, "frame_map_old", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "framapto");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, 900);
- RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_framelen_update");
-
- prop = RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "images");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, 900);
- RNA_def_property_ui_text(prop, "Frame Map New", "How many frames the Map Old will last");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_framelen_update");
-
-
- prop = RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dither_intensity");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Dither Intensity",
- "Amount of dithering noise added to the rendered image to break up banding");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_PIXEL);
- RNA_def_property_float_sdna(prop, NULL, "gauss");
- RNA_def_property_range(prop, 0.0f, 500.0f);
- RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 2);
- RNA_def_property_ui_text(prop, "Filter Size", "Width over which the reconstruction filter combines samples");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "alphamode");
- RNA_def_property_enum_items(prop, alpha_mode_items);
- RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-
- prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA);
- RNA_def_property_ui_text(prop, "Anti-Aliasing",
- "Render and combine multiple samples per pixel to prevent jagged edges");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "antialiasing_samples", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "osa");
- RNA_def_property_enum_items(prop, fixed_oversample_items);
- RNA_def_property_ui_text(prop, "Anti-Aliasing Samples", "Amount of anti-aliasing samples per pixel");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
-
- prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS);
- RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- /* threads */
- prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "threads");
- RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS);
- RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Threads",
- "Number of CPU threads to use simultaneously while rendering "
- "(for multi-core/CPU systems)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, threads_mode_items);
- RNA_def_property_enum_funcs(prop, "rna_RenderSettings_threads_mode_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Threads Mode", "Determine the amount of render threads used");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* motion blur */
- prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR);
- RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-
- prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "blurfac");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
- RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-
- prop = RNA_def_property(srna, "motion_blur_shutter_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mblur_shutter_curve");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Shutter Curve", "Curve defining the shutter's openness over time");
-
- /* Hairs */
- prop = RNA_def_property(srna, "hair_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, hair_shape_type_items);
- RNA_def_property_ui_text(prop, "Hair Shape Type", "Hair shape type");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-
- prop = RNA_def_property(srna, "hair_subdiv", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 3);
- RNA_def_property_ui_text(prop, "Additional Subdiv", "Additional subdivision along the hair");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
-
- /* border */
- prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Render Region", "Render a user-defined render region, within the frame size");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "border.xmin");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "border.ymin");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "border.xmax");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "border.ymax");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_CROP);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Crop to Render Region", "Crop the rendered frame to the defined render region size");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Placeholders",
- "Create empty placeholder files while rendering frames (similar to Unix 'touch')");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", R_NO_OVERWRITE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Overwrite", "Overwrite existing files while rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Compositing",
- "Process the render result through the compositing pipeline, "
- "if compositing nodes are enabled");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Sequencer",
- "Process the render (and composited) result through the video sequence "
- "editor pipeline, if sequencer strips exist");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "File Extensions",
- "Add the file format extensions to the rendered file name (eg: filename + .jpg)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
-#if 0 /* moved */
- prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "imtype");
- RNA_def_property_enum_items(prop, rna_enum_image_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_file_format_set", NULL);
- RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-#endif
-
- prop = RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
- RNA_def_property_ui_text(prop, "Extension", "The file extension used for saving renders");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_is_movie_format_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Format", "When true the format is a movie");
-
- prop = RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Save Buffers",
- "Save tiles for all RenderLayers and SceneNodes to files in the temp directory "
- "(saves memory, required for Full Sample)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE);
- RNA_def_property_ui_text(prop, "Full Sample",
- "Save for every anti-aliasing sample the entire RenderLayer results "
- "(this solves anti-aliasing issues with compositing)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "displaymode");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, display_mode_items);
- RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_lock_interface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_lock_interface", 1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
- RNA_def_property_ui_text(prop, "Lock Interface", "Lock interface during rendering in favor of giving more memory to the renderer");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "pic");
- RNA_def_property_ui_text(prop, "Output Path",
- "Directory/name to save animations, # characters defines the position "
- "and length of frame numbers");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Render result EXR cache. */
- prop = RNA_def_property(srna, "use_render_cache", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_CACHE_FILE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Cache Result",
- "Save render cache to EXR files (useful for heavy compositing, "
- "Note: affects indirectly rendered scenes)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Bake */
-
- prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_mode");
- RNA_def_property_enum_items(prop, bake_mode_items);
- RNA_def_property_ui_text(prop, "Bake Type", "Choose shading information to bake into the image");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE);
- RNA_def_property_ui_text(prop, "Selected to Active",
- "Bake shading on the surface of selected objects to the active object");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR);
- RNA_def_property_ui_text(prop, "Clear", "Clear Images before baking");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bake_margin", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "bake_filter");
- RNA_def_property_range(prop, 0, 64);
- RNA_def_property_ui_text(prop, "Margin",
- "Extends the baked result as a post process filter");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bake_biasdist");
- RNA_def_property_range(prop, 0.0, 1000.0);
- RNA_def_property_ui_text(prop, "Bias", "Bias towards faces further away from the object (in blender units)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_bake_multires", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_MULTIRES);
- RNA_def_property_ui_text(prop, "Bake from Multires", "Bake directly from multires object");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_LORES_MESH);
- RNA_def_property_ui_text(prop, "Low Resolution Mesh",
- "Calculate heights against unsubdivided low resolution mesh");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bake_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "bake_samples");
- RNA_def_property_range(prop, 64, 1024);
- RNA_def_property_int_default(prop, 256);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples used for ambient occlusion baking from multires");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_bake_user_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_USERSCALE);
- RNA_def_property_ui_text(prop, "User scale", "Use a user scale for the derivative map");
-
- prop = RNA_def_property(srna, "bake_user_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bake_user_scale");
- RNA_def_property_range(prop, 0.0, 1000.0);
- RNA_def_property_ui_text(prop, "Scale",
- "Instead of automatically normalizing to 0..1, "
- "apply a user scale to the derivative map");
-
- /* stamp */
-
- prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME);
- RNA_def_property_ui_text(prop, "Stamp Time",
- "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DATE);
- RNA_def_property_ui_text(prop, "Stamp Date", "Include the current date in image/video metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_frame", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME);
- RNA_def_property_ui_text(prop, "Stamp Frame", "Include the frame number in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_frame_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME_RANGE);
- RNA_def_property_ui_text(prop, "Stamp Frame", "Include the rendered frame range in image/video metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_camera", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA);
- RNA_def_property_ui_text(prop, "Stamp Camera", "Include the name of the active camera in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS);
- RNA_def_property_ui_text(prop, "Stamp Lens", "Include the active camera's lens in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SCENE);
- RNA_def_property_ui_text(prop, "Stamp Scene", "Include the name of the active scene in image/video metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_note", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_NOTE);
- RNA_def_property_ui_text(prop, "Stamp Note", "Include a custom note in image/video metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_marker", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MARKER);
- RNA_def_property_ui_text(prop, "Stamp Marker", "Include the name of the last marker in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME);
- RNA_def_property_ui_text(prop, "Stamp Filename", "Include the .blend filename in image/video metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP);
- RNA_def_property_ui_text(prop, "Stamp Sequence Strip",
- "Include the name of the foreground sequence strip in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME);
- RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "stamp_udata");
- RNA_def_property_ui_text(prop, "Stamp Note Text", "Custom text to appear in the stamp note");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DRAW);
- RNA_def_property_ui_text(prop, "Stamp Output", "Render the stamp info text in the rendered image");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_labels", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "stamp", R_STAMP_HIDE_LABELS);
- RNA_def_property_ui_text(prop, "Stamp Labels", "Display stamp labels (\"Camera\" in front of camera name, etc.)");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_strip_meta", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_STRIPMETA);
- RNA_def_property_ui_text(prop, "Strip Metadata", "Use metadata from the strips in the sequencer");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_memory", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MEMORY);
- RNA_def_property_ui_text(prop, "Stamp Peak Memory", "Include the peak memory usage in image metadata");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_stamp_hostname", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_HOSTNAME);
- RNA_def_property_ui_text(prop, "Stamp Hostname", "Include the hostname of the machine that rendered the frame");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
- RNA_def_property_range(prop, 8, 64);
- RNA_def_property_ui_text(prop, "Font Size", "Size of the font used when rendering stamp text");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Text Color", "Color to use for stamp text");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "bg_stamp");
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Background", "Color to use behind stamp text");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* sequencer draw options */
-
-#if 0 /* see R_SEQ_GL_REND comment */
- prop = RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_REND);
- RNA_def_property_ui_text(prop, "Sequencer OpenGL", "");
-#endif
-
- prop = RNA_def_property(srna, "sequencer_gl_preview", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "seq_prev_type");
- RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
- RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
-
-#if 0 /* UNUSED, see R_SEQ_GL_REND comment */
- prop = RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "seq_rend_type");
- RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
- /* XXX Label and tooltips are obviously wrong! */
- RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
-#endif
-
- prop = RNA_def_property(srna, "use_sequencer_gl_textured_solid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_SOLID_TEX);
- RNA_def_property_ui_text(prop, "Textured Solid", "Display face-assigned textures in solid draw method");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
-
- prop = RNA_def_property(srna, "use_sequencer_gl_dof", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_CAMERA_DOF);
- RNA_def_property_ui_text(prop, "Depth of Field", "Use depth of field using the values from scene strip active camera");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
-
- prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
- RNA_def_property_ui_text(prop, "Render Single Layer", "Only render the active layer. Only affects rendering from the interface, ignored for rendering from command line");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* views (stereoscopy et al) */
- prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "SceneRenderView");
- RNA_def_property_ui_text(prop, "Render Views", "");
- rna_def_render_views(brna, prop);
-
- prop = RNA_def_property(srna, "stereo_views", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "views", NULL);
- RNA_def_property_collection_funcs(prop, "rna_RenderSettings_stereoViews_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "SceneRenderView");
- RNA_def_property_ui_text(prop, "Render Views", "");
-
- prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_MULTIVIEW);
- RNA_def_property_ui_text(prop, "Multiple Views", "Use multiple views in the scene");
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, views_format_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Setup Stereo Mode", "");
- RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* engine */
- prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, engine_items);
- RNA_def_property_enum_funcs(prop, "rna_RenderSettings_engine_get", "rna_RenderSettings_engine_set",
- "rna_RenderSettings_engine_itemf");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering");
- RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update");
-
- prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Multiple Engines", "More than one rendering engine is available");
-
- prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_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");
-
- /* simplify */
- prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY);
- RNA_def_property_ui_text(prop, "Use Simplify", "Enable simplification of scene for quicker preview renders");
- RNA_def_property_update(prop, 0, "rna_Scene_use_simplify_update");
-
- prop = RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf");
- RNA_def_property_ui_range(prop, 0, 6, 1, -1);
- RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level");
- RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
-
- prop = RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "simplify_particles");
- RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage");
- RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
-
- prop = RNA_def_property(srna, "simplify_subdivision_render", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf_render");
- RNA_def_property_ui_range(prop, 0, 6, 1, -1);
- RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level during rendering");
- RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
-
- prop = RNA_def_property(srna, "simplify_child_particles_render", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "simplify_particles_render");
- RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage during rendering");
- RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
-
- prop = RNA_def_property(srna, "use_simplify_smoke_highres", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_smoke_ignore_highres", 1);
- RNA_def_property_ui_text(prop, "Use High-resolution Smoke", "Display high-resolution smoke in the viewport");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- /* Grease Pencil - Simplify Options */
- prop = RNA_def_property(srna, "simplify_gpencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ENABLE);
- RNA_def_property_ui_text(prop, "Simplify", "Simplify Grease Pencil drawing");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "simplify_gpencil_onplay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ON_PLAY);
- RNA_def_property_ui_text(prop, "Simplify Playback", "Simplify Grease Pencil only during animation playback");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "simplify_gpencil_view_fill", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FILL);
- RNA_def_property_ui_text(prop, "Disable Fill", "Disable fill strokes in the viewport");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "simplify_gpencil_remove_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_REMOVE_FILL_LINE);
- RNA_def_property_ui_text(prop, "Disable Lines", "Disable external lines of fill strokes");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "simplify_gpencil_view_modifier", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_MODIFIER);
- RNA_def_property_ui_text(prop, "Disable Modifiers", "Do not apply modifiers in the viewport");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "simplify_gpencil_shader_fx", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FX);
- RNA_def_property_ui_text(prop, "Simplify Shaders", "Do not apply shader fx");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "simplify_gpencil_blend", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_BLEND);
- RNA_def_property_ui_text(prop, "Layers Blending", "Do not display blend layers");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* persistent data */
- prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);
- RNA_def_property_ui_text(prop, "Persistent Data", "Keep render data around for faster re-renders");
- RNA_def_property_update(prop, 0, "rna_Scene_use_persistent_data_update");
-
- /* Freestyle line thickness options */
- prop = RNA_def_property(srna, "line_thickness_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "line_thickness_mode");
- RNA_def_property_enum_items(prop, freestyle_thickness_items);
- RNA_def_property_ui_text(prop, "Line Thickness Mode", "Line thickness mode for Freestyle line drawing");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- prop = RNA_def_property(srna, "line_thickness", PROP_FLOAT, PROP_PIXEL);
- RNA_def_property_float_sdna(prop, NULL, "unit_line_thickness");
- RNA_def_property_range(prop, 0.f, 10000.f);
- RNA_def_property_ui_text(prop, "Line Thickness", "Line thickness in pixels");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
-
- /* Bake Settings */
- prop = RNA_def_property(srna, "bake", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "bake");
- RNA_def_property_struct_type(prop, "BakeSettings");
- RNA_def_property_ui_text(prop, "Bake Data", "");
-
- /* Nestled Data */
- /* *** Non-Animated *** */
- RNA_define_animate_sdna(false);
- rna_def_bake_data(brna);
- RNA_define_animate_sdna(true);
-
- /* *** Animated *** */
-
- /* Scene API */
- RNA_api_scene_render(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem alpha_mode_items[] = {
+ {R_ADDSKY, "SKY", 0, "Sky", "Transparent pixels are filled with sky color"},
+ {R_ALPHAPREMUL,
+ "TRANSPARENT",
+ 0,
+ "Transparent",
+ "World background is transparent with premultiplied alpha"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem display_mode_items[] = {
+ {R_OUTPUT_SCREEN,
+ "SCREEN",
+ 0,
+ "Full Screen",
+ "Images are rendered in a maximized Image Editor"},
+ {R_OUTPUT_AREA, "AREA", 0, "Image Editor", "Images are rendered in an Image Editor"},
+ {R_OUTPUT_WINDOW, "WINDOW", 0, "New Window", "Images are rendered in a new window"},
+ {R_OUTPUT_NONE,
+ "NONE",
+ 0,
+ "Keep User Interface",
+ "Images are rendered without changing the user interface"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Bake */
+ static const EnumPropertyItem bake_mode_items[] = {
+ //{RE_BAKE_AO, "AO", 0, "Ambient Occlusion", "Bake ambient occlusion"},
+ {RE_BAKE_NORMALS, "NORMALS", 0, "Normals", "Bake normals"},
+ {RE_BAKE_DISPLACEMENT, "DISPLACEMENT", 0, "Displacement", "Bake displacement"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pixel_size_items[] = {
+ {0, "AUTO", 0, "Automatic", "Automatic pixel size, depends on the user interface scale"},
+ {1, "1", 0, "1x", "Render at full resolution"},
+ {2, "2", 0, "2x", "Render at 50% resolution"},
+ {4, "4", 0, "4x", "Render at 25% resolution"},
+ {8, "8", 0, "8x", "Render at 12.5% resolution"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem fixed_oversample_items[] = {
+ {5, "5", 0, "5", ""},
+ {8, "8", 0, "8", ""},
+ {11, "11", 0, "11", ""},
+ {16, "16", 0, "16", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem threads_mode_items[] = {
+ {0,
+ "AUTO",
+ 0,
+ "Auto-detect",
+ "Automatically determine the number of threads, based on CPUs"},
+ {R_FIXED_THREADS, "FIXED", 0, "Fixed", "Manually determine the number of threads"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem engine_items[] = {
+ {0, "BLENDER_EEVEE", 0, "Eevee", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem freestyle_thickness_items[] = {
+ {R_LINE_THICKNESS_ABSOLUTE,
+ "ABSOLUTE",
+ 0,
+ "Absolute",
+ "Specify unit line thickness in pixels"},
+ {R_LINE_THICKNESS_RELATIVE,
+ "RELATIVE",
+ 0,
+ "Relative",
+ "Unit line thickness is scaled by the proportion of the present vertical image "
+ "resolution to 480 pixels"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem views_format_items[] = {
+ {SCE_VIEWS_FORMAT_STEREO_3D,
+ "STEREO_3D",
+ 0,
+ "Stereo 3D",
+ "Single stereo camera system, adjust the stereo settings in the camera panel"},
+ {SCE_VIEWS_FORMAT_MULTIVIEW,
+ "MULTIVIEW",
+ 0,
+ "Multi-View",
+ "Multi camera system, adjust the cameras individually"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem hair_shape_type_items[] = {
+ {SCE_HAIR_SHAPE_STRAND, "STRAND", 0, "Strand", ""},
+ {SCE_HAIR_SHAPE_STRIP, "STRIP", 0, "Strip", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ rna_def_scene_ffmpeg_settings(brna);
+
+ srna = RNA_def_struct(brna, "RenderSettings", NULL);
+ RNA_def_struct_sdna(srna, "RenderData");
+ RNA_def_struct_nested(brna, srna, "Scene");
+ RNA_def_struct_path_func(srna, "rna_RenderSettings_path");
+ RNA_def_struct_ui_text(srna, "Render Data", "Rendering settings for a Scene data-block");
+
+ /* Render Data */
+ prop = RNA_def_property(srna, "image_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "im_format");
+ RNA_def_property_struct_type(prop, "ImageFormatSettings");
+ RNA_def_property_ui_text(prop, "Image Format", "");
+
+ prop = RNA_def_property(srna, "resolution_x", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "xsch");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 4, 65536);
+ RNA_def_property_ui_text(
+ prop, "Resolution X", "Number of horizontal pixels in the rendered image");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
+
+ prop = RNA_def_property(srna, "resolution_y", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "ysch");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 4, 65536);
+ RNA_def_property_ui_text(
+ prop, "Resolution Y", "Number of vertical pixels in the rendered image");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
+
+ prop = RNA_def_property(srna, "resolution_percentage", PROP_INT, PROP_PERCENTAGE);
+ RNA_def_property_int_sdna(prop, NULL, "size");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, 100, 10, 1);
+ RNA_def_property_ui_text(prop, "Resolution %", "Percentage scale for render resolution");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "tile_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tilex");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 8, 65536);
+ RNA_def_property_ui_text(prop, "Tile X", "Horizontal tile size to use while rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "tile_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tiley");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 8, 65536);
+ RNA_def_property_ui_text(prop, "Tile Y", "Vertical tile size to use while rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "preview_start_resolution", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 8, 16384);
+ RNA_def_property_int_default(prop, 64);
+ RNA_def_property_ui_text(prop,
+ "Start Resolution",
+ "Resolution to start rendering preview at, "
+ "progressively increasing it to the full viewport size");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "preview_pixel_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "preview_pixel_size");
+ RNA_def_property_enum_items(prop, pixel_size_items);
+ RNA_def_property_ui_text(prop, "Pixel Size", "Pixel size for viewport rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "pixel_aspect_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xasp");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1.0f, 200.0f);
+ RNA_def_property_ui_text(prop,
+ "Pixel Aspect X",
+ "Horizontal aspect ratio - for anamorphic or non-square pixel output");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
+
+ prop = RNA_def_property(srna, "pixel_aspect_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "yasp");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1.0f, 200.0f);
+ RNA_def_property_ui_text(
+ prop, "Pixel Aspect Y", "Vertical aspect ratio - for anamorphic or non-square pixel output");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_SceneCamera_update");
+
+ prop = RNA_def_property(srna, "ffmpeg", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "FFmpegSettings");
+ RNA_def_property_pointer_sdna(prop, NULL, "ffcodecdata");
+ RNA_def_property_flag(prop, PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "FFmpeg Settings", "FFmpeg related settings for the scene");
+
+ prop = RNA_def_property(srna, "fps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "frs_sec");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, 120, 1, -1);
+ RNA_def_property_ui_text(prop, "FPS", "Framerate, expressed in frames per second");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update");
+
+ prop = RNA_def_property(srna, "fps_base", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "frs_sec_base");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1e-5f, 1e6f);
+ RNA_def_property_ui_range(prop, 0.1f, 120.0f, 2, -1);
+ RNA_def_property_ui_text(prop, "FPS Base", "Framerate base");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_fps_update");
+
+ /* frame mapping */
+ prop = RNA_def_property(srna, "frame_map_old", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "framapto");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, 900);
+ RNA_def_property_ui_text(prop, "Frame Map Old", "Old mapping value in frames");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_framelen_update");
+
+ prop = RNA_def_property(srna, "frame_map_new", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "images");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, 900);
+ RNA_def_property_ui_text(prop, "Frame Map New", "How many frames the Map Old will last");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_framelen_update");
+
+ prop = RNA_def_property(srna, "dither_intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dither_intensity");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Dither Intensity",
+ "Amount of dithering noise added to the rendered image to break up banding");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_PIXEL);
+ RNA_def_property_float_sdna(prop, NULL, "gauss");
+ RNA_def_property_range(prop, 0.0f, 500.0f);
+ RNA_def_property_ui_range(prop, 0.01f, 10.0f, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Filter Size", "Width over which the reconstruction filter combines samples");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "alphamode");
+ RNA_def_property_enum_items(prop, alpha_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+
+ prop = RNA_def_property(srna, "use_antialiasing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_OSA);
+ RNA_def_property_ui_text(
+ prop,
+ "Anti-Aliasing",
+ "Render and combine multiple samples per pixel to prevent jagged edges");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "antialiasing_samples", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "osa");
+ RNA_def_property_enum_items(prop, fixed_oversample_items);
+ RNA_def_property_ui_text(
+ prop, "Anti-Aliasing Samples", "Amount of anti-aliasing samples per pixel");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_freestyle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_EDGE_FRS);
+ RNA_def_property_ui_text(prop, "Edge", "Draw stylized strokes using Freestyle");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ /* threads */
+ prop = RNA_def_property(srna, "threads", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "threads");
+ RNA_def_property_range(prop, 1, BLENDER_MAX_THREADS);
+ RNA_def_property_int_funcs(prop, "rna_RenderSettings_threads_get", NULL, NULL);
+ RNA_def_property_ui_text(prop,
+ "Threads",
+ "Number of CPU threads to use simultaneously while rendering "
+ "(for multi-core/CPU systems)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "threads_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, threads_mode_items);
+ RNA_def_property_enum_funcs(prop, "rna_RenderSettings_threads_mode_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Threads Mode", "Determine the amount of render threads used");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* motion blur */
+ prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_MBLUR);
+ RNA_def_property_ui_text(prop, "Motion Blur", "Use multi-sampled 3D scene motion blur");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+
+ prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "blurfac");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
+ RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+
+ prop = RNA_def_property(srna, "motion_blur_shutter_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mblur_shutter_curve");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(
+ prop, "Shutter Curve", "Curve defining the shutter's openness over time");
+
+ /* Hairs */
+ prop = RNA_def_property(srna, "hair_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, hair_shape_type_items);
+ RNA_def_property_ui_text(prop, "Hair Shape Type", "Hair shape type");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+
+ prop = RNA_def_property(srna, "hair_subdiv", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 3);
+ RNA_def_property_ui_text(prop, "Additional Subdiv", "Additional subdivision along the hair");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_glsl_update");
+
+ /* border */
+ prop = RNA_def_property(srna, "use_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_BORDER);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Render Region", "Render a user-defined render region, within the frame size");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "border_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "border.xmin");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "border_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "border.ymin");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "border_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "border.xmax");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "border_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "border.ymax");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_crop_to_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_CROP);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Crop to Render Region", "Crop the rendered frame to the defined render region size");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_placeholder", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_TOUCH);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Placeholders",
+ "Create empty placeholder files while rendering frames (similar to Unix 'touch')");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "mode", R_NO_OVERWRITE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Overwrite", "Overwrite existing files while rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_compositing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOCOMP);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Compositing",
+ "Process the render result through the compositing pipeline, "
+ "if compositing nodes are enabled");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_sequencer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_DOSEQ);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Sequencer",
+ "Process the render (and composited) result through the video sequence "
+ "editor pipeline, if sequencer strips exist");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_file_extension", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXTENSION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "File Extensions",
+ "Add the file format extensions to the rendered file name (eg: filename + .jpg)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+# if 0 /* moved */
+ prop = RNA_def_property(srna, "file_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "imtype");
+ RNA_def_property_enum_items(prop, rna_enum_image_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_file_format_set", NULL);
+ RNA_def_property_ui_text(prop, "File Format", "File format to save the rendered images as");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+# endif
+
+ prop = RNA_def_property(srna, "file_extension", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_SceneRender_file_ext_get", "rna_SceneRender_file_ext_length", NULL);
+ RNA_def_property_ui_text(prop, "Extension", "The file extension used for saving renders");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_movie_format", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_is_movie_format_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Format", "When true the format is a movie");
+
+ prop = RNA_def_property(srna, "use_save_buffers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_TILE_FILE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Save Buffers",
+ "Save tiles for all RenderLayers and SceneNodes to files in the temp directory "
+ "(saves memory, required for Full Sample)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_full_sample", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_FULL_SAMPLE);
+ RNA_def_property_ui_text(prop,
+ "Full Sample",
+ "Save for every anti-aliasing sample the entire RenderLayer results "
+ "(this solves anti-aliasing issues with compositing)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "displaymode");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, display_mode_items);
+ RNA_def_property_ui_text(prop, "Display", "Select where rendered images will be displayed");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_lock_interface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_lock_interface", 1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
+ RNA_def_property_ui_text(
+ prop,
+ "Lock Interface",
+ "Lock interface during rendering in favor of giving more memory to the renderer");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "pic");
+ RNA_def_property_ui_text(prop,
+ "Output Path",
+ "Directory/name to save animations, # characters defines the position "
+ "and length of frame numbers");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Render result EXR cache. */
+ prop = RNA_def_property(srna, "use_render_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_EXR_CACHE_FILE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Cache Result",
+ "Save render cache to EXR files (useful for heavy compositing, "
+ "Note: affects indirectly rendered scenes)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Bake */
+
+ prop = RNA_def_property(srna, "bake_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "bake_mode");
+ RNA_def_property_enum_items(prop, bake_mode_items);
+ RNA_def_property_ui_text(prop, "Bake Type", "Choose shading information to bake into the image");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_bake_selected_to_active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_TO_ACTIVE);
+ RNA_def_property_ui_text(prop,
+ "Selected to Active",
+ "Bake shading on the surface of selected objects to the active object");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_bake_clear", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_CLEAR);
+ RNA_def_property_ui_text(prop, "Clear", "Clear Images before baking");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bake_margin", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "bake_filter");
+ RNA_def_property_range(prop, 0, 64);
+ RNA_def_property_ui_text(prop, "Margin", "Extends the baked result as a post process filter");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bake_bias", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bake_biasdist");
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_text(
+ prop, "Bias", "Bias towards faces further away from the object (in blender units)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_bake_multires", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_MULTIRES);
+ RNA_def_property_ui_text(prop, "Bake from Multires", "Bake directly from multires object");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_bake_lores_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_LORES_MESH);
+ RNA_def_property_ui_text(
+ prop, "Low Resolution Mesh", "Calculate heights against unsubdivided low resolution mesh");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bake_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "bake_samples");
+ RNA_def_property_range(prop, 64, 1024);
+ RNA_def_property_int_default(prop, 256);
+ RNA_def_property_ui_text(
+ prop, "Samples", "Number of samples used for ambient occlusion baking from multires");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_bake_user_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bake_flag", R_BAKE_USERSCALE);
+ RNA_def_property_ui_text(prop, "User scale", "Use a user scale for the derivative map");
+
+ prop = RNA_def_property(srna, "bake_user_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bake_user_scale");
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_text(prop,
+ "Scale",
+ "Instead of automatically normalizing to 0..1, "
+ "apply a user scale to the derivative map");
+
+ /* stamp */
+
+ prop = RNA_def_property(srna, "use_stamp_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_TIME);
+ RNA_def_property_ui_text(
+ prop, "Stamp Time", "Include the rendered frame timecode as HH:MM:SS.FF in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_date", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DATE);
+ RNA_def_property_ui_text(prop, "Stamp Date", "Include the current date in image/video metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_frame", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME);
+ RNA_def_property_ui_text(prop, "Stamp Frame", "Include the frame number in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_frame_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FRAME_RANGE);
+ RNA_def_property_ui_text(
+ prop, "Stamp Frame", "Include the rendered frame range in image/video metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_camera", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERA);
+ RNA_def_property_ui_text(
+ prop, "Stamp Camera", "Include the name of the active camera in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_lens", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_CAMERALENS);
+ RNA_def_property_ui_text(
+ prop, "Stamp Lens", "Include the active camera's lens in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_scene", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SCENE);
+ RNA_def_property_ui_text(
+ prop, "Stamp Scene", "Include the name of the active scene in image/video metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_note", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_NOTE);
+ RNA_def_property_ui_text(prop, "Stamp Note", "Include a custom note in image/video metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_marker", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MARKER);
+ RNA_def_property_ui_text(
+ prop, "Stamp Marker", "Include the name of the last marker in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_filename", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_FILENAME);
+ RNA_def_property_ui_text(
+ prop, "Stamp Filename", "Include the .blend filename in image/video metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_sequencer_strip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_SEQSTRIP);
+ RNA_def_property_ui_text(prop,
+ "Stamp Sequence Strip",
+ "Include the name of the foreground sequence strip in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_render_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_RENDERTIME);
+ RNA_def_property_ui_text(prop, "Stamp Render Time", "Include the render time in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "stamp_note_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "stamp_udata");
+ RNA_def_property_ui_text(prop, "Stamp Note Text", "Custom text to appear in the stamp note");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_DRAW);
+ RNA_def_property_ui_text(
+ prop, "Stamp Output", "Render the stamp info text in the rendered image");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_labels", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "stamp", R_STAMP_HIDE_LABELS);
+ RNA_def_property_ui_text(
+ prop, "Stamp Labels", "Display stamp labels (\"Camera\" in front of camera name, etc.)");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_strip_meta", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_STRIPMETA);
+ RNA_def_property_ui_text(
+ prop, "Strip Metadata", "Use metadata from the strips in the sequencer");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_memory", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_MEMORY);
+ RNA_def_property_ui_text(
+ prop, "Stamp Peak Memory", "Include the peak memory usage in image metadata");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_stamp_hostname", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stamp", R_STAMP_HOSTNAME);
+ RNA_def_property_ui_text(
+ prop, "Stamp Hostname", "Include the hostname of the machine that rendered the frame");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "stamp_font_size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "stamp_font_id");
+ RNA_def_property_range(prop, 8, 64);
+ RNA_def_property_ui_text(prop, "Font Size", "Size of the font used when rendering stamp text");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "stamp_foreground", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "fg_stamp");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Text Color", "Color to use for stamp text");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "stamp_background", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "bg_stamp");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Background", "Color to use behind stamp text");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* sequencer draw options */
+
+# if 0 /* see R_SEQ_GL_REND comment */
+ prop = RNA_def_property(srna, "use_sequencer_gl_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_GL_REND);
+ RNA_def_property_ui_text(prop, "Sequencer OpenGL", "");
+# endif
+
+ prop = RNA_def_property(srna, "sequencer_gl_preview", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "seq_prev_type");
+ RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
+ RNA_def_property_ui_text(
+ prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
+
+# if 0 /* UNUSED, see R_SEQ_GL_REND comment */
+ prop = RNA_def_property(srna, "sequencer_gl_render", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "seq_rend_type");
+ RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
+ /* XXX Label and tooltips are obviously wrong! */
+ RNA_def_property_ui_text(prop, "Sequencer Preview Shading", "Method to draw in the sequencer view");
+# endif
+
+ prop = RNA_def_property(srna, "use_sequencer_gl_textured_solid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_SOLID_TEX);
+ RNA_def_property_ui_text(
+ prop, "Textured Solid", "Display face-assigned textures in solid draw method");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
+
+ prop = RNA_def_property(srna, "use_sequencer_gl_dof", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "seq_flag", R_SEQ_CAMERA_DOF);
+ RNA_def_property_ui_text(prop,
+ "Depth of Field",
+ "Use depth of field using the values from scene strip active camera");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SceneSequencer_update");
+
+ prop = RNA_def_property(srna, "use_single_layer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_SINGLE_LAYER);
+ RNA_def_property_ui_text(prop,
+ "Render Single Layer",
+ "Only render the active layer. Only affects rendering from the "
+ "interface, ignored for rendering from command line");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* views (stereoscopy et al) */
+ prop = RNA_def_property(srna, "views", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SceneRenderView");
+ RNA_def_property_ui_text(prop, "Render Views", "");
+ rna_def_render_views(brna, prop);
+
+ prop = RNA_def_property(srna, "stereo_views", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "views", NULL);
+ RNA_def_property_collection_funcs(prop,
+ "rna_RenderSettings_stereoViews_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "SceneRenderView");
+ RNA_def_property_ui_text(prop, "Render Views", "");
+
+ prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "scemode", R_MULTIVIEW);
+ RNA_def_property_ui_text(prop, "Multiple Views", "Use multiple views in the scene");
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, views_format_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Setup Stereo Mode", "");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_RenderSettings_views_format_set", NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* engine */
+ prop = RNA_def_property(srna, "engine", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, engine_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_RenderSettings_engine_get",
+ "rna_RenderSettings_engine_set",
+ "rna_RenderSettings_engine_itemf");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Engine", "Engine to use for rendering");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_RenderSettings_engine_update");
+
+ prop = RNA_def_property(srna, "has_multiple_engines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_multiple_engines_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Multiple Engines", "More than one rendering engine is available");
+
+ prop = RNA_def_property(srna, "use_spherical_stereo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_RenderSettings_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");
+
+ /* simplify */
+ prop = RNA_def_property(srna, "use_simplify", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_SIMPLIFY);
+ RNA_def_property_ui_text(
+ prop, "Use Simplify", "Enable simplification of scene for quicker preview renders");
+ RNA_def_property_update(prop, 0, "rna_Scene_use_simplify_update");
+
+ prop = RNA_def_property(srna, "simplify_subdivision", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf");
+ RNA_def_property_ui_range(prop, 0, 6, 1, -1);
+ RNA_def_property_ui_text(prop, "Simplify Subdivision", "Global maximum subdivision level");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
+ prop = RNA_def_property(srna, "simplify_child_particles", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "simplify_particles");
+ RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
+ prop = RNA_def_property(srna, "simplify_subdivision_render", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "simplify_subsurf_render");
+ RNA_def_property_ui_range(prop, 0, 6, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Simplify Subdivision", "Global maximum subdivision level during rendering");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
+ prop = RNA_def_property(srna, "simplify_child_particles_render", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "simplify_particles_render");
+ RNA_def_property_ui_text(
+ prop, "Simplify Child Particles", "Global child particles percentage during rendering");
+ RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
+
+ prop = RNA_def_property(srna, "use_simplify_smoke_highres", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_smoke_ignore_highres", 1);
+ RNA_def_property_ui_text(
+ prop, "Use High-resolution Smoke", "Display high-resolution smoke in the viewport");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ /* Grease Pencil - Simplify Options */
+ prop = RNA_def_property(srna, "simplify_gpencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ENABLE);
+ RNA_def_property_ui_text(prop, "Simplify", "Simplify Grease Pencil drawing");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "simplify_gpencil_onplay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ON_PLAY);
+ RNA_def_property_ui_text(
+ prop, "Simplify Playback", "Simplify Grease Pencil only during animation playback");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "simplify_gpencil_view_fill", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FILL);
+ RNA_def_property_ui_text(prop, "Disable Fill", "Disable fill strokes in the viewport");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "simplify_gpencil_remove_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_REMOVE_FILL_LINE);
+ RNA_def_property_ui_text(prop, "Disable Lines", "Disable external lines of fill strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "simplify_gpencil_view_modifier", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_MODIFIER);
+ RNA_def_property_ui_text(prop, "Disable Modifiers", "Do not apply modifiers in the viewport");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "simplify_gpencil_shader_fx", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_FX);
+ RNA_def_property_ui_text(prop, "Simplify Shaders", "Do not apply shader fx");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "simplify_gpencil_blend", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_BLEND);
+ RNA_def_property_ui_text(prop, "Layers Blending", "Do not display blend layers");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* persistent data */
+ prop = RNA_def_property(srna, "use_persistent_data", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", R_PERSISTENT_DATA);
+ RNA_def_property_ui_text(
+ prop, "Persistent Data", "Keep render data around for faster re-renders");
+ RNA_def_property_update(prop, 0, "rna_Scene_use_persistent_data_update");
+
+ /* Freestyle line thickness options */
+ prop = RNA_def_property(srna, "line_thickness_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "line_thickness_mode");
+ RNA_def_property_enum_items(prop, freestyle_thickness_items);
+ RNA_def_property_ui_text(
+ prop, "Line Thickness Mode", "Line thickness mode for Freestyle line drawing");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ prop = RNA_def_property(srna, "line_thickness", PROP_FLOAT, PROP_PIXEL);
+ RNA_def_property_float_sdna(prop, NULL, "unit_line_thickness");
+ RNA_def_property_range(prop, 0.f, 10000.f);
+ RNA_def_property_ui_text(prop, "Line Thickness", "Line thickness in pixels");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
+
+ /* Bake Settings */
+ prop = RNA_def_property(srna, "bake", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "bake");
+ RNA_def_property_struct_type(prop, "BakeSettings");
+ RNA_def_property_ui_text(prop, "Bake Data", "");
+
+ /* Nestled Data */
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
+ rna_def_bake_data(brna);
+ RNA_define_animate_sdna(true);
+
+ /* *** Animated *** */
+
+ /* Scene API */
+ RNA_api_scene_render(srna);
}
/* scene.objects */
static void rna_def_scene_objects(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- RNA_def_property_srna(cprop, "SceneObjects");
- srna = RNA_def_struct(brna, "SceneObjects", NULL);
- RNA_def_struct_sdna(srna, "Scene");
- RNA_def_struct_ui_text(srna, "Scene Objects", "All the of scene objects");
+ RNA_def_property_srna(cprop, "SceneObjects");
+ srna = RNA_def_struct(brna, "SceneObjects", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Scene Objects", "All the of scene objects");
}
/* scene.timeline_markers */
static void rna_def_timeline_markers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "TimelineMarkers");
- srna = RNA_def_struct(brna, "TimelineMarkers", NULL);
- RNA_def_struct_sdna(srna, "Scene");
- RNA_def_struct_ui_text(srna, "Timeline Markers", "Collection of timeline markers");
-
- func = RNA_def_function(srna, "new", "rna_TimeLine_add");
- RNA_def_function_ui_description(func, "Add a keyframe to the curve");
- parm = RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame", 1, -MAXFRAME, MAXFRAME, "", "The frame for the new marker", -MAXFRAME, MAXFRAME);
- parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created timeline marker");
- RNA_def_function_return(func, parm);
-
-
- func = RNA_def_function(srna, "remove", "rna_TimeLine_remove");
- RNA_def_function_ui_description(func, "Remove a timeline marker");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_TimeLine_clear");
- RNA_def_function_ui_description(func, "Remove all timeline markers");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "TimelineMarkers");
+ srna = RNA_def_struct(brna, "TimelineMarkers", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Timeline Markers", "Collection of timeline markers");
+
+ func = RNA_def_function(srna, "new", "rna_TimeLine_add");
+ RNA_def_function_ui_description(func, "Add a keyframe to the curve");
+ parm = RNA_def_string(func, "name", "Marker", 0, "", "New name for the marker (not unique)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The frame for the new marker",
+ -MAXFRAME,
+ MAXFRAME);
+ parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Newly created timeline marker");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_TimeLine_remove");
+ RNA_def_function_ui_description(func, "Remove a timeline marker");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "marker", "TimelineMarker", "", "Timeline marker to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_TimeLine_clear");
+ RNA_def_function_ui_description(func, "Remove all timeline markers");
}
/* scene.keying_sets */
static void rna_def_scene_keying_sets(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "KeyingSets");
- srna = RNA_def_struct(brna, "KeyingSets", NULL);
- RNA_def_struct_sdna(srna, "Scene");
- RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
-
- /* Add Keying Set */
- func = RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
- RNA_def_function_ui_description(func, "Add a new Keying Set to Scene");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* name */
- RNA_def_string(func, "idname", "KeyingSet", 64, "IDName", "Internal identifier of Keying Set");
- RNA_def_string(func, "name", "KeyingSet", 64, "Name", "User visible name of Keying Set");
- /* returns the new KeyingSet */
- parm = RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set");
- RNA_def_function_return(func, parm);
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get",
- "rna_Scene_active_keying_set_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get",
- "rna_Scene_active_keying_set_index_set", NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set Index",
- "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "KeyingSets");
+ srna = RNA_def_struct(brna, "KeyingSets", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Keying Sets", "Scene keying sets");
+
+ /* Add Keying Set */
+ func = RNA_def_function(srna, "new", "rna_Scene_keying_set_new");
+ RNA_def_function_ui_description(func, "Add a new Keying Set to Scene");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* name */
+ RNA_def_string(func, "idname", "KeyingSet", 64, "IDName", "Internal identifier of Keying Set");
+ RNA_def_string(func, "name", "KeyingSet", 64, "Name", "User visible name of Keying Set");
+ /* returns the new KeyingSet */
+ parm = RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set");
+ RNA_def_function_return(func, parm);
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
+ RNA_def_property_int_funcs(prop,
+ "rna_Scene_active_keying_set_index_get",
+ "rna_Scene_active_keying_set_index_set",
+ NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Active Keying Set Index",
+ "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
}
static void rna_def_scene_keying_sets_all(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "KeyingSetsAll");
- srna = RNA_def_struct(brna, "KeyingSetsAll", NULL);
- RNA_def_struct_sdna(srna, "Scene");
- RNA_def_struct_ui_text(srna, "Keying Sets All", "All available keying sets");
-
- /* NOTE: no add/remove available here, without screwing up this amalgamated list... */
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, "rna_Scene_active_keying_set_get",
- "rna_Scene_active_keying_set_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
- RNA_def_property_int_funcs(prop, "rna_Scene_active_keying_set_index_get",
- "rna_Scene_active_keying_set_index_set", NULL);
- RNA_def_property_ui_text(prop, "Active Keying Set Index",
- "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "KeyingSetsAll");
+ srna = RNA_def_struct(brna, "KeyingSetsAll", NULL);
+ RNA_def_struct_sdna(srna, "Scene");
+ RNA_def_struct_ui_text(srna, "Keying Sets All", "All available keying sets");
+
+ /* NOTE: no add/remove available here, without screwing up this amalgamated list... */
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Scene_active_keying_set_get", "rna_Scene_active_keying_set_set", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Active Keying Set", "Active Keying Set used to insert/delete keyframes");
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
+
+ prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "active_keyingset");
+ RNA_def_property_int_funcs(prop,
+ "rna_Scene_active_keying_set_index_get",
+ "rna_Scene_active_keying_set_index_set",
+ NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Active Keying Set Index",
+ "Current Keying Set index (negative for 'builtin' and positive for 'absolute')");
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
}
/* Runtime property, used to remember uv indices, used only in UV stitch for now.
*/
static void rna_def_selected_uv_element(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup");
- RNA_def_struct_ui_text(srna, "Selected UV Element", "");
+ srna = RNA_def_struct(brna, "SelectedUvElement", "PropertyGroup");
+ RNA_def_struct_ui_text(srna, "Selected UV Element", "");
- /* store the index to the UV element selected */
- prop = RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Element Index", "");
+ /* store the index to the UV element selected */
+ prop = RNA_def_property(srna, "element_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Element Index", "");
- prop = RNA_def_property(srna, "face_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Face Index", "");
+ prop = RNA_def_property(srna, "face_index", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Face Index", "");
}
static void rna_def_display_safe_areas(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static float default_title[2] = {0.1f, 0.05f};
- static float default_action[2] = {0.035f, 0.035f};
-
- static float default_title_center[2] = {0.175f, 0.05f};
- static float default_action_center[2] = {0.15f, 0.05f};
-
- srna = RNA_def_struct(brna, "DisplaySafeAreas", NULL);
- RNA_def_struct_ui_text(srna, "Safe Areas", "Safe areas used in 3D view and the sequencer");
- RNA_def_struct_sdna(srna, "DisplaySafeAreas");
-
- /* SAFE AREAS */
- prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "title");
- RNA_def_property_array(prop, 2);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_title);
- RNA_def_property_ui_text(prop, "Title Safe Margins", "Safe area for text and graphics");
- RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "action", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "action");
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_array_default(prop, default_action);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Action Safe Margins", "Safe area for general elements");
- RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "title_center", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "title_center");
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_array_default(prop, default_title_center);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Center Title Safe Margins", "Safe area for text and graphics in a different aspect ratio");
- RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
-
- prop = RNA_def_property(srna, "action_center", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "action_center");
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_array_default(prop, default_action_center);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Center Action Safe Margins", "Safe area for general elements in a different aspect ratio");
- RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static float default_title[2] = {0.1f, 0.05f};
+ static float default_action[2] = {0.035f, 0.035f};
+
+ static float default_title_center[2] = {0.175f, 0.05f};
+ static float default_action_center[2] = {0.15f, 0.05f};
+
+ srna = RNA_def_struct(brna, "DisplaySafeAreas", NULL);
+ RNA_def_struct_ui_text(srna, "Safe Areas", "Safe areas used in 3D view and the sequencer");
+ RNA_def_struct_sdna(srna, "DisplaySafeAreas");
+
+ /* SAFE AREAS */
+ prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "title");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_title);
+ RNA_def_property_ui_text(prop, "Title Safe Margins", "Safe area for text and graphics");
+ RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "action", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "action");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_array_default(prop, default_action);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Action Safe Margins", "Safe area for general elements");
+ RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "title_center", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "title_center");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_array_default(prop, default_title_center);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Center Title Safe Margins",
+ "Safe area for text and graphics in a different aspect ratio");
+ RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
+
+ prop = RNA_def_property(srna, "action_center", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "action_center");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_array_default(prop, default_action_center);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop,
+ "Center Action Safe Margins",
+ "Safe area for general elements in a different aspect ratio");
+ RNA_def_property_update(prop, NC_SCENE | ND_DRAW_RENDER_VIEWPORT, NULL);
}
static void rna_def_scene_display(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static float default_light_direction[3] = {-M_SQRT1_3, -M_SQRT1_3, M_SQRT1_3};
-
- srna = RNA_def_struct(brna, "SceneDisplay", NULL);
- RNA_def_struct_ui_text(srna, "Scene Display", "Scene display settings for 3d viewport");
- RNA_def_struct_sdna(srna, "SceneDisplay");
-
- prop = RNA_def_property(srna, "light_direction", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_float_sdna(prop, NULL, "light_direction");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_light_direction);
- RNA_def_property_ui_text(prop, "Light Direction", "Direction of the light for shadows and highlights");
- RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
-
- prop = RNA_def_property(srna, "shadow_shift", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_default(prop, 0.1);
- RNA_def_property_ui_text(prop, "Shadow Shift", "Shadow termination angle");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 2);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
-
- prop = RNA_def_property(srna, "shadow_focus", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.0);
- RNA_def_property_ui_text(prop, "Shadow Focus", "Shadow factor hardness");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
-
- prop = RNA_def_property(srna, "matcap_ssao_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
-
- prop = RNA_def_property(srna, "matcap_ssao_attenuation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
- RNA_def_property_range(prop, 1.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
-
- prop = RNA_def_property(srna, "matcap_ssao_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 16);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples");
- RNA_def_property_range(prop, 1, 500);
-
- /* OpenGL render engine settings. */
- prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Shading Settings", "Shading settings for OpenGL render engine");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static float default_light_direction[3] = {-M_SQRT1_3, -M_SQRT1_3, M_SQRT1_3};
+
+ srna = RNA_def_struct(brna, "SceneDisplay", NULL);
+ RNA_def_struct_ui_text(srna, "Scene Display", "Scene display settings for 3d viewport");
+ RNA_def_struct_sdna(srna, "SceneDisplay");
+
+ prop = RNA_def_property(srna, "light_direction", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_float_sdna(prop, NULL, "light_direction");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_light_direction);
+ RNA_def_property_ui_text(
+ prop, "Light Direction", "Direction of the light for shadows and highlights");
+ RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
+
+ prop = RNA_def_property(srna, "shadow_shift", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_default(prop, 0.1);
+ RNA_def_property_ui_text(prop, "Shadow Shift", "Shadow termination angle");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 2);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
+
+ prop = RNA_def_property(srna, "shadow_focus", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.0);
+ RNA_def_property_ui_text(prop, "Shadow Focus", "Shadow factor hardness");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
+
+ prop = RNA_def_property(srna, "matcap_ssao_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_ui_text(
+ prop, "Distance", "Distance of object that contribute to the Cavity/Edge effect");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+
+ prop = RNA_def_property(srna, "matcap_ssao_attenuation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Attenuation", "Attenuation constant");
+ RNA_def_property_range(prop, 1.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 1.0f, 100.0f, 1, 3);
+
+ prop = RNA_def_property(srna, "matcap_ssao_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 16);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples");
+ RNA_def_property_range(prop, 1, 500);
+
+ /* OpenGL render engine settings. */
+ prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Shading Settings", "Shading settings for OpenGL render engine");
}
static void rna_def_scene_eevee(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem eevee_shadow_method_items[] = {
- {SHADOW_ESM, "ESM", 0, "ESM", "Exponential Shadow Mapping"},
- {SHADOW_VSM, "VSM", 0, "VSM", "Variance Shadow Mapping"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem eevee_shadow_size_items[] = {
- {64, "64", 0, "64px", ""},
- {128, "128", 0, "128px", ""},
- {256, "256", 0, "256px", ""},
- {512, "512", 0, "512px", ""},
- {1024, "1024", 0, "1024px", ""},
- {2048, "2048", 0, "2048px", ""},
- {4096, "4096", 0, "4096px", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem eevee_gi_visibility_size_items[] = {
- {8, "8", 0, "8px", ""},
- {16, "16", 0, "16px", ""},
- {32, "32", 0, "32px", ""},
- {64, "64", 0, "64px", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem eevee_volumetric_tile_size_items[] = {
- {2, "2", 0, "2px", ""},
- {4, "4", 0, "4px", ""},
- {8, "8", 0, "8px", ""},
- {16, "16", 0, "16px", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static float default_bloom_color[3] = {1.0f, 1.0f, 1.0f};
-
- srna = RNA_def_struct(brna, "SceneEEVEE", NULL);
- RNA_def_struct_path_func(srna, "rna_SceneEEVEE_path");
- RNA_def_struct_ui_text(srna, "Scene Display", "Scene display settings for 3d viewport");
-
- /* Indirect Lighting */
- prop = RNA_def_property(srna, "gi_diffuse_bounces", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 3);
- RNA_def_property_ui_text(prop, "Diffuse Bounces", "Number of time the light is reinjected inside light grids, "
- "0 disable indirect diffuse light");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, eevee_shadow_size_items);
- RNA_def_property_enum_default(prop, 512);
- RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "gi_visibility_resolution", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, eevee_gi_visibility_size_items);
- RNA_def_property_enum_default(prop, 32);
- RNA_def_property_ui_text(prop, "Irradiance Visibility Size",
- "Size of the shadow map applied to each irradiance sample");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "gi_irradiance_smoothing", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 5, 2);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_ui_text(prop, "Irradiance Smoothing", "Smoother irradiance interpolation but introduce light bleeding");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gi_glossy_clamp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_ui_text(prop, "Clamp Glossy", "Clamp pixel intensity to reduce noise inside glossy reflections "
- "from reflection cubemaps (0 to disabled)");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "gi_filter_quality", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Filter Quality", "Take more samples during cubemap filtering to remove artifacts");
- RNA_def_property_range(prop, 1.0f, 8.0f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "gi_show_irradiance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_IRRADIANCE);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
- RNA_def_property_ui_text(prop, "Show Irradiance Cache", "Display irradiance samples in the viewport");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gi_show_cubemaps", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_CUBEMAPS);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
- RNA_def_property_ui_text(prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "gi_irradiance_draw_size");
- RNA_def_property_range(prop, 0.05f, 10.0f);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_ui_text(prop, "Irradiance Display Size", "Size of the irradiance sample spheres to debug captured light");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "gi_cubemap_draw_size");
- RNA_def_property_range(prop, 0.05f, 10.0f);
- RNA_def_property_float_default(prop, 0.3f);
- RNA_def_property_ui_text(prop, "Cubemap Display Size", "Size of the cubemap spheres to debug captured light");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gi_auto_bake", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GI_AUTOBAKE);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Auto Bake", "Auto bake indirect lighting when editing probes");
-
- prop = RNA_def_property(srna, "gi_cache_info", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "light_cache_info");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Light Cache Info", "Info on current cache status");
-
- /* Temporal Anti-Aliasing (super sampling) */
- prop = RNA_def_property(srna, "taa_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 16);
- RNA_def_property_ui_text(prop, "Viewport Samples", "Number of samples, unlimited if 0");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "taa_render_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 64);
- RNA_def_property_ui_text(prop, "Render Samples", "Number of samples per pixels for rendering");
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_taa_reprojection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_TAA_REPROJECTION);
- RNA_def_property_boolean_default(prop, 1);
- RNA_def_property_ui_text(prop, "Viewport Denoising", "Denoise image using temporal reprojection "
- "(can leave some ghosting)");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Screen Space Subsurface Scattering */
- prop = RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSS_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Subsurface Scattering", "Enable screen space subsurface scattering");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "sss_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 7);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute the scattering effect");
- RNA_def_property_range(prop, 1, 32);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "sss_jitter_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.3f);
- RNA_def_property_ui_text(prop, "Jitter Threshold", "Rotate samples that are below this threshold");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_sss_separate_albedo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSS_SEPARATE_ALBEDO);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Separate Albedo", "Avoid albedo being blurred by the subsurface scattering "
- "but uses more video memory");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Screen Space Reflection */
- prop = RNA_def_property(srna, "use_ssr", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_ssr_refraction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_REFRACTION);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_ssr_halfres", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_HALF_RESOLUTION);
- RNA_def_property_boolean_default(prop, 1);
- RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.25f);
- RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the screen space raytracing");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(prop, "Max Roughness", "Do not raytrace reflections for roughness above this value");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection");
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.075f);
- RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR");
- RNA_def_property_range(prop, 0.0f, 0.5f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 10.0f);
- RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disabled)");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Volumetrics */
- prop = RNA_def_property(srna, "use_volumetric", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Volumetrics", "Enable scattering and absorbance of volumetric material");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_ui_text(prop, "Start", "Start distance of the volumetric effect");
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_default(prop, 100.0f);
- RNA_def_property_ui_text(prop, "End", "End distance of the volumetric effect");
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_tile_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_default(prop, 8);
- RNA_def_property_enum_items(prop, eevee_volumetric_tile_size_items);
- RNA_def_property_ui_text(prop, "Tile Size", "Control the quality of the volumetric effects "
- "(lower size increase vram usage and quality)");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 64);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute volumetric effects");
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_sample_distribution", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.8f);
- RNA_def_property_ui_text(prop, "Exponential Sampling", "Distribute more samples closer to the camera");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_volumetric_lights", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_LIGHTS);
- RNA_def_property_boolean_default(prop, 1);
- RNA_def_property_ui_text(prop, "Volumetric Lighting", "Enable scene light interactions with volumetrics");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_volumetric_shadows", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_SHADOWS);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "volumetric_shadow_samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_default(prop, 16);
- RNA_def_property_range(prop, 1, 128);
- RNA_def_property_ui_text(prop, "Volumetric Shadow Samples", "Number of samples to compute volumetric shadowing");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Ambient Occlusion */
- prop = RNA_def_property(srna, "use_gtao", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Ambient Occlusion", "Enable ambient occlusion to simulate medium scale indirect shadowing");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_gtao_bent_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_BENT_NORMALS);
- RNA_def_property_boolean_default(prop, 1);
- RNA_def_property_ui_text(prop, "Bent Normals", "Compute main non occluded direction to sample the environment");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_gtao_bounce", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_BOUNCE);
- RNA_def_property_boolean_default(prop, 1);
- RNA_def_property_ui_text(prop, "Bounces Approximation", "An approximation to simulate light bounces "
- "giving less occlusion on brighter objects");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.25f);
- RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the horizon search");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "gtao_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_default(prop, 0.2f);
- RNA_def_property_ui_text(prop, "Distance", "Distance of object that contribute to the ambient occlusion effect");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Depth of Field */
- prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_DOF_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Depth of Field", "Enable depth of field using the values from the active camera");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_PIXEL);
- RNA_def_property_float_default(prop, 100.0f);
- RNA_def_property_ui_text(prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)");
- RNA_def_property_range(prop, 0.0f, 2000.0f);
- RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Bloom */
- prop = RNA_def_property(srna, "use_bloom", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_BLOOM_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Bloom", "High brightness pixels generate a glowing effect");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.8f);
- RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bloom_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_array_default(prop, default_bloom_color);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Color applied to the bloom effect");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 6.5f);
- RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.0f);
- RNA_def_property_ui_text(prop, "Clamp", "Maximum intensity a bloom pixel can have (0 to disabled)");
- RNA_def_property_range(prop, 0.0f, 100000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 0.05f);
- RNA_def_property_ui_text(prop, "Intensity", "Blend factor");
- RNA_def_property_range(prop, 0.0f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.0f, 0.1f, 1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Motion blur */
- prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_MOTION_BLUR_ENABLED);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Motion Blur", "Enable motion blur effect (only in camera view)");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_default(prop, 8);
- RNA_def_property_ui_text(prop, "Samples", "Number of samples to take with motion blur");
- RNA_def_property_range(prop, 1, 64);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Shadows */
- prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_default(prop, SHADOW_ESM);
- RNA_def_property_enum_items(prop, eevee_shadow_method_items);
- RNA_def_property_ui_text(prop, "Method", "Technique use to compute the shadows");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "shadow_cube_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_default(prop, 512);
- RNA_def_property_enum_items(prop, eevee_shadow_size_items);
- RNA_def_property_ui_text(prop, "Cube Shadows Resolution", "Size of point and area light shadow maps");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "shadow_cascade_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_default(prop, 1024);
- RNA_def_property_enum_items(prop, eevee_shadow_size_items);
- RNA_def_property_ui_text(prop, "Directional Shadows Resolution", "Size of sun light shadow maps");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_HIGH_BITDEPTH);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "use_soft_shadows", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_SOFT);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Soft Shadows", "Randomize shadowmaps origin to create soft shadows");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- prop = RNA_def_property(srna, "light_threshold", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_default(prop, 0.01f);
- RNA_def_property_ui_text(prop, "Light Threshold", "Minimum light intensity for a light to contribute to the lighting");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Overscan */
- prop = RNA_def_property(srna, "use_overscan", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_OVERSCAN);
- RNA_def_property_boolean_default(prop, 0);
- RNA_def_property_ui_text(prop, "Overscan", "Internally render past the image border to avoid "
- "screen-space effects disappearing");
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
-
- prop = RNA_def_property(srna, "overscan_size", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_float_sdna(prop, NULL, "overscan");
- RNA_def_property_float_default(prop, 3.0f);
- RNA_def_property_ui_text(prop, "Overscan Size", "Percentage of render size to add as overscan to the "
- "internal render buffers");
- RNA_def_property_range(prop, 0.0f, 50.0f);
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 2);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem eevee_shadow_method_items[] = {
+ {SHADOW_ESM, "ESM", 0, "ESM", "Exponential Shadow Mapping"},
+ {SHADOW_VSM, "VSM", 0, "VSM", "Variance Shadow Mapping"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem eevee_shadow_size_items[] = {
+ {64, "64", 0, "64px", ""},
+ {128, "128", 0, "128px", ""},
+ {256, "256", 0, "256px", ""},
+ {512, "512", 0, "512px", ""},
+ {1024, "1024", 0, "1024px", ""},
+ {2048, "2048", 0, "2048px", ""},
+ {4096, "4096", 0, "4096px", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem eevee_gi_visibility_size_items[] = {
+ {8, "8", 0, "8px", ""},
+ {16, "16", 0, "16px", ""},
+ {32, "32", 0, "32px", ""},
+ {64, "64", 0, "64px", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem eevee_volumetric_tile_size_items[] = {
+ {2, "2", 0, "2px", ""},
+ {4, "4", 0, "4px", ""},
+ {8, "8", 0, "8px", ""},
+ {16, "16", 0, "16px", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static float default_bloom_color[3] = {1.0f, 1.0f, 1.0f};
+
+ srna = RNA_def_struct(brna, "SceneEEVEE", NULL);
+ RNA_def_struct_path_func(srna, "rna_SceneEEVEE_path");
+ RNA_def_struct_ui_text(srna, "Scene Display", "Scene display settings for 3d viewport");
+
+ /* Indirect Lighting */
+ prop = RNA_def_property(srna, "gi_diffuse_bounces", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 3);
+ RNA_def_property_ui_text(prop,
+ "Diffuse Bounces",
+ "Number of time the light is reinjected inside light grids, "
+ "0 disable indirect diffuse light");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "gi_cubemap_resolution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, eevee_shadow_size_items);
+ RNA_def_property_enum_default(prop, 512);
+ RNA_def_property_ui_text(prop, "Cubemap Size", "Size of every cubemaps");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "gi_visibility_resolution", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, eevee_gi_visibility_size_items);
+ RNA_def_property_enum_default(prop, 32);
+ RNA_def_property_ui_text(prop,
+ "Irradiance Visibility Size",
+ "Size of the shadow map applied to each irradiance sample");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "gi_irradiance_smoothing", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 5, 2);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(prop,
+ "Irradiance Smoothing",
+ "Smoother irradiance interpolation but introduce light bleeding");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gi_glossy_clamp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(prop,
+ "Clamp Glossy",
+ "Clamp pixel intensity to reduce noise inside glossy reflections "
+ "from reflection cubemaps (0 to disabled)");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "gi_filter_quality", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Filter Quality", "Take more samples during cubemap filtering to remove artifacts");
+ RNA_def_property_range(prop, 1.0f, 8.0f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "gi_show_irradiance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_IRRADIANCE);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
+ RNA_def_property_ui_text(
+ prop, "Show Irradiance Cache", "Display irradiance samples in the viewport");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gi_show_cubemaps", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHOW_CUBEMAPS);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_ON, 1);
+ RNA_def_property_ui_text(
+ prop, "Show Cubemap Cache", "Display captured cubemaps in the viewport");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gi_irradiance_display_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "gi_irradiance_draw_size");
+ RNA_def_property_range(prop, 0.05f, 10.0f);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(prop,
+ "Irradiance Display Size",
+ "Size of the irradiance sample spheres to debug captured light");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gi_cubemap_display_size", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "gi_cubemap_draw_size");
+ RNA_def_property_range(prop, 0.05f, 10.0f);
+ RNA_def_property_float_default(prop, 0.3f);
+ RNA_def_property_ui_text(
+ prop, "Cubemap Display Size", "Size of the cubemap spheres to debug captured light");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gi_auto_bake", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GI_AUTOBAKE);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop, "Auto Bake", "Auto bake indirect lighting when editing probes");
+
+ prop = RNA_def_property(srna, "gi_cache_info", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "light_cache_info");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Light Cache Info", "Info on current cache status");
+
+ /* Temporal Anti-Aliasing (super sampling) */
+ prop = RNA_def_property(srna, "taa_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 16);
+ RNA_def_property_ui_text(prop, "Viewport Samples", "Number of samples, unlimited if 0");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "taa_render_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 64);
+ RNA_def_property_ui_text(prop, "Render Samples", "Number of samples per pixels for rendering");
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_taa_reprojection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_TAA_REPROJECTION);
+ RNA_def_property_boolean_default(prop, 1);
+ RNA_def_property_ui_text(prop,
+ "Viewport Denoising",
+ "Denoise image using temporal reprojection "
+ "(can leave some ghosting)");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Screen Space Subsurface Scattering */
+ prop = RNA_def_property(srna, "use_sss", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSS_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(
+ prop, "Subsurface Scattering", "Enable screen space subsurface scattering");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "sss_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 7);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute the scattering effect");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "sss_jitter_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.3f);
+ RNA_def_property_ui_text(
+ prop, "Jitter Threshold", "Rotate samples that are below this threshold");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_sss_separate_albedo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSS_SEPARATE_ALBEDO);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop,
+ "Separate Albedo",
+ "Avoid albedo being blurred by the subsurface scattering "
+ "but uses more video memory");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Screen Space Reflection */
+ prop = RNA_def_property(srna, "use_ssr", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop, "Screen Space Reflections", "Enable screen space reflection");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_ssr_refraction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_REFRACTION);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop, "Screen Space Refractions", "Enable screen space Refractions");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_ssr_halfres", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SSR_HALF_RESOLUTION);
+ RNA_def_property_boolean_default(prop, 1);
+ RNA_def_property_ui_text(prop, "Half Res Trace", "Raytrace at a lower resolution");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "ssr_quality", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.25f);
+ RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the screen space raytracing");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "ssr_max_roughness", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(
+ prop, "Max Roughness", "Do not raytrace reflections for roughness above this value");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "ssr_thickness", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_ui_text(prop, "Thickness", "Pixel thickness used to detect intersection");
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 5, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "ssr_border_fade", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.075f);
+ RNA_def_property_ui_text(prop, "Edge Fading", "Screen percentage used to fade the SSR");
+ RNA_def_property_range(prop, 0.0f, 0.5f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "ssr_firefly_fac", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 10.0f);
+ RNA_def_property_ui_text(prop, "Clamp", "Clamp pixel intensity to remove noise (0 to disabled)");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Volumetrics */
+ prop = RNA_def_property(srna, "use_volumetric", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(
+ prop, "Volumetrics", "Enable scattering and absorbance of volumetric material");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(prop, "Start", "Start distance of the volumetric effect");
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_end", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_default(prop, 100.0f);
+ RNA_def_property_ui_text(prop, "End", "End distance of the volumetric effect");
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_tile_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_default(prop, 8);
+ RNA_def_property_enum_items(prop, eevee_volumetric_tile_size_items);
+ RNA_def_property_ui_text(prop,
+ "Tile Size",
+ "Control the quality of the volumetric effects "
+ "(lower size increase vram usage and quality)");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 64);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples to compute volumetric effects");
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_sample_distribution", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_ui_text(
+ prop, "Exponential Sampling", "Distribute more samples closer to the camera");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_volumetric_lights", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_LIGHTS);
+ RNA_def_property_boolean_default(prop, 1);
+ RNA_def_property_ui_text(
+ prop, "Volumetric Lighting", "Enable scene light interactions with volumetrics");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_light_clamp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Clamp", "Maximum light contribution, reducing noise");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_volumetric_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_VOLUMETRIC_SHADOWS);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(
+ prop, "Volumetric Shadows", "Generate shadows from volumetric material (Very expensive)");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "volumetric_shadow_samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_default(prop, 16);
+ RNA_def_property_range(prop, 1, 128);
+ RNA_def_property_ui_text(
+ prop, "Volumetric Shadow Samples", "Number of samples to compute volumetric shadowing");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Ambient Occlusion */
+ prop = RNA_def_property(srna, "use_gtao", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop,
+ "Ambient Occlusion",
+ "Enable ambient occlusion to simulate medium scale indirect shadowing");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_gtao_bent_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_BENT_NORMALS);
+ RNA_def_property_boolean_default(prop, 1);
+ RNA_def_property_ui_text(
+ prop, "Bent Normals", "Compute main non occluded direction to sample the environment");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_gtao_bounce", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_GTAO_BOUNCE);
+ RNA_def_property_boolean_default(prop, 1);
+ RNA_def_property_ui_text(prop,
+ "Bounces Approximation",
+ "An approximation to simulate light bounces "
+ "giving less occlusion on brighter objects");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gtao_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gtao_quality", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.25f);
+ RNA_def_property_ui_text(prop, "Trace Precision", "Precision of the horizon search");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "gtao_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_default(prop, 0.2f);
+ RNA_def_property_ui_text(
+ prop, "Distance", "Distance of object that contribute to the ambient occlusion effect");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Depth of Field */
+ prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_DOF_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(
+ prop, "Depth of Field", "Enable depth of field using the values from the active camera");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bokeh_max_size", PROP_FLOAT, PROP_PIXEL);
+ RNA_def_property_float_default(prop, 100.0f);
+ RNA_def_property_ui_text(
+ prop, "Max Size", "Max size of the bokeh shape for the depth of field (lower is faster)");
+ RNA_def_property_range(prop, 0.0f, 2000.0f);
+ RNA_def_property_ui_range(prop, 2.0f, 200.0f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "bokeh_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Sprite Threshold", "Brightness threshold for using sprite base depth of field");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Bloom */
+ prop = RNA_def_property(srna, "use_bloom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_BLOOM_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop, "Bloom", "High brightness pixels generate a glowing effect");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bloom_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.8f);
+ RNA_def_property_ui_text(prop, "Threshold", "Filters out pixels under this level of brightness");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bloom_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_array_default(prop, default_bloom_color);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Color applied to the bloom effect");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bloom_knee", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(prop, "Knee", "Makes transition between under/over-threshold gradual");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bloom_radius", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 6.5f);
+ RNA_def_property_ui_text(prop, "Radius", "Bloom spread distance");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bloom_clamp", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.0f);
+ RNA_def_property_ui_text(
+ prop, "Clamp", "Maximum intensity a bloom pixel can have (0 to disabled)");
+ RNA_def_property_range(prop, 0.0f, 100000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1000.0f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "bloom_intensity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 0.05f);
+ RNA_def_property_ui_text(prop, "Intensity", "Blend factor");
+ RNA_def_property_range(prop, 0.0f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 0.1f, 1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Motion blur */
+ prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_MOTION_BLUR_ENABLED);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop, "Motion Blur", "Enable motion blur effect (only in camera view)");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "motion_blur_samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_default(prop, 8);
+ RNA_def_property_ui_text(prop, "Samples", "Number of samples to take with motion blur");
+ RNA_def_property_range(prop, 1, 64);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "motion_blur_shutter", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Shutter", "Time taken in frames between shutter open and close");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.01f, 1.0f, 1, 2);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Shadows */
+ prop = RNA_def_property(srna, "shadow_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_default(prop, SHADOW_ESM);
+ RNA_def_property_enum_items(prop, eevee_shadow_method_items);
+ RNA_def_property_ui_text(prop, "Method", "Technique use to compute the shadows");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "shadow_cube_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_default(prop, 512);
+ RNA_def_property_enum_items(prop, eevee_shadow_size_items);
+ RNA_def_property_ui_text(
+ prop, "Cube Shadows Resolution", "Size of point and area light shadow maps");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "shadow_cascade_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_default(prop, 1024);
+ RNA_def_property_enum_items(prop, eevee_shadow_size_items);
+ RNA_def_property_ui_text(
+ prop, "Directional Shadows Resolution", "Size of sun light shadow maps");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_shadow_high_bitdepth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_HIGH_BITDEPTH);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop, "High Bitdepth", "Use 32bit shadows");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "use_soft_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_SHADOW_SOFT);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(
+ prop, "Soft Shadows", "Randomize shadowmaps origin to create soft shadows");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ prop = RNA_def_property(srna, "light_threshold", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_default(prop, 0.01f);
+ RNA_def_property_ui_text(prop,
+ "Light Threshold",
+ "Minimum light intensity for a light to contribute to the lighting");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Overscan */
+ prop = RNA_def_property(srna, "use_overscan", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_EEVEE_OVERSCAN);
+ RNA_def_property_boolean_default(prop, 0);
+ RNA_def_property_ui_text(prop,
+ "Overscan",
+ "Internally render past the image border to avoid "
+ "screen-space effects disappearing");
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+
+ prop = RNA_def_property(srna, "overscan_size", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_float_sdna(prop, NULL, "overscan");
+ RNA_def_property_float_default(prop, 3.0f);
+ RNA_def_property_ui_text(prop,
+ "Overscan Size",
+ "Percentage of render size to add as overscan to the "
+ "internal render buffers");
+ RNA_def_property_range(prop, 0.0f, 50.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 1, 2);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
}
void RNA_def_scene(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem audio_distance_model_items[] = {
- {0, "NONE", 0, "None", "No distance attenuation"},
- {1, "INVERSE", 0, "Inverse", "Inverse distance model"},
- {2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping"},
- {3, "LINEAR", 0, "Linear", "Linear distance model"},
- {4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"},
- {5, "EXPONENT", 0, "Exponent", "Exponent distance model"},
- {6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem sync_mode_items[] = {
- {0, "NONE", 0, "No Sync", "Do not sync, play every frame"},
- {SCE_FRAME_DROP, "FRAME_DROP", 0, "Frame Dropping", "Drop frames if playback is too slow"},
- {AUDIO_SYNC, "AUDIO_SYNC", 0, "AV-sync", "Sync to audio playback, dropping frames"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* Struct definition */
- srna = RNA_def_struct(brna, "Scene", "ID");
- RNA_def_struct_ui_text(srna, "Scene", "Scene data-block, consisting in objects and "
- "defining time and render related settings");
- RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA);
- RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
-
- /* Global Settings */
- prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
- RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene");
- RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_camera_update");
-
- prop = RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "set");
- RNA_def_property_struct_type(prop, "Scene");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Background Scene", "Background set scene");
- RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
-
- prop = RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
- RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_world_update");
-
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "Objects", "");
- RNA_def_property_collection_funcs(prop,
- "rna_Scene_objects_begin",
- "rna_Scene_objects_next",
- "rna_Scene_objects_end",
- "rna_Scene_objects_get",
- NULL, NULL, NULL, NULL);
- rna_def_scene_objects(brna, prop);
-
- /* Frame Range Stuff */
- prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "r.cfra");
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_int_funcs(prop, NULL, "rna_Scene_frame_current_set", NULL);
- RNA_def_property_ui_text(prop, "Current Frame",
- "Current Frame, to update animation data from python frame_set() instead");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
-
- prop = RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME);
- RNA_def_property_float_sdna(prop, NULL, "r.subframe");
- RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
-
- prop = RNA_def_property(srna, "frame_float", PROP_FLOAT, PROP_TIME);
- RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_ui_range(prop, MINAFRAME, MAXFRAME, 0.1, 2);
- RNA_def_property_float_funcs(prop, "rna_Scene_frame_float_get", "rna_Scene_frame_float_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "r.sfra");
- RNA_def_property_int_funcs(prop, NULL, "rna_Scene_start_frame_set", NULL);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_int_default(prop, 1);
- RNA_def_property_ui_text(prop, "Start Frame", "First frame of the playback/rendering range");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
-
- prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "r.efra");
- RNA_def_property_int_funcs(prop, NULL, "rna_Scene_end_frame_set", NULL);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_int_default(prop, 250);
- RNA_def_property_ui_text(prop, "End Frame", "Final frame of the playback/rendering range");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
-
- prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "r.frame_step");
- RNA_def_property_range(prop, 0, MAXFRAME);
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
- RNA_def_property_ui_text(prop, "Frame Step",
- "Number of frames to skip forward while rendering/playing back each frame");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
-
- prop = RNA_def_property(srna, "frame_current_final", PROP_FLOAT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
- RNA_def_property_float_funcs(prop, "rna_Scene_frame_current_final_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Current Frame Final",
- "Current frame with subframe and time remapping applied");
-
- prop = RNA_def_property(srna, "lock_frame_selection_to_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_LOCK_FRAME_SELECTION);
- RNA_def_property_ui_text(prop, "Lock Frame Selection",
- "Don't allow frame to be selected with mouse outside of frame range");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
-
- /* Preview Range (frame-range for UI playback) */
- prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set");
- RNA_def_property_ui_text(prop, "Use Preview Range",
- "Use an alternative start/end frame range for animation playback and "
- "OpenGL renders instead of the Render properties start/end frame range");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
- RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0);
-
- prop = RNA_def_property(srna, "frame_preview_start", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "r.psfra");
- RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_start_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Preview Range Start Frame", "Alternative start frame for UI playback");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
-
- prop = RNA_def_property(srna, "frame_preview_end", PROP_INT, PROP_TIME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "r.pefra");
- RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_end_frame_set", NULL);
- RNA_def_property_ui_text(prop, "Preview Range End Frame", "Alternative end frame for UI playback");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
-
- /* Subframe for moblur debug. */
- prop = RNA_def_property(srna, "show_subframe", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_SHOW_SUBFRAME);
- RNA_def_property_ui_text(prop, "Show Subframe",
- "Show current scene subframe and allow set it using interface tools");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_show_subframe_update");
-
- /* Timeline / Time Navigation settings */
- prop = RNA_def_property(srna, "show_keys_from_selected_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCE_KEYS_NO_SELONLY);
- RNA_def_property_ui_text(prop, "Only Keyframes from Selected Channels",
- "Consider keyframes for active Object and/or its selected bones only "
- "(in timeline and when jumping between keyframes)");
- RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
-
- /* Stamp */
- prop = RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata");
- RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
-
- /* Animation Data (for Scene) */
- rna_def_animdata_common(srna);
-
- /* Readonly Properties */
- prop = RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */
- RNA_def_property_ui_text(prop, "NLA TweakMode",
- "Whether there is any action referenced by NLA being edited (strictly read-only)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* Frame dropping flag for playback and sync enum */
-#if 0 /* XXX: Is this actually needed? */
- prop = RNA_def_property(srna, "use_frame_drop", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_FRAME_DROP);
- RNA_def_property_ui_text(prop, "Frame Dropping", "Play back dropping frames if frame display is too slow");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-#endif
-
- prop = RNA_def_property(srna, "sync_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_funcs(prop, "rna_Scene_sync_mode_get", "rna_Scene_sync_mode_set", NULL);
- RNA_def_property_enum_items(prop, sync_mode_items);
- RNA_def_property_enum_default(prop, AUDIO_SYNC);
- RNA_def_property_ui_text(prop, "Sync Mode", "How to sync playback");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
-
- /* Nodes (Compositing) */
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree");
-
- prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Use Nodes", "Enable the compositing node tree");
- RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_nodes_update");
-
- /* Sequencer */
- prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ed");
- RNA_def_property_struct_type(prop, "SequenceEditor");
- RNA_def_property_ui_text(prop, "Sequence Editor", "");
-
- /* Keying Sets */
- prop = RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL);
- RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
- rna_def_scene_keying_sets(brna, prop);
-
- prop = RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_Scene_all_keyingsets_begin", "rna_Scene_all_keyingsets_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "KeyingSet");
- RNA_def_property_ui_text(prop, "All Keying Sets",
- "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
- RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
- rna_def_scene_keying_sets_all(brna, prop);
-
- /* Rigid Body Simulation */
- prop = RNA_def_property(srna, "rigidbody_world", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_world");
- RNA_def_property_struct_type(prop, "RigidBodyWorld");
- RNA_def_property_ui_text(prop, "Rigid Body World", "");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
- /* Tool Settings */
- prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "toolsettings");
- RNA_def_property_struct_type(prop, "ToolSettings");
- RNA_def_property_ui_text(prop, "Tool Settings", "");
-
- /* Unit Settings */
- prop = RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "unit");
- RNA_def_property_struct_type(prop, "UnitSettings");
- RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings");
-
- /* Physics Settings */
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
- RNA_def_property_float_sdna(prop, NULL, "physics_settings.gravity");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_range(prop, -200.0f, 200.0f, 1, 2);
- RNA_def_property_ui_text(prop, "Gravity", "Constant acceleration in a given direction");
- RNA_def_property_update(prop, 0, "rna_Physics_update");
-
- prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "physics_settings.flag", PHYS_GLOBAL_GRAVITY);
- RNA_def_property_ui_text(prop, "Global Gravity", "Use global gravity for all dynamics");
- RNA_def_property_update(prop, 0, "rna_Physics_update");
-
- /* Render Data */
- prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "r");
- RNA_def_property_struct_type(prop, "RenderSettings");
- RNA_def_property_ui_text(prop, "Render Data", "");
-
- /* Safe Areas */
- prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "safe_areas");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "DisplaySafeAreas");
- RNA_def_property_ui_text(prop, "Safe Areas", "");
-
- /* Markers */
- prop = RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
- RNA_def_property_struct_type(prop, "TimelineMarker");
- RNA_def_property_ui_text(prop, "Timeline Markers", "Markers used in all timelines for the current scene");
- rna_def_timeline_markers(brna, prop);
-
- /* Transform Orientations */
- prop = RNA_def_property(srna, "transform_orientation_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(
- prop,
- "rna_Scene_transform_orientation_slots_begin",
- "rna_iterator_array_next",
- "rna_iterator_array_end",
- "rna_iterator_array_get",
- "rna_Scene_transform_orientation_slots_length",
- NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "TransformOrientationSlot");
- RNA_def_property_ui_text(prop, "Transform Orientation Slots", "");
-
-
- /* 3D View Cursor */
- prop = RNA_def_property(srna, "cursor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "cursor");
- RNA_def_property_struct_type(prop, "View3DCursor");
- RNA_def_property_ui_text(prop, "3D Cursor", "");
-
- /* Audio Settings */
- prop = RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
- RNA_def_property_ui_text(prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
-#if 0 /* XXX: Is this actually needed? */
- prop = RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC);
- RNA_def_property_ui_text(prop, "Audio Sync",
- "Play back and sync with audio clock, dropping frames if frame display is too slow");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-#endif
-
- prop = RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SCRUB);
- RNA_def_property_ui_text(prop, "Audio Scrubbing", "Play audio from Sequence Editor while scrubbing");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
- prop = RNA_def_property(srna, "audio_doppler_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.01f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Speed of Sound", "Speed of sound for Doppler effect calculation");
- RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
-
- prop = RNA_def_property(srna, "audio_doppler_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for Doppler effect calculation");
- RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
-
- prop = RNA_def_property(srna, "audio_distance_model", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, audio_distance_model_items);
- RNA_def_property_ui_text(prop, "Distance Model", "Distance model for distance attenuation calculation");
- RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
-
- prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "audio.volume");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Volume", "Audio volume");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- RNA_def_property_update(prop, NC_SCENE, NULL);
- RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
-
- /* Statistics */
- func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", "");
- RNA_def_function_return(func, parm);
-
- /* Grease Pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Annotations", "Grease Pencil data-block used for annotations in the 3D view");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
-
- /* active MovieClip */
- prop = RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clip");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "MovieClip");
- RNA_def_property_ui_text(prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* color management */
- prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
- RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
- RNA_def_property_ui_text(prop, "View Settings", "Color management settings applied on image before saving");
-
- prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
- RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
- RNA_def_property_ui_text(prop, "Display Settings", "Settings of device saved image would be displayed on");
-
- prop = RNA_def_property(srna, "sequencer_colorspace_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "sequencer_colorspace_settings");
- RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings");
- RNA_def_property_ui_text(prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in");
-
- /* Layer and Collections */
- prop = RNA_def_property(srna, "view_layers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "view_layers", NULL);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_ui_text(prop, "View Layers", "");
- rna_def_view_layers(brna, prop);
-
- prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "master_collection");
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_ui_text(prop, "Collection", "Scene master collection that objects and other collections in the scene");
-
- /* Scene Display */
- prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "display");
- RNA_def_property_struct_type(prop, "SceneDisplay");
- RNA_def_property_ui_text(prop, "Scene Display", "Scene display settings for 3d viewport");
-
- /* EEVEE */
- prop = RNA_def_property(srna, "eevee", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "SceneEEVEE");
- RNA_def_property_ui_text(prop, "EEVEE", "EEVEE settings for the scene");
-
- /* Nestled Data */
- /* *** Non-Animated *** */
- RNA_define_animate_sdna(false);
- rna_def_tool_settings(brna);
- rna_def_gpencil_interpolate(brna);
- rna_def_unified_paint_settings(brna);
- rna_def_curve_paint_settings(brna);
- rna_def_statvis(brna);
- rna_def_unit_settings(brna);
- rna_def_scene_image_format_data(brna);
- rna_def_transform_orientation(brna);
- rna_def_transform_orientation_slot(brna);
- rna_def_view3d_cursor(brna);
- rna_def_selected_uv_element(brna);
- rna_def_display_safe_areas(brna);
- rna_def_scene_display(brna);
- rna_def_scene_eevee(brna);
- RNA_define_animate_sdna(true);
- /* *** Animated *** */
- rna_def_scene_render_data(brna);
- rna_def_gpu_fx(brna);
- rna_def_scene_render_view(brna);
-
- /* Scene API */
- RNA_api_scene(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem audio_distance_model_items[] = {
+ {0, "NONE", 0, "None", "No distance attenuation"},
+ {1, "INVERSE", 0, "Inverse", "Inverse distance model"},
+ {2, "INVERSE_CLAMPED", 0, "Inverse Clamped", "Inverse distance model with clamping"},
+ {3, "LINEAR", 0, "Linear", "Linear distance model"},
+ {4, "LINEAR_CLAMPED", 0, "Linear Clamped", "Linear distance model with clamping"},
+ {5, "EXPONENT", 0, "Exponent", "Exponent distance model"},
+ {6, "EXPONENT_CLAMPED", 0, "Exponent Clamped", "Exponent distance model with clamping"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem sync_mode_items[] = {
+ {0, "NONE", 0, "No Sync", "Do not sync, play every frame"},
+ {SCE_FRAME_DROP, "FRAME_DROP", 0, "Frame Dropping", "Drop frames if playback is too slow"},
+ {AUDIO_SYNC, "AUDIO_SYNC", 0, "AV-sync", "Sync to audio playback, dropping frames"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Struct definition */
+ srna = RNA_def_struct(brna, "Scene", "ID");
+ RNA_def_struct_ui_text(srna,
+ "Scene",
+ "Scene data-block, consisting in objects and "
+ "defining time and render related settings");
+ RNA_def_struct_ui_icon(srna, ICON_SCENE_DATA);
+ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+
+ /* Global Settings */
+ prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
+ RNA_def_property_ui_text(prop, "Camera", "Active camera, used for rendering the scene");
+ RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_camera_update");
+
+ prop = RNA_def_property(srna, "background_set", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "set");
+ RNA_def_property_struct_type(prop, "Scene");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Scene_set_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Background Scene", "Background set scene");
+ RNA_def_property_update(prop, NC_SCENE | NA_EDITED, "rna_Scene_set_update");
+
+ prop = RNA_def_property(srna, "world", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "World", "World used for rendering the scene");
+ RNA_def_property_update(prop, NC_SCENE | ND_WORLD, "rna_Scene_world_update");
+
+ prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_ui_text(prop, "Objects", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_Scene_objects_begin",
+ "rna_Scene_objects_next",
+ "rna_Scene_objects_end",
+ "rna_Scene_objects_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ rna_def_scene_objects(brna, prop);
+
+ /* Frame Range Stuff */
+ prop = RNA_def_property(srna, "frame_current", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "r.cfra");
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_int_funcs(prop, NULL, "rna_Scene_frame_current_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Current Frame",
+ "Current Frame, to update animation data from python frame_set() instead");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
+
+ prop = RNA_def_property(srna, "frame_subframe", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_float_sdna(prop, NULL, "r.subframe");
+ RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01, 2);
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
+
+ prop = RNA_def_property(srna, "frame_float", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_ui_text(prop, "Current Sub-Frame", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_ui_range(prop, MINAFRAME, MAXFRAME, 0.1, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_Scene_frame_float_get", "rna_Scene_frame_float_set", NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_frame_update");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "r.sfra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Scene_start_frame_set", NULL);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_int_default(prop, 1);
+ RNA_def_property_ui_text(prop, "Start Frame", "First frame of the playback/rendering range");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
+
+ prop = RNA_def_property(srna, "frame_end", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "r.efra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Scene_end_frame_set", NULL);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_int_default(prop, 250);
+ RNA_def_property_ui_text(prop, "End Frame", "Final frame of the playback/rendering range");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME_RANGE, NULL);
+
+ prop = RNA_def_property(srna, "frame_step", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "r.frame_step");
+ RNA_def_property_range(prop, 0, MAXFRAME);
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Frame Step",
+ "Number of frames to skip forward while rendering/playing back each frame");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
+
+ prop = RNA_def_property(srna, "frame_current_final", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_def_property_range(prop, MINAFRAME, MAXFRAME);
+ RNA_def_property_float_funcs(prop, "rna_Scene_frame_current_final_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Current Frame Final", "Current frame with subframe and time remapping applied");
+
+ prop = RNA_def_property(srna, "lock_frame_selection_to_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_LOCK_FRAME_SELECTION);
+ RNA_def_property_ui_text(prop,
+ "Lock Frame Selection",
+ "Don't allow frame to be selected with mouse outside of frame range");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
+
+ /* Preview Range (frame-range for UI playback) */
+ prop = RNA_def_property(srna, "use_preview_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_PRV_RANGE);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Scene_use_preview_range_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Use Preview Range",
+ "Use an alternative start/end frame range for animation playback and "
+ "OpenGL renders instead of the Render properties start/end frame range");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
+ RNA_def_property_ui_icon(prop, ICON_PREVIEW_RANGE, 0);
+
+ prop = RNA_def_property(srna, "frame_preview_start", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "r.psfra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_start_frame_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Preview Range Start Frame", "Alternative start frame for UI playback");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
+
+ prop = RNA_def_property(srna, "frame_preview_end", PROP_INT, PROP_TIME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "r.pefra");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Scene_preview_range_end_frame_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Preview Range End Frame", "Alternative end frame for UI playback");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
+
+ /* Subframe for moblur debug. */
+ prop = RNA_def_property(srna, "show_subframe", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "r.flag", SCER_SHOW_SUBFRAME);
+ RNA_def_property_ui_text(
+ prop, "Show Subframe", "Show current scene subframe and allow set it using interface tools");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, "rna_Scene_show_subframe_update");
+
+ /* Timeline / Time Navigation settings */
+ prop = RNA_def_property(srna, "show_keys_from_selected_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCE_KEYS_NO_SELONLY);
+ RNA_def_property_ui_text(prop,
+ "Only Keyframes from Selected Channels",
+ "Consider keyframes for active Object and/or its selected bones only "
+ "(in timeline and when jumping between keyframes)");
+ RNA_def_property_update(prop, NC_SCENE | ND_FRAME, NULL);
+
+ /* Stamp */
+ prop = RNA_def_property(srna, "use_stamp_note", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "r.stamp_udata");
+ RNA_def_property_ui_text(prop, "Stamp Note", "User defined note for the render stamping");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL);
+
+ /* Animation Data (for Scene) */
+ rna_def_animdata_common(srna);
+
+ /* Readonly Properties */
+ prop = RNA_def_property(srna, "is_nla_tweakmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_NLA_EDIT_ON);
+ RNA_def_property_clear_flag(prop,
+ PROP_EDITABLE); /* DO NOT MAKE THIS EDITABLE, OR NLA EDITOR BREAKS */
+ RNA_def_property_ui_text(
+ prop,
+ "NLA TweakMode",
+ "Whether there is any action referenced by NLA being edited (strictly read-only)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* Frame dropping flag for playback and sync enum */
+# if 0 /* XXX: Is this actually needed? */
+ prop = RNA_def_property(srna, "use_frame_drop", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SCE_FRAME_DROP);
+ RNA_def_property_ui_text(prop, "Frame Dropping", "Play back dropping frames if frame display is too slow");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+# endif
+
+ prop = RNA_def_property(srna, "sync_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_funcs(prop, "rna_Scene_sync_mode_get", "rna_Scene_sync_mode_set", NULL);
+ RNA_def_property_enum_items(prop, sync_mode_items);
+ RNA_def_property_enum_default(prop, AUDIO_SYNC);
+ RNA_def_property_ui_text(prop, "Sync Mode", "How to sync playback");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ /* Nodes (Compositing) */
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree");
+
+ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Use Nodes", "Enable the compositing node tree");
+ RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_use_nodes_update");
+
+ /* Sequencer */
+ prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ed");
+ RNA_def_property_struct_type(prop, "SequenceEditor");
+ RNA_def_property_ui_text(prop, "Sequence Editor", "");
+
+ /* Keying Sets */
+ prop = RNA_def_property(srna, "keying_sets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "keyingsets", NULL);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_ui_text(prop, "Absolute Keying Sets", "Absolute Keying Sets for this Scene");
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
+ rna_def_scene_keying_sets(brna, prop);
+
+ prop = RNA_def_property(srna, "keying_sets_all", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Scene_all_keyingsets_begin",
+ "rna_Scene_all_keyingsets_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "KeyingSet");
+ RNA_def_property_ui_text(
+ prop,
+ "All Keying Sets",
+ "All Keying Sets available for use (Builtins and Absolute Keying Sets for this Scene)");
+ RNA_def_property_update(prop, NC_SCENE | ND_KEYINGSET, NULL);
+ rna_def_scene_keying_sets_all(brna, prop);
+
+ /* Rigid Body Simulation */
+ prop = RNA_def_property(srna, "rigidbody_world", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "rigidbody_world");
+ RNA_def_property_struct_type(prop, "RigidBodyWorld");
+ RNA_def_property_ui_text(prop, "Rigid Body World", "");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ /* Tool Settings */
+ prop = RNA_def_property(srna, "tool_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "toolsettings");
+ RNA_def_property_struct_type(prop, "ToolSettings");
+ RNA_def_property_ui_text(prop, "Tool Settings", "");
+
+ /* Unit Settings */
+ prop = RNA_def_property(srna, "unit_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "unit");
+ RNA_def_property_struct_type(prop, "UnitSettings");
+ RNA_def_property_ui_text(prop, "Unit Settings", "Unit editing settings");
+
+ /* Physics Settings */
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_ACCELERATION);
+ RNA_def_property_float_sdna(prop, NULL, "physics_settings.gravity");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_range(prop, -200.0f, 200.0f, 1, 2);
+ RNA_def_property_ui_text(prop, "Gravity", "Constant acceleration in a given direction");
+ RNA_def_property_update(prop, 0, "rna_Physics_update");
+
+ prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "physics_settings.flag", PHYS_GLOBAL_GRAVITY);
+ RNA_def_property_ui_text(prop, "Global Gravity", "Use global gravity for all dynamics");
+ RNA_def_property_update(prop, 0, "rna_Physics_update");
+
+ /* Render Data */
+ prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "r");
+ RNA_def_property_struct_type(prop, "RenderSettings");
+ RNA_def_property_ui_text(prop, "Render Data", "");
+
+ /* Safe Areas */
+ prop = RNA_def_property(srna, "safe_areas", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "safe_areas");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "DisplaySafeAreas");
+ RNA_def_property_ui_text(prop, "Safe Areas", "");
+
+ /* Markers */
+ prop = RNA_def_property(srna, "timeline_markers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "markers", NULL);
+ RNA_def_property_struct_type(prop, "TimelineMarker");
+ RNA_def_property_ui_text(
+ prop, "Timeline Markers", "Markers used in all timelines for the current scene");
+ rna_def_timeline_markers(brna, prop);
+
+ /* Transform Orientations */
+ prop = RNA_def_property(srna, "transform_orientation_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_Scene_transform_orientation_slots_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_Scene_transform_orientation_slots_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "TransformOrientationSlot");
+ RNA_def_property_ui_text(prop, "Transform Orientation Slots", "");
+
+ /* 3D View Cursor */
+ prop = RNA_def_property(srna, "cursor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "cursor");
+ RNA_def_property_struct_type(prop, "View3DCursor");
+ RNA_def_property_ui_text(prop, "3D Cursor", "");
+
+ /* Audio Settings */
+ prop = RNA_def_property(srna, "use_audio", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Scene_use_audio_get", "rna_Scene_use_audio_set");
+ RNA_def_property_ui_text(
+ prop, "Audio Muted", "Play back of audio from Sequence Editor will be muted");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+# if 0 /* XXX: Is this actually needed? */
+ prop = RNA_def_property(srna, "use_audio_sync", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SYNC);
+ RNA_def_property_ui_text(prop, "Audio Sync",
+ "Play back and sync with audio clock, dropping frames if frame display is too slow");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+# endif
+
+ prop = RNA_def_property(srna, "use_audio_scrub", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "audio.flag", AUDIO_SCRUB);
+ RNA_def_property_ui_text(
+ prop, "Audio Scrubbing", "Play audio from Sequence Editor while scrubbing");
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop = RNA_def_property(srna, "audio_doppler_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "audio.speed_of_sound");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.01f, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Speed of Sound", "Speed of sound for Doppler effect calculation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
+
+ prop = RNA_def_property(srna, "audio_doppler_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "audio.doppler_factor");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Doppler Factor", "Pitch factor for Doppler effect calculation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
+
+ prop = RNA_def_property(srna, "audio_distance_model", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio.distance_model");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, audio_distance_model_items);
+ RNA_def_property_ui_text(
+ prop, "Distance Model", "Distance model for distance attenuation calculation");
+ RNA_def_property_update(prop, NC_SCENE, "rna_Scene_listener_update");
+
+ prop = RNA_def_property(srna, "audio_volume", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "audio.volume");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Volume", "Audio volume");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ RNA_def_property_update(prop, NC_SCENE, NULL);
+ RNA_def_property_float_funcs(prop, NULL, "rna_Scene_volume_set", NULL);
+
+ /* Statistics */
+ func = RNA_def_function(srna, "statistics", "rna_Scene_statistics_string_get");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Active layer");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_string(func, "statistics", NULL, 0, "Statistics", "");
+ RNA_def_function_return(func, parm);
+
+ /* Grease Pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(
+ prop, "Annotations", "Grease Pencil data-block used for annotations in the 3D view");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
+
+ /* active MovieClip */
+ prop = RNA_def_property(srna, "active_clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clip");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "MovieClip");
+ RNA_def_property_ui_text(
+ prop, "Active Movie Clip", "Active movie clip used for constraints and viewport drawing");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* color management */
+ prop = RNA_def_property(srna, "view_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "view_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedViewSettings");
+ RNA_def_property_ui_text(
+ prop, "View Settings", "Color management settings applied on image before saving");
+
+ prop = RNA_def_property(srna, "display_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedDisplaySettings");
+ RNA_def_property_ui_text(
+ prop, "Display Settings", "Settings of device saved image would be displayed on");
+
+ prop = RNA_def_property(srna, "sequencer_colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "sequencer_colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedSequencerColorspaceSettings");
+ RNA_def_property_ui_text(
+ prop, "Sequencer Color Space Settings", "Settings of color space sequencer is working in");
+
+ /* Layer and Collections */
+ prop = RNA_def_property(srna, "view_layers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "view_layers", NULL);
+ RNA_def_property_struct_type(prop, "ViewLayer");
+ RNA_def_property_ui_text(prop, "View Layers", "");
+ rna_def_view_layers(brna, prop);
+
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "master_collection");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_ui_text(
+ prop,
+ "Collection",
+ "Scene master collection that objects and other collections in the scene");
+
+ /* Scene Display */
+ prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "display");
+ RNA_def_property_struct_type(prop, "SceneDisplay");
+ RNA_def_property_ui_text(prop, "Scene Display", "Scene display settings for 3d viewport");
+
+ /* EEVEE */
+ prop = RNA_def_property(srna, "eevee", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SceneEEVEE");
+ RNA_def_property_ui_text(prop, "EEVEE", "EEVEE settings for the scene");
+
+ /* Nestled Data */
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
+ rna_def_tool_settings(brna);
+ rna_def_gpencil_interpolate(brna);
+ rna_def_unified_paint_settings(brna);
+ rna_def_curve_paint_settings(brna);
+ rna_def_statvis(brna);
+ rna_def_unit_settings(brna);
+ rna_def_scene_image_format_data(brna);
+ rna_def_transform_orientation(brna);
+ rna_def_transform_orientation_slot(brna);
+ rna_def_view3d_cursor(brna);
+ rna_def_selected_uv_element(brna);
+ rna_def_display_safe_areas(brna);
+ rna_def_scene_display(brna);
+ rna_def_scene_eevee(brna);
+ RNA_define_animate_sdna(true);
+ /* *** Animated *** */
+ rna_def_scene_render_data(brna);
+ rna_def_gpu_fx(brna);
+ rna_def_scene_render_view(brna);
+
+ /* Scene API */
+ RNA_api_scene(srna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 01c495f9864..e29891b60db 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -36,7 +35,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef WITH_ALEMBIC
# include "../../alembic/ABC_alembic.h"
@@ -44,363 +43,455 @@
const EnumPropertyItem rna_enum_abc_compression_items[] = {
#ifdef WITH_ALEMBIC
- { ABC_ARCHIVE_OGAWA, "OGAWA", 0, "Ogawa", "" },
- { ABC_ARCHIVE_HDF5, "HDF5", 0, "HDF5", "" },
+ {ABC_ARCHIVE_OGAWA, "OGAWA", 0, "Ogawa", ""},
+ {ABC_ARCHIVE_HDF5, "HDF5", 0, "HDF5", ""},
#endif
- { 0, NULL, 0, NULL, NULL }
-};
+ {0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
-#include "BKE_animsys.h"
-#include "BKE_editmesh.h"
-#include "BKE_global.h"
-#include "BKE_image.h"
-#include "BKE_scene.h"
-#include "BKE_writeavi.h"
+# include "BKE_animsys.h"
+# include "BKE_editmesh.h"
+# include "BKE_global.h"
+# include "BKE_image.h"
+# include "BKE_scene.h"
+# include "BKE_writeavi.h"
-#include "DEG_depsgraph_query.h"
+# include "DEG_depsgraph_query.h"
-#include "ED_transform.h"
-#include "ED_transform_snap_object_context.h"
-#include "ED_uvedit.h"
+# include "ED_transform.h"
+# include "ED_transform_snap_object_context.h"
+# include "ED_uvedit.h"
-#ifdef WITH_PYTHON
-# include "BPY_extern.h"
-#endif
+# ifdef WITH_PYTHON
+# include "BPY_extern.h"
+# endif
static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subframe)
{
- double cfra = (double)frame + (double)subframe;
+ double cfra = (double)frame + (double)subframe;
- CLAMP(cfra, MINAFRAME, MAXFRAME);
- BKE_scene_frame_set(scene, cfra);
+ CLAMP(cfra, MINAFRAME, MAXFRAME);
+ BKE_scene_frame_set(scene, cfra);
-#ifdef WITH_PYTHON
- BPy_BEGIN_ALLOW_THREADS;
-#endif
+# ifdef WITH_PYTHON
+ BPy_BEGIN_ALLOW_THREADS;
+# endif
- for (ViewLayer *view_layer = scene->view_layers.first;
- view_layer != NULL;
- view_layer = view_layer->next)
- {
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
- BKE_scene_graph_update_for_newframe(depsgraph, bmain);
- }
+ for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
+ view_layer = view_layer->next) {
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+ BKE_scene_graph_update_for_newframe(depsgraph, bmain);
+ }
-#ifdef WITH_PYTHON
- BPy_END_ALLOW_THREADS;
-#endif
+# ifdef WITH_PYTHON
+ BPy_END_ALLOW_THREADS;
+# endif
- BKE_scene_camera_switch_update(scene);
+ BKE_scene_camera_switch_update(scene);
- /* don't do notifier when we're rendering, avoid some viewport crashes
- * redrawing while the data is being modified for render */
- if (!G.is_rendering) {
- /* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call
- * BKE_scene_graph_update_for_newframe which will loose any un-keyed changes [#24690] */
- /* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
+ /* don't do notifier when we're rendering, avoid some viewport crashes
+ * redrawing while the data is being modified for render */
+ if (!G.is_rendering) {
+ /* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call
+ * BKE_scene_graph_update_for_newframe which will loose any un-keyed changes [#24690] */
+ /* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */
- /* instead just redraw the views */
- WM_main_add_notifier(NC_WINDOW, NULL);
- }
+ /* instead just redraw the views */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ }
}
static void rna_Scene_uvedit_aspect(Scene *scene, Object *ob, float *aspect)
{
- if ((ob->type == OB_MESH) && (ob->mode == OB_MODE_EDIT)) {
- BMEditMesh *em;
- em = BKE_editmesh_from_object(ob);
- if (EDBM_uv_check(em)) {
- ED_uvedit_get_aspect(scene, ob, em->bm, aspect, aspect + 1);
- return;
- }
- }
-
- aspect[0] = aspect[1] = 1.0f;
+ if ((ob->type == OB_MESH) && (ob->mode == OB_MODE_EDIT)) {
+ BMEditMesh *em;
+ em = BKE_editmesh_from_object(ob);
+ if (EDBM_uv_check(em)) {
+ ED_uvedit_get_aspect(scene, ob, em->bm, aspect, aspect + 1);
+ return;
+ }
+ }
+
+ aspect[0] = aspect[1] = 1.0f;
}
static void rna_Scene_update_tagged(Scene *scene, Main *bmain)
{
-#ifdef WITH_PYTHON
- BPy_BEGIN_ALLOW_THREADS;
-#endif
-
- for (ViewLayer *view_layer = scene->view_layers.first;
- view_layer != NULL;
- view_layer = view_layer->next)
- {
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
- BKE_scene_graph_update_tagged(depsgraph, bmain);
- }
-
-#ifdef WITH_PYTHON
- BPy_END_ALLOW_THREADS;
-#endif
+# ifdef WITH_PYTHON
+ BPy_BEGIN_ALLOW_THREADS;
+# endif
+
+ for (ViewLayer *view_layer = scene->view_layers.first; view_layer != NULL;
+ view_layer = view_layer->next) {
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+ BKE_scene_graph_update_tagged(depsgraph, bmain);
+ }
+
+# ifdef WITH_PYTHON
+ BPy_END_ALLOW_THREADS;
+# endif
}
static void rna_SceneRender_get_frame_path(
- RenderData *rd, Main *bmain, int frame, bool preview, const char *view, char *name)
+ RenderData *rd, Main *bmain, int frame, bool preview, const char *view, char *name)
{
- const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view);
-
- /* avoid NULL pointer */
- if (!suffix)
- suffix = "";
-
- if (BKE_imtype_is_movie(rd->im_format.imtype)) {
- BKE_movie_filepath_get(name, rd, preview != 0, suffix);
- }
- else {
- BKE_image_path_from_imformat(
- name, rd->pic, BKE_main_blendfile_path(bmain), (frame == INT_MIN) ? rd->cfra : frame,
- &rd->im_format, (rd->scemode & R_EXTENSION) != 0, true, suffix);
- }
+ const char *suffix = BKE_scene_multiview_view_suffix_get(rd, view);
+
+ /* avoid NULL pointer */
+ if (!suffix)
+ suffix = "";
+
+ if (BKE_imtype_is_movie(rd->im_format.imtype)) {
+ BKE_movie_filepath_get(name, rd, preview != 0, suffix);
+ }
+ else {
+ BKE_image_path_from_imformat(name,
+ rd->pic,
+ BKE_main_blendfile_path(bmain),
+ (frame == INT_MIN) ? rd->cfra : frame,
+ &rd->im_format,
+ (rd->scemode & R_EXTENSION) != 0,
+ true,
+ suffix);
+ }
}
-static void rna_Scene_ray_cast(
- Scene *scene, Main *bmain, ViewLayer *view_layer,
- float origin[3], float direction[3], float ray_dist,
- bool *r_success, float r_location[3], float r_normal[3], int *r_index,
- Object **r_ob, float r_obmat[16])
+static void rna_Scene_ray_cast(Scene *scene,
+ Main *bmain,
+ ViewLayer *view_layer,
+ float origin[3],
+ float direction[3],
+ float ray_dist,
+ bool *r_success,
+ float r_location[3],
+ float r_normal[3],
+ int *r_index,
+ Object **r_ob,
+ float r_obmat[16])
{
- normalize_v3(direction);
-
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
- SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, 0);
-
- bool ret = ED_transform_snap_object_project_ray_ex(
- sctx,
- &(const struct SnapObjectParams){
- .snap_select = SNAP_ALL,
- },
- origin, direction, &ray_dist,
- r_location, r_normal, r_index,
- r_ob, (float(*)[4])r_obmat);
-
- ED_transform_snap_object_context_destroy(sctx);
-
- if (r_ob != NULL && *r_ob != NULL) {
- *r_ob = DEG_get_original_object(*r_ob);
- }
-
- if (ret) {
- *r_success = true;
- }
- else {
- *r_success = false;
-
- unit_m4((float(*)[4])r_obmat);
- zero_v3(r_location);
- zero_v3(r_normal);
- }
+ normalize_v3(direction);
+
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+ SnapObjectContext *sctx = ED_transform_snap_object_context_create(bmain, scene, depsgraph, 0);
+
+ bool ret = ED_transform_snap_object_project_ray_ex(sctx,
+ &(const struct SnapObjectParams){
+ .snap_select = SNAP_ALL,
+ },
+ origin,
+ direction,
+ &ray_dist,
+ r_location,
+ r_normal,
+ r_index,
+ r_ob,
+ (float(*)[4])r_obmat);
+
+ ED_transform_snap_object_context_destroy(sctx);
+
+ if (r_ob != NULL && *r_ob != NULL) {
+ *r_ob = DEG_get_original_object(*r_ob);
+ }
+
+ if (ret) {
+ *r_success = true;
+ }
+ else {
+ *r_success = false;
+
+ unit_m4((float(*)[4])r_obmat);
+ zero_v3(r_location);
+ zero_v3(r_normal);
+ }
}
static void rna_Scene_sequencer_editing_free(Scene *scene)
{
- BKE_sequencer_editing_free(scene, true);
+ BKE_sequencer_editing_free(scene, true);
}
-#ifdef WITH_ALEMBIC
-
-static void rna_Scene_alembic_export(
- Scene *scene,
- bContext *C,
- const char *filepath,
- int frame_start,
- int frame_end,
- int xform_samples,
- int geom_samples,
- float shutter_open,
- float shutter_close,
- bool selected_only,
- bool uvs,
- bool normals,
- bool vcolors,
- bool apply_subdiv,
- bool flatten_hierarchy,
- bool visible_layers_only,
- bool renderable_only,
- bool face_sets,
- bool use_subdiv_schema,
- bool export_hair,
- bool export_particles,
- int compression_type,
- bool packuv,
- float scale,
- bool triangulate,
- int quad_method,
- int ngon_method)
+# ifdef WITH_ALEMBIC
+
+static void rna_Scene_alembic_export(Scene *scene,
+ bContext *C,
+ const char *filepath,
+ int frame_start,
+ int frame_end,
+ int xform_samples,
+ int geom_samples,
+ float shutter_open,
+ float shutter_close,
+ bool selected_only,
+ bool uvs,
+ bool normals,
+ bool vcolors,
+ bool apply_subdiv,
+ bool flatten_hierarchy,
+ bool visible_layers_only,
+ bool renderable_only,
+ bool face_sets,
+ bool use_subdiv_schema,
+ bool export_hair,
+ bool export_particles,
+ int compression_type,
+ bool packuv,
+ float scale,
+ bool triangulate,
+ int quad_method,
+ int ngon_method)
{
/* We have to enable allow_threads, because we may change scene frame number
* during export. */
-#ifdef WITH_PYTHON
- BPy_BEGIN_ALLOW_THREADS;
-#endif
-
- const struct AlembicExportParams params = {
- .frame_start = frame_start,
- .frame_end = frame_end,
-
- .frame_samples_xform = xform_samples,
- .frame_samples_shape = geom_samples,
-
- .shutter_open = shutter_open,
- .shutter_close = shutter_close,
-
- .selected_only = selected_only,
- .uvs = uvs,
- .normals = normals,
- .vcolors = vcolors,
- .apply_subdiv = apply_subdiv,
- .flatten_hierarchy = flatten_hierarchy,
- .visible_layers_only = visible_layers_only,
- .renderable_only = renderable_only,
- .face_sets = face_sets,
- .use_subdiv_schema = use_subdiv_schema,
- .export_hair = export_hair,
- .export_particles = export_particles,
- .compression_type = compression_type,
- .packuv = packuv,
- .triangulate = triangulate,
- .quad_method = quad_method,
- .ngon_method = ngon_method,
-
- .global_scale = scale,
- };
-
- ABC_export(scene, C, filepath, &params, true);
-
-#ifdef WITH_PYTHON
- BPy_END_ALLOW_THREADS;
-#endif
+# ifdef WITH_PYTHON
+ BPy_BEGIN_ALLOW_THREADS;
+# endif
+
+ const struct AlembicExportParams params = {
+ .frame_start = frame_start,
+ .frame_end = frame_end,
+
+ .frame_samples_xform = xform_samples,
+ .frame_samples_shape = geom_samples,
+
+ .shutter_open = shutter_open,
+ .shutter_close = shutter_close,
+
+ .selected_only = selected_only,
+ .uvs = uvs,
+ .normals = normals,
+ .vcolors = vcolors,
+ .apply_subdiv = apply_subdiv,
+ .flatten_hierarchy = flatten_hierarchy,
+ .visible_layers_only = visible_layers_only,
+ .renderable_only = renderable_only,
+ .face_sets = face_sets,
+ .use_subdiv_schema = use_subdiv_schema,
+ .export_hair = export_hair,
+ .export_particles = export_particles,
+ .compression_type = compression_type,
+ .packuv = packuv,
+ .triangulate = triangulate,
+ .quad_method = quad_method,
+ .ngon_method = ngon_method,
+
+ .global_scale = scale,
+ };
+
+ ABC_export(scene, C, filepath, &params, true);
+
+# ifdef WITH_PYTHON
+ BPy_END_ALLOW_THREADS;
+# endif
}
-#endif
+# endif
#else
void RNA_api_scene(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
- RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately");
- parm = RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set", MINAFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float(func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0);
- RNA_def_function_flag(func, FUNC_USE_MAIN);
-
- func = RNA_def_function(srna, "update", "rna_Scene_update_tagged");
- RNA_def_function_ui_description(func,
- "Update data tagged to be updated from previous access to data or operators");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
-
- func = RNA_def_function(srna, "uvedit_aspect", "rna_Scene_uvedit_aspect");
- RNA_def_function_ui_description(func, "Get uv aspect for current object");
- parm = RNA_def_pointer(func, "object", "Object", "", "Object");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_float_vector(func, "result", 2, NULL, 0.0f, FLT_MAX, "", "aspect", 0.0f, FLT_MAX);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
- /* Ray Cast */
- func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Cast a ray onto in object space");
- parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene Layer");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- /* ray start and end */
- parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float(func, "distance", BVH_RAYCAST_DIST_MAX, 0.0, BVH_RAYCAST_DIST_MAX,
- "", "Maximum distance", 0.0, BVH_RAYCAST_DIST_MAX);
- /* return location and normal */
- parm = RNA_def_boolean(func, "result", 0, "", "");
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location",
- "The hit location of this ray cast", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_vector(func, "normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal",
- "The face normal at the ray cast hit location", -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_int(func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
- RNA_def_function_output(func, parm);
- parm = RNA_def_pointer(func, "object", "Object", "", "Ray cast object");
- RNA_def_function_output(func, parm);
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
- RNA_def_function_output(func, parm);
-
- /* Sequencer. */
- func = RNA_def_function(srna, "sequence_editor_create", "BKE_sequencer_editing_ensure");
- RNA_def_function_ui_description(func, "Ensure sequence editor is valid in this scene");
- parm = RNA_def_pointer(func, "sequence_editor", "SequenceEditor", "", "New sequence editor data or NULL");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "sequence_editor_clear", "rna_Scene_sequencer_editing_free");
- RNA_def_function_ui_description(func, "Clear sequence editor in this scene");
-
-#ifdef WITH_ALEMBIC
- /* XXX Deprecated, will be removed in 2.8 in favour of calling the export operator. */
- func = RNA_def_function(srna, "alembic_export", "rna_Scene_alembic_export");
- RNA_def_function_ui_description(func, "Export to Alembic file (deprecated, use the Alembic export operator)");
-
- parm = RNA_def_string(func, "filepath", NULL, FILE_MAX, "File Path", "File path to write Alembic file");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
-
- RNA_def_int(func, "frame_start", 1, INT_MIN, INT_MAX, "Start", "Start Frame", INT_MIN, INT_MAX);
- RNA_def_int(func, "frame_end", 1, INT_MIN, INT_MAX, "End", "End Frame", INT_MIN, INT_MAX);
- RNA_def_int(func, "xform_samples", 1, 1, 128, "Xform samples", "Transform samples per frame", 1, 128);
- RNA_def_int(func, "geom_samples", 1, 1, 128, "Geom samples", "Geometry samples per frame", 1, 128);
- RNA_def_float(func, "shutter_open", 0.0f, -1.0f, 1.0f, "Shutter open", "", -1.0f, 1.0f);
- RNA_def_float(func, "shutter_close", 1.0f, -1.0f, 1.0f, "Shutter close", "", -1.0f, 1.0f);
- RNA_def_boolean(func, "selected_only", 0, "Selected only", "Export only selected objects");
- RNA_def_boolean(func, "uvs", 1, "UVs", "Export UVs");
- RNA_def_boolean(func, "normals", 1, "Normals", "Export normals");
- RNA_def_boolean(func, "vcolors", 0, "Vertex colors", "Export vertex colors");
- RNA_def_boolean(func, "apply_subdiv", 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes");
- RNA_def_boolean(func, "flatten", 0, "Flatten hierarchy", "Flatten hierarchy");
- RNA_def_boolean(func, "visible_layers_only", 0, "Visible layers only", "Export only objects in visible layers");
- RNA_def_boolean(func, "renderable_only", 0, "Renderable objects only", "Export only objects marked renderable in the outliner");
- RNA_def_boolean(func, "face_sets", 0, "Facesets", "Export face sets");
- RNA_def_boolean(func, "subdiv_schema", 0, "Use Alembic subdivision Schema", "Use Alembic subdivision Schema");
- RNA_def_boolean(func, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves");
- RNA_def_boolean(func, "export_particles", 1, "Export Particles", "Exports non-hair particle systems");
- RNA_def_enum(func, "compression_type", rna_enum_abc_compression_items, 0, "Compression", "");
- RNA_def_boolean(func, "packuv", 0, "Export with packed UV islands", "Export with packed UV islands");
- RNA_def_float(func, "scale", 1.0f, 0.0001f, 1000.0f, "Scale", "Value by which to enlarge or shrink the objects with respect to the world's origin", 0.0001f, 1000.0f);
- RNA_def_boolean(func, "triangulate", 0, "Triangulate", "Export Polygons (Quads & NGons) as Triangles");
- RNA_def_enum(func, "quad_method", rna_enum_modifier_triangulate_quad_method_items, 0, "Quad Method", "Method for splitting the quads into triangles");
- RNA_def_enum(func, "ngon_method", rna_enum_modifier_triangulate_quad_method_items, 0, "Polygon Method", "Method for splitting the polygons into triangles");
-
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-#endif
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "frame_set", "rna_Scene_frame_set");
+ RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately");
+ parm = RNA_def_int(
+ func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set", MINAFRAME, MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_float(
+ func, "subframe", 0.0, 0.0, 1.0, "", "Sub-frame time, between 0.0 and 1.0", 0.0, 1.0);
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+
+ func = RNA_def_function(srna, "update", "rna_Scene_update_tagged");
+ RNA_def_function_ui_description(
+ func, "Update data tagged to be updated from previous access to data or operators");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+
+ func = RNA_def_function(srna, "uvedit_aspect", "rna_Scene_uvedit_aspect");
+ RNA_def_function_ui_description(func, "Get uv aspect for current object");
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_float_vector(func, "result", 2, NULL, 0.0f, FLT_MAX, "", "aspect", 0.0f, FLT_MAX);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ /* Ray Cast */
+ func = RNA_def_function(srna, "ray_cast", "rna_Scene_ray_cast");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Cast a ray onto in object space");
+ parm = RNA_def_pointer(func, "view_layer", "ViewLayer", "", "Scene Layer");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ /* ray start and end */
+ parm = RNA_def_float_vector(func, "origin", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float_vector(func, "direction", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_float(func,
+ "distance",
+ BVH_RAYCAST_DIST_MAX,
+ 0.0,
+ BVH_RAYCAST_DIST_MAX,
+ "",
+ "Maximum distance",
+ 0.0,
+ BVH_RAYCAST_DIST_MAX);
+ /* return location and normal */
+ parm = RNA_def_boolean(func, "result", 0, "", "");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "location",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Location",
+ "The hit location of this ray cast",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func,
+ "normal",
+ 3,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Normal",
+ "The face normal at the ray cast hit location",
+ -1e4,
+ 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_int(
+ func, "index", 0, 0, 0, "", "The face index, -1 when original data isn't available", 0, 0);
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_pointer(func, "object", "Object", "", "Ray cast object");
+ RNA_def_function_output(func, parm);
+ parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, 0.0f, 0.0f, "", "Matrix", 0.0f, 0.0f);
+ RNA_def_function_output(func, parm);
+
+ /* Sequencer. */
+ func = RNA_def_function(srna, "sequence_editor_create", "BKE_sequencer_editing_ensure");
+ RNA_def_function_ui_description(func, "Ensure sequence editor is valid in this scene");
+ parm = RNA_def_pointer(
+ func, "sequence_editor", "SequenceEditor", "", "New sequence editor data or NULL");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "sequence_editor_clear", "rna_Scene_sequencer_editing_free");
+ RNA_def_function_ui_description(func, "Clear sequence editor in this scene");
+
+# ifdef WITH_ALEMBIC
+ /* XXX Deprecated, will be removed in 2.8 in favour of calling the export operator. */
+ func = RNA_def_function(srna, "alembic_export", "rna_Scene_alembic_export");
+ RNA_def_function_ui_description(
+ func, "Export to Alembic file (deprecated, use the Alembic export operator)");
+
+ parm = RNA_def_string(
+ func, "filepath", NULL, FILE_MAX, "File Path", "File path to write Alembic file");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_subtype(parm, PROP_FILEPATH); /* allow non utf8 */
+
+ RNA_def_int(func, "frame_start", 1, INT_MIN, INT_MAX, "Start", "Start Frame", INT_MIN, INT_MAX);
+ RNA_def_int(func, "frame_end", 1, INT_MIN, INT_MAX, "End", "End Frame", INT_MIN, INT_MAX);
+ RNA_def_int(
+ func, "xform_samples", 1, 1, 128, "Xform samples", "Transform samples per frame", 1, 128);
+ RNA_def_int(
+ func, "geom_samples", 1, 1, 128, "Geom samples", "Geometry samples per frame", 1, 128);
+ RNA_def_float(func, "shutter_open", 0.0f, -1.0f, 1.0f, "Shutter open", "", -1.0f, 1.0f);
+ RNA_def_float(func, "shutter_close", 1.0f, -1.0f, 1.0f, "Shutter close", "", -1.0f, 1.0f);
+ RNA_def_boolean(func, "selected_only", 0, "Selected only", "Export only selected objects");
+ RNA_def_boolean(func, "uvs", 1, "UVs", "Export UVs");
+ RNA_def_boolean(func, "normals", 1, "Normals", "Export normals");
+ RNA_def_boolean(func, "vcolors", 0, "Vertex colors", "Export vertex colors");
+ RNA_def_boolean(
+ func, "apply_subdiv", 1, "Subsurfs as meshes", "Export subdivision surfaces as meshes");
+ RNA_def_boolean(func, "flatten", 0, "Flatten hierarchy", "Flatten hierarchy");
+ RNA_def_boolean(func,
+ "visible_layers_only",
+ 0,
+ "Visible layers only",
+ "Export only objects in visible layers");
+ RNA_def_boolean(func,
+ "renderable_only",
+ 0,
+ "Renderable objects only",
+ "Export only objects marked renderable in the outliner");
+ RNA_def_boolean(func, "face_sets", 0, "Facesets", "Export face sets");
+ RNA_def_boolean(func,
+ "subdiv_schema",
+ 0,
+ "Use Alembic subdivision Schema",
+ "Use Alembic subdivision Schema");
+ RNA_def_boolean(
+ func, "export_hair", 1, "Export Hair", "Exports hair particle systems as animated curves");
+ RNA_def_boolean(
+ func, "export_particles", 1, "Export Particles", "Exports non-hair particle systems");
+ RNA_def_enum(func, "compression_type", rna_enum_abc_compression_items, 0, "Compression", "");
+ RNA_def_boolean(
+ func, "packuv", 0, "Export with packed UV islands", "Export with packed UV islands");
+ RNA_def_float(
+ func,
+ "scale",
+ 1.0f,
+ 0.0001f,
+ 1000.0f,
+ "Scale",
+ "Value by which to enlarge or shrink the objects with respect to the world's origin",
+ 0.0001f,
+ 1000.0f);
+ RNA_def_boolean(
+ func, "triangulate", 0, "Triangulate", "Export Polygons (Quads & NGons) as Triangles");
+ RNA_def_enum(func,
+ "quad_method",
+ rna_enum_modifier_triangulate_quad_method_items,
+ 0,
+ "Quad Method",
+ "Method for splitting the quads into triangles");
+ RNA_def_enum(func,
+ "ngon_method",
+ rna_enum_modifier_triangulate_quad_method_items,
+ 0,
+ "Polygon Method",
+ "Method for splitting the polygons into triangles");
+
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+# endif
}
-
void RNA_api_scene_render(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
- RNA_def_function_flag(func, FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Return the absolute path to the filename to be written for a given frame");
- RNA_def_int(func, "frame", INT_MIN, INT_MIN, INT_MAX, "",
- "Frame number to use, if unset the current frame will be used", MINAFRAME, MAXFRAME);
- RNA_def_boolean(func, "preview", 0, "Preview", "Use preview range");
- RNA_def_string_file_path(func, "view", NULL, FILE_MAX, "View",
- "The name of the view to use to replace the \"%\" chars");
- parm = RNA_def_string_file_path(func, "filepath", NULL, FILE_MAX, "File Path",
- "The resulting filepath from the scenes render settings");
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
- RNA_def_function_output(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "frame_path", "rna_SceneRender_get_frame_path");
+ RNA_def_function_flag(func, FUNC_USE_MAIN);
+ RNA_def_function_ui_description(
+ func, "Return the absolute path to the filename to be written for a given frame");
+ RNA_def_int(func,
+ "frame",
+ INT_MIN,
+ INT_MIN,
+ INT_MAX,
+ "",
+ "Frame number to use, if unset the current frame will be used",
+ MINAFRAME,
+ MAXFRAME);
+ RNA_def_boolean(func, "preview", 0, "Preview", "Use preview range");
+ RNA_def_string_file_path(func,
+ "view",
+ NULL,
+ FILE_MAX,
+ "View",
+ "The name of the view to use to replace the \"%\" chars");
+ parm = RNA_def_string_file_path(func,
+ "filepath",
+ NULL,
+ FILE_MAX,
+ "File Path",
+ "The resulting filepath from the scenes render settings");
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
+ RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index a6f321e614d..5913376606b 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stddef.h>
@@ -32,19 +31,19 @@
#include "DNA_workspace_types.h"
const EnumPropertyItem rna_enum_region_type_items[] = {
- {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""},
- {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""},
- {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""},
- {RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""},
- {RGN_TYPE_UI, "UI", 0, "UI", ""},
- {RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
- {RGN_TYPE_TOOL_PROPS, "TOOL_PROPS", 0, "Tool Properties", ""},
- {RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
- {RGN_TYPE_HUD, "HUD", 0, "Floating Region", ""},
- {RGN_TYPE_NAV_BAR, "NAVIGATION_BAR", 0, "Navigation Bar", ""},
- {RGN_TYPE_EXECUTE, "EXECUTE", 0, "Execute Buttons", ""},
- {RGN_TYPE_FOOTER, "FOOTER", 0, "Footer", ""},
- {0, NULL, 0, NULL, NULL},
+ {RGN_TYPE_WINDOW, "WINDOW", 0, "Window", ""},
+ {RGN_TYPE_HEADER, "HEADER", 0, "Header", ""},
+ {RGN_TYPE_CHANNELS, "CHANNELS", 0, "Channels", ""},
+ {RGN_TYPE_TEMPORARY, "TEMPORARY", 0, "Temporary", ""},
+ {RGN_TYPE_UI, "UI", 0, "UI", ""},
+ {RGN_TYPE_TOOLS, "TOOLS", 0, "Tools", ""},
+ {RGN_TYPE_TOOL_PROPS, "TOOL_PROPS", 0, "Tool Properties", ""},
+ {RGN_TYPE_PREVIEW, "PREVIEW", 0, "Preview", ""},
+ {RGN_TYPE_HUD, "HUD", 0, "Floating Region", ""},
+ {RGN_TYPE_NAV_BAR, "NAVIGATION_BAR", 0, "Navigation Bar", ""},
+ {RGN_TYPE_EXECUTE, "EXECUTE", 0, "Execute Buttons", ""},
+ {RGN_TYPE_FOOTER, "FOOTER", 0, "Footer", ""},
+ {0, NULL, 0, NULL, NULL},
};
#include "ED_screen.h"
@@ -54,224 +53,228 @@ const EnumPropertyItem rna_enum_region_type_items[] = {
#ifdef RNA_RUNTIME
-#include "BKE_global.h"
-#include "BKE_workspace.h"
-#include "BKE_screen.h"
+# include "BKE_global.h"
+# include "BKE_workspace.h"
+# include "BKE_screen.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "UI_view2d.h"
+# include "UI_view2d.h"
-#ifdef WITH_PYTHON
-# include "BPY_extern.h"
-#endif
+# ifdef WITH_PYTHON
+# include "BPY_extern.h"
+# endif
static void rna_Screen_bar_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- bScreen *screen = (bScreen *)ptr->data;
- screen->do_draw = true;
- screen->do_refresh = true;
+ bScreen *screen = (bScreen *)ptr->data;
+ screen->do_draw = true;
+ screen->do_refresh = true;
}
static void rna_Screen_redraw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- bScreen *screen = (bScreen *)ptr->data;
+ bScreen *screen = (bScreen *)ptr->data;
- /* the settings for this are currently only available from a menu in the TimeLine,
- * hence refresh=SPACE_ACTION, as timeline is now in there
- */
- ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_ACTION);
+ /* the settings for this are currently only available from a menu in the TimeLine,
+ * hence refresh=SPACE_ACTION, as timeline is now in there
+ */
+ ED_screen_animation_timer_update(screen, screen->redraws_flag, SPACE_ACTION);
}
static bool rna_Screen_is_animation_playing_get(PointerRNA *UNUSED(ptr))
{
- /* can be NULL on file load, T42619 */
- wmWindowManager *wm = G_MAIN->wm.first;
- return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
+ /* can be NULL on file load, T42619 */
+ wmWindowManager *wm = G_MAIN->wm.first;
+ return wm ? (ED_screen_animation_playing(wm) != NULL) : 0;
}
static int rna_region_alignment_get(PointerRNA *ptr)
{
- ARegion *region = ptr->data;
- return (region->alignment & ~RGN_SPLIT_PREV);
+ ARegion *region = ptr->data;
+ return (region->alignment & ~RGN_SPLIT_PREV);
}
static bool rna_Screen_fullscreen_get(PointerRNA *ptr)
{
- bScreen *sc = (bScreen *)ptr->data;
- return (sc->state == SCREENMAXIMIZED);
+ bScreen *sc = (bScreen *)ptr->data;
+ return (sc->state == SCREENMAXIMIZED);
}
/* UI compatible list: should not be needed, but for now we need to keep EMPTY
* at least in the static version of this enum for python scripts. */
-static const EnumPropertyItem *rna_Area_type_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Area_type_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- EnumPropertyItem *item = NULL;
- int totitem = 0;
-
- /* +1 to skip SPACE_EMPTY */
- for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier; item_from++) {
- if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
- continue;
- }
- RNA_enum_item_add(&item, &totitem, item_from);
- }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
+
+ /* +1 to skip SPACE_EMPTY */
+ for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier;
+ item_from++) {
+ if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
+ continue;
+ }
+ RNA_enum_item_add(&item, &totitem, item_from);
+ }
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
static int rna_Area_type_get(PointerRNA *ptr)
{
- ScrArea *sa = (ScrArea *)ptr->data;
- /* Usually 'spacetype' is used. It lags behind a bit while switching area
- * type though, then we use 'butspacetype' instead (T41435). */
- return (sa->butspacetype == SPACE_EMPTY) ? sa->spacetype : sa->butspacetype;
+ ScrArea *sa = (ScrArea *)ptr->data;
+ /* Usually 'spacetype' is used. It lags behind a bit while switching area
+ * type though, then we use 'butspacetype' instead (T41435). */
+ return (sa->butspacetype == SPACE_EMPTY) ? sa->spacetype : sa->butspacetype;
}
static void rna_Area_type_set(PointerRNA *ptr, int value)
{
- if (ELEM(value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
- /* Special case: An area can not be set to show the top-bar editor (or
- * other global areas). However it should still be possible to identify
- * its type from Python. */
- return;
- }
-
- ScrArea *sa = (ScrArea *)ptr->data;
- sa->butspacetype = value;
+ if (ELEM(value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
+ /* Special case: An area can not be set to show the top-bar editor (or
+ * other global areas). However it should still be possible to identify
+ * its type from Python. */
+ return;
+ }
+
+ ScrArea *sa = (ScrArea *)ptr->data;
+ sa->butspacetype = value;
}
static void rna_Area_type_update(bContext *C, PointerRNA *ptr)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- wmWindow *win;
- bScreen *sc = (bScreen *)ptr->id.data;
- ScrArea *sa = (ScrArea *)ptr->data;
-
- /* XXX this call still use context, so we trick it to work in the right context */
- for (win = wm->windows.first; win; win = win->next) {
- if (sc == WM_window_get_active_screen(win)) {
- wmWindow *prevwin = CTX_wm_window(C);
- ScrArea *prevsa = CTX_wm_area(C);
- ARegion *prevar = CTX_wm_region(C);
-
- CTX_wm_window_set(C, win);
- CTX_wm_area_set(C, sa);
- CTX_wm_region_set(C, NULL);
-
- ED_area_newspace(C, sa, sa->butspacetype, true);
- ED_area_tag_redraw(sa);
-
- /* Unset so that rna_Area_type_get uses spacetype instead. */
- sa->butspacetype = SPACE_EMPTY;
-
- /* It is possible that new layers becomes visible. */
- if (sa->spacetype == SPACE_VIEW3D) {
- DEG_on_visible_update(CTX_data_main(C), false);
- }
-
- CTX_wm_window_set(C, prevwin);
- CTX_wm_area_set(C, prevsa);
- CTX_wm_region_set(C, prevar);
- break;
- }
- }
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win;
+ bScreen *sc = (bScreen *)ptr->id.data;
+ ScrArea *sa = (ScrArea *)ptr->data;
+
+ /* XXX this call still use context, so we trick it to work in the right context */
+ for (win = wm->windows.first; win; win = win->next) {
+ if (sc == WM_window_get_active_screen(win)) {
+ wmWindow *prevwin = CTX_wm_window(C);
+ ScrArea *prevsa = CTX_wm_area(C);
+ ARegion *prevar = CTX_wm_region(C);
+
+ CTX_wm_window_set(C, win);
+ CTX_wm_area_set(C, sa);
+ CTX_wm_region_set(C, NULL);
+
+ ED_area_newspace(C, sa, sa->butspacetype, true);
+ ED_area_tag_redraw(sa);
+
+ /* Unset so that rna_Area_type_get uses spacetype instead. */
+ sa->butspacetype = SPACE_EMPTY;
+
+ /* It is possible that new layers becomes visible. */
+ if (sa->spacetype == SPACE_VIEW3D) {
+ DEG_on_visible_update(CTX_data_main(C), false);
+ }
+
+ CTX_wm_window_set(C, prevwin);
+ CTX_wm_area_set(C, prevsa);
+ CTX_wm_region_set(C, prevar);
+ break;
+ }
+ }
}
-
-static const EnumPropertyItem *rna_Area_ui_type_itemf(
- bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_Area_ui_type_itemf(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- EnumPropertyItem *item = NULL;
- int totitem = 0;
-
- /* +1 to skip SPACE_EMPTY */
- for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier; item_from++) {
- if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
- continue;
- }
-
- SpaceType *st = item_from->identifier[0] ? BKE_spacetype_from_id(item_from->value) : NULL;
- int totitem_prev = totitem;
- if (st && st->space_subtype_item_extend != NULL) {
- st->space_subtype_item_extend(C, &item, &totitem);
- while (totitem_prev < totitem) {
- item[totitem_prev++].value |= item_from->value << 16;
- }
- }
- else {
- RNA_enum_item_add(&item, &totitem, item_from);
- item[totitem_prev++].value = item_from->value << 16;
- }
- }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
+
+ /* +1 to skip SPACE_EMPTY */
+ for (const EnumPropertyItem *item_from = rna_enum_space_type_items + 1; item_from->identifier;
+ item_from++) {
+ if (ELEM(item_from->value, SPACE_TOPBAR, SPACE_STATUSBAR)) {
+ continue;
+ }
+
+ SpaceType *st = item_from->identifier[0] ? BKE_spacetype_from_id(item_from->value) : NULL;
+ int totitem_prev = totitem;
+ if (st && st->space_subtype_item_extend != NULL) {
+ st->space_subtype_item_extend(C, &item, &totitem);
+ while (totitem_prev < totitem) {
+ item[totitem_prev++].value |= item_from->value << 16;
+ }
+ }
+ else {
+ RNA_enum_item_add(&item, &totitem, item_from);
+ item[totitem_prev++].value = item_from->value << 16;
+ }
+ }
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
static int rna_Area_ui_type_get(PointerRNA *ptr)
{
- int value = rna_Area_type_get(ptr) << 16;
- ScrArea *sa = ptr->data;
- /* sa->type can be NULL (when not yet initialized), try to do it now. */
- /* Copied from `ED_area_initialize()`.*/
- if (sa->type == NULL) {
- sa->type = BKE_spacetype_from_id(sa->spacetype);
- if (sa->type == NULL) {
- sa->spacetype = SPACE_VIEW3D;
- sa->type = BKE_spacetype_from_id(sa->spacetype);
- }
- BLI_assert(sa->type != NULL);
- }
- if (sa->type->space_subtype_item_extend != NULL) {
- value |= sa->type->space_subtype_get(sa);
- }
- return value;
+ int value = rna_Area_type_get(ptr) << 16;
+ ScrArea *sa = ptr->data;
+ /* sa->type can be NULL (when not yet initialized), try to do it now. */
+ /* Copied from `ED_area_initialize()`.*/
+ if (sa->type == NULL) {
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
+ if (sa->type == NULL) {
+ sa->spacetype = SPACE_VIEW3D;
+ sa->type = BKE_spacetype_from_id(sa->spacetype);
+ }
+ BLI_assert(sa->type != NULL);
+ }
+ if (sa->type->space_subtype_item_extend != NULL) {
+ value |= sa->type->space_subtype_get(sa);
+ }
+ return value;
}
static void rna_Area_ui_type_set(PointerRNA *ptr, int value)
{
- ScrArea *sa = ptr->data;
- const int space_type = value >> 16;
- SpaceType *st = BKE_spacetype_from_id(space_type);
+ ScrArea *sa = ptr->data;
+ const int space_type = value >> 16;
+ SpaceType *st = BKE_spacetype_from_id(space_type);
- rna_Area_type_set(ptr, space_type);
+ rna_Area_type_set(ptr, space_type);
- if (st && st->space_subtype_item_extend != NULL) {
- sa->butspacetype_subtype = value & 0xffff;
- }
+ if (st && st->space_subtype_item_extend != NULL) {
+ sa->butspacetype_subtype = value & 0xffff;
+ }
}
static void rna_Area_ui_type_update(bContext *C, PointerRNA *ptr)
{
- ScrArea *sa = ptr->data;
- SpaceType *st = BKE_spacetype_from_id(sa->butspacetype);
+ ScrArea *sa = ptr->data;
+ SpaceType *st = BKE_spacetype_from_id(sa->butspacetype);
- rna_Area_type_update(C, ptr);
+ rna_Area_type_update(C, ptr);
- if ((sa->type == st) && (st->space_subtype_item_extend != NULL)) {
- st->space_subtype_set(sa, sa->butspacetype_subtype);
- }
- sa->butspacetype_subtype = 0;
+ if ((sa->type == st) && (st->space_subtype_item_extend != NULL)) {
+ st->space_subtype_set(sa, sa->butspacetype_subtype);
+ }
+ sa->butspacetype_subtype = 0;
}
static void rna_View2D_region_to_view(struct View2D *v2d, int x, int y, float result[2])
{
- UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
+ UI_view2d_region_to_view(v2d, x, y, &result[0], &result[1]);
}
-static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, bool clip, int result[2])
+static void rna_View2D_view_to_region(
+ struct View2D *v2d, float x, float y, bool clip, int result[2])
{
- if (clip)
- UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]);
- else
- UI_view2d_view_to_region(v2d, x, y, &result[0], &result[1]);
+ if (clip)
+ UI_view2d_view_to_region_clip(v2d, x, y, &result[0], &result[1]);
+ else
+ UI_view2d_view_to_region(v2d, x, y, &result[0], &result[1]);
}
#else
@@ -279,300 +282,337 @@ static void rna_View2D_view_to_region(struct View2D *v2d, float x, float y, bool
/* Area.spaces */
static void rna_def_area_spaces(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "AreaSpaces");
- srna = RNA_def_struct(brna, "AreaSpaces", NULL);
- RNA_def_struct_sdna(srna, "ScrArea");
- RNA_def_struct_ui_text(srna, "Area Spaces", "Collection of spaces");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
- RNA_def_property_struct_type(prop, "Space");
- RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "AreaSpaces");
+ srna = RNA_def_struct(brna, "AreaSpaces", NULL);
+ RNA_def_struct_sdna(srna, "ScrArea");
+ RNA_def_struct_ui_text(srna, "Area Spaces", "Collection of spaces");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "spacedata.first");
+ RNA_def_property_struct_type(prop, "Space");
+ RNA_def_property_ui_text(prop, "Active Space", "Space currently being displayed in this area");
}
static void rna_def_area_api(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
+ RNA_def_function(srna, "tag_redraw", "ED_area_tag_redraw");
- func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
- RNA_def_function_ui_description(func, "Set the header status text");
- parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the header, None clears the text");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
+ func = RNA_def_function(srna, "header_text_set", "ED_area_status_text");
+ RNA_def_function_ui_description(func, "Set the header status text");
+ parm = RNA_def_string(
+ func, "text", NULL, 0, "Text", "New string for the header, None clears the text");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
}
static void rna_def_area(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Area", NULL);
- RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
- RNA_def_struct_sdna(srna, "ScrArea");
-
- prop = RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
- RNA_def_property_struct_type(prop, "Space");
- RNA_def_property_ui_text(prop, "Spaces",
- "Spaces contained in this area, the first being the active space "
- "(NOTE: Useful for example to restore a previously used 3D view space "
- "in a certain area to get the old view orientation)");
- rna_def_area_spaces(brna, prop);
-
- prop = RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
- RNA_def_property_struct_type(prop, "Region");
- RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in");
-
- prop = RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN);
- RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "spacetype");
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_enum_default(prop, SPACE_VIEW3D);
- RNA_def_property_enum_funcs(prop, "rna_Area_type_get", "rna_Area_type_set", "rna_Area_type_itemf");
- RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Area_type_update");
-
- prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, DummyRNA_NULL_items); /* infact dummy */
- RNA_def_property_enum_default(prop, SPACE_VIEW3D << 16);
- RNA_def_property_enum_funcs(prop, "rna_Area_ui_type_get", "rna_Area_ui_type_set", "rna_Area_ui_type_itemf");
- RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, 0, "rna_Area_ui_type_update");
-
- prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the area");
-
- prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the area");
-
- prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "winx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Width", "Area width");
-
- prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "winy");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Height", "Area height");
-
- rna_def_area_api(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Area", NULL);
+ RNA_def_struct_ui_text(srna, "Area", "Area in a subdivided screen, containing an editor");
+ RNA_def_struct_sdna(srna, "ScrArea");
+
+ prop = RNA_def_property(srna, "spaces", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "spacedata", NULL);
+ RNA_def_property_struct_type(prop, "Space");
+ RNA_def_property_ui_text(prop,
+ "Spaces",
+ "Spaces contained in this area, the first being the active space "
+ "(NOTE: Useful for example to restore a previously used 3D view space "
+ "in a certain area to get the old view orientation)");
+ rna_def_area_spaces(brna, prop);
+
+ prop = RNA_def_property(srna, "regions", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "regionbase", NULL);
+ RNA_def_property_struct_type(prop, "Region");
+ RNA_def_property_ui_text(prop, "Regions", "Regions this area is subdivided in");
+
+ prop = RNA_def_property(srna, "show_menus", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", HEADER_NO_PULLDOWN);
+ RNA_def_property_ui_text(prop, "Show Menus", "Show menus in the header");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "spacetype");
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_enum_default(prop, SPACE_VIEW3D);
+ RNA_def_property_enum_funcs(
+ prop, "rna_Area_type_get", "rna_Area_type_set", "rna_Area_type_itemf");
+ RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Area_type_update");
+
+ prop = RNA_def_property(srna, "ui_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, DummyRNA_NULL_items); /* infact dummy */
+ RNA_def_property_enum_default(prop, SPACE_VIEW3D << 16);
+ RNA_def_property_enum_funcs(
+ prop, "rna_Area_ui_type_get", "rna_Area_ui_type_set", "rna_Area_ui_type_itemf");
+ RNA_def_property_ui_text(prop, "Editor Type", "Current editor type for this area");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, 0, "rna_Area_ui_type_update");
+
+ prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "totrct.xmin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "X Position", "The window relative vertical location of the area");
+
+ prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "totrct.ymin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Y Position", "The window relative horizontal location of the area");
+
+ prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "winx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Width", "Area width");
+
+ prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "winy");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Height", "Area height");
+
+ rna_def_area_api(srna);
}
static void rna_def_view2d_api(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const float view_default[2] = {0.0f, 0.0f};
- static const int region_default[2] = {0.0f, 0.0f};
-
- func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view");
- RNA_def_function_ui_description(func, "Transform region coordinates to 2D view");
- parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float_array(func, "result", 2, view_default, -FLT_MAX, FLT_MAX, "Result", "View coordinates", -10000.0f, 10000.0f);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
-
- func = RNA_def_function(srna, "view_to_region", "rna_View2D_view_to_region");
- RNA_def_function_ui_description(func, "Transform 2D view coordinates to region");
- parm = RNA_def_float(func, "x", 0.0f, -FLT_MAX, FLT_MAX, "x", "2D View x coordinate", -10000.0f, 10000.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "y", 0.0f, -FLT_MAX, FLT_MAX, "y", "2D View y coordinate", -10000.0f, 10000.0f);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "clip", 1, "Clip", "Clip coordinates to the visible region");
- parm = RNA_def_int_array(func, "result", 2, region_default, INT_MIN, INT_MAX, "Result", "Region coordinates", -10000, 10000);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const float view_default[2] = {0.0f, 0.0f};
+ static const int region_default[2] = {0.0f, 0.0f};
+
+ func = RNA_def_function(srna, "region_to_view", "rna_View2D_region_to_view");
+ RNA_def_function_ui_description(func, "Transform region coordinates to 2D view");
+ parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float_array(func,
+ "result",
+ 2,
+ view_default,
+ -FLT_MAX,
+ FLT_MAX,
+ "Result",
+ "View coordinates",
+ -10000.0f,
+ 10000.0f);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
+
+ func = RNA_def_function(srna, "view_to_region", "rna_View2D_view_to_region");
+ RNA_def_function_ui_description(func, "Transform 2D view coordinates to region");
+ parm = RNA_def_float(
+ func, "x", 0.0f, -FLT_MAX, FLT_MAX, "x", "2D View x coordinate", -10000.0f, 10000.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(
+ func, "y", 0.0f, -FLT_MAX, FLT_MAX, "y", "2D View y coordinate", -10000.0f, 10000.0f);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "clip", 1, "Clip", "Clip coordinates to the visible region");
+ parm = RNA_def_int_array(func,
+ "result",
+ 2,
+ region_default,
+ INT_MIN,
+ INT_MAX,
+ "Result",
+ "Region coordinates",
+ -10000,
+ 10000);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
static void rna_def_view2d(BlenderRNA *brna)
{
- StructRNA *srna;
- /* PropertyRNA *prop; */
+ StructRNA *srna;
+ /* PropertyRNA *prop; */
- srna = RNA_def_struct(brna, "View2D", NULL);
- RNA_def_struct_ui_text(srna, "View2D", "Scroll and zoom for a 2D region");
- RNA_def_struct_sdna(srna, "View2D");
+ srna = RNA_def_struct(brna, "View2D", NULL);
+ RNA_def_struct_ui_text(srna, "View2D", "Scroll and zoom for a 2D region");
+ RNA_def_struct_sdna(srna, "View2D");
- /* TODO more View2D properties could be exposed here (read-only) */
+ /* TODO more View2D properties could be exposed here (read-only) */
- rna_def_view2d_api(srna);
+ rna_def_view2d_api(srna);
}
static void rna_def_region(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem alignment_types[] = {
- {RGN_ALIGN_NONE, "NONE", 0, "None", "Don't use any fixed alignment, fill available space"},
- {RGN_ALIGN_TOP, "TOP", 0, "Top", ""},
- {RGN_ALIGN_BOTTOM, "BOTTOM", 0, "Bottom", ""},
- {RGN_ALIGN_LEFT, "LEFT", 0, "Left", ""},
- {RGN_ALIGN_RIGHT, "RIGHT", 0, "Right", ""},
- {RGN_ALIGN_HSPLIT, "HORIZONTAL_SPLIT", 0, "Horizontal Split", ""},
- {RGN_ALIGN_VSPLIT, "VERTICAL_SPLIT", 0, "Vertical Split", ""},
- {RGN_ALIGN_FLOAT, "FLOAT", 0, "Float", "Region floats on screen, doesn't use any fixed alignment"},
- {RGN_ALIGN_QSPLIT, "QUAD_SPLIT", 0, "Quad Split", "Region is split horizontally and vertically"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Region", NULL);
- RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
- RNA_def_struct_sdna(srna, "ARegion");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "regiontype");
- RNA_def_property_enum_items(prop, rna_enum_region_type_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
-
- prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "X Position", "The window relative vertical location of the region");
-
- prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Y Position", "The window relative horizontal location of the region");
-
- prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "winx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Width", "Region width");
-
- prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "winy");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Height", "Region height");
-
- prop = RNA_def_property(srna, "view2d", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "v2d");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "View2D", "2D view of the region");
-
- prop = RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, alignment_types);
- RNA_def_property_enum_funcs(prop, "rna_region_alignment_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Alignment", "Alignment of the region within the area");
-
- RNA_def_function(srna, "tag_redraw", "ED_region_tag_redraw");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem alignment_types[] = {
+ {RGN_ALIGN_NONE, "NONE", 0, "None", "Don't use any fixed alignment, fill available space"},
+ {RGN_ALIGN_TOP, "TOP", 0, "Top", ""},
+ {RGN_ALIGN_BOTTOM, "BOTTOM", 0, "Bottom", ""},
+ {RGN_ALIGN_LEFT, "LEFT", 0, "Left", ""},
+ {RGN_ALIGN_RIGHT, "RIGHT", 0, "Right", ""},
+ {RGN_ALIGN_HSPLIT, "HORIZONTAL_SPLIT", 0, "Horizontal Split", ""},
+ {RGN_ALIGN_VSPLIT, "VERTICAL_SPLIT", 0, "Vertical Split", ""},
+ {RGN_ALIGN_FLOAT,
+ "FLOAT",
+ 0,
+ "Float",
+ "Region floats on screen, doesn't use any fixed alignment"},
+ {RGN_ALIGN_QSPLIT,
+ "QUAD_SPLIT",
+ 0,
+ "Quad Split",
+ "Region is split horizontally and vertically"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Region", NULL);
+ RNA_def_struct_ui_text(srna, "Region", "Region in a subdivided screen area");
+ RNA_def_struct_sdna(srna, "ARegion");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "regiontype");
+ RNA_def_property_enum_items(prop, rna_enum_region_type_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Region Type", "Type of this region");
+
+ prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "winrct.xmin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "X Position", "The window relative vertical location of the region");
+
+ prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "winrct.ymin");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Y Position", "The window relative horizontal location of the region");
+
+ prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "winx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Width", "Region width");
+
+ prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "winy");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Height", "Region height");
+
+ prop = RNA_def_property(srna, "view2d", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "v2d");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "View2D", "2D view of the region");
+
+ prop = RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, alignment_types);
+ RNA_def_property_enum_funcs(prop, "rna_region_alignment_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Alignment", "Alignment of the region within the area");
+
+ RNA_def_function(srna, "tag_redraw", "ED_region_tag_redraw");
}
static void rna_def_screen(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Screen", "ID");
- RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
- RNA_def_struct_ui_text(srna, "Screen", "Screen data-block, defining the layout of areas in a window");
- RNA_def_struct_ui_icon(srna, ICON_WORKSPACE);
-
- /* collections */
- prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
- RNA_def_property_struct_type(prop, "Area");
- RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");
-
- /* readonly status indicators */
- prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
- RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
-
- prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
- RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen");
-
- prop = RNA_def_property(srna, "show_topbar", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_TOPBAR);
- RNA_def_property_ui_text(prop, "Show Top Bar", "Show top bar with tool settings");
- RNA_def_property_update(prop, 0, "rna_Screen_bar_update");
-
- prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_STATUSBAR);
- RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar");
- RNA_def_property_update(prop, 0, "rna_Screen_bar_update");
-
- /* Define Anim Playback Areas */
- prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
- RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
- RNA_def_property_ui_text(prop, "All 3D View Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_follow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_FOLLOW);
- RNA_def_property_ui_text(prop, "Follow", "Follow current frame in editors");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
- RNA_def_property_ui_text(prop, "Animation Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
- RNA_def_property_ui_text(prop, "Property Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
- RNA_def_property_ui_text(prop, "Image Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
- RNA_def_property_ui_text(prop, "Sequencer Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
- RNA_def_property_ui_text(prop, "Node Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
-
- prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
- RNA_def_property_ui_text(prop, "Clip Editors", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Screen", "ID");
+ RNA_def_struct_sdna(srna, "Screen"); /* it is actually bScreen but for 2.5 the dna is patched! */
+ RNA_def_struct_ui_text(
+ srna, "Screen", "Screen data-block, defining the layout of areas in a window");
+ RNA_def_struct_ui_icon(srna, ICON_WORKSPACE);
+
+ /* collections */
+ prop = RNA_def_property(srna, "areas", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "areabase", NULL);
+ RNA_def_property_struct_type(prop, "Area");
+ RNA_def_property_ui_text(prop, "Areas", "Areas the screen is subdivided into");
+
+ /* readonly status indicators */
+ prop = RNA_def_property(srna, "is_animation_playing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Screen_is_animation_playing_get", NULL);
+ RNA_def_property_ui_text(prop, "Animation Playing", "Animation playback is active");
+
+ prop = RNA_def_property(srna, "show_fullscreen", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Screen_fullscreen_get", NULL);
+ RNA_def_property_ui_text(prop, "Maximize", "An area is maximized, filling this screen");
+
+ prop = RNA_def_property(srna, "show_topbar", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_TOPBAR);
+ RNA_def_property_ui_text(prop, "Show Top Bar", "Show top bar with tool settings");
+ RNA_def_property_update(prop, 0, "rna_Screen_bar_update");
+
+ prop = RNA_def_property(srna, "show_statusbar", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SCREEN_COLLAPSE_STATUSBAR);
+ RNA_def_property_ui_text(prop, "Show Status Bar", "Show status bar");
+ RNA_def_property_update(prop, 0, "rna_Screen_bar_update");
+
+ /* Define Anim Playback Areas */
+ prop = RNA_def_property(srna, "use_play_top_left_3d_editor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_REGION);
+ RNA_def_property_ui_text(prop, "Top-Left 3D Editor", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_3d_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_3D_WIN);
+ RNA_def_property_ui_text(prop, "All 3D View Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_follow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_FOLLOW);
+ RNA_def_property_ui_text(prop, "Follow", "Follow current frame in editors");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_animation_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_ANIM_WIN);
+ RNA_def_property_ui_text(prop, "Animation Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_properties_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_BUTS_WIN);
+ RNA_def_property_ui_text(prop, "Property Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_image_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_ALL_IMAGE_WIN);
+ RNA_def_property_ui_text(prop, "Image Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_sequence_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_SEQ);
+ RNA_def_property_ui_text(prop, "Sequencer Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_node_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_NODES);
+ RNA_def_property_ui_text(prop, "Node Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
+
+ prop = RNA_def_property(srna, "use_play_clip_editors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "redraws_flag", TIME_CLIPS);
+ RNA_def_property_ui_text(prop, "Clip Editors", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Screen_redraw_update");
}
void RNA_def_screen(BlenderRNA *brna)
{
- rna_def_screen(brna);
- rna_def_area(brna);
- rna_def_region(brna);
- rna_def_view2d(brna);
+ rna_def_screen(brna);
+ rna_def_area(brna);
+ rna_def_region(brna);
+ rna_def_view2d(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c
index 6d805639940..19dc16e1c9c 100644
--- a/source/blender/makesrna/intern/rna_sculpt_paint.c
+++ b/source/blender/makesrna/intern/rna_sculpt_paint.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include "BLI_math.h"
@@ -48,1462 +47,1577 @@
#include "bmesh.h"
const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[] = {
- {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
- {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
- {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
- {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
- {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"},
- {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
- {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
- {0, NULL, 0, NULL, NULL},
+ {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
+ {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
+ {PE_BRUSH_ADD, "ADD", 0, "Add", "Add hairs"},
+ {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
+ {PE_BRUSH_PUFF, "PUFF", 0, "Puff", "Make hairs stand up"},
+ {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
+ {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
- {GP_SCULPT_TYPE_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", "Smooth stroke points"},
- {GP_SCULPT_TYPE_THICKNESS, "THICKNESS", ICON_GPBRUSH_THICKNESS, "Thickness", "Adjust thickness of strokes"},
- {GP_SCULPT_TYPE_STRENGTH, "STRENGTH", ICON_GPBRUSH_STRENGTH, "Strength", "Adjust color strength of strokes" },
- {GP_SCULPT_TYPE_RANDOMIZE, "RANDOMIZE", ICON_GPBRUSH_RANDOMIZE, "Randomize", "Introduce jitter/randomness into strokes"},
- {GP_SCULPT_TYPE_GRAB, "GRAB", ICON_GPBRUSH_GRAB, "Grab", "Translate the set of points initially within the brush circle" },
- {GP_SCULPT_TYPE_PUSH, "PUSH", ICON_GPBRUSH_PUSH, "Push", "Move points out of the way, as if combing them"},
- {GP_SCULPT_TYPE_TWIST, "TWIST", ICON_GPBRUSH_TWIST, "Twist", "Rotate points around the midpoint of the brush"},
- {GP_SCULPT_TYPE_PINCH, "PINCH", ICON_GPBRUSH_PINCH, "Pinch", "Pull points towards the midpoint of the brush"},
- {GP_SCULPT_TYPE_CLONE, "CLONE", ICON_GPBRUSH_CLONE, "Clone", "Paste copies of the strokes stored on the clipboard"},
- { 0, NULL, 0, NULL, NULL }
-};
+ {GP_SCULPT_TYPE_SMOOTH, "SMOOTH", ICON_GPBRUSH_SMOOTH, "Smooth", "Smooth stroke points"},
+ {GP_SCULPT_TYPE_THICKNESS,
+ "THICKNESS",
+ ICON_GPBRUSH_THICKNESS,
+ "Thickness",
+ "Adjust thickness of strokes"},
+ {GP_SCULPT_TYPE_STRENGTH,
+ "STRENGTH",
+ ICON_GPBRUSH_STRENGTH,
+ "Strength",
+ "Adjust color strength of strokes"},
+ {GP_SCULPT_TYPE_RANDOMIZE,
+ "RANDOMIZE",
+ ICON_GPBRUSH_RANDOMIZE,
+ "Randomize",
+ "Introduce jitter/randomness into strokes"},
+ {GP_SCULPT_TYPE_GRAB,
+ "GRAB",
+ ICON_GPBRUSH_GRAB,
+ "Grab",
+ "Translate the set of points initially within the brush circle"},
+ {GP_SCULPT_TYPE_PUSH,
+ "PUSH",
+ ICON_GPBRUSH_PUSH,
+ "Push",
+ "Move points out of the way, as if combing them"},
+ {GP_SCULPT_TYPE_TWIST,
+ "TWIST",
+ ICON_GPBRUSH_TWIST,
+ "Twist",
+ "Rotate points around the midpoint of the brush"},
+ {GP_SCULPT_TYPE_PINCH,
+ "PINCH",
+ ICON_GPBRUSH_PINCH,
+ "Pinch",
+ "Pull points towards the midpoint of the brush"},
+ {GP_SCULPT_TYPE_CLONE,
+ "CLONE",
+ ICON_GPBRUSH_CLONE,
+ "Clone",
+ "Paste copies of the strokes stored on the clipboard"},
+ {0, NULL, 0, NULL, NULL}};
const EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = {
- {GP_SCULPT_TYPE_WEIGHT, "WEIGHT", ICON_GPBRUSH_WEIGHT, "Weight", "Weight Paint for Vertex Groups"},
- {0, NULL, 0, NULL, NULL},
+ {GP_SCULPT_TYPE_WEIGHT,
+ "WEIGHT",
+ ICON_GPBRUSH_WEIGHT,
+ "Weight",
+ "Weight Paint for Vertex Groups"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem rna_enum_gpencil_lock_axis_items[] = {
- {GP_LOCKAXIS_VIEW, "VIEW", ICON_RESTRICT_VIEW_ON, "View", "Align strokes to current view plane"},
- {GP_LOCKAXIS_Y, "AXIS_Y", ICON_AXIS_FRONT, "Front (X-Z)", "Project strokes to plane locked to Y"},
- {GP_LOCKAXIS_X, "AXIS_X", ICON_AXIS_SIDE, "Side (Y-Z)", "Project strokes to plane locked to X"},
- {GP_LOCKAXIS_Z, "AXIS_Z", ICON_AXIS_TOP, "Top (X-Y)", "Project strokes to plane locked to Z"},
- {GP_LOCKAXIS_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "Cursor", "Align strokes to current 3D cursor orientation"},
- {0, NULL, 0, NULL, NULL},
+ {GP_LOCKAXIS_VIEW,
+ "VIEW",
+ ICON_RESTRICT_VIEW_ON,
+ "View",
+ "Align strokes to current view plane"},
+ {GP_LOCKAXIS_Y,
+ "AXIS_Y",
+ ICON_AXIS_FRONT,
+ "Front (X-Z)",
+ "Project strokes to plane locked to Y"},
+ {GP_LOCKAXIS_X,
+ "AXIS_X",
+ ICON_AXIS_SIDE,
+ "Side (Y-Z)",
+ "Project strokes to plane locked to X"},
+ {GP_LOCKAXIS_Z, "AXIS_Z", ICON_AXIS_TOP, "Top (X-Y)", "Project strokes to plane locked to Z"},
+ {GP_LOCKAXIS_CURSOR,
+ "CURSOR",
+ ICON_PIVOT_CURSOR,
+ "Cursor",
+ "Align strokes to current 3D cursor orientation"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_symmetrize_direction_items[] = {
- {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""},
- {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""},
+ {BMO_SYMMETRIZE_NEGATIVE_X, "NEGATIVE_X", 0, "-X to +X", ""},
+ {BMO_SYMMETRIZE_POSITIVE_X, "POSITIVE_X", 0, "+X to -X", ""},
- {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""},
- {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""},
+ {BMO_SYMMETRIZE_NEGATIVE_Y, "NEGATIVE_Y", 0, "-Y to +Y", ""},
+ {BMO_SYMMETRIZE_POSITIVE_Y, "POSITIVE_Y", 0, "+Y to -Y", ""},
- {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""},
- {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""},
- {0, NULL, 0, NULL, NULL},
+ {BMO_SYMMETRIZE_NEGATIVE_Z, "NEGATIVE_Z", 0, "-Z to +Z", ""},
+ {BMO_SYMMETRIZE_POSITIVE_Z, "POSITIVE_Z", 0, "+Z to -Z", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
-
-#include "BKE_collection.h"
-#include "BKE_context.h"
-#include "BKE_particle.h"
-#include "BKE_pbvh.h"
-#include "BKE_pointcache.h"
-#include "BKE_object.h"
-#include "BKE_gpencil.h"
+# include "MEM_guardedalloc.h"
+# include "BKE_collection.h"
+# include "BKE_context.h"
+# include "BKE_particle.h"
+# include "BKE_pbvh.h"
+# include "BKE_pointcache.h"
+# include "BKE_object.h"
+# include "BKE_gpencil.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_particle.h"
+# include "ED_particle.h"
static void rna_GPencil_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
{
- /* mark all grease pencil datablocks of the scene */
- FOREACH_SCENE_COLLECTION_BEGIN(scene, collection)
- {
- FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN(collection, ob)
- {
- if (ob->type == OB_GPENCIL) {
- bGPdata *gpd = (bGPdata *)ob->data;
- gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
- DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- }
- }
- FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
- }
- FOREACH_SCENE_COLLECTION_END;
-
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ /* mark all grease pencil datablocks of the scene */
+ FOREACH_SCENE_COLLECTION_BEGIN (scene, collection) {
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_BEGIN (collection, ob) {
+ if (ob->type == OB_GPENCIL) {
+ bGPdata *gpd = (bGPdata *)ob->data;
+ gpd->flag |= GP_DATA_CACHE_IS_DIRTY;
+ DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ }
+ }
+ FOREACH_COLLECTION_OBJECT_RECURSIVE_END;
+ }
+ FOREACH_SCENE_COLLECTION_END;
+
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
const EnumPropertyItem rna_enum_particle_edit_disconnected_hair_brush_items[] = {
- {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
- {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
- {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
- {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
- {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
- {0, NULL, 0, NULL, NULL},
+ {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb hairs"},
+ {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth hairs"},
+ {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make hairs longer or shorter"},
+ {PE_BRUSH_CUT, "CUT", 0, "Cut", "Cut hairs"},
+ {PE_BRUSH_WEIGHT, "WEIGHT", 0, "Weight", "Weight hair particles"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem particle_edit_cache_brush_items[] = {
- {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
- {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"},
- {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"},
- {0, NULL, 0, NULL, NULL},
+ {PE_BRUSH_COMB, "COMB", 0, "Comb", "Comb paths"},
+ {PE_BRUSH_SMOOTH, "SMOOTH", 0, "Smooth", "Smooth paths"},
+ {PE_BRUSH_LENGTH, "LENGTH", 0, "Length", "Make paths longer or shorter"},
+ {0, NULL, 0, NULL, NULL},
};
static PointerRNA rna_ParticleEdit_brush_get(PointerRNA *ptr)
{
- ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
- ParticleBrushData *brush = NULL;
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+ ParticleBrushData *brush = NULL;
- brush = &pset->brush[pset->brushtype];
+ brush = &pset->brush[pset->brushtype];
- return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
+ return rna_pointer_inherit_refine(ptr, &RNA_ParticleBrush, brush);
}
static PointerRNA rna_ParticleBrush_curve_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
+ return rna_pointer_inherit_refine(ptr, &RNA_CurveMapping, NULL);
}
static void rna_ParticleEdit_redo(bContext *C, PointerRNA *UNUSED(ptr))
{
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
- PTCacheEdit *edit = PE_get_current(scene, ob);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+ PTCacheEdit *edit = PE_get_current(scene, ob);
- if (!edit)
- return;
+ if (!edit)
+ return;
- if (ob) DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ if (ob)
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
- psys_free_path_cache(edit->psys, edit);
- DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_COPY_ON_WRITE);
+ BKE_particle_batch_cache_dirty_tag(edit->psys, BKE_PARTICLE_BATCH_DIRTY_ALL);
+ psys_free_path_cache(edit->psys, edit);
+ DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_COPY_ON_WRITE);
}
static void rna_ParticleEdit_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
- if (ob) DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ if (ob)
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- /* Sync tool setting changes from original to evaluated scenes. */
- DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_COPY_ON_WRITE);
+ /* Sync tool setting changes from original to evaluated scenes. */
+ DEG_id_tag_update(&CTX_data_scene(C)->id, ID_RECALC_COPY_ON_WRITE);
}
static void rna_ParticleEdit_tool_set(PointerRNA *ptr, int value)
{
- ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
-
- /* redraw hair completely if weight brush is/was used */
- if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->object) {
- Object *ob = pset->object;
- if (ob) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
- }
- }
-
- pset->brushtype = value;
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+
+ /* redraw hair completely if weight brush is/was used */
+ if ((pset->brushtype == PE_BRUSH_WEIGHT || value == PE_BRUSH_WEIGHT) && pset->object) {
+ Object *ob = pset->object;
+ if (ob) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ }
+ }
+
+ pset->brushtype = value;
}
-static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(
- bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_ParticleEdit_tool_itemf(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
-#if 0
- Scene *scene = CTX_data_scene(C);
- PTCacheEdit *edit = PE_get_current(scene, ob);
- ParticleSystem *psys = edit ? edit->psys : NULL;
-#else
- /* use this rather than PE_get_current() - because the editing cache is
- * dependent on the cache being updated which can happen after this UI
- * draws causing a glitch [#28883] */
- ParticleSystem *psys = psys_get_current(ob);
-#endif
-
- if (psys) {
- if (psys->flag & PSYS_GLOBAL_HAIR) {
- return rna_enum_particle_edit_disconnected_hair_brush_items;
- }
- else {
- return rna_enum_particle_edit_hair_brush_items;
- }
- }
-
- return particle_edit_cache_brush_items;
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+# if 0
+ Scene *scene = CTX_data_scene(C);
+ PTCacheEdit *edit = PE_get_current(scene, ob);
+ ParticleSystem *psys = edit ? edit->psys : NULL;
+# else
+ /* use this rather than PE_get_current() - because the editing cache is
+ * dependent on the cache being updated which can happen after this UI
+ * draws causing a glitch [#28883] */
+ ParticleSystem *psys = psys_get_current(ob);
+# endif
+
+ if (psys) {
+ if (psys->flag & PSYS_GLOBAL_HAIR) {
+ return rna_enum_particle_edit_disconnected_hair_brush_items;
+ }
+ else {
+ return rna_enum_particle_edit_hair_brush_items;
+ }
+ }
+
+ return particle_edit_cache_brush_items;
}
static bool rna_ParticleEdit_editable_get(PointerRNA *ptr)
{
- ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
- return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object));
+ return (pset->object && pset->scene && PE_get_current(pset->scene, pset->object));
}
static bool rna_ParticleEdit_hair_get(PointerRNA *ptr)
{
- ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
+ ParticleEditSettings *pset = (ParticleEditSettings *)ptr->data;
- if (pset->scene) {
- PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
+ if (pset->scene) {
+ PTCacheEdit *edit = PE_get_current(pset->scene, pset->object);
- return (edit && edit->psys);
- }
+ return (edit && edit->psys);
+ }
- return 0;
+ return 0;
}
static char *rna_ParticleEdit_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.particle_edit");
+ return BLI_strdup("tool_settings.particle_edit");
}
static bool rna_Brush_mode_poll(PointerRNA *ptr, PointerRNA value)
{
- const Paint *paint = ptr->data;
- Brush *brush = value.id.data;
- const uint tool_offset = paint->runtime.tool_offset;
- const eObjectMode ob_mode = paint->runtime.ob_mode;
- UNUSED_VARS_NDEBUG(tool_offset);
- BLI_assert(tool_offset && ob_mode);
-
- if (brush->ob_mode & ob_mode) {
- if (paint->brush) {
- if (BKE_brush_tool_get(paint->brush, paint) == BKE_brush_tool_get(brush, paint)) {
- return true;
- }
- }
- else {
- return true;
- }
- }
-
- return false;
+ const Paint *paint = ptr->data;
+ Brush *brush = value.id.data;
+ const uint tool_offset = paint->runtime.tool_offset;
+ const eObjectMode ob_mode = paint->runtime.ob_mode;
+ UNUSED_VARS_NDEBUG(tool_offset);
+ BLI_assert(tool_offset && ob_mode);
+
+ if (brush->ob_mode & ob_mode) {
+ if (paint->brush) {
+ if (BKE_brush_tool_get(paint->brush, paint) == BKE_brush_tool_get(brush, paint)) {
+ return true;
+ }
+ }
+ else {
+ return true;
+ }
+ }
+
+ return false;
}
static bool paint_contains_brush_slot(const Paint *paint, const PaintToolSlot *tslot, int *r_index)
{
- if ((tslot >= paint->tool_slots) &&
- (tslot < (paint->tool_slots + paint->tool_slots_len)))
- {
- *r_index = (int)(tslot - paint->tool_slots);
- return true;
- }
- return false;
+ if ((tslot >= paint->tool_slots) && (tslot < (paint->tool_slots + paint->tool_slots_len))) {
+ *r_index = (int)(tslot - paint->tool_slots);
+ return true;
+ }
+ return false;
}
static bool rna_Brush_mode_with_tool_poll(PointerRNA *ptr, PointerRNA value)
{
- Scene *scene = (Scene *)ptr->id.data;
- const PaintToolSlot *tslot = ptr->data;
- ToolSettings *ts = scene->toolsettings;
- Brush *brush = value.id.data;
- int mode = 0;
- int slot_index = 0;
-
- if (paint_contains_brush_slot(&ts->imapaint.paint, tslot, &slot_index)) {
- if (slot_index != brush->imagepaint_tool) {
- return false;
- }
- mode = OB_MODE_TEXTURE_PAINT;
- }
- else if (paint_contains_brush_slot(&ts->sculpt->paint, tslot, &slot_index)) {
- if (slot_index != brush->sculpt_tool) {
- return false;
- }
- mode = OB_MODE_SCULPT;
- }
- else if (paint_contains_brush_slot(&ts->vpaint->paint, tslot, &slot_index)) {
- if (slot_index != brush->vertexpaint_tool) {
- return false;
- }
- mode = OB_MODE_VERTEX_PAINT;
- }
- else if (paint_contains_brush_slot(&ts->wpaint->paint, tslot, &slot_index)) {
- if (slot_index != brush->weightpaint_tool) {
- return false;
- }
- mode = OB_MODE_WEIGHT_PAINT;
- }
- else if (paint_contains_brush_slot(&ts->gp_paint->paint, tslot, &slot_index)) {
- if (slot_index != brush->gpencil_tool) {
- return false;
- }
- mode = OB_MODE_PAINT_GPENCIL;
- }
-
- return brush->ob_mode & mode;
+ Scene *scene = (Scene *)ptr->id.data;
+ const PaintToolSlot *tslot = ptr->data;
+ ToolSettings *ts = scene->toolsettings;
+ Brush *brush = value.id.data;
+ int mode = 0;
+ int slot_index = 0;
+
+ if (paint_contains_brush_slot(&ts->imapaint.paint, tslot, &slot_index)) {
+ if (slot_index != brush->imagepaint_tool) {
+ return false;
+ }
+ mode = OB_MODE_TEXTURE_PAINT;
+ }
+ else if (paint_contains_brush_slot(&ts->sculpt->paint, tslot, &slot_index)) {
+ if (slot_index != brush->sculpt_tool) {
+ return false;
+ }
+ mode = OB_MODE_SCULPT;
+ }
+ else if (paint_contains_brush_slot(&ts->vpaint->paint, tslot, &slot_index)) {
+ if (slot_index != brush->vertexpaint_tool) {
+ return false;
+ }
+ mode = OB_MODE_VERTEX_PAINT;
+ }
+ else if (paint_contains_brush_slot(&ts->wpaint->paint, tslot, &slot_index)) {
+ if (slot_index != brush->weightpaint_tool) {
+ return false;
+ }
+ mode = OB_MODE_WEIGHT_PAINT;
+ }
+ else if (paint_contains_brush_slot(&ts->gp_paint->paint, tslot, &slot_index)) {
+ if (slot_index != brush->gpencil_tool) {
+ return false;
+ }
+ mode = OB_MODE_PAINT_GPENCIL;
+ }
+
+ return brush->ob_mode & mode;
}
static void rna_Sculpt_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
-
- if (ob) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
-
- if (ob->sculpt) {
- ob->sculpt->bm_smooth_shading = ((scene->toolsettings->sculpt->flags &
- SCULPT_DYNTOPO_SMOOTH_SHADING) != 0);
- }
- }
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+
+ if (ob) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+
+ if (ob->sculpt) {
+ ob->sculpt->bm_smooth_shading = ((scene->toolsettings->sculpt->flags &
+ SCULPT_DYNTOPO_SMOOTH_SHADING) != 0);
+ }
+ }
}
static void rna_Sculpt_ShowDiffuseColor_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
- if (ob && ob->sculpt) {
- Scene *scene = CTX_data_scene(C);
- Sculpt *sd = scene->toolsettings->sculpt;
- ob->sculpt->show_diffuse_color = ((sd->flags & SCULPT_SHOW_DIFFUSE) != 0);
+ if (ob && ob->sculpt) {
+ Scene *scene = CTX_data_scene(C);
+ Sculpt *sd = scene->toolsettings->sculpt;
+ ob->sculpt->show_diffuse_color = ((sd->flags & SCULPT_SHOW_DIFFUSE) != 0);
- if (ob->sculpt->pbvh)
- pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color);
+ if (ob->sculpt->pbvh)
+ pbvh_show_diffuse_color_set(ob->sculpt->pbvh, ob->sculpt->show_diffuse_color);
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
- }
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
+ }
}
static void rna_Sculpt_ShowMask_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *object = OBACT(view_layer);
- if (object == NULL || object->sculpt == NULL) {
- return;
- }
- Scene *scene = CTX_data_scene(C);
- Sculpt *sd = scene->toolsettings->sculpt;
- object->sculpt->show_mask = ((sd->flags & SCULPT_HIDE_MASK) == 0);
- if (object->sculpt->pbvh != NULL) {
- pbvh_show_mask_set(object->sculpt->pbvh, object->sculpt->show_mask);
- }
- DEG_id_tag_update(&object->id, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, object);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *object = OBACT(view_layer);
+ if (object == NULL || object->sculpt == NULL) {
+ return;
+ }
+ Scene *scene = CTX_data_scene(C);
+ Sculpt *sd = scene->toolsettings->sculpt;
+ object->sculpt->show_mask = ((sd->flags & SCULPT_HIDE_MASK) == 0);
+ if (object->sculpt->pbvh != NULL) {
+ pbvh_show_mask_set(object->sculpt->pbvh, object->sculpt->show_mask);
+ }
+ DEG_id_tag_update(&object->id, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, object);
}
static char *rna_Sculpt_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.sculpt");
+ return BLI_strdup("tool_settings.sculpt");
}
static char *rna_VertexPaint_path(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- ToolSettings *ts = scene->toolsettings;
- if (ptr->data == ts->vpaint) {
- return BLI_strdup("tool_settings.vertex_paint");
- }
- else {
- return BLI_strdup("tool_settings.weight_paint");
- }
+ Scene *scene = (Scene *)ptr->id.data;
+ ToolSettings *ts = scene->toolsettings;
+ if (ptr->data == ts->vpaint) {
+ return BLI_strdup("tool_settings.vertex_paint");
+ }
+ else {
+ return BLI_strdup("tool_settings.weight_paint");
+ }
}
static char *rna_ImagePaintSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.image_paint");
+ return BLI_strdup("tool_settings.image_paint");
}
static char *rna_UvSculpt_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.uv_sculpt");
+ return BLI_strdup("tool_settings.uv_sculpt");
}
static char *rna_GpPaint_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.gpencil_paint");
+ return BLI_strdup("tool_settings.gpencil_paint");
}
static char *rna_ParticleBrush_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.particle_edit.brush");
+ return BLI_strdup("tool_settings.particle_edit.brush");
}
static void rna_Paint_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Paint *paint = ptr->data;
- Brush *br = paint->brush;
- BKE_paint_invalidate_overlay_all();
- /* Needed because we're not calling 'BKE_paint_brush_set' which handles this. */
- BKE_paint_toolslots_brush_update(paint);
- WM_main_add_notifier(NC_BRUSH | NA_SELECTED, br);
+ Paint *paint = ptr->data;
+ Brush *br = paint->brush;
+ BKE_paint_invalidate_overlay_all();
+ /* Needed because we're not calling 'BKE_paint_brush_set' which handles this. */
+ BKE_paint_toolslots_brush_update(paint);
+ WM_main_add_notifier(NC_BRUSH | NA_SELECTED, br);
}
-static void rna_ImaPaint_viewport_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_ImaPaint_viewport_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- /* not the best solution maybe, but will refresh the 3D viewport */
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ /* not the best solution maybe, but will refresh the 3D viewport */
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
static void rna_ImaPaint_mode_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
-
- if (ob && ob->type == OB_MESH) {
- /* of course we need to invalidate here */
- BKE_texpaint_slots_refresh_object(scene, ob);
-
- /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- }
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+
+ if (ob && ob->type == OB_MESH) {
+ /* of course we need to invalidate here */
+ BKE_texpaint_slots_refresh_object(scene, ob);
+
+ /* we assume that changing the current mode will invalidate the uv layers so we need to refresh display */
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ }
}
static void rna_ImaPaint_stencil_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
-
- if (ob && ob->type == OB_MESH) {
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- }
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+
+ if (ob && ob->type == OB_MESH) {
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ }
}
static void rna_ImaPaint_canvas_update(bContext *C, PointerRNA *UNUSED(ptr))
{
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *ob = OBACT(view_layer);
- Object *obedit = OBEDIT_FROM_OBACT(ob);
- bScreen *sc;
- Image *ima = scene->toolsettings->imapaint.canvas;
-
- for (sc = bmain->screens.first; sc; sc = sc->id.next) {
- ScrArea *sa;
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- SpaceLink *slink;
- for (slink = sa->spacedata.first; slink; slink = slink->next) {
- if (slink->spacetype == SPACE_IMAGE) {
- SpaceImage *sima = (SpaceImage *)slink;
-
- if (!sima->pin)
- ED_space_image_set(bmain, sima, obedit, ima, true);
- }
- }
- }
- }
-
- if (ob && ob->type == OB_MESH) {
- BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
- }
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *ob = OBACT(view_layer);
+ Object *obedit = OBEDIT_FROM_OBACT(ob);
+ bScreen *sc;
+ Image *ima = scene->toolsettings->imapaint.canvas;
+
+ for (sc = bmain->screens.first; sc; sc = sc->id.next) {
+ ScrArea *sa;
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ SpaceLink *slink;
+ for (slink = sa->spacedata.first; slink; slink = slink->next) {
+ if (slink->spacetype == SPACE_IMAGE) {
+ SpaceImage *sima = (SpaceImage *)slink;
+
+ if (!sima->pin)
+ ED_space_image_set(bmain, sima, obedit, ima, true);
+ }
+ }
+ }
+ }
+
+ if (ob && ob->type == OB_MESH) {
+ BKE_paint_proj_mesh_data_check(scene, ob, NULL, NULL, NULL, NULL);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ }
}
static bool rna_ImaPaint_detect_data(ImagePaintSettings *imapaint)
{
- return imapaint->missing_data == 0;
+ return imapaint->missing_data == 0;
}
-
static PointerRNA rna_GPencilSculptSettings_brush_get(PointerRNA *ptr)
{
- GP_Sculpt_Settings *gset = (GP_Sculpt_Settings *)ptr->data;
- GP_Sculpt_Data *brush = NULL;
-
- if ((gset) && (gset->flag & GP_SCULPT_SETT_FLAG_WEIGHT_MODE)) {
- if ((gset->weighttype >= GP_SCULPT_TYPE_WEIGHT) && (gset->weighttype < GP_SCULPT_TYPE_MAX))
- brush = &gset->brush[gset->weighttype];
- }
- else {
- if ((gset->brushtype >= 0) && (gset->brushtype < GP_SCULPT_TYPE_WEIGHT))
- brush = &gset->brush[gset->brushtype];
- }
- return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush);
+ GP_Sculpt_Settings *gset = (GP_Sculpt_Settings *)ptr->data;
+ GP_Sculpt_Data *brush = NULL;
+
+ if ((gset) && (gset->flag & GP_SCULPT_SETT_FLAG_WEIGHT_MODE)) {
+ if ((gset->weighttype >= GP_SCULPT_TYPE_WEIGHT) && (gset->weighttype < GP_SCULPT_TYPE_MAX))
+ brush = &gset->brush[gset->weighttype];
+ }
+ else {
+ if ((gset->brushtype >= 0) && (gset->brushtype < GP_SCULPT_TYPE_WEIGHT))
+ brush = &gset->brush[gset->brushtype];
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_GPencilSculptBrush, brush);
}
static char *rna_GPencilSculptSettings_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.gpencil_sculpt");
+ return BLI_strdup("tool_settings.gpencil_sculpt");
}
static char *rna_GPencilSculptBrush_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.gpencil_sculpt.brush");
+ return BLI_strdup("tool_settings.gpencil_sculpt.brush");
}
static char *rna_GPencilSculptGuide_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tool_settings.gpencil_sculpt.guide");
+ return BLI_strdup("tool_settings.gpencil_sculpt.guide");
}
#else
static void rna_def_paint_curve(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "PaintCurve", "ID");
- RNA_def_struct_ui_text(srna, "Paint Curve", "");
- RNA_def_struct_ui_icon(srna, ICON_CURVE_BEZCURVE);
+ srna = RNA_def_struct(brna, "PaintCurve", "ID");
+ RNA_def_struct_ui_text(srna, "Paint Curve", "");
+ RNA_def_struct_ui_icon(srna, ICON_CURVE_BEZCURVE);
}
static void rna_def_paint_tool_slot(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "PaintToolSlot", NULL);
- RNA_def_struct_ui_text(srna, "Paint Tool Slot", "");
+ srna = RNA_def_struct(brna, "PaintToolSlot", NULL);
+ RNA_def_struct_ui_text(srna, "Paint Tool Slot", "");
- prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_with_tool_poll");
- RNA_def_property_ui_text(prop, "Brush", "");
+ prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_with_tool_poll");
+ RNA_def_property_ui_text(prop, "Brush", "");
}
static void rna_def_paint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Paint", NULL);
- RNA_def_struct_ui_text(srna, "Paint", "");
-
- /* Global Settings */
- prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
- RNA_def_property_ui_text(prop, "Brush", "Active Brush");
- RNA_def_property_update(prop, 0, "rna_Paint_brush_update");
-
- /* paint_tool_slots */
- prop = RNA_def_property(srna, "tool_slots", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "tool_slots", "tool_slots_len");
- RNA_def_property_struct_type(prop, "PaintToolSlot");
- /* don't dereference pointer! */
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Paint Tool Slots", "");
-
- prop = RNA_def_property(srna, "palette", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Palette", "Active Palette");
-
- prop = RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
- RNA_def_property_ui_text(prop, "Show Brush", "");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE);
- RNA_def_property_ui_text(prop, "Show Brush On Surface", "");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
- RNA_def_property_ui_text(prop, "Fast Navigate", "For multires, show low resolution while navigating the view");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "num_input_samples");
- RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 0, -1);
- RNA_def_property_ui_text(prop, "Input Samples", "Average multiple input samples together to smooth the brush stroke");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_X);
- RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Y);
- RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Z);
- RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMMETRY_FEATHER);
- RNA_def_property_ui_text(prop, "Symmetry Feathering",
- "Reduce the strength of the brush where it overlaps symmetrical daubs");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "cavity_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Curve", "Editable cavity curve");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_cavity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_USE_CAVITY_MASK);
- RNA_def_property_ui_text(prop, "Cavity Mask", "Mask painting according to mesh geometry cavity");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "tile_offset", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "tile_offset");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.01, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.01, 100, 1 * 100, 2);
- RNA_def_property_ui_text(prop, "Tiling offset for the X Axis",
- "Stride at which tiled strokes are copied");
-
- prop = RNA_def_property(srna, "tile_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_X);
- RNA_def_property_ui_text(prop, "Tile X", "Tile along X axis");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "tile_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_Y);
- RNA_def_property_ui_text(prop, "Tile Y", "Tile along Y axis");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "tile_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_Z);
- RNA_def_property_ui_text(prop, "Tile Z", "Tile along Z axis");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Paint", NULL);
+ RNA_def_struct_ui_text(srna, "Paint", "");
+
+ /* Global Settings */
+ prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Brush_mode_poll");
+ RNA_def_property_ui_text(prop, "Brush", "Active Brush");
+ RNA_def_property_update(prop, 0, "rna_Paint_brush_update");
+
+ /* paint_tool_slots */
+ prop = RNA_def_property(srna, "tool_slots", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "tool_slots", "tool_slots_len");
+ RNA_def_property_struct_type(prop, "PaintToolSlot");
+ /* don't dereference pointer! */
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, "rna_iterator_array_get", NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Paint Tool Slots", "");
+
+ prop = RNA_def_property(srna, "palette", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Palette", "Active Palette");
+
+ prop = RNA_def_property(srna, "show_brush", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH);
+ RNA_def_property_ui_text(prop, "Show Brush", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "show_brush_on_surface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_SHOW_BRUSH_ON_SURFACE);
+ RNA_def_property_ui_text(prop, "Show Brush On Surface", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "show_low_resolution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_FAST_NAVIGATE);
+ RNA_def_property_ui_text(
+ prop, "Fast Navigate", "For multires, show low resolution while navigating the view");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "input_samples", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "num_input_samples");
+ RNA_def_property_ui_range(prop, 1, PAINT_MAX_INPUT_SAMPLES, 0, -1);
+ RNA_def_property_ui_text(
+ prop, "Input Samples", "Average multiple input samples together to smooth the brush stroke");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_symmetry_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_X);
+ RNA_def_property_ui_text(prop, "Symmetry X", "Mirror brush across the X axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_symmetry_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Y);
+ RNA_def_property_ui_text(prop, "Symmetry Y", "Mirror brush across the Y axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_symmetry_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMM_Z);
+ RNA_def_property_ui_text(prop, "Symmetry Z", "Mirror brush across the Z axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_symmetry_feather", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_SYMMETRY_FEATHER);
+ RNA_def_property_ui_text(prop,
+ "Symmetry Feathering",
+ "Reduce the strength of the brush where it overlaps symmetrical daubs");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "cavity_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Curve", "Editable cavity curve");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_cavity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", PAINT_USE_CAVITY_MASK);
+ RNA_def_property_ui_text(prop, "Cavity Mask", "Mask painting according to mesh geometry cavity");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "tile_offset", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "tile_offset");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.01, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1 * 100, 2);
+ RNA_def_property_ui_text(
+ prop, "Tiling offset for the X Axis", "Stride at which tiled strokes are copied");
+
+ prop = RNA_def_property(srna, "tile_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_X);
+ RNA_def_property_ui_text(prop, "Tile X", "Tile along X axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "tile_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_Y);
+ RNA_def_property_ui_text(prop, "Tile Y", "Tile along Y axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "tile_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "symmetry_flags", PAINT_TILE_Z);
+ RNA_def_property_ui_text(prop, "Tile Z", "Tile along Z axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
-static void rna_def_sculpt(BlenderRNA *brna)
+static void rna_def_sculpt(BlenderRNA *brna)
{
- static const EnumPropertyItem detail_refine_items[] = {
- {SCULPT_DYNTOPO_SUBDIVIDE, "SUBDIVIDE", 0,
- "Subdivide Edges", "Subdivide long edges to add mesh detail where needed"},
- {SCULPT_DYNTOPO_COLLAPSE, "COLLAPSE", 0,
- "Collapse Edges", "Collapse short edges to remove mesh detail where possible"},
- {SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE, "SUBDIVIDE_COLLAPSE", 0,
- "Subdivide Collapse", "Both subdivide long edges and collapse short edges to refine mesh detail"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem detail_type_items[] = {
- {0, "RELATIVE", 0,
- "Relative Detail", "Mesh detail is relative to the brush size and detail size"},
- {SCULPT_DYNTOPO_DETAIL_CONSTANT, "CONSTANT", 0,
- "Constant Detail", "Mesh detail is constant in world space according to detail size"},
- {SCULPT_DYNTOPO_DETAIL_BRUSH, "BRUSH", 0,
- "Brush Detail", "Mesh detail is relative to brush radius"},
- {SCULPT_DYNTOPO_DETAIL_MANUAL, "MANUAL", 0,
- "Manual Detail", "Mesh detail does not change on each stroke, only when using Flood Fill"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Sculpt", "Paint");
- RNA_def_struct_path_func(srna, "rna_Sculpt_path");
- RNA_def_struct_ui_text(srna, "Sculpt", "");
-
- prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
- RNA_def_property_int_sdna(prop, NULL, "radial_symm");
- RNA_def_property_int_default(prop, 1);
- RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_range(prop, 0, 32, 1, 1);
- RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis",
- "Number of times to copy strokes across the surface");
-
- prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
- RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
- RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
- RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
- RNA_def_property_ui_text(prop, "Use OpenMP",
- "Take advantage of multiple CPU cores to improve sculpting performance");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
- RNA_def_property_ui_text(prop, "Use Deform Only",
- "Use only deformation modifiers (temporary disable all "
- "constructive modifiers except multi-resolution)");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
-
- prop = RNA_def_property(srna, "show_diffuse_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SHOW_DIFFUSE);
- RNA_def_property_ui_text(prop, "Show Diffuse Color",
- "Show diffuse color of object and overlay sculpt mask on top of it");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update");
-
- prop = RNA_def_property(srna, "show_mask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", SCULPT_HIDE_MASK);
- RNA_def_property_ui_text(prop, "Show Mask", "Show mask as overlay on object");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowMask_update");
-
- prop = RNA_def_property(srna, "detail_size", PROP_FLOAT, PROP_PIXEL);
- RNA_def_property_ui_range(prop, 0.5, 40.0, 10, 2);
- RNA_def_property_ui_text(prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "detail_percent", PROP_FLOAT, PROP_PERCENTAGE);
- RNA_def_property_ui_range(prop, 0.5, 100.0, 10, 2);
- RNA_def_property_ui_text(prop, "Detail Percentage", "Maximum edge length for dynamic topology sculpting (in brush percenage)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "constant_detail_resolution", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "constant_detail");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001, 1000.0, 10, 2);
- RNA_def_property_ui_text(prop, "Resolution", "Maximum edge length for dynamic topology sculpting (as divisor "
- "of blender unit - higher value means smaller edge length)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_smooth_shading", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING);
- RNA_def_property_ui_text(prop, "Smooth Shading",
- "Show faces in dynamic-topology mode with smooth "
- "shading rather than flat shaded");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
-
- prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_symmetrize_direction_items);
- RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator");
-
- prop = RNA_def_property(srna, "detail_refine_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, detail_refine_items);
- RNA_def_property_ui_text(prop, "Detail Refine Method",
- "In dynamic-topology mode, how to add or remove mesh detail");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "detail_type_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
- RNA_def_property_enum_items(prop, detail_type_items);
- RNA_def_property_ui_text(prop, "Detail Type Method",
- "In dynamic-topology mode, how mesh detail size is calculated");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gravity_factor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_ui_text(prop, "Gravity", "Amount of gravity after each dab");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "gravity_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Orientation", "Object whose Z axis defines orientation of gravity");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+ static const EnumPropertyItem detail_refine_items[] = {
+ {SCULPT_DYNTOPO_SUBDIVIDE,
+ "SUBDIVIDE",
+ 0,
+ "Subdivide Edges",
+ "Subdivide long edges to add mesh detail where needed"},
+ {SCULPT_DYNTOPO_COLLAPSE,
+ "COLLAPSE",
+ 0,
+ "Collapse Edges",
+ "Collapse short edges to remove mesh detail where possible"},
+ {SCULPT_DYNTOPO_SUBDIVIDE | SCULPT_DYNTOPO_COLLAPSE,
+ "SUBDIVIDE_COLLAPSE",
+ 0,
+ "Subdivide Collapse",
+ "Both subdivide long edges and collapse short edges to refine mesh detail"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem detail_type_items[] = {
+ {0,
+ "RELATIVE",
+ 0,
+ "Relative Detail",
+ "Mesh detail is relative to the brush size and detail size"},
+ {SCULPT_DYNTOPO_DETAIL_CONSTANT,
+ "CONSTANT",
+ 0,
+ "Constant Detail",
+ "Mesh detail is constant in world space according to detail size"},
+ {SCULPT_DYNTOPO_DETAIL_BRUSH,
+ "BRUSH",
+ 0,
+ "Brush Detail",
+ "Mesh detail is relative to brush radius"},
+ {SCULPT_DYNTOPO_DETAIL_MANUAL,
+ "MANUAL",
+ 0,
+ "Manual Detail",
+ "Mesh detail does not change on each stroke, only when using Flood Fill"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Sculpt", "Paint");
+ RNA_def_struct_path_func(srna, "rna_Sculpt_path");
+ RNA_def_struct_ui_text(srna, "Sculpt", "");
+
+ prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
+ RNA_def_property_int_sdna(prop, NULL, "radial_symm");
+ RNA_def_property_int_default(prop, 1);
+ RNA_def_property_range(prop, 1, 64);
+ RNA_def_property_ui_range(prop, 0, 32, 1, 1);
+ RNA_def_property_ui_text(
+ prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface");
+
+ prop = RNA_def_property(srna, "lock_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_X);
+ RNA_def_property_ui_text(prop, "Lock X", "Disallow changes to the X axis of vertices");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "lock_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Y);
+ RNA_def_property_ui_text(prop, "Lock Y", "Disallow changes to the Y axis of vertices");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "lock_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_LOCK_Z);
+ RNA_def_property_ui_text(prop, "Lock Z", "Disallow changes to the Z axis of vertices");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_threaded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_USE_OPENMP);
+ RNA_def_property_ui_text(
+ prop, "Use OpenMP", "Take advantage of multiple CPU cores to improve sculpting performance");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_deform_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_ONLY_DEFORM);
+ RNA_def_property_ui_text(prop,
+ "Use Deform Only",
+ "Use only deformation modifiers (temporary disable all "
+ "constructive modifiers except multi-resolution)");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
+
+ prop = RNA_def_property(srna, "show_diffuse_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_SHOW_DIFFUSE);
+ RNA_def_property_ui_text(prop,
+ "Show Diffuse Color",
+ "Show diffuse color of object and overlay sculpt mask on top of it");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowDiffuseColor_update");
+
+ prop = RNA_def_property(srna, "show_mask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flags", SCULPT_HIDE_MASK);
+ RNA_def_property_ui_text(prop, "Show Mask", "Show mask as overlay on object");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_ShowMask_update");
+
+ prop = RNA_def_property(srna, "detail_size", PROP_FLOAT, PROP_PIXEL);
+ RNA_def_property_ui_range(prop, 0.5, 40.0, 10, 2);
+ RNA_def_property_ui_text(
+ prop, "Detail Size", "Maximum edge length for dynamic topology sculpting (in pixels)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "detail_percent", PROP_FLOAT, PROP_PERCENTAGE);
+ RNA_def_property_ui_range(prop, 0.5, 100.0, 10, 2);
+ RNA_def_property_ui_text(
+ prop,
+ "Detail Percentage",
+ "Maximum edge length for dynamic topology sculpting (in brush percenage)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "constant_detail_resolution", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "constant_detail");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001, 1000.0, 10, 2);
+ RNA_def_property_ui_text(prop,
+ "Resolution",
+ "Maximum edge length for dynamic topology sculpting (as divisor "
+ "of blender unit - higher value means smaller edge length)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_smooth_shading", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SCULPT_DYNTOPO_SMOOTH_SHADING);
+ RNA_def_property_ui_text(prop,
+ "Smooth Shading",
+ "Show faces in dynamic-topology mode with smooth "
+ "shading rather than flat shaded");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Sculpt_update");
+
+ prop = RNA_def_property(srna, "symmetrize_direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_symmetrize_direction_items);
+ RNA_def_property_ui_text(prop, "Direction", "Source and destination for symmetrize operator");
+
+ prop = RNA_def_property(srna, "detail_refine_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, detail_refine_items);
+ RNA_def_property_ui_text(
+ prop, "Detail Refine Method", "In dynamic-topology mode, how to add or remove mesh detail");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "detail_type_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
+ RNA_def_property_enum_items(prop, detail_type_items);
+ RNA_def_property_ui_text(
+ prop, "Detail Type Method", "In dynamic-topology mode, how mesh detail size is calculated");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gravity_factor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Gravity", "Amount of gravity after each dab");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "gravity_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Orientation", "Object whose Z axis defines orientation of gravity");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
}
-
-static void rna_def_uv_sculpt(BlenderRNA *brna)
+static void rna_def_uv_sculpt(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "UvSculpt", "Paint");
- RNA_def_struct_path_func(srna, "rna_UvSculpt_path");
- RNA_def_struct_ui_text(srna, "UV Sculpting", "");
+ srna = RNA_def_struct(brna, "UvSculpt", "Paint");
+ RNA_def_struct_path_func(srna, "rna_UvSculpt_path");
+ RNA_def_struct_ui_text(srna, "UV Sculpting", "");
}
-static void rna_def_gp_paint(BlenderRNA *brna)
+static void rna_def_gp_paint(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "GpPaint", "Paint");
- RNA_def_struct_path_func(srna, "rna_GpPaint_path");
- RNA_def_struct_ui_text(srna, "Grease Pencil Paint", "");
+ srna = RNA_def_struct(brna, "GpPaint", "Paint");
+ RNA_def_struct_path_func(srna, "rna_GpPaint_path");
+ RNA_def_struct_ui_text(srna, "Grease Pencil Paint", "");
}
/* use for weight paint too */
static void rna_def_vertex_paint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "VertexPaint", "Paint");
- RNA_def_struct_sdna(srna, "VPaint");
- RNA_def_struct_path_func(srna, "rna_VertexPaint_path");
- RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
-
- /* weight paint only */
- prop = RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_FLAG_VGROUP_RESTRICT);
- RNA_def_property_ui_text(prop, "Restrict", "Restrict painting to vertices in the group");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* Mirroring */
- prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
- RNA_def_property_int_sdna(prop, NULL, "radial_symm");
- RNA_def_property_int_default(prop, 1);
- RNA_def_property_range(prop, 1, 64);
- RNA_def_property_ui_range(prop, 1, 32, 1, 1);
- RNA_def_property_ui_text(prop, "Radial Symmetry Count X Axis",
- "Number of times to copy strokes across the surface");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "VertexPaint", "Paint");
+ RNA_def_struct_sdna(srna, "VPaint");
+ RNA_def_struct_path_func(srna, "rna_VertexPaint_path");
+ RNA_def_struct_ui_text(srna, "Vertex Paint", "Properties of vertex and weight paint mode");
+
+ /* weight paint only */
+ prop = RNA_def_property(srna, "use_group_restrict", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", VP_FLAG_VGROUP_RESTRICT);
+ RNA_def_property_ui_text(prop, "Restrict", "Restrict painting to vertices in the group");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* Mirroring */
+ prop = RNA_def_property(srna, "radial_symmetry", PROP_INT, PROP_XYZ);
+ RNA_def_property_int_sdna(prop, NULL, "radial_symm");
+ RNA_def_property_int_default(prop, 1);
+ RNA_def_property_range(prop, 1, 64);
+ RNA_def_property_ui_range(prop, 1, 32, 1, 1);
+ RNA_def_property_ui_text(
+ prop, "Radial Symmetry Count X Axis", "Number of times to copy strokes across the surface");
}
static void rna_def_image_paint(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
-
- static const EnumPropertyItem paint_type_items[] = {
- {IMAGEPAINT_MODE_MATERIAL, "MATERIAL", 0,
- "Material", "Detect image slots from the material"},
- {IMAGEPAINT_MODE_IMAGE, "IMAGE", 0,
- "Single Image", "Set image for texture painting directly"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem paint_interp_items[] = {
- {IMAGEPAINT_INTERP_LINEAR, "LINEAR", 0,
- "Linear", "Linear interpolation"},
- {IMAGEPAINT_INTERP_CLOSEST, "CLOSEST", 0,
- "Closest", "No interpolation (sample closest texel)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ImagePaint", "Paint");
- RNA_def_struct_sdna(srna, "ImagePaintSettings");
- RNA_def_struct_path_func(srna, "rna_ImagePaintSettings_path");
- RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode");
-
- /* functions */
- func = RNA_def_function(srna, "detect_data", "rna_ImaPaint_detect_data");
- RNA_def_function_ui_description(func, "Check if required texpaint data exist");
-
- /* return type */
- RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", ""));
-
- /* booleans */
- prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
- RNA_def_property_ui_text(prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
- RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
- RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
- RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
-
- prop = RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
- RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
-
- prop = RNA_def_property(srna, "stencil_image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "stencil");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Stencil Image", "Image used as stencil");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_stencil_update");
-
- prop = RNA_def_property(srna, "canvas", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Canvas", "Image used as canvas");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_canvas_update");
-
- prop = RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "clone");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Clone Image", "Image used as clone source");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "stencil_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "stencil_col");
- RNA_def_property_ui_text(prop, "Stencil Color", "Stencil color in the viewport");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
-
- prop = RNA_def_property(srna, "dither", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_text(prop, "Dither", "Amount of dithering when painting on byte images");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
- RNA_def_property_ui_text(prop, "Clone Map",
- "Use another UV map as clone source, otherwise use the 3D cursor as the source");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
-
- /* integers */
-
- prop = RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_PIXEL);
- RNA_def_property_ui_range(prop, 0, 8, 0, -1);
- RNA_def_property_ui_text(prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
-
- prop = RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_range(prop, 0, 90);
- RNA_def_property_ui_text(prop, "Angle", "Paint most on faces pointing towards the view according to this angle");
-
- prop = RNA_def_int_array(srna, "screen_grab_size", 2, NULL, 0, 0, "screen_grab_size",
- "Size to capture the image for re-projecting", 0, 0);
- RNA_def_property_range(prop, 512, 16384);
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_enum_items(prop, paint_type_items);
- RNA_def_property_ui_text(prop, "Mode", "Mode of operation for projection painting");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "interp");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_enum_items(prop, paint_interp_items);
- RNA_def_property_ui_text(prop, "Interpolation", "Texture filtering type");
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
-
- /* Missing data */
- prop = RNA_def_property(srna, "missing_uvs", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_UVS);
- RNA_def_property_ui_text(prop, "Missing UVs",
- "A UV layer is missing on the mesh");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "missing_materials", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_MATERIAL);
- RNA_def_property_ui_text(prop, "Missing Materials",
- "The mesh is missing materials");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "missing_stencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_STENCIL);
- RNA_def_property_ui_text(prop, "Missing Stencil",
- "Image Painting does not have a stencil");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "missing_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_TEX);
- RNA_def_property_ui_text(prop, "Missing Texture",
- "Image Painting does not have a texture to paint on");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+
+ static const EnumPropertyItem paint_type_items[] = {
+ {IMAGEPAINT_MODE_MATERIAL,
+ "MATERIAL",
+ 0,
+ "Material",
+ "Detect image slots from the material"},
+ {IMAGEPAINT_MODE_IMAGE,
+ "IMAGE",
+ 0,
+ "Single Image",
+ "Set image for texture painting directly"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem paint_interp_items[] = {
+ {IMAGEPAINT_INTERP_LINEAR, "LINEAR", 0, "Linear", "Linear interpolation"},
+ {IMAGEPAINT_INTERP_CLOSEST,
+ "CLOSEST",
+ 0,
+ "Closest",
+ "No interpolation (sample closest texel)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ImagePaint", "Paint");
+ RNA_def_struct_sdna(srna, "ImagePaintSettings");
+ RNA_def_struct_path_func(srna, "rna_ImagePaintSettings_path");
+ RNA_def_struct_ui_text(srna, "Image Paint", "Properties of image and texture painting mode");
+
+ /* functions */
+ func = RNA_def_function(srna, "detect_data", "rna_ImaPaint_detect_data");
+ RNA_def_function_ui_description(func, "Check if required texpaint data exist");
+
+ /* return type */
+ RNA_def_function_return(func, RNA_def_boolean(func, "ok", 1, "", ""));
+
+ /* booleans */
+ prop = RNA_def_property(srna, "use_occlude", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_XRAY);
+ RNA_def_property_ui_text(
+ prop, "Occlude", "Only paint onto the faces directly under the brush (slower)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_backface_culling", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_BACKFACE);
+ RNA_def_property_ui_text(prop, "Cull", "Ignore faces pointing away from the view (faster)");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_normal_falloff", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_FLAT);
+ RNA_def_property_ui_text(prop, "Normal", "Paint most on faces pointing towards the view");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_stencil_layer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL);
+ RNA_def_property_ui_text(prop, "Stencil Layer", "Set the mask layer from the UV map buttons");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "invert_stencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_STENCIL_INV);
+ RNA_def_property_ui_text(prop, "Invert", "Invert the stencil layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "stencil_image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "stencil");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Stencil Image", "Image used as stencil");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_stencil_update");
+
+ prop = RNA_def_property(srna, "canvas", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Canvas", "Image used as canvas");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_canvas_update");
+
+ prop = RNA_def_property(srna, "clone_image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "clone");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Clone Image", "Image used as clone source");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "stencil_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "stencil_col");
+ RNA_def_property_ui_text(prop, "Stencil Color", "Stencil color in the viewport");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "dither", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_text(prop, "Dither", "Amount of dithering when painting on byte images");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_clone_layer", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE);
+ RNA_def_property_ui_text(
+ prop,
+ "Clone Map",
+ "Use another UV map as clone source, otherwise use the 3D cursor as the source");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ /* integers */
+
+ prop = RNA_def_property(srna, "seam_bleed", PROP_INT, PROP_PIXEL);
+ RNA_def_property_ui_range(prop, 0, 8, 0, -1);
+ RNA_def_property_ui_text(
+ prop, "Bleed", "Extend paint beyond the faces UVs to reduce seams (in pixels, slower)");
+
+ prop = RNA_def_property(srna, "normal_angle", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_range(prop, 0, 90);
+ RNA_def_property_ui_text(
+ prop, "Angle", "Paint most on faces pointing towards the view according to this angle");
+
+ prop = RNA_def_int_array(srna,
+ "screen_grab_size",
+ 2,
+ NULL,
+ 0,
+ 0,
+ "screen_grab_size",
+ "Size to capture the image for re-projecting",
+ 0,
+ 0);
+ RNA_def_property_range(prop, 512, 16384);
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_items(prop, paint_type_items);
+ RNA_def_property_ui_text(prop, "Mode", "Mode of operation for projection painting");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "interp");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_items(prop, paint_interp_items);
+ RNA_def_property_ui_text(prop, "Interpolation", "Texture filtering type");
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_mode_update");
+
+ /* Missing data */
+ prop = RNA_def_property(srna, "missing_uvs", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_UVS);
+ RNA_def_property_ui_text(prop, "Missing UVs", "A UV layer is missing on the mesh");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "missing_materials", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_MATERIAL);
+ RNA_def_property_ui_text(prop, "Missing Materials", "The mesh is missing materials");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "missing_stencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_STENCIL);
+ RNA_def_property_ui_text(prop, "Missing Stencil", "Image Painting does not have a stencil");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "missing_texture", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "missing_data", IMAGEPAINT_MISSING_TEX);
+ RNA_def_property_ui_text(
+ prop, "Missing Texture", "Image Painting does not have a texture to paint on");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_particle_edit(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem select_mode_items[] = {
- {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
- {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
- {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem puff_mode[] = {
- {0, "ADD", 0, "Add", "Make hairs more puffy"},
- {1, "SUB", 0, "Sub", "Make hairs less puffy"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem length_mode[] = {
- {0, "GROW", 0, "Grow", "Make hairs longer"},
- {1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem edit_type_items[] = {
- {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
- {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
- {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
-
- /* edit */
-
- srna = RNA_def_struct(brna, "ParticleEdit", NULL);
- RNA_def_struct_sdna(srna, "ParticleEditSettings");
- RNA_def_struct_path_func(srna, "rna_ParticleEdit_path");
- RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
-
- prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "brushtype");
- RNA_def_property_enum_items(prop, rna_enum_particle_edit_hair_brush_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
- RNA_def_property_ui_text(prop, "Tool", "");
-
- prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
- RNA_def_property_enum_items(prop, select_mode_items);
- RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
-
- prop = RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
- RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");
-
- prop = RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
- RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");
-
- prop = RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
- RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");
-
- prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "emitterdist");
- RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
- RNA_def_property_ui_text(prop, "Emitter Distance", "Distance to keep particles away from the emitter");
-
- prop = RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
- RNA_def_property_ui_text(prop, "Fade Time", "Fade paths and keys further away from current frame");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
-
- prop = RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
- RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");
-
- prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
- RNA_def_property_ui_text(prop, "Display Particles", "Display actual particles");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
-
- prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
- RNA_def_property_ui_text(prop, "Interpolate", "Interpolate new particles from the existing ones");
-
- prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "totaddkey");
- RNA_def_property_range(prop, 2, SHRT_MAX);
- RNA_def_property_ui_range(prop, 2, 20, 10, 3);
- RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");
-
- prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ParticleBrush");
- RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Brush", "");
-
- prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "draw_step");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_text(prop, "Steps", "How many steps to display the path with");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
-
- prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_enum_sdna(prop, NULL, "edittype");
- RNA_def_property_enum_items(prop, edit_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
-
- prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
-
- prop = RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Hair", "Editing hair");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Object", "The edited object");
-
- prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
-
- /* brush */
-
- srna = RNA_def_struct(brna, "ParticleBrush", NULL);
- RNA_def_struct_sdna(srna, "ParticleBrushData");
- RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
- RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
-
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 10, 3);
- RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.001, 1.0);
- RNA_def_property_ui_text(prop, "Strength", "Brush strength");
-
- prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_range(prop, 1, 100, 10, 3);
- RNA_def_property_ui_text(prop, "Count", "Particle count");
-
- prop = RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "step");
- RNA_def_property_range(prop, 1, SHRT_MAX);
- RNA_def_property_ui_range(prop, 1, 50, 10, 3);
- RNA_def_property_ui_text(prop, "Steps", "Brush steps");
-
- prop = RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "invert");
- RNA_def_property_enum_items(prop, puff_mode);
- RNA_def_property_ui_text(prop, "Puff Mode", "");
-
- prop = RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
- RNA_def_property_ui_text(prop, "Puff Volume",
- "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
-
- prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "invert");
- RNA_def_property_enum_items(prop, length_mode);
- RNA_def_property_ui_text(prop, "Length Mode", "");
-
- /* dummy */
- prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Curve", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem select_mode_items[] = {
+ {SCE_SELECT_PATH, "PATH", ICON_PARTICLE_PATH, "Path", "Path edit mode"},
+ {SCE_SELECT_POINT, "POINT", ICON_PARTICLE_POINT, "Point", "Point select mode"},
+ {SCE_SELECT_END, "TIP", ICON_PARTICLE_TIP, "Tip", "Tip select mode"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem puff_mode[] = {
+ {0, "ADD", 0, "Add", "Make hairs more puffy"},
+ {1, "SUB", 0, "Sub", "Make hairs less puffy"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem length_mode[] = {
+ {0, "GROW", 0, "Grow", "Make hairs longer"},
+ {1, "SHRINK", 0, "Shrink", "Make hairs shorter"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem edit_type_items[] = {
+ {PE_TYPE_PARTICLES, "PARTICLES", 0, "Particles", ""},
+ {PE_TYPE_SOFTBODY, "SOFT_BODY", 0, "Soft body", ""},
+ {PE_TYPE_CLOTH, "CLOTH", 0, "Cloth", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* edit */
+
+ srna = RNA_def_struct(brna, "ParticleEdit", NULL);
+ RNA_def_struct_sdna(srna, "ParticleEditSettings");
+ RNA_def_struct_path_func(srna, "rna_ParticleEdit_path");
+ RNA_def_struct_ui_text(srna, "Particle Edit", "Properties of particle editing mode");
+
+ prop = RNA_def_property(srna, "tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brushtype");
+ RNA_def_property_enum_items(prop, rna_enum_particle_edit_hair_brush_items);
+ RNA_def_property_enum_funcs(
+ prop, NULL, "rna_ParticleEdit_tool_set", "rna_ParticleEdit_tool_itemf");
+ RNA_def_property_ui_text(prop, "Tool", "");
+
+ prop = RNA_def_property(srna, "select_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "selectmode");
+ RNA_def_property_enum_items(prop, select_mode_items);
+ RNA_def_property_ui_text(prop, "Selection Mode", "Particle select and display mode");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
+
+ prop = RNA_def_property(srna, "use_preserve_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_KEEP_LENGTHS);
+ RNA_def_property_ui_text(prop, "Keep Lengths", "Keep path lengths constant");
+
+ prop = RNA_def_property(srna, "use_preserve_root", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_LOCK_FIRST);
+ RNA_def_property_ui_text(prop, "Keep Root", "Keep root keys unmodified");
+
+ prop = RNA_def_property(srna, "use_emitter_deflect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DEFLECT_EMITTER);
+ RNA_def_property_ui_text(prop, "Deflect Emitter", "Keep paths from intersecting the emitter");
+
+ prop = RNA_def_property(srna, "emitter_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "emitterdist");
+ RNA_def_property_ui_range(prop, 0.0f, 10.0f, 10, 3);
+ RNA_def_property_ui_text(
+ prop, "Emitter Distance", "Distance to keep particles away from the emitter");
+
+ prop = RNA_def_property(srna, "use_fade_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_FADE_TIME);
+ RNA_def_property_ui_text(
+ prop, "Fade Time", "Fade paths and keys further away from current frame");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
+
+ prop = RNA_def_property(srna, "use_auto_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_AUTO_VELOCITY);
+ RNA_def_property_ui_text(prop, "Auto Velocity", "Calculate point velocities automatically");
+
+ prop = RNA_def_property(srna, "show_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_DRAW_PART);
+ RNA_def_property_ui_text(prop, "Display Particles", "Display actual particles");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ prop = RNA_def_property(srna, "use_default_interpolate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_INTERPOLATE_ADDED);
+ RNA_def_property_ui_text(
+ prop, "Interpolate", "Interpolate new particles from the existing ones");
+
+ prop = RNA_def_property(srna, "default_key_count", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "totaddkey");
+ RNA_def_property_range(prop, 2, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 2, 20, 10, 3);
+ RNA_def_property_ui_text(prop, "Keys", "How many keys to make new particles with");
+
+ prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ParticleBrush");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleEdit_brush_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Brush", "");
+
+ prop = RNA_def_property(srna, "display_step", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "draw_step");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(prop, "Steps", "How many steps to display the path with");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ prop = RNA_def_property(srna, "fade_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(prop, "Frames", "How many frames to fade");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_update");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_sdna(prop, NULL, "edittype");
+ RNA_def_property_enum_items(prop, edit_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ prop = RNA_def_property(srna, "is_editable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_editable_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Editable", "A valid edit mode exists");
+
+ prop = RNA_def_property(srna, "is_hair", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_ParticleEdit_hair_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Hair", "Editing hair");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Object", "The edited object");
+
+ prop = RNA_def_property(srna, "shape_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Shape Object", "Outer shape to use for tools");
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Mesh_object_poll");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_ParticleEdit_redo");
+
+ /* brush */
+
+ srna = RNA_def_struct(brna, "ParticleBrush", NULL);
+ RNA_def_struct_sdna(srna, "ParticleBrushData");
+ RNA_def_struct_path_func(srna, "rna_ParticleBrush_path");
+ RNA_def_struct_ui_text(srna, "Particle Brush", "Particle editing brush");
+
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, MAX_BRUSH_PIXEL_RADIUS, 10, 3);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.001, 1.0);
+ RNA_def_property_ui_text(prop, "Strength", "Brush strength");
+
+ prop = RNA_def_property(srna, "count", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_range(prop, 1, 100, 10, 3);
+ RNA_def_property_ui_text(prop, "Count", "Particle count");
+
+ prop = RNA_def_property(srna, "steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "step");
+ RNA_def_property_range(prop, 1, SHRT_MAX);
+ RNA_def_property_ui_range(prop, 1, 50, 10, 3);
+ RNA_def_property_ui_text(prop, "Steps", "Brush steps");
+
+ prop = RNA_def_property(srna, "puff_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "invert");
+ RNA_def_property_enum_items(prop, puff_mode);
+ RNA_def_property_ui_text(prop, "Puff Mode", "");
+
+ prop = RNA_def_property(srna, "use_puff_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PE_BRUSH_DATA_PUFF_VOLUME);
+ RNA_def_property_ui_text(
+ prop,
+ "Puff Volume",
+ "Apply puff to unselected end-points (helps maintain hair volume when puffing root)");
+
+ prop = RNA_def_property(srna, "length_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "invert");
+ RNA_def_property_enum_items(prop, length_mode);
+ RNA_def_property_ui_text(prop, "Length Mode", "");
+
+ /* dummy */
+ prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_pointer_funcs(prop, "rna_ParticleBrush_curve_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Curve", "");
}
/* srna -- gpencil speed guides */
static void rna_def_gpencil_guides(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "GPencilSculptGuide", NULL);
- RNA_def_struct_sdna(srna, "GP_Sculpt_Guide");
- RNA_def_struct_path_func(srna, "rna_GPencilSculptGuide_path");
- RNA_def_struct_ui_text(srna, "GPencil Sculpt Guide", "Guides for drawing");
-
- static const EnumPropertyItem prop_gpencil_guidetypes[] = {
- {GP_GUIDE_CIRCULAR, "CIRCULAR", 0, "Circular", "Use single point to create rings"},
- {GP_GUIDE_RADIAL, "RADIAL", 0, "Radial", "Use single point as direction"},
- {GP_GUIDE_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel lines"},
- {GP_GUIDE_GRID, "GRID", 0, "Grid", "Grid allows horizontal and vertical lines"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_gpencil_guide_references[] = {
- {GP_GUIDE_REF_CURSOR, "CURSOR", 0, "Cursor", "Use cursor as reference point"},
- {GP_GUIDE_REF_CUSTOM, "CUSTOM", 0, "Custom", "Use custom reference point"},
- {GP_GUIDE_REF_OBJECT, "OBJECT", 0, "Object", "Use object as reference point"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "use_guide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_guide", false);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Use Guides", "Enable speed guides");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_snapping", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_snapping", false);
- RNA_def_property_boolean_default(prop, false);
- RNA_def_property_ui_text(prop, "Use Snapping", "Enable snapping to guides angle or spacing options");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "reference_object");
- RNA_def_property_ui_text(prop, "Object", "Object used for reference point");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
-
- prop = RNA_def_property(srna, "reference_point", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "reference_point");
- RNA_def_property_enum_items(prop, prop_gpencil_guide_references);
- RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_gpencil_guidetypes);
- RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_range(prop, -(M_PI * 2.0f), (M_PI * 2.0f));
- RNA_def_property_ui_text(prop, "Angle", "Direction of lines");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "angle_snap", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle_snap");
- RNA_def_property_range(prop, -(M_PI * 2.0f), (M_PI * 2.0f));
- RNA_def_property_ui_text(prop, "Angle Snap", "Angle snapping");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "spacing");
- RNA_def_property_float_default(prop, 0.01f);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
- RNA_def_property_ui_text(prop, "Spacing", "Guide spacing");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "location");
- RNA_def_property_array(prop, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Location", "Custom reference point for guides");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "GPencilSculptGuide", NULL);
+ RNA_def_struct_sdna(srna, "GP_Sculpt_Guide");
+ RNA_def_struct_path_func(srna, "rna_GPencilSculptGuide_path");
+ RNA_def_struct_ui_text(srna, "GPencil Sculpt Guide", "Guides for drawing");
+
+ static const EnumPropertyItem prop_gpencil_guidetypes[] = {
+ {GP_GUIDE_CIRCULAR, "CIRCULAR", 0, "Circular", "Use single point to create rings"},
+ {GP_GUIDE_RADIAL, "RADIAL", 0, "Radial", "Use single point as direction"},
+ {GP_GUIDE_PARALLEL, "PARALLEL", 0, "Parallel", "Parallel lines"},
+ {GP_GUIDE_GRID, "GRID", 0, "Grid", "Grid allows horizontal and vertical lines"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_gpencil_guide_references[] = {
+ {GP_GUIDE_REF_CURSOR, "CURSOR", 0, "Cursor", "Use cursor as reference point"},
+ {GP_GUIDE_REF_CUSTOM, "CUSTOM", 0, "Custom", "Use custom reference point"},
+ {GP_GUIDE_REF_OBJECT, "OBJECT", 0, "Object", "Use object as reference point"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "use_guide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_guide", false);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(prop, "Use Guides", "Enable speed guides");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_snapping", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_snapping", false);
+ RNA_def_property_boolean_default(prop, false);
+ RNA_def_property_ui_text(
+ prop, "Use Snapping", "Enable snapping to guides angle or spacing options");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "reference_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "reference_object");
+ RNA_def_property_ui_text(prop, "Object", "Object used for reference point");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "reference_point", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "reference_point");
+ RNA_def_property_enum_items(prop, prop_gpencil_guide_references);
+ RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_gpencil_guidetypes);
+ RNA_def_property_ui_text(prop, "Type", "Type of speed guide");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_range(prop, -(M_PI * 2.0f), (M_PI * 2.0f));
+ RNA_def_property_ui_text(prop, "Angle", "Direction of lines");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "angle_snap", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle_snap");
+ RNA_def_property_range(prop, -(M_PI * 2.0f), (M_PI * 2.0f));
+ RNA_def_property_ui_text(prop, "Angle Snap", "Angle snapping");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "spacing", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "spacing");
+ RNA_def_property_float_default(prop, 0.01f);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, 3);
+ RNA_def_property_ui_text(prop, "Spacing", "Guide spacing");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "location");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Location", "Custom reference point for guides");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update");
}
static void rna_def_gpencil_sculpt(BlenderRNA *brna)
{
- static const EnumPropertyItem prop_direction_items[] = {
- {0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
- {GP_SCULPT_FLAG_INVERT, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* == Settings == */
- srna = RNA_def_struct(brna, "GPencilSculptSettings", NULL);
- RNA_def_struct_sdna(srna, "GP_Sculpt_Settings");
- RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path");
- RNA_def_struct_ui_text(srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool");
-
- prop = RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "brushtype");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_sculpt_brush_items);
- RNA_def_property_ui_text(prop, "Tool", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "weight_tool", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "weighttype");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_weight_brush_items);
- RNA_def_property_ui_text(prop, "Tool", "Tool for weight painting");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "GPencilSculptBrush");
- RNA_def_property_pointer_funcs(prop, "rna_GPencilSculptSettings_brush_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Brush", "");
-
- prop = RNA_def_property(srna, "guide", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "GPencilSculptGuide");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Guide", "");
-
- prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_SELECT_MASK);
- RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
- RNA_def_property_ui_icon(prop, ICON_GP_ONLY_SELECTED, 0);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_POSITION);
- RNA_def_property_ui_text(prop, "Affect Position", "The brush affects the position of the point");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_edit_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_STRENGTH);
- RNA_def_property_ui_text(prop, "Affect Strength", "The brush affects the color strength of the point");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_edit_thickness", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_THICKNESS);
- RNA_def_property_ui_text(prop, "Affect Thickness", "The brush affects the thickness of the point");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_edit_uv", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_UV);
- RNA_def_property_ui_text(prop, "Affect UV", "The brush affects the UV rotation of the point");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_multiframe_falloff", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_FRAME_FALLOFF);
- RNA_def_property_ui_text(prop, "Use Falloff", "Use falloff effect when edit in multiframe mode to compute brush effect by frame");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_thickness_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE);
- RNA_def_property_ui_text(prop, "Use Curve", "Use curve to define primitive stroke thickness");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* custom falloff curve */
- prop = RNA_def_property(srna, "multiframe_falloff_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "cur_falloff");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(
- prop, "Curve",
- "Custom curve to control falloff of brush effect by Grease Pencil frames");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* custom primitive curve */
- prop = RNA_def_property(srna, "thickness_primitive_curve", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "cur_primitive");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(
- prop, "Curve",
- "Custom curve to control primitive thickness");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* lock axis */
- prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "lock_axis");
- RNA_def_property_enum_items(prop, rna_enum_gpencil_lock_axis_items);
- RNA_def_property_ui_text(prop, "Lock Axis", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
-
- /* threshold for cutter */
- prop = RNA_def_property(srna, "intersection_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "isect_threshold");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_ui_text(prop, "Threshold", "Threshold for stroke intersections");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- /* brush */
- srna = RNA_def_struct(brna, "GPencilSculptBrush", NULL);
- RNA_def_struct_sdna(srna, "GP_Sculpt_Data");
- RNA_def_struct_path_func(srna, "rna_GPencilSculptBrush_path");
- RNA_def_struct_ui_text(srna, "GPencil Sculpt Brush", "Stroke editing brush");
-
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 1, GP_MAX_BRUSH_PIXEL_RADIUS);
- RNA_def_property_ui_range(prop, 1, 500, 10, 3);
- RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.001, 1.0);
- RNA_def_property_ui_text(prop, "Strength", "Brush strength");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Weight", "Target weight");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_USE_PRESSURE);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_PRESSURE_RADIUS);
- RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
- RNA_def_property_ui_text(prop, "Radius Pressure", "Enable tablet pressure sensitivity for radius");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_USE_FALLOFF);
- RNA_def_property_ui_text(prop, "Use Falloff", "Strength of brush decays with distance from cursor");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "use_edit_pressure", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_SMOOTH_PRESSURE);
- RNA_def_property_ui_text(prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_direction_items);
- RNA_def_property_ui_text(prop, "Direction", "");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
-
- /* Cursor Color */
- static float default_1[3] = { 1.0f, 0.6f, 0.6f };
- static float default_2[3] = { 0.6f, 0.6f, 1.0f };
-
- prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "curcolor_add");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_1);
- RNA_def_property_ui_text(prop, "Cursor Add", "Color for the cursor for addition");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "cursor_color_sub", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "curcolor_sub");
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_array_default(prop, default_2);
- RNA_def_property_ui_text(prop, "Cursor Sub", "Color for the cursor for subtraction");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
-
- prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_ENABLE_CURSOR);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ static const EnumPropertyItem prop_direction_items[] = {
+ {0, "ADD", ICON_ADD, "Add", "Add effect of brush"},
+ {GP_SCULPT_FLAG_INVERT, "SUBTRACT", ICON_REMOVE, "Subtract", "Subtract effect of brush"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* == Settings == */
+ srna = RNA_def_struct(brna, "GPencilSculptSettings", NULL);
+ RNA_def_struct_sdna(srna, "GP_Sculpt_Settings");
+ RNA_def_struct_path_func(srna, "rna_GPencilSculptSettings_path");
+ RNA_def_struct_ui_text(
+ srna, "GPencil Sculpt Settings", "Properties for Grease Pencil stroke sculpting tool");
+
+ prop = RNA_def_property(srna, "sculpt_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "brushtype");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_sculpt_brush_items);
+ RNA_def_property_ui_text(prop, "Tool", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "weight_tool", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "weighttype");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_weight_brush_items);
+ RNA_def_property_ui_text(prop, "Tool", "Tool for weight painting");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "brush", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "GPencilSculptBrush");
+ RNA_def_property_pointer_funcs(prop, "rna_GPencilSculptSettings_brush_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Brush", "");
+
+ prop = RNA_def_property(srna, "guide", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "GPencilSculptGuide");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Guide", "");
+
+ prop = RNA_def_property(srna, "use_select_mask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_SELECT_MASK);
+ RNA_def_property_ui_text(prop, "Selection Mask", "Only sculpt selected stroke points");
+ RNA_def_property_ui_icon(prop, ICON_GP_ONLY_SELECTED, 0);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_edit_position", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_POSITION);
+ RNA_def_property_ui_text(prop, "Affect Position", "The brush affects the position of the point");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_edit_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_STRENGTH);
+ RNA_def_property_ui_text(
+ prop, "Affect Strength", "The brush affects the color strength of the point");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_edit_thickness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_THICKNESS);
+ RNA_def_property_ui_text(
+ prop, "Affect Thickness", "The brush affects the thickness of the point");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_edit_uv", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_APPLY_UV);
+ RNA_def_property_ui_text(prop, "Affect UV", "The brush affects the UV rotation of the point");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_multiframe_falloff", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_FRAME_FALLOFF);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Falloff",
+ "Use falloff effect when edit in multiframe mode to compute brush effect by frame");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_thickness_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_SETT_FLAG_PRIMITIVE_CURVE);
+ RNA_def_property_ui_text(prop, "Use Curve", "Use curve to define primitive stroke thickness");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* custom falloff curve */
+ prop = RNA_def_property(srna, "multiframe_falloff_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "cur_falloff");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(
+ prop, "Curve", "Custom curve to control falloff of brush effect by Grease Pencil frames");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* custom primitive curve */
+ prop = RNA_def_property(srna, "thickness_primitive_curve", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "cur_primitive");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve", "Custom curve to control primitive thickness");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* lock axis */
+ prop = RNA_def_property(srna, "lock_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "lock_axis");
+ RNA_def_property_enum_items(prop, rna_enum_gpencil_lock_axis_items);
+ RNA_def_property_ui_text(prop, "Lock Axis", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");
+
+ /* threshold for cutter */
+ prop = RNA_def_property(srna, "intersection_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "isect_threshold");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(prop, "Threshold", "Threshold for stroke intersections");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ /* brush */
+ srna = RNA_def_struct(brna, "GPencilSculptBrush", NULL);
+ RNA_def_struct_sdna(srna, "GP_Sculpt_Data");
+ RNA_def_struct_path_func(srna, "rna_GPencilSculptBrush_path");
+ RNA_def_struct_ui_text(srna, "GPencil Sculpt Brush", "Stroke editing brush");
+
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 1, GP_MAX_BRUSH_PIXEL_RADIUS);
+ RNA_def_property_ui_range(prop, 1, 500, 10, 3);
+ RNA_def_property_ui_text(prop, "Radius", "Radius of the brush in pixels");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.001, 1.0);
+ RNA_def_property_ui_text(prop, "Strength", "Brush strength");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Weight", "Target weight");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_pressure_strength", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_USE_PRESSURE);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Strength Pressure", "Enable tablet pressure sensitivity for strength");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_pressure_radius", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_PRESSURE_RADIUS);
+ RNA_def_property_ui_icon(prop, ICON_STYLUS_PRESSURE, 0);
+ RNA_def_property_ui_text(
+ prop, "Radius Pressure", "Enable tablet pressure sensitivity for radius");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_falloff", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_USE_FALLOFF);
+ RNA_def_property_ui_text(
+ prop, "Use Falloff", "Strength of brush decays with distance from cursor");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "use_edit_pressure", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_SMOOTH_PRESSURE);
+ RNA_def_property_ui_text(
+ prop, "Affect Pressure", "Affect pressure values as well when smoothing strokes");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_direction_items);
+ RNA_def_property_ui_text(prop, "Direction", "");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL);
+
+ /* Cursor Color */
+ static float default_1[3] = {1.0f, 0.6f, 0.6f};
+ static float default_2[3] = {0.6f, 0.6f, 1.0f};
+
+ prop = RNA_def_property(srna, "cursor_color_add", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "curcolor_add");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_1);
+ RNA_def_property_ui_text(prop, "Cursor Add", "Color for the cursor for addition");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "cursor_color_sub", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "curcolor_sub");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_array_default(prop, default_2);
+ RNA_def_property_ui_text(prop, "Cursor Sub", "Color for the cursor for subtraction");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+
+ prop = RNA_def_property(srna, "use_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_SCULPT_FLAG_ENABLE_CURSOR);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Enable Cursor", "Enable cursor on screen");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
}
void RNA_def_sculpt_paint(BlenderRNA *brna)
{
- /* *** Non-Animated *** */
- RNA_define_animate_sdna(false);
- rna_def_paint_curve(brna);
- rna_def_paint_tool_slot(brna);
- rna_def_paint(brna);
- rna_def_sculpt(brna);
- rna_def_uv_sculpt(brna);
- rna_def_gp_paint(brna);
- rna_def_vertex_paint(brna);
- rna_def_image_paint(brna);
- rna_def_particle_edit(brna);
- rna_def_gpencil_guides(brna);
- rna_def_gpencil_sculpt(brna);
- RNA_define_animate_sdna(true);
+ /* *** Non-Animated *** */
+ RNA_define_animate_sdna(false);
+ rna_def_paint_curve(brna);
+ rna_def_paint_tool_slot(brna);
+ rna_def_paint(brna);
+ rna_def_sculpt(brna);
+ rna_def_uv_sculpt(brna);
+ rna_def_gp_paint(brna);
+ rna_def_vertex_paint(brna);
+ rna_def_image_paint(brna);
+ rna_def_particle_edit(brna);
+ rna_def_gpencil_guides(brna);
+ rna_def_gpencil_sculpt(brna);
+ RNA_define_animate_sdna(true);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sequencer.c b/source/blender/makesrna/intern/rna_sequencer.c
index 569fbb61ad8..a00d4c99455 100644
--- a/source/blender/makesrna/intern/rna_sequencer.c
+++ b/source/blender/makesrna/intern/rna_sequencer.c
@@ -49,168 +49,174 @@
#include "WM_types.h"
typedef struct EffectInfo {
- const char *struct_name;
- const char *ui_name;
- const char *ui_desc;
- void (*func)(StructRNA *);
- int inputs;
+ const char *struct_name;
+ const char *ui_name;
+ const char *ui_desc;
+ void (*func)(StructRNA *);
+ int inputs;
} EffectInfo;
const EnumPropertyItem rna_enum_sequence_modifier_type_items[] = {
- {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""},
- {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""},
- {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""},
- {seqModifierType_BrightContrast, "BRIGHT_CONTRAST", ICON_NONE, "Bright/Contrast", ""},
- {seqModifierType_Mask, "MASK", ICON_NONE, "Mask", ""},
- {seqModifierType_WhiteBalance, "WHITE_BALANCE", ICON_NONE, "White Balance", ""},
- {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""},
- {0, NULL, 0, NULL, NULL},
+ {seqModifierType_ColorBalance, "COLOR_BALANCE", ICON_NONE, "Color Balance", ""},
+ {seqModifierType_Curves, "CURVES", ICON_NONE, "Curves", ""},
+ {seqModifierType_HueCorrect, "HUE_CORRECT", ICON_NONE, "Hue Correct", ""},
+ {seqModifierType_BrightContrast, "BRIGHT_CONTRAST", ICON_NONE, "Bright/Contrast", ""},
+ {seqModifierType_Mask, "MASK", ICON_NONE, "Mask", ""},
+ {seqModifierType_WhiteBalance, "WHITE_BALANCE", ICON_NONE, "White Balance", ""},
+ {seqModifierType_Tonemap, "TONEMAP", ICON_NONE, "Tone Map", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BKE_report.h"
-#include "BKE_idprop.h"
-#include "BKE_movieclip.h"
+# include "BKE_report.h"
+# include "BKE_idprop.h"
+# include "BKE_movieclip.h"
-#include "WM_api.h"
+# include "WM_api.h"
-#include "IMB_imbuf.h"
+# include "IMB_imbuf.h"
typedef struct SequenceSearchData {
- Sequence *seq;
- void *data;
- SequenceModifierData *smd;
+ Sequence *seq;
+ void *data;
+ SequenceModifierData *smd;
} SequenceSearchData;
/* build a temp reference to the parent */
static void meta_tmp_ref(Sequence *seq_par, Sequence *seq)
{
- for (; seq; seq = seq->next) {
- seq->tmp = seq_par;
- if (seq->type == SEQ_TYPE_META) {
- meta_tmp_ref(seq, seq->seqbase.first);
- }
- }
+ for (; seq; seq = seq->next) {
+ seq->tmp = seq_par;
+ if (seq->type == SEQ_TYPE_META) {
+ meta_tmp_ref(seq, seq->seqbase.first);
+ }
+ }
}
static void rna_SequenceElement_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- if (ed) {
- StripElem *se = (StripElem *)ptr->data;
- Sequence *seq;
+ if (ed) {
+ StripElem *se = (StripElem *)ptr->data;
+ Sequence *seq;
- /* slow but we can't avoid! */
- seq = BKE_sequencer_from_elem(&ed->seqbase, se);
- if (seq) {
- BKE_sequence_invalidate_cache(scene, seq);
- }
- }
+ /* slow but we can't avoid! */
+ seq = BKE_sequencer_from_elem(&ed->seqbase, se);
+ if (seq) {
+ BKE_sequence_invalidate_cache(scene, seq);
+ }
+ }
}
static void rna_Sequence_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- if (ed) {
- Sequence *seq = (Sequence *) ptr->data;
+ if (ed) {
+ Sequence *seq = (Sequence *)ptr->data;
- BKE_sequence_invalidate_cache(scene, seq);
- }
+ BKE_sequence_invalidate_cache(scene, seq);
+ }
}
-static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_SequenceEditor_sequences_all_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- meta_tmp_ref(NULL, ed->seqbase.first);
+ meta_tmp_ref(NULL, ed->seqbase.first);
- rna_iterator_listbase_begin(iter, &ed->seqbase, NULL);
+ rna_iterator_listbase_begin(iter, &ed->seqbase, NULL);
}
-static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain), Scene *scene, PointerRNA *UNUSED(ptr))
+static void rna_SequenceEditor_update_cache(Main *UNUSED(bmain),
+ Scene *scene,
+ PointerRNA *UNUSED(ptr))
{
- Editing *ed = scene->ed;
+ Editing *ed = scene->ed;
- BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
+ BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
}
-
static void rna_SequenceEditor_sequences_all_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- Sequence *seq = (Sequence *)internal->link;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ Sequence *seq = (Sequence *)internal->link;
- if (seq->seqbase.first)
- internal->link = (Link *)seq->seqbase.first;
- else if (seq->next)
- internal->link = (Link *)seq->next;
- else {
- internal->link = NULL;
+ if (seq->seqbase.first)
+ internal->link = (Link *)seq->seqbase.first;
+ else if (seq->next)
+ internal->link = (Link *)seq->next;
+ else {
+ internal->link = NULL;
- do {
- seq = seq->tmp; /* XXX - seq's don't reference their parents! */
- if (seq && seq->next) {
- internal->link = (Link *)seq->next;
- break;
- }
- } while (seq);
- }
+ do {
+ seq = seq->tmp; /* XXX - seq's don't reference their parents! */
+ if (seq && seq->next) {
+ internal->link = (Link *)seq->next;
+ break;
+ }
+ } while (seq);
+ }
- iter->valid = (internal->link != NULL);
+ iter->valid = (internal->link != NULL);
}
/* internal use */
static int rna_SequenceEditor_elements_length(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)ptr->data;
+ Sequence *seq = (Sequence *)ptr->data;
- /* Hack? copied from sequencer.c::reload_sequence_new_file() */
- size_t olen = MEM_allocN_len(seq->strip->stripdata) / sizeof(struct StripElem);
+ /* Hack? copied from sequencer.c::reload_sequence_new_file() */
+ size_t olen = MEM_allocN_len(seq->strip->stripdata) / sizeof(struct StripElem);
- /* the problem with seq->strip->len and seq->len is that it's discounted from the offset (hard cut trim) */
- return (int) olen;
+ /* the problem with seq->strip->len and seq->len is that it's discounted from the offset (hard cut trim) */
+ return (int)olen;
}
static void rna_SequenceEditor_elements_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)ptr->data;
- rna_iterator_array_begin(iter, (void *)seq->strip->stripdata, sizeof(StripElem),
- rna_SequenceEditor_elements_length(ptr), 0, NULL);
+ Sequence *seq = (Sequence *)ptr->data;
+ rna_iterator_array_begin(iter,
+ (void *)seq->strip->stripdata,
+ sizeof(StripElem),
+ rna_SequenceEditor_elements_length(ptr),
+ 0,
+ NULL);
}
static void rna_Sequence_views_format_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_Sequence_update(bmain, scene, ptr);
+ rna_Sequence_update(bmain, scene, ptr);
}
static void do_sequence_frame_change_update(Scene *scene, Sequence *seq)
{
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq);
- Sequence *tseq;
- BKE_sequence_calc_disp(scene, seq);
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq);
+ Sequence *tseq;
+ BKE_sequence_calc_disp(scene, seq);
- /* ensure effects are always fit in length to their input */
+ /* ensure effects are always fit in length to their input */
- /* TODO(sergey): probably could be optimized.
- * in terms skipping update of non-changing strips
- */
- for (tseq = seqbase->first; tseq; tseq = tseq->next) {
- if (tseq->seq1 || tseq->seq2 || tseq->seq3) {
- BKE_sequence_calc(scene, tseq);
- }
- }
+ /* TODO(sergey): probably could be optimized.
+ * in terms skipping update of non-changing strips
+ */
+ for (tseq = seqbase->first; tseq; tseq = tseq->next) {
+ if (tseq->seq1 || tseq->seq2 || tseq->seq3) {
+ BKE_sequence_calc(scene, tseq);
+ }
+ }
- if (BKE_sequence_test_overlap(seqbase, seq)) {
- BKE_sequence_base_shuffle(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */
- }
- BKE_sequencer_sort(scene);
+ if (BKE_sequence_test_overlap(seqbase, seq)) {
+ BKE_sequence_base_shuffle(seqbase, seq, scene); /* XXX - BROKEN!, uses context seqbasep */
+ }
+ BKE_sequencer_sort(scene);
}
/* A simple wrapper around above func, directly usable as prop update func.
@@ -218,2611 +224,2758 @@ static void do_sequence_frame_change_update(Scene *scene, Sequence *seq)
*/
static void rna_Sequence_frame_change_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- do_sequence_frame_change_update(scene, (Sequence *)ptr->data);
- rna_Sequence_update(bmain, scene, ptr);
+ Scene *scene = (Scene *)ptr->id.data;
+ do_sequence_frame_change_update(scene, (Sequence *)ptr->data);
+ rna_Sequence_update(bmain, scene, ptr);
}
static void rna_Sequence_start_frame_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
- BKE_sequence_translate(scene, seq, value - seq->start);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_translate(scene, seq, value - seq->start);
+ do_sequence_frame_change_update(scene, seq);
}
static void rna_Sequence_start_frame_final_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
- BKE_sequence_tx_set_final_left(seq, value);
- BKE_sequence_single_fix(seq);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_tx_set_final_left(seq, value);
+ BKE_sequence_single_fix(seq);
+ do_sequence_frame_change_update(scene, seq);
}
static void rna_Sequence_end_frame_final_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
- BKE_sequence_tx_set_final_right(seq, value);
- BKE_sequence_single_fix(seq);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_tx_set_final_right(seq, value);
+ BKE_sequence_single_fix(seq);
+ do_sequence_frame_change_update(scene, seq);
}
static void rna_Sequence_anim_startofs_final_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
- seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs);
+ seq->anim_startofs = MIN2(value, seq->len + seq->anim_startofs);
- BKE_sequence_reload_new_file(scene, seq, false);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_reload_new_file(scene, seq, false);
+ do_sequence_frame_change_update(scene, seq);
}
static void rna_Sequence_anim_endofs_final_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
- seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs);
+ seq->anim_endofs = MIN2(value, seq->len + seq->anim_endofs);
- BKE_sequence_reload_new_file(scene, seq, false);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_reload_new_file(scene, seq, false);
+ do_sequence_frame_change_update(scene, seq);
}
static void rna_Sequence_frame_length_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
- BKE_sequence_tx_set_final_right(seq, BKE_sequence_tx_get_final_left(seq, false) + value);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_tx_set_final_right(seq, BKE_sequence_tx_get_final_left(seq, false) + value);
+ do_sequence_frame_change_update(scene, seq);
}
static int rna_Sequence_frame_length_get(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)ptr->data;
- return BKE_sequence_tx_get_final_right(seq, false) - BKE_sequence_tx_get_final_left(seq, false);
+ Sequence *seq = (Sequence *)ptr->data;
+ return BKE_sequence_tx_get_final_right(seq, false) - BKE_sequence_tx_get_final_left(seq, false);
}
static int rna_Sequence_frame_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- Sequence *seq = (Sequence *)ptr->data;
- /* Effect sequences' start frame and length must be readonly! */
- return (BKE_sequence_effect_get_num_inputs(seq->type)) ? 0 : PROP_EDITABLE;
+ Sequence *seq = (Sequence *)ptr->data;
+ /* Effect sequences' start frame and length must be readonly! */
+ return (BKE_sequence_effect_get_num_inputs(seq->type)) ? 0 : PROP_EDITABLE;
}
static void rna_Sequence_channel_set(PointerRNA *ptr, int value)
{
- Sequence *seq = (Sequence *)ptr->data;
- Scene *scene = (Scene *)ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq);
+ Sequence *seq = (Sequence *)ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ ListBase *seqbase = BKE_sequence_seqbase(&ed->seqbase, seq);
- /* check channel increment or decrement */
- const int channel_delta = (value >= seq->machine) ? 1 : -1;
- seq->machine = value;
+ /* check channel increment or decrement */
+ const int channel_delta = (value >= seq->machine) ? 1 : -1;
+ seq->machine = value;
- if (BKE_sequence_test_overlap(seqbase, seq)) {
- /* XXX - BROKEN!, uses context seqbasep */
- BKE_sequence_base_shuffle_ex(seqbase, seq, scene, channel_delta);
- }
- BKE_sequencer_sort(scene);
+ if (BKE_sequence_test_overlap(seqbase, seq)) {
+ /* XXX - BROKEN!, uses context seqbasep */
+ BKE_sequence_base_shuffle_ex(seqbase, seq, scene, channel_delta);
+ }
+ BKE_sequencer_sort(scene);
}
-static void rna_Sequence_frame_offset_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_Sequence_frame_offset_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- Sequence *seq = (Sequence *)ptr->data;
- *min = ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD) ? 0 : INT_MIN;
- *max = INT_MAX;
+ Sequence *seq = (Sequence *)ptr->data;
+ *min = ELEM(seq->type, SEQ_TYPE_SOUND_RAM, SEQ_TYPE_SOUND_HD) ? 0 : INT_MIN;
+ *max = INT_MAX;
}
static void rna_Sequence_use_proxy_set(PointerRNA *ptr, bool value)
{
- Sequence *seq = (Sequence *)ptr->data;
- BKE_sequencer_proxy_set(seq, value != 0);
+ Sequence *seq = (Sequence *)ptr->data;
+ BKE_sequencer_proxy_set(seq, value != 0);
}
static void rna_Sequence_use_translation_set(PointerRNA *ptr, bool value)
{
- Sequence *seq = (Sequence *)ptr->data;
- if (value) {
- seq->flag |= SEQ_USE_TRANSFORM;
- if (seq->strip->transform == NULL) {
- seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
- }
- }
- else {
- seq->flag &= ~SEQ_USE_TRANSFORM;
- }
+ Sequence *seq = (Sequence *)ptr->data;
+ if (value) {
+ seq->flag |= SEQ_USE_TRANSFORM;
+ if (seq->strip->transform == NULL) {
+ seq->strip->transform = MEM_callocN(sizeof(struct StripTransform), "StripTransform");
+ }
+ }
+ else {
+ seq->flag &= ~SEQ_USE_TRANSFORM;
+ }
}
static void rna_Sequence_use_crop_set(PointerRNA *ptr, bool value)
{
- Sequence *seq = (Sequence *)ptr->data;
- if (value) {
- seq->flag |= SEQ_USE_CROP;
- if (seq->strip->crop == NULL) {
- seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
- }
- }
- else {
- seq->flag &= ~SEQ_USE_CROP;
- }
+ Sequence *seq = (Sequence *)ptr->data;
+ if (value) {
+ seq->flag |= SEQ_USE_CROP;
+ if (seq->strip->crop == NULL) {
+ seq->strip->crop = MEM_callocN(sizeof(struct StripCrop), "StripCrop");
+ }
+ }
+ else {
+ seq->flag &= ~SEQ_USE_CROP;
+ }
}
static int transform_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
- SequenceSearchData *data = arg_pt;
+ SequenceSearchData *data = arg_pt;
- if (seq->strip && seq->strip->transform == data->data) {
- data->seq = seq;
- return -1; /* done so bail out */
- }
- return 1;
+ if (seq->strip && seq->strip->transform == data->data) {
+ data->seq = seq;
+ return -1; /* done so bail out */
+ }
+ return 1;
}
static Sequence *sequence_get_by_transform(Editing *ed, StripTransform *transform)
{
- SequenceSearchData data;
+ SequenceSearchData data;
- data.seq = NULL;
- data.data = transform;
+ data.seq = NULL;
+ data.data = transform;
- /* irritating we need to search for our sequence! */
- BKE_sequencer_base_recursive_apply(&ed->seqbase, transform_seq_cmp_cb, &data);
+ /* irritating we need to search for our sequence! */
+ BKE_sequencer_base_recursive_apply(&ed->seqbase, transform_seq_cmp_cb, &data);
- return data.seq;
+ return data.seq;
}
static char *rna_SequenceTransform_path(PointerRNA *ptr)
{
- Scene *scene = ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_transform(ed, ptr->data);
+ Scene *scene = ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_transform(ed, ptr->data);
- if (seq && seq->name + 2) {
- char name_esc[(sizeof(seq->name) - 2) * 2];
+ if (seq && seq->name + 2) {
+ char name_esc[(sizeof(seq->name) - 2) * 2];
- BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform", name_esc);
- }
- else {
- return BLI_strdup("");
- }
+ BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].transform", name_esc);
+ }
+ else {
+ return BLI_strdup("");
+ }
}
-static void rna_SequenceTransform_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SequenceTransform_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_transform(ed, ptr->data);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_transform(ed, ptr->data);
- BKE_sequence_invalidate_cache(scene, seq);
+ BKE_sequence_invalidate_cache(scene, seq);
}
static int crop_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
- SequenceSearchData *data = arg_pt;
+ SequenceSearchData *data = arg_pt;
- if (seq->strip && seq->strip->crop == data->data) {
- data->seq = seq;
- return -1; /* done so bail out */
- }
- return 1;
+ if (seq->strip && seq->strip->crop == data->data) {
+ data->seq = seq;
+ return -1; /* done so bail out */
+ }
+ return 1;
}
static Sequence *sequence_get_by_crop(Editing *ed, StripCrop *crop)
{
- SequenceSearchData data;
+ SequenceSearchData data;
- data.seq = NULL;
- data.data = crop;
+ data.seq = NULL;
+ data.data = crop;
- /* irritating we need to search for our sequence! */
- BKE_sequencer_base_recursive_apply(&ed->seqbase, crop_seq_cmp_cb, &data);
+ /* irritating we need to search for our sequence! */
+ BKE_sequencer_base_recursive_apply(&ed->seqbase, crop_seq_cmp_cb, &data);
- return data.seq;
+ return data.seq;
}
static char *rna_SequenceCrop_path(PointerRNA *ptr)
{
- Scene *scene = ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_crop(ed, ptr->data);
+ Scene *scene = ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_crop(ed, ptr->data);
- if (seq && seq->name + 2) {
- char name_esc[(sizeof(seq->name) - 2) * 2];
+ if (seq && seq->name + 2) {
+ char name_esc[(sizeof(seq->name) - 2) * 2];
- BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop", name_esc);
- }
- else {
- return BLI_strdup("");
- }
+ BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].crop", name_esc);
+ }
+ else {
+ return BLI_strdup("");
+ }
}
static void rna_SequenceCrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_crop(ed, ptr->data);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_crop(ed, ptr->data);
- BKE_sequence_invalidate_cache(scene, seq);
+ BKE_sequence_invalidate_cache(scene, seq);
}
static void rna_Sequence_text_font_set(PointerRNA *ptr, PointerRNA ptr_value)
{
- Sequence *seq = ptr->data;
- TextVars *data = seq->effectdata;
- VFont *value = ptr_value.data;
+ Sequence *seq = ptr->data;
+ TextVars *data = seq->effectdata;
+ VFont *value = ptr_value.data;
- BKE_sequencer_text_font_unload(data, true);
+ BKE_sequencer_text_font_unload(data, true);
- id_us_plus(&value->id);
- data->text_blf_id = SEQ_FONT_NOT_LOADED;
- data->text_font = value;
+ id_us_plus(&value->id);
+ data->text_blf_id = SEQ_FONT_NOT_LOADED;
+ data->text_font = value;
}
/* name functions that ignore the first two characters */
static void rna_Sequence_name_get(PointerRNA *ptr, char *value)
{
- Sequence *seq = (Sequence *)ptr->data;
- BLI_strncpy(value, seq->name + 2, sizeof(seq->name) - 2);
+ Sequence *seq = (Sequence *)ptr->data;
+ BLI_strncpy(value, seq->name + 2, sizeof(seq->name) - 2);
}
static int rna_Sequence_name_length(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)ptr->data;
- return strlen(seq->name + 2);
+ Sequence *seq = (Sequence *)ptr->data;
+ return strlen(seq->name + 2);
}
static void rna_Sequence_name_set(PointerRNA *ptr, const char *value)
{
- Scene *scene = (Scene *)ptr->id.data;
- Sequence *seq = (Sequence *)ptr->data;
- char oldname[sizeof(seq->name)];
- AnimData *adt;
+ Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)ptr->data;
+ char oldname[sizeof(seq->name)];
+ AnimData *adt;
- /* make a copy of the old name first */
- BLI_strncpy(oldname, seq->name + 2, sizeof(seq->name) - 2);
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, seq->name + 2, sizeof(seq->name) - 2);
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(seq->name + 2, value, sizeof(seq->name) - 2);
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(seq->name + 2, value, sizeof(seq->name) - 2);
- /* make sure the name is unique */
- BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
+ /* make sure the name is unique */
+ BKE_sequence_base_unique_name_recursive(&scene->ed->seqbase, seq);
- /* fix all the animation data which may link to this */
+ /* fix all the animation data which may link to this */
- /* don't rename everywhere because these are per scene */
- /* BKE_animdata_fix_paths_rename_all(NULL, "sequence_editor.sequences_all", oldname, seq->name + 2); */
- adt = BKE_animdata_from_id(&scene->id);
- if (adt)
- BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name + 2, 0, 0, 1);
+ /* don't rename everywhere because these are per scene */
+ /* BKE_animdata_fix_paths_rename_all(NULL, "sequence_editor.sequences_all", oldname, seq->name + 2); */
+ adt = BKE_animdata_from_id(&scene->id);
+ if (adt)
+ BKE_animdata_fix_paths_rename(
+ &scene->id, adt, NULL, "sequence_editor.sequences_all", oldname, seq->name + 2, 0, 0, 1);
}
static StructRNA *rna_Sequence_refine(struct PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)ptr->data;
-
- switch (seq->type) {
- case SEQ_TYPE_IMAGE:
- return &RNA_ImageSequence;
- case SEQ_TYPE_META:
- return &RNA_MetaSequence;
- case SEQ_TYPE_SCENE:
- return &RNA_SceneSequence;
- case SEQ_TYPE_MOVIE:
- return &RNA_MovieSequence;
- case SEQ_TYPE_MOVIECLIP:
- return &RNA_MovieClipSequence;
- case SEQ_TYPE_MASK:
- return &RNA_MaskSequence;
- case SEQ_TYPE_SOUND_RAM:
- return &RNA_SoundSequence;
- case SEQ_TYPE_CROSS:
- return &RNA_CrossSequence;
- case SEQ_TYPE_ADD:
- return &RNA_AddSequence;
- case SEQ_TYPE_SUB:
- return &RNA_SubtractSequence;
- case SEQ_TYPE_ALPHAOVER:
- return &RNA_AlphaOverSequence;
- case SEQ_TYPE_ALPHAUNDER:
- return &RNA_AlphaUnderSequence;
- case SEQ_TYPE_GAMCROSS:
- return &RNA_GammaCrossSequence;
- case SEQ_TYPE_MUL:
- return &RNA_MultiplySequence;
- case SEQ_TYPE_OVERDROP:
- return &RNA_OverDropSequence;
- case SEQ_TYPE_MULTICAM:
- return &RNA_MulticamSequence;
- case SEQ_TYPE_ADJUSTMENT:
- return &RNA_AdjustmentSequence;
- case SEQ_TYPE_WIPE:
- return &RNA_WipeSequence;
- case SEQ_TYPE_GLOW:
- return &RNA_GlowSequence;
- case SEQ_TYPE_TRANSFORM:
- return &RNA_TransformSequence;
- case SEQ_TYPE_COLOR:
- return &RNA_ColorSequence;
- case SEQ_TYPE_SPEED:
- return &RNA_SpeedControlSequence;
- case SEQ_TYPE_GAUSSIAN_BLUR:
- return &RNA_GaussianBlurSequence;
- case SEQ_TYPE_TEXT:
- return &RNA_TextSequence;
- case SEQ_TYPE_COLORMIX:
- return &RNA_ColorMixSequence;
- default:
- return &RNA_Sequence;
- }
+ Sequence *seq = (Sequence *)ptr->data;
+
+ switch (seq->type) {
+ case SEQ_TYPE_IMAGE:
+ return &RNA_ImageSequence;
+ case SEQ_TYPE_META:
+ return &RNA_MetaSequence;
+ case SEQ_TYPE_SCENE:
+ return &RNA_SceneSequence;
+ case SEQ_TYPE_MOVIE:
+ return &RNA_MovieSequence;
+ case SEQ_TYPE_MOVIECLIP:
+ return &RNA_MovieClipSequence;
+ case SEQ_TYPE_MASK:
+ return &RNA_MaskSequence;
+ case SEQ_TYPE_SOUND_RAM:
+ return &RNA_SoundSequence;
+ case SEQ_TYPE_CROSS:
+ return &RNA_CrossSequence;
+ case SEQ_TYPE_ADD:
+ return &RNA_AddSequence;
+ case SEQ_TYPE_SUB:
+ return &RNA_SubtractSequence;
+ case SEQ_TYPE_ALPHAOVER:
+ return &RNA_AlphaOverSequence;
+ case SEQ_TYPE_ALPHAUNDER:
+ return &RNA_AlphaUnderSequence;
+ case SEQ_TYPE_GAMCROSS:
+ return &RNA_GammaCrossSequence;
+ case SEQ_TYPE_MUL:
+ return &RNA_MultiplySequence;
+ case SEQ_TYPE_OVERDROP:
+ return &RNA_OverDropSequence;
+ case SEQ_TYPE_MULTICAM:
+ return &RNA_MulticamSequence;
+ case SEQ_TYPE_ADJUSTMENT:
+ return &RNA_AdjustmentSequence;
+ case SEQ_TYPE_WIPE:
+ return &RNA_WipeSequence;
+ case SEQ_TYPE_GLOW:
+ return &RNA_GlowSequence;
+ case SEQ_TYPE_TRANSFORM:
+ return &RNA_TransformSequence;
+ case SEQ_TYPE_COLOR:
+ return &RNA_ColorSequence;
+ case SEQ_TYPE_SPEED:
+ return &RNA_SpeedControlSequence;
+ case SEQ_TYPE_GAUSSIAN_BLUR:
+ return &RNA_GaussianBlurSequence;
+ case SEQ_TYPE_TEXT:
+ return &RNA_TextSequence;
+ case SEQ_TYPE_COLORMIX:
+ return &RNA_ColorMixSequence;
+ default:
+ return &RNA_Sequence;
+ }
}
static char *rna_Sequence_path(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)ptr->data;
+ Sequence *seq = (Sequence *)ptr->data;
- /* sequencer data comes from scene...
- * TODO: would be nice to make SequenceEditor data a data-block of its own (for shorter paths)
- */
- if (seq->name + 2) {
- char name_esc[(sizeof(seq->name) - 2) * 2];
+ /* sequencer data comes from scene...
+ * TODO: would be nice to make SequenceEditor data a data-block of its own (for shorter paths)
+ */
+ if (seq->name + 2) {
+ char name_esc[(sizeof(seq->name) - 2) * 2];
- BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"]", name_esc);
- }
- else {
- return BLI_strdup("");
- }
+ BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"]", name_esc);
+ }
+ else {
+ return BLI_strdup("");
+ }
}
static IDProperty *rna_Sequence_idprops(PointerRNA *ptr, bool create)
{
- Sequence *seq = ptr->data;
+ Sequence *seq = ptr->data;
- if (create && !seq->prop) {
- IDPropertyTemplate val = {0};
- seq->prop = IDP_New(IDP_GROUP, &val, "Sequence ID properties");
- }
+ if (create && !seq->prop) {
+ IDPropertyTemplate val = {0};
+ seq->prop = IDP_New(IDP_GROUP, &val, "Sequence ID properties");
+ }
- return seq->prop;
+ return seq->prop;
}
static PointerRNA rna_MovieSequence_metadata_get(Sequence *seq)
{
- if (seq == NULL || seq->anims.first == NULL) {
- return PointerRNA_NULL;
- }
+ if (seq == NULL || seq->anims.first == NULL) {
+ return PointerRNA_NULL;
+ }
- StripAnim *sanim = seq->anims.first;
- if (sanim->anim == NULL) {
- return PointerRNA_NULL;
- }
+ StripAnim *sanim = seq->anims.first;
+ if (sanim->anim == NULL) {
+ return PointerRNA_NULL;
+ }
- IDProperty *metadata = IMB_anim_load_metadata(sanim->anim);
- if (metadata == NULL) {
- return PointerRNA_NULL;
- }
+ IDProperty *metadata = IMB_anim_load_metadata(sanim->anim);
+ if (metadata == NULL) {
+ return PointerRNA_NULL;
+ }
- PointerRNA ptr;
- RNA_pointer_create(NULL, &RNA_IDPropertyWrapPtr, metadata, &ptr);
- return ptr;
+ PointerRNA ptr;
+ RNA_pointer_create(NULL, &RNA_IDPropertyWrapPtr, metadata, &ptr);
+ return ptr;
}
static PointerRNA rna_SequenceEditor_meta_stack_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- MetaStack *ms = (MetaStack *)internal->link;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ MetaStack *ms = (MetaStack *)internal->link;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq);
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Sequence, ms->parseq);
}
/* TODO, expose seq path setting as a higher level sequencer BKE function */
static void rna_Sequence_filepath_set(PointerRNA *ptr, const char *value)
{
- Sequence *seq = (Sequence *)(ptr->data);
- BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
- sizeof(seq->strip->stripdata->name));
+ Sequence *seq = (Sequence *)(ptr->data);
+ BLI_split_dirfile(value,
+ seq->strip->dir,
+ seq->strip->stripdata->name,
+ sizeof(seq->strip->dir),
+ sizeof(seq->strip->stripdata->name));
}
static void rna_Sequence_filepath_get(PointerRNA *ptr, char *value)
{
- Sequence *seq = (Sequence *)(ptr->data);
+ Sequence *seq = (Sequence *)(ptr->data);
- BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_join_dirfile(value, FILE_MAX, seq->strip->dir, seq->strip->stripdata->name);
}
static int rna_Sequence_filepath_length(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)(ptr->data);
- char path[FILE_MAX];
+ Sequence *seq = (Sequence *)(ptr->data);
+ char path[FILE_MAX];
- BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name);
- return strlen(path);
+ BLI_join_dirfile(path, sizeof(path), seq->strip->dir, seq->strip->stripdata->name);
+ return strlen(path);
}
static void rna_Sequence_proxy_filepath_set(PointerRNA *ptr, const char *value)
{
- StripProxy *proxy = (StripProxy *)(ptr->data);
- BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file));
- if (proxy->anim) {
- IMB_free_anim(proxy->anim);
- proxy->anim = NULL;
- }
+ StripProxy *proxy = (StripProxy *)(ptr->data);
+ BLI_split_dirfile(value, proxy->dir, proxy->file, sizeof(proxy->dir), sizeof(proxy->file));
+ if (proxy->anim) {
+ IMB_free_anim(proxy->anim);
+ proxy->anim = NULL;
+ }
}
static void rna_Sequence_proxy_filepath_get(PointerRNA *ptr, char *value)
{
- StripProxy *proxy = (StripProxy *)(ptr->data);
+ StripProxy *proxy = (StripProxy *)(ptr->data);
- BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file);
+ BLI_join_dirfile(value, FILE_MAX, proxy->dir, proxy->file);
}
static int rna_Sequence_proxy_filepath_length(PointerRNA *ptr)
{
- StripProxy *proxy = (StripProxy *)(ptr->data);
- char path[FILE_MAX];
+ StripProxy *proxy = (StripProxy *)(ptr->data);
+ char path[FILE_MAX];
- BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file);
- return strlen(path);
+ BLI_join_dirfile(path, sizeof(path), proxy->dir, proxy->file);
+ return strlen(path);
}
static void rna_Sequence_volume_set(PointerRNA *ptr, float value)
{
- Sequence *seq = (Sequence *)(ptr->data);
+ Sequence *seq = (Sequence *)(ptr->data);
- seq->volume = value;
- if (seq->scene_sound)
- BKE_sound_set_scene_sound_volume(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
+ seq->volume = value;
+ if (seq->scene_sound)
+ BKE_sound_set_scene_sound_volume(
+ seq->scene_sound, value, (seq->flag & SEQ_AUDIO_VOLUME_ANIMATED) != 0);
}
static void rna_Sequence_pitch_set(PointerRNA *ptr, float value)
{
- Sequence *seq = (Sequence *)(ptr->data);
+ Sequence *seq = (Sequence *)(ptr->data);
- seq->pitch = value;
- if (seq->scene_sound)
- BKE_sound_set_scene_sound_pitch(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
+ seq->pitch = value;
+ if (seq->scene_sound)
+ BKE_sound_set_scene_sound_pitch(
+ seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PITCH_ANIMATED) != 0);
}
static void rna_Sequence_pan_set(PointerRNA *ptr, float value)
{
- Sequence *seq = (Sequence *)(ptr->data);
+ Sequence *seq = (Sequence *)(ptr->data);
- seq->pan = value;
- if (seq->scene_sound)
- BKE_sound_set_scene_sound_pan(seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
+ seq->pan = value;
+ if (seq->scene_sound)
+ BKE_sound_set_scene_sound_pan(
+ seq->scene_sound, value, (seq->flag & SEQ_AUDIO_PAN_ANIMATED) != 0);
}
-
static int rna_Sequence_input_count_get(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)(ptr->data);
+ Sequence *seq = (Sequence *)(ptr->data);
- return BKE_sequence_effect_get_num_inputs(seq->type);
+ return BKE_sequence_effect_get_num_inputs(seq->type);
}
-#if 0
+# if 0
static void rna_SoundSequence_filename_set(PointerRNA *ptr, const char *value)
{
- Sequence *seq = (Sequence *)(ptr->data);
- BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
- sizeof(seq->strip->stripdata->name));
+ Sequence *seq = (Sequence *)(ptr->data);
+ BLI_split_dirfile(value, seq->strip->dir, seq->strip->stripdata->name, sizeof(seq->strip->dir),
+ sizeof(seq->strip->stripdata->name));
}
static void rna_SequenceElement_filename_set(PointerRNA *ptr, const char *value)
{
- StripElem *elem = (StripElem *)(ptr->data);
- BLI_split_file_part(value, elem->name, sizeof(elem->name));
+ StripElem *elem = (StripElem *)(ptr->data);
+ BLI_split_file_part(value, elem->name, sizeof(elem->name));
}
-#endif
+# endif
-static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Sequence_update_reopen_files(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
+ BKE_sequencer_free_imbuf(scene, &ed->seqbase, false);
- if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
- BKE_sequencer_update_sound_bounds(scene, ptr->data);
+ if (RNA_struct_is_a(ptr->type, &RNA_SoundSequence))
+ BKE_sequencer_update_sound_bounds(scene, ptr->data);
}
static void rna_Sequence_mute_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- BKE_sequencer_update_muting(ed);
- rna_Sequence_update(bmain, scene, ptr);
+ BKE_sequencer_update_muting(ed);
+ rna_Sequence_update(bmain, scene, ptr);
}
static void rna_Sequence_filepath_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Sequence *seq = (Sequence *)(ptr->data);
- BKE_sequence_reload_new_file(scene, seq, true);
- BKE_sequence_calc(scene, seq);
- rna_Sequence_update(bmain, scene, ptr);
+ Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)(ptr->data);
+ BKE_sequence_reload_new_file(scene, seq, true);
+ BKE_sequence_calc(scene, seq);
+ rna_Sequence_update(bmain, scene, ptr);
}
static void rna_Sequence_sound_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Sequence *seq = (Sequence *) ptr->data;
- if (seq->sound != NULL) {
- BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
- }
- rna_Sequence_update(bmain, scene, ptr);
+ Sequence *seq = (Sequence *)ptr->data;
+ if (seq->sound != NULL) {
+ BKE_sound_update_scene_sound(seq->scene_sound, seq->sound);
+ }
+ rna_Sequence_update(bmain, scene, ptr);
}
static int seqproxy_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
- SequenceSearchData *data = arg_pt;
+ SequenceSearchData *data = arg_pt;
- if (seq->strip && seq->strip->proxy == data->data) {
- data->seq = seq;
- return -1; /* done so bail out */
- }
- return 1;
+ if (seq->strip && seq->strip->proxy == data->data) {
+ data->seq = seq;
+ return -1; /* done so bail out */
+ }
+ return 1;
}
static Sequence *sequence_get_by_proxy(Editing *ed, StripProxy *proxy)
{
- SequenceSearchData data;
+ SequenceSearchData data;
- data.seq = NULL;
- data.data = proxy;
+ data.seq = NULL;
+ data.data = proxy;
- BKE_sequencer_base_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_cb, &data);
- return data.seq;
+ BKE_sequencer_base_recursive_apply(&ed->seqbase, seqproxy_seq_cmp_cb, &data);
+ return data.seq;
}
static void rna_Sequence_tcindex_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
- BKE_sequence_reload_new_file(scene, seq, false);
- do_sequence_frame_change_update(scene, seq);
+ BKE_sequence_reload_new_file(scene, seq, false);
+ do_sequence_frame_change_update(scene, seq);
}
static void rna_SequenceProxy_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_proxy(ed, ptr->data);
- BKE_sequence_invalidate_cache(scene, seq);
+ BKE_sequence_invalidate_cache(scene, seq);
}
/* do_versions? */
static float rna_Sequence_opacity_get(PointerRNA *ptr)
{
- Sequence *seq = (Sequence *)(ptr->data);
- return seq->blend_opacity / 100.0f;
+ Sequence *seq = (Sequence *)(ptr->data);
+ return seq->blend_opacity / 100.0f;
}
static void rna_Sequence_opacity_set(PointerRNA *ptr, float value)
{
- Sequence *seq = (Sequence *)(ptr->data);
- CLAMP(value, 0.0f, 1.0f);
- seq->blend_opacity = value * 100.0f;
+ Sequence *seq = (Sequence *)(ptr->data);
+ CLAMP(value, 0.0f, 1.0f);
+ seq->blend_opacity = value * 100.0f;
}
static int colbalance_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
- SequenceSearchData *data = arg_pt;
+ SequenceSearchData *data = arg_pt;
- if (seq->modifiers.first) {
- SequenceModifierData *smd = seq->modifiers.first;
+ if (seq->modifiers.first) {
+ SequenceModifierData *smd = seq->modifiers.first;
- for (smd = seq->modifiers.first; smd; smd = smd->next) {
- if (smd->type == seqModifierType_ColorBalance) {
- ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *) smd;
+ for (smd = seq->modifiers.first; smd; smd = smd->next) {
+ if (smd->type == seqModifierType_ColorBalance) {
+ ColorBalanceModifierData *cbmd = (ColorBalanceModifierData *)smd;
- if (&cbmd->color_balance == data->data) {
- data->seq = seq;
- data->smd = smd;
- return -1; /* done so bail out */
- }
- }
- }
- }
+ if (&cbmd->color_balance == data->data) {
+ data->seq = seq;
+ data->smd = smd;
+ return -1; /* done so bail out */
+ }
+ }
+ }
+ }
- return 1;
+ return 1;
}
-static Sequence *sequence_get_by_colorbalance(Editing *ed, StripColorBalance *cb, SequenceModifierData **r_smd)
+static Sequence *sequence_get_by_colorbalance(Editing *ed,
+ StripColorBalance *cb,
+ SequenceModifierData **r_smd)
{
- SequenceSearchData data;
+ SequenceSearchData data;
- data.seq = NULL;
- data.smd = NULL;
- data.data = cb;
+ data.seq = NULL;
+ data.smd = NULL;
+ data.data = cb;
- /* irritating we need to search for our sequence! */
- BKE_sequencer_base_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
+ /* irritating we need to search for our sequence! */
+ BKE_sequencer_base_recursive_apply(&ed->seqbase, colbalance_seq_cmp_cb, &data);
- *r_smd = data.smd;
+ *r_smd = data.smd;
- return data.seq;
+ return data.seq;
}
static char *rna_SequenceColorBalance_path(PointerRNA *ptr)
{
- Scene *scene = ptr->id.data;
- SequenceModifierData *smd;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
+ Scene *scene = ptr->id.data;
+ SequenceModifierData *smd;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
- if (seq && seq->name + 2) {
- char name_esc[(sizeof(seq->name) - 2) * 2];
+ if (seq && seq->name + 2) {
+ char name_esc[(sizeof(seq->name) - 2) * 2];
- BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
+ BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
- if (!smd) {
- /* path to old filter color balance */
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", name_esc);
- }
- else {
- /* path to modifier */
- char name_esc_smd[sizeof(smd->name) * 2];
+ if (!smd) {
+ /* path to old filter color balance */
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].color_balance", name_esc);
+ }
+ else {
+ /* path to modifier */
+ char name_esc_smd[sizeof(smd->name) * 2];
- BLI_strescape(name_esc_smd, smd->name, sizeof(name_esc_smd));
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"].color_balance",
- name_esc, name_esc_smd);
- }
- }
- else
- return BLI_strdup("");
+ BLI_strescape(name_esc_smd, smd->name, sizeof(name_esc_smd));
+ return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"].color_balance",
+ name_esc,
+ name_esc_smd);
+ }
+ }
+ else
+ return BLI_strdup("");
}
-static void rna_SequenceColorBalance_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SequenceColorBalance_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- SequenceModifierData *smd;
- Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ SequenceModifierData *smd;
+ Sequence *seq = sequence_get_by_colorbalance(ed, ptr->data, &smd);
- if (smd == NULL)
- BKE_sequence_invalidate_cache(scene, seq);
- else
- BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+ if (smd == NULL)
+ BKE_sequence_invalidate_cache(scene, seq);
+ else
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
}
static void rna_SequenceEditor_overlay_lock_set(PointerRNA *ptr, bool value)
{
- Scene *scene = ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- if (ed == NULL)
- return;
+ if (ed == NULL)
+ return;
- /* convert from abs to relative and back */
- if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) == 0 && value) {
- ed->over_cfra = scene->r.cfra + ed->over_ofs;
- ed->over_flag |= SEQ_EDIT_OVERLAY_ABS;
- }
- else if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
- ed->over_ofs = ed->over_cfra - scene->r.cfra;
- ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS;
- }
+ /* convert from abs to relative and back */
+ if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) == 0 && value) {
+ ed->over_cfra = scene->r.cfra + ed->over_ofs;
+ ed->over_flag |= SEQ_EDIT_OVERLAY_ABS;
+ }
+ else if ((ed->over_flag & SEQ_EDIT_OVERLAY_ABS) && !value) {
+ ed->over_ofs = ed->over_cfra - scene->r.cfra;
+ ed->over_flag &= ~SEQ_EDIT_OVERLAY_ABS;
+ }
}
static int rna_SequenceEditor_overlay_frame_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
-
- if (ed == NULL)
- return scene->r.cfra;
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
- return ed->over_cfra - scene->r.cfra;
- else
- return ed->over_ofs;
+ if (ed == NULL)
+ return scene->r.cfra;
+ if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
+ return ed->over_cfra - scene->r.cfra;
+ else
+ return ed->over_ofs;
}
static void rna_SequenceEditor_overlay_frame_set(PointerRNA *ptr, int value)
{
- Scene *scene = (Scene *)ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
- if (ed == NULL)
- return;
+ if (ed == NULL)
+ return;
-
- if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
- ed->over_cfra = (scene->r.cfra + value);
- else
- ed->over_ofs = value;
+ if (ed->over_flag & SEQ_EDIT_OVERLAY_ABS)
+ ed->over_cfra = (scene->r.cfra + value);
+ else
+ ed->over_ofs = value;
}
static int modifier_seq_cmp_cb(Sequence *seq, void *arg_pt)
{
- SequenceSearchData *data = arg_pt;
+ SequenceSearchData *data = arg_pt;
- if (BLI_findindex(&seq->modifiers, data->data) != -1) {
- data->seq = seq;
- return -1; /* done so bail out */
- }
+ if (BLI_findindex(&seq->modifiers, data->data) != -1) {
+ data->seq = seq;
+ return -1; /* done so bail out */
+ }
- return 1;
+ return 1;
}
static Sequence *sequence_get_by_modifier(Editing *ed, SequenceModifierData *smd)
{
- SequenceSearchData data;
+ SequenceSearchData data;
- data.seq = NULL;
- data.data = smd;
+ data.seq = NULL;
+ data.data = smd;
- /* irritating we need to search for our sequence! */
- BKE_sequencer_base_recursive_apply(&ed->seqbase, modifier_seq_cmp_cb, &data);
+ /* irritating we need to search for our sequence! */
+ BKE_sequencer_base_recursive_apply(&ed->seqbase, modifier_seq_cmp_cb, &data);
- return data.seq;
+ return data.seq;
}
static StructRNA *rna_SequenceModifier_refine(struct PointerRNA *ptr)
{
- SequenceModifierData *smd = (SequenceModifierData *) ptr->data;
-
- switch (smd->type) {
- case seqModifierType_ColorBalance:
- return &RNA_ColorBalanceModifier;
- case seqModifierType_Curves:
- return &RNA_CurvesModifier;
- case seqModifierType_HueCorrect:
- return &RNA_HueCorrectModifier;
- case seqModifierType_BrightContrast:
- return &RNA_BrightContrastModifier;
- case seqModifierType_WhiteBalance:
- return &RNA_WhiteBalanceModifier;
- case seqModifierType_Tonemap:
- return &RNA_SequencerTonemapModifierData;
- default:
- return &RNA_SequenceModifier;
- }
+ SequenceModifierData *smd = (SequenceModifierData *)ptr->data;
+
+ switch (smd->type) {
+ case seqModifierType_ColorBalance:
+ return &RNA_ColorBalanceModifier;
+ case seqModifierType_Curves:
+ return &RNA_CurvesModifier;
+ case seqModifierType_HueCorrect:
+ return &RNA_HueCorrectModifier;
+ case seqModifierType_BrightContrast:
+ return &RNA_BrightContrastModifier;
+ case seqModifierType_WhiteBalance:
+ return &RNA_WhiteBalanceModifier;
+ case seqModifierType_Tonemap:
+ return &RNA_SequencerTonemapModifierData;
+ default:
+ return &RNA_SequenceModifier;
+ }
}
static char *rna_SequenceModifier_path(PointerRNA *ptr)
{
- Scene *scene = ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- SequenceModifierData *smd = ptr->data;
- Sequence *seq = sequence_get_by_modifier(ed, smd);
+ Scene *scene = ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ SequenceModifierData *smd = ptr->data;
+ Sequence *seq = sequence_get_by_modifier(ed, smd);
- if (seq && seq->name + 2) {
- char name_esc[(sizeof(seq->name) - 2) * 2];
- char name_esc_smd[sizeof(smd->name) * 2];
+ if (seq && seq->name + 2) {
+ char name_esc[(sizeof(seq->name) - 2) * 2];
+ char name_esc_smd[sizeof(smd->name) * 2];
- BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
- BLI_strescape(name_esc_smd, smd->name, sizeof(name_esc_smd));
- return BLI_sprintfN("sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"]",
- name_esc, name_esc_smd);
- }
- else {
- return BLI_strdup("");
- }
+ BLI_strescape(name_esc, seq->name + 2, sizeof(name_esc));
+ BLI_strescape(name_esc_smd, smd->name, sizeof(name_esc_smd));
+ return BLI_sprintfN(
+ "sequence_editor.sequences_all[\"%s\"].modifiers[\"%s\"]", name_esc, name_esc_smd);
+ }
+ else {
+ return BLI_strdup("");
+ }
}
static void rna_SequenceModifier_name_set(PointerRNA *ptr, const char *value)
{
- SequenceModifierData *smd = ptr->data;
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_modifier(ed, smd);
- AnimData *adt;
- char oldname[sizeof(smd->name)];
+ SequenceModifierData *smd = ptr->data;
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_modifier(ed, smd);
+ AnimData *adt;
+ char oldname[sizeof(smd->name)];
- /* make a copy of the old name first */
- BLI_strncpy(oldname, smd->name, sizeof(smd->name));
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, smd->name, sizeof(smd->name));
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(smd->name, value, sizeof(smd->name));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(smd->name, value, sizeof(smd->name));
- /* make sure the name is truly unique */
- BKE_sequence_modifier_unique_name(seq, smd);
+ /* make sure the name is truly unique */
+ BKE_sequence_modifier_unique_name(seq, smd);
- /* fix all the animation data which may link to this */
- adt = BKE_animdata_from_id(&scene->id);
- if (adt) {
- char path[1024];
+ /* fix all the animation data which may link to this */
+ adt = BKE_animdata_from_id(&scene->id);
+ if (adt) {
+ char path[1024];
- BLI_snprintf(path, sizeof(path), "sequence_editor.sequences_all[\"%s\"].modifiers", seq->name + 2);
- BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, path, oldname, smd->name, 0, 0, 1);
- }
+ BLI_snprintf(
+ path, sizeof(path), "sequence_editor.sequences_all[\"%s\"].modifiers", seq->name + 2);
+ BKE_animdata_fix_paths_rename(&scene->id, adt, NULL, path, oldname, smd->name, 0, 0, 1);
+ }
}
static void rna_SequenceModifier_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- /* strip from other scenes could be modified, so using active scene is not reliable */
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
+ /* strip from other scenes could be modified, so using active scene is not reliable */
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
- BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
}
static bool rna_SequenceModifier_otherSequence_poll(PointerRNA *ptr, PointerRNA value)
{
- Scene *scene = (Scene *) ptr->id.data;
- Editing *ed = BKE_sequencer_editing_get(scene, false);
- Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
- Sequence *cur = (Sequence *) value.data;
+ Scene *scene = (Scene *)ptr->id.data;
+ Editing *ed = BKE_sequencer_editing_get(scene, false);
+ Sequence *seq = sequence_get_by_modifier(ed, ptr->data);
+ Sequence *cur = (Sequence *)value.data;
- if ((seq == cur) || (cur->type == SEQ_TYPE_SOUND_RAM)) {
- return false;
- }
+ if ((seq == cur) || (cur->type == SEQ_TYPE_SOUND_RAM)) {
+ return false;
+ }
- return true;
+ return true;
}
-static SequenceModifierData *rna_Sequence_modifier_new(Sequence *seq, bContext *C, ReportList *reports, const char *name, int type)
+static SequenceModifierData *rna_Sequence_modifier_new(
+ Sequence *seq, bContext *C, ReportList *reports, const char *name, int type)
{
- if (!BKE_sequence_supports_modifiers(seq)) {
- BKE_report(reports, RPT_ERROR, "Sequence type does not support modifiers");
+ if (!BKE_sequence_supports_modifiers(seq)) {
+ BKE_report(reports, RPT_ERROR, "Sequence type does not support modifiers");
- return NULL;
- }
- else {
- Scene *scene = CTX_data_scene(C);
- SequenceModifierData *smd;
+ return NULL;
+ }
+ else {
+ Scene *scene = CTX_data_scene(C);
+ SequenceModifierData *smd;
- smd = BKE_sequence_modifier_new(seq, name, type);
+ smd = BKE_sequence_modifier_new(seq, name, type);
- BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
- return smd;
- }
+ return smd;
+ }
}
-static void rna_Sequence_modifier_remove(Sequence *seq, bContext *C, ReportList *reports, PointerRNA *smd_ptr)
+static void rna_Sequence_modifier_remove(Sequence *seq,
+ bContext *C,
+ ReportList *reports,
+ PointerRNA *smd_ptr)
{
- SequenceModifierData *smd = smd_ptr->data;
- Scene *scene = CTX_data_scene(C);
+ SequenceModifierData *smd = smd_ptr->data;
+ Scene *scene = CTX_data_scene(C);
- if (BKE_sequence_modifier_remove(seq, smd) == false) {
- BKE_report(reports, RPT_ERROR, "Modifier was not found in the stack");
- return;
- }
+ if (BKE_sequence_modifier_remove(seq, smd) == false) {
+ BKE_report(reports, RPT_ERROR, "Modifier was not found in the stack");
+ return;
+ }
- RNA_POINTER_INVALIDATE(smd_ptr);
- BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+ RNA_POINTER_INVALIDATE(smd_ptr);
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
}
static void rna_Sequence_modifier_clear(Sequence *seq, bContext *C)
{
- Scene *scene = CTX_data_scene(C);
+ Scene *scene = CTX_data_scene(C);
- BKE_sequence_modifier_clear(seq);
+ BKE_sequence_modifier_clear(seq);
- BKE_sequence_invalidate_cache_for_modifier(scene, seq);
+ BKE_sequence_invalidate_cache_for_modifier(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, NULL);
}
static float rna_Sequence_fps_get(PointerRNA *ptr)
{
- Scene *scene = (Scene *)ptr->id.data;
- Sequence *seq = (Sequence *)(ptr->data);
- return BKE_sequence_get_fps(scene, seq);
+ Scene *scene = (Scene *)ptr->id.data;
+ Sequence *seq = (Sequence *)(ptr->data);
+ return BKE_sequence_get_fps(scene, seq);
}
#else
static void rna_def_strip_element(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SequenceElement", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Element", "Sequence strip data for a single frame");
- RNA_def_struct_sdna(srna, "StripElem");
+ srna = RNA_def_struct(brna, "SequenceElement", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence Element", "Sequence strip data for a single frame");
+ RNA_def_struct_sdna(srna, "StripElem");
- prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "Filename", "Name of the source file");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceElement_update");
+ prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "Filename", "Name of the source file");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceElement_update");
- prop = RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "orig_width");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
+ prop = RNA_def_property(srna, "orig_width", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "orig_width");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Orig Width", "Original image width");
- prop = RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "orig_height");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
+ prop = RNA_def_property(srna, "orig_height", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "orig_height");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Orig Height", "Original image height");
}
static void rna_def_strip_crop(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SequenceCrop", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Crop", "Cropping parameters for a sequence strip");
- RNA_def_struct_sdna(srna, "StripCrop");
+ srna = RNA_def_struct(brna, "SequenceCrop", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence Crop", "Cropping parameters for a sequence strip");
+ RNA_def_struct_sdna(srna, "StripCrop");
- prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "top");
- RNA_def_property_ui_text(prop, "Top", "Number of pixels to crop from the top");
- RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
+ prop = RNA_def_property(srna, "max_y", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "top");
+ RNA_def_property_ui_text(prop, "Top", "Number of pixels to crop from the top");
+ RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
- prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "bottom");
- RNA_def_property_ui_text(prop, "Bottom", "Number of pixels to crop from the bottom");
- RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
+ prop = RNA_def_property(srna, "min_y", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "bottom");
+ RNA_def_property_ui_text(prop, "Bottom", "Number of pixels to crop from the bottom");
+ RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
- prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "left");
- RNA_def_property_ui_text(prop, "Left", "Number of pixels to crop from the left side");
- RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
+ prop = RNA_def_property(srna, "min_x", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "left");
+ RNA_def_property_ui_text(prop, "Left", "Number of pixels to crop from the left side");
+ RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
- prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "right");
- RNA_def_property_ui_text(prop, "Right", "Number of pixels to crop from the right side");
- RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
+ prop = RNA_def_property(srna, "max_x", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "right");
+ RNA_def_property_ui_text(prop, "Right", "Number of pixels to crop from the right side");
+ RNA_def_property_ui_range(prop, 0, 4096, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceCrop_update");
- RNA_def_struct_path_func(srna, "rna_SequenceCrop_path");
+ RNA_def_struct_path_func(srna, "rna_SequenceCrop_path");
}
static void rna_def_strip_transform(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SequenceTransform", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip");
- RNA_def_struct_sdna(srna, "StripTransform");
+ StructRNA *srna;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "xofs");
- RNA_def_property_ui_text(prop, "Offset X", "Amount to move the input on the X axis within its boundaries");
- RNA_def_property_ui_range(prop, -4096, 4096, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
+ srna = RNA_def_struct(brna, "SequenceTransform", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence Transform", "Transform parameters for a sequence strip");
+ RNA_def_struct_sdna(srna, "StripTransform");
- prop = RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "yofs");
- RNA_def_property_ui_text(prop, "Offset Y", "Amount to move the input on the Y axis within its boundaries");
- RNA_def_property_ui_range(prop, -4096, 4096, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
+ prop = RNA_def_property(srna, "offset_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "xofs");
+ RNA_def_property_ui_text(
+ prop, "Offset X", "Amount to move the input on the X axis within its boundaries");
+ RNA_def_property_ui_range(prop, -4096, 4096, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
- RNA_def_struct_path_func(srna, "rna_SequenceTransform_path");
+ prop = RNA_def_property(srna, "offset_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "yofs");
+ RNA_def_property_ui_text(
+ prop, "Offset Y", "Amount to move the input on the Y axis within its boundaries");
+ RNA_def_property_ui_range(prop, -4096, 4096, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceTransform_update");
+ RNA_def_struct_path_func(srna, "rna_SequenceTransform_path");
}
static void rna_def_strip_proxy(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem seq_tc_items[] = {
- {SEQ_PROXY_TC_NONE, "NONE", 0, "No TC in use", ""},
- {SEQ_PROXY_TC_RECORD_RUN, "RECORD_RUN", 0, "Record Run",
- "Use images in the order as they are recorded"},
- {SEQ_PROXY_TC_FREE_RUN, "FREE_RUN", 0, "Free Run",
- "Use global timestamp written by recording device"},
- {SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN, "FREE_RUN_REC_DATE", 0, "Free Run (rec date)",
- "Interpolate a global timestamp using the "
- "record date and time written by recording device"},
- {SEQ_PROXY_TC_RECORD_RUN_NO_GAPS, "RECORD_RUN_NO_GAPS", 0, "Record Run No Gaps",
- "Like record run, but ignore timecode, "
- "changes in framerate or dropouts"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SequenceProxy", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Proxy", "Proxy parameters for a sequence strip");
- RNA_def_struct_sdna(srna, "StripProxy");
-
- prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "dir");
- RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceProxy_update");
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file");
- RNA_def_property_string_funcs(prop, "rna_Sequence_proxy_filepath_get", "rna_Sequence_proxy_filepath_length",
- "rna_Sequence_proxy_filepath_set");
-
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceProxy_update");
-
- prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "build_flags", SEQ_PROXY_SKIP_EXISTING);
- RNA_def_property_ui_text(prop, "Overwrite", "Overwrite existing proxy files when building");
-
- prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_25);
- RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution");
-
- prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_50);
- RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution");
-
- prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_75);
- RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution");
-
- prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_100);
- RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution");
-
- prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_RECORD_RUN);
- RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
-
- prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_FREE_RUN);
- RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
-
- prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN);
- RNA_def_property_ui_text(prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
-
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "quality");
- RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build");
- RNA_def_property_ui_range(prop, 1, 100, 1, -1);
-
- prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tc");
- RNA_def_property_enum_items(prop, seq_tc_items);
- RNA_def_property_ui_text(prop, "Timecode", "Method for reading the inputs timecode");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_tcindex_update");
-
- prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_DIR);
- RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_FILE);
- RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem seq_tc_items[] = {
+ {SEQ_PROXY_TC_NONE, "NONE", 0, "No TC in use", ""},
+ {SEQ_PROXY_TC_RECORD_RUN,
+ "RECORD_RUN",
+ 0,
+ "Record Run",
+ "Use images in the order as they are recorded"},
+ {SEQ_PROXY_TC_FREE_RUN,
+ "FREE_RUN",
+ 0,
+ "Free Run",
+ "Use global timestamp written by recording device"},
+ {SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN,
+ "FREE_RUN_REC_DATE",
+ 0,
+ "Free Run (rec date)",
+ "Interpolate a global timestamp using the "
+ "record date and time written by recording device"},
+ {SEQ_PROXY_TC_RECORD_RUN_NO_GAPS,
+ "RECORD_RUN_NO_GAPS",
+ 0,
+ "Record Run No Gaps",
+ "Like record run, but ignore timecode, "
+ "changes in framerate or dropouts"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SequenceProxy", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence Proxy", "Proxy parameters for a sequence strip");
+ RNA_def_struct_sdna(srna, "StripProxy");
+
+ prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "dir");
+ RNA_def_property_ui_text(prop, "Directory", "Location to store the proxy files");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceProxy_update");
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "Path", "Location of custom proxy file");
+ RNA_def_property_string_funcs(prop,
+ "rna_Sequence_proxy_filepath_get",
+ "rna_Sequence_proxy_filepath_length",
+ "rna_Sequence_proxy_filepath_set");
+
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceProxy_update");
+
+ prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "build_flags", SEQ_PROXY_SKIP_EXISTING);
+ RNA_def_property_ui_text(prop, "Overwrite", "Overwrite existing proxy files when building");
+
+ prop = RNA_def_property(srna, "build_25", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_25);
+ RNA_def_property_ui_text(prop, "25%", "Build 25% proxy resolution");
+
+ prop = RNA_def_property(srna, "build_50", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_50);
+ RNA_def_property_ui_text(prop, "50%", "Build 50% proxy resolution");
+
+ prop = RNA_def_property(srna, "build_75", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_75);
+ RNA_def_property_ui_text(prop, "75%", "Build 75% proxy resolution");
+
+ prop = RNA_def_property(srna, "build_100", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_size_flags", SEQ_PROXY_IMAGE_SIZE_100);
+ RNA_def_property_ui_text(prop, "100%", "Build 100% proxy resolution");
+
+ prop = RNA_def_property(srna, "build_record_run", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_RECORD_RUN);
+ RNA_def_property_ui_text(prop, "Rec Run", "Build record run time code index");
+
+ prop = RNA_def_property(srna, "build_free_run", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "build_tc_flags", SEQ_PROXY_TC_FREE_RUN);
+ RNA_def_property_ui_text(prop, "Free Run", "Build free run time code index");
+
+ prop = RNA_def_property(srna, "build_free_run_rec_date", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "build_tc_flags", SEQ_PROXY_TC_INTERP_REC_DATE_FREE_RUN);
+ RNA_def_property_ui_text(
+ prop, "Free Run (Rec Date)", "Build free run time code index using Record Date/Time");
+
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "quality");
+ RNA_def_property_ui_text(prop, "Quality", "JPEG Quality of proxies to build");
+ RNA_def_property_ui_range(prop, 1, 100, 1, -1);
+
+ prop = RNA_def_property(srna, "timecode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tc");
+ RNA_def_property_enum_items(prop, seq_tc_items);
+ RNA_def_property_ui_text(prop, "Timecode", "Method for reading the inputs timecode");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_tcindex_update");
+
+ prop = RNA_def_property(srna, "use_proxy_custom_directory", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_DIR);
+ RNA_def_property_ui_text(prop, "Proxy Custom Directory", "Use a custom directory to store data");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_proxy_custom_file", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "storage", SEQ_STORAGE_PROXY_CUSTOM_FILE);
+ RNA_def_property_ui_text(prop, "Proxy Custom File", "Use a custom file to read proxy data from");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_color_balance(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SequenceColorBalanceData", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Color Balance Data", "Color balance parameters for a sequence strip and it's modifiers");
- RNA_def_struct_sdna(srna, "StripColorBalance");
-
- prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
- prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
- prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
- RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
- prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
- RNA_def_property_ui_text(prop, "Inverse Gain", "Invert the gain color`");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
- prop = RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
- RNA_def_property_ui_text(prop, "Inverse Gamma", "Invert the gamma color");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
- prop = RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT);
- RNA_def_property_ui_text(prop, "Inverse Lift", "Invert the lift color");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
-
- /* not yet used */
-#if 0
- prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Exposure", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
-
- prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Saturation", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
-#endif
-
- RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SequenceColorBalanceData", NULL);
+ RNA_def_struct_ui_text(srna,
+ "Sequence Color Balance Data",
+ "Color balance parameters for a sequence strip and it's modifiers");
+ RNA_def_struct_sdna(srna, "StripColorBalance");
+
+ prop = RNA_def_property(srna, "lift", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Lift", "Color balance lift (shadows)");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Gamma", "Color balance gamma (midtones)");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Gain", "Color balance gain (highlights)");
+ RNA_def_property_ui_range(prop, 0, 2, 0.1, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "invert_gain", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAIN);
+ RNA_def_property_ui_text(prop, "Inverse Gain", "Invert the gain color`");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "invert_gamma", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_GAMMA);
+ RNA_def_property_ui_text(prop, "Inverse Gamma", "Invert the gamma color");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ prop = RNA_def_property(srna, "invert_lift", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_COLOR_BALANCE_INVERSE_LIFT);
+ RNA_def_property_ui_text(prop, "Inverse Lift", "Invert the lift color");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceColorBalance_update");
+
+ /* not yet used */
+# if 0
+ prop = RNA_def_property(srna, "exposure", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Exposure", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
+
+ prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Saturation", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_ColorBabalnce_update");
+# endif
+
+ RNA_def_struct_path_func(srna, "rna_SequenceColorBalance_path");
}
static void rna_def_strip_color_balance(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "SequenceColorBalance", "SequenceColorBalanceData");
- RNA_def_struct_ui_text(srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
- RNA_def_struct_sdna(srna, "StripColorBalance");
+ srna = RNA_def_struct(brna, "SequenceColorBalance", "SequenceColorBalanceData");
+ RNA_def_struct_ui_text(
+ srna, "Sequence Color Balance", "Color balance parameters for a sequence strip");
+ RNA_def_struct_sdna(srna, "StripColorBalance");
}
static const EnumPropertyItem blend_mode_items[] = {
- {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
- {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""},
- {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_TYPE_BURN, "BURN", 0, "Burn", ""},
- {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
- {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""},
- {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""},
- {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""},
- {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
- {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""},
- {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""},
- {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
- {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
- {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
- {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""},
- {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""},
- {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""},
- {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
- {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
- {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
- {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
- {0, NULL, 0, NULL, NULL},
+ {SEQ_BLEND_REPLACE, "REPLACE", 0, "Replace", ""},
+ {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""},
+ {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_TYPE_BURN, "BURN", 0, "Burn", ""},
+ {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
+ {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""},
+ {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""},
+ {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""},
+ {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""},
+ {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
+ {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
+ {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""},
+ {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""},
+ {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+ {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+ {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+ {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_sequence_modifiers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "SequenceModifiers");
- srna = RNA_def_struct(brna, "SequenceModifiers", NULL);
- RNA_def_struct_sdna(srna, "Sequence");
- RNA_def_struct_ui_text(srna, "Strip Modifiers", "Collection of strip modifiers");
-
- /* add modifier */
- func = RNA_def_function(srna, "new", "rna_Sequence_modifier_new");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add a new modifier");
- parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* modifier to add */
- parm = RNA_def_enum(func, "type", rna_enum_sequence_modifier_type_items, seqModifierType_ColorBalance, "", "Modifier type to add");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Newly created modifier");
- RNA_def_function_return(func, parm);
-
- /* remove modifier */
- func = RNA_def_function(srna, "remove", "rna_Sequence_modifier_remove");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove an existing modifier from the sequence");
- /* modifier to remove */
- parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Modifier to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* clear all modifiers */
- func = RNA_def_function(srna, "clear", "rna_Sequence_modifier_clear");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Remove all modifiers from the sequence");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "SequenceModifiers");
+ srna = RNA_def_struct(brna, "SequenceModifiers", NULL);
+ RNA_def_struct_sdna(srna, "Sequence");
+ RNA_def_struct_ui_text(srna, "Strip Modifiers", "Collection of strip modifiers");
+
+ /* add modifier */
+ func = RNA_def_function(srna, "new", "rna_Sequence_modifier_new");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Add a new modifier");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the modifier");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* modifier to add */
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_sequence_modifier_type_items,
+ seqModifierType_ColorBalance,
+ "",
+ "Modifier type to add");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Newly created modifier");
+ RNA_def_function_return(func, parm);
+
+ /* remove modifier */
+ func = RNA_def_function(srna, "remove", "rna_Sequence_modifier_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an existing modifier from the sequence");
+ /* modifier to remove */
+ parm = RNA_def_pointer(func, "modifier", "SequenceModifier", "", "Modifier to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* clear all modifiers */
+ func = RNA_def_function(srna, "clear", "rna_Sequence_modifier_clear");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Remove all modifiers from the sequence");
}
static void rna_def_sequence(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem seq_type_items[] = {
- {SEQ_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
- {SEQ_TYPE_META, "META", 0, "Meta", ""},
- {SEQ_TYPE_SCENE, "SCENE", 0, "Scene", ""},
- {SEQ_TYPE_MOVIE, "MOVIE", 0, "Movie", ""},
- {SEQ_TYPE_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""},
- {SEQ_TYPE_MASK, "MASK", 0, "Mask", ""},
- {SEQ_TYPE_SOUND_RAM, "SOUND", 0, "Sound", ""},
- {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
- {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
- {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
- {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
- {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
- {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
- {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
- {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
- {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
- {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
- {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
- {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
- {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
- {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
- {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
- {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
- {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Sequence", NULL);
- RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor");
- RNA_def_struct_refine_func(srna, "rna_Sequence_refine");
- RNA_def_struct_path_func(srna, "rna_Sequence_path");
- RNA_def_struct_idprops_func(srna, "rna_Sequence_idprops");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set");
- RNA_def_property_string_maxlength(prop, sizeof(((Sequence *)NULL)->name) - 2);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, seq_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
-
- /* flags */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL);
- RNA_def_property_ui_text(prop, "Left Handle Selected", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_RIGHTSEL);
- RNA_def_property_ui_text(prop, "Right Handle Selected", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
- RNA_def_property_ui_text(prop, "Mute", "Disable strip so that it cannot be viewed in the output");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_mute_update");
-
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
- RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it cannot be transformed");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
-
- /* strip positioning */
- prop = RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
- RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Length", "The length of the contents of this strip after the handles are applied");
- RNA_def_property_int_funcs(prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set", NULL);
- RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "len");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, MAXFRAME);
- RNA_def_property_ui_text(prop, "Length",
- "The length of the contents of this strip before the handles are applied");
-
- prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "start");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Start Frame", "X position where the strip begins");
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_set", NULL); /* overlap tests and calc_seq_disp */
- RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "startdisp");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Start Frame",
- "Start frame displayed in the sequence editor after offsets are applied, setting this is "
- "equivalent to moving the handle, not the actual start frame");
- /* overlap tests and calc_seq_disp */
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL);
- RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "enddisp");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "End Frame",
- "End frame displayed in the sequence editor after offsets are applied");
- /* overlap tests and calc_seq_disp */
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL);
- RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "startofs");
-// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
- RNA_def_property_ui_text(prop, "Start Offset", "");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Sequence_frame_offset_range");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
-
- prop = RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "endofs");
-// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
- RNA_def_property_ui_text(prop, "End Offset", "");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Sequence_frame_offset_range");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
-
- prop = RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "startstill");
-// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
- RNA_def_property_range(prop, 0, MAXFRAME);
- RNA_def_property_ui_text(prop, "Start Still", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
-
- prop = RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "endstill");
-// RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
- RNA_def_property_range(prop, 0, MAXFRAME);
- RNA_def_property_ui_text(prop, "End Still", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
-
- prop = RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "machine");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 1, MAXSEQ);
- RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set", NULL); /* overlap test */
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_linear_modifiers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_LINEAR_MODIFIERS);
- RNA_def_property_ui_text(prop, "Use Linear Modifiers", "Calculate modifiers in linear space instead of sequencer's space");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- /* blending */
-
- prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "blend_mode");
- RNA_def_property_enum_items(prop, blend_mode_items);
- RNA_def_property_ui_text(prop, "Blend Mode", "Method for controlling how the strip combines with other strips");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Blend Opacity", "Percentage of how much the strip's colors affect other strips");
- /* stupid 0-100 -> 0-1 */
- RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
- RNA_def_property_float_sdna(prop, NULL, "effect_fader");
- RNA_def_property_ui_text(prop, "Effect fader position", "Custom fade value");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE);
- RNA_def_property_ui_text(prop, "Use Default Fade",
- "Fade effect using the built-in default (usually make transition as long as "
- "effect strip)");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
-
- prop = RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "speed_fader");
- RNA_def_property_ui_text(prop, "Speed factor",
- "Multiply the current speed of the sequence with this number or remap current frame "
- "to this frame");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- /* modifiers */
- prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "SequenceModifier");
- RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting this strip");
- rna_def_sequence_modifiers(brna, prop);
-
- RNA_api_sequence_strip(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem seq_type_items[] = {
+ {SEQ_TYPE_IMAGE, "IMAGE", 0, "Image", ""},
+ {SEQ_TYPE_META, "META", 0, "Meta", ""},
+ {SEQ_TYPE_SCENE, "SCENE", 0, "Scene", ""},
+ {SEQ_TYPE_MOVIE, "MOVIE", 0, "Movie", ""},
+ {SEQ_TYPE_MOVIECLIP, "MOVIECLIP", 0, "Clip", ""},
+ {SEQ_TYPE_MASK, "MASK", 0, "Mask", ""},
+ {SEQ_TYPE_SOUND_RAM, "SOUND", 0, "Sound", ""},
+ {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
+ {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
+ {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+ {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+ {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+ {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
+ {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
+ {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
+ {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
+ {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
+ {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
+ {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
+ {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
+ {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Sequence", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence", "Sequence strip in the sequence editor");
+ RNA_def_struct_refine_func(srna, "rna_Sequence_refine");
+ RNA_def_struct_path_func(srna, "rna_Sequence_path");
+ RNA_def_struct_idprops_func(srna, "rna_Sequence_idprops");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Sequence_name_get", "rna_Sequence_name_length", "rna_Sequence_name_set");
+ RNA_def_property_string_maxlength(prop, sizeof(((Sequence *)NULL)->name) - 2);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, seq_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ /* flags */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "select_left_handle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LEFTSEL);
+ RNA_def_property_ui_text(prop, "Left Handle Selected", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "select_right_handle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_RIGHTSEL);
+ RNA_def_property_ui_text(prop, "Right Handle Selected", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER | NA_SELECTED, NULL);
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MUTE);
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_ui_text(
+ prop, "Mute", "Disable strip so that it cannot be viewed in the output");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_mute_update");
+
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_LOCK);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_icon(prop, ICON_UNLOCKED, true);
+ RNA_def_property_ui_text(prop, "Lock", "Lock strip so that it cannot be transformed");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ /* strip positioning */
+ prop = RNA_def_property(srna, "frame_final_duration", PROP_INT, PROP_TIME);
+ RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Length", "The length of the contents of this strip after the handles are applied");
+ RNA_def_property_int_funcs(
+ prop, "rna_Sequence_frame_length_get", "rna_Sequence_frame_length_set", NULL);
+ RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "frame_duration", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "len");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, MAXFRAME);
+ RNA_def_property_ui_text(
+ prop, "Length", "The length of the contents of this strip before the handles are applied");
+
+ prop = RNA_def_property(srna, "frame_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "start");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Start Frame", "X position where the strip begins");
+ RNA_def_property_int_funcs(
+ prop, NULL, "rna_Sequence_start_frame_set", NULL); /* overlap tests and calc_seq_disp */
+ RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "frame_final_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "startdisp");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Start Frame",
+ "Start frame displayed in the sequence editor after offsets are applied, setting this is "
+ "equivalent to moving the handle, not the actual start frame");
+ /* overlap tests and calc_seq_disp */
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_start_frame_final_set", NULL);
+ RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "frame_final_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "enddisp");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "End Frame", "End frame displayed in the sequence editor after offsets are applied");
+ /* overlap tests and calc_seq_disp */
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_end_frame_final_set", NULL);
+ RNA_def_property_editable_func(prop, "rna_Sequence_frame_editable");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "frame_offset_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "startofs");
+ // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
+ RNA_def_property_ui_text(prop, "Start Offset", "");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Sequence_frame_offset_range");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
+
+ prop = RNA_def_property(srna, "frame_offset_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "endofs");
+ // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
+ RNA_def_property_ui_text(prop, "End Offset", "");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_Sequence_frame_offset_range");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
+
+ prop = RNA_def_property(srna, "frame_still_start", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "startstill");
+ // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
+ RNA_def_property_range(prop, 0, MAXFRAME);
+ RNA_def_property_ui_text(prop, "Start Still", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
+
+ prop = RNA_def_property(srna, "frame_still_end", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "endstill");
+ // RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* overlap tests */
+ RNA_def_property_range(prop, 0, MAXFRAME);
+ RNA_def_property_ui_text(prop, "End Still", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_frame_change_update");
+
+ prop = RNA_def_property(srna, "channel", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "machine");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 1, MAXSEQ);
+ RNA_def_property_ui_text(prop, "Channel", "Y position of the sequence strip");
+ RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_channel_set", NULL); /* overlap test */
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_linear_modifiers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_LINEAR_MODIFIERS);
+ RNA_def_property_ui_text(prop,
+ "Use Linear Modifiers",
+ "Calculate modifiers in linear space instead of sequencer's space");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ /* blending */
+
+ prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blend_mode");
+ RNA_def_property_enum_items(prop, blend_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Blend Mode", "Method for controlling how the strip combines with other strips");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "blend_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Blend Opacity", "Percentage of how much the strip's colors affect other strips");
+ /* stupid 0-100 -> 0-1 */
+ RNA_def_property_float_funcs(prop, "rna_Sequence_opacity_get", "rna_Sequence_opacity_set", NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "effect_fader", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "effect_fader");
+ RNA_def_property_ui_text(prop, "Effect fader position", "Custom fade value");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_default_fade", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_EFFECT_DEFAULT_FADE);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Default Fade",
+ "Fade effect using the built-in default (usually make transition as long as "
+ "effect strip)");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "speed_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "speed_fader");
+ RNA_def_property_ui_text(
+ prop,
+ "Speed factor",
+ "Multiply the current speed of the sequence with this number or remap current frame "
+ "to this frame");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ /* modifiers */
+ prop = RNA_def_property(srna, "modifiers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SequenceModifier");
+ RNA_def_property_ui_text(prop, "Modifiers", "Modifiers affecting this strip");
+ rna_def_sequence_modifiers(brna, prop);
+
+ RNA_api_sequence_strip(srna);
}
static void rna_def_editor(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem editing_storage_items[] = {
- {0, "PER_STRIP", 0, "Per Strip", "Store proxies using per strip settings"},
- {SEQ_EDIT_PROXY_DIR_STORAGE, "PROJECT", 0, "Project", "Store proxies using project directory"},
- {0, NULL, 0, NULL, NULL},
- };
- srna = RNA_def_struct(brna, "SequenceEditor", NULL);
- RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene data-block");
- RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
- RNA_def_struct_sdna(srna, "Editing");
-
- prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
- RNA_def_property_struct_type(prop, "Sequence");
- RNA_def_property_ui_text(prop, "Sequences", "Top-level strips only");
- RNA_api_sequences(brna, prop);
-
- prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
- RNA_def_property_struct_type(prop, "Sequence");
- RNA_def_property_ui_text(prop, "All Sequences", "All strips, recursively including those inside metastrips");
- RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_sequences_all_begin",
- "rna_SequenceEditor_sequences_all_next", NULL, NULL, NULL, NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
- RNA_def_property_struct_type(prop, "Sequence");
- RNA_def_property_ui_text(prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get",
- NULL, NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
-
- prop = RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW);
- RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay on top of the sequencer");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "use_overlay_lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS);
- RNA_def_property_ui_text(prop, "Overlay Lock", "");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- /* access to fixed and relative frame */
- prop = RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Overlay Offset", "");
- RNA_def_property_int_funcs(prop, "rna_SequenceEditor_overlay_frame_get",
- "rna_SequenceEditor_overlay_frame_set", NULL);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "proxy_storage", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, editing_storage_items);
- RNA_def_property_ui_text(prop, "Proxy Storage", "How to store proxies for this project");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache");
-
- prop = RNA_def_property(srna, "proxy_dir", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "proxy_dir");
- RNA_def_property_ui_text(prop, "Proxy Directory", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem editing_storage_items[] = {
+ {0, "PER_STRIP", 0, "Per Strip", "Store proxies using per strip settings"},
+ {SEQ_EDIT_PROXY_DIR_STORAGE,
+ "PROJECT",
+ 0,
+ "Project",
+ "Store proxies using project directory"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ srna = RNA_def_struct(brna, "SequenceEditor", NULL);
+ RNA_def_struct_ui_text(srna, "Sequence Editor", "Sequence editing data for a Scene data-block");
+ RNA_def_struct_ui_icon(srna, ICON_SEQUENCE);
+ RNA_def_struct_sdna(srna, "Editing");
+
+ prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
+ RNA_def_property_struct_type(prop, "Sequence");
+ RNA_def_property_ui_text(prop, "Sequences", "Top-level strips only");
+ RNA_api_sequences(brna, prop);
+
+ prop = RNA_def_property(srna, "sequences_all", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
+ RNA_def_property_struct_type(prop, "Sequence");
+ RNA_def_property_ui_text(
+ prop, "All Sequences", "All strips, recursively including those inside metastrips");
+ RNA_def_property_collection_funcs(prop,
+ "rna_SequenceEditor_sequences_all_begin",
+ "rna_SequenceEditor_sequences_all_next",
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ prop = RNA_def_property(srna, "meta_stack", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "metastack", NULL);
+ RNA_def_property_struct_type(prop, "Sequence");
+ RNA_def_property_ui_text(
+ prop, "Meta Stack", "Meta strip stack, last is currently edited meta strip");
+ RNA_def_property_collection_funcs(
+ prop, NULL, NULL, NULL, "rna_SequenceEditor_meta_stack_get", NULL, NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "active_strip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "act_seq");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active Strip", "Sequencer's active strip");
+
+ prop = RNA_def_property(srna, "show_overlay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_SHOW);
+ RNA_def_property_ui_text(prop, "Draw Axes", "Partial overlay on top of the sequencer");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "use_overlay_lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "over_flag", SEQ_EDIT_OVERLAY_ABS);
+ RNA_def_property_ui_text(prop, "Overlay Lock", "");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_SequenceEditor_overlay_lock_set");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ /* access to fixed and relative frame */
+ prop = RNA_def_property(srna, "overlay_frame", PROP_INT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Overlay Offset", "");
+ RNA_def_property_int_funcs(
+ prop, "rna_SequenceEditor_overlay_frame_get", "rna_SequenceEditor_overlay_frame_set", NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "proxy_storage", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, editing_storage_items);
+ RNA_def_property_ui_text(prop, "Proxy Storage", "How to store proxies for this project");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache");
+
+ prop = RNA_def_property(srna, "proxy_dir", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "proxy_dir");
+ RNA_def_property_ui_text(prop, "Proxy Directory", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, "rna_SequenceEditor_update_cache");
}
static void rna_def_filter_video(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem alpha_mode_items[] = {
- {SEQ_ALPHA_STRAIGHT, "STRAIGHT", 0, "Straight", "RGB channels in transparent pixels are unaffected by the alpha channel"},
- {SEQ_ALPHA_PREMUL, "PREMUL", 0, "Premultiplied", "RGB channels in transparent pixels are multiplied by the alpha channel"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FILTERY);
- RNA_def_property_ui_text(prop, "Deinterlace", "Remove fields from video movies");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files");
-
- prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, alpha_mode_items);
- RNA_def_property_ui_text(prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPX);
- RNA_def_property_ui_text(prop, "Flip X", "Flip on the X axis");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPY);
- RNA_def_property_ui_text(prop, "Flip Y", "Flip on the Y axis");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_float", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_FLOAT);
- RNA_def_property_ui_text(prop, "Convert Float", "Convert input to float data");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_REVERSE_FRAMES);
- RNA_def_property_ui_text(prop, "Flip Time", "Reverse frame order");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "mul");
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Multiply Colors", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "sat");
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Saturation", "Adjust the intensity of the input's color");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 1.0f, 30.0f);
- RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
- RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "strip->transform");
- RNA_def_property_ui_text(prop, "Transform", "");
-
- prop = RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP);
- RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "strip->crop");
- RNA_def_property_ui_text(prop, "Crop", "");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem alpha_mode_items[] = {
+ {SEQ_ALPHA_STRAIGHT,
+ "STRAIGHT",
+ 0,
+ "Straight",
+ "RGB channels in transparent pixels are unaffected by the alpha channel"},
+ {SEQ_ALPHA_PREMUL,
+ "PREMUL",
+ 0,
+ "Premultiplied",
+ "RGB channels in transparent pixels are multiplied by the alpha channel"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "use_deinterlace", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FILTERY);
+ RNA_def_property_ui_text(prop, "Deinterlace", "Remove fields from video movies");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files");
+
+ prop = RNA_def_property(srna, "alpha_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, alpha_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Alpha Mode", "Representation of alpha information in the RGBA pixels");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_flip_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPX);
+ RNA_def_property_ui_text(prop, "Flip X", "Flip on the X axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_flip_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_FLIPY);
+ RNA_def_property_ui_text(prop, "Flip Y", "Flip on the Y axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_float", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MAKE_FLOAT);
+ RNA_def_property_ui_text(prop, "Convert Float", "Convert input to float data");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_reverse_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_REVERSE_FRAMES);
+ RNA_def_property_ui_text(prop, "Flip Time", "Reverse frame order");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "mul");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Multiply Colors", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "color_saturation", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "sat");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 3, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Saturation", "Adjust the intensity of the input's color");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "strobe", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0f, 30.0f);
+ RNA_def_property_ui_text(prop, "Strobe", "Only display every nth frame");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_translation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_TRANSFORM);
+ RNA_def_property_ui_text(prop, "Use Translation", "Translate image before processing");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_translation_set");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "transform", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "strip->transform");
+ RNA_def_property_ui_text(prop, "Transform", "");
+
+ prop = RNA_def_property(srna, "use_crop", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_CROP);
+ RNA_def_property_ui_text(prop, "Use Crop", "Crop image before processing");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_crop_set");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "crop", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "strip->crop");
+ RNA_def_property_ui_text(prop, "Crop", "");
}
static void rna_def_proxy(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY);
- RNA_def_property_ui_text(prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this strip");
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set");
+ prop = RNA_def_property(srna, "use_proxy", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_PROXY);
+ RNA_def_property_ui_text(
+ prop, "Use Proxy / Timecode", "Use a preview proxy and/or timecode index for this strip");
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Sequence_use_proxy_set");
- prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy");
- RNA_def_property_ui_text(prop, "Proxy", "");
+ prop = RNA_def_property(srna, "proxy", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "strip->proxy");
+ RNA_def_property_ui_text(prop, "Proxy", "");
}
static void rna_def_input(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "animation_offset_start", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "anim_startofs");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); /* overlap tests */
- RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "animation_offset_start", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "anim_startofs");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(
+ prop, NULL, "rna_Sequence_anim_startofs_final_set", NULL); /* overlap tests */
+ RNA_def_property_ui_text(prop, "Animation Start Offset", "Animation start offset (trim start)");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "anim_endofs");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); /* overlap tests */
- RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "animation_offset_end", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "anim_endofs");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(
+ prop, NULL, "rna_Sequence_anim_endofs_final_set", NULL); /* overlap tests */
+ RNA_def_property_ui_text(prop, "Animation End Offset", "Animation end offset (trim end)");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_effect_inputs(StructRNA *srna, int count)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
-
- if (count >= 1) {
- prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "seq1");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
- }
-
- if (count >= 2) {
- prop = RNA_def_property(srna, "input_2", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "seq2");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
- }
-
-#if 0
- if (count == 3) { // not used by any effects (perhaps one day plugins?)
- prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "seq3");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
- }
-#endif
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "input_count", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_funcs(prop, "rna_Sequence_input_count_get", NULL, NULL);
+
+ if (count >= 1) {
+ prop = RNA_def_property(srna, "input_1", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "seq1");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Input 1", "First input for the effect strip");
+ }
+
+ if (count >= 2) {
+ prop = RNA_def_property(srna, "input_2", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "seq2");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Input 2", "Second input for the effect strip");
+ }
+
+# if 0
+ if (count == 3) { // not used by any effects (perhaps one day plugins?)
+ prop = RNA_def_property(srna, "input_3", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "seq3");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Input 3", "Third input for the effect strip");
+ }
+# endif
}
static void rna_def_color_management(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "strip->colorspace_settings");
- RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
- RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
+ prop = RNA_def_property(srna, "colorspace_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "strip->colorspace_settings");
+ RNA_def_property_struct_type(prop, "ColorManagedInputColorspaceSettings");
+ RNA_def_property_ui_text(prop, "Color Space Settings", "Input color space settings");
}
static void rna_def_movie_types(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "fps", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "FPS", "Frames per second");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_Sequence_fps_get", NULL, NULL);
+ prop = RNA_def_property(srna, "fps", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "FPS", "Frames per second");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_Sequence_fps_get", NULL, NULL);
}
static void rna_def_image(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ImageSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Image Sequence", "Sequence strip to load one or more images");
- RNA_def_struct_sdna(srna, "Sequence");
-
- prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "strip->dir");
- RNA_def_property_ui_text(prop, "Directory", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
- RNA_def_property_struct_type(prop, "SequenceElement");
- RNA_def_property_ui_text(prop, "Elements", "");
- RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
- RNA_api_sequence_elements(brna, prop);
-
- /* multiview */
- prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS);
- RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_views_format_update");
-
- prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "views_format");
- RNA_def_property_enum_items(prop, rna_enum_views_format_items);
- RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Sequence_views_format_update");
-
- prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "Stereo3dFormat");
- RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
-
- rna_def_filter_video(srna);
- rna_def_proxy(srna);
- rna_def_input(srna);
- rna_def_color_management(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ImageSequence", "Sequence");
+ RNA_def_struct_ui_text(srna, "Image Sequence", "Sequence strip to load one or more images");
+ RNA_def_struct_sdna(srna, "Sequence");
+
+ prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "strip->dir");
+ RNA_def_property_ui_text(prop, "Directory", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
+ RNA_def_property_struct_type(prop, "SequenceElement");
+ RNA_def_property_ui_text(prop, "Elements", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_SequenceEditor_elements_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_SequenceEditor_elements_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_api_sequence_elements(brna, prop);
+
+ /* multiview */
+ prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS);
+ RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_views_format_update");
+
+ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "views_format");
+ RNA_def_property_enum_items(prop, rna_enum_views_format_items);
+ RNA_def_property_ui_text(prop, "Views Format", "Mode to load image views");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Sequence_views_format_update");
+
+ prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Stereo3dFormat");
+ RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
+
+ rna_def_filter_video(srna);
+ rna_def_proxy(srna);
+ rna_def_input(srna);
+ rna_def_color_management(srna);
}
static void rna_def_meta(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MetaSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Meta Sequence", "Sequence strip to group other strips as a single sequence strip");
- RNA_def_struct_sdna(srna, "Sequence");
+ srna = RNA_def_struct(brna, "MetaSequence", "Sequence");
+ RNA_def_struct_ui_text(
+ srna, "Meta Sequence", "Sequence strip to group other strips as a single sequence strip");
+ RNA_def_struct_sdna(srna, "Sequence");
- prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
- RNA_def_property_struct_type(prop, "Sequence");
- RNA_def_property_ui_text(prop, "Sequences", "");
+ prop = RNA_def_property(srna, "sequences", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "seqbase", NULL);
+ RNA_def_property_struct_type(prop, "Sequence");
+ RNA_def_property_ui_text(prop, "Sequences", "");
- rna_def_filter_video(srna);
- rna_def_proxy(srna);
- rna_def_input(srna);
+ rna_def_filter_video(srna);
+ rna_def_proxy(srna);
+ rna_def_input(srna);
}
static void rna_def_scene(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SceneSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Scene Sequence", "Sequence strip to used the rendered image of a scene");
- RNA_def_struct_sdna(srna, "Sequence");
+ srna = RNA_def_struct(brna, "SceneSequence", "Sequence");
+ RNA_def_struct_ui_text(
+ srna, "Scene Sequence", "Sequence strip to used the rendered image of a scene");
+ RNA_def_struct_sdna(srna, "Sequence");
- prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Scene", "Scene that this sequence uses");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "scene_camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
- RNA_def_property_ui_text(prop, "Camera Override", "Override the scenes active camera");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "scene_camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_Camera_object_poll");
+ RNA_def_property_ui_text(prop, "Camera Override", "Override the scenes active camera");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "use_sequence", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SCENE_STRIPS);
- RNA_def_property_ui_text(prop, "Use Sequence", "Use scenes sequence strips directly, instead of rendering");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "use_sequence", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SCENE_STRIPS);
+ RNA_def_property_ui_text(
+ prop, "Use Sequence", "Use scenes sequence strips directly, instead of rendering");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_SCENE_NO_GPENCIL);
- RNA_def_property_ui_text(prop, "Use Grease Pencil", "Show Grease Pencil strokes in OpenGL previews");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "use_grease_pencil", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_SCENE_NO_GPENCIL);
+ RNA_def_property_ui_text(
+ prop, "Use Grease Pencil", "Show Grease Pencil strokes in OpenGL previews");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- rna_def_filter_video(srna);
- rna_def_proxy(srna);
- rna_def_input(srna);
- rna_def_movie_types(srna);
+ rna_def_filter_video(srna);
+ rna_def_proxy(srna);
+ rna_def_input(srna);
+ rna_def_movie_types(srna);
}
static void rna_def_movie(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "MovieSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video");
- RNA_def_struct_sdna(srna, "Sequence");
-
- prop = RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "anim_preseek");
- RNA_def_property_range(prop, 0, 50);
- RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "streamindex");
- RNA_def_property_range(prop, 0, 20);
- RNA_def_property_ui_text(prop, "Stream Index",
- "For files with several movie streams, use the stream with the given index");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files");
-
- prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
- RNA_def_property_struct_type(prop, "SequenceElement");
- RNA_def_property_ui_text(prop, "Elements", "");
- RNA_def_property_collection_funcs(prop, "rna_SequenceEditor_elements_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_SequenceEditor_elements_length", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_ui_text(prop, "File", "");
- RNA_def_property_string_funcs(prop, "rna_Sequence_filepath_get", "rna_Sequence_filepath_length",
- "rna_Sequence_filepath_set");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
-
- /* metadata */
- func = RNA_def_function(srna, "metadata", "rna_MovieSequence_metadata_get");
- RNA_def_function_ui_description(func, "Retrieve metadata of the movie file");
- /* return type */
- parm = RNA_def_pointer(func, "metadata", "IDPropertyWrapPtr", "", "Dict-like object containing the metadata");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- /* multiview */
- prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS);
- RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_views_format_update");
-
- prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "views_format");
- RNA_def_property_enum_items(prop, rna_enum_views_format_items);
- RNA_def_property_ui_text(prop, "Views Format", "Mode to load movie views");
- RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Sequence_views_format_update");
-
- prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "Stereo3dFormat");
- RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
-
- rna_def_filter_video(srna);
- rna_def_proxy(srna);
- rna_def_input(srna);
- rna_def_color_management(srna);
- rna_def_movie_types(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "MovieSequence", "Sequence");
+ RNA_def_struct_ui_text(srna, "Movie Sequence", "Sequence strip to load a video");
+ RNA_def_struct_sdna(srna, "Sequence");
+
+ prop = RNA_def_property(srna, "mpeg_preseek", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "anim_preseek");
+ RNA_def_property_range(prop, 0, 50);
+ RNA_def_property_ui_text(prop, "MPEG Preseek", "For MPEG movies, preseek this many frames");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "stream_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "streamindex");
+ RNA_def_property_range(prop, 0, 20);
+ RNA_def_property_ui_text(
+ prop,
+ "Stream Index",
+ "For files with several movie streams, use the stream with the given index");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update_reopen_files");
+
+ prop = RNA_def_property(srna, "elements", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "strip->stripdata", NULL);
+ RNA_def_property_struct_type(prop, "SequenceElement");
+ RNA_def_property_ui_text(prop, "Elements", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_SequenceEditor_elements_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_SequenceEditor_elements_length",
+ NULL,
+ NULL,
+ NULL);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_ui_text(prop, "File", "");
+ RNA_def_property_string_funcs(prop,
+ "rna_Sequence_filepath_get",
+ "rna_Sequence_filepath_length",
+ "rna_Sequence_filepath_set");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_filepath_update");
+
+ /* metadata */
+ func = RNA_def_function(srna, "metadata", "rna_MovieSequence_metadata_get");
+ RNA_def_function_ui_description(func, "Retrieve metadata of the movie file");
+ /* return type */
+ parm = RNA_def_pointer(
+ func, "metadata", "IDPropertyWrapPtr", "", "Dict-like object containing the metadata");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ /* multiview */
+ prop = RNA_def_property(srna, "use_multiview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_USE_VIEWS);
+ RNA_def_property_ui_text(prop, "Use Multi-View", "Use Multiple Views (when available)");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_views_format_update");
+
+ prop = RNA_def_property(srna, "views_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "views_format");
+ RNA_def_property_enum_items(prop, rna_enum_views_format_items);
+ RNA_def_property_ui_text(prop, "Views Format", "Mode to load movie views");
+ RNA_def_property_update(prop, NC_IMAGE | ND_DISPLAY, "rna_Sequence_views_format_update");
+
+ prop = RNA_def_property(srna, "stereo_3d_format", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Stereo3dFormat");
+ RNA_def_property_ui_text(prop, "Stereo 3D Format", "Settings for stereo 3d");
+
+ rna_def_filter_video(srna);
+ rna_def_proxy(srna);
+ rna_def_input(srna);
+ rna_def_color_management(srna);
+ rna_def_movie_types(srna);
}
static void rna_def_movieclip(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MovieClipSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "MovieClip Sequence", "Sequence strip to load a video from the clip editor");
- RNA_def_struct_sdna(srna, "Sequence");
+ srna = RNA_def_struct(brna, "MovieClipSequence", "Sequence");
+ RNA_def_struct_ui_text(
+ srna, "MovieClip Sequence", "Sequence strip to load a video from the clip editor");
+ RNA_def_struct_sdna(srna, "Sequence");
- /* TODO - add clip property? */
+ /* TODO - add clip property? */
- prop = RNA_def_property(srna, "undistort", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_UNDISTORTED);
- RNA_def_property_ui_text(prop, "Undistort Clip", "Use the undistorted version of the clip");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "undistort", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_UNDISTORTED);
+ RNA_def_property_ui_text(prop, "Undistort Clip", "Use the undistorted version of the clip");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "stabilize2d", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_STABILIZED);
- RNA_def_property_ui_text(prop, "Stabilize 2D Clip", "Use the 2D stabilized version of the clip");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "stabilize2d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "clip_flag", SEQ_MOVIECLIP_RENDER_STABILIZED);
+ RNA_def_property_ui_text(prop, "Stabilize 2D Clip", "Use the 2D stabilized version of the clip");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- rna_def_filter_video(srna);
- rna_def_input(srna);
- rna_def_movie_types(srna);
+ rna_def_filter_video(srna);
+ rna_def_input(srna);
+ rna_def_movie_types(srna);
}
static void rna_def_mask(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MaskSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Mask Sequence", "Sequence strip to load a video from a mask");
- RNA_def_struct_sdna(srna, "Sequence");
+ srna = RNA_def_struct(brna, "MaskSequence", "Sequence");
+ RNA_def_struct_ui_text(srna, "Mask Sequence", "Sequence strip to load a video from a mask");
+ RNA_def_struct_sdna(srna, "Sequence");
- prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask", "Mask that this sequence uses");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask", "Mask that this sequence uses");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- rna_def_filter_video(srna);
- rna_def_input(srna);
+ rna_def_filter_video(srna);
+ rna_def_input(srna);
}
static void rna_def_sound(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SoundSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Sound Sequence",
- "Sequence strip defining a sound to be played over a period of time");
- RNA_def_struct_sdna(srna, "Sequence");
-
- prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "Sound");
- RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this sequence");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_sound_update");
-
- prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "volume");
- RNA_def_property_range(prop, 0.0f, 100.0f);
- RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pitch");
- RNA_def_property_range(prop, 0.1f, 10.0f);
- RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pan");
- RNA_def_property_range(prop, -2.0f, 2.0f);
- RNA_def_property_ui_text(prop, "Pan", "Playback panning of the sound (only for Mono sources)");
- RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
- RNA_def_property_ui_text(prop, "Display Waveform", "Display the audio waveform inside the clip");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
-
- rna_def_input(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SoundSequence", "Sequence");
+ RNA_def_struct_ui_text(srna,
+ "Sound Sequence",
+ "Sequence strip defining a sound to be played over a period of time");
+ RNA_def_struct_sdna(srna, "Sequence");
+
+ prop = RNA_def_property(srna, "sound", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "Sound");
+ RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this sequence");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_sound_update");
+
+ prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "volume");
+ RNA_def_property_range(prop, 0.0f, 100.0f);
+ RNA_def_property_ui_text(prop, "Volume", "Playback volume of the sound");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_volume_set", NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pitch");
+ RNA_def_property_range(prop, 0.1f, 10.0f);
+ RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pitch_set", NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "pan", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pan");
+ RNA_def_property_range(prop, -2.0f, 2.0f);
+ RNA_def_property_ui_text(prop, "Pan", "Playback panning of the sound (only for Mono sources)");
+ RNA_def_property_float_funcs(prop, NULL, "rna_Sequence_pan_set", NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "show_waveform", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_AUDIO_DRAW_WAVEFORM);
+ RNA_def_property_ui_text(prop, "Display Waveform", "Display the audio waveform inside the clip");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ rna_def_input(srna);
}
static void rna_def_effect(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "EffectSequence", "Sequence");
- RNA_def_struct_ui_text(srna, "Effect Sequence",
- "Sequence strip applying an effect on the images created by other strips");
- RNA_def_struct_sdna(srna, "Sequence");
+ srna = RNA_def_struct(brna, "EffectSequence", "Sequence");
+ RNA_def_struct_ui_text(
+ srna,
+ "Effect Sequence",
+ "Sequence strip applying an effect on the images created by other strips");
+ RNA_def_struct_sdna(srna, "Sequence");
- rna_def_filter_video(srna);
- rna_def_proxy(srna);
+ rna_def_filter_video(srna);
+ rna_def_proxy(srna);
}
static void rna_def_multicam(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "multicam_source");
- RNA_def_property_range(prop, 0, MAXSEQ - 1);
- RNA_def_property_ui_text(prop, "Multicam Source Channel", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "multicam_source", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "multicam_source");
+ RNA_def_property_range(prop, 0, MAXSEQ - 1);
+ RNA_def_property_ui_text(prop, "Multicam Source Channel", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- rna_def_input(srna);
+ rna_def_input(srna);
}
static void rna_def_wipe(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem wipe_type_items[] = {
- {0, "SINGLE", 0, "Single", ""},
- {1, "DOUBLE", 0, "Double", ""},
- /* not used yet {2, "BOX", 0, "Box", ""}, */
- /* not used yet {3, "CROSS", 0, "Cross", ""}, */
- {4, "IRIS", 0, "Iris", ""},
- {5, "CLOCK", 0, "Clock", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem wipe_direction_items[] = {
- {0, "OUT", 0, "Out", ""},
- {1, "IN", 0, "In", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_struct_sdna_from(srna, "WipeVars", "effectdata");
-
- prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "edgeWidth");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Blur Width",
- "Width of the blur edge, in percentage relative to the image size");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_range(prop, DEG2RADF(-90.0f), DEG2RADF(90.0f));
- RNA_def_property_ui_text(prop, "Angle", "Edge angle");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "forward");
- RNA_def_property_enum_items(prop, wipe_direction_items);
- RNA_def_property_ui_text(prop, "Direction", "Wipe direction");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "wipetype");
- RNA_def_property_enum_items(prop, wipe_type_items);
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE);
- RNA_def_property_ui_text(prop, "Transition Type", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem wipe_type_items[] = {
+ {0, "SINGLE", 0, "Single", ""},
+ {1, "DOUBLE", 0, "Double", ""},
+ /* not used yet {2, "BOX", 0, "Box", ""}, */
+ /* not used yet {3, "CROSS", 0, "Cross", ""}, */
+ {4, "IRIS", 0, "Iris", ""},
+ {5, "CLOCK", 0, "Clock", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem wipe_direction_items[] = {
+ {0, "OUT", 0, "Out", ""},
+ {1, "IN", 0, "In", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_struct_sdna_from(srna, "WipeVars", "effectdata");
+
+ prop = RNA_def_property(srna, "blur_width", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "edgeWidth");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Blur Width", "Width of the blur edge, in percentage relative to the image size");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_range(prop, DEG2RADF(-90.0f), DEG2RADF(90.0f));
+ RNA_def_property_ui_text(prop, "Angle", "Edge angle");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "forward");
+ RNA_def_property_enum_items(prop, wipe_direction_items);
+ RNA_def_property_ui_text(prop, "Direction", "Wipe direction");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "transition_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wipetype");
+ RNA_def_property_enum_items(prop, wipe_type_items);
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SEQUENCE);
+ RNA_def_property_ui_text(prop, "Transition Type", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_glow(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "GlowVars", "effectdata");
+ RNA_def_struct_sdna_from(srna, "GlowVars", "effectdata");
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "fMini");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fMini");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Threshold", "Minimum intensity to trigger a glow");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "fClamp");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Clamp", "Brightness limit of intensity");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "clamp", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fClamp");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Clamp", "Brightness limit of intensity");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "fBoost");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Boost Factor", "Brightness multiplier");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "boost_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "fBoost");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Boost Factor", "Brightness multiplier");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "blur_radius", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dDist");
- RNA_def_property_range(prop, 0.5f, 20.0f);
- RNA_def_property_ui_text(prop, "Blur Distance", "Radius of glow effect");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "blur_radius", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dDist");
+ RNA_def_property_range(prop, 0.5f, 20.0f);
+ RNA_def_property_ui_text(prop, "Blur Distance", "Radius of glow effect");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "dQuality");
- RNA_def_property_range(prop, 1, 5);
- RNA_def_property_ui_text(prop, "Quality", "Accuracy of the blur effect");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "quality", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "dQuality");
+ RNA_def_property_range(prop, 1, 5);
+ RNA_def_property_ui_text(prop, "Quality", "Accuracy of the blur effect");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "use_only_boost", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "bNoComp", 0);
- RNA_def_property_ui_text(prop, "Only Boost", "Show the glow buffer only");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "use_only_boost", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "bNoComp", 0);
+ RNA_def_property_ui_text(prop, "Only Boost", "Show the glow buffer only");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_transform(StructRNA *srna)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem interpolation_items[] = {
- {0, "NONE", 0, "None", "No interpolation"},
- {1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"},
- {2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem translation_unit_items[] = {
- {0, "PIXELS", 0, "Pixels", ""},
- {1, "PERCENT", 0, "Percent", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
-
- prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "ScalexIni");
- RNA_def_property_ui_text(prop, "Scale X", "Amount to scale the input in the X axis");
- RNA_def_property_ui_range(prop, 0, 10, 3, 6);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "ScaleyIni");
- RNA_def_property_ui_text(prop, "Scale Y", "Amount to scale the input in the Y axis");
- RNA_def_property_ui_range(prop, 0, 10, 3, 6);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uniform_scale", 0);
- RNA_def_property_ui_text(prop, "Uniform Scale", "Scale uniformly, preserving aspect ratio");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xIni");
- RNA_def_property_ui_text(prop, "Translate X", "Amount to move the input on the X axis");
- RNA_def_property_ui_range(prop, -4000.0f, 4000.0f, 3, 6);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "yIni");
- RNA_def_property_ui_text(prop, "Translate Y", "Amount to move the input on the Y axis");
- RNA_def_property_ui_range(prop, -4000.0f, 4000.0f, 3, 6);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rotIni");
- RNA_def_property_ui_text(prop, "Rotation", "Degrees to rotate the input");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "percent");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
- RNA_def_property_enum_items(prop, translation_unit_items);
- RNA_def_property_ui_text(prop, "Translation Unit", "Unit of measure to translate the input");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, interpolation_items);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
- RNA_def_property_ui_text(prop, "Interpolation", "Method to determine how missing pixels are created");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem interpolation_items[] = {
+ {0, "NONE", 0, "None", "No interpolation"},
+ {1, "BILINEAR", 0, "Bilinear", "Bilinear interpolation"},
+ {2, "BICUBIC", 0, "Bicubic", "Bicubic interpolation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem translation_unit_items[] = {
+ {0, "PIXELS", 0, "Pixels", ""},
+ {1, "PERCENT", 0, "Percent", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_struct_sdna_from(srna, "TransformVars", "effectdata");
+
+ prop = RNA_def_property(srna, "scale_start_x", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "ScalexIni");
+ RNA_def_property_ui_text(prop, "Scale X", "Amount to scale the input in the X axis");
+ RNA_def_property_ui_range(prop, 0, 10, 3, 6);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "scale_start_y", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "ScaleyIni");
+ RNA_def_property_ui_text(prop, "Scale Y", "Amount to scale the input in the Y axis");
+ RNA_def_property_ui_range(prop, 0, 10, 3, 6);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_uniform_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uniform_scale", 0);
+ RNA_def_property_ui_text(prop, "Uniform Scale", "Scale uniformly, preserving aspect ratio");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "translate_start_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xIni");
+ RNA_def_property_ui_text(prop, "Translate X", "Amount to move the input on the X axis");
+ RNA_def_property_ui_range(prop, -4000.0f, 4000.0f, 3, 6);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "translate_start_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "yIni");
+ RNA_def_property_ui_text(prop, "Translate Y", "Amount to move the input on the Y axis");
+ RNA_def_property_ui_range(prop, -4000.0f, 4000.0f, 3, 6);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "rotation_start", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rotIni");
+ RNA_def_property_ui_text(prop, "Rotation", "Degrees to rotate the input");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "translation_unit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "percent");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
+ RNA_def_property_enum_items(prop, translation_unit_items);
+ RNA_def_property_ui_text(prop, "Translation Unit", "Unit of measure to translate the input");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, interpolation_items);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* not meant to be animated */
+ RNA_def_property_ui_text(
+ prop, "Interpolation", "Method to determine how missing pixels are created");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_solid_color(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
+ RNA_def_struct_sdna_from(srna, "SolidColorVars", "effectdata");
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "col");
- RNA_def_property_ui_text(prop, "Color", "Effect Strip color");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "col");
+ RNA_def_property_ui_text(prop, "Color", "Effect Strip color");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_speed_control(StructRNA *srna)
{
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "SpeedControlVars", "effectdata");
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "globalSpeed");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* seq->facf0 is used to animate this */
- RNA_def_property_ui_text(prop, "Multiply Speed", "Multiply the resulting speed after the speed factor");
- RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ RNA_def_struct_sdna_from(srna, "SpeedControlVars", "effectdata");
- prop = RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE);
- RNA_def_property_ui_text(prop, "Use as speed", "Interpret the value as speed instead of a frame number");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "multiply_speed", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "globalSpeed");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); /* seq->facf0 is used to animate this */
+ RNA_def_property_ui_text(
+ prop, "Multiply Speed", "Multiply the resulting speed after the speed factor");
+ RNA_def_property_ui_range(prop, 0.0f, 100.0f, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "use_scale_to_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
- RNA_def_property_ui_text(prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "use_as_speed", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_INTEGRATE);
+ RNA_def_property_ui_text(
+ prop, "Use as speed", "Interpret the value as speed instead of a frame number");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "use_scale_to_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SEQ_SPEED_COMPRESS_IPO_Y);
+ RNA_def_property_ui_text(
+ prop, "Scale to length", "Scale values from 0.0 to 1.0 to target sequence length");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_gaussian_blur(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- RNA_def_struct_sdna_from(srna, "GaussianBlurVars", "effectdata");
- prop = RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Size X", "Size of the blur along X axis");
- RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ RNA_def_struct_sdna_from(srna, "GaussianBlurVars", "effectdata");
+ prop = RNA_def_property(srna, "size_x", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Size X", "Size of the blur along X axis");
+ RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
- prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "Size Y", "Size of the blur along Y axis");
- RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ prop = RNA_def_property(srna, "size_y", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "Size Y", "Size of the blur along Y axis");
+ RNA_def_property_ui_range(prop, 0.0f, FLT_MAX, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_text(StructRNA *srna)
{
- static const EnumPropertyItem text_align_x_items[] = {
- {SEQ_TEXT_ALIGN_X_LEFT, "LEFT", 0, "Left", ""},
- {SEQ_TEXT_ALIGN_X_CENTER, "CENTER", 0, "Center", ""},
- {SEQ_TEXT_ALIGN_X_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL},
- };
- static const EnumPropertyItem text_align_y_items[] = {
- {SEQ_TEXT_ALIGN_Y_TOP, "TOP", 0, "Top", ""},
- {SEQ_TEXT_ALIGN_Y_CENTER, "CENTER", 0, "Center", ""},
- {SEQ_TEXT_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "TextVars", "effectdata");
-
- prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "text_font");
- RNA_def_property_ui_icon(prop, ICON_FILE_FONT, false);
- RNA_def_property_ui_text(prop, "Font", "Font of the text. Falls back to the UI font by default");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_text_font_set", NULL, NULL);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "text_size");
- RNA_def_property_ui_text(prop, "Size", "Size of the text");
- RNA_def_property_range(prop, 0.0, 2000);
- RNA_def_property_ui_range(prop, 0.0f, 1000, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "color");
- RNA_def_property_ui_text(prop, "Color", "Text color");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shadow_color");
- RNA_def_property_ui_text(prop, "Shadow Color", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_ui_text(prop, "Location", "Location of the text");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "wrap_width", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "wrap_width");
- RNA_def_property_ui_text(prop, "Wrap Width", "Word wrap width as factor, zero disables");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "align");
- RNA_def_property_enum_items(prop, text_align_x_items);
- RNA_def_property_ui_text(prop, "Align X", "Align the text along the X axis");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "align_y");
- RNA_def_property_enum_items(prop, text_align_y_items);
- RNA_def_property_ui_text(prop, "Align Y", "Align the image along the Y axis");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Text", "Text that will be displayed");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TEXT_SHADOW);
- RNA_def_property_ui_text(prop, "Shadow", "Draw text with shadow");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ static const EnumPropertyItem text_align_x_items[] = {
+ {SEQ_TEXT_ALIGN_X_LEFT, "LEFT", 0, "Left", ""},
+ {SEQ_TEXT_ALIGN_X_CENTER, "CENTER", 0, "Center", ""},
+ {SEQ_TEXT_ALIGN_X_RIGHT, "RIGHT", 0, "Right", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const EnumPropertyItem text_align_y_items[] = {
+ {SEQ_TEXT_ALIGN_Y_TOP, "TOP", 0, "Top", ""},
+ {SEQ_TEXT_ALIGN_Y_CENTER, "CENTER", 0, "Center", ""},
+ {SEQ_TEXT_ALIGN_Y_BOTTOM, "BOTTOM", 0, "Bottom", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "TextVars", "effectdata");
+
+ prop = RNA_def_property(srna, "font", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "text_font");
+ RNA_def_property_ui_icon(prop, ICON_FILE_FONT, false);
+ RNA_def_property_ui_text(prop, "Font", "Font of the text. Falls back to the UI font by default");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Sequence_text_font_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "text_size");
+ RNA_def_property_ui_text(prop, "Size", "Size of the text");
+ RNA_def_property_range(prop, 0.0, 2000);
+ RNA_def_property_ui_range(prop, 0.0f, 1000, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_ui_text(prop, "Color", "Text color");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shadow_color");
+ RNA_def_property_ui_text(prop, "Shadow Color", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Location", "Location of the text");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "wrap_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "wrap_width");
+ RNA_def_property_ui_text(prop, "Wrap Width", "Word wrap width as factor, zero disables");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "align_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align");
+ RNA_def_property_enum_items(prop, text_align_x_items);
+ RNA_def_property_ui_text(prop, "Align X", "Align the text along the X axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "align_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "align_y");
+ RNA_def_property_enum_items(prop, text_align_y_items);
+ RNA_def_property_ui_text(prop, "Align Y", "Align the image along the Y axis");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Text", "Text that will be displayed");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "use_shadow", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_TEXT_SHADOW);
+ RNA_def_property_ui_text(prop, "Shadow", "Draw text with shadow");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static void rna_def_color_mix(StructRNA *srna)
{
- static EnumPropertyItem blend_color_items[] = {
- {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
- {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
- {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
- {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""},
- {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""},
- {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""},
- {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""},
- {SEQ_TYPE_BURN, "BURN", 0, "Burn", ""},
- {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""},
- {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
- {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""},
- {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""},
- {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
- {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""},
- {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""},
- {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""},
- {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""},
- {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
- {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
- {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
-
- RNA_def_struct_sdna_from(srna, "ColorMixVars", "effectdata");
-
- prop = RNA_def_property(srna, "blend_effect", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "blend_effect");
- RNA_def_property_enum_items(prop, blend_color_items);
- RNA_def_property_ui_text(prop, "Blend Effect", "Method for controlling how the strip combines with other strips");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Blend Factor", "Percentage of how much the strip's colors affect other strips");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+ static EnumPropertyItem blend_color_items[] = {
+ {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
+ {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_TYPE_LIGHTEN, "LIGHTEN", 0, "Lighten", ""},
+ {SEQ_TYPE_DARKEN, "DARKEN", 0, "Darken", ""},
+ {SEQ_TYPE_SCREEN, "SCREEN", 0, "Screen", ""},
+ {SEQ_TYPE_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {SEQ_TYPE_DODGE, "DODGE", 0, "Dodge", ""},
+ {SEQ_TYPE_BURN, "BURN", 0, "Burn", ""},
+ {SEQ_TYPE_LINEAR_BURN, "LINEAR_BURN", 0, "Linear Burn", ""},
+ {SEQ_TYPE_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {SEQ_TYPE_HARD_LIGHT, "HARD_LIGHT", 0, "Hard Light", ""},
+ {SEQ_TYPE_PIN_LIGHT, "PIN_LIGHT", 0, "Pin Light", ""},
+ {SEQ_TYPE_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {SEQ_TYPE_VIVID_LIGHT, "VIVID_LIGHT", 0, "Vivid Light", ""},
+ {SEQ_TYPE_BLEND_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_TYPE_HUE, "HUE", 0, "Hue", ""},
+ {SEQ_TYPE_SATURATION, "SATURATION", 0, "Saturation", ""},
+ {SEQ_TYPE_VALUE, "VALUE", 0, "Value", ""},
+ {SEQ_TYPE_DIFFERENCE, "DIFFERENCE", 0, "Difference", ""},
+ {SEQ_TYPE_EXCLUSION, "EXCLUSION", 0, "Exclusion", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+
+ RNA_def_struct_sdna_from(srna, "ColorMixVars", "effectdata");
+
+ prop = RNA_def_property(srna, "blend_effect", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blend_effect");
+ RNA_def_property_enum_items(prop, blend_color_items);
+ RNA_def_property_ui_text(
+ prop, "Blend Effect", "Method for controlling how the strip combines with other strips");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Blend Factor", "Percentage of how much the strip's colors affect other strips");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_Sequence_update");
}
static EffectInfo def_effects[] = {
- {"AddSequence", "Add Sequence", "Add Sequence", NULL, 2},
- {"AdjustmentSequence", "Adjustment Layer Sequence",
- "Sequence strip to perform filter adjustments to layers below", rna_def_input, 0},
- {"AlphaOverSequence", "Alpha Over Sequence", "Alpha Over Sequence", NULL, 2},
- {"AlphaUnderSequence", "Alpha Under Sequence", "Alpha Under Sequence", NULL, 2},
- {"ColorSequence", "Color Sequence",
- "Sequence strip creating an image filled with a single color", rna_def_solid_color, 0},
- {"CrossSequence", "Cross Sequence", "Cross Sequence", NULL, 2},
- {"GammaCrossSequence", "Gamma Cross Sequence", "Gamma Cross Sequence", NULL, 2},
- {"GlowSequence", "Glow Sequence", "Sequence strip creating a glow effect", rna_def_glow, 1},
- {"MulticamSequence", "Multicam Select Sequence", "Sequence strip to perform multicam editing",
- rna_def_multicam, 0},
- {"MultiplySequence", "Multiply Sequence", "Multiply Sequence", NULL, 2},
- {"OverDropSequence", "Over Drop Sequence", "Over Drop Sequence", NULL, 2},
- {"SpeedControlSequence", "SpeedControl Sequence",
- "Sequence strip to control the speed of other strips", rna_def_speed_control, 1},
- {"SubtractSequence", "Subtract Sequence", "Subtract Sequence", NULL, 2},
- {"TransformSequence", "Transform Sequence",
- "Sequence strip applying affine transformations to other strips", rna_def_transform, 1},
- {"WipeSequence", "Wipe Sequence", "Sequence strip creating a wipe transition",
- rna_def_wipe, 2},
- {"GaussianBlurSequence", "Gaussian Blur Sequence", "Sequence strip creating a gaussian blur",
- rna_def_gaussian_blur, 1},
- {"TextSequence", "Text Sequence", "Sequence strip creating text",
- rna_def_text, 0},
- {"ColorMixSequence", "Color Mix Sequence", "Color Mix Sequence", rna_def_color_mix, 2},
- {"", "", "", NULL, 0},
+ {"AddSequence", "Add Sequence", "Add Sequence", NULL, 2},
+ {"AdjustmentSequence",
+ "Adjustment Layer Sequence",
+ "Sequence strip to perform filter adjustments to layers below",
+ rna_def_input,
+ 0},
+ {"AlphaOverSequence", "Alpha Over Sequence", "Alpha Over Sequence", NULL, 2},
+ {"AlphaUnderSequence", "Alpha Under Sequence", "Alpha Under Sequence", NULL, 2},
+ {"ColorSequence",
+ "Color Sequence",
+ "Sequence strip creating an image filled with a single color",
+ rna_def_solid_color,
+ 0},
+ {"CrossSequence", "Cross Sequence", "Cross Sequence", NULL, 2},
+ {"GammaCrossSequence", "Gamma Cross Sequence", "Gamma Cross Sequence", NULL, 2},
+ {"GlowSequence", "Glow Sequence", "Sequence strip creating a glow effect", rna_def_glow, 1},
+ {"MulticamSequence",
+ "Multicam Select Sequence",
+ "Sequence strip to perform multicam editing",
+ rna_def_multicam,
+ 0},
+ {"MultiplySequence", "Multiply Sequence", "Multiply Sequence", NULL, 2},
+ {"OverDropSequence", "Over Drop Sequence", "Over Drop Sequence", NULL, 2},
+ {"SpeedControlSequence",
+ "SpeedControl Sequence",
+ "Sequence strip to control the speed of other strips",
+ rna_def_speed_control,
+ 1},
+ {"SubtractSequence", "Subtract Sequence", "Subtract Sequence", NULL, 2},
+ {"TransformSequence",
+ "Transform Sequence",
+ "Sequence strip applying affine transformations to other strips",
+ rna_def_transform,
+ 1},
+ {"WipeSequence",
+ "Wipe Sequence",
+ "Sequence strip creating a wipe transition",
+ rna_def_wipe,
+ 2},
+ {"GaussianBlurSequence",
+ "Gaussian Blur Sequence",
+ "Sequence strip creating a gaussian blur",
+ rna_def_gaussian_blur,
+ 1},
+ {"TextSequence", "Text Sequence", "Sequence strip creating text", rna_def_text, 0},
+ {"ColorMixSequence", "Color Mix Sequence", "Color Mix Sequence", rna_def_color_mix, 2},
+ {"", "", "", NULL, 0},
};
static void rna_def_effects(BlenderRNA *brna)
{
- StructRNA *srna;
- EffectInfo *effect;
+ StructRNA *srna;
+ EffectInfo *effect;
- for (effect = def_effects; effect->struct_name[0] != '\0'; effect++) {
- srna = RNA_def_struct(brna, effect->struct_name, "EffectSequence");
- RNA_def_struct_ui_text(srna, effect->ui_name, effect->ui_desc);
- RNA_def_struct_sdna(srna, "Sequence");
+ for (effect = def_effects; effect->struct_name[0] != '\0'; effect++) {
+ srna = RNA_def_struct(brna, effect->struct_name, "EffectSequence");
+ RNA_def_struct_ui_text(srna, effect->ui_name, effect->ui_desc);
+ RNA_def_struct_sdna(srna, "Sequence");
- rna_def_effect_inputs(srna, effect->inputs);
+ rna_def_effect_inputs(srna, effect->inputs);
- if (effect->func)
- effect->func(srna);
- }
+ if (effect->func)
+ effect->func(srna);
+ }
}
static void rna_def_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem mask_input_type_items[] = {
- {SEQUENCE_MASK_INPUT_STRIP, "STRIP", 0, "Strip", "Use sequencer strip as mask input"},
- {SEQUENCE_MASK_INPUT_ID, "ID", 0, "Mask", "Use mask ID as mask input"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem mask_time_items[] = {
- {SEQUENCE_MASK_TIME_RELATIVE, "RELATIVE", 0, "Relative", "Mask animation is offset to start of strip"},
- {SEQUENCE_MASK_TIME_ABSOLUTE, "ABSOLUTE", 0, "Absolute", "Mask animation is in sync with scene frame"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SequenceModifier", NULL);
- RNA_def_struct_sdna(srna, "SequenceModifierData");
- RNA_def_struct_ui_text(srna, "SequenceModifier", "Modifier for sequence strip");
- RNA_def_struct_refine_func(srna, "rna_SequenceModifier_refine");
- RNA_def_struct_path_func(srna, "rna_SequenceModifier_path");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceModifier_name_set");
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_sequence_modifier_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_MUTE);
- RNA_def_property_ui_text(prop, "Mute", "Mute this modifier");
- RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_EXPANDED);
- RNA_def_property_ui_text(prop, "Expanded", "Mute expanded settings for the modifier");
- RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "input_mask_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mask_input_type");
- RNA_def_property_enum_items(prop, mask_input_type_items);
- RNA_def_property_ui_text(prop, "Mask Input Type", "Type of input data used for mask");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "mask_time", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mask_time");
- RNA_def_property_enum_items(prop, mask_time_items);
- RNA_def_property_ui_text(prop, "Mask Time", "Time to use for the Mask animation");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask Strip", "Strip used as mask input for the modifier");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "input_mask_id", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mask_id");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask", "Mask ID used as mask input for the modifier");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem mask_input_type_items[] = {
+ {SEQUENCE_MASK_INPUT_STRIP, "STRIP", 0, "Strip", "Use sequencer strip as mask input"},
+ {SEQUENCE_MASK_INPUT_ID, "ID", 0, "Mask", "Use mask ID as mask input"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem mask_time_items[] = {
+ {SEQUENCE_MASK_TIME_RELATIVE,
+ "RELATIVE",
+ 0,
+ "Relative",
+ "Mask animation is offset to start of strip"},
+ {SEQUENCE_MASK_TIME_ABSOLUTE,
+ "ABSOLUTE",
+ 0,
+ "Absolute",
+ "Mask animation is in sync with scene frame"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SequenceModifier", NULL);
+ RNA_def_struct_sdna(srna, "SequenceModifierData");
+ RNA_def_struct_ui_text(srna, "SequenceModifier", "Modifier for sequence strip");
+ RNA_def_struct_refine_func(srna, "rna_SequenceModifier_refine");
+ RNA_def_struct_path_func(srna, "rna_SequenceModifier_path");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SequenceModifier_name_set");
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_sequence_modifier_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_MUTE);
+ RNA_def_property_ui_text(prop, "Mute", "Mute this modifier");
+ RNA_def_property_ui_icon(prop, ICON_HIDE_OFF, -1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQUENCE_MODIFIER_EXPANDED);
+ RNA_def_property_ui_text(prop, "Expanded", "Mute expanded settings for the modifier");
+ RNA_def_property_ui_icon(prop, ICON_TRIA_RIGHT, 1);
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "input_mask_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_input_type");
+ RNA_def_property_enum_items(prop, mask_input_type_items);
+ RNA_def_property_ui_text(prop, "Mask Input Type", "Type of input data used for mask");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "mask_time", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_time");
+ RNA_def_property_enum_items(prop, mask_time_items);
+ RNA_def_property_ui_text(prop, "Mask Time", "Time to use for the Mask animation");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "input_mask_strip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_sequence");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_SequenceModifier_otherSequence_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask Strip", "Strip used as mask input for the modifier");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "input_mask_id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_id");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask", "Mask ID used as mask input for the modifier");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_colorbalance_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ColorBalanceModifier", "SequenceModifier");
- RNA_def_struct_sdna(srna, "ColorBalanceModifierData");
- RNA_def_struct_ui_text(srna, "ColorBalanceModifier", "Color balance modifier for sequence strip");
+ srna = RNA_def_struct(brna, "ColorBalanceModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "ColorBalanceModifierData");
+ RNA_def_struct_ui_text(
+ srna, "ColorBalanceModifier", "Color balance modifier for sequence strip");
- prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "SequenceColorBalanceData");
+ prop = RNA_def_property(srna, "color_balance", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "SequenceColorBalanceData");
- prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "color_multiply");
- RNA_def_property_range(prop, 0.0f, 20.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Multiply Colors", "Multiply the intensity of each pixel");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ prop = RNA_def_property(srna, "color_multiply", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "color_multiply");
+ RNA_def_property_range(prop, 0.0f, 20.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Multiply Colors", "Multiply the intensity of each pixel");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_whitebalance_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "WhiteBalanceModifier", "SequenceModifier");
- RNA_def_struct_sdna(srna, "WhiteBalanceModifierData");
- RNA_def_struct_ui_text(srna, "WhiteBalanceModifier", "White balance modifier for sequence strip");
+ srna = RNA_def_struct(brna, "WhiteBalanceModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "WhiteBalanceModifierData");
+ RNA_def_struct_ui_text(
+ srna, "WhiteBalanceModifier", "White balance modifier for sequence strip");
- prop = RNA_def_property(srna, "white_value", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "white_value");
- RNA_def_property_ui_text(prop, "White value", "This color defines white in the strip");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ prop = RNA_def_property(srna, "white_value", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "white_value");
+ RNA_def_property_ui_text(prop, "White value", "This color defines white in the strip");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_curves_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "CurvesModifier", "SequenceModifier");
- RNA_def_struct_sdna(srna, "CurvesModifierData");
- RNA_def_struct_ui_text(srna, "CurvesModifier", "RGB curves modifier for sequence strip");
+ srna = RNA_def_struct(brna, "CurvesModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "CurvesModifierData");
+ RNA_def_struct_ui_text(srna, "CurvesModifier", "RGB curves modifier for sequence strip");
- prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve Mapping", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Mapping", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_hue_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "HueCorrectModifier", "SequenceModifier");
- RNA_def_struct_sdna(srna, "HueCorrectModifierData");
- RNA_def_struct_ui_text(srna, "HueCorrectModifier", "Hue correction modifier for sequence strip");
+ srna = RNA_def_struct(brna, "HueCorrectModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "HueCorrectModifierData");
+ RNA_def_struct_ui_text(srna, "HueCorrectModifier", "Hue correction modifier for sequence strip");
- prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
- RNA_def_property_struct_type(prop, "CurveMapping");
- RNA_def_property_ui_text(prop, "Curve Mapping", "");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ prop = RNA_def_property(srna, "curve_mapping", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "curve_mapping");
+ RNA_def_property_struct_type(prop, "CurveMapping");
+ RNA_def_property_ui_text(prop, "Curve Mapping", "");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_brightcontrast_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "BrightContrastModifier", "SequenceModifier");
- RNA_def_struct_sdna(srna, "BrightContrastModifierData");
- RNA_def_struct_ui_text(srna, "BrightContrastModifier", "Bright/contrast modifier data for sequence strip");
+ srna = RNA_def_struct(brna, "BrightContrastModifier", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "BrightContrastModifierData");
+ RNA_def_struct_ui_text(
+ srna, "BrightContrastModifier", "Bright/contrast modifier data for sequence strip");
- prop = RNA_def_property(srna, "bright", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "bright");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Bright", "Adjust the luminosity of the colors");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ prop = RNA_def_property(srna, "bright", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "bright");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Bright", "Adjust the luminosity of the colors");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
- prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "contrast");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Contrast", "Adjust the difference in luminosity between pixels");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "contrast");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Contrast", "Adjust the difference in luminosity between pixels");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_tonemap_modifier(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem type_items[] = {
- {SEQ_TONEMAP_RD_PHOTORECEPTOR, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
- {SEQ_TONEMAP_RH_SIMPLE, "RH_SIMPLE", 0, "Rh Simple", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SequencerTonemapModifierData", "SequenceModifier");
- RNA_def_struct_sdna(srna, "SequencerTonemapModifierData");
- RNA_def_struct_ui_text(srna, "SequencerTonemapModifierData", "Tone mapping modifier");
-
- prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, type_items);
- RNA_def_property_ui_text(prop, "Tonemap Type", "Tone mapping algorithm");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001f, 10.0f);
- RNA_def_property_ui_text(prop, "Offset",
- "Normally always 1, but can be used as an extra control to alter the brightness curve");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001f, 3.0f);
- RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, -8.0f, 8.0f);
- RNA_def_property_ui_text(prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
-
- prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
- RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem type_items[] = {
+ {SEQ_TONEMAP_RD_PHOTORECEPTOR, "RD_PHOTORECEPTOR", 0, "R/D Photoreceptor", ""},
+ {SEQ_TONEMAP_RH_SIMPLE, "RH_SIMPLE", 0, "Rh Simple", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SequencerTonemapModifierData", "SequenceModifier");
+ RNA_def_struct_sdna(srna, "SequencerTonemapModifierData");
+ RNA_def_struct_ui_text(srna, "SequencerTonemapModifierData", "Tone mapping modifier");
+
+ prop = RNA_def_property(srna, "tonemap_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, type_items);
+ RNA_def_property_ui_text(prop, "Tonemap Type", "Tone mapping algorithm");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "key", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Key", "The value the average luminance is mapped to");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001f, 10.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Offset",
+ "Normally always 1, but can be used as an extra control to alter the brightness curve");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "gamma", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001f, 3.0f);
+ RNA_def_property_ui_text(prop, "Gamma", "If not used, set to 1");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, -8.0f, 8.0f);
+ RNA_def_property_ui_text(
+ prop, "Intensity", "If less than zero, darkens image; otherwise, makes it brighter");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Contrast", "Set to 0 to use estimate from input image");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "adaptation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Adaptation", "If 0, global; if 1, based on pixel intensity");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
+
+ prop = RNA_def_property(srna, "correction", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Color Correction", "If 0, same for all channels; if 1, each independent");
+ RNA_def_property_update(prop, NC_SCENE | ND_SEQUENCER, "rna_SequenceModifier_update");
}
static void rna_def_modifiers(BlenderRNA *brna)
{
- rna_def_modifier(brna);
+ rna_def_modifier(brna);
- rna_def_colorbalance_modifier(brna);
- rna_def_curves_modifier(brna);
- rna_def_hue_modifier(brna);
- rna_def_brightcontrast_modifier(brna);
- rna_def_whitebalance_modifier(brna);
- rna_def_tonemap_modifier(brna);
+ rna_def_colorbalance_modifier(brna);
+ rna_def_curves_modifier(brna);
+ rna_def_hue_modifier(brna);
+ rna_def_brightcontrast_modifier(brna);
+ rna_def_whitebalance_modifier(brna);
+ rna_def_tonemap_modifier(brna);
}
void RNA_def_sequencer(BlenderRNA *brna)
{
- rna_def_color_balance(brna);
-
- rna_def_strip_element(brna);
- rna_def_strip_proxy(brna);
- rna_def_strip_color_balance(brna);
- rna_def_strip_crop(brna);
- rna_def_strip_transform(brna);
-
- rna_def_sequence(brna);
- rna_def_editor(brna);
-
- rna_def_image(brna);
- rna_def_meta(brna);
- rna_def_scene(brna);
- rna_def_movie(brna);
- rna_def_movieclip(brna);
- rna_def_mask(brna);
- rna_def_sound(brna);
- rna_def_effect(brna);
- rna_def_effects(brna);
- rna_def_modifiers(brna);
+ rna_def_color_balance(brna);
+
+ rna_def_strip_element(brna);
+ rna_def_strip_proxy(brna);
+ rna_def_strip_color_balance(brna);
+ rna_def_strip_crop(brna);
+ rna_def_strip_transform(brna);
+
+ rna_def_sequence(brna);
+ rna_def_editor(brna);
+
+ rna_def_image(brna);
+ rna_def_meta(brna);
+ rna_def_scene(brna);
+ rna_def_movie(brna);
+ rna_def_movieclip(brna);
+ rna_def_mask(brna);
+ rna_def_sound(brna);
+ rna_def_effect(brna);
+ rna_def_effects(brna);
+ rna_def_modifiers(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sequencer_api.c b/source/blender/makesrna/intern/rna_sequencer_api.c
index b93bfdfe137..3fc46bf1225 100644
--- a/source/blender/makesrna/intern/rna_sequencer_api.c
+++ b/source/blender/makesrna/intern/rna_sequencer_api.c
@@ -35,582 +35,672 @@
#ifdef RNA_RUNTIME
//#include "DNA_anim_types.h"
-#include "DNA_image_types.h"
-#include "DNA_mask_types.h"
-#include "DNA_sound_types.h"
+# include "DNA_image_types.h"
+# include "DNA_mask_types.h"
+# include "DNA_sound_types.h"
-#include "BLI_path_util.h" /* BLI_split_dirfile */
+# include "BLI_path_util.h" /* BLI_split_dirfile */
-#include "BKE_image.h"
-#include "BKE_mask.h"
-#include "BKE_movieclip.h"
+# include "BKE_image.h"
+# include "BKE_mask.h"
+# include "BKE_movieclip.h"
-#include "BKE_report.h"
-#include "BKE_sequencer.h"
-#include "BKE_sound.h"
+# include "BKE_report.h"
+# include "BKE_sequencer.h"
+# include "BKE_sound.h"
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
+# include "IMB_imbuf.h"
+# include "IMB_imbuf_types.h"
-#include "WM_api.h"
+# include "WM_api.h"
static void rna_Sequence_update_rnafunc(ID *id, Sequence *self, bool do_data)
{
- if (do_data) {
- BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true);
- // new_tstripdata(self); // need 2.6x version of this.
- }
- BKE_sequence_calc((Scene *)id, self);
- BKE_sequence_calc_disp((Scene *)id, self);
+ if (do_data) {
+ BKE_sequencer_update_changed_seq_and_deps((Scene *)id, self, true, true);
+ // new_tstripdata(self); // need 2.6x version of this.
+ }
+ BKE_sequence_calc((Scene *)id, self);
+ BKE_sequence_calc_disp((Scene *)id, self);
}
-static void rna_Sequence_swap_internal(Sequence *seq_self, ReportList *reports, Sequence *seq_other)
+static void rna_Sequence_swap_internal(Sequence *seq_self,
+ ReportList *reports,
+ Sequence *seq_other)
{
- const char *error_msg;
+ const char *error_msg;
- if (BKE_sequence_swap(seq_self, seq_other, &error_msg) == 0)
- BKE_report(reports, RPT_ERROR, error_msg);
+ if (BKE_sequence_swap(seq_self, seq_other, &error_msg) == 0)
+ BKE_report(reports, RPT_ERROR, error_msg);
}
-static Sequence *alloc_generic_sequence(Editing *ed, const char *name, int frame_start,
- int channel, int type, const char *file)
+static Sequence *alloc_generic_sequence(
+ Editing *ed, const char *name, int frame_start, int channel, int type, const char *file)
{
- Sequence *seq;
- Strip *strip;
- StripElem *se;
+ Sequence *seq;
+ Strip *strip;
+ StripElem *se;
- seq = BKE_sequence_alloc(ed->seqbasep, frame_start, channel);
- seq->type = type;
+ seq = BKE_sequence_alloc(ed->seqbasep, frame_start, channel);
+ seq->type = type;
- BLI_strncpy(seq->name + 2, name, sizeof(seq->name) - 2);
- BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
+ BLI_strncpy(seq->name + 2, name, sizeof(seq->name) - 2);
+ BKE_sequence_base_unique_name_recursive(&ed->seqbase, seq);
- seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
- seq->strip->us = 1;
+ seq->strip = strip = MEM_callocN(sizeof(Strip), "strip");
+ seq->strip->us = 1;
- if (file) {
- strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
- BLI_split_dirfile(file, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
+ if (file) {
+ strip->stripdata = se = MEM_callocN(sizeof(StripElem), "stripelem");
+ BLI_split_dirfile(file, strip->dir, se->name, sizeof(strip->dir), sizeof(se->name));
- BKE_sequence_init_colorspace(seq);
- }
- else {
- strip->stripdata = NULL;
- }
+ BKE_sequence_init_colorspace(seq);
+ }
+ else {
+ strip->stripdata = NULL;
+ }
- return seq;
+ return seq;
}
-static Sequence *rna_Sequences_new_clip(ID *id, Editing *ed,
- const char *name, MovieClip *clip, int channel,
- int frame_start)
+static Sequence *rna_Sequences_new_clip(
+ ID *id, Editing *ed, const char *name, MovieClip *clip, int channel, int frame_start)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
- seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIECLIP, clip->name);
- seq->clip = clip;
- seq->len = BKE_movieclip_get_duration(clip);
- id_us_plus((ID *)clip);
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIECLIP, clip->name);
+ seq->clip = clip;
+ seq->len = BKE_movieclip_get_duration(clip);
+ id_us_plus((ID *)clip);
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return seq;
+ return seq;
}
-static Sequence *rna_Sequences_new_mask(ID *id, Editing *ed,
- const char *name, Mask *mask, int channel,
- int frame_start)
+static Sequence *rna_Sequences_new_mask(
+ ID *id, Editing *ed, const char *name, Mask *mask, int channel, int frame_start)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
- seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MASK, mask->id.name);
- seq->mask = mask;
- seq->len = BKE_mask_get_duration(mask);
- id_us_plus((ID *)mask);
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MASK, mask->id.name);
+ seq->mask = mask;
+ seq->len = BKE_mask_get_duration(mask);
+ id_us_plus((ID *)mask);
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return seq;
+ return seq;
}
-static Sequence *rna_Sequences_new_scene(ID *id, Editing *ed,
- const char *name, Scene *sce_seq, int channel,
- int frame_start)
+static Sequence *rna_Sequences_new_scene(
+ ID *id, Editing *ed, const char *name, Scene *sce_seq, int channel, int frame_start)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
- seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL);
- seq->scene = sce_seq;
- seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
- seq->scene_sound = BKE_sound_scene_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0);
- id_us_plus((ID *)sce_seq);
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SCENE, NULL);
+ seq->scene = sce_seq;
+ seq->len = sce_seq->r.efra - sce_seq->r.sfra + 1;
+ seq->scene_sound = BKE_sound_scene_add_scene_sound(
+ scene, seq, frame_start, frame_start + seq->len, 0);
+ id_us_plus((ID *)sce_seq);
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return seq;
+ return seq;
}
-static Sequence *rna_Sequences_new_image(ID *id, Editing *ed, ReportList *reports,
- const char *name, const char *file, int channel,
+static Sequence *rna_Sequences_new_image(ID *id,
+ Editing *ed,
+ ReportList *reports,
+ const char *name,
+ const char *file,
+ int channel,
int frame_start)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
- seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_IMAGE, file);
- seq->len = 1;
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_IMAGE, file);
+ seq->len = 1;
- if (seq->strip->stripdata->name[0] == '\0') {
- BKE_report(reports, RPT_ERROR, "Sequences.new_image: unable to open image file");
- BLI_remlink(&ed->seqbase, seq);
- BKE_sequence_free(scene, seq);
- return NULL;
- }
+ if (seq->strip->stripdata->name[0] == '\0') {
+ BKE_report(reports, RPT_ERROR, "Sequences.new_image: unable to open image file");
+ BLI_remlink(&ed->seqbase, seq);
+ BKE_sequence_free(scene, seq);
+ return NULL;
+ }
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return seq;
+ return seq;
}
-static Sequence *rna_Sequences_new_movie(ID *id, Editing *ed, ReportList *reports,
- const char *name, const char *file, int channel,
+static Sequence *rna_Sequences_new_movie(ID *id,
+ Editing *ed,
+ ReportList *reports,
+ const char *name,
+ const char *file,
+ int channel,
int frame_start)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
- StripAnim *sanim;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
+ StripAnim *sanim;
- struct anim *an = openanim(file, IB_rect, 0, NULL);
+ struct anim *an = openanim(file, IB_rect, 0, NULL);
- if (an == NULL) {
- BKE_report(reports, RPT_ERROR, "Sequences.new_movie: unable to open movie file");
- return NULL;
- }
+ if (an == NULL) {
+ BKE_report(reports, RPT_ERROR, "Sequences.new_movie: unable to open movie file");
+ return NULL;
+ }
- seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file);
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_MOVIE, file);
- sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim");
- BLI_addtail(&seq->anims, sanim);
- sanim->anim = an;
+ sanim = MEM_mallocN(sizeof(StripAnim), "Strip Anim");
+ BLI_addtail(&seq->anims, sanim);
+ sanim->anim = an;
- seq->anim_preseek = IMB_anim_get_preseek(an);
- seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
+ seq->anim_preseek = IMB_anim_get_preseek(an);
+ seq->len = IMB_anim_get_duration(an, IMB_TC_RECORD_RUN);
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return seq;
+ return seq;
}
-#ifdef WITH_AUDASPACE
-static Sequence *rna_Sequences_new_sound(ID *id, Editing *ed, Main *bmain, ReportList *reports,
- const char *name, const char *file, int channel, int frame_start)
+# ifdef WITH_AUDASPACE
+static Sequence *rna_Sequences_new_sound(ID *id,
+ Editing *ed,
+ Main *bmain,
+ ReportList *reports,
+ const char *name,
+ const char *file,
+ int channel,
+ int frame_start)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
- bSound *sound = BKE_sound_new_file(bmain, file);
+ bSound *sound = BKE_sound_new_file(bmain, file);
- if (sound->playback_handle == NULL) {
- BKE_id_free(bmain, sound);
- BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
- return NULL;
- }
+ if (sound->playback_handle == NULL) {
+ BKE_id_free(bmain, sound);
+ BKE_report(reports, RPT_ERROR, "Sequences.new_sound: unable to open sound file");
+ return NULL;
+ }
- seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name);
- seq->sound = sound;
- seq->len = ceil((double)BKE_sound_get_length(sound) * FPS);
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, SEQ_TYPE_SOUND_RAM, sound->name);
+ seq->sound = sound;
+ seq->len = ceil((double)BKE_sound_get_length(sound) * FPS);
- seq->scene_sound = BKE_sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0);
+ seq->scene_sound = BKE_sound_add_scene_sound(scene, seq, frame_start, frame_start + seq->len, 0);
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return seq;
+ return seq;
}
-#else /* WITH_AUDASPACE */
-static Sequence *rna_Sequences_new_sound(ID *UNUSED(id), Editing *UNUSED(ed), Main *UNUSED(bmain), ReportList *reports,
- const char *UNUSED(name), const char *UNUSED(file), int UNUSED(channel),
+# else /* WITH_AUDASPACE */
+static Sequence *rna_Sequences_new_sound(ID *UNUSED(id),
+ Editing *UNUSED(ed),
+ Main *UNUSED(bmain),
+ ReportList *reports,
+ const char *UNUSED(name),
+ const char *UNUSED(file),
+ int UNUSED(channel),
int UNUSED(frame_start))
{
- BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
- return NULL;
+ BKE_report(reports, RPT_ERROR, "Blender compiled without Audaspace support");
+ return NULL;
}
-#endif /* WITH_AUDASPACE */
-
-static Sequence *rna_Sequences_new_effect(ID *id, Editing *ed, ReportList *reports,
- const char *name, int type, int channel,
- int frame_start, int frame_end,
- Sequence *seq1, Sequence *seq2, Sequence *seq3)
+# endif /* WITH_AUDASPACE */
+
+static Sequence *rna_Sequences_new_effect(ID *id,
+ Editing *ed,
+ ReportList *reports,
+ const char *name,
+ int type,
+ int channel,
+ int frame_start,
+ int frame_end,
+ Sequence *seq1,
+ Sequence *seq2,
+ Sequence *seq3)
{
- Scene *scene = (Scene *)id;
- Sequence *seq;
- struct SeqEffectHandle sh;
- int num_inputs = BKE_sequence_effect_get_num_inputs(type);
-
- switch (num_inputs) {
- case 0:
- if (frame_end <= frame_start) {
- BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set");
- return NULL;
- }
- break;
- case 1:
- if (seq1 == NULL) {
- BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 1 input sequence");
- return NULL;
- }
- break;
- case 2:
- if (seq1 == NULL || seq2 == NULL) {
- BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 2 input sequences");
- return NULL;
- }
- break;
- case 3:
- if (seq1 == NULL || seq2 == NULL || seq3 == NULL) {
- BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
- return NULL;
- }
- break;
- default:
- BKE_reportf(reports, RPT_ERROR,
- "Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)",
- num_inputs);
- return NULL;
- }
-
- seq = alloc_generic_sequence(ed, name, frame_start, channel, type, NULL);
-
- sh = BKE_sequence_get_effect(seq);
-
- seq->seq1 = seq1;
- seq->seq2 = seq2;
- seq->seq3 = seq3;
-
- sh.init(seq);
-
- if (!seq1) { /* effect has no deps */
- seq->len = 1;
- BKE_sequence_tx_set_final_right(seq, frame_end);
- }
-
- seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
-
- BKE_sequence_calc(scene, seq);
- BKE_sequence_calc_disp(scene, seq);
-
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
-
- return seq;
+ Scene *scene = (Scene *)id;
+ Sequence *seq;
+ struct SeqEffectHandle sh;
+ int num_inputs = BKE_sequence_effect_get_num_inputs(type);
+
+ switch (num_inputs) {
+ case 0:
+ if (frame_end <= frame_start) {
+ BKE_report(reports, RPT_ERROR, "Sequences.new_effect: end frame not set");
+ return NULL;
+ }
+ break;
+ case 1:
+ if (seq1 == NULL) {
+ BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 1 input sequence");
+ return NULL;
+ }
+ break;
+ case 2:
+ if (seq1 == NULL || seq2 == NULL) {
+ BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 2 input sequences");
+ return NULL;
+ }
+ break;
+ case 3:
+ if (seq1 == NULL || seq2 == NULL || seq3 == NULL) {
+ BKE_report(reports, RPT_ERROR, "Sequences.new_effect: effect takes 3 input sequences");
+ return NULL;
+ }
+ break;
+ default:
+ BKE_reportf(
+ reports,
+ RPT_ERROR,
+ "Sequences.new_effect: effect expects more than 3 inputs (%d, should never happen!)",
+ num_inputs);
+ return NULL;
+ }
+
+ seq = alloc_generic_sequence(ed, name, frame_start, channel, type, NULL);
+
+ sh = BKE_sequence_get_effect(seq);
+
+ seq->seq1 = seq1;
+ seq->seq2 = seq2;
+ seq->seq3 = seq3;
+
+ sh.init(seq);
+
+ if (!seq1) { /* effect has no deps */
+ seq->len = 1;
+ BKE_sequence_tx_set_final_right(seq, frame_end);
+ }
+
+ seq->flag |= SEQ_USE_EFFECT_DEFAULT_FADE;
+
+ BKE_sequence_calc(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
+
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+
+ return seq;
}
static void rna_Sequences_remove(ID *id, Editing *ed, ReportList *reports, PointerRNA *seq_ptr)
{
- Sequence *seq = seq_ptr->data;
- Scene *scene = (Scene *)id;
+ Sequence *seq = seq_ptr->data;
+ Scene *scene = (Scene *)id;
- if (BLI_remlink_safe(&ed->seqbase, seq) == false) {
- BKE_reportf(reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2);
- return;
- }
+ if (BLI_remlink_safe(&ed->seqbase, seq) == false) {
+ BKE_reportf(
+ reports, RPT_ERROR, "Sequence '%s' not in scene '%s'", seq->name + 2, scene->id.name + 2);
+ return;
+ }
- BKE_sequence_free(scene, seq);
- RNA_POINTER_INVALIDATE(seq_ptr);
+ BKE_sequence_free(scene, seq);
+ RNA_POINTER_INVALIDATE(seq_ptr);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
}
static StripElem *rna_SequenceElements_append(ID *id, Sequence *seq, const char *filename)
{
- Scene *scene = (Scene *)id;
- StripElem *se;
+ Scene *scene = (Scene *)id;
+ StripElem *se;
- seq->strip->stripdata = se = MEM_reallocN(seq->strip->stripdata, sizeof(StripElem) * (seq->len + 1));
- se += seq->len;
- BLI_strncpy(se->name, filename, sizeof(se->name));
- seq->len++;
+ seq->strip->stripdata = se = MEM_reallocN(seq->strip->stripdata,
+ sizeof(StripElem) * (seq->len + 1));
+ se += seq->len;
+ BLI_strncpy(se->name, filename, sizeof(se->name));
+ seq->len++;
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
- return se;
+ return se;
}
static void rna_SequenceElements_pop(ID *id, Sequence *seq, ReportList *reports, int index)
{
- Scene *scene = (Scene *)id;
- StripElem *new_seq, *se;
+ Scene *scene = (Scene *)id;
+ StripElem *new_seq, *se;
- if (seq->len == 1) {
- BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element");
- return;
- }
+ if (seq->len == 1) {
+ BKE_report(reports, RPT_ERROR, "SequenceElements.pop: cannot pop the last element");
+ return;
+ }
- /* python style negative indexing */
- if (index < 0) {
- index += seq->len;
- }
+ /* python style negative indexing */
+ if (index < 0) {
+ index += seq->len;
+ }
- if (seq->len <= index || index < 0) {
- BKE_report(reports, RPT_ERROR, "SequenceElements.pop: index out of range");
- return;
- }
+ if (seq->len <= index || index < 0) {
+ BKE_report(reports, RPT_ERROR, "SequenceElements.pop: index out of range");
+ return;
+ }
- new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop");
- seq->len--;
+ new_seq = MEM_callocN(sizeof(StripElem) * (seq->len - 1), "SequenceElements_pop");
+ seq->len--;
- se = seq->strip->stripdata;
- if (index > 0)
- memcpy(new_seq, se, sizeof(StripElem) * index);
+ se = seq->strip->stripdata;
+ if (index > 0)
+ memcpy(new_seq, se, sizeof(StripElem) * index);
- if (index < seq->len)
- memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index));
+ if (index < seq->len)
+ memcpy(&new_seq[index], &se[index + 1], sizeof(StripElem) * (seq->len - index));
- MEM_freeN(seq->strip->stripdata);
- seq->strip->stripdata = new_seq;
+ MEM_freeN(seq->strip->stripdata);
+ seq->strip->stripdata = new_seq;
- BKE_sequence_calc_disp(scene, seq);
+ BKE_sequence_calc_disp(scene, seq);
- WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
+ WM_main_add_notifier(NC_SCENE | ND_SEQUENCER, scene);
}
-
#else
void RNA_api_sequence_strip(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Update the strip dimensions");
- parm = RNA_def_boolean(func, "data", false, "Data",
- "Update strip data");
-
- func = RNA_def_function(srna, "strip_elem_from_frame", "BKE_sequencer_give_stripelem");
- RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
- parm = RNA_def_int(func, "frame", 0, -MAXFRAME, MAXFRAME, "Frame",
- "The frame to get the strip element from", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_return(func, RNA_def_pointer(func, "elem", "SequenceElement", "",
- "strip element of the current frame"));
-
- func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "update", "rna_Sequence_update_rnafunc");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Update the strip dimensions");
+ parm = RNA_def_boolean(func, "data", false, "Data", "Update strip data");
+
+ func = RNA_def_function(srna, "strip_elem_from_frame", "BKE_sequencer_give_stripelem");
+ RNA_def_function_ui_description(func, "Return the strip element from a given frame or None");
+ parm = RNA_def_int(func,
+ "frame",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "Frame",
+ "The frame to get the strip element from",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_return(
+ func,
+ RNA_def_pointer(func, "elem", "SequenceElement", "", "strip element of the current frame"));
+
+ func = RNA_def_function(srna, "swap", "rna_Sequence_swap_internal");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "other", "Sequence", "Other", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
}
void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "SequenceElements");
- srna = RNA_def_struct(brna, "SequenceElements", NULL);
- RNA_def_struct_sdna(srna, "Sequence");
- RNA_def_struct_ui_text(srna, "SequenceElements", "Collection of SequenceElement");
-
- func = RNA_def_function(srna, "append", "rna_SequenceElements_append");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Push an image from ImageSequence.directory");
- parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "elem", "SequenceElement", "", "New SequenceElement");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "pop", "rna_SequenceElements_pop");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Pop an image off the collection");
- parm = RNA_def_int(func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "SequenceElements");
+ srna = RNA_def_struct(brna, "SequenceElements", NULL);
+ RNA_def_struct_sdna(srna, "Sequence");
+ RNA_def_struct_ui_text(srna, "SequenceElements", "Collection of SequenceElement");
+
+ func = RNA_def_function(srna, "append", "rna_SequenceElements_append");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Push an image from ImageSequence.directory");
+ parm = RNA_def_string(func, "filename", "File", 0, "", "Filepath to image");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "elem", "SequenceElement", "", "New SequenceElement");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "pop", "rna_SequenceElements_pop");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Pop an image off the collection");
+ parm = RNA_def_int(
+ func, "index", -1, INT_MIN, INT_MAX, "", "Index of image to remove", INT_MIN, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- static const EnumPropertyItem seq_effect_items[] = {
- {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
- {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
- {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
- {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
- {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
- {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
- {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
- {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
- {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
- {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
- {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
- {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
- {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
- {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
- {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
- {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
- {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
- {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- RNA_def_property_srna(cprop, "Sequences");
- srna = RNA_def_struct(brna, "Sequences", NULL);
- RNA_def_struct_sdna(srna, "Editing");
- RNA_def_struct_ui_text(srna, "Sequences", "Collection of Sequences");
-
- func = RNA_def_function(srna, "new_clip", "rna_Sequences_new_clip");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new movie clip sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "",
- "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_mask", "rna_Sequences_new_mask");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new mask sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "",
- "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_scene", "rna_Sequences_new_scene");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new scene sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "",
- "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_image", "rna_Sequences_new_image");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new image sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "",
- "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_movie", "rna_Sequences_new_movie");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new movie sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "",
- "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_sound", "rna_Sequences_new_sound");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- RNA_def_function_ui_description(func, "Add a new sound sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, -MAXFRAME, MAXFRAME, "",
- "The start frame for the new sequence", -MAXFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_effect", "rna_Sequences_new_effect");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Add a new effect sequence");
- parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type",
- "type for the new sequence");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "channel", 0, 1, MAXSEQ, "Channel",
- "The channel for the new sequence", 1, MAXSEQ);
- /* don't use MAXFRAME since it makes importer scripts fail */
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "frame_start", 0, INT_MIN, INT_MAX, "",
- "The start frame for the new sequence", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "frame_end", 0, INT_MIN, INT_MAX, "",
- "The end frame for the new sequence", INT_MIN, INT_MAX);
- RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
- RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
- RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
- /* return type */
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
- RNA_def_function_return(func, parm);
-
-
- func = RNA_def_function(srna, "remove", "rna_Sequences_remove");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove a Sequence");
- parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ StructRNA *srna;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ static const EnumPropertyItem seq_effect_items[] = {
+ {SEQ_TYPE_CROSS, "CROSS", 0, "Cross", ""},
+ {SEQ_TYPE_ADD, "ADD", 0, "Add", ""},
+ {SEQ_TYPE_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {SEQ_TYPE_ALPHAOVER, "ALPHA_OVER", 0, "Alpha Over", ""},
+ {SEQ_TYPE_ALPHAUNDER, "ALPHA_UNDER", 0, "Alpha Under", ""},
+ {SEQ_TYPE_GAMCROSS, "GAMMA_CROSS", 0, "Gamma Cross", ""},
+ {SEQ_TYPE_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {SEQ_TYPE_OVERDROP, "OVER_DROP", 0, "Over Drop", ""},
+ {SEQ_TYPE_WIPE, "WIPE", 0, "Wipe", ""},
+ {SEQ_TYPE_GLOW, "GLOW", 0, "Glow", ""},
+ {SEQ_TYPE_TRANSFORM, "TRANSFORM", 0, "Transform", ""},
+ {SEQ_TYPE_COLOR, "COLOR", 0, "Color", ""},
+ {SEQ_TYPE_SPEED, "SPEED", 0, "Speed", ""},
+ {SEQ_TYPE_MULTICAM, "MULTICAM", 0, "Multicam Selector", ""},
+ {SEQ_TYPE_ADJUSTMENT, "ADJUSTMENT", 0, "Adjustment Layer", ""},
+ {SEQ_TYPE_GAUSSIAN_BLUR, "GAUSSIAN_BLUR", 0, "Gaussian Blur", ""},
+ {SEQ_TYPE_TEXT, "TEXT", 0, "Text", ""},
+ {SEQ_TYPE_COLORMIX, "COLORMIX", 0, "Color Mix", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ RNA_def_property_srna(cprop, "Sequences");
+ srna = RNA_def_struct(brna, "Sequences", NULL);
+ RNA_def_struct_sdna(srna, "Editing");
+ RNA_def_struct_ui_text(srna, "Sequences", "Collection of Sequences");
+
+ func = RNA_def_function(srna, "new_clip", "rna_Sequences_new_clip");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new movie clip sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "clip", "MovieClip", "", "Movie clip to add");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The start frame for the new sequence",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_mask", "rna_Sequences_new_mask");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new mask sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "mask", "Mask", "", "Mask to add");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The start frame for the new sequence",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_scene", "rna_Sequences_new_scene");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new scene sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "scene", "Scene", "", "Scene to add");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The start frame for the new sequence",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_image", "rna_Sequences_new_image");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new image sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to image");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The start frame for the new sequence",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_movie", "rna_Sequences_new_movie");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new movie sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The start frame for the new sequence",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_sound", "rna_Sequences_new_sound");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add a new sound sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "filepath", "File", 0, "", "Filepath to movie");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ -MAXFRAME,
+ MAXFRAME,
+ "",
+ "The start frame for the new sequence",
+ -MAXFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_effect", "rna_Sequences_new_effect");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Add a new effect sequence");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "Name for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", seq_effect_items, 0, "Type", "type for the new sequence");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "channel", 0, 1, MAXSEQ, "Channel", "The channel for the new sequence", 1, MAXSEQ);
+ /* don't use MAXFRAME since it makes importer scripts fail */
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func,
+ "frame_start",
+ 0,
+ INT_MIN,
+ INT_MAX,
+ "",
+ "The start frame for the new sequence",
+ INT_MIN,
+ INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func,
+ "frame_end",
+ 0,
+ INT_MIN,
+ INT_MAX,
+ "",
+ "The end frame for the new sequence",
+ INT_MIN,
+ INT_MAX);
+ RNA_def_pointer(func, "seq1", "Sequence", "", "Sequence 1 for effect");
+ RNA_def_pointer(func, "seq2", "Sequence", "", "Sequence 2 for effect");
+ RNA_def_pointer(func, "seq3", "Sequence", "", "Sequence 3 for effect");
+ /* return type */
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "New Sequence");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_Sequences_remove");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove a Sequence");
+ parm = RNA_def_pointer(func, "sequence", "Sequence", "", "Sequence to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_shader_fx.c b/source/blender/makesrna/intern/rna_shader_fx.c
index 41e87f6d121..6c610a92093 100644
--- a/source/blender/makesrna/intern/rna_shader_fx.c
+++ b/source/blender/makesrna/intern/rna_shader_fx.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <float.h>
#include <limits.h>
#include <stdlib.h>
@@ -45,661 +44,670 @@
#include "WM_types.h"
const EnumPropertyItem rna_enum_object_shaderfx_type_items[] = {
- {eShaderFxType_Blur, "FX_BLUR", ICON_SHADERFX, "Blur", "Apply Gaussian Blur to object" },
- {eShaderFxType_Colorize, "FX_COLORIZE", ICON_SHADERFX, "Colorize", "Apply different tint effects" },
- {eShaderFxType_Flip, "FX_FLIP", ICON_SHADERFX, "Flip", "Flip image" },
- {eShaderFxType_Glow, "FX_GLOW", ICON_SHADERFX, "Glow", "Create a glow effect" },
- {eShaderFxType_Light, "FX_LIGHT", ICON_SHADERFX, "Light", "Simulate illumination" },
- {eShaderFxType_Pixel, "FX_PIXEL", ICON_SHADERFX, "Pixelate", "Pixelate image"},
- {eShaderFxType_Rim, "FX_RIM", ICON_SHADERFX, "Rim", "Add a rim to the image" },
- {eShaderFxType_Shadow, "FX_SHADOW", ICON_SHADERFX, "Shadow", "Create a shadow effect"},
- {eShaderFxType_Swirl, "FX_SWIRL", ICON_SHADERFX, "Swirl", "Create a rotation distortion"},
- {eShaderFxType_Wave, "FX_WAVE", ICON_SHADERFX, "Wave Distortion", "Apply sinusoidal deformation"},
- {0, NULL, 0, NULL, NULL},
+ {eShaderFxType_Blur, "FX_BLUR", ICON_SHADERFX, "Blur", "Apply Gaussian Blur to object"},
+ {eShaderFxType_Colorize,
+ "FX_COLORIZE",
+ ICON_SHADERFX,
+ "Colorize",
+ "Apply different tint effects"},
+ {eShaderFxType_Flip, "FX_FLIP", ICON_SHADERFX, "Flip", "Flip image"},
+ {eShaderFxType_Glow, "FX_GLOW", ICON_SHADERFX, "Glow", "Create a glow effect"},
+ {eShaderFxType_Light, "FX_LIGHT", ICON_SHADERFX, "Light", "Simulate illumination"},
+ {eShaderFxType_Pixel, "FX_PIXEL", ICON_SHADERFX, "Pixelate", "Pixelate image"},
+ {eShaderFxType_Rim, "FX_RIM", ICON_SHADERFX, "Rim", "Add a rim to the image"},
+ {eShaderFxType_Shadow, "FX_SHADOW", ICON_SHADERFX, "Shadow", "Create a shadow effect"},
+ {eShaderFxType_Swirl, "FX_SWIRL", ICON_SHADERFX, "Swirl", "Create a rotation distortion"},
+ {eShaderFxType_Wave,
+ "FX_WAVE",
+ ICON_SHADERFX,
+ "Wave Distortion",
+ "Apply sinusoidal deformation"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_shaderfx_rim_modes_items[] = {
- {eShaderFxRimMode_Normal, "NORMAL", 0, "Regular", "" },
- {eShaderFxRimMode_Overlay, "OVERLAY", 0, "Overlay", "" },
- {eShaderFxRimMode_Add, "ADD", 0, "Add", "" },
- {eShaderFxRimMode_Subtract, "SUBTRACT", 0, "Subtract", "" },
- {eShaderFxRimMode_Multiply, "MULTIPLY", 0, "Multiply", "" },
- {eShaderFxRimMode_Divide, "DIVIDE", 0, "Divide", "" },
- {0, NULL, 0, NULL, NULL }
-};
+ {eShaderFxRimMode_Normal, "NORMAL", 0, "Regular", ""},
+ {eShaderFxRimMode_Overlay, "OVERLAY", 0, "Overlay", ""},
+ {eShaderFxRimMode_Add, "ADD", 0, "Add", ""},
+ {eShaderFxRimMode_Subtract, "SUBTRACT", 0, "Subtract", ""},
+ {eShaderFxRimMode_Multiply, "MULTIPLY", 0, "Multiply", ""},
+ {eShaderFxRimMode_Divide, "DIVIDE", 0, "Divide", ""},
+ {0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem rna_enum_shaderfx_glow_modes_items[] = {
- {eShaderFxGlowMode_Luminance, "LUMINANCE", 0, "Luminance", "" },
- {eShaderFxGlowMode_Color, "COLOR", 0, "Color", "" },
- {0, NULL, 0, NULL, NULL }
-};
+ {eShaderFxGlowMode_Luminance, "LUMINANCE", 0, "Luminance", ""},
+ {eShaderFxGlowMode_Color, "COLOR", 0, "Color", ""},
+ {0, NULL, 0, NULL, NULL}};
static const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
- {eShaderFxColorizeMode_GrayScale, "GRAYSCALE", 0, "Gray Scale", "" },
- {eShaderFxColorizeMode_Sepia, "SEPIA", 0, "Sepia", "" },
- {eShaderFxColorizeMode_Duotone, "DUOTONE", 0, "Duotone", "" },
- {eShaderFxColorizeMode_Transparent, "TRANSPARENT", 0, "Transparent", "" },
- {eShaderFxColorizeMode_Custom, "CUSTOM", 0, "Custom", "" },
- {0, NULL, 0, NULL, NULL }
-};
+ {eShaderFxColorizeMode_GrayScale, "GRAYSCALE", 0, "Gray Scale", ""},
+ {eShaderFxColorizeMode_Sepia, "SEPIA", 0, "Sepia", ""},
+ {eShaderFxColorizeMode_Duotone, "DUOTONE", 0, "Duotone", ""},
+ {eShaderFxColorizeMode_Transparent, "TRANSPARENT", 0, "Transparent", ""},
+ {eShaderFxColorizeMode_Custom, "CUSTOM", 0, "Custom", ""},
+ {0, NULL, 0, NULL, NULL}};
#ifdef RNA_RUNTIME
-#include "BKE_shader_fx.h"
+# include "BKE_shader_fx.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
static StructRNA *rna_ShaderFx_refine(struct PointerRNA *ptr)
{
- ShaderFxData *md = (ShaderFxData *)ptr->data;
-
- switch ((ShaderFxType)md->type) {
- case eShaderFxType_Blur:
- return &RNA_ShaderFxBlur;
- case eShaderFxType_Colorize:
- return &RNA_ShaderFxColorize;
- case eShaderFxType_Wave:
- return &RNA_ShaderFxWave;
- case eShaderFxType_Pixel:
- return &RNA_ShaderFxPixel;
- case eShaderFxType_Rim:
- return &RNA_ShaderFxRim;
- case eShaderFxType_Shadow:
- return &RNA_ShaderFxShadow;
- case eShaderFxType_Swirl:
- return &RNA_ShaderFxSwirl;
- case eShaderFxType_Flip:
- return &RNA_ShaderFxFlip;
- case eShaderFxType_Glow:
- return &RNA_ShaderFxGlow;
- case eShaderFxType_Light:
- return &RNA_ShaderFxLight;
- /* Default */
- case eShaderFxType_None:
- case NUM_SHADER_FX_TYPES:
- return &RNA_ShaderFx;
- }
-
- return &RNA_ShaderFx;
+ ShaderFxData *md = (ShaderFxData *)ptr->data;
+
+ switch ((ShaderFxType)md->type) {
+ case eShaderFxType_Blur:
+ return &RNA_ShaderFxBlur;
+ case eShaderFxType_Colorize:
+ return &RNA_ShaderFxColorize;
+ case eShaderFxType_Wave:
+ return &RNA_ShaderFxWave;
+ case eShaderFxType_Pixel:
+ return &RNA_ShaderFxPixel;
+ case eShaderFxType_Rim:
+ return &RNA_ShaderFxRim;
+ case eShaderFxType_Shadow:
+ return &RNA_ShaderFxShadow;
+ case eShaderFxType_Swirl:
+ return &RNA_ShaderFxSwirl;
+ case eShaderFxType_Flip:
+ return &RNA_ShaderFxFlip;
+ case eShaderFxType_Glow:
+ return &RNA_ShaderFxGlow;
+ case eShaderFxType_Light:
+ return &RNA_ShaderFxLight;
+ /* Default */
+ case eShaderFxType_None:
+ case NUM_SHADER_FX_TYPES:
+ return &RNA_ShaderFx;
+ }
+
+ return &RNA_ShaderFx;
}
static void rna_ShaderFx_name_set(PointerRNA *ptr, const char *value)
{
- ShaderFxData *gmd = ptr->data;
- char oldname[sizeof(gmd->name)];
+ ShaderFxData *gmd = ptr->data;
+ char oldname[sizeof(gmd->name)];
- /* make a copy of the old name first */
- BLI_strncpy(oldname, gmd->name, sizeof(gmd->name));
+ /* make a copy of the old name first */
+ BLI_strncpy(oldname, gmd->name, sizeof(gmd->name));
- /* copy the new name into the name slot */
- BLI_strncpy_utf8(gmd->name, value, sizeof(gmd->name));
+ /* copy the new name into the name slot */
+ BLI_strncpy_utf8(gmd->name, value, sizeof(gmd->name));
- /* make sure the name is truly unique */
- if (ptr->id.data) {
- Object *ob = ptr->id.data;
- BKE_shaderfx_unique_name(&ob->shader_fx, gmd);
- }
+ /* make sure the name is truly unique */
+ if (ptr->id.data) {
+ Object *ob = ptr->id.data;
+ BKE_shaderfx_unique_name(&ob->shader_fx, gmd);
+ }
- /* fix all the animation data which may link to this */
- BKE_animdata_fix_paths_rename_all(NULL, "shader_effects", oldname, gmd->name);
+ /* fix all the animation data which may link to this */
+ BKE_animdata_fix_paths_rename_all(NULL, "shader_effects", oldname, gmd->name);
}
static char *rna_ShaderFx_path(PointerRNA *ptr)
{
- ShaderFxData *gmd = ptr->data;
- char name_esc[sizeof(gmd->name) * 2];
+ ShaderFxData *gmd = ptr->data;
+ char name_esc[sizeof(gmd->name) * 2];
- BLI_strescape(name_esc, gmd->name, sizeof(name_esc));
- return BLI_sprintfN("shader_effects[\"%s\"]", name_esc);
+ BLI_strescape(name_esc, gmd->name, sizeof(name_esc));
+ return BLI_sprintfN("shader_effects[\"%s\"]", name_esc);
}
static void rna_ShaderFx_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ptr->id.data);
}
static void rna_ShaderFx_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_ShaderFx_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
+ rna_ShaderFx_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
}
/* Objects */
static void shaderfx_object_set(Object *self, Object **ob_p, int type, PointerRNA value)
{
- Object *ob = value.data;
-
- if (!self || ob != self) {
- if (!ob || type == OB_EMPTY || ob->type == type) {
- id_lib_extern((ID *)ob);
- *ob_p = ob;
- }
- }
+ Object *ob = value.data;
+
+ if (!self || ob != self) {
+ if (!ob || type == OB_EMPTY || ob->type == type) {
+ id_lib_extern((ID *)ob);
+ *ob_p = ob;
+ }
+ }
}
-#define RNA_FX_OBJECT_SET(_type, _prop, _obtype) \
-static void rna_##_type##ShaderFx_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
-{ \
- _type##ShaderFxData *tmd = (_type##ShaderFxData *)ptr->data; \
- shaderfx_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
-}
+# define RNA_FX_OBJECT_SET(_type, _prop, _obtype) \
+ static void rna_##_type##ShaderFx_##_prop##_set(PointerRNA *ptr, PointerRNA value) \
+ { \
+ _type##ShaderFxData *tmd = (_type##ShaderFxData *)ptr->data; \
+ shaderfx_object_set(ptr->id.data, &tmd->_prop, _obtype, value); \
+ }
RNA_FX_OBJECT_SET(Light, object, OB_EMPTY);
RNA_FX_OBJECT_SET(Shadow, object, OB_EMPTY);
RNA_FX_OBJECT_SET(Swirl, object, OB_EMPTY);
-#undef RNA_FX_OBJECT_SET
+# undef RNA_FX_OBJECT_SET
#else
static void rna_def_shader_fx_blur(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxBlur", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Gaussian Blur Effect", "Gaussian Blur effect");
- RNA_def_struct_sdna(srna, "BlurShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "factor", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Factor", "Factor of Blur");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "samples");
- RNA_def_property_range(prop, 0, 32);
- RNA_def_property_ui_range(prop, 0, 32, 2, -1);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "coc", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "coc");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_float_default(prop, 0.025f);
- RNA_def_property_ui_text(prop, "Precision", "Define circle of confusion for depth of field");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "use_dof_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_BLUR_DOF_MODE);
- RNA_def_property_ui_text(prop, "Lock Focal Plane", "Blur using focal plane distance as factor to simulate depth of field effect (only in camera view)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxBlur", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Gaussian Blur Effect", "Gaussian Blur effect");
+ RNA_def_struct_sdna(srna, "BlurShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "factor", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Factor", "Factor of Blur");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_range(prop, 0, 32);
+ RNA_def_property_ui_range(prop, 0, 32, 2, -1);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "coc", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "coc");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_float_default(prop, 0.025f);
+ RNA_def_property_ui_text(prop, "Precision", "Define circle of confusion for depth of field");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "use_dof_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_BLUR_DOF_MODE);
+ RNA_def_property_ui_text(prop,
+ "Lock Focal Plane",
+ "Blur using focal plane distance as factor to simulate depth of field "
+ "effect (only in camera view)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_colorize(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxColorize", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Colorize Effect", "Colorize effect");
- RNA_def_struct_sdna(srna, "ColorizeShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "factor");
- RNA_def_property_range(prop, 0, 1.0);
- RNA_def_property_ui_text(prop, "Factor", "Mix factor");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "low_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "low_color");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Low color", "First color used for effect");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "high_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "high_color");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Height color", "Second color used for effect");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_shaderfx_colorize_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Effect mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxColorize", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Colorize Effect", "Colorize effect");
+ RNA_def_struct_sdna(srna, "ColorizeShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "factor");
+ RNA_def_property_range(prop, 0, 1.0);
+ RNA_def_property_ui_text(prop, "Factor", "Mix factor");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "low_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "low_color");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Low color", "First color used for effect");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "high_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "high_color");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Height color", "Second color used for effect");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_shaderfx_colorize_modes_items);
+ RNA_def_property_ui_text(prop, "Mode", "Effect mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_wave(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static EnumPropertyItem prop_shaderfx_wave_type_items[] = {
- { 0, "HORIZONTAL", 0, "Horizontal", "" },
- { 1, "VERTICAL", 0, "Vertical", "" },
- { 0, NULL, 0, NULL, NULL }
- };
-
- srna = RNA_def_struct(brna, "ShaderFxWave", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Wave Deformation Effect", "Wave Deformation effect");
- RNA_def_struct_sdna(srna, "WaveShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "orientation");
- RNA_def_property_enum_items(prop, prop_shaderfx_wave_type_items);
- RNA_def_property_ui_text(prop, "Orientation", "Direction of the wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of Wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Period", "Period of Wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "phase");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Phase", "Phase Shift of Wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static EnumPropertyItem prop_shaderfx_wave_type_items[] = {
+ {0, "HORIZONTAL", 0, "Horizontal", ""},
+ {1, "VERTICAL", 0, "Vertical", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ srna = RNA_def_struct(brna, "ShaderFxWave", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Wave Deformation Effect", "Wave Deformation effect");
+ RNA_def_struct_sdna(srna, "WaveShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "orientation");
+ RNA_def_property_enum_items(prop, prop_shaderfx_wave_type_items);
+ RNA_def_property_ui_text(prop, "Orientation", "Direction of the wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of Wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Period", "Period of Wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phase");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Phase", "Phase Shift of Wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_pixel(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxPixel", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Pixelate Effect", "Pixelate effect");
- RNA_def_struct_sdna(srna, "PixelShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "size");
- RNA_def_property_range(prop, 1, INT_MAX);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Size", "Pixel size");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "rgba");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Color", "Color used for lines");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_PIXEL_USE_LINES);
- RNA_def_property_ui_text(prop, "Lines", "Display lines between pixels");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxPixel", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Pixelate Effect", "Pixelate effect");
+ RNA_def_struct_sdna(srna, "PixelShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "size");
+ RNA_def_property_range(prop, 1, INT_MAX);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Size", "Pixel size");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "rgba");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Color", "Color used for lines");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "use_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_PIXEL_USE_LINES);
+ RNA_def_property_ui_text(prop, "Lines", "Display lines between pixels");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_rim(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxRim", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Rim Effect", "Rim effect");
- RNA_def_struct_sdna(srna, "RimShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "offset", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, -INT_MAX, INT_MAX);
- RNA_def_property_ui_text(prop, "Offset", "Offset of the rim");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "rim_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "rim_rgb");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Rim Color", "Color used for Rim");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "mask_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "mask_rgb");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Mask Color", "Color that must be kept");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_shaderfx_rim_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Blend mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "blur", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "blur");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Blur", "Number of pixels for blurring rim (set to 0 to disable)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "samples");
- RNA_def_property_range(prop, 0, 32);
- RNA_def_property_ui_range(prop, 0, 32, 2, -1);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxRim", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Rim Effect", "Rim effect");
+ RNA_def_struct_sdna(srna, "RimShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "offset", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, -INT_MAX, INT_MAX);
+ RNA_def_property_ui_text(prop, "Offset", "Offset of the rim");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "rim_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "rim_rgb");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Rim Color", "Color used for Rim");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "mask_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "mask_rgb");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Mask Color", "Color that must be kept");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_shaderfx_rim_modes_items);
+ RNA_def_property_ui_text(prop, "Mode", "Blend mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "blur", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "blur");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Blur", "Number of pixels for blurring rim (set to 0 to disable)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_range(prop, 0, 32);
+ RNA_def_property_ui_range(prop, 0, 32, 2, -1);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_shadow(BlenderRNA *brna)
{
- static EnumPropertyItem prop_shaderfx_shadow_type_items[] = {
- { 0, "HORIZONTAL", 0, "Horizontal", "" },
- { 1, "VERTICAL", 0, "Vertical", "" },
- { 0, NULL, 0, NULL, NULL }
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxShadow", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Shadow Effect", "Shadow effect");
- RNA_def_struct_sdna(srna, "ShadowShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Object to determine center of rotation");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_ShadowShaderFx_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update");
-
- prop = RNA_def_property(srna, "offset", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "offset");
- RNA_def_property_range(prop, -INT_MAX, INT_MAX);
- RNA_def_property_ui_text(prop, "Offset", "Offset of the shadow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Scale", "Offset of the shadow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "shadow_rgba");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Shadow Color", "Color used for Shadow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "orientation");
- RNA_def_property_enum_items(prop, prop_shaderfx_shadow_type_items);
- RNA_def_property_ui_text(prop, "Orientation", "Direction of the wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "amplitude");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of Wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "period");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Period", "Period of Wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "phase");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_text(prop, "Phase", "Phase Shift of Wave");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "rotation");
- RNA_def_property_range(prop, DEG2RAD(-360), DEG2RAD(360));
- RNA_def_property_ui_range(prop, DEG2RAD(-360), DEG2RAD(360), 5, 2);
- RNA_def_property_ui_text(prop, "Rotation", "Rotation around center or object");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "blur", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "blur");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Blur", "Number of pixels for blurring shadow (set to 0 to disable)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "samples");
- RNA_def_property_range(prop, 0, 32);
- RNA_def_property_ui_range(prop, 0, 32, 2, -1);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "use_object", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SHADOW_USE_OBJECT);
- RNA_def_property_ui_text(prop, "Use Object", "Use object as center of rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "use_wave", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SHADOW_USE_WAVE);
- RNA_def_property_ui_text(prop, "Wave", "Use wave effect");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ static EnumPropertyItem prop_shaderfx_shadow_type_items[] = {
+ {0, "HORIZONTAL", 0, "Horizontal", ""},
+ {1, "VERTICAL", 0, "Vertical", ""},
+ {0, NULL, 0, NULL, NULL}};
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxShadow", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Shadow Effect", "Shadow effect");
+ RNA_def_struct_sdna(srna, "ShadowShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object to determine center of rotation");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_ShadowShaderFx_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "offset");
+ RNA_def_property_range(prop, -INT_MAX, INT_MAX);
+ RNA_def_property_ui_text(prop, "Offset", "Offset of the shadow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Scale", "Offset of the shadow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "shadow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "shadow_rgba");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Shadow Color", "Color used for Shadow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "orientation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "orientation");
+ RNA_def_property_enum_items(prop, prop_shaderfx_shadow_type_items);
+ RNA_def_property_ui_text(prop, "Orientation", "Direction of the wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "amplitude", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "amplitude");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Amplitude", "Amplitude of Wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "period", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "period");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Period", "Period of Wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "phase", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "phase");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_text(prop, "Phase", "Phase Shift of Wave");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "rotation");
+ RNA_def_property_range(prop, DEG2RAD(-360), DEG2RAD(360));
+ RNA_def_property_ui_range(prop, DEG2RAD(-360), DEG2RAD(360), 5, 2);
+ RNA_def_property_ui_text(prop, "Rotation", "Rotation around center or object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "blur", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "blur");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Blur", "Number of pixels for blurring shadow (set to 0 to disable)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_range(prop, 0, 32);
+ RNA_def_property_ui_range(prop, 0, 32, 2, -1);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples (zero, disable blur)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "use_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SHADOW_USE_OBJECT);
+ RNA_def_property_ui_text(prop, "Use Object", "Use object as center of rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "use_wave", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SHADOW_USE_WAVE);
+ RNA_def_property_ui_text(prop, "Wave", "Use wave effect");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_glow(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxGlow", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Glow Effect", "Glow effect");
- RNA_def_struct_sdna(srna, "GlowShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "glow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "glow_color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Glow Color", "Color used for generated glow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "select_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_float_sdna(prop, NULL, "select_color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Select Color", "Color selected to apply glow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_shaderfx_glow_modes_items);
- RNA_def_property_ui_text(prop, "Mode", "Glow mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "threshold");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
- RNA_def_property_ui_text(prop, "Threshold", "Limit to select color for glow effect");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- /* use blur fields to make compatible with blur filter, but only makes public first array element */
- prop = RNA_def_property(srna, "radius", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "blur[0]");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Radius", "Number of pixels for blurring glow (set to 0 to disable)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "samples");
- RNA_def_property_range(prop, 1, 32);
- RNA_def_property_ui_range(prop, 1, 32, 2, -1);
- RNA_def_property_int_default(prop, 4);
- RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "use_alpha_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_GLOW_USE_ALPHA);
- RNA_def_property_ui_text(prop, "Use Alpha", "Glow only areas with alpha");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxGlow", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Glow Effect", "Glow effect");
+ RNA_def_struct_sdna(srna, "GlowShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "glow_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "glow_color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Glow Color", "Color used for generated glow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "select_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_float_sdna(prop, NULL, "select_color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Select Color", "Color selected to apply glow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_shaderfx_glow_modes_items);
+ RNA_def_property_ui_text(prop, "Mode", "Glow mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "threshold");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
+ RNA_def_property_ui_text(prop, "Threshold", "Limit to select color for glow effect");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ /* use blur fields to make compatible with blur filter, but only makes public first array element */
+ prop = RNA_def_property(srna, "radius", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "blur[0]");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Radius", "Number of pixels for blurring glow (set to 0 to disable)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "samples", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "samples");
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_range(prop, 1, 32, 2, -1);
+ RNA_def_property_int_default(prop, 4);
+ RNA_def_property_ui_text(prop, "Samples", "Number of Blur Samples");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "use_alpha_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_GLOW_USE_ALPHA);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Glow only areas with alpha");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_swirl(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxSwirl", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Swirl Effect", "Swirl effect");
- RNA_def_struct_sdna(srna, "SwirlShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "radius", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "radius");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "angle");
- RNA_def_property_range(prop, DEG2RAD(-5 * 360), DEG2RAD(5 * 360));
- RNA_def_property_ui_range(prop, DEG2RAD(-5 * 360), DEG2RAD(5 * 360), 5, 2);
- RNA_def_property_ui_text(prop, "Angle", "Angle of rotation");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "use_transparent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SWIRL_MAKE_TRANSPARENT);
- RNA_def_property_ui_text(prop, "Transparent", "Make image transparent outside of radius");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Object to determine center location");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SwirlShaderFx_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxSwirl", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Swirl Effect", "Swirl effect");
+ RNA_def_struct_sdna(srna, "SwirlShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "radius", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "radius");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Radius", "Radius to apply");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "angle", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "angle");
+ RNA_def_property_range(prop, DEG2RAD(-5 * 360), DEG2RAD(5 * 360));
+ RNA_def_property_ui_range(prop, DEG2RAD(-5 * 360), DEG2RAD(5 * 360), 5, 2);
+ RNA_def_property_ui_text(prop, "Angle", "Angle of rotation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "use_transparent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_SWIRL_MAKE_TRANSPARENT);
+ RNA_def_property_ui_text(prop, "Transparent", "Make image transparent outside of radius");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object to determine center location");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SwirlShaderFx_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update");
}
static void rna_def_shader_fx_flip(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxFlip", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Flip Effect", "Flip effect");
- RNA_def_struct_sdna(srna, "FlipShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "flip_horizontal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_HORIZONTAL);
- RNA_def_property_ui_text(prop, "Horizontal", "Flip image horizontally");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "flip_vertical", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_VERTICAL);
- RNA_def_property_ui_text(prop, "Vertical", "Flip image vertically");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxFlip", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Flip Effect", "Flip effect");
+ RNA_def_struct_sdna(srna, "FlipShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "flip_horizontal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_HORIZONTAL);
+ RNA_def_property_ui_text(prop, "Horizontal", "Flip image horizontally");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "flip_vertical", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FX_FLIP_VERTICAL);
+ RNA_def_property_ui_text(prop, "Vertical", "Flip image vertically");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
}
static void rna_def_shader_fx_light(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ShaderFxLight", "ShaderFx");
- RNA_def_struct_ui_text(srna, "Light Effect", "Light effect");
- RNA_def_struct_sdna(srna, "LightShaderFxData");
- RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
-
- prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "energy");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 1, FLT_MAX, 1, 2);
- RNA_def_property_ui_text(prop, "Energy", "Strength of light source");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ambient");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, FLT_MAX, 1, 2);
- RNA_def_property_ui_text(prop, "Ambient", "Strength of ambient light source");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
-
- prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Object", "Object to determine light source location");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_LightShaderFx_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ShaderFxLight", "ShaderFx");
+ RNA_def_struct_ui_text(srna, "Light Effect", "Light effect");
+ RNA_def_struct_sdna(srna, "LightShaderFxData");
+ RNA_def_struct_ui_icon(srna, ICON_SHADERFX);
+
+ prop = RNA_def_property(srna, "energy", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "energy");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 1, FLT_MAX, 1, 2);
+ RNA_def_property_ui_text(prop, "Energy", "Strength of light source");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "ambient", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ambient");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, FLT_MAX, 1, 2);
+ RNA_def_property_ui_text(prop, "Ambient", "Strength of ambient light source");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+
+ prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Object", "Object to determine light source location");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_LightShaderFx_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_update(prop, 0, "rna_ShaderFx_dependency_update");
}
void RNA_def_shader_fx(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* data */
- srna = RNA_def_struct(brna, "ShaderFx", NULL);
- RNA_def_struct_ui_text(srna, "ShaderFx", "Effect affecting the grease pencil object");
- RNA_def_struct_refine_func(srna, "rna_ShaderFx_refine");
- RNA_def_struct_path_func(srna, "rna_ShaderFx_path");
- RNA_def_struct_sdna(srna, "ShaderFxData");
-
- /* strings */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShaderFx_name_set");
- RNA_def_property_ui_text(prop, "Name", "Effect name");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- /* enums */
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_object_shaderfx_type_items);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID); /* Abused, for "Light"... */
-
- /* flags */
- prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Realtime);
- RNA_def_property_ui_text(prop, "Realtime", "Display effect in viewport");
- RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
-
- prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Render);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Render", "Use effect during render");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
-
- prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Editmode);
- RNA_def_property_ui_text(prop, "Edit Mode", "Display effect in Edit mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
- RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Expanded);
- RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
- RNA_def_property_ui_text(prop, "Expanded", "Set effect expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- /* types */
- rna_def_shader_fx_blur(brna);
- rna_def_shader_fx_colorize(brna);
- rna_def_shader_fx_wave(brna);
- rna_def_shader_fx_pixel(brna);
- rna_def_shader_fx_rim(brna);
- rna_def_shader_fx_shadow(brna);
- rna_def_shader_fx_glow(brna);
- rna_def_shader_fx_swirl(brna);
- rna_def_shader_fx_flip(brna);
- rna_def_shader_fx_light(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* data */
+ srna = RNA_def_struct(brna, "ShaderFx", NULL);
+ RNA_def_struct_ui_text(srna, "ShaderFx", "Effect affecting the grease pencil object");
+ RNA_def_struct_refine_func(srna, "rna_ShaderFx_refine");
+ RNA_def_struct_path_func(srna, "rna_ShaderFx_path");
+ RNA_def_struct_sdna(srna, "ShaderFxData");
+
+ /* strings */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_ShaderFx_name_set");
+ RNA_def_property_ui_text(prop, "Name", "Effect name");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER | NA_RENAME, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* enums */
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_object_shaderfx_type_items);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID); /* Abused, for "Light"... */
+
+ /* flags */
+ prop = RNA_def_property(srna, "show_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Realtime);
+ RNA_def_property_ui_text(prop, "Realtime", "Display effect in viewport");
+ RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_ON, 1);
+
+ prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Render);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Render", "Use effect during render");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_ON, 1);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "show_in_editmode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Editmode);
+ RNA_def_property_ui_text(prop, "Edit Mode", "Display effect in Edit mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_ShaderFx_update");
+ RNA_def_property_ui_icon(prop, ICON_EDITMODE_HLT, 0);
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", eShaderFxMode_Expanded);
+ RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_text(prop, "Expanded", "Set effect expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ /* types */
+ rna_def_shader_fx_blur(brna);
+ rna_def_shader_fx_colorize(brna);
+ rna_def_shader_fx_wave(brna);
+ rna_def_shader_fx_pixel(brna);
+ rna_def_shader_fx_rim(brna);
+ rna_def_shader_fx_shadow(brna);
+ rna_def_shader_fx_glow(brna);
+ rna_def_shader_fx_swirl(brna);
+ rna_def_shader_fx_flip(brna);
+ rna_def_shader_fx_light(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index 3f44d488497..b6486d7a3f4 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <limits.h>
@@ -41,1096 +40,1167 @@
#include "WM_types.h"
-
#ifdef RNA_RUNTIME
-#include "BLI_threads.h"
+# include "BLI_threads.h"
-#include "BKE_colorband.h"
-#include "BKE_context.h"
-#include "BKE_particle.h"
+# include "BKE_colorband.h"
+# include "BKE_context.h"
+# include "BKE_particle.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-
-#include "smoke_API.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+# include "smoke_API.h"
static void rna_Smoke_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
}
static void rna_Smoke_dependency_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- rna_Smoke_update(bmain, scene, ptr);
- DEG_relations_tag_update(bmain);
+ rna_Smoke_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
}
static void rna_Smoke_resetCache(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- if (settings->smd && settings->smd->domain)
- settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
- DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ if (settings->smd && settings->smd->domain)
+ settings->point_cache[0]->flag |= PTCACHE_OUTDATED;
+ DEG_id_tag_update(ptr->id.data, ID_RECALC_GEOMETRY);
}
static void rna_Smoke_cachetype_set(struct PointerRNA *ptr, int value)
{
- SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- Object *ob = (Object *)ptr->id.data;
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ Object *ob = (Object *)ptr->id.data;
- if (value != settings->cache_file_format) {
- /* Clear old caches. */
- PTCacheID id;
- BKE_ptcache_id_from_smoke(&id, ob, settings->smd);
- BKE_ptcache_id_clear(&id, PTCACHE_CLEAR_ALL, 0);
+ if (value != settings->cache_file_format) {
+ /* Clear old caches. */
+ PTCacheID id;
+ BKE_ptcache_id_from_smoke(&id, ob, settings->smd);
+ BKE_ptcache_id_clear(&id, PTCACHE_CLEAR_ALL, 0);
- settings->cache_file_format = value;
- }
+ settings->cache_file_format = value;
+ }
}
static void rna_Smoke_reset(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- smokeModifier_reset(settings->smd);
- rna_Smoke_resetCache(bmain, scene, ptr);
+ smokeModifier_reset(settings->smd);
+ rna_Smoke_resetCache(bmain, scene, ptr);
- rna_Smoke_update(bmain, scene, ptr);
+ rna_Smoke_update(bmain, scene, ptr);
}
static void rna_Smoke_reset_dependency(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- smokeModifier_reset(settings->smd);
+ smokeModifier_reset(settings->smd);
- if (settings->smd && settings->smd->domain)
- settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED;
+ if (settings->smd && settings->smd->domain)
+ settings->smd->domain->point_cache[0]->flag |= PTCACHE_OUTDATED;
- rna_Smoke_dependency_update(bmain, scene, ptr);
+ rna_Smoke_dependency_update(bmain, scene, ptr);
}
static char *rna_SmokeDomainSettings_path(PointerRNA *ptr)
{
- SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
- ModifierData *md = (ModifierData *)settings->smd;
- char name_esc[sizeof(md->name) * 2];
+ SmokeDomainSettings *settings = (SmokeDomainSettings *)ptr->data;
+ ModifierData *md = (ModifierData *)settings->smd;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].domain_settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].domain_settings", name_esc);
}
static char *rna_SmokeFlowSettings_path(PointerRNA *ptr)
{
- SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data;
- ModifierData *md = (ModifierData *)settings->smd;
- char name_esc[sizeof(md->name) * 2];
+ SmokeFlowSettings *settings = (SmokeFlowSettings *)ptr->data;
+ ModifierData *md = (ModifierData *)settings->smd;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].flow_settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].flow_settings", name_esc);
}
static char *rna_SmokeCollSettings_path(PointerRNA *ptr)
{
- SmokeCollSettings *settings = (SmokeCollSettings *)ptr->data;
- ModifierData *md = (ModifierData *)settings->smd;
- char name_esc[sizeof(md->name) * 2];
+ SmokeCollSettings *settings = (SmokeCollSettings *)ptr->data;
+ ModifierData *md = (ModifierData *)settings->smd;
+ char name_esc[sizeof(md->name) * 2];
- BLI_strescape(name_esc, md->name, sizeof(name_esc));
- return BLI_sprintfN("modifiers[\"%s\"].coll_settings", name_esc);
+ BLI_strescape(name_esc, md->name, sizeof(name_esc));
+ return BLI_sprintfN("modifiers[\"%s\"].coll_settings", name_esc);
}
static int rna_SmokeModifier_grid_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- float *density = NULL;
- int size = 0;
-
- if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
- /* high resolution smoke */
- int res[3];
-
- smoke_turbulence_get_res(sds->wt, res);
- size = res[0] * res[1] * res[2];
-
- density = smoke_turbulence_get_density(sds->wt);
- }
- else if (sds->fluid) {
- /* regular resolution */
- size = sds->res[0] * sds->res[1] * sds->res[2];
- density = smoke_get_density(sds->fluid);
- }
-
- length[0] = (density) ? size : 0;
-#else
- (void)ptr;
- length[0] = 0;
-#endif
- return length[0];
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ float *density = NULL;
+ int size = 0;
+
+ if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
+ /* high resolution smoke */
+ int res[3];
+
+ smoke_turbulence_get_res(sds->wt, res);
+ size = res[0] * res[1] * res[2];
+
+ density = smoke_turbulence_get_density(sds->wt);
+ }
+ else if (sds->fluid) {
+ /* regular resolution */
+ size = sds->res[0] * sds->res[1] * sds->res[2];
+ density = smoke_get_density(sds->fluid);
+ }
+
+ length[0] = (density) ? size : 0;
+# else
+ (void)ptr;
+ length[0] = 0;
+# endif
+ return length[0];
}
-static int rna_SmokeModifier_color_grid_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_SmokeModifier_color_grid_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
- rna_SmokeModifier_grid_get_length(ptr, length);
+ rna_SmokeModifier_grid_get_length(ptr, length);
- length[0] *= 4;
- return length[0];
+ length[0] *= 4;
+ return length[0];
}
-static int rna_SmokeModifier_velocity_grid_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_SmokeModifier_velocity_grid_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- float *vx = NULL;
- float *vy = NULL;
- float *vz = NULL;
- int size = 0;
-
- /* Velocity data is always low-resolution. */
- if (sds->fluid) {
- size = 3 * sds->res[0] * sds->res[1] * sds->res[2];
- vx = smoke_get_velocity_x(sds->fluid);
- vy = smoke_get_velocity_y(sds->fluid);
- vz = smoke_get_velocity_z(sds->fluid);
- }
-
- length[0] = (vx && vy && vz) ? size : 0;
-#else
- (void)ptr;
- length[0] = 0;
-#endif
- return length[0];
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ float *vx = NULL;
+ float *vy = NULL;
+ float *vz = NULL;
+ int size = 0;
+
+ /* Velocity data is always low-resolution. */
+ if (sds->fluid) {
+ size = 3 * sds->res[0] * sds->res[1] * sds->res[2];
+ vx = smoke_get_velocity_x(sds->fluid);
+ vy = smoke_get_velocity_y(sds->fluid);
+ vz = smoke_get_velocity_z(sds->fluid);
+ }
+
+ length[0] = (vx && vy && vz) ? size : 0;
+# else
+ (void)ptr;
+ length[0] = 0;
+# endif
+ return length[0];
}
-static int rna_SmokeModifier_heat_grid_get_length(
- PointerRNA *ptr,
- int length[RNA_MAX_ARRAY_DIMENSION])
+static int rna_SmokeModifier_heat_grid_get_length(PointerRNA *ptr,
+ int length[RNA_MAX_ARRAY_DIMENSION])
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- float *heat = NULL;
- int size = 0;
-
- /* Heat data is always low-resolution. */
- if (sds->fluid) {
- size = sds->res[0] * sds->res[1] * sds->res[2];
- heat = smoke_get_heat(sds->fluid);
- }
-
- length[0] = (heat) ? size : 0;
-#else
- (void)ptr;
- length[0] = 0;
-#endif
- return length[0];
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ float *heat = NULL;
+ int size = 0;
+
+ /* Heat data is always low-resolution. */
+ if (sds->fluid) {
+ size = sds->res[0] * sds->res[1] * sds->res[2];
+ heat = smoke_get_heat(sds->fluid);
+ }
+
+ length[0] = (heat) ? size : 0;
+# else
+ (void)ptr;
+ length[0] = 0;
+# endif
+ return length[0];
}
static void rna_SmokeModifier_density_grid_get(PointerRNA *ptr, float *values)
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- int length[RNA_MAX_ARRAY_DIMENSION];
- int size = rna_SmokeModifier_grid_get_length(ptr, length);
- float *density;
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ int length[RNA_MAX_ARRAY_DIMENSION];
+ int size = rna_SmokeModifier_grid_get_length(ptr, length);
+ float *density;
- BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
- if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt)
- density = smoke_turbulence_get_density(sds->wt);
- else
- density = smoke_get_density(sds->fluid);
+ if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt)
+ density = smoke_turbulence_get_density(sds->wt);
+ else
+ density = smoke_get_density(sds->fluid);
- memcpy(values, density, size * sizeof(float));
+ memcpy(values, density, size * sizeof(float));
- BLI_rw_mutex_unlock(sds->fluid_mutex);
-#else
- UNUSED_VARS(ptr, values);
-#endif
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+# else
+ UNUSED_VARS(ptr, values);
+# endif
}
static void rna_SmokeModifier_velocity_grid_get(PointerRNA *ptr, float *values)
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- int length[RNA_MAX_ARRAY_DIMENSION];
- int size = rna_SmokeModifier_velocity_grid_get_length(ptr, length);
- float *vx, *vy, *vz;
- int i;
-
- BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
-
- vx = smoke_get_velocity_x(sds->fluid);
- vy = smoke_get_velocity_y(sds->fluid);
- vz = smoke_get_velocity_z(sds->fluid);
-
- for (i = 0; i < size; i += 3) {
- *(values++) = *(vx++);
- *(values++) = *(vy++);
- *(values++) = *(vz++);
- }
-
- BLI_rw_mutex_unlock(sds->fluid_mutex);
-#else
- UNUSED_VARS(ptr, values);
-#endif
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ int length[RNA_MAX_ARRAY_DIMENSION];
+ int size = rna_SmokeModifier_velocity_grid_get_length(ptr, length);
+ float *vx, *vy, *vz;
+ int i;
+
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+
+ vx = smoke_get_velocity_x(sds->fluid);
+ vy = smoke_get_velocity_y(sds->fluid);
+ vz = smoke_get_velocity_z(sds->fluid);
+
+ for (i = 0; i < size; i += 3) {
+ *(values++) = *(vx++);
+ *(values++) = *(vy++);
+ *(values++) = *(vz++);
+ }
+
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+# else
+ UNUSED_VARS(ptr, values);
+# endif
}
static void rna_SmokeModifier_color_grid_get(PointerRNA *ptr, float *values)
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- int length[RNA_MAX_ARRAY_DIMENSION];
- int size = rna_SmokeModifier_grid_get_length(ptr, length);
-
- BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
-
- if (!sds->fluid) {
- memset(values, 0, size * sizeof(float));
- }
- else {
- if (sds->flags & MOD_SMOKE_HIGHRES) {
- if (smoke_turbulence_has_colors(sds->wt))
- smoke_turbulence_get_rgba(sds->wt, values, 0);
- else
- smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, values, 0);
- }
- else {
- if (smoke_has_colors(sds->fluid))
- smoke_get_rgba(sds->fluid, values, 0);
- else
- smoke_get_rgba_from_density(sds->fluid, sds->active_color, values, 0);
- }
- }
-
- BLI_rw_mutex_unlock(sds->fluid_mutex);
-#else
- UNUSED_VARS(ptr, values);
-#endif
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ int length[RNA_MAX_ARRAY_DIMENSION];
+ int size = rna_SmokeModifier_grid_get_length(ptr, length);
+
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+
+ if (!sds->fluid) {
+ memset(values, 0, size * sizeof(float));
+ }
+ else {
+ if (sds->flags & MOD_SMOKE_HIGHRES) {
+ if (smoke_turbulence_has_colors(sds->wt))
+ smoke_turbulence_get_rgba(sds->wt, values, 0);
+ else
+ smoke_turbulence_get_rgba_from_density(sds->wt, sds->active_color, values, 0);
+ }
+ else {
+ if (smoke_has_colors(sds->fluid))
+ smoke_get_rgba(sds->fluid, values, 0);
+ else
+ smoke_get_rgba_from_density(sds->fluid, sds->active_color, values, 0);
+ }
+ }
+
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+# else
+ UNUSED_VARS(ptr, values);
+# endif
}
static void rna_SmokeModifier_flame_grid_get(PointerRNA *ptr, float *values)
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- int length[RNA_MAX_ARRAY_DIMENSION];
- int size = rna_SmokeModifier_grid_get_length(ptr, length);
- float *flame;
-
- BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
-
- if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt)
- flame = smoke_turbulence_get_flame(sds->wt);
- else
- flame = smoke_get_flame(sds->fluid);
-
- if (flame)
- memcpy(values, flame, size * sizeof(float));
- else
- memset(values, 0, size * sizeof(float));
-
- BLI_rw_mutex_unlock(sds->fluid_mutex);
-#else
- UNUSED_VARS(ptr, values);
-#endif
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ int length[RNA_MAX_ARRAY_DIMENSION];
+ int size = rna_SmokeModifier_grid_get_length(ptr, length);
+ float *flame;
+
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+
+ if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt)
+ flame = smoke_turbulence_get_flame(sds->wt);
+ else
+ flame = smoke_get_flame(sds->fluid);
+
+ if (flame)
+ memcpy(values, flame, size * sizeof(float));
+ else
+ memset(values, 0, size * sizeof(float));
+
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+# else
+ UNUSED_VARS(ptr, values);
+# endif
}
static void rna_SmokeModifier_heat_grid_get(PointerRNA *ptr, float *values)
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- int length[RNA_MAX_ARRAY_DIMENSION];
- int size = rna_SmokeModifier_heat_grid_get_length(ptr, length);
- float *heat;
-
- BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
-
- heat = smoke_get_heat(sds->fluid);
-
- if (heat != NULL) {
- /* scale heat values from -2.0-2.0 to -1.0-1.0. */
- for (int i = 0; i < size; i++) {
- values[i] = heat[i] * 0.5f;
- }
- }
- else {
- memset(values, 0, size * sizeof(float));
- }
-
- BLI_rw_mutex_unlock(sds->fluid_mutex);
-#else
- UNUSED_VARS(ptr, values);
-#endif
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ int length[RNA_MAX_ARRAY_DIMENSION];
+ int size = rna_SmokeModifier_heat_grid_get_length(ptr, length);
+ float *heat;
+
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+
+ heat = smoke_get_heat(sds->fluid);
+
+ if (heat != NULL) {
+ /* scale heat values from -2.0-2.0 to -1.0-1.0. */
+ for (int i = 0; i < size; i++) {
+ values[i] = heat[i] * 0.5f;
+ }
+ }
+ else {
+ memset(values, 0, size * sizeof(float));
+ }
+
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+# else
+ UNUSED_VARS(ptr, values);
+# endif
}
static void rna_SmokeModifier_temperature_grid_get(PointerRNA *ptr, float *values)
{
-#ifdef WITH_SMOKE
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- int length[RNA_MAX_ARRAY_DIMENSION];
- int size = rna_SmokeModifier_grid_get_length(ptr, length);
- float *flame;
-
- BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
-
- if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
- flame = smoke_turbulence_get_flame(sds->wt);
- }
- else {
- flame = smoke_get_flame(sds->fluid);
- }
-
- if (flame) {
- /* Output is such that 0..1 maps to 0..1000K */
- float offset = sds->flame_ignition;
- float scale = sds->flame_max_temp - sds->flame_ignition;
-
- for (int i = 0; i < size; i++) {
- values[i] = (flame[i] > 0.01f) ? offset + flame[i] * scale : 0.0f;
- }
- }
- else {
- memset(values, 0, size * sizeof(float));
- }
-
- BLI_rw_mutex_unlock(sds->fluid_mutex);
-#else
- UNUSED_VARS(ptr, values);
-#endif
+# ifdef WITH_SMOKE
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ int length[RNA_MAX_ARRAY_DIMENSION];
+ int size = rna_SmokeModifier_grid_get_length(ptr, length);
+ float *flame;
+
+ BLI_rw_mutex_lock(sds->fluid_mutex, THREAD_LOCK_READ);
+
+ if (sds->flags & MOD_SMOKE_HIGHRES && sds->wt) {
+ flame = smoke_turbulence_get_flame(sds->wt);
+ }
+ else {
+ flame = smoke_get_flame(sds->fluid);
+ }
+
+ if (flame) {
+ /* Output is such that 0..1 maps to 0..1000K */
+ float offset = sds->flame_ignition;
+ float scale = sds->flame_max_temp - sds->flame_ignition;
+
+ for (int i = 0; i < size; i++) {
+ values[i] = (flame[i] > 0.01f) ? offset + flame[i] * scale : 0.0f;
+ }
+ }
+ else {
+ memset(values, 0, size * sizeof(float));
+ }
+
+ BLI_rw_mutex_unlock(sds->fluid_mutex);
+# else
+ UNUSED_VARS(ptr, values);
+# endif
}
static void rna_SmokeFlow_density_vgroup_get(PointerRNA *ptr, char *value)
{
- SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
- rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density);
+ SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+ rna_object_vgroup_name_index_get(ptr, value, flow->vgroup_density);
}
static int rna_SmokeFlow_density_vgroup_length(PointerRNA *ptr)
{
- SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
- return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density);
+ SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+ return rna_object_vgroup_name_index_length(ptr, flow->vgroup_density);
}
static void rna_SmokeFlow_density_vgroup_set(PointerRNA *ptr, const char *value)
{
- SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
- rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density);
+ SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+ rna_object_vgroup_name_index_set(ptr, value, &flow->vgroup_density);
}
static void rna_SmokeFlow_uvlayer_set(PointerRNA *ptr, const char *value)
{
- SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
- rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name));
+ SmokeFlowSettings *flow = (SmokeFlowSettings *)ptr->data;
+ rna_object_uvlayer_name_set(ptr, value, flow->uvlayer_name, sizeof(flow->uvlayer_name));
}
static void rna_Smoke_use_color_ramp_set(PointerRNA *ptr, bool value)
{
- SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
+ SmokeDomainSettings *sds = (SmokeDomainSettings *)ptr->data;
- sds->use_coba = value;
+ sds->use_coba = value;
- if (value && sds->coba == NULL) {
- sds->coba = BKE_colorband_add(false);
- }
+ if (value && sds->coba == NULL) {
+ sds->coba = BKE_colorband_add(false);
+ }
}
#else
static void rna_def_smoke_domain_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_noise_type_items[] = {
- {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
-#ifdef WITH_FFTW3
- {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
-#endif
- /* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_compression_items[] = {
- { VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression" },
-#ifdef WITH_OPENVDB_BLOSC
- { VDB_COMPRESSION_BLOSC, "BLOSC", 0, "Blosc", "Multithreaded compression, similar in size and quality as 'Zip'" },
-#endif
- { VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression" },
- { 0, NULL, 0, NULL, NULL }
- };
-
- static const EnumPropertyItem smoke_cache_comp_items[] = {
- {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"},
- {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem smoke_highres_sampling_items[] = {
- {SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
- {SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
- {SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem smoke_data_depth_items[] = {
- {16, "16", 0, "Float (Half)", "Half float (16 bit data)"},
- {0, "32", 0, "Float (Full)", "Full float (32 bit data)"}, /* default */
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem smoke_domain_colli_items[] = {
- {SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"},
- {SM_BORDER_VERTICAL, "BORDERVERTICAL", 0, "Vertically Open",
- "Smoke doesn't collide with top and bottom sides"},
- {SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem cache_file_type_items[] = {
- {PTCACHE_FILE_PTCACHE, "POINTCACHE", 0, "Point Cache", "Blender specific point cache file format"},
-#ifdef WITH_OPENVDB
- {PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem smoke_view_items[] = {
- {MOD_SMOKE_SLICE_VIEW_ALIGNED, "VIEW_ALIGNED", 0, "View", "Slice volume parallel to the view plane"},
- {MOD_SMOKE_SLICE_AXIS_ALIGNED, "AXIS_ALIGNED", 0, "Axis", "Slice volume parallel to the major axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem axis_slice_method_items[] = {
- {AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"},
- {AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem interp_method_item[] = {
- {VOLUME_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
- {VOLUME_INTERP_CUBIC, "CUBIC", 0, "Cubic", "Smoothed high quality interpolation, but slower"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem axis_slice_position_items[] = {
- {SLICE_AXIS_AUTO, "AUTO", 0, "Auto", "Adjust slice direction according to the view direction"},
- {SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"},
- {SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"},
- {SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem vector_draw_items[] = {
- {VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"},
- {VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL);
- RNA_def_struct_ui_text(srna, "Domain Settings", "Smoke domain settings");
- RNA_def_struct_sdna(srna, "SmokeDomainSettings");
- RNA_def_struct_path_func(srna, "rna_SmokeDomainSettings_path");
-
- prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "maxres");
- RNA_def_property_range(prop, 6, 512);
- RNA_def_property_ui_range(prop, 24, 512, 2, -1);
- RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "amplify", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "amplify");
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_range(prop, 1, 10, 1, -1);
- RNA_def_property_ui_text(prop, "Amplification", "Enhance the resolution of smoke by this factor using noise");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "use_high_resolution", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES);
- RNA_def_property_ui_text(prop, "High res", "Enable high resolution (using amplification)");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "show_high_resolution", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOW_HIGHRES);
- RNA_def_property_ui_text(prop, "Show High Resolution", "Show high resolution (using amplification)");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noise");
- RNA_def_property_enum_items(prop, prop_noise_type_items);
- RNA_def_property_ui_text(prop, "Noise Method", "Noise method which is used for creating the high resolution");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "alpha");
- RNA_def_property_range(prop, -5.0, 5.0);
- RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Density",
- "How much density affects smoke motion (higher value results in faster rising smoke)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "beta");
- RNA_def_property_range(prop, -5.0, 5.0);
- RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Heat",
- "How much heat affects smoke motion (higher value results in faster rising smoke)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Collection", "Limit collisions to this collection");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
-
- prop = RNA_def_property(srna, "fluid_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "fluid_group");
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Fluid Collection", "Limit fluid objects to this collection");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
-
- prop = RNA_def_property(srna, "effector_collection", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "eff_group");
- RNA_def_property_struct_type(prop, "Collection");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
-
- prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "strength");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
- RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
- RNA_def_property_int_sdna(prop, NULL, "diss_speed");
- RNA_def_property_range(prop, 1.0, 10000.0);
- RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1);
- RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE);
- RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG);
- RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x ");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]");
- RNA_def_property_struct_type(prop, "PointCache");
- RNA_def_property_ui_text(prop, "Point Cache", "");
-
- prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
- RNA_def_property_enum_items(prop, smoke_cache_comp_items);
- RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
-
- prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp");
- RNA_def_property_enum_items(prop, prop_compression_items);
- RNA_def_property_ui_text(prop, "Compression", "Compression method to be used");
-
- prop = RNA_def_property(srna, "data_depth", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_depth");
- RNA_def_property_enum_items(prop, smoke_data_depth_items);
- RNA_def_property_ui_text(prop, "Data Depth",
- "Bit depth for writing all scalar (including vector) "
- "lower values reduce file size");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
-
- prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "border_collisions");
- RNA_def_property_enum_items(prop, smoke_domain_colli_items);
- RNA_def_property_ui_text(prop, "Border Collisions",
- "Select which domain border will be treated as collision object");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "EffectorWeights");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Weights", "");
-
- prop = RNA_def_property(srna, "highres_sampling", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, smoke_highres_sampling_items);
- RNA_def_property_ui_text(prop, "Emitter", "Method for sampling the high resolution flow");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "time_scale");
- RNA_def_property_range(prop, 0.2, 1.5);
- RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5);
- RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vorticity");
- RNA_def_property_range(prop, 0.01, 4.0);
- RNA_def_property_ui_range(prop, 0.01, 4.0, 0.02, 5);
- RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "density_grid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length");
- RNA_def_property_float_funcs(prop, "rna_SmokeModifier_density_grid_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Density Grid", "Smoke density grid");
-
- prop = RNA_def_property(srna, "velocity_grid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_velocity_grid_get_length");
- RNA_def_property_float_funcs(prop, "rna_SmokeModifier_velocity_grid_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Velocity Grid", "Smoke velocity grid");
-
- prop = RNA_def_property(srna, "flame_grid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length");
- RNA_def_property_float_funcs(prop, "rna_SmokeModifier_flame_grid_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Flame Grid", "Smoke flame grid");
-
- prop = RNA_def_property(srna, "color_grid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_color_grid_get_length");
- RNA_def_property_float_funcs(prop, "rna_SmokeModifier_color_grid_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Color Grid", "Smoke color grid");
-
- prop = RNA_def_property(srna, "heat_grid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_heat_grid_get_length");
- RNA_def_property_float_funcs(prop, "rna_SmokeModifier_heat_grid_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Heat Grid", "Smoke heat grid");
-
- prop = RNA_def_property(srna, "temperature_grid", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 32);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length");
- RNA_def_property_float_funcs(prop, "rna_SmokeModifier_temperature_grid_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Temperature Grid", "Smoke temperature grid, range 0..1 represents 0..1000K");
-
- prop = RNA_def_property(srna, "cell_size", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "cell_size", "Cell Size");
-
- prop = RNA_def_property(srna, "start_point", PROP_FLOAT, PROP_XYZ); /* can change each frame when using adaptive domain */
- RNA_def_property_float_sdna(prop, NULL, "p0");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "p0", "Start point");
-
- prop = RNA_def_property(srna, "domain_resolution", PROP_INT, PROP_XYZ); /* can change each frame when using adaptive domain */
- RNA_def_property_int_sdna(prop, NULL, "res");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution");
-
- prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 4.0);
- RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
- RNA_def_property_ui_text(prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 8.0);
- RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
- RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 2.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
- RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.5, 5.0);
- RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
- RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 1.0, 10.0);
- RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
- RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_ADAPTIVE_DOMAIN);
- RNA_def_property_ui_text(prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "adapt_res");
- RNA_def_property_range(prop, 0, 512);
- RNA_def_property_ui_range(prop, 0, 512, 2, -1);
- RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "adapt_margin");
- RNA_def_property_range(prop, 2, 24);
- RNA_def_property_ui_range(prop, 2, 24, 2, -1);
- RNA_def_property_ui_text(prop, "Margin", "Margin added around fluid to minimize boundary interference");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 0.5);
- RNA_def_property_ui_range(prop, 0.01, 0.5, 1.0, 5);
- RNA_def_property_ui_text(prop, "Threshold",
- "Maximum amount of fluid cell can contain before it is considered empty");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- prop = RNA_def_property(srna, "cache_file_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "cache_file_format");
- RNA_def_property_enum_items(prop, cache_file_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Smoke_cachetype_set", NULL);
- RNA_def_property_ui_text(prop, "File Format", "Select the file format to be used for caching");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
-
- /* display settings */
-
- prop = RNA_def_property(srna, "slice_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "slice_method");
- RNA_def_property_enum_items(prop, smoke_view_items);
- RNA_def_property_ui_text(prop, "View Method", "How to slice the volume for viewport rendering");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "axis_slice_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "axis_slice_method");
- RNA_def_property_enum_items(prop, axis_slice_method_items);
- RNA_def_property_ui_text(prop, "Method", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "slice_axis");
- RNA_def_property_enum_items(prop, axis_slice_position_items);
- RNA_def_property_ui_text(prop, "Axis", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "slice_per_voxel", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "slice_per_voxel");
- RNA_def_property_range(prop, 0.0, 100.0);
- RNA_def_property_ui_range(prop, 0.0, 5.0, 0.1, 1);
- RNA_def_property_ui_text(prop, "Slice Per Voxel",
- "How many slices per voxel should be generated");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "slice_depth");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Position", "Position of the slice");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "display_thickness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "display_thickness");
- RNA_def_property_range(prop, 0.001, 1000.0);
- RNA_def_property_ui_range(prop, 0.1, 100.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Thickness", "Thickness of smoke drawing in the viewport");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
-
- prop = RNA_def_property(srna, "display_interpolation", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "interp_method");
- RNA_def_property_enum_items(prop, interp_method_item);
- RNA_def_property_ui_text(prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0);
- RNA_def_property_ui_text(prop, "Display Velocity", "Toggle visualization of the velocity field as needles");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "vector_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "vector_draw_type");
- RNA_def_property_enum_items(prop, vector_draw_items);
- RNA_def_property_ui_text(prop, "Display Type", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "vector_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vector_scale");
- RNA_def_property_range(prop, 0.0, 1000.0);
- RNA_def_property_ui_range(prop, 0.0, 100.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Scale", "Multiplier for scaling the vectors");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- /* --------- Color mapping. --------- */
-
- prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_coba", 0);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Smoke_use_color_ramp_set");
- RNA_def_property_ui_text(prop, "Use Color Ramp",
- "Render a simulation field while mapping its voxels values to the colors of a ramp");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- static const EnumPropertyItem coba_field_items[] = {
- {FLUID_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"},
- {FLUID_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"},
- {FLUID_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"},
- {FLUID_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"},
- {FLUID_FIELD_FLAME, "FLAME", 0, "Flame", "Flame field"},
- {FLUID_FIELD_FUEL, "FUEL", 0, "Fuel", "Fuel field"},
- {FLUID_FIELD_HEAT, "HEAT", 0, "Heat", "Temperature of the fluid"},
- {FLUID_FIELD_VELOCITY_X, "VELOCITY_X", 0, "X Velocity", "X component of the velocity field"},
- {FLUID_FIELD_VELOCITY_Y, "VELOCITY_Y", 0, "Y Velocity", "Y component of the velocity field"},
- {FLUID_FIELD_VELOCITY_Z, "VELOCITY_Z", 0, "Z Velocity", "Z component of the velocity field"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "coba_field");
- RNA_def_property_enum_items(prop, coba_field_items);
- RNA_def_property_ui_text(prop, "Field", "Simulation field to color map");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "coba");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Color Ramp", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
-
- prop = RNA_def_property(srna, "clipping", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clipping");
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
- RNA_def_property_ui_text(prop, "Clipping",
- "Value under which voxels are considered empty space to optimize caching and rendering");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_noise_type_items[] = {
+ {MOD_SMOKE_NOISEWAVE, "NOISEWAVE", 0, "Wavelet", ""},
+# ifdef WITH_FFTW3
+ {MOD_SMOKE_NOISEFFT, "NOISEFFT", 0, "FFT", ""},
+# endif
+ /* {MOD_SMOKE_NOISECURL, "NOISECURL", 0, "Curl", ""}, */
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_compression_items[] = {
+ {VDB_COMPRESSION_ZIP, "ZIP", 0, "Zip", "Effective but slow compression"},
+# ifdef WITH_OPENVDB_BLOSC
+ {VDB_COMPRESSION_BLOSC,
+ "BLOSC",
+ 0,
+ "Blosc",
+ "Multithreaded compression, similar in size and quality as 'Zip'"},
+# endif
+ {VDB_COMPRESSION_NONE, "NONE", 0, "None", "Do not use any compression"},
+ {0, NULL, 0, NULL, NULL}};
+
+ static const EnumPropertyItem smoke_cache_comp_items[] = {
+ {SM_CACHE_LIGHT, "CACHELIGHT", 0, "Light", "Fast but not so effective compression"},
+ {SM_CACHE_HEAVY, "CACHEHEAVY", 0, "Heavy", "Effective but slow compression"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem smoke_highres_sampling_items[] = {
+ {SM_HRES_FULLSAMPLE, "FULLSAMPLE", 0, "Full Sample", ""},
+ {SM_HRES_LINEAR, "LINEAR", 0, "Linear", ""},
+ {SM_HRES_NEAREST, "NEAREST", 0, "Nearest", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem smoke_data_depth_items[] = {
+ {16, "16", 0, "Float (Half)", "Half float (16 bit data)"},
+ {0, "32", 0, "Float (Full)", "Full float (32 bit data)"}, /* default */
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem smoke_domain_colli_items[] = {
+ {SM_BORDER_OPEN, "BORDEROPEN", 0, "Open", "Smoke doesn't collide with any border"},
+ {SM_BORDER_VERTICAL,
+ "BORDERVERTICAL",
+ 0,
+ "Vertically Open",
+ "Smoke doesn't collide with top and bottom sides"},
+ {SM_BORDER_CLOSED, "BORDERCLOSED", 0, "Collide All", "Smoke collides with every side"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem cache_file_type_items[] = {
+ {PTCACHE_FILE_PTCACHE,
+ "POINTCACHE",
+ 0,
+ "Point Cache",
+ "Blender specific point cache file format"},
+# ifdef WITH_OPENVDB
+ {PTCACHE_FILE_OPENVDB, "OPENVDB", 0, "OpenVDB", "OpenVDB file format"},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem smoke_view_items[] = {
+ {MOD_SMOKE_SLICE_VIEW_ALIGNED,
+ "VIEW_ALIGNED",
+ 0,
+ "View",
+ "Slice volume parallel to the view plane"},
+ {MOD_SMOKE_SLICE_AXIS_ALIGNED,
+ "AXIS_ALIGNED",
+ 0,
+ "Axis",
+ "Slice volume parallel to the major axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem axis_slice_method_items[] = {
+ {AXIS_SLICE_FULL, "FULL", 0, "Full", "Slice the whole domain object"},
+ {AXIS_SLICE_SINGLE, "SINGLE", 0, "Single", "Perform a single slice of the domain object"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem interp_method_item[] = {
+ {VOLUME_INTERP_LINEAR, "LINEAR", 0, "Linear", "Good smoothness and speed"},
+ {VOLUME_INTERP_CUBIC,
+ "CUBIC",
+ 0,
+ "Cubic",
+ "Smoothed high quality interpolation, but slower"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem axis_slice_position_items[] = {
+ {SLICE_AXIS_AUTO,
+ "AUTO",
+ 0,
+ "Auto",
+ "Adjust slice direction according to the view direction"},
+ {SLICE_AXIS_X, "X", 0, "X", "Slice along the X axis"},
+ {SLICE_AXIS_Y, "Y", 0, "Y", "Slice along the Y axis"},
+ {SLICE_AXIS_Z, "Z", 0, "Z", "Slice along the Z axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem vector_draw_items[] = {
+ {VECTOR_DRAW_NEEDLE, "NEEDLE", 0, "Needle", "Display vectors as needles"},
+ {VECTOR_DRAW_STREAMLINE, "STREAMLINE", 0, "Streamlines", "Display vectors as streamlines"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SmokeDomainSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Domain Settings", "Smoke domain settings");
+ RNA_def_struct_sdna(srna, "SmokeDomainSettings");
+ RNA_def_struct_path_func(srna, "rna_SmokeDomainSettings_path");
+
+ prop = RNA_def_property(srna, "resolution_max", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "maxres");
+ RNA_def_property_range(prop, 6, 512);
+ RNA_def_property_ui_range(prop, 24, 512, 2, -1);
+ RNA_def_property_ui_text(prop, "Max Res", "Maximal resolution used in the fluid domain");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "amplify", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "amplify");
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_range(prop, 1, 10, 1, -1);
+ RNA_def_property_ui_text(
+ prop, "Amplification", "Enhance the resolution of smoke by this factor using noise");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "use_high_resolution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_HIGHRES);
+ RNA_def_property_ui_text(prop, "High res", "Enable high resolution (using amplification)");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "show_high_resolution", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "viewsettings", MOD_SMOKE_VIEW_SHOW_HIGHRES);
+ RNA_def_property_ui_text(
+ prop, "Show High Resolution", "Show high resolution (using amplification)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noise");
+ RNA_def_property_enum_items(prop, prop_noise_type_items);
+ RNA_def_property_ui_text(
+ prop, "Noise Method", "Noise method which is used for creating the high resolution");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "alpha");
+ RNA_def_property_range(prop, -5.0, 5.0);
+ RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
+ RNA_def_property_ui_text(
+ prop,
+ "Density",
+ "How much density affects smoke motion (higher value results in faster rising smoke)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "beta", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "beta");
+ RNA_def_property_range(prop, -5.0, 5.0);
+ RNA_def_property_ui_range(prop, -5.0, 5.0, 0.02, 5);
+ RNA_def_property_ui_text(
+ prop,
+ "Heat",
+ "How much heat affects smoke motion (higher value results in faster rising smoke)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "collision_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit collisions to this collection");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
+
+ prop = RNA_def_property(srna, "fluid_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "fluid_group");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Fluid Collection", "Limit fluid objects to this collection");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
+
+ prop = RNA_def_property(srna, "effector_collection", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "eff_group");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
+
+ prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "strength");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Strength", "Strength of noise");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "dissolve_speed", PROP_INT, PROP_TIME);
+ RNA_def_property_int_sdna(prop, NULL, "diss_speed");
+ RNA_def_property_range(prop, 1.0, 10000.0);
+ RNA_def_property_ui_range(prop, 1.0, 10000.0, 1, -1);
+ RNA_def_property_ui_text(prop, "Dissolve Speed", "Dissolve Speed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "use_dissolve_smoke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE);
+ RNA_def_property_ui_text(prop, "Dissolve Smoke", "Enable smoke to disappear over time");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "use_dissolve_smoke_log", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_DISSOLVE_LOG);
+ RNA_def_property_ui_text(prop, "Logarithmic dissolve", "Using 1/x ");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "point_cache", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "point_cache[0]");
+ RNA_def_property_struct_type(prop, "PointCache");
+ RNA_def_property_ui_text(prop, "Point Cache", "");
+
+ prop = RNA_def_property(srna, "point_cache_compress_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "cache_comp");
+ RNA_def_property_enum_items(prop, smoke_cache_comp_items);
+ RNA_def_property_ui_text(prop, "Cache Compression", "Compression method to be used");
+
+ prop = RNA_def_property(srna, "openvdb_cache_compress_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "openvdb_comp");
+ RNA_def_property_enum_items(prop, prop_compression_items);
+ RNA_def_property_ui_text(prop, "Compression", "Compression method to be used");
+
+ prop = RNA_def_property(srna, "data_depth", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "data_depth");
+ RNA_def_property_enum_items(prop, smoke_data_depth_items);
+ RNA_def_property_ui_text(prop,
+ "Data Depth",
+ "Bit depth for writing all scalar (including vector) "
+ "lower values reduce file size");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "collision_extents", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "border_collisions");
+ RNA_def_property_enum_items(prop, smoke_domain_colli_items);
+ RNA_def_property_ui_text(
+ prop, "Border Collisions", "Select which domain border will be treated as collision object");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "EffectorWeights");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Effector Weights", "");
+
+ prop = RNA_def_property(srna, "highres_sampling", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, smoke_highres_sampling_items);
+ RNA_def_property_ui_text(prop, "Emitter", "Method for sampling the high resolution flow");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "time_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "time_scale");
+ RNA_def_property_range(prop, 0.2, 1.5);
+ RNA_def_property_ui_range(prop, 0.2, 1.5, 0.02, 5);
+ RNA_def_property_ui_text(prop, "Time Scale", "Adjust simulation speed");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "vorticity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vorticity");
+ RNA_def_property_range(prop, 0.01, 4.0);
+ RNA_def_property_ui_range(prop, 0.01, 4.0, 0.02, 5);
+ RNA_def_property_ui_text(prop, "Vorticity", "Amount of turbulence/rotation in fluid");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "density_grid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length");
+ RNA_def_property_float_funcs(prop, "rna_SmokeModifier_density_grid_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Density Grid", "Smoke density grid");
+
+ prop = RNA_def_property(srna, "velocity_grid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_velocity_grid_get_length");
+ RNA_def_property_float_funcs(prop, "rna_SmokeModifier_velocity_grid_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Velocity Grid", "Smoke velocity grid");
+
+ prop = RNA_def_property(srna, "flame_grid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length");
+ RNA_def_property_float_funcs(prop, "rna_SmokeModifier_flame_grid_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Flame Grid", "Smoke flame grid");
+
+ prop = RNA_def_property(srna, "color_grid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_color_grid_get_length");
+ RNA_def_property_float_funcs(prop, "rna_SmokeModifier_color_grid_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Color Grid", "Smoke color grid");
+
+ prop = RNA_def_property(srna, "heat_grid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_heat_grid_get_length");
+ RNA_def_property_float_funcs(prop, "rna_SmokeModifier_heat_grid_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Heat Grid", "Smoke heat grid");
+
+ prop = RNA_def_property(srna, "temperature_grid", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 32);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_dynamic_array_funcs(prop, "rna_SmokeModifier_grid_get_length");
+ RNA_def_property_float_funcs(prop, "rna_SmokeModifier_temperature_grid_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Temperature Grid", "Smoke temperature grid, range 0..1 represents 0..1000K");
+
+ prop = RNA_def_property(srna,
+ "cell_size",
+ PROP_FLOAT,
+ PROP_XYZ); /* can change each frame when using adaptive domain */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "cell_size", "Cell Size");
+
+ prop = RNA_def_property(srna,
+ "start_point",
+ PROP_FLOAT,
+ PROP_XYZ); /* can change each frame when using adaptive domain */
+ RNA_def_property_float_sdna(prop, NULL, "p0");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "p0", "Start point");
+
+ prop = RNA_def_property(srna,
+ "domain_resolution",
+ PROP_INT,
+ PROP_XYZ); /* can change each frame when using adaptive domain */
+ RNA_def_property_int_sdna(prop, NULL, "res");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "res", "Smoke Grid Resolution");
+
+ prop = RNA_def_property(srna, "burning_rate", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 4.0);
+ RNA_def_property_ui_range(prop, 0.01, 2.0, 1.0, 5);
+ RNA_def_property_ui_text(
+ prop, "Speed", "Speed of the burning reaction (use larger values for smaller flame)");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "flame_smoke", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 8.0);
+ RNA_def_property_ui_range(prop, 0.0, 4.0, 1.0, 5);
+ RNA_def_property_ui_text(prop, "Smoke", "Amount of smoke created by burning fuel");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "flame_vorticity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 2.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 5);
+ RNA_def_property_ui_text(prop, "Vorticity", "Additional vorticity for the flames");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "flame_ignition", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.5, 5.0);
+ RNA_def_property_ui_range(prop, 0.5, 2.5, 1.0, 5);
+ RNA_def_property_ui_text(prop, "Ignition", "Minimum temperature of flames");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "flame_max_temp", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 1.0, 10.0);
+ RNA_def_property_ui_range(prop, 1.0, 5.0, 1.0, 5);
+ RNA_def_property_ui_text(prop, "Maximum", "Maximum temperature of flames");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "flame_smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke emitted from burning fuel");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "use_adaptive_domain", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_ADAPTIVE_DOMAIN);
+ RNA_def_property_ui_text(
+ prop, "Adaptive Domain", "Adapt simulation resolution and size to fluid");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "additional_res", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "adapt_res");
+ RNA_def_property_range(prop, 0, 512);
+ RNA_def_property_ui_range(prop, 0, 512, 2, -1);
+ RNA_def_property_ui_text(prop, "Additional", "Maximum number of additional cells");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "adapt_margin", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "adapt_margin");
+ RNA_def_property_range(prop, 2, 24);
+ RNA_def_property_ui_range(prop, 2, 24, 2, -1);
+ RNA_def_property_ui_text(
+ prop, "Margin", "Margin added around fluid to minimize boundary interference");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "adapt_threshold", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 0.5);
+ RNA_def_property_ui_range(prop, 0.01, 0.5, 1.0, 5);
+ RNA_def_property_ui_text(
+ prop, "Threshold", "Maximum amount of fluid cell can contain before it is considered empty");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ prop = RNA_def_property(srna, "cache_file_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "cache_file_format");
+ RNA_def_property_enum_items(prop, cache_file_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Smoke_cachetype_set", NULL);
+ RNA_def_property_ui_text(prop, "File Format", "Select the file format to be used for caching");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_resetCache");
+
+ /* display settings */
+
+ prop = RNA_def_property(srna, "slice_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "slice_method");
+ RNA_def_property_enum_items(prop, smoke_view_items);
+ RNA_def_property_ui_text(prop, "View Method", "How to slice the volume for viewport rendering");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "axis_slice_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "axis_slice_method");
+ RNA_def_property_enum_items(prop, axis_slice_method_items);
+ RNA_def_property_ui_text(prop, "Method", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "slice_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "slice_axis");
+ RNA_def_property_enum_items(prop, axis_slice_position_items);
+ RNA_def_property_ui_text(prop, "Axis", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "slice_per_voxel", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "slice_per_voxel");
+ RNA_def_property_range(prop, 0.0, 100.0);
+ RNA_def_property_ui_range(prop, 0.0, 5.0, 0.1, 1);
+ RNA_def_property_ui_text(
+ prop, "Slice Per Voxel", "How many slices per voxel should be generated");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "slice_depth", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "slice_depth");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Position", "Position of the slice");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "display_thickness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "display_thickness");
+ RNA_def_property_range(prop, 0.001, 1000.0);
+ RNA_def_property_ui_range(prop, 0.1, 100.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Thickness", "Thickness of smoke drawing in the viewport");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
+
+ prop = RNA_def_property(srna, "display_interpolation", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "interp_method");
+ RNA_def_property_enum_items(prop, interp_method_item);
+ RNA_def_property_ui_text(
+ prop, "Interpolation", "Interpolation method to use for smoke/fire volumes in solid mode");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "show_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw_velocity", 0);
+ RNA_def_property_ui_text(
+ prop, "Display Velocity", "Toggle visualization of the velocity field as needles");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "vector_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "vector_draw_type");
+ RNA_def_property_enum_items(prop, vector_draw_items);
+ RNA_def_property_ui_text(prop, "Display Type", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "vector_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vector_scale");
+ RNA_def_property_range(prop, 0.0, 1000.0);
+ RNA_def_property_ui_range(prop, 0.0, 100.0, 0.1, 3);
+ RNA_def_property_ui_text(prop, "Scale", "Multiplier for scaling the vectors");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ /* --------- Color mapping. --------- */
+
+ prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_coba", 0);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Smoke_use_color_ramp_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Use Color Ramp",
+ "Render a simulation field while mapping its voxels values to the colors of a ramp");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ static const EnumPropertyItem coba_field_items[] = {
+ {FLUID_FIELD_COLOR_R, "COLOR_R", 0, "Red", "Red component of the color field"},
+ {FLUID_FIELD_COLOR_G, "COLOR_G", 0, "Green", "Green component of the color field"},
+ {FLUID_FIELD_COLOR_B, "COLOR_B", 0, "Blue", "Blue component of the color field"},
+ {FLUID_FIELD_DENSITY, "DENSITY", 0, "Density", "Quantity of soot in the fluid"},
+ {FLUID_FIELD_FLAME, "FLAME", 0, "Flame", "Flame field"},
+ {FLUID_FIELD_FUEL, "FUEL", 0, "Fuel", "Fuel field"},
+ {FLUID_FIELD_HEAT, "HEAT", 0, "Heat", "Temperature of the fluid"},
+ {FLUID_FIELD_VELOCITY_X, "VELOCITY_X", 0, "X Velocity", "X component of the velocity field"},
+ {FLUID_FIELD_VELOCITY_Y, "VELOCITY_Y", 0, "Y Velocity", "Y component of the velocity field"},
+ {FLUID_FIELD_VELOCITY_Z, "VELOCITY_Z", 0, "Z Velocity", "Z component of the velocity field"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "coba_field", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "coba_field");
+ RNA_def_property_enum_items(prop, coba_field_items);
+ RNA_def_property_ui_text(prop, "Field", "Simulation field to color map");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "coba");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Color Ramp", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
+
+ prop = RNA_def_property(srna, "clipping", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clipping");
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Clipping",
+ "Value under which voxels are considered empty space to optimize caching and rendering");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, NULL);
}
static void rna_def_smoke_flow_settings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem smoke_flow_types[] = {
- {MOD_SMOKE_FLOW_TYPE_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete smoke from simulation"},
- {MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
- {MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
- {MOD_SMOKE_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem smoke_flow_sources[] = {
- {MOD_SMOKE_FLOW_SOURCE_PARTICLES, "PARTICLES", ICON_PARTICLES, "Particle System", "Emit smoke from particles"},
- {MOD_SMOKE_FLOW_SOURCE_MESH, "MESH", ICON_META_CUBE, "Mesh", "Emit smoke from mesh surface or volume"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem smoke_flow_texture_types[] = {
- {MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO, "AUTO", 0, "Generated", "Generated coordinates centered to flow object"},
- {MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL);
- RNA_def_struct_ui_text(srna, "Flow Settings", "Smoke flow settings");
- RNA_def_struct_sdna(srna, "SmokeFlowSettings");
- RNA_def_struct_path_func(srna, "rna_SmokeFlowSettings_path");
-
- prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "density");
- RNA_def_property_range(prop, 0.0, 1);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
- RNA_def_property_ui_text(prop, "Density", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 10);
- RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4);
- RNA_def_property_ui_text(prop, "Flame Rate", "");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "temp");
- RNA_def_property_range(prop, -10, 10);
- RNA_def_property_ui_range(prop, -10, 10, 1, 1);
- RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "psys");
- RNA_def_property_struct_type(prop, "ParticleSystem");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
- RNA_def_property_update(prop, 0, "rna_Smoke_reset_dependency");
-
- prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, smoke_flow_types);
- RNA_def_property_ui_text(prop, "Flow Type", "Change how flow affects the simulation");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "smoke_flow_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "source");
- RNA_def_property_enum_items(prop, smoke_flow_sources);
- RNA_def_property_ui_text(prop, "Source", "Change how smoke is emitted");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE);
- RNA_def_property_ui_text(prop, "Absolute Density", "Only allow given density value in emitter area");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "use_initial_velocity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY);
- RNA_def_property_ui_text(prop, "Initial Velocity", "Smoke has some initial velocity when it is emitted");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vel_multi");
- RNA_def_property_range(prop, -100.0, 100.0);
- RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Source", "Multiplier of source velocity passed to smoke");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vel_normal");
- RNA_def_property_range(prop, -100.0, 100.0);
- RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vel_random");
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 0.0, 10.0);
- RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.1, 20.0);
- RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Size", "Particle size in simulation cells");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "use_particle_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_USE_PART_SIZE);
- RNA_def_property_ui_text(prop, "Set Size", "Set particle size in simulation cells or use nearest cell");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 50);
- RNA_def_property_ui_range(prop, 0, 10, 1, -1);
- RNA_def_property_ui_text(prop, "Subframes", "Number of additional samples to take between frames to improve quality of fast moving flows");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_SmokeFlow_density_vgroup_get",
- "rna_SmokeFlow_density_vgroup_length",
- "rna_SmokeFlow_density_vgroup_set");
- RNA_def_property_ui_text(prop, "Vertex Group",
- "Name of vertex group which determines surface emission rate");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_TEXTUREEMIT);
- RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texture_type");
- RNA_def_property_enum_items(prop, smoke_flow_texture_types);
- RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
- RNA_def_property_ui_text(prop, "UV Map", "UV map name");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmokeFlow_uvlayer_set");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01, 10.0);
- RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Size", "Size of texture mapping");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
-
- prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 200.0);
- RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5);
- RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem smoke_flow_types[] = {
+ {MOD_SMOKE_FLOW_TYPE_OUTFLOW, "OUTFLOW", 0, "Outflow", "Delete smoke from simulation"},
+ {MOD_SMOKE_FLOW_TYPE_SMOKE, "SMOKE", 0, "Smoke", "Add smoke"},
+ {MOD_SMOKE_FLOW_TYPE_SMOKEFIRE, "BOTH", 0, "Fire + Smoke", "Add fire and smoke"},
+ {MOD_SMOKE_FLOW_TYPE_FIRE, "FIRE", 0, "Fire", "Add fire"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem smoke_flow_sources[] = {
+ {MOD_SMOKE_FLOW_SOURCE_PARTICLES,
+ "PARTICLES",
+ ICON_PARTICLES,
+ "Particle System",
+ "Emit smoke from particles"},
+ {MOD_SMOKE_FLOW_SOURCE_MESH,
+ "MESH",
+ ICON_META_CUBE,
+ "Mesh",
+ "Emit smoke from mesh surface or volume"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem smoke_flow_texture_types[] = {
+ {MOD_SMOKE_FLOW_TEXTURE_MAP_AUTO,
+ "AUTO",
+ 0,
+ "Generated",
+ "Generated coordinates centered to flow object"},
+ {MOD_SMOKE_FLOW_TEXTURE_MAP_UV, "UV", 0, "UV", "Use UV layer for texture coordinates"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SmokeFlowSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Flow Settings", "Smoke flow settings");
+ RNA_def_struct_sdna(srna, "SmokeFlowSettings");
+ RNA_def_struct_path_func(srna, "rna_SmokeFlowSettings_path");
+
+ prop = RNA_def_property(srna, "density", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "density");
+ RNA_def_property_range(prop, 0.0, 1);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 1.0, 4);
+ RNA_def_property_ui_text(prop, "Density", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "smoke_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Smoke Color", "Color of smoke");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "fuel_amount", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 10);
+ RNA_def_property_ui_range(prop, 0.0, 5.0, 1.0, 4);
+ RNA_def_property_ui_text(prop, "Flame Rate", "");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "temperature", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "temp");
+ RNA_def_property_range(prop, -10, 10);
+ RNA_def_property_ui_range(prop, -10, 10, 1, 1);
+ RNA_def_property_ui_text(prop, "Temp. Diff.", "Temperature difference to ambient temperature");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "particle_system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "psys");
+ RNA_def_property_struct_type(prop, "ParticleSystem");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Particle Systems", "Particle systems emitted from the object");
+ RNA_def_property_update(prop, 0, "rna_Smoke_reset_dependency");
+
+ prop = RNA_def_property(srna, "smoke_flow_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, smoke_flow_types);
+ RNA_def_property_ui_text(prop, "Flow Type", "Change how flow affects the simulation");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "smoke_flow_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "source");
+ RNA_def_property_enum_items(prop, smoke_flow_sources);
+ RNA_def_property_ui_text(prop, "Source", "Change how smoke is emitted");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "use_absolute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_ABSOLUTE);
+ RNA_def_property_ui_text(
+ prop, "Absolute Density", "Only allow given density value in emitter area");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "use_initial_velocity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_INITVELOCITY);
+ RNA_def_property_ui_text(
+ prop, "Initial Velocity", "Smoke has some initial velocity when it is emitted");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "velocity_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vel_multi");
+ RNA_def_property_range(prop, -100.0, 100.0);
+ RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Source", "Multiplier of source velocity passed to smoke");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "velocity_normal", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vel_normal");
+ RNA_def_property_range(prop, -100.0, 100.0);
+ RNA_def_property_ui_range(prop, -2.0, 2.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Normal", "Amount of normal directional velocity");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "velocity_random", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vel_random");
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.0, 2.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Random", "Amount of random velocity");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "volume_density", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_range(prop, 0.0, 1.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Volume", "Factor for smoke emitted from inside the mesh volume");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "surface_distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 0.0, 10.0);
+ RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Surface", "Maximum distance from mesh surface to emit smoke");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "particle_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.1, 20.0);
+ RNA_def_property_ui_range(prop, 0.5, 5.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Size", "Particle size in simulation cells");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "use_particle_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_USE_PART_SIZE);
+ RNA_def_property_ui_text(
+ prop, "Set Size", "Set particle size in simulation cells or use nearest cell");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "subframes", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 50);
+ RNA_def_property_ui_range(prop, 0, 10, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Subframes",
+ "Number of additional samples to take between frames to improve "
+ "quality of fast moving flows");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "density_vertex_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_SmokeFlow_density_vgroup_get",
+ "rna_SmokeFlow_density_vgroup_length",
+ "rna_SmokeFlow_density_vgroup_set");
+ RNA_def_property_ui_text(
+ prop, "Vertex Group", "Name of vertex group which determines surface emission rate");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "use_texture", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", MOD_SMOKE_FLOW_TEXTUREEMIT);
+ RNA_def_property_ui_text(prop, "Use Texture", "Use a texture to control emission strength");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "texture_map_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texture_type");
+ RNA_def_property_enum_items(prop, smoke_flow_texture_types);
+ RNA_def_property_ui_text(prop, "Mapping", "Texture mapping type");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "uv_layer", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "uvlayer_name");
+ RNA_def_property_ui_text(prop, "UV Map", "UV map name");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SmokeFlow_uvlayer_set");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "noise_texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Texture", "Texture that controls emission strength");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "texture_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01, 10.0);
+ RNA_def_property_ui_range(prop, 0.1, 5.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Size", "Size of texture mapping");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+
+ prop = RNA_def_property(srna, "texture_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 200.0);
+ RNA_def_property_ui_range(prop, 0.0, 100.0, 0.05, 5);
+ RNA_def_property_ui_text(prop, "Offset", "Z-offset of texture mapping");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
}
static void rna_def_smoke_coll_settings(BlenderRNA *brna)
{
- static const EnumPropertyItem smoke_coll_type_items[] = {
- {SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"},
- {SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"},
- {SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SmokeCollSettings", NULL);
- RNA_def_struct_ui_text(srna, "Collision Settings", "Smoke collision settings");
- RNA_def_struct_sdna(srna, "SmokeCollSettings");
- RNA_def_struct_path_func(srna, "rna_SmokeCollSettings_path");
-
- prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, smoke_coll_type_items);
- RNA_def_property_ui_text(prop, "Collision type", "Collision type");
- RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
+ static const EnumPropertyItem smoke_coll_type_items[] = {
+ {SM_COLL_STATIC, "COLLSTATIC", 0, "Static", "Non moving obstacle"},
+ {SM_COLL_RIGID, "COLLRIGID", 0, "Rigid", "Rigid obstacle"},
+ {SM_COLL_ANIMATED, "COLLANIMATED", 0, "Animated", "Animated obstacle"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SmokeCollSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Collision Settings", "Smoke collision settings");
+ RNA_def_struct_sdna(srna, "SmokeCollSettings");
+ RNA_def_struct_path_func(srna, "rna_SmokeCollSettings_path");
+
+ prop = RNA_def_property(srna, "collision_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, smoke_coll_type_items);
+ RNA_def_property_ui_text(prop, "Collision type", "Collision type");
+ RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset");
}
void RNA_def_smoke(BlenderRNA *brna)
{
- rna_def_smoke_domain_settings(brna);
- rna_def_smoke_flow_settings(brna);
- rna_def_smoke_coll_settings(brna);
+ rna_def_smoke_domain_settings(brna);
+ rna_def_smoke_flow_settings(brna);
+ rna_def_smoke_coll_settings(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c
index 241c42b983e..736e387a986 100644
--- a/source/blender/makesrna/intern/rna_sound.c
+++ b/source/blender/makesrna/intern/rna_sound.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include "RNA_define.h"
@@ -29,75 +28,78 @@
#ifdef RNA_RUNTIME
-#include "BKE_sound.h"
-#include "BKE_context.h"
-#include "BKE_sequencer.h"
+# include "BKE_sound.h"
+# include "BKE_context.h"
+# include "BKE_sequencer.h"
static void rna_Sound_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- BKE_sound_load(bmain, (bSound *)ptr->data);
+ BKE_sound_load(bmain, (bSound *)ptr->data);
}
static bool rna_Sound_caching_get(PointerRNA *ptr)
{
- bSound *sound = (bSound *)(ptr->data);
- return (sound->flags & SOUND_FLAGS_CACHING) != 0;
+ bSound *sound = (bSound *)(ptr->data);
+ return (sound->flags & SOUND_FLAGS_CACHING) != 0;
}
static void rna_Sound_caching_set(PointerRNA *ptr, const bool value)
{
- bSound *sound = (bSound *)(ptr->data);
- if (value)
- BKE_sound_cache(sound);
- else
- BKE_sound_delete_cache(sound);
+ bSound *sound = (bSound *)(ptr->data);
+ if (value)
+ BKE_sound_cache(sound);
+ else
+ BKE_sound_delete_cache(sound);
}
static void rna_Sound_caching_update(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
- BKE_sequencer_update_sound(scene, (bSound *)(ptr->data));
+ BKE_sequencer_update_sound(scene, (bSound *)(ptr->data));
}
#else
static void rna_def_sound(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Sound", "ID");
- RNA_def_struct_sdna(srna, "bSound");
- RNA_def_struct_ui_text(srna, "Sound", "Sound data-block referencing an external or packed sound file");
- RNA_def_struct_ui_icon(srna, ICON_SOUND);
-
- /*rna_def_ipo_common(srna); */
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_ui_text(prop, "File Path", "Sound sample file used by this Sound data-block");
- RNA_def_property_update(prop, 0, "rna_Sound_update");
-
- prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
- RNA_def_property_ui_text(prop, "Packed File", "");
-
- prop = RNA_def_property(srna, "use_memory_cache", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
- RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM");
- RNA_def_property_update(prop, 0, "rna_Sound_caching_update");
-
- prop = RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO);
- RNA_def_property_ui_text(prop, "Mono",
- "If the file contains multiple audio channels they are rendered to a single one");
- RNA_def_property_update(prop, 0, "rna_Sound_update");
-
- RNA_api_sound(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Sound", "ID");
+ RNA_def_struct_sdna(srna, "bSound");
+ RNA_def_struct_ui_text(
+ srna, "Sound", "Sound data-block referencing an external or packed sound file");
+ RNA_def_struct_ui_icon(srna, ICON_SOUND);
+
+ /*rna_def_ipo_common(srna); */
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_ui_text(prop, "File Path", "Sound sample file used by this Sound data-block");
+ RNA_def_property_update(prop, 0, "rna_Sound_update");
+
+ prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
+ RNA_def_property_ui_text(prop, "Packed File", "");
+
+ prop = RNA_def_property(srna, "use_memory_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Sound_caching_get", "rna_Sound_caching_set");
+ RNA_def_property_ui_text(prop, "Caching", "The sound file is decoded and loaded into RAM");
+ RNA_def_property_update(prop, 0, "rna_Sound_caching_update");
+
+ prop = RNA_def_property(srna, "use_mono", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", SOUND_FLAGS_MONO);
+ RNA_def_property_ui_text(
+ prop,
+ "Mono",
+ "If the file contains multiple audio channels they are rendered to a single one");
+ RNA_def_property_update(prop, 0, "rna_Sound_update");
+
+ RNA_api_sound(srna);
}
void RNA_def_sound(BlenderRNA *brna)
{
- rna_def_sound(brna);
+ rna_def_sound(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_sound_api.c b/source/blender/makesrna/intern/rna_sound_api.c
index 9b3529544c2..f172c659900 100644
--- a/source/blender/makesrna/intern/rna_sound_api.c
+++ b/source/blender/makesrna/intern/rna_sound_api.c
@@ -30,38 +30,39 @@
#ifdef RNA_RUNTIME
-#include "BKE_packedFile.h"
+# include "BKE_packedFile.h"
static void rna_Sound_pack(bSound *sound, Main *bmain, ReportList *reports)
{
- sound->packedfile = newPackedFile(reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
+ sound->packedfile = newPackedFile(reports, sound->name, ID_BLEND_PATH(bmain, &sound->id));
}
static void rna_Sound_unpack(bSound *sound, Main *bmain, ReportList *reports, int method)
{
- if (!sound->packedfile) {
- BKE_report(reports, RPT_ERROR, "Sound not packed");
- }
- else {
- /* reports its own error on failure */
- unpackSound(bmain, reports, sound, method);
- }
+ if (!sound->packedfile) {
+ BKE_report(reports, RPT_ERROR, "Sound not packed");
+ }
+ else {
+ /* reports its own error on failure */
+ unpackSound(bmain, reports, sound, method);
+ }
}
#else
void RNA_api_sound(StructRNA *srna)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = RNA_def_function(srna, "pack", "rna_Sound_pack");
- RNA_def_function_ui_description(func, "Pack the sound into the current blend file");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ func = RNA_def_function(srna, "pack", "rna_Sound_pack");
+ RNA_def_function_ui_description(func, "Pack the sound into the current blend file");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- func = RNA_def_function(srna, "unpack", "rna_Sound_unpack");
- RNA_def_function_ui_description(func, "Unpack the sound to the samples filename");
- RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
- RNA_def_enum(func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
+ func = RNA_def_function(srna, "unpack", "rna_Sound_unpack");
+ RNA_def_function_ui_description(func, "Unpack the sound to the samples filename");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ RNA_def_enum(
+ func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index fda1d71d9db..ebfe23942d9 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -58,99 +58,166 @@
#include "RNA_enum_types.h"
-
const EnumPropertyItem rna_enum_space_type_items[] = {
- /* empty must be here for python, is skipped for UI */
- {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
-
- /* General */
- {0, "", ICON_NONE, "General", ""},
- {SPACE_VIEW3D, "VIEW_3D", ICON_VIEW3D, "3D Viewport", "Manipulate objects in a 3D environment"},
- {SPACE_IMAGE, "IMAGE_EDITOR", ICON_IMAGE, "UV/Image Editor", "View and edit images and UV Maps"},
- {SPACE_NODE, "NODE_EDITOR", ICON_NODETREE, "Node Editor", "Editor for node-based shading and compositing tools"},
- {SPACE_SEQ, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequencer", "Video editing tools"},
- {SPACE_CLIP, "CLIP_EDITOR", ICON_TRACKER, "Movie Clip Editor", "Motion tracking tools"},
-
- /* Animation */
- {0, "", ICON_NONE, "Animation", ""},
- //{SPACE_ACTION, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls (NOTE: Switch to 'Timeline' mode)"}, /* XXX */
- {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"},
- {SPACE_GRAPH, "GRAPH_EDITOR", ICON_GRAPH, "Graph Editor", "Edit drivers and keyframe interpolation"},
- {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", "Combine and layer Actions"},
-
- /* Scripting */
- {0, "", ICON_NONE, "Scripting", ""},
- {SPACE_TEXT, "TEXT_EDITOR", ICON_TEXT, "Text Editor", "Edit scripts and in-file documentation"},
- {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 "
- "(drag down to expand and display)"},
- /* Special case: Top-bar and Status-bar aren't supposed to be a regular editor for the user. */
- {SPACE_TOPBAR, "TOPBAR", ICON_NONE, "Top Bar", "Global bar at the top of the screen for "
- "global per-window settings"},
- {SPACE_STATUSBAR, "STATUSBAR", ICON_NONE, "Status Bar", "Global bar at the bottom of the "
- "screen for general status information"},
-
- /* Data */
- {0, "", ICON_NONE, "Data", ""},
- {SPACE_OUTLINER, "OUTLINER", ICON_OUTLINER, "Outliner", "Overview of scene graph and all available data-blocks"},
- {SPACE_PROPERTIES, "PROPERTIES", ICON_PROPERTIES, "Properties", "Edit properties of active object and related data-blocks"},
- {SPACE_FILE, "FILE_BROWSER", ICON_FILEBROWSER, "File Browser", "Browse for files and assets"},
- {SPACE_USERPREF, "PREFERENCES", ICON_PREFERENCES, "Preferences",
- "Edit persistent configuration settings"},
- {0, NULL, 0, NULL, NULL},
+ /* empty must be here for python, is skipped for UI */
+ {SPACE_EMPTY, "EMPTY", ICON_NONE, "Empty", ""},
+
+ /* General */
+ {0, "", ICON_NONE, "General", ""},
+ {SPACE_VIEW3D,
+ "VIEW_3D",
+ ICON_VIEW3D,
+ "3D Viewport",
+ "Manipulate objects in a 3D environment"},
+ {SPACE_IMAGE,
+ "IMAGE_EDITOR",
+ ICON_IMAGE,
+ "UV/Image Editor",
+ "View and edit images and UV Maps"},
+ {SPACE_NODE,
+ "NODE_EDITOR",
+ ICON_NODETREE,
+ "Node Editor",
+ "Editor for node-based shading and compositing tools"},
+ {SPACE_SEQ, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequencer", "Video editing tools"},
+ {SPACE_CLIP, "CLIP_EDITOR", ICON_TRACKER, "Movie Clip Editor", "Motion tracking tools"},
+
+ /* Animation */
+ {0, "", ICON_NONE, "Animation", ""},
+ //{SPACE_ACTION, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls (NOTE: Switch to 'Timeline' mode)"}, /* XXX */
+ {SPACE_ACTION, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", "Adjust timing of keyframes"},
+ {SPACE_GRAPH,
+ "GRAPH_EDITOR",
+ ICON_GRAPH,
+ "Graph Editor",
+ "Edit drivers and keyframe interpolation"},
+ {SPACE_NLA, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", "Combine and layer Actions"},
+
+ /* Scripting */
+ {0, "", ICON_NONE, "Scripting", ""},
+ {SPACE_TEXT,
+ "TEXT_EDITOR",
+ ICON_TEXT,
+ "Text Editor",
+ "Edit scripts and in-file documentation"},
+ {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 "
+ "(drag down to expand and display)"},
+ /* Special case: Top-bar and Status-bar aren't supposed to be a regular editor for the user. */
+ {SPACE_TOPBAR,
+ "TOPBAR",
+ ICON_NONE,
+ "Top Bar",
+ "Global bar at the top of the screen for "
+ "global per-window settings"},
+ {SPACE_STATUSBAR,
+ "STATUSBAR",
+ ICON_NONE,
+ "Status Bar",
+ "Global bar at the bottom of the "
+ "screen for general status information"},
+
+ /* Data */
+ {0, "", ICON_NONE, "Data", ""},
+ {SPACE_OUTLINER,
+ "OUTLINER",
+ ICON_OUTLINER,
+ "Outliner",
+ "Overview of scene graph and all available data-blocks"},
+ {SPACE_PROPERTIES,
+ "PROPERTIES",
+ ICON_PROPERTIES,
+ "Properties",
+ "Edit properties of active object and related data-blocks"},
+ {SPACE_FILE, "FILE_BROWSER", ICON_FILEBROWSER, "File Browser", "Browse for files and assets"},
+ {SPACE_USERPREF,
+ "PREFERENCES",
+ ICON_PREFERENCES,
+ "Preferences",
+ "Edit persistent configuration settings"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_space_graph_mode_items[] = {
- {SIPO_MODE_ANIMATION, "FCURVES", ICON_GRAPH, "Graph Editor",
- "Edit animation/keyframes displayed as 2D curves"},
- {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
- {0, NULL, 0, NULL, NULL},
+ {SIPO_MODE_ANIMATION,
+ "FCURVES",
+ ICON_GRAPH,
+ "Graph Editor",
+ "Edit animation/keyframes displayed as 2D curves"},
+ {SIPO_MODE_DRIVERS, "DRIVERS", ICON_DRIVER, "Drivers", "Edit drivers"},
+ {0, NULL, 0, NULL, NULL},
};
#define SACT_ITEM_DOPESHEET \
- {SACTCONT_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dope Sheet", "Edit all keyframes in scene"}
+ { \
+ SACTCONT_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dope Sheet", "Edit all keyframes in scene" \
+ }
#define SACT_ITEM_TIMELINE \
- {SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls"}
+ { \
+ SACTCONT_TIMELINE, "TIMELINE", ICON_TIME, "Timeline", "Timeline and playback controls" \
+ }
#define SACT_ITEM_ACTION \
- {SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", "Edit keyframes in active object's Object-level action"}
+ { \
+ SACTCONT_ACTION, "ACTION", ICON_OBJECT_DATA, "Action Editor", \
+ "Edit keyframes in active object's Object-level action" \
+ }
#define SACT_ITEM_SHAPEKEY \
- {SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", "Edit keyframes in active object's Shape Keys action"}
+ { \
+ SACTCONT_SHAPEKEY, "SHAPEKEY", ICON_SHAPEKEY_DATA, "Shape Key Editor", \
+ "Edit keyframes in active object's Shape Keys action" \
+ }
#define SACT_ITEM_GPENCIL \
- {SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Edit timings for all Grease Pencil sketches in file"}
+ { \
+ SACTCONT_GPENCIL, "GPENCIL", ICON_GREASEPENCIL, "Grease Pencil", \
+ "Edit timings for all Grease Pencil sketches in file" \
+ }
#define SACT_ITEM_MASK \
- {SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines"}
+ { \
+ SACTCONT_MASK, "MASK", ICON_MOD_MASK, "Mask", "Edit timings for Mask Editor splines" \
+ }
#define SACT_ITEM_CACHEFILE \
- {SACTCONT_CACHEFILE, "CACHEFILE", ICON_FILE, "Cache File", "Edit timings for Cache File data-blocks"}
+ { \
+ SACTCONT_CACHEFILE, "CACHEFILE", ICON_FILE, "Cache File", \
+ "Edit timings for Cache File data-blocks" \
+ }
#ifndef RNA_RUNTIME
/* XXX: action-editor is currently for object-level only actions, so show that using object-icon hint */
static EnumPropertyItem rna_enum_space_action_mode_all_items[] = {
- SACT_ITEM_DOPESHEET,
- SACT_ITEM_TIMELINE,
- SACT_ITEM_ACTION,
- SACT_ITEM_SHAPEKEY,
- SACT_ITEM_GPENCIL,
- SACT_ITEM_MASK,
- SACT_ITEM_CACHEFILE,
- {0, NULL, 0, NULL, NULL},
+ SACT_ITEM_DOPESHEET,
+ SACT_ITEM_TIMELINE,
+ SACT_ITEM_ACTION,
+ SACT_ITEM_SHAPEKEY,
+ SACT_ITEM_GPENCIL,
+ SACT_ITEM_MASK,
+ SACT_ITEM_CACHEFILE,
+ {0, NULL, 0, NULL, NULL},
};
static EnumPropertyItem rna_enum_space_action_ui_mode_items[] = {
- SACT_ITEM_DOPESHEET,
- /* SACT_ITEM_TIMELINE, */
- SACT_ITEM_ACTION,
- SACT_ITEM_SHAPEKEY,
- SACT_ITEM_GPENCIL,
- SACT_ITEM_MASK,
- SACT_ITEM_CACHEFILE,
- {0, NULL, 0, NULL, NULL},
+ SACT_ITEM_DOPESHEET,
+ /* SACT_ITEM_TIMELINE, */
+ SACT_ITEM_ACTION,
+ SACT_ITEM_SHAPEKEY,
+ SACT_ITEM_GPENCIL,
+ SACT_ITEM_MASK,
+ SACT_ITEM_CACHEFILE,
+ {0, NULL, 0, NULL, NULL},
};
#endif
/* expose as ui_mode */
const EnumPropertyItem rna_enum_space_action_mode_items[] = {
- SACT_ITEM_DOPESHEET,
- SACT_ITEM_TIMELINE,
- {0, NULL, 0, NULL, NULL},
+ SACT_ITEM_DOPESHEET,
+ SACT_ITEM_TIMELINE,
+ {0, NULL, 0, NULL, NULL},
};
#undef SACT_ITEM_DOPESHEET
@@ -161,35 +228,42 @@ const EnumPropertyItem rna_enum_space_action_mode_items[] = {
#undef SACT_ITEM_MASK
#undef SACT_ITEM_CACHEFILE
-
#define SI_ITEM_VIEW(name, icon) \
- {SI_MODE_VIEW, "VIEW", icon, name, "View the image"}
+ { \
+ SI_MODE_VIEW, "VIEW", icon, name, "View the image" \
+ }
#define SI_ITEM_UV \
- {SI_MODE_UV, "UV", ICON_UV, "UV Editor", "UV edit in mesh editmode"}
+ { \
+ SI_MODE_UV, "UV", ICON_UV, "UV Editor", "UV edit in mesh editmode" \
+ }
#define SI_ITEM_PAINT \
- {SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode"}
+ { \
+ SI_MODE_PAINT, "PAINT", ICON_TPAINT_HLT, "Paint", "2D image painting mode" \
+ }
#define SI_ITEM_MASK \
- {SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing"}
+ { \
+ SI_MODE_MASK, "MASK", ICON_MOD_MASK, "Mask", "Mask editing" \
+ }
const EnumPropertyItem rna_enum_space_image_mode_all_items[] = {
- SI_ITEM_VIEW("View", ICON_FILE_IMAGE),
- SI_ITEM_UV,
- SI_ITEM_PAINT,
- SI_ITEM_MASK,
- {0, NULL, 0, NULL, NULL},
+ SI_ITEM_VIEW("View", ICON_FILE_IMAGE),
+ SI_ITEM_UV,
+ SI_ITEM_PAINT,
+ SI_ITEM_MASK,
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_space_image_mode_ui_items[] = {
- SI_ITEM_VIEW("View", ICON_FILE_IMAGE),
- SI_ITEM_PAINT,
- SI_ITEM_MASK,
- {0, NULL, 0, NULL, NULL},
+ SI_ITEM_VIEW("View", ICON_FILE_IMAGE),
+ SI_ITEM_PAINT,
+ SI_ITEM_MASK,
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_space_image_mode_items[] = {
- SI_ITEM_VIEW("Image Editor", ICON_IMAGE),
- SI_ITEM_UV,
- {0, NULL, 0, NULL, NULL},
+ SI_ITEM_VIEW("Image Editor", ICON_IMAGE),
+ SI_ITEM_UV,
+ {0, NULL, 0, NULL, NULL},
};
#undef SI_ITEM_VIEW
@@ -197,25 +271,20 @@ const EnumPropertyItem rna_enum_space_image_mode_items[] = {
#undef SI_ITEM_PAINT
#undef SI_ITEM_MASK
-#define V3D_S3D_CAMERA_LEFT {STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""},
-#define V3D_S3D_CAMERA_RIGHT {STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""},
-#define V3D_S3D_CAMERA_S3D {STEREO_3D_ID, "S3D", ICON_CAMERA_STEREO, "3D", ""},
+#define V3D_S3D_CAMERA_LEFT {STEREO_LEFT_ID, "LEFT", ICON_RESTRICT_RENDER_OFF, "Left", ""},
+#define V3D_S3D_CAMERA_RIGHT {STEREO_RIGHT_ID, "RIGHT", ICON_RESTRICT_RENDER_OFF, "Right", ""},
+#define V3D_S3D_CAMERA_S3D {STEREO_3D_ID, "S3D", ICON_CAMERA_STEREO, "3D", ""},
#ifdef RNA_RUNTIME
-#define V3D_S3D_CAMERA_VIEWS {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""},
+# define V3D_S3D_CAMERA_VIEWS {STEREO_MONO_ID, "MONO", ICON_RESTRICT_RENDER_OFF, "Views", ""},
#endif
static const EnumPropertyItem stereo3d_camera_items[] = {
- V3D_S3D_CAMERA_LEFT
- V3D_S3D_CAMERA_RIGHT
- V3D_S3D_CAMERA_S3D
- {0, NULL, 0, NULL, NULL},
+ V3D_S3D_CAMERA_LEFT V3D_S3D_CAMERA_RIGHT V3D_S3D_CAMERA_S3D{0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
static const EnumPropertyItem multiview_camera_items[] = {
- V3D_S3D_CAMERA_VIEWS
- V3D_S3D_CAMERA_S3D
- {0, NULL, 0, NULL, NULL},
+ V3D_S3D_CAMERA_VIEWS V3D_S3D_CAMERA_S3D{0, NULL, 0, NULL, NULL},
};
#endif
@@ -233,1002 +302,1058 @@ static const EnumPropertyItem stereo3d_eye_items[] = {
#endif
static const EnumPropertyItem display_channels_items[] = {
- {SI_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
- "Display image with RGB colors and alpha transparency"},
- {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
- {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Display alpha transparency channel"},
- {SI_SHOW_ZBUF, "Z_BUFFER", ICON_IMAGE_ZDEPTH, "Z-Buffer",
- "Display Z-buffer associated with image (mapped from camera clip start to end)"},
- {SI_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
- {SI_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
- {SI_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
- {0, NULL, 0, NULL, NULL},
+ {SI_USE_ALPHA,
+ "COLOR_ALPHA",
+ ICON_IMAGE_RGB_ALPHA,
+ "Color and Alpha",
+ "Display image with RGB colors and alpha transparency"},
+ {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
+ {SI_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Display alpha transparency channel"},
+ {SI_SHOW_ZBUF,
+ "Z_BUFFER",
+ ICON_IMAGE_ZDEPTH,
+ "Z-Buffer",
+ "Display Z-buffer associated with image (mapped from camera clip start to end)"},
+ {SI_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
+ {SI_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
+ {SI_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem autosnap_items[] = {
- {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
- /* {-1, "", 0, "", ""}, */
- {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"},
- {SACTSNAP_TSTEP, "TIME_STEP", 0, "Second Step", "Snap to 1.0 second intervals"},
- /* {-1, "", 0, "", ""}, */
- {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames (nla-action time)"},
- {SACTSNAP_SECOND, "SECOND", 0, "Nearest Second", "Snap to actual seconds (nla-action time)"},
- /* {-1, "", 0, "", ""}, */
- {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
- {0, NULL, 0, NULL, NULL},
+ {SACTSNAP_OFF, "NONE", 0, "No Auto-Snap", ""},
+ /* {-1, "", 0, "", ""}, */
+ {SACTSNAP_STEP, "STEP", 0, "Frame Step", "Snap to 1.0 frame intervals"},
+ {SACTSNAP_TSTEP, "TIME_STEP", 0, "Second Step", "Snap to 1.0 second intervals"},
+ /* {-1, "", 0, "", ""}, */
+ {SACTSNAP_FRAME, "FRAME", 0, "Nearest Frame", "Snap to actual frames (nla-action time)"},
+ {SACTSNAP_SECOND, "SECOND", 0, "Nearest Second", "Snap to actual seconds (nla-action time)"},
+ /* {-1, "", 0, "", ""}, */
+ {SACTSNAP_MARKER, "MARKER", 0, "Nearest Marker", "Snap to nearest marker"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_shading_type_items[] = {
- {OB_WIRE, "WIREFRAME", ICON_SHADING_WIRE, "Wireframe", "Display the object as wire edges"},
- {OB_SOLID, "SOLID", ICON_SHADING_SOLID, "Solid", "Display in solid mode"},
- {OB_MATERIAL, "MATERIAL", ICON_SHADING_TEXTURE, "LookDev", "Display in LookDev mode"},
- {OB_RENDER, "RENDERED", ICON_SHADING_RENDERED, "Rendered", "Display render preview"},
- {0, NULL, 0, NULL, NULL},
+ {OB_WIRE, "WIREFRAME", ICON_SHADING_WIRE, "Wireframe", "Display the object as wire edges"},
+ {OB_SOLID, "SOLID", ICON_SHADING_SOLID, "Solid", "Display in solid mode"},
+ {OB_MATERIAL, "MATERIAL", ICON_SHADING_TEXTURE, "LookDev", "Display in LookDev mode"},
+ {OB_RENDER, "RENDERED", ICON_SHADING_RENDERED, "Rendered", "Display render preview"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
- {V3D_LIGHTING_FLAT, "FLAT", 0, "Flat", "Display using flat lighting"},
- {V3D_LIGHTING_STUDIO, "STUDIO", 0, "Studio", "Display using studio lighting"},
- {V3D_LIGHTING_MATCAP, "MATCAP", 0, "MatCap", "Display using matcap material and lighting"},
- {0, NULL, 0, NULL, NULL},
+ {V3D_LIGHTING_FLAT, "FLAT", 0, "Flat", "Display using flat lighting"},
+ {V3D_LIGHTING_STUDIO, "STUDIO", 0, "Studio", "Display using studio lighting"},
+ {V3D_LIGHTING_MATCAP, "MATCAP", 0, "MatCap", "Display using matcap material and lighting"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem rna_enum_shading_color_type_items[] = {
- {V3D_SHADING_SINGLE_COLOR, "SINGLE", 0, "Single", "Show scene in a single color"},
- {V3D_SHADING_MATERIAL_COLOR, "MATERIAL", 0, "Material", "Show material color"},
- {V3D_SHADING_OBJECT_COLOR, "OBJECT", 0, "Object", "Show object color"},
- {V3D_SHADING_RANDOM_COLOR, "RANDOM", 0, "Random", "Show random object color"},
- {V3D_SHADING_TEXTURE_COLOR, "TEXTURE", 0, "Texture", "Show texture"},
- {0, NULL, 0, NULL, NULL},
+ {V3D_SHADING_SINGLE_COLOR, "SINGLE", 0, "Single", "Show scene in a single color"},
+ {V3D_SHADING_MATERIAL_COLOR, "MATERIAL", 0, "Material", "Show material color"},
+ {V3D_SHADING_OBJECT_COLOR, "OBJECT", 0, "Object", "Show object color"},
+ {V3D_SHADING_RANDOM_COLOR, "RANDOM", 0, "Random", "Show random object color"},
+ {V3D_SHADING_TEXTURE_COLOR, "TEXTURE", 0, "Texture", "Show texture"},
+ {0, NULL, 0, NULL, NULL},
};
-
static const EnumPropertyItem rna_enum_studio_light_items[] = {
- {0, "DEFAULT", 0, "Default", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "DEFAULT", 0, "Default", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_clip_editor_mode_items[] = {
- {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
- {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
- {0, NULL, 0, NULL, NULL},
+ {SC_MODE_TRACKING, "TRACKING", ICON_ANIM_DATA, "Tracking", "Show tracking and solving tools"},
+ {SC_MODE_MASKEDIT, "MASK", ICON_MOD_MASK, "Mask", "Show mask editing tools"},
+ {0, NULL, 0, NULL, NULL},
};
/* Actually populated dynamically trough a function, but helps for context-less access (e.g. doc, i18n...). */
static const EnumPropertyItem buttons_context_items[] = {
- {BCONTEXT_TOOL, "TOOL", ICON_TOOL_SETTINGS, "Tool", "Active Tool and Workspace settings"},
- {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"},
- {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"},
- {BCONTEXT_OUTPUT, "OUTPUT", ICON_OUTPUT, "Output", "Output"},
- {BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "View Layer"},
- {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
- {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
- {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object Constraints"},
- {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Modifiers"},
- {BCONTEXT_DATA, "DATA", ICON_NONE, "Data", "Object Data"},
- {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
- {BCONTEXT_BONE_CONSTRAINT, "BONE_CONSTRAINT", ICON_CONSTRAINT_BONE, "Bone Constraints", "Bone Constraints"},
- {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
- {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
- {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particles"},
- {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
- {BCONTEXT_SHADERFX, "SHADERFX", ICON_SHADERFX, "Effects", "Object visual effects" },
- {0, NULL, 0, NULL, NULL},
+ {BCONTEXT_TOOL, "TOOL", ICON_TOOL_SETTINGS, "Tool", "Active Tool and Workspace settings"},
+ {BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"},
+ {BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"},
+ {BCONTEXT_OUTPUT, "OUTPUT", ICON_OUTPUT, "Output", "Output"},
+ {BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "View Layer"},
+ {BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
+ {BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
+ {BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object Constraints"},
+ {BCONTEXT_MODIFIER, "MODIFIER", ICON_MODIFIER, "Modifiers", "Modifiers"},
+ {BCONTEXT_DATA, "DATA", ICON_NONE, "Data", "Object Data"},
+ {BCONTEXT_BONE, "BONE", ICON_BONE_DATA, "Bone", "Bone"},
+ {BCONTEXT_BONE_CONSTRAINT,
+ "BONE_CONSTRAINT",
+ ICON_CONSTRAINT_BONE,
+ "Bone Constraints",
+ "Bone Constraints"},
+ {BCONTEXT_MATERIAL, "MATERIAL", ICON_MATERIAL, "Material", "Material"},
+ {BCONTEXT_TEXTURE, "TEXTURE", ICON_TEXTURE, "Texture", "Texture"},
+ {BCONTEXT_PARTICLE, "PARTICLES", ICON_PARTICLES, "Particles", "Particles"},
+ {BCONTEXT_PHYSICS, "PHYSICS", ICON_PHYSICS, "Physics", "Physics"},
+ {BCONTEXT_SHADERFX, "SHADERFX", ICON_SHADERFX, "Effects", "Object visual effects"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
- {0, "NONE", 0, "None", "Only list current directory's content, with no recursion"},
- {1, "BLEND", 0, "Blend File", "List .blend files' content"},
- {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"},
- {3, "ALL_2", 0, "Two Levels", "List all sub-directories' content, two levels of recursion"},
- {4, "ALL_3", 0, "Three Levels", "List all sub-directories' content, three levels of recursion"},
- {0, NULL, 0, NULL, NULL},
+ {0, "NONE", 0, "None", "Only list current directory's content, with no recursion"},
+ {1, "BLEND", 0, "Blend File", "List .blend files' content"},
+ {2, "ALL_1", 0, "One Level", "List all sub-directories' content, one level of recursion"},
+ {3, "ALL_2", 0, "Two Levels", "List all sub-directories' content, two levels of recursion"},
+ {4,
+ "ALL_3",
+ 0,
+ "Three Levels",
+ "List all sub-directories' content, three levels of recursion"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_file_sort_items[] = {
- {FILE_SORT_ALPHA, "FILE_SORT_ALPHA", ICON_SORTALPHA, "Sort alphabetically", "Sort the file list alphabetically"},
- {FILE_SORT_EXTENSION, "FILE_SORT_EXTENSION", ICON_SORTBYEXT, "Sort by extension", "Sort the file list by extension/type"},
- {FILE_SORT_TIME, "FILE_SORT_TIME", ICON_SORTTIME, "Sort by time", "Sort files by modification time"},
- {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
- {0, NULL, 0, NULL, NULL},
+ {FILE_SORT_ALPHA,
+ "FILE_SORT_ALPHA",
+ ICON_SORTALPHA,
+ "Sort alphabetically",
+ "Sort the file list alphabetically"},
+ {FILE_SORT_EXTENSION,
+ "FILE_SORT_EXTENSION",
+ ICON_SORTBYEXT,
+ "Sort by extension",
+ "Sort the file list by extension/type"},
+ {FILE_SORT_TIME,
+ "FILE_SORT_TIME",
+ ICON_SORTTIME,
+ "Sort by time",
+ "Sort files by modification time"},
+ {FILE_SORT_SIZE, "FILE_SORT_SIZE", ICON_SORTSIZE, "Sort by size", "Sort files by size"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "DNA_anim_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_userdef_types.h"
-
-#include "BLI_path_util.h"
-#include "BLI_string.h"
-
-#include "BKE_animsys.h"
-#include "BKE_brush.h"
-#include "BKE_colortools.h"
-#include "BKE_context.h"
-#include "BKE_layer.h"
-#include "BKE_global.h"
-#include "BKE_nla.h"
-#include "BKE_paint.h"
-#include "BKE_scene.h"
-#include "BKE_screen.h"
-#include "BKE_icons.h"
-#include "BKE_workspace.h"
-
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
-
-#include "ED_anim_api.h"
-#include "ED_buttons.h"
-#include "ED_fileselect.h"
-#include "ED_image.h"
-#include "ED_node.h"
-#include "ED_transform.h"
-#include "ED_screen.h"
-#include "ED_view3d.h"
-#include "ED_sequencer.h"
-#include "ED_clip.h"
-
-#include "GPU_material.h"
-
-#include "IMB_imbuf_types.h"
-
-#include "UI_interface.h"
-#include "UI_view2d.h"
+# include "DNA_anim_types.h"
+# include "DNA_scene_types.h"
+# include "DNA_screen_types.h"
+# include "DNA_userdef_types.h"
+
+# include "BLI_path_util.h"
+# include "BLI_string.h"
+
+# include "BKE_animsys.h"
+# include "BKE_brush.h"
+# include "BKE_colortools.h"
+# include "BKE_context.h"
+# include "BKE_layer.h"
+# include "BKE_global.h"
+# include "BKE_nla.h"
+# include "BKE_paint.h"
+# include "BKE_scene.h"
+# include "BKE_screen.h"
+# include "BKE_icons.h"
+# include "BKE_workspace.h"
+
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
+
+# include "ED_anim_api.h"
+# include "ED_buttons.h"
+# include "ED_fileselect.h"
+# include "ED_image.h"
+# include "ED_node.h"
+# include "ED_transform.h"
+# include "ED_screen.h"
+# include "ED_view3d.h"
+# include "ED_sequencer.h"
+# include "ED_clip.h"
+
+# include "GPU_material.h"
+
+# include "IMB_imbuf_types.h"
+
+# include "UI_interface.h"
+# include "UI_view2d.h"
static StructRNA *rna_Space_refine(struct PointerRNA *ptr)
{
- SpaceLink *space = (SpaceLink *)ptr->data;
-
- switch (space->spacetype) {
- case SPACE_VIEW3D:
- return &RNA_SpaceView3D;
- case SPACE_GRAPH:
- return &RNA_SpaceGraphEditor;
- case SPACE_OUTLINER:
- return &RNA_SpaceOutliner;
- case SPACE_PROPERTIES:
- return &RNA_SpaceProperties;
- case SPACE_FILE:
- return &RNA_SpaceFileBrowser;
- case SPACE_IMAGE:
- return &RNA_SpaceImageEditor;
- case SPACE_INFO:
- return &RNA_SpaceInfo;
- case SPACE_SEQ:
- return &RNA_SpaceSequenceEditor;
- case SPACE_TEXT:
- return &RNA_SpaceTextEditor;
- case SPACE_ACTION:
- return &RNA_SpaceDopeSheetEditor;
- case SPACE_NLA:
- return &RNA_SpaceNLA;
- case SPACE_NODE:
- return &RNA_SpaceNodeEditor;
- case SPACE_CONSOLE:
- return &RNA_SpaceConsole;
- case SPACE_USERPREF:
- return &RNA_SpacePreferences;
- case SPACE_CLIP:
- return &RNA_SpaceClipEditor;
- default:
- return &RNA_Space;
- }
+ SpaceLink *space = (SpaceLink *)ptr->data;
+
+ switch (space->spacetype) {
+ case SPACE_VIEW3D:
+ return &RNA_SpaceView3D;
+ case SPACE_GRAPH:
+ return &RNA_SpaceGraphEditor;
+ case SPACE_OUTLINER:
+ return &RNA_SpaceOutliner;
+ case SPACE_PROPERTIES:
+ return &RNA_SpaceProperties;
+ case SPACE_FILE:
+ return &RNA_SpaceFileBrowser;
+ case SPACE_IMAGE:
+ return &RNA_SpaceImageEditor;
+ case SPACE_INFO:
+ return &RNA_SpaceInfo;
+ case SPACE_SEQ:
+ return &RNA_SpaceSequenceEditor;
+ case SPACE_TEXT:
+ return &RNA_SpaceTextEditor;
+ case SPACE_ACTION:
+ return &RNA_SpaceDopeSheetEditor;
+ case SPACE_NLA:
+ return &RNA_SpaceNLA;
+ case SPACE_NODE:
+ return &RNA_SpaceNodeEditor;
+ case SPACE_CONSOLE:
+ return &RNA_SpaceConsole;
+ case SPACE_USERPREF:
+ return &RNA_SpacePreferences;
+ case SPACE_CLIP:
+ return &RNA_SpaceClipEditor;
+ default:
+ return &RNA_Space;
+ }
}
static ScrArea *rna_area_from_space(PointerRNA *ptr)
{
- bScreen *sc = (bScreen *)ptr->id.data;
- SpaceLink *link = (SpaceLink *)ptr->data;
- return BKE_screen_find_area_from_space(sc, link);
+ bScreen *sc = (bScreen *)ptr->id.data;
+ SpaceLink *link = (SpaceLink *)ptr->data;
+ return BKE_screen_find_area_from_space(sc, link);
}
-static void area_region_from_regiondata(bScreen *sc, void *regiondata, ScrArea **r_sa, ARegion **r_ar)
+static void area_region_from_regiondata(bScreen *sc,
+ void *regiondata,
+ ScrArea **r_sa,
+ ARegion **r_ar)
{
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- *r_sa = NULL;
- *r_ar = NULL;
+ *r_sa = NULL;
+ *r_ar = NULL;
- for (sa = sc->areabase.first; sa; sa = sa->next) {
- for (ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->regiondata == regiondata) {
- *r_sa = sa;
- *r_ar = ar;
- return;
- }
- }
- }
+ for (sa = sc->areabase.first; sa; sa = sa->next) {
+ for (ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->regiondata == regiondata) {
+ *r_sa = sa;
+ *r_ar = ar;
+ return;
+ }
+ }
+ }
}
static void rna_area_region_from_regiondata(PointerRNA *ptr, ScrArea **r_sa, ARegion **r_ar)
{
- bScreen *sc = (bScreen *)ptr->id.data;
- void *regiondata = ptr->data;
+ bScreen *sc = (bScreen *)ptr->id.data;
+ void *regiondata = ptr->data;
- area_region_from_regiondata(sc, regiondata, r_sa, r_ar);
+ area_region_from_regiondata(sc, regiondata, r_sa, r_ar);
}
static bool rna_Space_view2d_sync_get(PointerRNA *ptr)
{
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- View2D *v2d = &ar->v2d;
- return (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME) != 0;
- }
+ sa = rna_area_from_space(ptr); /* can be NULL */
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (ar) {
+ View2D *v2d = &ar->v2d;
+ return (v2d->flag & V2D_VIEWSYNC_SCREEN_TIME) != 0;
+ }
- return false;
+ return false;
}
static void rna_Space_view2d_sync_set(PointerRNA *ptr, bool value)
{
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- View2D *v2d = &ar->v2d;
- if (value) {
- v2d->flag |= V2D_VIEWSYNC_SCREEN_TIME;
- }
- else {
- v2d->flag &= ~V2D_VIEWSYNC_SCREEN_TIME;
- }
- }
+ sa = rna_area_from_space(ptr); /* can be NULL */
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (ar) {
+ View2D *v2d = &ar->v2d;
+ if (value) {
+ v2d->flag |= V2D_VIEWSYNC_SCREEN_TIME;
+ }
+ else {
+ v2d->flag &= ~V2D_VIEWSYNC_SCREEN_TIME;
+ }
+ }
}
-static void rna_Space_view2d_sync_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Space_view2d_sync_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ sa = rna_area_from_space(ptr); /* can be NULL */
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- bScreen *sc = (bScreen *)ptr->id.data;
- View2D *v2d = &ar->v2d;
+ if (ar) {
+ bScreen *sc = (bScreen *)ptr->id.data;
+ View2D *v2d = &ar->v2d;
- UI_view2d_sync(sc, sa, v2d, V2D_LOCK_SET);
- }
+ UI_view2d_sync(sc, sa, v2d, V2D_LOCK_SET);
+ }
}
static void rna_GPencil_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
- /* need set all caches as dirty to recalculate onion skinning */
- for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (ob->type == OB_GPENCIL) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
- }
- WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
+ /* need set all caches as dirty to recalculate onion skinning */
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (ob->type == OB_GPENCIL) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+ }
+ WM_main_add_notifier(NC_GPENCIL | NA_EDITED, NULL);
}
/* Space 3D View */
static void rna_SpaceView3D_camera_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- View3D *v3d = (View3D *)(ptr->data);
- if (v3d->scenelock) {
- wmWindowManager *wm = bmain->wm.first;
+ View3D *v3d = (View3D *)(ptr->data);
+ if (v3d->scenelock) {
+ wmWindowManager *wm = bmain->wm.first;
- scene->camera = v3d->camera;
- WM_windows_scene_data_sync(&wm->windows, scene);
- }
+ scene->camera = v3d->camera;
+ WM_windows_scene_data_sync(&wm->windows, scene);
+ }
}
static void rna_SpaceView3D_use_local_camera_set(PointerRNA *ptr, bool value)
{
- View3D *v3d = (View3D *)(ptr->data);
- bScreen *sc = (bScreen *)ptr->id.data;
+ View3D *v3d = (View3D *)(ptr->data);
+ bScreen *sc = (bScreen *)ptr->id.data;
- v3d->scenelock = !value;
+ v3d->scenelock = !value;
- if (!value) {
- Scene *scene = ED_screen_scene_find(sc, G_MAIN->wm.first);
- v3d->camera = scene->camera;
- }
+ if (!value) {
+ Scene *scene = ED_screen_scene_find(sc, G_MAIN->wm.first);
+ v3d->camera = scene->camera;
+ }
}
static float rna_View3DOverlay_GridScaleUnit_get(PointerRNA *ptr)
{
- View3D *v3d = (View3D *)(ptr->data);
- bScreen *screen = ptr->id.data;
- Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first);
+ View3D *v3d = (View3D *)(ptr->data);
+ bScreen *screen = ptr->id.data;
+ Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first);
- return ED_view3d_grid_scale(scene, v3d, NULL);
+ return ED_view3d_grid_scale(scene, v3d, NULL);
}
static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr)
{
- View3D *v3d = (View3D *)(ptr->data);
- ScrArea *sa = rna_area_from_space(ptr);
- void *regiondata = NULL;
- if (sa) {
- ListBase *regionbase = (sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase;
- ARegion *ar = regionbase->last; /* always last in list, weak .. */
- regiondata = ar->regiondata;
- }
+ View3D *v3d = (View3D *)(ptr->data);
+ ScrArea *sa = rna_area_from_space(ptr);
+ void *regiondata = NULL;
+ if (sa) {
+ ListBase *regionbase = (sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase;
+ ARegion *ar = regionbase->last; /* always last in list, weak .. */
+ regiondata = ar->regiondata;
+ }
- return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
+ return rna_pointer_inherit_refine(ptr, &RNA_RegionView3D, regiondata);
}
-static void rna_SpaceView3D_region_quadviews_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_SpaceView3D_region_quadviews_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- View3D *v3d = (View3D *)(ptr->data);
- ScrArea *sa = rna_area_from_space(ptr);
- int i = 3;
+ View3D *v3d = (View3D *)(ptr->data);
+ ScrArea *sa = rna_area_from_space(ptr);
+ int i = 3;
- ARegion *ar = ((sa && sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase)->last;
- ListBase lb = {NULL, NULL};
+ ARegion *ar = ((sa && sa->spacedata.first == v3d) ? &sa->regionbase : &v3d->regionbase)->last;
+ ListBase lb = {NULL, NULL};
- if (ar && ar->alignment == RGN_ALIGN_QSPLIT) {
- while (i-- && ar) {
- ar = ar->prev;
- }
+ if (ar && ar->alignment == RGN_ALIGN_QSPLIT) {
+ while (i-- && ar) {
+ ar = ar->prev;
+ }
- if (i < 0) {
- lb.first = ar;
- }
- }
+ if (i < 0) {
+ lb.first = ar;
+ }
+ }
- rna_iterator_listbase_begin(iter, &lb, NULL);
+ rna_iterator_listbase_begin(iter, &lb, NULL);
}
static PointerRNA rna_SpaceView3D_region_quadviews_get(CollectionPropertyIterator *iter)
{
- void *regiondata = ((ARegion *)rna_iterator_listbase_get(iter))->regiondata;
+ void *regiondata = ((ARegion *)rna_iterator_listbase_get(iter))->regiondata;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_RegionView3D, regiondata);
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_RegionView3D, regiondata);
}
-static void rna_RegionView3D_quadview_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_RegionView3D_quadview_update(Main *UNUSED(main),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- rna_area_region_from_regiondata(ptr, &sa, &ar);
- if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
- ED_view3d_quadview_update(sa, ar, false);
+ rna_area_region_from_regiondata(ptr, &sa, &ar);
+ if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
+ ED_view3d_quadview_update(sa, ar, false);
}
/* same as above but call clip==true */
-static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_RegionView3D_quadview_clip_update(Main *UNUSED(main),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- rna_area_region_from_regiondata(ptr, &sa, &ar);
- if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
- ED_view3d_quadview_update(sa, ar, true);
+ rna_area_region_from_regiondata(ptr, &sa, &ar);
+ if (sa && ar && ar->alignment == RGN_ALIGN_QSPLIT)
+ ED_view3d_quadview_update(sa, ar, true);
}
static void rna_RegionView3D_view_location_get(PointerRNA *ptr, float *values)
{
- RegionView3D *rv3d = (RegionView3D *)(ptr->data);
- negate_v3_v3(values, rv3d->ofs);
+ RegionView3D *rv3d = (RegionView3D *)(ptr->data);
+ negate_v3_v3(values, rv3d->ofs);
}
static void rna_RegionView3D_view_location_set(PointerRNA *ptr, const float *values)
{
- RegionView3D *rv3d = (RegionView3D *)(ptr->data);
- negate_v3_v3(rv3d->ofs, values);
+ RegionView3D *rv3d = (RegionView3D *)(ptr->data);
+ negate_v3_v3(rv3d->ofs, values);
}
static void rna_RegionView3D_view_rotation_get(PointerRNA *ptr, float *values)
{
- RegionView3D *rv3d = (RegionView3D *)(ptr->data);
- invert_qt_qt(values, rv3d->viewquat);
+ RegionView3D *rv3d = (RegionView3D *)(ptr->data);
+ invert_qt_qt(values, rv3d->viewquat);
}
static void rna_RegionView3D_view_rotation_set(PointerRNA *ptr, const float *values)
{
- RegionView3D *rv3d = (RegionView3D *)(ptr->data);
- invert_qt_qt(rv3d->viewquat, values);
+ RegionView3D *rv3d = (RegionView3D *)(ptr->data);
+ invert_qt_qt(rv3d->viewquat, values);
}
static void rna_RegionView3D_view_matrix_set(PointerRNA *ptr, const float *values)
{
- RegionView3D *rv3d = (RegionView3D *)(ptr->data);
- float mat[4][4];
- invert_m4_m4(mat, (float (*)[4])values);
- ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
+ RegionView3D *rv3d = (RegionView3D *)(ptr->data);
+ float mat[4][4];
+ invert_m4_m4(mat, (float(*)[4])values);
+ ED_view3d_from_m4(mat, rv3d->ofs, rv3d->viewquat, &rv3d->dist);
}
static void rna_3DViewShading_type_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- ID *id = ptr->id.data;
- if (GS(id->name) == ID_SCE) {
- return;
- }
-
- for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
- /* XXX Dependency graph does not support CD mask tracking,
- * so we trigger materials shading for until it's properly supported.
- * This is to ensure material batches are all recreated when switching
- * shading type. In the future DEG should replace this and just tag
- * the meshes itself.
- * This hack just tag BKE_MESH_BATCH_DIRTY_SHADING for every mesh that
- * have a material. (see T55059) */
- DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
- }
-
- View3DShading *shading = ptr->data;
- if (shading->type == OB_MATERIAL ||
- (shading->type == OB_RENDER &&
- STR_ELEM(scene->r.engine, RE_engine_id_BLENDER_EEVEE, RE_engine_id_CYCLES)))
- {
- /* When switching from workbench to render or material mode the geometry of any
- * active sculpt session needs to be recalculated. */
- for (Object *ob = bmain->objects.first; ob ; ob = ob->id.next) {
- if (ob->sculpt) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
- }
- }
-
- bScreen *screen = ptr->id.data;
- for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
- if (sl->spacetype == SPACE_VIEW3D) {
- View3D *v3d = (View3D *)sl;
- if (&v3d->shading == shading) {
- ED_view3d_shade_update(bmain, v3d, sa);
- return;
- }
- }
- }
- }
+ ID *id = ptr->id.data;
+ if (GS(id->name) == ID_SCE) {
+ return;
+ }
+
+ for (Material *ma = bmain->materials.first; ma; ma = ma->id.next) {
+ /* XXX Dependency graph does not support CD mask tracking,
+ * so we trigger materials shading for until it's properly supported.
+ * This is to ensure material batches are all recreated when switching
+ * shading type. In the future DEG should replace this and just tag
+ * the meshes itself.
+ * This hack just tag BKE_MESH_BATCH_DIRTY_SHADING for every mesh that
+ * have a material. (see T55059) */
+ DEG_id_tag_update(&ma->id, ID_RECALC_SHADING);
+ }
+
+ View3DShading *shading = ptr->data;
+ if (shading->type == OB_MATERIAL ||
+ (shading->type == OB_RENDER &&
+ STR_ELEM(scene->r.engine, RE_engine_id_BLENDER_EEVEE, RE_engine_id_CYCLES))) {
+ /* When switching from workbench to render or material mode the geometry of any
+ * active sculpt session needs to be recalculated. */
+ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (ob->sculpt) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+ }
+ }
+
+ bScreen *screen = ptr->id.data;
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (SpaceLink *sl = sa->spacedata.first; sl; sl = sl->next) {
+ if (sl->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = (View3D *)sl;
+ if (&v3d->shading == shading) {
+ ED_view3d_shade_update(bmain, v3d, sa);
+ return;
+ }
+ }
+ }
+ }
}
static Scene *rna_3DViewShading_scene(PointerRNA *ptr)
{
- /* Get scene, depends if using 3D view or OpenGL render settings. */
- ID *id = ptr->id.data;
- if (GS(id->name) == ID_SCE) {
- return (Scene *)id;
- }
- else {
- bScreen *screen = ptr->id.data;
- return WM_windows_scene_get_from_screen(G_MAIN->wm.first, screen);
- }
+ /* Get scene, depends if using 3D view or OpenGL render settings. */
+ ID *id = ptr->id.data;
+ if (GS(id->name) == ID_SCE) {
+ return (Scene *)id;
+ }
+ else {
+ bScreen *screen = ptr->id.data;
+ return WM_windows_scene_get_from_screen(G_MAIN->wm.first, screen);
+ }
}
static int rna_3DViewShading_type_get(PointerRNA *ptr)
{
- /* Available shading types depend on render engine. */
- Scene *scene = rna_3DViewShading_scene(ptr);
- RenderEngineType *type = (scene) ? RE_engines_find(scene->r.engine) : NULL;
- View3DShading *shading = (View3DShading *)ptr->data;
-
- if (scene == NULL || BKE_scene_uses_blender_eevee(scene)) {
- return shading->type;
- }
- else if (BKE_scene_uses_blender_workbench(scene)) {
- return (shading->type == OB_MATERIAL) ? OB_RENDER : shading->type;
- }
- else {
- if (shading->type == OB_RENDER && !(type && type->view_draw)) {
- return OB_MATERIAL;
- }
- else {
- return shading->type;
- }
- }
+ /* Available shading types depend on render engine. */
+ Scene *scene = rna_3DViewShading_scene(ptr);
+ RenderEngineType *type = (scene) ? RE_engines_find(scene->r.engine) : NULL;
+ View3DShading *shading = (View3DShading *)ptr->data;
+
+ if (scene == NULL || BKE_scene_uses_blender_eevee(scene)) {
+ return shading->type;
+ }
+ else if (BKE_scene_uses_blender_workbench(scene)) {
+ return (shading->type == OB_MATERIAL) ? OB_RENDER : shading->type;
+ }
+ else {
+ if (shading->type == OB_RENDER && !(type && type->view_draw)) {
+ return OB_MATERIAL;
+ }
+ else {
+ return shading->type;
+ }
+ }
}
static void rna_3DViewShading_type_set(PointerRNA *ptr, int value)
{
- View3DShading *shading = (View3DShading *)ptr->data;
- if (value != shading->type && value == OB_RENDER) {
- shading->prev_type = shading->type;
- }
- shading->type = value;
+ View3DShading *shading = (View3DShading *)ptr->data;
+ if (value != shading->type && value == OB_RENDER) {
+ shading->prev_type = shading->type;
+ }
+ shading->type = value;
}
-static const EnumPropertyItem *rna_3DViewShading_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_3DViewShading_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- Scene *scene = rna_3DViewShading_scene(ptr);
- RenderEngineType *type = (scene) ? RE_engines_find(scene->r.engine) : NULL;
+ Scene *scene = rna_3DViewShading_scene(ptr);
+ RenderEngineType *type = (scene) ? RE_engines_find(scene->r.engine) : NULL;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_WIRE);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_SOLID);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_WIRE);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_SOLID);
- if (scene == NULL || BKE_scene_uses_blender_eevee(scene)) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_MATERIAL);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
- }
- else if (BKE_scene_uses_blender_workbench(scene)) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
- }
- else {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_MATERIAL);
- if (type && type->view_draw) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
- }
- }
+ if (scene == NULL || BKE_scene_uses_blender_eevee(scene)) {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_MATERIAL);
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
+ }
+ else if (BKE_scene_uses_blender_workbench(scene)) {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
+ }
+ else {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_MATERIAL);
+ if (type && type->view_draw) {
+ RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_type_items, OB_RENDER);
+ }
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
/* Shading.selected_studio_light */
static PointerRNA rna_View3DShading_selected_studio_light_get(PointerRNA *ptr)
{
- View3DShading *shading = (View3DShading *)ptr->data;
- StudioLight *sl;
- if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
- sl = BKE_studiolight_find(shading->matcap, STUDIOLIGHT_FLAG_ALL);
- }
- else if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_STUDIO) {
- sl = BKE_studiolight_find(shading->studio_light, STUDIOLIGHT_FLAG_ALL);
- }
- else {
- sl = BKE_studiolight_find(shading->lookdev_light, STUDIOLIGHT_FLAG_ALL);
- }
- return rna_pointer_inherit_refine(ptr, &RNA_StudioLight, sl);
+ View3DShading *shading = (View3DShading *)ptr->data;
+ StudioLight *sl;
+ if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
+ sl = BKE_studiolight_find(shading->matcap, STUDIOLIGHT_FLAG_ALL);
+ }
+ else if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_STUDIO) {
+ sl = BKE_studiolight_find(shading->studio_light, STUDIOLIGHT_FLAG_ALL);
+ }
+ else {
+ sl = BKE_studiolight_find(shading->lookdev_light, STUDIOLIGHT_FLAG_ALL);
+ }
+ return rna_pointer_inherit_refine(ptr, &RNA_StudioLight, sl);
}
/* shading.light */
static int rna_View3DShading_light_get(PointerRNA *ptr)
{
- View3DShading *shading = (View3DShading *)ptr->data;
- return shading->light;
+ View3DShading *shading = (View3DShading *)ptr->data;
+ return shading->light;
}
static void rna_View3DShading_light_set(PointerRNA *ptr, int value)
{
- View3DShading *shading = (View3DShading *)ptr->data;
- if (value == V3D_LIGHTING_MATCAP && shading->color_type == V3D_SHADING_TEXTURE_COLOR) {
- shading->color_type = V3D_SHADING_MATERIAL_COLOR;
- }
- shading->light = value;
-}
-
-static const EnumPropertyItem *rna_View3DShading_color_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
-{
- View3DShading *shading = (View3DShading *)ptr->data;
-
- int totitem = 0;
- EnumPropertyItem *item = NULL;
-
- if (shading->type == OB_SOLID) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_MATERIAL_COLOR);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_OBJECT_COLOR);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_RANDOM_COLOR);
- if (shading->light != V3D_LIGHTING_MATCAP) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_TEXTURE_COLOR);
- }
- }
- else if (shading->type == OB_WIRE) {
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_OBJECT_COLOR);
- RNA_enum_items_add_value(&item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_RANDOM_COLOR);
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
- return item;
+ View3DShading *shading = (View3DShading *)ptr->data;
+ if (value == V3D_LIGHTING_MATCAP && shading->color_type == V3D_SHADING_TEXTURE_COLOR) {
+ shading->color_type = V3D_SHADING_MATERIAL_COLOR;
+ }
+ shading->light = value;
+}
+
+static const EnumPropertyItem *rna_View3DShading_color_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ View3DShading *shading = (View3DShading *)ptr->data;
+
+ int totitem = 0;
+ EnumPropertyItem *item = NULL;
+
+ if (shading->type == OB_SOLID) {
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_MATERIAL_COLOR);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_OBJECT_COLOR);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_RANDOM_COLOR);
+ if (shading->light != V3D_LIGHTING_MATCAP) {
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_TEXTURE_COLOR);
+ }
+ }
+ else if (shading->type == OB_WIRE) {
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_SINGLE_COLOR);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_OBJECT_COLOR);
+ RNA_enum_items_add_value(
+ &item, &totitem, rna_enum_shading_color_type_items, V3D_SHADING_RANDOM_COLOR);
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+ return item;
}
/* Studio light */
static int rna_View3DShading_studio_light_get(PointerRNA *ptr)
{
- View3DShading *shading = (View3DShading *)ptr->data;
- char *dna_storage = shading->studio_light;
-
- int flag = STUDIOLIGHT_TYPE_STUDIO;
- if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
- flag = STUDIOLIGHT_TYPE_MATCAP;
- dna_storage = shading->matcap;
- }
- else if (shading->type == OB_MATERIAL) {
- flag = STUDIOLIGHT_TYPE_WORLD;
- dna_storage = shading->lookdev_light;
- }
- StudioLight *sl = BKE_studiolight_find(dna_storage, flag);
- if (sl) {
- BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE);
- return sl->index;
- }
- else {
- return 0;
- }
+ View3DShading *shading = (View3DShading *)ptr->data;
+ char *dna_storage = shading->studio_light;
+
+ int flag = STUDIOLIGHT_TYPE_STUDIO;
+ if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
+ flag = STUDIOLIGHT_TYPE_MATCAP;
+ dna_storage = shading->matcap;
+ }
+ else if (shading->type == OB_MATERIAL) {
+ flag = STUDIOLIGHT_TYPE_WORLD;
+ dna_storage = shading->lookdev_light;
+ }
+ StudioLight *sl = BKE_studiolight_find(dna_storage, flag);
+ if (sl) {
+ BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE);
+ return sl->index;
+ }
+ else {
+ return 0;
+ }
}
static void rna_View3DShading_studio_light_set(PointerRNA *ptr, int value)
{
- View3DShading *shading = (View3DShading *)ptr->data;
- char *dna_storage = shading->studio_light;
-
- int flag = STUDIOLIGHT_TYPE_STUDIO;
- if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
- flag = STUDIOLIGHT_TYPE_MATCAP;
- dna_storage = shading->matcap;
- }
- else if (shading->type == OB_MATERIAL) {
- flag = STUDIOLIGHT_TYPE_WORLD;
- dna_storage = shading->lookdev_light;
- }
- StudioLight *sl = BKE_studiolight_findindex(value, flag);
- if (sl) {
- BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE);
- }
-}
-
-static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
-{
- View3DShading *shading = (View3DShading *)ptr->data;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
-
- if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
- const int flags = (STUDIOLIGHT_EXTERNAL_FILE | STUDIOLIGHT_TYPE_MATCAP);
-
- LISTBASE_FOREACH(StudioLight *, sl, BKE_studiolight_listbase()) {
- int icon_id = (shading->flag & V3D_SHADING_MATCAP_FLIP_X) ? sl->icon_id_matcap_flipped: sl->icon_id_matcap;
- if ((sl->flag & flags) == flags) {
- EnumPropertyItem tmp = {sl->index, sl->name, icon_id, sl->name, ""};
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- }
- }
- else {
- LISTBASE_FOREACH(StudioLight *, sl, BKE_studiolight_listbase()) {
- int icon_id = sl->icon_id_irradiance;
- bool show_studiolight = false;
-
- if (sl->flag & STUDIOLIGHT_INTERNAL) {
- /* always show internal lights for solid */
- if (shading->type == OB_SOLID) {
- show_studiolight = true;
- }
- }
- else {
- switch (shading->type) {
- case OB_SOLID:
- case OB_TEXTURE:
- show_studiolight = ((sl->flag & STUDIOLIGHT_TYPE_STUDIO) != 0);
- break;
-
- case OB_MATERIAL:
- show_studiolight = ((sl->flag & STUDIOLIGHT_TYPE_WORLD) != 0);
- icon_id = sl->icon_id_radiance;
- break;
- }
- }
-
- if (show_studiolight) {
- EnumPropertyItem tmp = {sl->index, sl->name, icon_id, sl->name, ""};
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- }
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
- return item;
-}
-
-static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(
- bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
-{
- Scene *scene = CTX_data_scene(C);
-
- if (scene->r.views_format == SCE_VIEWS_FORMAT_MULTIVIEW)
- return multiview_camera_items;
- else
- return stereo3d_camera_items;
+ View3DShading *shading = (View3DShading *)ptr->data;
+ char *dna_storage = shading->studio_light;
+
+ int flag = STUDIOLIGHT_TYPE_STUDIO;
+ if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
+ flag = STUDIOLIGHT_TYPE_MATCAP;
+ dna_storage = shading->matcap;
+ }
+ else if (shading->type == OB_MATERIAL) {
+ flag = STUDIOLIGHT_TYPE_WORLD;
+ dna_storage = shading->lookdev_light;
+ }
+ StudioLight *sl = BKE_studiolight_findindex(value, flag);
+ if (sl) {
+ BLI_strncpy(dna_storage, sl->name, FILE_MAXFILE);
+ }
+}
+
+static const EnumPropertyItem *rna_View3DShading_studio_light_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
+{
+ View3DShading *shading = (View3DShading *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
+
+ if (shading->type == OB_SOLID && shading->light == V3D_LIGHTING_MATCAP) {
+ const int flags = (STUDIOLIGHT_EXTERNAL_FILE | STUDIOLIGHT_TYPE_MATCAP);
+
+ LISTBASE_FOREACH (StudioLight *, sl, BKE_studiolight_listbase()) {
+ int icon_id = (shading->flag & V3D_SHADING_MATCAP_FLIP_X) ? sl->icon_id_matcap_flipped :
+ sl->icon_id_matcap;
+ if ((sl->flag & flags) == flags) {
+ EnumPropertyItem tmp = {sl->index, sl->name, icon_id, sl->name, ""};
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+ }
+ else {
+ LISTBASE_FOREACH (StudioLight *, sl, BKE_studiolight_listbase()) {
+ int icon_id = sl->icon_id_irradiance;
+ bool show_studiolight = false;
+
+ if (sl->flag & STUDIOLIGHT_INTERNAL) {
+ /* always show internal lights for solid */
+ if (shading->type == OB_SOLID) {
+ show_studiolight = true;
+ }
+ }
+ else {
+ switch (shading->type) {
+ case OB_SOLID:
+ case OB_TEXTURE:
+ show_studiolight = ((sl->flag & STUDIOLIGHT_TYPE_STUDIO) != 0);
+ break;
+
+ case OB_MATERIAL:
+ show_studiolight = ((sl->flag & STUDIOLIGHT_TYPE_WORLD) != 0);
+ icon_id = sl->icon_id_radiance;
+ break;
+ }
+ }
+
+ if (show_studiolight) {
+ EnumPropertyItem tmp = {sl->index, sl->name, icon_id, sl->name, ""};
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+ return item;
+}
+
+static const EnumPropertyItem *rna_SpaceView3D_stereo3d_camera_itemf(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ Scene *scene = CTX_data_scene(C);
+
+ if (scene->r.views_format == SCE_VIEWS_FORMAT_MULTIVIEW)
+ return multiview_camera_items;
+ else
+ return stereo3d_camera_items;
}
static int rna_SpaceView3D_icon_from_show_object_viewport_get(PointerRNA *ptr)
{
- const View3D *v3d = (View3D *)ptr->data;
- /* Ignore selection values when view is off, intent is to show if visible objects aren't selectable. */
- const int view_value = (v3d->object_type_exclude_viewport != 0);
- const int select_value = (v3d->object_type_exclude_select & ~v3d->object_type_exclude_viewport) != 0;
- return ICON_VIS_SEL_11 + (view_value << 1) + select_value;
+ const View3D *v3d = (View3D *)ptr->data;
+ /* Ignore selection values when view is off, intent is to show if visible objects aren't selectable. */
+ const int view_value = (v3d->object_type_exclude_viewport != 0);
+ const int select_value = (v3d->object_type_exclude_select &
+ ~v3d->object_type_exclude_viewport) != 0;
+ return ICON_VIS_SEL_11 + (view_value << 1) + select_value;
}
static char *rna_View3DShading_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("shading");
+ return BLI_strdup("shading");
}
static PointerRNA rna_SpaceView3D_overlay_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_View3DOverlay, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_View3DOverlay, ptr->data);
}
static char *rna_View3DOverlay_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("overlay");
+ return BLI_strdup("overlay");
}
/* Space Image Editor */
static PointerRNA rna_SpaceImageEditor_uvedit_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_SpaceUVEditor, ptr->data);
}
static void rna_SpaceImageEditor_mode_update(Main *bmain, Scene *scene, PointerRNA *UNUSED(ptr))
{
- ED_space_image_paint_update(bmain, bmain->wm.first, scene);
+ ED_space_image_paint_update(bmain, bmain->wm.first, scene);
}
-
static void rna_SpaceImageEditor_show_stereo_set(PointerRNA *ptr, int value)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
- if (value)
- sima->iuser.flag |= IMA_SHOW_STEREO;
- else
- sima->iuser.flag &= ~IMA_SHOW_STEREO;
+ if (value)
+ sima->iuser.flag |= IMA_SHOW_STEREO;
+ else
+ sima->iuser.flag &= ~IMA_SHOW_STEREO;
}
static bool rna_SpaceImageEditor_show_stereo_get(PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- return (sima->iuser.flag & IMA_SHOW_STEREO) != 0;
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ return (sima->iuser.flag & IMA_SHOW_STEREO) != 0;
}
-static void rna_SpaceImageEditor_show_stereo_update(Main *UNUSED(bmain), Scene *UNUSED(unused), PointerRNA *ptr)
+static void rna_SpaceImageEditor_show_stereo_update(Main *UNUSED(bmain),
+ Scene *UNUSED(unused),
+ PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- Image *ima = sima->image;
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ Image *ima = sima->image;
- if (ima) {
- if (ima->rr) {
- BKE_image_multilayer_index(ima->rr, &sima->iuser);
- }
- else {
- BKE_image_multiview_index(ima, &sima->iuser);
- }
- }
+ if (ima) {
+ if (ima->rr) {
+ BKE_image_multilayer_index(ima->rr, &sima->iuser);
+ }
+ else {
+ BKE_image_multiview_index(ima, &sima->iuser);
+ }
+ }
}
static bool rna_SpaceImageEditor_show_render_get(PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- return ED_space_image_show_render(sima);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ return ED_space_image_show_render(sima);
}
static bool rna_SpaceImageEditor_show_paint_get(PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- return ED_space_image_show_paint(sima);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ return ED_space_image_show_paint(sima);
}
static bool rna_SpaceImageEditor_show_uvedit_get(PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- bScreen *sc = (bScreen *)ptr->id.data;
- wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
- return ED_space_image_show_uvedit(sima, obedit);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ bScreen *sc = (bScreen *)ptr->id.data;
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ return ED_space_image_show_uvedit(sima, obedit);
}
static bool rna_SpaceImageEditor_show_maskedit_get(PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- bScreen *sc = (bScreen *)ptr->id.data;
- wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- return ED_space_image_check_show_maskedit(sima, view_layer);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ bScreen *sc = (bScreen *)ptr->id.data;
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ return ED_space_image_check_show_maskedit(sima, view_layer);
}
static void rna_SpaceImageEditor_image_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
- bScreen *sc = (bScreen *)ptr->id.data;
- wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
+ bScreen *sc = (bScreen *)ptr->id.data;
+ wmWindow *win = ED_screen_window_find(sc, G_MAIN->wm.first);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Object *obedit = OBEDIT_FROM_VIEW_LAYER(view_layer);
- BLI_assert(BKE_id_is_in_global_main(value.data));
- ED_space_image_set(G_MAIN, sima, obedit, (Image *)value.data, false);
+ BLI_assert(BKE_id_is_in_global_main(value.data));
+ ED_space_image_set(G_MAIN, sima, obedit, (Image *)value.data, false);
}
static void rna_SpaceImageEditor_mask_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceImage *sima = (SpaceImage *)(ptr->data);
+ SpaceImage *sima = (SpaceImage *)(ptr->data);
- ED_space_image_set_mask(NULL, sima, (Mask *)value.data);
+ ED_space_image_set_mask(NULL, sima, (Mask *)value.data);
}
static const EnumPropertyItem *rna_SpaceImageEditor_display_channels_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- SpaceImage *sima = (SpaceImage *)ptr->data;
- EnumPropertyItem *item = NULL;
- ImBuf *ibuf;
- void *lock;
- int zbuf, alpha, totitem = 0;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
+ EnumPropertyItem *item = NULL;
+ ImBuf *ibuf;
+ void *lock;
+ int zbuf, alpha, totitem = 0;
- ibuf = ED_space_image_acquire_buffer(sima, &lock);
+ ibuf = ED_space_image_acquire_buffer(sima, &lock);
- alpha = ibuf && (ibuf->channels == 4);
- zbuf = ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1));
+ alpha = ibuf && (ibuf->channels == 4);
+ zbuf = ibuf && (ibuf->zbuf || ibuf->zbuf_float || (ibuf->channels == 1));
- ED_space_image_release_buffer(sima, ibuf, lock);
+ ED_space_image_release_buffer(sima, ibuf, lock);
- if (alpha && zbuf)
- return display_channels_items;
+ if (alpha && zbuf)
+ return display_channels_items;
- if (alpha) {
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_USE_ALPHA);
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, 0);
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_ALPHA);
- }
- else if (zbuf) {
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, 0);
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_ZBUF);
- }
- else {
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, 0);
- }
+ if (alpha) {
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_USE_ALPHA);
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, 0);
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_ALPHA);
+ }
+ else if (zbuf) {
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, 0);
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_ZBUF);
+ }
+ else {
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, 0);
+ }
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_R);
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_G);
- RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_B);
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_R);
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_G);
+ RNA_enum_items_add_value(&item, &totitem, display_channels_items, SI_SHOW_B);
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
static void rna_SpaceImageEditor_zoom_get(PointerRNA *ptr, float *values)
{
- SpaceImage *sima = (SpaceImage *)ptr->data;
- ScrArea *sa;
- ARegion *ar;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
+ ScrArea *sa;
+ ARegion *ar;
- values[0] = values[1] = 1;
+ values[0] = values[1] = 1;
- /* find aregion */
- sa = rna_area_from_space(ptr); /* can be NULL */
- ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- if (ar) {
- ED_space_image_get_zoom(sima, ar, &values[0], &values[1]);
- }
+ /* find aregion */
+ sa = rna_area_from_space(ptr); /* can be NULL */
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ if (ar) {
+ ED_space_image_get_zoom(sima, ar, &values[0], &values[1]);
+ }
}
static void rna_SpaceImageEditor_cursor_location_get(PointerRNA *ptr, float *values)
{
- SpaceImage *sima = (SpaceImage *)ptr->data;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
- if (sima->flag & SI_COORDFLOATS) {
- copy_v2_v2(values, sima->cursor);
- }
- else {
- int w, h;
- ED_space_image_get_size(sima, &w, &h);
+ if (sima->flag & SI_COORDFLOATS) {
+ copy_v2_v2(values, sima->cursor);
+ }
+ else {
+ int w, h;
+ ED_space_image_get_size(sima, &w, &h);
- values[0] = sima->cursor[0] * w;
- values[1] = sima->cursor[1] * h;
- }
+ values[0] = sima->cursor[0] * w;
+ values[1] = sima->cursor[1] * h;
+ }
}
static void rna_SpaceImageEditor_cursor_location_set(PointerRNA *ptr, const float *values)
{
- SpaceImage *sima = (SpaceImage *)ptr->data;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
- if (sima->flag & SI_COORDFLOATS) {
- copy_v2_v2(sima->cursor, values);
- }
- else {
- int w, h;
- ED_space_image_get_size(sima, &w, &h);
+ if (sima->flag & SI_COORDFLOATS) {
+ copy_v2_v2(sima->cursor, values);
+ }
+ else {
+ int w, h;
+ ED_space_image_get_size(sima, &w, &h);
- sima->cursor[0] = values[0] / w;
- sima->cursor[1] = values[1] / h;
- }
+ sima->cursor[0] = values[0] / w;
+ sima->cursor[1] = values[1] / h;
+ }
}
-static void rna_SpaceImageEditor_image_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceImageEditor_image_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)ptr->data;
- Image *ima = sima->image;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
+ Image *ima = sima->image;
- /* make sure all the iuser settings are valid for the sima image */
- if (ima) {
- if (ima->rr) {
- if (BKE_image_multilayer_index(sima->image->rr, &sima->iuser) == NULL) {
- BKE_image_init_imageuser(sima->image, &sima->iuser);
- }
- }
- else {
- BKE_image_multiview_index(ima, &sima->iuser);
- }
- }
+ /* make sure all the iuser settings are valid for the sima image */
+ if (ima) {
+ if (ima->rr) {
+ if (BKE_image_multilayer_index(sima->image->rr, &sima->iuser) == NULL) {
+ BKE_image_init_imageuser(sima->image, &sima->iuser);
+ }
+ }
+ else {
+ BKE_image_multiview_index(ima, &sima->iuser);
+ }
+ }
}
static void rna_SpaceImageEditor_scopes_update(struct bContext *C, struct PointerRNA *ptr)
{
- SpaceImage *sima = (SpaceImage *)ptr->data;
- ImBuf *ibuf;
- void *lock;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
+ ImBuf *ibuf;
+ void *lock;
- ibuf = ED_space_image_acquire_buffer(sima, &lock);
- if (ibuf) {
- ED_space_image_scopes_update(C, sima, ibuf, true);
- WM_main_add_notifier(NC_IMAGE, sima->image);
- }
- ED_space_image_release_buffer(sima, ibuf, lock);
+ ibuf = ED_space_image_acquire_buffer(sima, &lock);
+ if (ibuf) {
+ ED_space_image_scopes_update(C, sima, ibuf, true);
+ WM_main_add_notifier(NC_IMAGE, sima->image);
+ }
+ ED_space_image_release_buffer(sima, ibuf, lock);
}
-static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+static const EnumPropertyItem *rna_SpaceImageEditor_pivot_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- static const EnumPropertyItem pivot_items[] = {
- {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center", ""},
- {V3D_AROUND_CENTER_MEDIAN, "MEDIAN", ICON_PIVOT_MEDIAN, "Median Point", ""},
- {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
- {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
- "Individual Origins", "Pivot around each selected island's own median point"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem pivot_items[] = {
+ {V3D_AROUND_CENTER_BOUNDS, "CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center", ""},
+ {V3D_AROUND_CENTER_MEDIAN, "MEDIAN", ICON_PIVOT_MEDIAN, "Median Point", ""},
+ {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
+ {V3D_AROUND_LOCAL_ORIGINS,
+ "INDIVIDUAL_ORIGINS",
+ ICON_PIVOT_INDIVIDUAL,
+ "Individual Origins",
+ "Pivot around each selected island's own median point"},
+ {0, NULL, 0, NULL, NULL},
+ };
- SpaceImage *sima = (SpaceImage *)ptr->data;
+ SpaceImage *sima = (SpaceImage *)ptr->data;
- if (sima->mode == SI_MODE_PAINT)
- return rna_enum_transform_pivot_items_full;
- else
- return pivot_items;
+ if (sima->mode == SI_MODE_PAINT)
+ return rna_enum_transform_pivot_items_full;
+ else
+ return pivot_items;
}
/* Space Text Editor */
static void rna_SpaceTextEditor_word_wrap_set(PointerRNA *ptr, bool value)
{
- SpaceText *st = (SpaceText *)(ptr->data);
+ SpaceText *st = (SpaceText *)(ptr->data);
- st->wordwrap = value;
- st->left = 0;
+ st->wordwrap = value;
+ st->left = 0;
}
static void rna_SpaceTextEditor_text_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceText *st = (SpaceText *)(ptr->data);
+ SpaceText *st = (SpaceText *)(ptr->data);
- st->text = value.data;
+ st->text = value.data;
- WM_main_add_notifier(NC_TEXT | NA_SELECTED, st->text);
+ WM_main_add_notifier(NC_TEXT | NA_SELECTED, st->text);
}
-static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceText *st = (SpaceText *)ptr->data;
+ SpaceText *st = (SpaceText *)ptr->data;
- if (st->text)
- WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text);
+ if (st->text)
+ WM_main_add_notifier(NC_TEXT | NA_EDITED, st->text);
}
/* Space Properties */
@@ -1236,4117 +1361,4566 @@ static void rna_SpaceTextEditor_updateEdited(Main *UNUSED(bmain), Scene *UNUSED(
/* note: this function exists only to avoid id refcounting */
static void rna_SpaceProperties_pin_id_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
- sbuts->pinid = value.data;
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
+ sbuts->pinid = value.data;
}
static StructRNA *rna_SpaceProperties_pin_id_typef(PointerRNA *ptr)
{
- SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
- if (sbuts->pinid)
- return ID_code_to_RNA_type(GS(sbuts->pinid->name));
+ if (sbuts->pinid)
+ return ID_code_to_RNA_type(GS(sbuts->pinid->name));
- return &RNA_ID;
+ return &RNA_ID;
}
-static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceProperties_pin_id_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
- ID *id = sbuts->pinid;
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
+ ID *id = sbuts->pinid;
- if (id == NULL) {
- sbuts->flag &= ~SB_PIN_CONTEXT;
- return;
- }
+ if (id == NULL) {
+ sbuts->flag &= ~SB_PIN_CONTEXT;
+ return;
+ }
- switch (GS(id->name)) {
- case ID_MA:
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
- break;
- case ID_TE:
- WM_main_add_notifier(NC_TEXTURE, NULL);
- break;
- case ID_WO:
- WM_main_add_notifier(NC_WORLD, NULL);
- break;
- case ID_LA:
- WM_main_add_notifier(NC_LAMP, NULL);
- break;
- default:
- break;
- }
+ switch (GS(id->name)) {
+ case ID_MA:
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING, NULL);
+ break;
+ case ID_TE:
+ WM_main_add_notifier(NC_TEXTURE, NULL);
+ break;
+ case ID_WO:
+ WM_main_add_notifier(NC_WORLD, NULL);
+ break;
+ case ID_LA:
+ WM_main_add_notifier(NC_LAMP, NULL);
+ break;
+ default:
+ break;
+ }
}
-
static void rna_SpaceProperties_context_set(PointerRNA *ptr, int value)
{
- SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
- sbuts->mainb = value;
- sbuts->mainbuser = value;
+ sbuts->mainb = value;
+ sbuts->mainbuser = value;
}
-static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_SpaceProperties_context_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- if (sbuts->pathflag & (1 << BCONTEXT_TOOL)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TOOL);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_TOOL)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TOOL);
+ }
- if (totitem) {
- RNA_enum_item_add_separator(&item, &totitem);
- }
+ if (totitem) {
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_RENDER)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_RENDER)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_RENDER);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_OUTPUT)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OUTPUT);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_OUTPUT)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OUTPUT);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_VIEW_LAYER);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_VIEW_LAYER)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_VIEW_LAYER);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_SCENE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SCENE);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_WORLD)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORLD);
+ }
- if (totitem) {
- RNA_enum_item_add_separator(&item, &totitem);
- }
+ if (totitem) {
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MODIFIER);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_MODIFIER)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MODIFIER);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_SHADERFX)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SHADERFX);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_SHADERFX)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_SHADERFX);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_PARTICLE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PARTICLE);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_PHYSICS)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_PHYSICS);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_CONSTRAINT)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_CONSTRAINT);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_DATA)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_DATA);
- (item + totitem - 1)->icon = sbuts->dataicon;
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_DATA)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_DATA);
+ (item + totitem - 1)->icon = sbuts->dataicon;
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_BONE)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_BONE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_BONE_CONSTRAINT)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE_CONSTRAINT);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_BONE_CONSTRAINT)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_BONE_CONSTRAINT);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_MATERIAL)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MATERIAL);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_MATERIAL)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_MATERIAL);
+ }
- if (totitem) {
- RNA_enum_item_add_separator(&item, &totitem);
- }
+ if (totitem) {
+ RNA_enum_item_add_separator(&item, &totitem);
+ }
- if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE);
- }
+ if (sbuts->pathflag & (1 << BCONTEXT_TEXTURE)) {
+ RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_TEXTURE);
+ }
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
-static void rna_SpaceProperties_context_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceProperties_context_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
- /* XXX BCONTEXT_DATA is ugly, but required for lights... See T51318. */
- if (ELEM(sbuts->mainb, BCONTEXT_WORLD, BCONTEXT_MATERIAL, BCONTEXT_TEXTURE, BCONTEXT_DATA)) {
- sbuts->preview = 1;
- }
+ SpaceProperties *sbuts = (SpaceProperties *)(ptr->data);
+ /* XXX BCONTEXT_DATA is ugly, but required for lights... See T51318. */
+ if (ELEM(sbuts->mainb, BCONTEXT_WORLD, BCONTEXT_MATERIAL, BCONTEXT_TEXTURE, BCONTEXT_DATA)) {
+ sbuts->preview = 1;
+ }
}
/* Space Console */
static void rna_ConsoleLine_body_get(PointerRNA *ptr, char *value)
{
- ConsoleLine *ci = (ConsoleLine *)ptr->data;
- memcpy(value, ci->line, ci->len + 1);
+ ConsoleLine *ci = (ConsoleLine *)ptr->data;
+ memcpy(value, ci->line, ci->len + 1);
}
static int rna_ConsoleLine_body_length(PointerRNA *ptr)
{
- ConsoleLine *ci = (ConsoleLine *)ptr->data;
- return ci->len;
+ ConsoleLine *ci = (ConsoleLine *)ptr->data;
+ return ci->len;
}
static void rna_ConsoleLine_body_set(PointerRNA *ptr, const char *value)
{
- ConsoleLine *ci = (ConsoleLine *)ptr->data;
- int len = strlen(value);
+ ConsoleLine *ci = (ConsoleLine *)ptr->data;
+ int len = strlen(value);
- if ((len >= ci->len_alloc) || (len * 2 < ci->len_alloc) ) { /* allocate a new string */
- MEM_freeN(ci->line);
- ci->line = MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
- ci->len_alloc = len + 1;
- }
- memcpy(ci->line, value, len + 1);
- ci->len = len;
+ if ((len >= ci->len_alloc) || (len * 2 < ci->len_alloc)) { /* allocate a new string */
+ MEM_freeN(ci->line);
+ ci->line = MEM_mallocN((len + 1) * sizeof(char), "rna_consoleline");
+ ci->len_alloc = len + 1;
+ }
+ memcpy(ci->line, value, len + 1);
+ ci->len = len;
- if (ci->cursor > len) /* clamp the cursor */
- ci->cursor = len;
+ if (ci->cursor > len) /* clamp the cursor */
+ ci->cursor = len;
}
-static void rna_ConsoleLine_cursor_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_ConsoleLine_cursor_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- ConsoleLine *ci = (ConsoleLine *)ptr->data;
+ ConsoleLine *ci = (ConsoleLine *)ptr->data;
- *min = 0;
- *max = ci->len; /* intentionally _not_ -1 */
+ *min = 0;
+ *max = ci->len; /* intentionally _not_ -1 */
}
/* Space Dopesheet */
static void rna_SpaceDopeSheetEditor_action_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceAction *saction = (SpaceAction *)(ptr->data);
- bAction *act = (bAction *)value.data;
-
- if ((act == NULL) || (act->idroot == 0)) {
- /* just set if we're clearing the action or if the action is "amorphous" still */
- saction->action = act;
- }
- else {
- /* action to set must strictly meet the mode criteria... */
- if (saction->mode == SACTCONT_ACTION) {
- /* currently, this is "object-level" only, until we have some way of specifying this */
- if (act->idroot == ID_OB)
- saction->action = act;
- else
- printf("ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level animation\n",
- act->id.name + 2);
- }
- else if (saction->mode == SACTCONT_SHAPEKEY) {
- /* as the name says, "shapekey-level" only... */
- if (act->idroot == ID_KE)
- saction->action = act;
- else
- printf("ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate Shape Keys\n",
- act->id.name + 2);
- }
- else {
- printf("ACK: who's trying to set an action while not in a mode displaying a single Action only?\n");
- }
- }
+ SpaceAction *saction = (SpaceAction *)(ptr->data);
+ bAction *act = (bAction *)value.data;
+
+ if ((act == NULL) || (act->idroot == 0)) {
+ /* just set if we're clearing the action or if the action is "amorphous" still */
+ saction->action = act;
+ }
+ else {
+ /* action to set must strictly meet the mode criteria... */
+ if (saction->mode == SACTCONT_ACTION) {
+ /* currently, this is "object-level" only, until we have some way of specifying this */
+ if (act->idroot == ID_OB)
+ saction->action = act;
+ else
+ printf(
+ "ERROR: cannot assign Action '%s' to Action Editor, as action is not object-level "
+ "animation\n",
+ act->id.name + 2);
+ }
+ else if (saction->mode == SACTCONT_SHAPEKEY) {
+ /* as the name says, "shapekey-level" only... */
+ if (act->idroot == ID_KE)
+ saction->action = act;
+ else
+ printf(
+ "ERROR: cannot assign Action '%s' to Shape Key Editor, as action doesn't animate "
+ "Shape Keys\n",
+ act->id.name + 2);
+ }
+ else {
+ printf(
+ "ACK: who's trying to set an action while not in a mode displaying a single Action "
+ "only?\n");
+ }
+ }
}
static void rna_SpaceDopeSheetEditor_action_update(bContext *C, PointerRNA *ptr)
{
- SpaceAction *saction = (SpaceAction *)(ptr->data);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Main *bmain = CTX_data_main(C);
- Object *obact = OBACT(view_layer);
-
- /* we must set this action to be the one used by active object (if not pinned) */
- if (obact /* && saction->pin == 0*/) {
- AnimData *adt = NULL;
-
- if (saction->mode == SACTCONT_ACTION) {
- /* TODO: context selector could help decide this with more control? */
- adt = BKE_animdata_add_id(&obact->id); /* this only adds if non-existent */
- }
- else if (saction->mode == SACTCONT_SHAPEKEY) {
- Key *key = BKE_key_from_object(obact);
- if (key)
- adt = BKE_animdata_add_id(&key->id); /* this only adds if non-existent */
- }
-
- /* set action */
- // FIXME: this overlaps a lot with the BKE_animdata_set_action() API method
- if (adt) {
- /* Don't do anything if old and new actions are the same... */
- if (adt->action != saction->action) {
- /* NLA Tweak Mode needs special handling... */
- if (adt->flag & ADT_NLA_EDIT_ON) {
- /* Exit editmode first - we cannot change actions while in tweakmode
- * NOTE: This will clear the action ref properly
- */
- BKE_nla_tweakmode_exit(adt);
-
- /* Assign new action, and adjust the usercounts accordingly */
- adt->action = saction->action;
- id_us_plus((ID *)adt->action);
- }
- else {
- /* Handle old action... */
- if (adt->action) {
- /* Fix id-count of action we're replacing */
- id_us_min(&adt->action->id);
-
- /* To prevent data loss (i.e. if users flip between actions using the Browse menu),
- * stash this action if nothing else uses it.
- *
- * EXCEPTION:
- * This callback runs when unlinking actions. In that case, we don't want to
- * stash the action, as the user is signalling that they want to detach it.
- * This can be reviewed again later, but it could get annoying if we keep these instead.
- */
- if ((adt->action->id.us <= 0) && (saction->action != NULL)) {
- /* XXX: Things here get dodgy if this action is only partially completed,
- * and the user then uses the browse menu to get back to this action,
- * assigning it as the active action (i.e. the stash strip gets out of sync)
- */
- BKE_nla_action_stash(adt);
- }
- }
-
- /* Assign new action, and adjust the usercounts accordingly */
- adt->action = saction->action;
- id_us_plus((ID *)adt->action);
- }
- }
-
- /* Force update of animdata */
- DEG_id_tag_update(&obact->id, ID_RECALC_ANIMATION);
- }
-
- /* force depsgraph flush too */
- DEG_id_tag_update(&obact->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
- /* Update relations as well, so new time source dependency is added. */
- DEG_relations_tag_update(bmain);
- }
+ SpaceAction *saction = (SpaceAction *)(ptr->data);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Main *bmain = CTX_data_main(C);
+ Object *obact = OBACT(view_layer);
+
+ /* we must set this action to be the one used by active object (if not pinned) */
+ if (obact /* && saction->pin == 0*/) {
+ AnimData *adt = NULL;
+
+ if (saction->mode == SACTCONT_ACTION) {
+ /* TODO: context selector could help decide this with more control? */
+ adt = BKE_animdata_add_id(&obact->id); /* this only adds if non-existent */
+ }
+ else if (saction->mode == SACTCONT_SHAPEKEY) {
+ Key *key = BKE_key_from_object(obact);
+ if (key)
+ adt = BKE_animdata_add_id(&key->id); /* this only adds if non-existent */
+ }
+
+ /* set action */
+ // FIXME: this overlaps a lot with the BKE_animdata_set_action() API method
+ if (adt) {
+ /* Don't do anything if old and new actions are the same... */
+ if (adt->action != saction->action) {
+ /* NLA Tweak Mode needs special handling... */
+ if (adt->flag & ADT_NLA_EDIT_ON) {
+ /* Exit editmode first - we cannot change actions while in tweakmode
+ * NOTE: This will clear the action ref properly
+ */
+ BKE_nla_tweakmode_exit(adt);
+
+ /* Assign new action, and adjust the usercounts accordingly */
+ adt->action = saction->action;
+ id_us_plus((ID *)adt->action);
+ }
+ else {
+ /* Handle old action... */
+ if (adt->action) {
+ /* Fix id-count of action we're replacing */
+ id_us_min(&adt->action->id);
+
+ /* To prevent data loss (i.e. if users flip between actions using the Browse menu),
+ * stash this action if nothing else uses it.
+ *
+ * EXCEPTION:
+ * This callback runs when unlinking actions. In that case, we don't want to
+ * stash the action, as the user is signalling that they want to detach it.
+ * This can be reviewed again later, but it could get annoying if we keep these instead.
+ */
+ if ((adt->action->id.us <= 0) && (saction->action != NULL)) {
+ /* XXX: Things here get dodgy if this action is only partially completed,
+ * and the user then uses the browse menu to get back to this action,
+ * assigning it as the active action (i.e. the stash strip gets out of sync)
+ */
+ BKE_nla_action_stash(adt);
+ }
+ }
+
+ /* Assign new action, and adjust the usercounts accordingly */
+ adt->action = saction->action;
+ id_us_plus((ID *)adt->action);
+ }
+ }
+
+ /* Force update of animdata */
+ DEG_id_tag_update(&obact->id, ID_RECALC_ANIMATION);
+ }
+
+ /* force depsgraph flush too */
+ DEG_id_tag_update(&obact->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ /* Update relations as well, so new time source dependency is added. */
+ DEG_relations_tag_update(bmain);
+ }
}
static void rna_SpaceDopeSheetEditor_mode_update(bContext *C, PointerRNA *ptr)
{
- SpaceAction *saction = (SpaceAction *)(ptr->data);
- ScrArea *sa = CTX_wm_area(C);
- ViewLayer *view_layer = CTX_data_view_layer(C);
- Object *obact = OBACT(view_layer);
-
- /* special exceptions for ShapeKey Editor mode */
- if (saction->mode == SACTCONT_SHAPEKEY) {
- Key *key = BKE_key_from_object(obact);
-
- /* 1) update the action stored for the editor */
- if (key)
- saction->action = (key->adt) ? key->adt->action : NULL;
- else
- saction->action = NULL;
-
- /* 2) enable 'show sliders' by default, since one of the main
- * points of the ShapeKey Editor is to provide a one-stop shop
- * for controlling the shapekeys, whose main control is the value
- */
- saction->flag |= SACTION_SLIDERS;
- }
- /* make sure action stored is valid */
- else if (saction->mode == SACTCONT_ACTION) {
- /* 1) update the action stored for the editor */
- /* TODO: context selector could help decide this with more control? */
- if (obact)
- saction->action = (obact->adt) ? obact->adt->action : NULL;
- else
- saction->action = NULL;
- }
-
- /* Collapse (and show) summary channel and hide channel list for timeline */
- if (saction->mode == SACTCONT_TIMELINE) {
- saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
- saction->ads.filterflag |= ADS_FILTER_SUMMARY;
- }
-
- if (sa && sa->spacedata.first == saction) {
- ARegion *channels_region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
- if (channels_region) {
- if (saction->mode == SACTCONT_TIMELINE) {
- channels_region->flag |= RGN_FLAG_HIDDEN;
- }
- else {
- channels_region->flag &= ~RGN_FLAG_HIDDEN;
- }
- ED_region_visibility_change_update(C, channels_region);
- }
- }
-
- /* recalculate extents of channel list */
- saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
-
- /* store current mode as "old mode", so that returning from other editors doesn't always reset to "Action Editor" */
- if (saction->mode != SACTCONT_TIMELINE) {
- saction->mode_prev = saction->mode;
- }
+ SpaceAction *saction = (SpaceAction *)(ptr->data);
+ ScrArea *sa = CTX_wm_area(C);
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ Object *obact = OBACT(view_layer);
+
+ /* special exceptions for ShapeKey Editor mode */
+ if (saction->mode == SACTCONT_SHAPEKEY) {
+ Key *key = BKE_key_from_object(obact);
+
+ /* 1) update the action stored for the editor */
+ if (key)
+ saction->action = (key->adt) ? key->adt->action : NULL;
+ else
+ saction->action = NULL;
+
+ /* 2) enable 'show sliders' by default, since one of the main
+ * points of the ShapeKey Editor is to provide a one-stop shop
+ * for controlling the shapekeys, whose main control is the value
+ */
+ saction->flag |= SACTION_SLIDERS;
+ }
+ /* make sure action stored is valid */
+ else if (saction->mode == SACTCONT_ACTION) {
+ /* 1) update the action stored for the editor */
+ /* TODO: context selector could help decide this with more control? */
+ if (obact)
+ saction->action = (obact->adt) ? obact->adt->action : NULL;
+ else
+ saction->action = NULL;
+ }
+
+ /* Collapse (and show) summary channel and hide channel list for timeline */
+ if (saction->mode == SACTCONT_TIMELINE) {
+ saction->ads.flag |= ADS_FLAG_SUMMARY_COLLAPSED;
+ saction->ads.filterflag |= ADS_FILTER_SUMMARY;
+ }
+
+ if (sa && sa->spacedata.first == saction) {
+ ARegion *channels_region = BKE_area_find_region_type(sa, RGN_TYPE_CHANNELS);
+ if (channels_region) {
+ if (saction->mode == SACTCONT_TIMELINE) {
+ channels_region->flag |= RGN_FLAG_HIDDEN;
+ }
+ else {
+ channels_region->flag &= ~RGN_FLAG_HIDDEN;
+ }
+ ED_region_visibility_change_update(C, channels_region);
+ }
+ }
+
+ /* recalculate extents of channel list */
+ saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
+
+ /* store current mode as "old mode", so that returning from other editors doesn't always reset to "Action Editor" */
+ if (saction->mode != SACTCONT_TIMELINE) {
+ saction->mode_prev = saction->mode;
+ }
}
/* Space Graph Editor */
static void rna_SpaceGraphEditor_display_mode_update(bContext *C, PointerRNA *ptr)
{
- ScrArea *sa = rna_area_from_space(ptr);
- SpaceGraph *sipo = (SpaceGraph *)ptr->data;
+ ScrArea *sa = rna_area_from_space(ptr);
+ SpaceGraph *sipo = (SpaceGraph *)ptr->data;
- /* for "Drivers" mode, enable all the necessary bits and pieces */
- if (sipo->mode == SIPO_MODE_DRIVERS) {
- ED_drivers_editor_init(C, sa);
- ED_area_tag_redraw(sa);
- }
+ /* for "Drivers" mode, enable all the necessary bits and pieces */
+ if (sipo->mode == SIPO_MODE_DRIVERS) {
+ ED_drivers_editor_init(C, sa);
+ ED_area_tag_redraw(sa);
+ }
- /* after changing view mode, must force recalculation of F-Curve colors
- * which can only be achieved using refresh as opposed to redraw
- */
- ED_area_tag_refresh(sa);
+ /* after changing view mode, must force recalculation of F-Curve colors
+ * which can only be achieved using refresh as opposed to redraw
+ */
+ ED_area_tag_refresh(sa);
}
static bool rna_SpaceGraphEditor_has_ghost_curves_get(PointerRNA *ptr)
{
- SpaceGraph *sipo = (SpaceGraph *)(ptr->data);
- return (BLI_listbase_is_empty(&sipo->runtime.ghost_curves) == false);
+ SpaceGraph *sipo = (SpaceGraph *)(ptr->data);
+ return (BLI_listbase_is_empty(&sipo->runtime.ghost_curves) == false);
}
-static void rna_SpaceConsole_rect_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceConsole_rect_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceConsole *sc = ptr->data;
- WM_main_add_notifier(NC_SPACE | ND_SPACE_CONSOLE | NA_EDITED, sc);
+ SpaceConsole *sc = ptr->data;
+ WM_main_add_notifier(NC_SPACE | ND_SPACE_CONSOLE | NA_EDITED, sc);
}
-static void rna_Sequencer_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_Sequencer_view_type_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ScrArea *sa = rna_area_from_space(ptr);
- ED_area_tag_refresh(sa);
+ ScrArea *sa = rna_area_from_space(ptr);
+ ED_area_tag_refresh(sa);
}
/* Space Node Editor */
static void rna_SpaceNodeEditor_node_tree_set(PointerRNA *ptr, const PointerRNA value)
{
- SpaceNode *snode = (SpaceNode *)ptr->data;
- ED_node_tree_start(snode, (bNodeTree *)value.data, NULL, NULL);
+ SpaceNode *snode = (SpaceNode *)ptr->data;
+ ED_node_tree_start(snode, (bNodeTree *)value.data, NULL, NULL);
}
static bool rna_SpaceNodeEditor_node_tree_poll(PointerRNA *ptr, const PointerRNA value)
{
- SpaceNode *snode = (SpaceNode *)ptr->data;
- bNodeTree *ntree = (bNodeTree *)value.data;
+ SpaceNode *snode = (SpaceNode *)ptr->data;
+ bNodeTree *ntree = (bNodeTree *)value.data;
- /* node tree type must match the selected type in node editor */
- return (STREQ(snode->tree_idname, ntree->idname));
+ /* node tree type must match the selected type in node editor */
+ return (STREQ(snode->tree_idname, ntree->idname));
}
static void rna_SpaceNodeEditor_node_tree_update(const bContext *C, PointerRNA *UNUSED(ptr))
{
- ED_node_tree_update(C);
+ ED_node_tree_update(C);
}
static int rna_SpaceNodeEditor_tree_type_get(PointerRNA *ptr)
{
- SpaceNode *snode = (SpaceNode *)ptr->data;
- return rna_node_tree_idname_to_enum(snode->tree_idname);
+ SpaceNode *snode = (SpaceNode *)ptr->data;
+ return rna_node_tree_idname_to_enum(snode->tree_idname);
}
static void rna_SpaceNodeEditor_tree_type_set(PointerRNA *ptr, int value)
{
- SpaceNode *snode = (SpaceNode *)ptr->data;
- ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value));
+ SpaceNode *snode = (SpaceNode *)ptr->data;
+ ED_node_set_tree_type(snode, rna_node_tree_type_from_enum(value));
}
static bool rna_SpaceNodeEditor_tree_type_poll(void *Cv, bNodeTreeType *type)
{
- bContext *C = (bContext *)Cv;
- if (type->poll)
- return type->poll(C, type);
- else
- return true;
+ bContext *C = (bContext *)Cv;
+ if (type->poll)
+ return type->poll(C, type);
+ else
+ return true;
}
const EnumPropertyItem *RNA_enum_node_tree_types_itemf_impl(bContext *C, bool *r_free)
{
- return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free);
+ return rna_node_tree_type_itemf(C, rna_SpaceNodeEditor_tree_type_poll, r_free);
}
-static const EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(
- bContext *C, PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_SpaceNodeEditor_tree_type_itemf(bContext *C,
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- return RNA_enum_node_tree_types_itemf_impl(C, r_free);
+ return RNA_enum_node_tree_types_itemf_impl(C, r_free);
}
static void rna_SpaceNodeEditor_path_get(PointerRNA *ptr, char *value)
{
- SpaceNode *snode = ptr->data;
- ED_node_tree_path_get(snode, value);
+ SpaceNode *snode = ptr->data;
+ ED_node_tree_path_get(snode, value);
}
static int rna_SpaceNodeEditor_path_length(PointerRNA *ptr)
{
- SpaceNode *snode = ptr->data;
- return ED_node_tree_path_length(snode);
+ SpaceNode *snode = ptr->data;
+ return ED_node_tree_path_length(snode);
}
static void rna_SpaceNodeEditor_path_clear(SpaceNode *snode, bContext *C)
{
- ED_node_tree_start(snode, NULL, NULL, NULL);
- ED_node_tree_update(C);
+ ED_node_tree_start(snode, NULL, NULL, NULL);
+ ED_node_tree_update(C);
}
static void rna_SpaceNodeEditor_path_start(SpaceNode *snode, bContext *C, PointerRNA *node_tree)
{
- ED_node_tree_start(snode, (bNodeTree *)node_tree->data, NULL, NULL);
- ED_node_tree_update(C);
+ ED_node_tree_start(snode, (bNodeTree *)node_tree->data, NULL, NULL);
+ ED_node_tree_update(C);
}
-static void rna_SpaceNodeEditor_path_append(SpaceNode *snode, bContext *C, PointerRNA *node_tree, PointerRNA *node)
+static void rna_SpaceNodeEditor_path_append(SpaceNode *snode,
+ bContext *C,
+ PointerRNA *node_tree,
+ PointerRNA *node)
{
- ED_node_tree_push(snode, node_tree->data, node->data);
- ED_node_tree_update(C);
+ ED_node_tree_push(snode, node_tree->data, node->data);
+ ED_node_tree_update(C);
}
static void rna_SpaceNodeEditor_path_pop(SpaceNode *snode, bContext *C)
{
- ED_node_tree_pop(snode);
- ED_node_tree_update(C);
+ ED_node_tree_pop(snode);
+ ED_node_tree_update(C);
}
-static void rna_SpaceNodeEditor_show_backdrop_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_SpaceNodeEditor_show_backdrop_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
- WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
+ WM_main_add_notifier(NC_NODE | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
}
-static void rna_SpaceNodeEditor_cursor_location_from_region(SpaceNode *snode, bContext *C, int x, int y)
+static void rna_SpaceNodeEditor_cursor_location_from_region(SpaceNode *snode,
+ bContext *C,
+ int x,
+ int y)
{
- ARegion *ar = CTX_wm_region(C);
+ ARegion *ar = CTX_wm_region(C);
- UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
- snode->cursor[0] /= UI_DPI_FAC;
- snode->cursor[1] /= UI_DPI_FAC;
+ UI_view2d_region_to_view(&ar->v2d, x, y, &snode->cursor[0], &snode->cursor[1]);
+ snode->cursor[0] /= UI_DPI_FAC;
+ snode->cursor[1] /= UI_DPI_FAC;
}
static void rna_SpaceClipEditor_clip_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceClip *sc = (SpaceClip *)(ptr->data);
- bScreen *screen = (bScreen *)ptr->id.data;
+ SpaceClip *sc = (SpaceClip *)(ptr->data);
+ bScreen *screen = (bScreen *)ptr->id.data;
- ED_space_clip_set_clip(NULL, screen, sc, (MovieClip *)value.data);
+ ED_space_clip_set_clip(NULL, screen, sc, (MovieClip *)value.data);
}
static void rna_SpaceClipEditor_mask_set(PointerRNA *ptr, PointerRNA value)
{
- SpaceClip *sc = (SpaceClip *)(ptr->data);
+ SpaceClip *sc = (SpaceClip *)(ptr->data);
- ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
+ ED_space_clip_set_mask(NULL, sc, (Mask *)value.data);
}
-static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceClipEditor_clip_mode_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceClip *sc = (SpaceClip *)(ptr->data);
+ SpaceClip *sc = (SpaceClip *)(ptr->data);
- sc->scopes.ok = 0;
+ sc->scopes.ok = 0;
}
-static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceClipEditor_lock_selection_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- SpaceClip *sc = (SpaceClip *)(ptr->data);
+ SpaceClip *sc = (SpaceClip *)(ptr->data);
- sc->xlockof = 0.f;
- sc->ylockof = 0.f;
+ sc->xlockof = 0.f;
+ sc->ylockof = 0.f;
}
-static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_SpaceClipEditor_view_type_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- ScrArea *sa = rna_area_from_space(ptr);
- ED_area_tag_refresh(sa);
+ ScrArea *sa = rna_area_from_space(ptr);
+ ED_area_tag_refresh(sa);
}
/* File browser. */
static bool rna_FileSelectParams_use_lib_get(PointerRNA *ptr)
{
- FileSelectParams *params = ptr->data;
+ FileSelectParams *params = ptr->data;
- return params && (params->type == FILE_LOADLIB);
+ return params && (params->type == FILE_LOADLIB);
}
static const EnumPropertyItem *rna_FileSelectParams_recursion_level_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
+ bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *r_free)
{
- FileSelectParams *params = ptr->data;
+ FileSelectParams *params = ptr->data;
- if (params && params->type != FILE_LOADLIB) {
- EnumPropertyItem *item = NULL;
- int totitem = 0;
+ if (params && params->type != FILE_LOADLIB) {
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
- RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 0);
- RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 2);
- RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 3);
- RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 4);
+ RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 0);
+ RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 2);
+ RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 3);
+ RNA_enum_items_add_value(&item, &totitem, fileselectparams_recursion_level_items, 4);
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
- }
+ return item;
+ }
- *r_free = false;
- return fileselectparams_recursion_level_items;
+ *r_free = false;
+ return fileselectparams_recursion_level_items;
}
static void rna_FileSelectPrams_filter_glob_set(PointerRNA *ptr, const char *value)
{
- FileSelectParams *params = ptr->data;
+ FileSelectParams *params = ptr->data;
- BLI_strncpy(params->filter_glob, value, sizeof(params->filter_glob));
+ BLI_strncpy(params->filter_glob, value, sizeof(params->filter_glob));
- /* Remove stupi things like last group being a wildcard-only one... */
- BLI_path_extension_glob_validate(params->filter_glob);
+ /* Remove stupi things like last group being a wildcard-only one... */
+ BLI_path_extension_glob_validate(params->filter_glob);
}
static void rna_FileBrowser_FSMenuEntry_path_get(PointerRNA *ptr, char *value)
{
- char *path = ED_fsmenu_entry_get_path(ptr->data);
+ char *path = ED_fsmenu_entry_get_path(ptr->data);
- strcpy(value, path ? path : "");
+ strcpy(value, path ? path : "");
}
static int rna_FileBrowser_FSMenuEntry_path_length(PointerRNA *ptr)
{
- char *path = ED_fsmenu_entry_get_path(ptr->data);
+ char *path = ED_fsmenu_entry_get_path(ptr->data);
- return (int)(path ? strlen(path) : 0);
+ return (int)(path ? strlen(path) : 0);
}
static void rna_FileBrowser_FSMenuEntry_path_set(PointerRNA *ptr, const char *value)
{
- FSMenuEntry *fsm = ptr->data;
+ FSMenuEntry *fsm = ptr->data;
- /* Note: this will write to file immediately.
- * Not nice (and to be fixed ultimately), but acceptable in this case for now. */
- ED_fsmenu_entry_set_path(fsm, value);
+ /* Note: this will write to file immediately.
+ * Not nice (and to be fixed ultimately), but acceptable in this case for now. */
+ ED_fsmenu_entry_set_path(fsm, value);
}
static void rna_FileBrowser_FSMenuEntry_name_get(PointerRNA *ptr, char *value)
{
- strcpy(value, ED_fsmenu_entry_get_name(ptr->data));
+ strcpy(value, ED_fsmenu_entry_get_name(ptr->data));
}
static int rna_FileBrowser_FSMenuEntry_name_length(PointerRNA *ptr)
{
- return (int)strlen(ED_fsmenu_entry_get_name(ptr->data));
+ return (int)strlen(ED_fsmenu_entry_get_name(ptr->data));
}
static void rna_FileBrowser_FSMenuEntry_name_set(PointerRNA *ptr, const char *value)
{
- FSMenuEntry *fsm = ptr->data;
+ FSMenuEntry *fsm = ptr->data;
- /* Note: this will write to file immediately.
- * Not nice (and to be fixed ultimately), but acceptable in this case for now. */
- ED_fsmenu_entry_set_name(fsm, value);
+ /* Note: this will write to file immediately.
+ * Not nice (and to be fixed ultimately), but acceptable in this case for now. */
+ ED_fsmenu_entry_set_name(fsm, value);
}
-static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr, const char **UNUSED(r_info))
+static int rna_FileBrowser_FSMenuEntry_name_get_editable(PointerRNA *ptr,
+ const char **UNUSED(r_info))
{
- FSMenuEntry *fsm = ptr->data;
+ FSMenuEntry *fsm = ptr->data;
- return fsm->save ? PROP_EDITABLE : 0;
+ return fsm->save ? PROP_EDITABLE : 0;
}
static bool rna_FileBrowser_FSMenuEntry_use_save_get(PointerRNA *ptr)
{
- FSMenuEntry *fsm = ptr->data;
- return fsm->save;
+ FSMenuEntry *fsm = ptr->data;
+ return fsm->save;
}
static bool rna_FileBrowser_FSMenuEntry_is_valid_get(PointerRNA *ptr)
{
- FSMenuEntry *fsm = ptr->data;
- return fsm->valid;
+ FSMenuEntry *fsm = ptr->data;
+ return fsm->valid;
}
static void rna_FileBrowser_FSMenu_next(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- if (internal->skip) {
- do {
- internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next);
- iter->valid = (internal->link != NULL);
- } while (iter->valid && internal->skip(iter, internal->link));
- }
- else {
- internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next);
- iter->valid = (internal->link != NULL);
- }
+ if (internal->skip) {
+ do {
+ internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next);
+ iter->valid = (internal->link != NULL);
+ } while (iter->valid && internal->skip(iter, internal->link));
+ }
+ else {
+ internal->link = (Link *)(((FSMenuEntry *)(internal->link))->next);
+ iter->valid = (internal->link != NULL);
+ }
}
static void rna_FileBrowser_FSMenu_begin(CollectionPropertyIterator *iter, FSMenuCategory category)
{
- ListBaseIterator *internal = &iter->internal.listbase;
+ ListBaseIterator *internal = &iter->internal.listbase;
- struct FSMenu *fsmenu = ED_fsmenu_get();
- struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, category);
+ struct FSMenu *fsmenu = ED_fsmenu_get();
+ struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, category);
- internal->link = (fsmentry) ? (Link *)fsmentry : NULL;
- internal->skip = NULL;
+ internal->link = (fsmentry) ? (Link *)fsmentry : NULL;
+ internal->skip = NULL;
- iter->valid = (internal->link != NULL);
+ iter->valid = (internal->link != NULL);
}
static PointerRNA rna_FileBrowser_FSMenu_get(CollectionPropertyIterator *iter)
{
- ListBaseIterator *internal = &iter->internal.listbase;
- PointerRNA r_ptr;
+ ListBaseIterator *internal = &iter->internal.listbase;
+ PointerRNA r_ptr;
- RNA_pointer_create(NULL, &RNA_FileBrowserFSMenuEntry, internal->link, &r_ptr);
+ RNA_pointer_create(NULL, &RNA_FileBrowserFSMenuEntry, internal->link, &r_ptr);
- return r_ptr;
+ return r_ptr;
}
static void rna_FileBrowser_FSMenu_end(CollectionPropertyIterator *UNUSED(iter))
{
}
-static void rna_FileBrowser_FSMenuSystem_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
+static void rna_FileBrowser_FSMenuSystem_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *UNUSED(ptr))
{
- rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM);
+ rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM);
}
static int rna_FileBrowser_FSMenuSystem_data_length(PointerRNA *UNUSED(ptr))
{
- struct FSMenu *fsmenu = ED_fsmenu_get();
+ struct FSMenu *fsmenu = ED_fsmenu_get();
- return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM);
+ return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM);
}
-static void rna_FileBrowser_FSMenuSystemBookmark_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
+static void rna_FileBrowser_FSMenuSystemBookmark_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *UNUSED(ptr))
{
- rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM_BOOKMARKS);
+ rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_SYSTEM_BOOKMARKS);
}
static int rna_FileBrowser_FSMenuSystemBookmark_data_length(PointerRNA *UNUSED(ptr))
{
- struct FSMenu *fsmenu = ED_fsmenu_get();
+ struct FSMenu *fsmenu = ED_fsmenu_get();
- return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS);
+ return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS);
}
-static void rna_FileBrowser_FSMenuBookmark_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
+static void rna_FileBrowser_FSMenuBookmark_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *UNUSED(ptr))
{
- rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_BOOKMARKS);
+ rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_BOOKMARKS);
}
static int rna_FileBrowser_FSMenuBookmark_data_length(PointerRNA *UNUSED(ptr))
{
- struct FSMenu *fsmenu = ED_fsmenu_get();
+ struct FSMenu *fsmenu = ED_fsmenu_get();
- return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
+ return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS);
}
-static void rna_FileBrowser_FSMenuRecent_data_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
+static void rna_FileBrowser_FSMenuRecent_data_begin(CollectionPropertyIterator *iter,
+ PointerRNA *UNUSED(ptr))
{
- rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_RECENT);
+ rna_FileBrowser_FSMenu_begin(iter, FS_CATEGORY_RECENT);
}
static int rna_FileBrowser_FSMenuRecent_data_length(PointerRNA *UNUSED(ptr))
{
- struct FSMenu *fsmenu = ED_fsmenu_get();
+ struct FSMenu *fsmenu = ED_fsmenu_get();
- return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_RECENT);
+ return ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_RECENT);
}
static int rna_FileBrowser_FSMenu_active_get(PointerRNA *ptr, const FSMenuCategory category)
{
- SpaceFile *sf = ptr->data;
- int actnr = -1;
-
- switch (category) {
- case FS_CATEGORY_SYSTEM:
- actnr = sf->systemnr;
- break;
- case FS_CATEGORY_SYSTEM_BOOKMARKS:
- actnr = sf->system_bookmarknr;
- break;
- case FS_CATEGORY_BOOKMARKS:
- actnr = sf->bookmarknr;
- break;
- case FS_CATEGORY_RECENT:
- actnr = sf->recentnr;
- break;
- }
-
- return actnr;
-}
-
-static void rna_FileBrowser_FSMenu_active_set(PointerRNA *ptr, int value, const FSMenuCategory category)
-{
- SpaceFile *sf = ptr->data;
- struct FSMenu *fsmenu = ED_fsmenu_get();
- FSMenuEntry *fsm = ED_fsmenu_get_entry(fsmenu, category, value);
-
- if (fsm && sf->params) {
- switch (category) {
- case FS_CATEGORY_SYSTEM:
- sf->systemnr = value;
- break;
- case FS_CATEGORY_SYSTEM_BOOKMARKS:
- sf->system_bookmarknr = value;
- break;
- case FS_CATEGORY_BOOKMARKS:
- sf->bookmarknr = value;
- break;
- case FS_CATEGORY_RECENT:
- sf->recentnr = value;
- break;
- }
-
- BLI_strncpy(sf->params->dir, fsm->path, sizeof(sf->params->dir));
- }
-}
-
-static void rna_FileBrowser_FSMenu_active_range(
- PointerRNA *UNUSED(ptr), int *min, int *max, int *softmin, int *softmax, const FSMenuCategory category)
-{
- struct FSMenu *fsmenu = ED_fsmenu_get();
-
- *min = *softmin = -1;
- *max = *softmax = ED_fsmenu_get_nentries(fsmenu, category) - 1;
+ SpaceFile *sf = ptr->data;
+ int actnr = -1;
+
+ switch (category) {
+ case FS_CATEGORY_SYSTEM:
+ actnr = sf->systemnr;
+ break;
+ case FS_CATEGORY_SYSTEM_BOOKMARKS:
+ actnr = sf->system_bookmarknr;
+ break;
+ case FS_CATEGORY_BOOKMARKS:
+ actnr = sf->bookmarknr;
+ break;
+ case FS_CATEGORY_RECENT:
+ actnr = sf->recentnr;
+ break;
+ }
+
+ return actnr;
+}
+
+static void rna_FileBrowser_FSMenu_active_set(PointerRNA *ptr,
+ int value,
+ const FSMenuCategory category)
+{
+ SpaceFile *sf = ptr->data;
+ struct FSMenu *fsmenu = ED_fsmenu_get();
+ FSMenuEntry *fsm = ED_fsmenu_get_entry(fsmenu, category, value);
+
+ if (fsm && sf->params) {
+ switch (category) {
+ case FS_CATEGORY_SYSTEM:
+ sf->systemnr = value;
+ break;
+ case FS_CATEGORY_SYSTEM_BOOKMARKS:
+ sf->system_bookmarknr = value;
+ break;
+ case FS_CATEGORY_BOOKMARKS:
+ sf->bookmarknr = value;
+ break;
+ case FS_CATEGORY_RECENT:
+ sf->recentnr = value;
+ break;
+ }
+
+ BLI_strncpy(sf->params->dir, fsm->path, sizeof(sf->params->dir));
+ }
+}
+
+static void rna_FileBrowser_FSMenu_active_range(PointerRNA *UNUSED(ptr),
+ int *min,
+ int *max,
+ int *softmin,
+ int *softmax,
+ const FSMenuCategory category)
+{
+ struct FSMenu *fsmenu = ED_fsmenu_get();
+
+ *min = *softmin = -1;
+ *max = *softmax = ED_fsmenu_get_nentries(fsmenu, category) - 1;
}
static void rna_FileBrowser_FSMenu_active_update(struct bContext *C, PointerRNA *UNUSED(ptr))
{
- ED_file_change_dir(C);
+ ED_file_change_dir(C);
}
static int rna_FileBrowser_FSMenuSystem_active_get(PointerRNA *ptr)
{
- return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM);
+ return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM);
}
static void rna_FileBrowser_FSMenuSystem_active_set(PointerRNA *ptr, int value)
{
- rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM);
+ rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM);
}
-static void rna_FileBrowser_FSMenuSystem_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_FileBrowser_FSMenuSystem_active_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM);
+ rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM);
}
static int rna_FileBrowser_FSMenuSystemBookmark_active_get(PointerRNA *ptr)
{
- return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM_BOOKMARKS);
+ return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_SYSTEM_BOOKMARKS);
}
static void rna_FileBrowser_FSMenuSystemBookmark_active_set(PointerRNA *ptr, int value)
{
- rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM_BOOKMARKS);
+ rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_SYSTEM_BOOKMARKS);
}
-static void rna_FileBrowser_FSMenuSystemBookmark_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_FileBrowser_FSMenuSystemBookmark_active_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM_BOOKMARKS);
+ rna_FileBrowser_FSMenu_active_range(
+ ptr, min, max, softmin, softmax, FS_CATEGORY_SYSTEM_BOOKMARKS);
}
static int rna_FileBrowser_FSMenuBookmark_active_get(PointerRNA *ptr)
{
- return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_BOOKMARKS);
+ return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_BOOKMARKS);
}
static void rna_FileBrowser_FSMenuBookmark_active_set(PointerRNA *ptr, int value)
{
- rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_BOOKMARKS);
+ rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_BOOKMARKS);
}
-static void rna_FileBrowser_FSMenuBookmark_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_FileBrowser_FSMenuBookmark_active_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_BOOKMARKS);
+ rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_BOOKMARKS);
}
static int rna_FileBrowser_FSMenuRecent_active_get(PointerRNA *ptr)
{
- return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_RECENT);
+ return rna_FileBrowser_FSMenu_active_get(ptr, FS_CATEGORY_RECENT);
}
static void rna_FileBrowser_FSMenuRecent_active_set(PointerRNA *ptr, int value)
{
- rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_RECENT);
+ rna_FileBrowser_FSMenu_active_set(ptr, value, FS_CATEGORY_RECENT);
}
-static void rna_FileBrowser_FSMenuRecent_active_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
+static void rna_FileBrowser_FSMenuRecent_active_range(
+ PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
{
- rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_RECENT);
+ rna_FileBrowser_FSMenu_active_range(ptr, min, max, softmin, softmax, FS_CATEGORY_RECENT);
}
#else
static const EnumPropertyItem dt_uv_items[] = {
- {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Display white edges with black outline"},
- {SI_UVDT_DASH, "DASH", 0, "Dash", "Display dashed black-white edges"},
- {SI_UVDT_BLACK, "BLACK", 0, "Black", "Display black edges"},
- {SI_UVDT_WHITE, "WHITE", 0, "White", "Display white edges"},
- {0, NULL, 0, NULL, NULL},
+ {SI_UVDT_OUTLINE, "OUTLINE", 0, "Outline", "Display white edges with black outline"},
+ {SI_UVDT_DASH, "DASH", 0, "Dash", "Display dashed black-white edges"},
+ {SI_UVDT_BLACK, "BLACK", 0, "Black", "Display black edges"},
+ {SI_UVDT_WHITE, "WHITE", 0, "White", "Display white edges"},
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_space(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "Space", NULL);
- RNA_def_struct_sdna(srna, "SpaceLink");
- RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area");
- RNA_def_struct_refine_func(srna, "rna_Space_refine");
+ srna = RNA_def_struct(brna, "Space", NULL);
+ RNA_def_struct_sdna(srna, "SpaceLink");
+ RNA_def_struct_ui_text(srna, "Space", "Space data for a screen area");
+ RNA_def_struct_refine_func(srna, "rna_Space_refine");
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "spacetype");
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- /* When making this editable, take care for the special case of global areas (see rna_Area_type_set). */
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "Space data type");
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "spacetype");
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ /* When making this editable, take care for the special case of global areas (see rna_Area_type_set). */
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Type", "Space data type");
- /* access to V2D_VIEWSYNC_SCREEN_TIME */
- prop = RNA_def_property(srna, "show_locked_time", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Space_view2d_sync_get", "rna_Space_view2d_sync_set");
- RNA_def_property_ui_text(prop, "Lock Time to Other Windows", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Space_view2d_sync_update");
+ /* access to V2D_VIEWSYNC_SCREEN_TIME */
+ prop = RNA_def_property(srna, "show_locked_time", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Space_view2d_sync_get", "rna_Space_view2d_sync_set");
+ RNA_def_property_ui_text(prop, "Lock Time to Other Windows", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, "rna_Space_view2d_sync_update");
}
/* for all spaces that use a mask */
static void rna_def_space_mask_info(StructRNA *srna, int noteflag, const char *mask_set_func)
{
- PropertyRNA *prop;
-
- static const EnumPropertyItem overlay_mode_items[] = {
- {MASK_OVERLAY_ALPHACHANNEL, "ALPHACHANNEL", ICON_NONE, "Alpha Channel", "Show alpha channel of the mask"},
- {MASK_OVERLAY_COMBINED, "COMBINED", ICON_NONE, "Combined", "Combine space background image with the mask"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "mask_info.mask");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mask", "Mask displayed and edited in this space");
- RNA_def_property_pointer_funcs(prop, NULL, mask_set_func, NULL, NULL);
- RNA_def_property_update(prop, noteflag, NULL);
-
- /* mask drawing */
- prop = RNA_def_property(srna, "mask_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mask_info.draw_type");
- RNA_def_property_enum_items(prop, dt_uv_items);
- RNA_def_property_ui_text(prop, "Edge Display Type", "Display type for mask splines");
- RNA_def_property_update(prop, noteflag, NULL);
-
- prop = RNA_def_property(srna, "show_mask_smooth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SMOOTH);
- RNA_def_property_ui_text(prop, "Display Smooth Splines", "");
- RNA_def_property_update(prop, noteflag, NULL);
-
- prop = RNA_def_property(srna, "show_mask_overlay", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_OVERLAY);
- RNA_def_property_ui_text(prop, "Show Mask Overlay", "");
- RNA_def_property_update(prop, noteflag, NULL);
-
- prop = RNA_def_property(srna, "mask_overlay_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mask_info.overlay_mode");
- RNA_def_property_enum_items(prop, overlay_mode_items);
- RNA_def_property_ui_text(prop, "Overlay Mode", "Overlay mode of rasterized mask");
- RNA_def_property_update(prop, noteflag, NULL);
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem overlay_mode_items[] = {
+ {MASK_OVERLAY_ALPHACHANNEL,
+ "ALPHACHANNEL",
+ ICON_NONE,
+ "Alpha Channel",
+ "Show alpha channel of the mask"},
+ {MASK_OVERLAY_COMBINED,
+ "COMBINED",
+ ICON_NONE,
+ "Combined",
+ "Combine space background image with the mask"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "mask", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "mask_info.mask");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Mask", "Mask displayed and edited in this space");
+ RNA_def_property_pointer_funcs(prop, NULL, mask_set_func, NULL, NULL);
+ RNA_def_property_update(prop, noteflag, NULL);
+
+ /* mask drawing */
+ prop = RNA_def_property(srna, "mask_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_info.draw_type");
+ RNA_def_property_enum_items(prop, dt_uv_items);
+ RNA_def_property_ui_text(prop, "Edge Display Type", "Display type for mask splines");
+ RNA_def_property_update(prop, noteflag, NULL);
+
+ prop = RNA_def_property(srna, "show_mask_smooth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_SMOOTH);
+ RNA_def_property_ui_text(prop, "Display Smooth Splines", "");
+ RNA_def_property_update(prop, noteflag, NULL);
+
+ prop = RNA_def_property(srna, "show_mask_overlay", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mask_info.draw_flag", MASK_DRAWFLAG_OVERLAY);
+ RNA_def_property_ui_text(prop, "Show Mask Overlay", "");
+ RNA_def_property_update(prop, noteflag, NULL);
+
+ prop = RNA_def_property(srna, "mask_overlay_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mask_info.overlay_mode");
+ RNA_def_property_enum_items(prop, overlay_mode_items);
+ RNA_def_property_ui_text(prop, "Overlay Mode", "Overlay mode of rasterized mask");
+ RNA_def_property_update(prop, noteflag, NULL);
}
static void rna_def_space_image_uv(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem sticky_mode_items[] = {
- {SI_STICKY_DISABLE, "DISABLED", ICON_STICKY_UVS_DISABLE, "Disabled", "Sticky vertex selection disabled"},
- {SI_STICKY_LOC, "SHARED_LOCATION", ICON_STICKY_UVS_LOC, "Shared Location",
- "Select UVs that are at the same location and share a mesh vertex"},
- {SI_STICKY_VERTEX, "SHARED_VERTEX", ICON_STICKY_UVS_VERT, "Shared Vertex",
- "Select UVs that share mesh vertex, irrespective if they are in the same location"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem dt_uvstretch_items[] = {
- {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
- {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem pixel_snap_mode_items[] = {
- {SI_PIXEL_SNAP_DISABLED, "DISABLED", 0, "Disabled", "Don't snap to pixels"},
- {SI_PIXEL_SNAP_CORNER, "CORNER", 0, "Corner", "Snap to pixel corners"},
- {SI_PIXEL_SNAP_CENTER, "CENTER", 0, "Center", "Snap to pixel centers"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
- RNA_def_struct_sdna(srna, "SpaceImage");
- RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
- RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
-
- /* selection */
- prop = RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sticky");
- RNA_def_property_enum_items(prop, sticky_mode_items);
- RNA_def_property_ui_text(prop, "Sticky Selection Mode",
- "Automatically select also UVs sharing the same vertex as the ones being selected");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- /* drawing */
- prop = RNA_def_property(srna, "edge_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
- RNA_def_property_enum_items(prop, dt_uv_items);
- RNA_def_property_ui_text(prop, "Edge Display Type", "Display type for drawing UV edges");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
- RNA_def_property_ui_text(prop, "Display Smooth Edges", "Display UV edges anti-aliased");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
- RNA_def_property_ui_text(prop, "Display Stretch",
- "Display faces colored according to the difference in shape between UVs and "
- "their 3D coordinates (blue for low distortion, red for high distortion)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "display_stretch_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
- RNA_def_property_enum_items(prop, dt_uvstretch_items);
- RNA_def_property_ui_text(prop, "Display Stretch Type", "Type of stretch to draw");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
- RNA_def_property_ui_text(prop, "Display Modified Edges", "Display edges after modifiers are applied");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_METADATA);
- RNA_def_property_ui_text(prop, "Show Metadata", "Display metadata properties of the image");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_texpaint", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAW_TEXPAINT);
- RNA_def_property_ui_text(prop, "Display Texture Paint UVs", "Display overlay of texture paint uv layer");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_pixel_coords", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_COORDFLOATS);
- RNA_def_property_ui_text(prop, "Pixel Coordinates",
- "Display UV coordinates in pixels rather than from 0.0 to 1.0");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWFACES);
- RNA_def_property_ui_text(prop, "Display Faces", "Display faces over the image");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWEDGES);
- RNA_def_property_ui_text(prop, "Display Edges", "Display edges in vertex select mode");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- /* todo: move edge and face drawing options here from G.f */
-
- prop = RNA_def_property(srna, "pixel_snap_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, pixel_snap_mode_items);
- RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixels while editing");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
- RNA_def_property_ui_text(prop, "Constrain to Image Bounds",
- "Constraint to stay within the image bounds while editing");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
- RNA_def_property_ui_text(prop, "Live Unwrap",
- "Continuously unwrap the selected UV island while transforming pinned vertices");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem sticky_mode_items[] = {
+ {SI_STICKY_DISABLE,
+ "DISABLED",
+ ICON_STICKY_UVS_DISABLE,
+ "Disabled",
+ "Sticky vertex selection disabled"},
+ {SI_STICKY_LOC,
+ "SHARED_LOCATION",
+ ICON_STICKY_UVS_LOC,
+ "Shared Location",
+ "Select UVs that are at the same location and share a mesh vertex"},
+ {SI_STICKY_VERTEX,
+ "SHARED_VERTEX",
+ ICON_STICKY_UVS_VERT,
+ "Shared Vertex",
+ "Select UVs that share mesh vertex, irrespective if they are in the same location"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem dt_uvstretch_items[] = {
+ {SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
+ {SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pixel_snap_mode_items[] = {
+ {SI_PIXEL_SNAP_DISABLED, "DISABLED", 0, "Disabled", "Don't snap to pixels"},
+ {SI_PIXEL_SNAP_CORNER, "CORNER", 0, "Corner", "Snap to pixel corners"},
+ {SI_PIXEL_SNAP_CENTER, "CENTER", 0, "Center", "Snap to pixel centers"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceUVEditor", NULL);
+ RNA_def_struct_sdna(srna, "SpaceImage");
+ RNA_def_struct_nested(brna, srna, "SpaceImageEditor");
+ RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
+
+ /* selection */
+ prop = RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sticky");
+ RNA_def_property_enum_items(prop, sticky_mode_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Sticky Selection Mode",
+ "Automatically select also UVs sharing the same vertex as the ones being selected");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ /* drawing */
+ prop = RNA_def_property(srna, "edge_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "dt_uv");
+ RNA_def_property_enum_items(prop, dt_uv_items);
+ RNA_def_property_ui_text(prop, "Edge Display Type", "Display type for drawing UV edges");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_smooth_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SMOOTH_UV);
+ RNA_def_property_ui_text(prop, "Display Smooth Edges", "Display UV edges anti-aliased");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_stretch", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_STRETCH);
+ RNA_def_property_ui_text(
+ prop,
+ "Display Stretch",
+ "Display faces colored according to the difference in shape between UVs and "
+ "their 3D coordinates (blue for low distortion, red for high distortion)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "display_stretch_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "dt_uvstretch");
+ RNA_def_property_enum_items(prop, dt_uvstretch_items);
+ RNA_def_property_ui_text(prop, "Display Stretch Type", "Type of stretch to draw");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_modified_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAWSHADOW);
+ RNA_def_property_ui_text(
+ prop, "Display Modified Edges", "Display edges after modifiers are applied");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_METADATA);
+ RNA_def_property_ui_text(prop, "Show Metadata", "Display metadata properties of the image");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_texpaint", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAW_TEXPAINT);
+ RNA_def_property_ui_text(
+ prop, "Display Texture Paint UVs", "Display overlay of texture paint uv layer");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_pixel_coords", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_COORDFLOATS);
+ RNA_def_property_ui_text(
+ prop, "Pixel Coordinates", "Display UV coordinates in pixels rather than from 0.0 to 1.0");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWFACES);
+ RNA_def_property_ui_text(prop, "Display Faces", "Display faces over the image");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SI_NO_DRAWEDGES);
+ RNA_def_property_ui_text(prop, "Display Edges", "Display edges in vertex select mode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ /* todo: move edge and face drawing options here from G.f */
+
+ prop = RNA_def_property(srna, "pixel_snap_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, pixel_snap_mode_items);
+ RNA_def_property_ui_text(prop, "Snap to Pixels", "Snap UVs to pixels while editing");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "lock_bounds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_CLIP_UV);
+ RNA_def_property_ui_text(prop,
+ "Constrain to Image Bounds",
+ "Constraint to stay within the image bounds while editing");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "use_live_unwrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_LIVE_UNWRAP);
+ RNA_def_property_ui_text(
+ prop,
+ "Live Unwrap",
+ "Continuously unwrap the selected UV island while transforming pinned vertices");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
}
static void rna_def_space_outliner(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem display_mode_items[] = {
- {SO_SCENES, "SCENES", ICON_SCENE_DATA, "Scenes", "Display scenes and their view layers, collections and objects"},
- {SO_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "Display collections and objects in the view layer"},
- {SO_SEQUENCE, "SEQUENCE", ICON_SEQUENCE, "Sequence", "Display sequence data-blocks"},
- {SO_LIBRARIES, "LIBRARIES", ICON_FILE_BLEND, "Blender File", "Display data of current file and linked libraries"},
- {SO_DATA_API, "DATA_API", ICON_RNA, "Data API", "Display low level Blender data and its properties"},
- {SO_ID_ORPHANS, "ORPHAN_DATA", ICON_ORPHAN_DATA, "Orphan Data",
- "Display data-blocks which are unused and/or will be lost when the file is reloaded"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem filter_state_items[] = {
- {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view layer"},
- {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
- {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
- {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SpaceOutliner", "Space");
- RNA_def_struct_sdna(srna, "SpaceOutliner");
- RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
-
- prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
- RNA_def_property_enum_items(prop, display_mode_items);
- RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "search_string");
- RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
- RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
- RNA_def_property_ui_text(prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
- RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE);
- RNA_def_property_ui_text(prop, "Complete Matches Only", "Only use complete matches of search string");
- RNA_def_property_ui_icon(prop, ICON_OUTLINER_DATA_FONT, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_sort_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_SKIP_SORT_ALPHA);
- RNA_def_property_ui_text(prop, "Sort Alphabetically", "");
- RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
- RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- /* Filters. */
- prop = RNA_def_property(srna, "use_filter_object", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OBJECT);
- RNA_def_property_ui_text(prop, "Filter Objects", "Show objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_object_content", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CONTENT);
- RNA_def_property_ui_text(prop, "Show Object Contents", "Show what is inside the objects elements");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_children", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_CHILDREN);
- RNA_def_property_ui_text(prop, "Show Object Children", "Show children");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_collection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_COLLECTION);
- RNA_def_property_ui_text(prop, "Show Collections", "Show collections");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- /* Filters object state. */
- prop = RNA_def_property(srna, "filter_state", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filter_state");
- RNA_def_property_enum_items(prop, filter_state_items);
- RNA_def_property_ui_text(prop, "Object State Filter", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- /* Filters object type. */
- prop = RNA_def_property(srna, "use_filter_object_mesh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_MESH);
- RNA_def_property_ui_text(prop, "Show Meshes", "Show mesh objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_object_armature", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_ARMATURE);
- RNA_def_property_ui_text(prop, "Show Armatures", "Show armature objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_object_empty", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_EMPTY);
- RNA_def_property_ui_text(prop, "Show Empties", "Show empty objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_object_light", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_LAMP);
- RNA_def_property_ui_text(prop, "Show Lights", "Show light objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_object_camera", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CAMERA);
- RNA_def_property_ui_text(prop, "Show Cameras", "Show camera objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "use_filter_object_others", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_OTHERS);
- RNA_def_property_ui_text(prop, "Show Other Objects", "Show curves, lattices, light probes, fonts, ...");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- /* Libraries filter. */
- prop = RNA_def_property(srna, "use_filter_id_type", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_ID_TYPE);
- RNA_def_property_ui_text(prop, "Filter By Type", "Show only data-blocks of one type");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
-
- prop = RNA_def_property(srna, "filter_id_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filter_id_type");
- RNA_def_property_enum_items(prop, rna_enum_id_type_items);
- RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem display_mode_items[] = {
+ {SO_SCENES,
+ "SCENES",
+ ICON_SCENE_DATA,
+ "Scenes",
+ "Display scenes and their view layers, collections and objects"},
+ {SO_VIEW_LAYER,
+ "VIEW_LAYER",
+ ICON_RENDER_RESULT,
+ "View Layer",
+ "Display collections and objects in the view layer"},
+ {SO_SEQUENCE, "SEQUENCE", ICON_SEQUENCE, "Sequence", "Display sequence data-blocks"},
+ {SO_LIBRARIES,
+ "LIBRARIES",
+ ICON_FILE_BLEND,
+ "Blender File",
+ "Display data of current file and linked libraries"},
+ {SO_DATA_API,
+ "DATA_API",
+ ICON_RNA,
+ "Data API",
+ "Display low level Blender data and its properties"},
+ {SO_ID_ORPHANS,
+ "ORPHAN_DATA",
+ ICON_ORPHAN_DATA,
+ "Orphan Data",
+ "Display data-blocks which are unused and/or will be lost when the file is reloaded"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem filter_state_items[] = {
+ {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view layer"},
+ {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
+ {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
+ {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceOutliner", "Space");
+ RNA_def_struct_sdna(srna, "SpaceOutliner");
+ RNA_def_struct_ui_text(srna, "Space Outliner", "Outliner space data");
+
+ prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "outlinevis");
+ RNA_def_property_enum_items(prop, display_mode_items);
+ RNA_def_property_ui_text(prop, "Display Mode", "Type of information to display");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "search_string");
+ RNA_def_property_ui_text(prop, "Display Filter", "Live search filtering string");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_case_sensitive", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_CASE_SENSITIVE);
+ RNA_def_property_ui_text(
+ prop, "Case Sensitive Matches Only", "Only use case sensitive matches of search string");
+ RNA_def_property_ui_icon(prop, ICON_SYNTAX_OFF, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_complete", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "search_flags", SO_FIND_COMPLETE);
+ RNA_def_property_ui_text(
+ prop, "Complete Matches Only", "Only use complete matches of search string");
+ RNA_def_property_ui_icon(prop, ICON_OUTLINER_DATA_FONT, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_sort_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_SKIP_SORT_ALPHA);
+ RNA_def_property_ui_text(prop, "Sort Alphabetically", "");
+ RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "show_restrict_columns", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SO_HIDE_RESTRICTCOLS);
+ RNA_def_property_ui_text(prop, "Show Restriction Columns", "Show column");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ /* Filters. */
+ prop = RNA_def_property(srna, "use_filter_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OBJECT);
+ RNA_def_property_ui_text(prop, "Filter Objects", "Show objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_object_content", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CONTENT);
+ RNA_def_property_ui_text(
+ prop, "Show Object Contents", "Show what is inside the objects elements");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_CHILDREN);
+ RNA_def_property_ui_text(prop, "Show Object Children", "Show children");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_collection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_COLLECTION);
+ RNA_def_property_ui_text(prop, "Show Collections", "Show collections");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ /* Filters object state. */
+ prop = RNA_def_property(srna, "filter_state", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter_state");
+ RNA_def_property_enum_items(prop, filter_state_items);
+ RNA_def_property_ui_text(prop, "Object State Filter", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ /* Filters object type. */
+ prop = RNA_def_property(srna, "use_filter_object_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_MESH);
+ RNA_def_property_ui_text(prop, "Show Meshes", "Show mesh objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_object_armature", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_ARMATURE);
+ RNA_def_property_ui_text(prop, "Show Armatures", "Show armature objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_object_empty", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_EMPTY);
+ RNA_def_property_ui_text(prop, "Show Empties", "Show empty objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_object_light", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_LAMP);
+ RNA_def_property_ui_text(prop, "Show Lights", "Show light objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_object_camera", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CAMERA);
+ RNA_def_property_ui_text(prop, "Show Cameras", "Show camera objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_object_others", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_OTHERS);
+ RNA_def_property_ui_text(
+ prop, "Show Other Objects", "Show curves, lattices, light probes, fonts, ...");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ /* Libraries filter. */
+ prop = RNA_def_property(srna, "use_filter_id_type", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", SO_FILTER_ID_TYPE);
+ RNA_def_property_ui_text(prop, "Filter By Type", "Show only data-blocks of one type");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
+ prop = RNA_def_property(srna, "filter_id_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter_id_type");
+ RNA_def_property_enum_items(prop, rna_enum_id_type_items);
+ RNA_def_property_ui_text(prop, "Filter ID Type", "Data-block type to show");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_ID);
}
static void rna_def_space_view3d_shading(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem background_type_items[] = {
- {V3D_SHADING_BACKGROUND_THEME, "THEME", 0, "Theme", "Use the theme for background color"},
- {V3D_SHADING_BACKGROUND_WORLD, "WORLD", 0, "World", "Use the world for background color"},
- {V3D_SHADING_BACKGROUND_VIEWPORT, "VIEWPORT", 0, "Viewport", "Use a custom color limited to this viewport only"},
- {0, NULL, 0, NULL, NULL},
- };
- static const float default_background_color[] = {0.05f, 0.05f, 0.05f};
-
- static const EnumPropertyItem cavity_type_items[] = {
- {V3D_SHADING_CAVITY_SSAO, "WORLD", 0, "World", "Cavity shading computed in world space, useful for larger-scale occlusion"},
- {V3D_SHADING_CAVITY_CURVATURE, "SCREEN", 0, "Screen", "Curvature-based shading, useful for making fine details more visible"},
- {V3D_SHADING_CAVITY_BOTH, "BOTH", 0, "Both", "Use both effects simultaneously"},
- {0, NULL, 0, NULL, NULL},
- };
-
-
- /* Note these settings are used for both 3D viewport and the OpenGL render
- * engine in the scene, so can't assume to always be part of a screen. */
- srna = RNA_def_struct(brna, "View3DShading", NULL);
- RNA_def_struct_path_func(srna, "rna_View3DShading_path");
- RNA_def_struct_ui_text(srna, "3D View Shading Settings", "Settings for shading in the 3D viewport");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
- RNA_def_property_enum_funcs(prop, "rna_3DViewShading_type_get", "rna_3DViewShading_type_set",
- "rna_3DViewShading_type_itemf");
- RNA_def_property_ui_text(prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
-
- prop = RNA_def_property(srna, "light", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "light");
- RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items);
- RNA_def_property_enum_funcs(prop, "rna_View3DShading_light_get", "rna_View3DShading_light_set", NULL);
- RNA_def_property_ui_text(prop, "Lighting", "Lighting Method for Solid/Texture Viewport Shading");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_object_outline", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_OBJECT_OUTLINE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Outline", "Show Object Outline");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "studio_light", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_studio_light_items);
- RNA_def_property_enum_default(prop, 0);
- RNA_def_property_enum_funcs(prop, "rna_View3DShading_studio_light_get", "rna_View3DShading_studio_light_set", "rna_View3DShading_studio_light_itemf");
- RNA_def_property_ui_text(prop, "Studiolight", "Studio lighting setup");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_world_space_lighting", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_WORLD_ORIENTATION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "World Space Lighting", "Make the lighting fixed and not follow the camera");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_BACKFACE_CULLING);
- RNA_def_property_ui_text(prop, "Backface Culling", "Use back face culling to hide the back side of faces");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_cavity", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_CAVITY);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Cavity", "Show Cavity");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "cavity_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, cavity_type_items);
- RNA_def_property_ui_text(prop, "Cavity Type", "Way to draw the cavity shading");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "curvature_ridge_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "curvature_ridge_factor");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Curvature Ridge", "Factor for the curvature ridges");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "curvature_valley_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "curvature_valley_factor");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Curvature Valley", "Factor for the curvature valleys");
- RNA_def_property_range(prop, 0.0f, 2.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "cavity_ridge_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "cavity_ridge_factor");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Cavity Ridge", "Factor for the cavity ridges");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_ui_range(prop, 0.00f, 2.5f, 1, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "cavity_valley_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "cavity_valley_factor");
- RNA_def_property_float_default(prop, 1.0);
- RNA_def_property_ui_text(prop, "Cavity Valley", "Factor for the cavity valleys");
- RNA_def_property_range(prop, 0.0f, 250.0f);
- RNA_def_property_ui_range(prop, 0.00f, 2.5f, 1, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "selected_studio_light", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "StudioLight");
- RNA_define_verify_sdna(0);
- RNA_def_property_ui_text(prop, "Studio Light", "Selected StudioLight");
- RNA_def_property_pointer_funcs(prop, "rna_View3DShading_selected_studio_light_get", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
- RNA_define_verify_sdna(1);
-
- prop = RNA_def_property(srna, "studiolight_rotate_z", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "studiolight_rot_z");
- RNA_def_property_float_default(prop, 0.0);
- RNA_def_property_ui_text(prop, "Studiolight Rotation", "Rotation of the studiolight around the Z-Axis");
- RNA_def_property_range(prop, -M_PI, M_PI);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "color_type");
- RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
- RNA_def_property_ui_text(prop, "Color", "Color Type");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "wireframe_color_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "wire_color_type");
- RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
- RNA_def_property_ui_text(prop, "Color", "Color Type");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "single_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "single_color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Color for single color mode");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "background_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, background_type_items);
- RNA_def_property_ui_text(prop, "Background", "Way to draw the background");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "background_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_background_color);
- RNA_def_property_ui_text(prop, "Background Color", "Color for custom background color");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SHADOW);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Shadow", "Show Shadow");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_xray", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Show X-Ray", "Show whole scene transparent");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_xray_wireframe", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY_BONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Show X-Ray", "Show whole scene transparent");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "xray_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "xray_alpha");
- RNA_def_property_float_default(prop, 0.5);
- RNA_def_property_ui_text(prop, "X-Ray Alpha", "Amount of alpha to use");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "xray_alpha_wireframe", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "xray_alpha_wire");
- RNA_def_property_float_default(prop, 0.5);
- RNA_def_property_ui_text(prop, "X-Ray Alpha", "Amount of alpha to use");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_DEPTH_OF_FIELD);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Depth Of Field", "Use depth of field on viewport using the values from the active camera");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_scene_lights", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SCENE_LIGHTS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Scene Lights", "Render lights and light probes of the scene");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_scene_world", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SCENE_WORLD);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Scene World", "Use scene world for lighting");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_specular_highlight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SPECULAR_HIGHLIGHT);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Specular Highlights", "Render specular highlights");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "object_outline_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "object_outline_color");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Outline Color", "Color for object outline");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "shadow_intensity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "shadow_intensity");
- RNA_def_property_float_default(prop, 0.5);
- RNA_def_property_ui_text(prop, "Shadow Intensity", "Darkness of shadows");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "studiolight_background_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "studiolight_background");
- RNA_def_property_float_default(prop, 0.0);
- RNA_def_property_ui_text(prop, "Background", "Show the studiolight in the background");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem background_type_items[] = {
+ {V3D_SHADING_BACKGROUND_THEME, "THEME", 0, "Theme", "Use the theme for background color"},
+ {V3D_SHADING_BACKGROUND_WORLD, "WORLD", 0, "World", "Use the world for background color"},
+ {V3D_SHADING_BACKGROUND_VIEWPORT,
+ "VIEWPORT",
+ 0,
+ "Viewport",
+ "Use a custom color limited to this viewport only"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ static const float default_background_color[] = {0.05f, 0.05f, 0.05f};
+
+ static const EnumPropertyItem cavity_type_items[] = {
+ {V3D_SHADING_CAVITY_SSAO,
+ "WORLD",
+ 0,
+ "World",
+ "Cavity shading computed in world space, useful for larger-scale occlusion"},
+ {V3D_SHADING_CAVITY_CURVATURE,
+ "SCREEN",
+ 0,
+ "Screen",
+ "Curvature-based shading, useful for making fine details more visible"},
+ {V3D_SHADING_CAVITY_BOTH, "BOTH", 0, "Both", "Use both effects simultaneously"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* Note these settings are used for both 3D viewport and the OpenGL render
+ * engine in the scene, so can't assume to always be part of a screen. */
+ srna = RNA_def_struct(brna, "View3DShading", NULL);
+ RNA_def_struct_path_func(srna, "rna_View3DShading_path");
+ RNA_def_struct_ui_text(
+ srna, "3D View Shading Settings", "Settings for shading in the 3D viewport");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_shading_type_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_3DViewShading_type_get",
+ "rna_3DViewShading_type_set",
+ "rna_3DViewShading_type_itemf");
+ RNA_def_property_ui_text(
+ prop, "Viewport Shading", "Method to display/shade objects in the 3D View");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_3DViewShading_type_update");
+
+ prop = RNA_def_property(srna, "light", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "light");
+ RNA_def_property_enum_items(prop, rna_enum_viewport_lighting_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_View3DShading_light_get", "rna_View3DShading_light_set", NULL);
+ RNA_def_property_ui_text(prop, "Lighting", "Lighting Method for Solid/Texture Viewport Shading");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_object_outline", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_OBJECT_OUTLINE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Outline", "Show Object Outline");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "studio_light", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_studio_light_items);
+ RNA_def_property_enum_default(prop, 0);
+ RNA_def_property_enum_funcs(prop,
+ "rna_View3DShading_studio_light_get",
+ "rna_View3DShading_studio_light_set",
+ "rna_View3DShading_studio_light_itemf");
+ RNA_def_property_ui_text(prop, "Studiolight", "Studio lighting setup");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_world_space_lighting", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_WORLD_ORIENTATION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "World Space Lighting", "Make the lighting fixed and not follow the camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_backface_culling", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_BACKFACE_CULLING);
+ RNA_def_property_ui_text(
+ prop, "Backface Culling", "Use back face culling to hide the back side of faces");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_cavity", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_CAVITY);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Cavity", "Show Cavity");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "cavity_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, cavity_type_items);
+ RNA_def_property_ui_text(prop, "Cavity Type", "Way to draw the cavity shading");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "curvature_ridge_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "curvature_ridge_factor");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Curvature Ridge", "Factor for the curvature ridges");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "curvature_valley_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "curvature_valley_factor");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Curvature Valley", "Factor for the curvature valleys");
+ RNA_def_property_range(prop, 0.0f, 2.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "cavity_ridge_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "cavity_ridge_factor");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Cavity Ridge", "Factor for the cavity ridges");
+ RNA_def_property_range(prop, 0.0f, 250.0f);
+ RNA_def_property_ui_range(prop, 0.00f, 2.5f, 1, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "cavity_valley_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "cavity_valley_factor");
+ RNA_def_property_float_default(prop, 1.0);
+ RNA_def_property_ui_text(prop, "Cavity Valley", "Factor for the cavity valleys");
+ RNA_def_property_range(prop, 0.0f, 250.0f);
+ RNA_def_property_ui_range(prop, 0.00f, 2.5f, 1, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "selected_studio_light", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "StudioLight");
+ RNA_define_verify_sdna(0);
+ RNA_def_property_ui_text(prop, "Studio Light", "Selected StudioLight");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_View3DShading_selected_studio_light_get", NULL, NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE | PROP_EDITABLE);
+ RNA_define_verify_sdna(1);
+
+ prop = RNA_def_property(srna, "studiolight_rotate_z", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "studiolight_rot_z");
+ RNA_def_property_float_default(prop, 0.0);
+ RNA_def_property_ui_text(
+ prop, "Studiolight Rotation", "Rotation of the studiolight around the Z-Axis");
+ RNA_def_property_range(prop, -M_PI, M_PI);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "color_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "color_type");
+ RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
+ RNA_def_property_ui_text(prop, "Color", "Color Type");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "wireframe_color_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "wire_color_type");
+ RNA_def_property_enum_items(prop, rna_enum_shading_color_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_View3DShading_color_type_itemf");
+ RNA_def_property_ui_text(prop, "Color", "Color Type");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "single_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "single_color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Color for single color mode");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "background_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, background_type_items);
+ RNA_def_property_ui_text(prop, "Background", "Way to draw the background");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "background_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_background_color);
+ RNA_def_property_ui_text(prop, "Background Color", "Color for custom background color");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_shadows", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SHADOW);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Shadow", "Show Shadow");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_xray", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Show X-Ray", "Show whole scene transparent");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_xray_wireframe", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_XRAY_BONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Show X-Ray", "Show whole scene transparent");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "xray_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "xray_alpha");
+ RNA_def_property_float_default(prop, 0.5);
+ RNA_def_property_ui_text(prop, "X-Ray Alpha", "Amount of alpha to use");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "xray_alpha_wireframe", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "xray_alpha_wire");
+ RNA_def_property_float_default(prop, 0.5);
+ RNA_def_property_ui_text(prop, "X-Ray Alpha", "Amount of alpha to use");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_dof", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_DEPTH_OF_FIELD);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Depth Of Field",
+ "Use depth of field on viewport using the values from the active camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_scene_lights", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SCENE_LIGHTS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Scene Lights", "Render lights and light probes of the scene");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_scene_world", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SCENE_WORLD);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Scene World", "Use scene world for lighting");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_specular_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SHADING_SPECULAR_HIGHLIGHT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Specular Highlights", "Render specular highlights");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "object_outline_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "object_outline_color");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Outline Color", "Color for object outline");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "shadow_intensity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "shadow_intensity");
+ RNA_def_property_float_default(prop, 0.5);
+ RNA_def_property_ui_text(prop, "Shadow Intensity", "Darkness of shadows");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "studiolight_background_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "studiolight_background");
+ RNA_def_property_float_default(prop, 0.0);
+ RNA_def_property_ui_text(prop, "Background", "Show the studiolight in the background");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.00f, 1.0f, 1, 3);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
}
static void rna_def_space_view3d_overlay(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "View3DOverlay", NULL);
- RNA_def_struct_sdna(srna, "View3D");
- RNA_def_struct_nested(brna, srna, "SpaceView3D");
- RNA_def_struct_path_func(srna, "rna_View3DOverlay_path");
- RNA_def_struct_ui_text(srna, "3D View Overlay Settings", "Settings for display of overlays in the 3D viewport");
-
- prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_HIDE_OVERLAYS);
- RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like gizmos and outlines");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
- RNA_def_property_ui_text(prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
- RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
- RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
- RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "grid");
- RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines");
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, 1000.0f, 0.1f, 3);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gridlines");
- RNA_def_property_ui_text(prop, "Grid Lines", "Number of grid lines to display in perspective view");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_int_default(prop, 16);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
- RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines");
- RNA_def_property_range(prop, 1, 1024);
- RNA_def_property_int_default(prop, 10);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "grid_scale_unit", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_View3DOverlay_GridScaleUnit_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Grid Scale Unit", "Grid cell size scaled by scene unit system settings");
-
- prop = RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
- RNA_def_property_ui_text(prop, "Outline Selected",
- "Show an outline highlight around selected objects in non-wireframe views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_object_origins", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_OBJECT_ORIGINS);
- RNA_def_property_ui_text(prop, "Object Origins", "Show object center dots");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_object_origins_all", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
- RNA_def_property_ui_text(prop, "All Object Origins",
- "Show the object origin center dot for all (selected and unselected) objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
- RNA_def_property_ui_text(prop, "Relationship Lines",
- "Show dashed lines indicating parent or constraint relationships");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_CURSOR);
- RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor Overlay");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_text", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_TEXT);
- RNA_def_property_ui_text(prop, "Show Text", "Display overlay text");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_extras", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_OBJECT_XTRAS);
- RNA_def_property_ui_text(prop, "Extras", "Object details, including empty wire, cameras and other visual guides");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_bones", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_BONES);
- RNA_def_property_ui_text(prop, "Show Bones", "Display bones (disable to show motion paths only)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_face_orientation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_FACE_ORIENTATION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Face Orientation", "Show the Face Orientation Overlay");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_xray_bone", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_BONE_SELECT);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Show Bone X-Ray", "Show the bone selection overlay");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "xray_alpha_bone", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.xray_alpha_bone");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(prop, "Opacity", "Opacity to use for bone selection");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "show_motion_paths", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_MOTION_PATHS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Motion Paths", "Show the Motion Paths Overlay");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_onion_skins", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_ONION_SKINS);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Onion Skins", "Show the Onion Skinning Overlay");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_look_dev", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_LOOK_DEV);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Look Dev Preview", "Show look development balls and palette");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_wireframes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_WIREFRAMES);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Wireframe", "Show face edges wires");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "wireframe_threshold", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.wireframe_threshold");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(prop, "Wireframe Threshold", "Adjust the number of wires displayed (1 for all wires)");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_paint_wire", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.paint_flag", V3D_OVERLAY_PAINT_WIRE);
- RNA_def_property_ui_text(prop, "Show Wire", "Use wireframe display in painting modes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_wpaint_contours", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.wpaint_flag", V3D_OVERLAY_WPAINT_CONTOURS);
- RNA_def_property_ui_text(prop, "Show Weight Contours", "Show contour lines formed by points with the same interpolated weight");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_WEIGHT);
- RNA_def_property_ui_text(prop, "Show Weights", "Display weights in editmode");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_OCCLUDE_WIRE);
- RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_face_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_NORMALS);
- RNA_def_property_ui_text(prop, "Display Normals", "Display face normals as lines");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_vertex_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_VERT_NORMALS);
- RNA_def_property_ui_text(prop, "Display Vertex Normals", "Display vertex normals as lines");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_split_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_LOOP_NORMALS);
- RNA_def_property_ui_text(prop, "Display Split Normals", "Display vertex-per-face normals as lines");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGES);
- RNA_def_property_ui_text(prop, "Draw Edges",
- "Display selected edges using highlights in the 3D view and UV editor");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACES);
- RNA_def_property_ui_text(prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_face_center", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_DOT);
- RNA_def_property_ui_text(prop, "Draw Face Center", "Display face center "
- "(when disabled, edges display wider in edge mode)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CREASES);
- RNA_def_property_ui_text(prop, "Draw Creases", "Display creases created for Subdivision Surface modifier");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_BWEIGHTS);
- RNA_def_property_ui_text(prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_SEAMS);
- RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_SHARP);
- RNA_def_property_ui_text(prop, "Draw Sharp", "Display sharp edges, used with the Edge Split modifier");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_freestyle_edge_marks", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FREESTYLE_EDGE);
- RNA_def_property_ui_text(prop, "Draw Freestyle Edge Marks", "Display Freestyle edge marks, used with the Freestyle renderer");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_freestyle_face_marks", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FREESTYLE_FACE);
- RNA_def_property_ui_text(prop, "Draw Freestyle Face Marks", "Display Freestyle face marks, used with the Freestyle renderer");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_statvis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_STATVIS);
- RNA_def_property_ui_text(prop, "Stat Vis", "Display statistical information about the mesh");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGE_LEN);
- RNA_def_property_ui_text(prop, "Edge Length",
- "Display selected edge lengths, using global values when set in the transform panel");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGE_ANG);
- RNA_def_property_ui_text(prop, "Edge Angle",
- "Display selected edge angle, using global values when set in the transform panel");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_ANG);
- RNA_def_property_ui_text(prop, "Face Angles",
- "Display the angles in the selected edges, "
- "using global values when set in the transform panel");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_AREA);
- RNA_def_property_ui_text(prop, "Face Area",
- "Display the area of selected faces, "
- "using global values when set in the transform panel");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_INDICES);
- RNA_def_property_ui_text(prop, "Indices", "Display the index numbers of selected vertices, edges, and faces");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_curve_handles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_HANDLES);
- RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_curve_normals", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_NORMALS);
- RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.normals_length");
- RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
- RNA_def_property_range(prop, 0.00001, 100000.0);
- RNA_def_property_ui_range(prop, 0.01, 2.0, 1, 2);
- RNA_def_property_float_default(prop, 0.02);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "backwire_opacity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.backwire_opacity");
- RNA_def_property_ui_text(prop, "Backwire Opacity", "Opacity when rendering transparent wires");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "texture_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.texture_paint_mode_opacity");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Texture Opacity", "Opacity of the texture paint mode overlay");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "vertex_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.vertex_paint_mode_opacity");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Vertex Paint Opacity", "Opacity of the vertex paint mode overlay");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "weight_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "overlay.weight_paint_mode_opacity");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Weight Paint Opacity", "Opacity of the weight paint mode overlay");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* grease pencil paper settings */
- prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_ANNOTATION);
- RNA_def_property_ui_text(
- prop, "Show Annotation",
- "Show annotations for this view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_paper", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_PAPER);
- RNA_def_property_ui_text(
- prop, "Use Paper",
- "Cover all viewport with a full color layer to improve visibility while drawing over complex scenes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_grid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_GRID);
- RNA_def_property_ui_text(
- prop, "Use Grid",
- "Display a grid over grease pencil paper");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "use_gpencil_fade_layers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_FADE_NOACTIVE_LAYERS);
- RNA_def_property_ui_text(
- prop, "Fade Layers",
- "Toggle fading of Grease Pencil layers except the active one");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "gpencil_grid_opacity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_grid_opacity");
- RNA_def_property_range(prop, 0.1f, 1.0f);
- RNA_def_property_float_default(prop, 0.9f);
- RNA_def_property_ui_text(prop, "Opacity", "Canvas grid opacity");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Paper opacity factor */
- prop = RNA_def_property(srna, "gpencil_paper_opacity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_paper_opacity");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(prop, "Opacity", "Paper opacity");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Paper opacity factor */
- prop = RNA_def_property(srna, "gpencil_fade_layer", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_fade_layer");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_ui_text(
- prop, "Opacity",
- "Fade layer opacity for Grease Pencil layers except the active one");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- /* show edit lines */
- prop = RNA_def_property(srna, "use_gpencil_edit_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_EDIT_LINES);
- RNA_def_property_ui_text(prop, "Show Edit Lines", "Show edit lines when editing strokes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- prop = RNA_def_property(srna, "use_gpencil_multiedit_line_only", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_MULTIEDIT_LINES);
- RNA_def_property_ui_text(prop, "Lines Only", "Only show edit lines for additional frames");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- /* main grease pencil onion switch */
- prop = RNA_def_property(srna, "use_gpencil_onion_skin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_ONION_SKIN);
- RNA_def_property_ui_text(prop, "Onion Skins", "Show ghosts of the keyframes before and after the current frame");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
-
- /* vertex opacity */
- prop = RNA_def_property(srna, "vertex_opacity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vertex_opacity");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Vertex Opacity", "Opacity for edit vertices");
- RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
- RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "View3DOverlay", NULL);
+ RNA_def_struct_sdna(srna, "View3D");
+ RNA_def_struct_nested(brna, srna, "SpaceView3D");
+ RNA_def_struct_path_func(srna, "rna_View3DOverlay_path");
+ RNA_def_struct_ui_text(
+ srna, "3D View Overlay Settings", "Settings for display of overlays in the 3D viewport");
+
+ prop = RNA_def_property(srna, "show_overlays", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag2", V3D_HIDE_OVERLAYS);
+ RNA_def_property_ui_text(prop, "Show Overlays", "Display overlays like gizmos and outlines");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "show_floor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_FLOOR);
+ RNA_def_property_ui_text(
+ prop, "Display Grid Floor", "Show the ground plane grid in perspective view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_axis_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_X);
+ RNA_def_property_ui_text(prop, "Display X Axis", "Show the X axis line in perspective view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_axis_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Y);
+ RNA_def_property_ui_text(prop, "Display Y Axis", "Show the Y axis line in perspective view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_axis_z", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gridflag", V3D_SHOW_Z);
+ RNA_def_property_ui_text(prop, "Display Z Axis", "Show the Z axis line in perspective view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "grid_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "grid");
+ RNA_def_property_ui_text(prop, "Grid Scale", "Distance between 3D View grid lines");
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, 1000.0f, 0.1f, 3);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "grid_lines", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gridlines");
+ RNA_def_property_ui_text(
+ prop, "Grid Lines", "Number of grid lines to display in perspective view");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_int_default(prop, 16);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "grid_subdivisions", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "gridsubdiv");
+ RNA_def_property_ui_text(prop, "Grid Subdivisions", "Number of subdivisions between grid lines");
+ RNA_def_property_range(prop, 1, 1024);
+ RNA_def_property_int_default(prop, 10);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "grid_scale_unit", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_View3DOverlay_GridScaleUnit_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Grid Scale Unit", "Grid cell size scaled by scene unit system settings");
+
+ prop = RNA_def_property(srna, "show_outline_selected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_SELECT_OUTLINE);
+ RNA_def_property_ui_text(
+ prop,
+ "Outline Selected",
+ "Show an outline highlight around selected objects in non-wireframe views");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_object_origins", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_OBJECT_ORIGINS);
+ RNA_def_property_ui_text(prop, "Object Origins", "Show object center dots");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_object_origins_all", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", V3D_DRAW_CENTERS);
+ RNA_def_property_ui_text(
+ prop,
+ "All Object Origins",
+ "Show the object origin center dot for all (selected and unselected) objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_relationship_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", V3D_HIDE_HELPLINES);
+ RNA_def_property_ui_text(prop,
+ "Relationship Lines",
+ "Show dashed lines indicating parent or constraint relationships");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_CURSOR);
+ RNA_def_property_ui_text(prop, "Show 3D Cursor", "Display 3D Cursor Overlay");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_text", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_TEXT);
+ RNA_def_property_ui_text(prop, "Show Text", "Display overlay text");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_extras", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_OBJECT_XTRAS);
+ RNA_def_property_ui_text(
+ prop, "Extras", "Object details, including empty wire, cameras and other visual guides");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_bones", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_BONES);
+ RNA_def_property_ui_text(
+ prop, "Show Bones", "Display bones (disable to show motion paths only)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_face_orientation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_FACE_ORIENTATION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Face Orientation", "Show the Face Orientation Overlay");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_xray_bone", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_BONE_SELECT);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Show Bone X-Ray", "Show the bone selection overlay");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "xray_alpha_bone", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.xray_alpha_bone");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(prop, "Opacity", "Opacity to use for bone selection");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "show_motion_paths", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_MOTION_PATHS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Motion Paths", "Show the Motion Paths Overlay");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_onion_skins", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_ONION_SKINS);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Onion Skins", "Show the Onion Skinning Overlay");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_look_dev", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_LOOK_DEV);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Look Dev Preview", "Show look development balls and palette");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_wireframes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.flag", V3D_OVERLAY_WIREFRAMES);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Wireframe", "Show face edges wires");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "wireframe_threshold", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.wireframe_threshold");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(
+ prop, "Wireframe Threshold", "Adjust the number of wires displayed (1 for all wires)");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_paint_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.paint_flag", V3D_OVERLAY_PAINT_WIRE);
+ RNA_def_property_ui_text(prop, "Show Wire", "Use wireframe display in painting modes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_wpaint_contours", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.wpaint_flag", V3D_OVERLAY_WPAINT_CONTOURS);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Weight Contours",
+ "Show contour lines formed by points with the same interpolated weight");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_WEIGHT);
+ RNA_def_property_ui_text(prop, "Show Weights", "Display weights in editmode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_occlude_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_OCCLUDE_WIRE);
+ RNA_def_property_ui_text(prop, "Hidden Wire", "Use hidden wireframe display");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_face_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_NORMALS);
+ RNA_def_property_ui_text(prop, "Display Normals", "Display face normals as lines");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_vertex_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_VERT_NORMALS);
+ RNA_def_property_ui_text(prop, "Display Vertex Normals", "Display vertex normals as lines");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_split_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_LOOP_NORMALS);
+ RNA_def_property_ui_text(
+ prop, "Display Split Normals", "Display vertex-per-face normals as lines");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_edges", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGES);
+ RNA_def_property_ui_text(
+ prop, "Draw Edges", "Display selected edges using highlights in the 3D view and UV editor");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_faces", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACES);
+ RNA_def_property_ui_text(
+ prop, "Draw Faces", "Display all faces as shades in the 3D view and UV editor");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_face_center", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_DOT);
+ RNA_def_property_ui_text(prop,
+ "Draw Face Center",
+ "Display face center "
+ "(when disabled, edges display wider in edge mode)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_edge_crease", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CREASES);
+ RNA_def_property_ui_text(
+ prop, "Draw Creases", "Display creases created for Subdivision Surface modifier");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_edge_bevel_weight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_BWEIGHTS);
+ RNA_def_property_ui_text(
+ prop, "Draw Bevel Weights", "Display weights created for the Bevel modifier");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_edge_seams", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_SEAMS);
+ RNA_def_property_ui_text(prop, "Draw Seams", "Display UV unwrapping seams");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_edge_sharp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_SHARP);
+ RNA_def_property_ui_text(
+ prop, "Draw Sharp", "Display sharp edges, used with the Edge Split modifier");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_freestyle_edge_marks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FREESTYLE_EDGE);
+ RNA_def_property_ui_text(prop,
+ "Draw Freestyle Edge Marks",
+ "Display Freestyle edge marks, used with the Freestyle renderer");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_freestyle_face_marks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FREESTYLE_FACE);
+ RNA_def_property_ui_text(prop,
+ "Draw Freestyle Face Marks",
+ "Display Freestyle face marks, used with the Freestyle renderer");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_statvis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_STATVIS);
+ RNA_def_property_ui_text(prop, "Stat Vis", "Display statistical information about the mesh");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_extra_edge_length", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGE_LEN);
+ RNA_def_property_ui_text(
+ prop,
+ "Edge Length",
+ "Display selected edge lengths, using global values when set in the transform panel");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_extra_edge_angle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_EDGE_ANG);
+ RNA_def_property_ui_text(
+ prop,
+ "Edge Angle",
+ "Display selected edge angle, using global values when set in the transform panel");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_extra_face_angle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_ANG);
+ RNA_def_property_ui_text(prop,
+ "Face Angles",
+ "Display the angles in the selected edges, "
+ "using global values when set in the transform panel");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_extra_face_area", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_FACE_AREA);
+ RNA_def_property_ui_text(prop,
+ "Face Area",
+ "Display the area of selected faces, "
+ "using global values when set in the transform panel");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_extra_indices", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_INDICES);
+ RNA_def_property_ui_text(
+ prop, "Indices", "Display the index numbers of selected vertices, edges, and faces");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_curve_handles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_HANDLES);
+ RNA_def_property_ui_text(prop, "Draw Handles", "Display Bezier handles in editmode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_curve_normals", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overlay.edit_flag", V3D_OVERLAY_EDIT_CU_NORMALS);
+ RNA_def_property_ui_text(prop, "Draw Normals", "Display 3D curve normals in editmode");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "normals_length", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.normals_length");
+ RNA_def_property_ui_text(prop, "Normal Size", "Display size for normals in the 3D view");
+ RNA_def_property_range(prop, 0.00001, 100000.0);
+ RNA_def_property_ui_range(prop, 0.01, 2.0, 1, 2);
+ RNA_def_property_float_default(prop, 0.02);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "backwire_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.backwire_opacity");
+ RNA_def_property_ui_text(prop, "Backwire Opacity", "Opacity when rendering transparent wires");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "texture_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.texture_paint_mode_opacity");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Texture Opacity", "Opacity of the texture paint mode overlay");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "vertex_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.vertex_paint_mode_opacity");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Vertex Paint Opacity", "Opacity of the vertex paint mode overlay");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "weight_paint_mode_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.weight_paint_mode_opacity");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Weight Paint Opacity", "Opacity of the weight paint mode overlay");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* grease pencil paper settings */
+ prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_ANNOTATION);
+ RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_paper", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_PAPER);
+ RNA_def_property_ui_text(prop,
+ "Use Paper",
+ "Cover all viewport with a full color layer to improve visibility "
+ "while drawing over complex scenes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_GRID);
+ RNA_def_property_ui_text(prop, "Use Grid", "Display a grid over grease pencil paper");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_gpencil_fade_layers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_FADE_NOACTIVE_LAYERS);
+ RNA_def_property_ui_text(
+ prop, "Fade Layers", "Toggle fading of Grease Pencil layers except the active one");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "gpencil_grid_opacity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_grid_opacity");
+ RNA_def_property_range(prop, 0.1f, 1.0f);
+ RNA_def_property_float_default(prop, 0.9f);
+ RNA_def_property_ui_text(prop, "Opacity", "Canvas grid opacity");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Paper opacity factor */
+ prop = RNA_def_property(srna, "gpencil_paper_opacity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_paper_opacity");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(prop, "Opacity", "Paper opacity");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Paper opacity factor */
+ prop = RNA_def_property(srna, "gpencil_fade_layer", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "overlay.gpencil_fade_layer");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_ui_text(
+ prop, "Opacity", "Fade layer opacity for Grease Pencil layers except the active one");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ /* show edit lines */
+ prop = RNA_def_property(srna, "use_gpencil_edit_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_EDIT_LINES);
+ RNA_def_property_ui_text(prop, "Show Edit Lines", "Show edit lines when editing strokes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ prop = RNA_def_property(srna, "use_gpencil_multiedit_line_only", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_MULTIEDIT_LINES);
+ RNA_def_property_ui_text(prop, "Lines Only", "Only show edit lines for additional frames");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ /* main grease pencil onion switch */
+ prop = RNA_def_property(srna, "use_gpencil_onion_skin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_flag", V3D_GP_SHOW_ONION_SKIN);
+ RNA_def_property_ui_text(
+ prop, "Onion Skins", "Show ghosts of the keyframes before and after the current frame");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update");
+
+ /* vertex opacity */
+ prop = RNA_def_property(srna, "vertex_opacity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vertex_opacity");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Vertex Opacity", "Opacity for edit vertices");
+ RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
+ RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_GPencil_update");
}
static void rna_def_space_view3d(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem rv3d_persp_items[] = {
- {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
- {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
- {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem bundle_drawtype_items[] = {
- {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
- {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
- {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
- {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
- {OB_CUBE, "CUBE", 0, "Cube", ""},
- {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
- {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SpaceView3D", "Space");
- RNA_def_struct_sdna(srna, "View3D");
- RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
-
- prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_sdna(prop, NULL, "camera");
- RNA_def_property_ui_text(prop, "Camera",
- "Active camera used in this view (when unlocked from the scene's active camera)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_camera_update");
-
- /* render border */
- prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Render Region", "Use a region within the frame size for rendered viewport"
- "(when not viewing through the camera)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "render_border_min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "render_border.xmin");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "render_border_min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "render_border.ymin");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "render_border_max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "render_border.xmax");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "render_border_max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "render_border.ymax");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
- RNA_def_property_ui_text(prop, "Lock to Object", "3D View center is locked to this object's position");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "ob_centre_bone");
- RNA_def_property_ui_text(prop, "Lock to Bone", "3D View center is locked to this bone's position");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
- RNA_def_property_ui_text(prop, "Lock to Cursor", "3D View center is locked to the cursor's position");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "localvd");
- RNA_def_property_ui_text(prop, "Local View",
- "Display an isolated sub-set of objects, apart from the scene visibility");
-
- prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_UNIT_CAMERA);
- RNA_def_property_float_sdna(prop, NULL, "lens");
- RNA_def_property_ui_text(prop, "Lens", "Viewport lens angle");
- RNA_def_property_range(prop, 1.0f, 250.0f);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_float_default(prop, 0.1f);
- RNA_def_property_ui_text(prop, "Clip Start", "3D View near clipping distance (perspective view only)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_range(prop, 1e-6f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
- RNA_def_property_float_default(prop, 1000.0f);
- RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
- RNA_def_property_ui_text(prop, "Lock Camera to View", "Enable view navigation within the camera view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE);
- RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_navigate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE_NAVIGATE);
- RNA_def_property_ui_text(prop, "Navigate Gizmo", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_context", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE_CONTEXT);
- RNA_def_property_ui_text(prop, "Context Gizmo", "Context sensitive gizmos for the active item");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_tool", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE_TOOL);
- RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Per object type gizmo display flags. */
-
- prop = RNA_def_property(srna, "show_gizmo_object_translate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_TRANSLATE);
- RNA_def_property_ui_text(prop, "Show Object Location", "Gizmo to adjust location");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_object_rotate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_ROTATE);
- RNA_def_property_ui_text(prop, "Show Object Rotation", "Gizmo to adjust rotation");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_object_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_SCALE);
- RNA_def_property_ui_text(prop, "Show Object Scale", "Gizmo to adjust scale");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Empty Object Data. */
- prop = RNA_def_property(srna, "show_gizmo_empty_image", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_IMAGE);
- RNA_def_property_ui_text(prop, "Show Empty Image", "Gizmo to adjust image size and position");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_empty_force_field", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD);
- RNA_def_property_ui_text(prop, "Show Empty Force Field", "Gizmo to adjust the force field");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Light Object Data. */
- prop = RNA_def_property(srna, "show_gizmo_light_size", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_SIZE);
- RNA_def_property_ui_text(prop, "Show Light Size", "Gizmo to adjust spot and area size");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_light_look_at", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_LOOK_AT);
- RNA_def_property_ui_text(prop, "Show Light Look-At", "Gizmo to adjust spot and area size");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Camera Object Data. */
- prop = RNA_def_property(srna, "show_gizmo_camera_lens", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_LENS);
- RNA_def_property_ui_text(prop, "Show Camera Lens", "Gizmo to adjust camera lens & ortho size");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_gizmo_camera_dof_distance", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_DOF_DIST);
- RNA_def_property_ui_text(
- prop, "Show Camera Focus Distance", "Gizmo to adjust camera focus distance "
- "(depends on limits display)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
-
- prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_use_local_camera_set");
- RNA_def_property_ui_text(prop, "Use Local Camera",
- "Use a local camera in this view, rather than scene's active camera camera");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "RegionView3D");
- RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "3D Region", "3D region in this space, in case of quad view the camera region");
-
- prop = RNA_def_property(srna, "region_quadviews", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "RegionView3D");
- RNA_def_property_collection_funcs(prop, "rna_SpaceView3D_region_quadviews_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_SpaceView3D_region_quadviews_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Quad View Regions", "3D regions (the third one defines quad view settings, "
- "the fourth one is same as 'region_3d')");
-
- prop = RNA_def_property(srna, "show_reconstruction", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_RECONSTRUCTION);
- RNA_def_property_ui_text(prop, "Show Reconstruction", "Display reconstruction data from active movie clip");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "tracks_display_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 5, 1, 3);
- RNA_def_property_float_sdna(prop, NULL, "bundle_size");
- RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "tracks_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype");
- RNA_def_property_enum_items(prop, bundle_drawtype_items);
- RNA_def_property_ui_text(prop, "Tracks Display Type", "Viewport display style for tracks");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH);
- RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed camera path");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_bundle_names", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME);
- RNA_def_property_ui_text(prop, "Show 3D Marker Names", "Show names for reconstructed tracks objects");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "fx_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "FX Options", "Options used for real time compositing");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* Stereo Settings */
- prop = RNA_def_property(srna, "stereo_3d_eye", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "multiview_eye");
- RNA_def_property_enum_items(prop, stereo3d_eye_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
- RNA_def_property_ui_text(prop, "Stereo Eye", "Current stereo eye being drawn");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "stereo_3d_camera", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stereo3d_camera");
- RNA_def_property_enum_items(prop, stereo3d_camera_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
- RNA_def_property_ui_text(prop, "Camera", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_stereo_3d_cameras", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPCAMERAS);
- RNA_def_property_ui_text(prop, "Cameras", "Show the left and right cameras");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_stereo_3d_convergence_plane", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPPLANE);
- RNA_def_property_ui_text(prop, "Plane", "Show the stereo 3d convergence plane");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "stereo_3d_convergence_plane_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "stereo3d_convergence_alpha");
- RNA_def_property_ui_text(prop, "Plane Alpha", "Opacity (alpha) of the convergence plane");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "show_stereo_3d_volume", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPVOLUME);
- RNA_def_property_ui_text(prop, "Volume", "Show the stereo 3d frustum volume");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "stereo_3d_volume_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "stereo3d_volume_alpha");
- RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- {
- struct {
- const char *name;
- int type_mask;
- const char *identifier[2];
- } info[] = {
- {"Mesh", (1 << OB_MESH),
- {"show_object_viewport_mesh", "show_object_select_mesh"}},
- {"Curve", (1 << OB_CURVE),
- {"show_object_viewport_curve", "show_object_select_curve"}},
- {"Surface", (1 << OB_SURF),
- {"show_object_viewport_surf", "show_object_select_surf"}},
- {"Meta", (1 << OB_MBALL),
- {"show_object_viewport_meta", "show_object_select_meta"}},
- {"Font", (1 << OB_FONT),
- {"show_object_viewport_font", "show_object_select_font"}},
- {"Armature", (1 << OB_ARMATURE),
- {"show_object_viewport_armature", "show_object_select_armature"}},
- {"Lattice", (1 << OB_LATTICE),
- {"show_object_viewport_lattice", "show_object_select_lattice"}},
- {"Empty", (1 << OB_EMPTY),
- {"show_object_viewport_empty", "show_object_select_empty"}},
- {"Grease Pencil", (1 << OB_GPENCIL),
- {"show_object_viewport_grease_pencil", "show_object_select_grease_pencil"}},
- {"Camera", (1 << OB_CAMERA),
- {"show_object_viewport_camera", "show_object_select_camera"}},
- {"Light", (1 << OB_LAMP),
- {"show_object_viewport_light", "show_object_select_light"}},
- {"Speaker", (1 << OB_SPEAKER),
- {"show_object_viewport_speaker", "show_object_select_speaker"}},
- {"Light Probe", (1 << OB_LIGHTPROBE),
- {"show_object_viewport_light_probe", "show_object_select_light_probe"}},
- };
-
- const char *view_mask_member[2] = {
- "object_type_exclude_viewport",
- "object_type_exclude_select",
- };
- for (int mask_index = 0; mask_index < 2; mask_index++) {
- for (int type_index = 0; type_index < ARRAY_SIZE(info); type_index++) {
- prop = RNA_def_property(srna, info[type_index].identifier[mask_index], PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(
- prop, NULL, view_mask_member[mask_index], info[type_index].type_mask);
- RNA_def_property_ui_text(prop, info[type_index].name, "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- }
- }
-
- /* Heper for drawing the icon. */
- prop = RNA_def_property(srna, "icon_from_show_object_viewport", PROP_INT, PROP_NONE);
- RNA_def_property_int_funcs(prop, "rna_SpaceView3D_icon_from_show_object_viewport_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Visibility Icon", "");
- }
-
- /* Nested Structs */
- prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "View3DShading");
- RNA_def_property_ui_text(prop, "Shading Settings", "Settings for shading in the 3D viewport");
-
- prop = RNA_def_property(srna, "overlay", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "View3DOverlay");
- RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_overlay_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Overlay Settings", "Settings for display of overlays in the 3D viewport");
-
- rna_def_space_view3d_shading(brna);
- rna_def_space_view3d_overlay(brna);
-
- /* *** Animated *** */
- RNA_define_animate_sdna(true);
- /* region */
-
- srna = RNA_def_struct(brna, "RegionView3D", NULL);
- RNA_def_struct_sdna(srna, "RegionView3D");
- RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
-
- prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
- RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
-
- prop = RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
- RNA_def_property_ui_text(prop, "Box", "Sync view position between side views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
-
- prop = RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
- RNA_def_property_ui_text(prop, "Clip", "Clip objects based on what's visible in other side views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
-
- prop = RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "persmat");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* XXX: for now, it's too risky for users to do this */
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Perspective Matrix",
- "Current perspective matrix (``window_matrix * view_matrix``)");
-
- prop = RNA_def_property(srna, "window_matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "winmat");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Window Matrix", "Current window matrix");
-
- prop = RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "viewmat");
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_float_funcs(prop, NULL, "rna_RegionView3D_view_matrix_set", NULL);
- RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "persp");
- RNA_def_property_enum_items(prop, rv3d_persp_items);
- RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "is_persp", 1);
- RNA_def_property_ui_text(prop, "Is Perspective", "");
- RNA_def_property_flag(prop, PROP_EDITABLE);
-
- /* This isn't directly accessible from the UI, only an operator. */
- prop = RNA_def_property(srna, "use_clip_planes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rflag", RV3D_CLIPPING);
- RNA_def_property_ui_text(prop, "Use Clip Planes", "");
-
- prop = RNA_def_property(srna, "clip_planes", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "clip");
- RNA_def_property_multi_array(prop, 2, (int[]){6, 4});
- RNA_def_property_ui_text(prop, "Clip Planes", "");
-
- prop = RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
-#if 0
- RNA_def_property_float_sdna(prop, NULL, "ofs"); /* cant use because its negated */
-#else
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_location_get",
- "rna_RegionView3D_view_location_set", NULL);
-#endif
- RNA_def_property_ui_text(prop, "View Location", "View pivot location");
- RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); /* cant use because its inverted */
-#if 0
- RNA_def_property_float_sdna(prop, NULL, "viewquat");
-#else
- RNA_def_property_array(prop, 4);
- RNA_def_property_float_funcs(prop, "rna_RegionView3D_view_rotation_get",
- "rna_RegionView3D_view_rotation_set", NULL);
-#endif
- RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- /* not sure we need rna access to these but adding anyway */
- prop = RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "view_camera_zoom", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_sdna(prop, NULL, "camzoom");
- RNA_def_property_ui_text(prop, "Camera Zoom", "Zoom factor in camera view");
- RNA_def_property_range(prop, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- prop = RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "camdx");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Camera Offset", "View shift in camera view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
-
- RNA_api_region_view3d(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem rv3d_persp_items[] = {
+ {RV3D_PERSP, "PERSP", 0, "Perspective", ""},
+ {RV3D_ORTHO, "ORTHO", 0, "Orthographic", ""},
+ {RV3D_CAMOB, "CAMERA", 0, "Camera", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem bundle_drawtype_items[] = {
+ {OB_PLAINAXES, "PLAIN_AXES", 0, "Plain Axes", ""},
+ {OB_ARROWS, "ARROWS", 0, "Arrows", ""},
+ {OB_SINGLE_ARROW, "SINGLE_ARROW", 0, "Single Arrow", ""},
+ {OB_CIRCLE, "CIRCLE", 0, "Circle", ""},
+ {OB_CUBE, "CUBE", 0, "Cube", ""},
+ {OB_EMPTY_SPHERE, "SPHERE", 0, "Sphere", ""},
+ {OB_EMPTY_CONE, "CONE", 0, "Cone", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceView3D", "Space");
+ RNA_def_struct_sdna(srna, "View3D");
+ RNA_def_struct_ui_text(srna, "3D View Space", "3D View space data");
+
+ prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_sdna(prop, NULL, "camera");
+ RNA_def_property_ui_text(
+ prop,
+ "Camera",
+ "Active camera used in this view (when unlocked from the scene's active camera)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_SpaceView3D_camera_update");
+
+ /* render border */
+ prop = RNA_def_property(srna, "use_render_border", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_RENDER_BORDER);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Render Region",
+ "Use a region within the frame size for rendered viewport"
+ "(when not viewing through the camera)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "render_border_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "render_border.xmin");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Region Minimum X", "Minimum X value for the render region");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "render_border_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "render_border.ymin");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Region Minimum Y", "Minimum Y value for the render region");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "render_border_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "render_border.xmax");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Region Maximum X", "Maximum X value for the render region");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "render_border_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "render_border.ymax");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Region Maximum Y", "Maximum Y value for the render region");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "lock_object", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ob_centre");
+ RNA_def_property_ui_text(
+ prop, "Lock to Object", "3D View center is locked to this object's position");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "lock_bone", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "ob_centre_bone");
+ RNA_def_property_ui_text(
+ prop, "Lock to Bone", "3D View center is locked to this bone's position");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "lock_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ob_centre_cursor", 1);
+ RNA_def_property_ui_text(
+ prop, "Lock to Cursor", "3D View center is locked to the cursor's position");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "local_view", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "localvd");
+ RNA_def_property_ui_text(
+ prop,
+ "Local View",
+ "Display an isolated sub-set of objects, apart from the scene visibility");
+
+ prop = RNA_def_property(srna, "lens", PROP_FLOAT, PROP_UNIT_CAMERA);
+ RNA_def_property_float_sdna(prop, NULL, "lens");
+ RNA_def_property_ui_text(prop, "Lens", "Viewport lens angle");
+ RNA_def_property_range(prop, 1.0f, 250.0f);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "clip_start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_float_default(prop, 0.1f);
+ RNA_def_property_ui_text(
+ prop, "Clip Start", "3D View near clipping distance (perspective view only)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "clip_end", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_range(prop, 1e-6f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.001f, FLT_MAX, 10, 3);
+ RNA_def_property_float_default(prop, 1000.0f);
+ RNA_def_property_ui_text(prop, "Clip End", "3D View far clipping distance");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "lock_camera", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_LOCK_CAMERA);
+ RNA_def_property_ui_text(
+ prop, "Lock Camera to View", "Enable view navigation within the camera view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE);
+ RNA_def_property_ui_text(prop, "Show Gizmo", "Show gizmos of all types");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_navigate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE_NAVIGATE);
+ RNA_def_property_ui_text(prop, "Navigate Gizmo", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_context", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE_CONTEXT);
+ RNA_def_property_ui_text(prop, "Context Gizmo", "Context sensitive gizmos for the active item");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_tool", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "gizmo_flag", V3D_GIZMO_HIDE_TOOL);
+ RNA_def_property_ui_text(prop, "Tool Gizmo", "Active tool gizmo");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Per object type gizmo display flags. */
+
+ prop = RNA_def_property(srna, "show_gizmo_object_translate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_TRANSLATE);
+ RNA_def_property_ui_text(prop, "Show Object Location", "Gizmo to adjust location");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_object_rotate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_ROTATE);
+ RNA_def_property_ui_text(prop, "Show Object Rotation", "Gizmo to adjust rotation");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_object_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_object", V3D_GIZMO_SHOW_OBJECT_SCALE);
+ RNA_def_property_ui_text(prop, "Show Object Scale", "Gizmo to adjust scale");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Empty Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_empty_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_IMAGE);
+ RNA_def_property_ui_text(prop, "Show Empty Image", "Gizmo to adjust image size and position");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_empty_force_field", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_empty", V3D_GIZMO_SHOW_EMPTY_FORCE_FIELD);
+ RNA_def_property_ui_text(prop, "Show Empty Force Field", "Gizmo to adjust the force field");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Light Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_light_size", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_SIZE);
+ RNA_def_property_ui_text(prop, "Show Light Size", "Gizmo to adjust spot and area size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_light_look_at", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_light", V3D_GIZMO_SHOW_LIGHT_LOOK_AT);
+ RNA_def_property_ui_text(prop, "Show Light Look-At", "Gizmo to adjust spot and area size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Camera Object Data. */
+ prop = RNA_def_property(srna, "show_gizmo_camera_lens", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_LENS);
+ RNA_def_property_ui_text(prop, "Show Camera Lens", "Gizmo to adjust camera lens & ortho size");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_gizmo_camera_dof_distance", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_show_camera", V3D_GIZMO_SHOW_CAMERA_DOF_DIST);
+ RNA_def_property_ui_text(prop,
+ "Show Camera Focus Distance",
+ "Gizmo to adjust camera focus distance "
+ "(depends on limits display)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "use_local_camera", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "scenelock", 1);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceView3D_use_local_camera_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Use Local Camera",
+ "Use a local camera in this view, rather than scene's active camera camera");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "region_3d", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RegionView3D");
+ RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_region_3d_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "3D Region", "3D region in this space, in case of quad view the camera region");
+
+ prop = RNA_def_property(srna, "region_quadviews", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "RegionView3D");
+ RNA_def_property_collection_funcs(prop,
+ "rna_SpaceView3D_region_quadviews_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_SpaceView3D_region_quadviews_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop,
+ "Quad View Regions",
+ "3D regions (the third one defines quad view settings, "
+ "the fourth one is same as 'region_3d')");
+
+ prop = RNA_def_property(srna, "show_reconstruction", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_RECONSTRUCTION);
+ RNA_def_property_ui_text(
+ prop, "Show Reconstruction", "Display reconstruction data from active movie clip");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "tracks_display_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 5, 1, 3);
+ RNA_def_property_float_sdna(prop, NULL, "bundle_size");
+ RNA_def_property_ui_text(prop, "Tracks Size", "Display size of tracks from reconstructed data");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "tracks_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "bundle_drawtype");
+ RNA_def_property_enum_items(prop, bundle_drawtype_items);
+ RNA_def_property_ui_text(prop, "Tracks Display Type", "Viewport display style for tracks");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_camera_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_CAMERAPATH);
+ RNA_def_property_ui_text(prop, "Show Camera Path", "Show reconstructed camera path");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_bundle_names", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag2", V3D_SHOW_BUNDLENAME);
+ RNA_def_property_ui_text(
+ prop, "Show 3D Marker Names", "Show names for reconstructed tracks objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "fx_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "FX Options", "Options used for real time compositing");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* Stereo Settings */
+ prop = RNA_def_property(srna, "stereo_3d_eye", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "multiview_eye");
+ RNA_def_property_enum_items(prop, stereo3d_eye_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
+ RNA_def_property_ui_text(prop, "Stereo Eye", "Current stereo eye being drawn");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "stereo_3d_camera", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stereo3d_camera");
+ RNA_def_property_enum_items(prop, stereo3d_camera_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceView3D_stereo3d_camera_itemf");
+ RNA_def_property_ui_text(prop, "Camera", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_stereo_3d_cameras", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPCAMERAS);
+ RNA_def_property_ui_text(prop, "Cameras", "Show the left and right cameras");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_stereo_3d_convergence_plane", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPPLANE);
+ RNA_def_property_ui_text(prop, "Plane", "Show the stereo 3d convergence plane");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "stereo_3d_convergence_plane_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "stereo3d_convergence_alpha");
+ RNA_def_property_ui_text(prop, "Plane Alpha", "Opacity (alpha) of the convergence plane");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "show_stereo_3d_volume", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "stereo3d_flag", V3D_S3D_DISPVOLUME);
+ RNA_def_property_ui_text(prop, "Volume", "Show the stereo 3d frustum volume");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "stereo_3d_volume_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "stereo3d_volume_alpha");
+ RNA_def_property_ui_text(prop, "Volume Alpha", "Opacity (alpha) of the cameras' frustum volume");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ {
+ struct {
+ const char *name;
+ int type_mask;
+ const char *identifier[2];
+ } info[] = {
+ {"Mesh", (1 << OB_MESH), {"show_object_viewport_mesh", "show_object_select_mesh"}},
+ {"Curve", (1 << OB_CURVE), {"show_object_viewport_curve", "show_object_select_curve"}},
+ {"Surface", (1 << OB_SURF), {"show_object_viewport_surf", "show_object_select_surf"}},
+ {"Meta", (1 << OB_MBALL), {"show_object_viewport_meta", "show_object_select_meta"}},
+ {"Font", (1 << OB_FONT), {"show_object_viewport_font", "show_object_select_font"}},
+ {"Armature",
+ (1 << OB_ARMATURE),
+ {"show_object_viewport_armature", "show_object_select_armature"}},
+ {"Lattice",
+ (1 << OB_LATTICE),
+ {"show_object_viewport_lattice", "show_object_select_lattice"}},
+ {"Empty", (1 << OB_EMPTY), {"show_object_viewport_empty", "show_object_select_empty"}},
+ {"Grease Pencil",
+ (1 << OB_GPENCIL),
+ {"show_object_viewport_grease_pencil", "show_object_select_grease_pencil"}},
+ {"Camera", (1 << OB_CAMERA), {"show_object_viewport_camera", "show_object_select_camera"}},
+ {"Light", (1 << OB_LAMP), {"show_object_viewport_light", "show_object_select_light"}},
+ {"Speaker",
+ (1 << OB_SPEAKER),
+ {"show_object_viewport_speaker", "show_object_select_speaker"}},
+ {"Light Probe",
+ (1 << OB_LIGHTPROBE),
+ {"show_object_viewport_light_probe", "show_object_select_light_probe"}},
+ };
+
+ const char *view_mask_member[2] = {
+ "object_type_exclude_viewport",
+ "object_type_exclude_select",
+ };
+ for (int mask_index = 0; mask_index < 2; mask_index++) {
+ for (int type_index = 0; type_index < ARRAY_SIZE(info); type_index++) {
+ prop = RNA_def_property(
+ srna, info[type_index].identifier[mask_index], PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, view_mask_member[mask_index], info[type_index].type_mask);
+ RNA_def_property_ui_text(prop, info[type_index].name, "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+ }
+ }
+
+ /* Heper for drawing the icon. */
+ prop = RNA_def_property(srna, "icon_from_show_object_viewport", PROP_INT, PROP_NONE);
+ RNA_def_property_int_funcs(
+ prop, "rna_SpaceView3D_icon_from_show_object_viewport_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Visibility Icon", "");
+ }
+
+ /* Nested Structs */
+ prop = RNA_def_property(srna, "shading", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "View3DShading");
+ RNA_def_property_ui_text(prop, "Shading Settings", "Settings for shading in the 3D viewport");
+
+ prop = RNA_def_property(srna, "overlay", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "View3DOverlay");
+ RNA_def_property_pointer_funcs(prop, "rna_SpaceView3D_overlay_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Overlay Settings", "Settings for display of overlays in the 3D viewport");
+
+ rna_def_space_view3d_shading(brna);
+ rna_def_space_view3d_overlay(brna);
+
+ /* *** Animated *** */
+ RNA_define_animate_sdna(true);
+ /* region */
+
+ srna = RNA_def_struct(brna, "RegionView3D", NULL);
+ RNA_def_struct_sdna(srna, "RegionView3D");
+ RNA_def_struct_ui_text(srna, "3D View Region", "3D View region data");
+
+ prop = RNA_def_property(srna, "lock_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_LOCKED);
+ RNA_def_property_ui_text(prop, "Lock", "Lock view rotation in side views");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
+
+ prop = RNA_def_property(srna, "show_sync_view", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXVIEW);
+ RNA_def_property_ui_text(prop, "Box", "Sync view position between side views");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_update");
+
+ prop = RNA_def_property(srna, "use_box_clip", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "viewlock", RV3D_BOXCLIP);
+ RNA_def_property_ui_text(
+ prop, "Clip", "Clip objects based on what's visible in other side views");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_RegionView3D_quadview_clip_update");
+
+ prop = RNA_def_property(srna, "perspective_matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "persmat");
+ RNA_def_property_clear_flag(
+ prop, PROP_EDITABLE); /* XXX: for now, it's too risky for users to do this */
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(
+ prop, "Perspective Matrix", "Current perspective matrix (``window_matrix * view_matrix``)");
+
+ prop = RNA_def_property(srna, "window_matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "winmat");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Window Matrix", "Current window matrix");
+
+ prop = RNA_def_property(srna, "view_matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "viewmat");
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_float_funcs(prop, NULL, "rna_RegionView3D_view_matrix_set", NULL);
+ RNA_def_property_ui_text(prop, "View Matrix", "Current view matrix");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "view_perspective", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "persp");
+ RNA_def_property_enum_items(prop, rv3d_persp_items);
+ RNA_def_property_ui_text(prop, "Perspective", "View Perspective");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "is_perspective", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "is_persp", 1);
+ RNA_def_property_ui_text(prop, "Is Perspective", "");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+
+ /* This isn't directly accessible from the UI, only an operator. */
+ prop = RNA_def_property(srna, "use_clip_planes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rflag", RV3D_CLIPPING);
+ RNA_def_property_ui_text(prop, "Use Clip Planes", "");
+
+ prop = RNA_def_property(srna, "clip_planes", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "clip");
+ RNA_def_property_multi_array(prop, 2, (int[]){6, 4});
+ RNA_def_property_ui_text(prop, "Clip Planes", "");
+
+ prop = RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION);
+# if 0
+ RNA_def_property_float_sdna(prop, NULL, "ofs"); /* cant use because its negated */
+# else
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(
+ prop, "rna_RegionView3D_view_location_get", "rna_RegionView3D_view_location_set", NULL);
+# endif
+ RNA_def_property_ui_text(prop, "View Location", "View pivot location");
+ RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(
+ srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); /* cant use because its inverted */
+# if 0
+ RNA_def_property_float_sdna(prop, NULL, "viewquat");
+# else
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_float_funcs(
+ prop, "rna_RegionView3D_view_rotation_get", "rna_RegionView3D_view_rotation_set", NULL);
+# endif
+ RNA_def_property_ui_text(prop, "View Rotation", "Rotation in quaternions (keep normalized)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ /* not sure we need rna access to these but adding anyway */
+ prop = RNA_def_property(srna, "view_distance", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_ui_text(prop, "Distance", "Distance to the view location");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "view_camera_zoom", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_sdna(prop, NULL, "camzoom");
+ RNA_def_property_ui_text(prop, "Camera Zoom", "Zoom factor in camera view");
+ RNA_def_property_range(prop, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ prop = RNA_def_property(srna, "view_camera_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "camdx");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Camera Offset", "View shift in camera view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, NULL);
+
+ RNA_api_region_view3d(srna);
}
static void rna_def_space_buttons(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceProperties", "Space");
- RNA_def_struct_sdna(srna, "SpaceProperties");
- RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
-
- prop = RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mainb");
- RNA_def_property_enum_items(prop, buttons_context_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_SpaceProperties_context_set", "rna_SpaceProperties_context_itemf");
- RNA_def_property_ui_text(prop, "Context", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
-
- /* pinned data */
- prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "pinid");
- RNA_def_property_struct_type(prop, "ID");
- /* note: custom set function is ONLY to avoid rna setting a user for this. */
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceProperties_pin_id_set",
- "rna_SpaceProperties_pin_id_typef", NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
-
- prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
- RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceProperties", "Space");
+ RNA_def_struct_sdna(srna, "SpaceProperties");
+ RNA_def_struct_ui_text(srna, "Properties Space", "Properties space data");
+
+ prop = RNA_def_property(srna, "context", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mainb");
+ RNA_def_property_enum_items(prop, buttons_context_items);
+ RNA_def_property_enum_funcs(
+ prop, NULL, "rna_SpaceProperties_context_set", "rna_SpaceProperties_context_itemf");
+ RNA_def_property_ui_text(prop, "Context", "");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_context_update");
+
+ /* pinned data */
+ prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "pinid");
+ RNA_def_property_struct_type(prop, "ID");
+ /* note: custom set function is ONLY to avoid rna setting a user for this. */
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_SpaceProperties_pin_id_set", "rna_SpaceProperties_pin_id_typef", NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_SpaceProperties_pin_id_update");
+
+ prop = RNA_def_property(srna, "use_pin_id", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SB_PIN_CONTEXT);
+ RNA_def_property_ui_text(prop, "Pin ID", "Use the pinned context");
}
static void rna_def_space_image(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceImageEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceImage");
- RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
-
- /* image */
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_SpaceImageEditor_image_update"); /* is handled in image editor too */
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "scopes");
- RNA_def_property_struct_type(prop, "Scopes");
- RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_update");
-
- prop = RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
- RNA_def_property_ui_text(prop, "Image Pin", "Display current image regardless of object selection");
- RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
- RNA_def_property_struct_type(prop, "Histogram");
- RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
-
- prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
- RNA_def_property_array(prop, 2);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Zoom", "Zoom factor");
-
- /* image draw */
- prop = RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
- RNA_def_property_ui_text(prop, "Display Repeated", "Display the image repeated outside of the main view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SHOW_GPENCIL);
- RNA_def_property_ui_text(prop, "Show Annotation",
- "Show annotations for this view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "display_channels", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, display_channels_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_display_channels_itemf");
- RNA_def_property_ui_text(prop, "Display Channels", "Channels of the image to draw");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "show_stereo_3d", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_stereo_get", "rna_SpaceImageEditor_show_stereo_set");
- RNA_def_property_ui_text(prop, "Show Stereo", "Display the image in Stereo 3D");
- RNA_def_property_ui_icon(prop, ICON_CAMERA_STEREO, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_show_stereo_update");
-
- /* uv */
- prop = RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "SpaceUVEditor");
- RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings");
-
- /* mode (hidden in the UI, see 'ui_mode') */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_space_image_mode_all_items);
- RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
-
- prop = RNA_def_property(srna, "ui_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_space_image_mode_ui_items);
- RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
-
- /* transform */
- prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_cursor_location_get",
- "rna_SpaceImageEditor_cursor_location_set", NULL);
- RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "around");
- RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_pivot_itemf");
- RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
- /* update */
- prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
- RNA_def_property_ui_text(prop, "Update Automatically",
- "Update other affected window spaces automatically to reflect changes "
- "during interactive operations such as transform");
-
- /* state */
- prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_render_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Show Render", "Show render related properties");
-
- prop = RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_paint_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Show Paint", "Show paint related properties");
-
- prop = RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_uvedit_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
-
- prop = RNA_def_property(srna, "show_maskedit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_maskedit_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Show Mask Editor", "Show Mask editing related properties");
-
- rna_def_space_image_uv(brna);
-
- /* mask */
- rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mask_set");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceImageEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceImage");
+ RNA_def_struct_ui_text(srna, "Space Image Editor", "Image and UV editor space data");
+
+ /* image */
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceImageEditor_image_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Image", "Image displayed and edited in this space");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_update(
+ prop,
+ NC_GEOM | ND_DATA,
+ "rna_SpaceImageEditor_image_update"); /* is handled in image editor too */
+
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+ RNA_def_property_ui_text(
+ prop,
+ "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "scopes");
+ RNA_def_property_struct_type(prop, "Scopes");
+ RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize image statistics");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_scopes_update");
+
+ prop = RNA_def_property(srna, "use_image_pin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pin", 0);
+ RNA_def_property_ui_text(
+ prop, "Image Pin", "Display current image regardless of object selection");
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "sample_histogram", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "sample_line_hist");
+ RNA_def_property_struct_type(prop, "Histogram");
+ RNA_def_property_ui_text(prop, "Line sample", "Sampled colors along line");
+
+ prop = RNA_def_property(srna, "zoom", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_SpaceImageEditor_zoom_get", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Zoom", "Zoom factor");
+
+ /* image draw */
+ prop = RNA_def_property(srna, "show_repeat", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_DRAW_TILE);
+ RNA_def_property_ui_text(
+ prop, "Display Repeated", "Display the image repeated outside of the main view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SI_SHOW_GPENCIL);
+ RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "display_channels", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, display_channels_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_display_channels_itemf");
+ RNA_def_property_ui_text(prop, "Display Channels", "Channels of the image to draw");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "show_stereo_3d", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_SpaceImageEditor_show_stereo_get", "rna_SpaceImageEditor_show_stereo_set");
+ RNA_def_property_ui_text(prop, "Show Stereo", "Display the image in Stereo 3D");
+ RNA_def_property_ui_icon(prop, ICON_CAMERA_STEREO, 0);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_show_stereo_update");
+
+ /* uv */
+ prop = RNA_def_property(srna, "uv_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "SpaceUVEditor");
+ RNA_def_property_pointer_funcs(prop, "rna_SpaceImageEditor_uvedit_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "UV Editor", "UV editor settings");
+
+ /* mode (hidden in the UI, see 'ui_mode') */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_space_image_mode_all_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
+
+ prop = RNA_def_property(srna, "ui_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_space_image_mode_ui_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mode_update");
+
+ /* transform */
+ prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_funcs(prop,
+ "rna_SpaceImageEditor_cursor_location_get",
+ "rna_SpaceImageEditor_cursor_location_set",
+ NULL);
+ RNA_def_property_ui_text(prop, "2D Cursor Location", "2D cursor location for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "around");
+ RNA_def_property_enum_items(prop, rna_enum_transform_pivot_items_full);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_SpaceImageEditor_pivot_itemf");
+ RNA_def_property_ui_text(prop, "Pivot", "Rotation/Scaling Pivot");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this space");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
+ /* update */
+ prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "lock", 0);
+ RNA_def_property_ui_text(prop,
+ "Update Automatically",
+ "Update other affected window spaces automatically to reflect changes "
+ "during interactive operations such as transform");
+
+ /* state */
+ prop = RNA_def_property(srna, "show_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_render_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Show Render", "Show render related properties");
+
+ prop = RNA_def_property(srna, "show_paint", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_paint_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Show Paint", "Show paint related properties");
+
+ prop = RNA_def_property(srna, "show_uvedit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_uvedit_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Show UV Editor", "Show UV editing related properties");
+
+ prop = RNA_def_property(srna, "show_maskedit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SpaceImageEditor_show_maskedit_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Show Mask Editor", "Show Mask editing related properties");
+
+ rna_def_space_image_uv(brna);
+
+ /* mask */
+ rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_IMAGE, "rna_SpaceImageEditor_mask_set");
}
static void rna_def_space_sequencer(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem view_type_items[] = {
- {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
- {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Preview", ""},
- {SEQ_VIEW_SEQUENCE_PREVIEW, "SEQUENCER_PREVIEW", ICON_SEQ_SPLITVIEW, "Sequencer/Preview", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem display_mode_items[] = {
- {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
- {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
- {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
- {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem proxy_render_size_items[] = {
- {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
- {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
- {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
- {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
- {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
- {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
- {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem overlay_type_items[] = {
- {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
- {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
- {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem preview_channels_items[] = {
- {SEQ_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
- "Display image with RGB colors and alpha transparency"},
- {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem waveform_type_display_items[] = {
- {SEQ_NO_WAVEFORMS, "NO_WAVEFORMS", 0, "Waveforms Off",
- "No waveforms drawn for any sound strips"},
- {SEQ_ALL_WAVEFORMS, "ALL_WAVEFORMS", 0, "Waveforms On",
- "Waveforms drawn for all sound strips"},
- {0, "DEFAULT_WAVEFORMS", 0, "Use Strip Option",
- "Waveforms drawn according to strip setting"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceSeq");
- RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
-
- /* view type, fairly important */
- prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "view");
- RNA_def_property_enum_items(prop, view_type_items);
- RNA_def_property_ui_text(prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)");
- RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update");
-
- /* display type, fairly important */
- prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mainb");
- RNA_def_property_enum_items(prop, display_mode_items);
- RNA_def_property_ui_text(prop, "Display Mode", "View mode to use for displaying sequencer output");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- /* flags */
- prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
- "Show frame number beside the current frame indicator line");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
- RNA_def_property_ui_text(prop, "Display Frames", "Display frames rather than seconds");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
- RNA_def_property_ui_text(prop, "Sync Markers", "Transform markers as well as strips");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPARATED);
- RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_MARGINS);
- RNA_def_property_ui_text(prop, "Safe Areas", "Show TV title safe and action safe areas in preview");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_CENTER);
- RNA_def_property_ui_text(prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA);
- RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
- RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_MARKER_LINES);
- RNA_def_property_ui_text(prop, "Show Marker Lines",
- "Show a vertical line for every marker");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GPENCIL);
- RNA_def_property_ui_text(prop, "Show Annotation",
- "Show annotations for this view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "chanshown");
- RNA_def_property_ui_text(prop, "Display Channel",
- "The channel number shown in the image preview. 0 is the result of all strips combined");
- RNA_def_property_range(prop, -5, MAXSEQ);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "preview_channels", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, preview_channels_items);
- RNA_def_property_ui_text(prop, "Display Channels", "Channels of the preview to draw");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "waveform_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, waveform_type_display_items);
- RNA_def_property_ui_text(prop, "Waveform Displaying", "How Waveforms are drawn");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_overexposed", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "zebra");
- RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");
- RNA_def_property_range(prop, 0, 110);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "render_size");
- RNA_def_property_enum_items(prop, proxy_render_size_items);
- RNA_def_property_ui_text(prop, "Proxy Render Size",
- "Display preview using full resolution or different proxy resolutions");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil data for this Preview region");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "overlay_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "overlay_type");
- RNA_def_property_enum_items(prop, overlay_type_items);
- RNA_def_property_ui_text(prop, "Overlay Type", "Overlay draw type");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_BACKDROP);
- RNA_def_property_ui_text(prop, "Use Backdrop", "Display result under strips");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
-
- prop = RNA_def_property(srna, "show_strip_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_OFFSET_EXT);
- RNA_def_property_ui_text(prop, "Show Offsets", "Display strip in/out offsets");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem view_type_items[] = {
+ {SEQ_VIEW_SEQUENCE, "SEQUENCER", ICON_SEQ_SEQUENCER, "Sequencer", ""},
+ {SEQ_VIEW_PREVIEW, "PREVIEW", ICON_SEQ_PREVIEW, "Preview", ""},
+ {SEQ_VIEW_SEQUENCE_PREVIEW,
+ "SEQUENCER_PREVIEW",
+ ICON_SEQ_SPLITVIEW,
+ "Sequencer/Preview",
+ ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem display_mode_items[] = {
+ {SEQ_DRAW_IMG_IMBUF, "IMAGE", ICON_SEQ_PREVIEW, "Image Preview", ""},
+ {SEQ_DRAW_IMG_WAVEFORM, "WAVEFORM", ICON_SEQ_LUMA_WAVEFORM, "Luma Waveform", ""},
+ {SEQ_DRAW_IMG_VECTORSCOPE, "VECTOR_SCOPE", ICON_SEQ_CHROMA_SCOPE, "Chroma Vectorscope", ""},
+ {SEQ_DRAW_IMG_HISTOGRAM, "HISTOGRAM", ICON_SEQ_HISTOGRAM, "Histogram", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem proxy_render_size_items[] = {
+ {SEQ_PROXY_RENDER_SIZE_NONE, "NONE", 0, "No display", ""},
+ {SEQ_PROXY_RENDER_SIZE_SCENE, "SCENE", 0, "Scene render size", ""},
+ {SEQ_PROXY_RENDER_SIZE_25, "PROXY_25", 0, "Proxy size 25%", ""},
+ {SEQ_PROXY_RENDER_SIZE_50, "PROXY_50", 0, "Proxy size 50%", ""},
+ {SEQ_PROXY_RENDER_SIZE_75, "PROXY_75", 0, "Proxy size 75%", ""},
+ {SEQ_PROXY_RENDER_SIZE_100, "PROXY_100", 0, "Proxy size 100%", ""},
+ {SEQ_PROXY_RENDER_SIZE_FULL, "FULL", 0, "No proxy, full render", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem overlay_type_items[] = {
+ {SEQ_DRAW_OVERLAY_RECT, "RECTANGLE", 0, "Rectangle", "Show rectangle area overlay"},
+ {SEQ_DRAW_OVERLAY_REFERENCE, "REFERENCE", 0, "Reference", "Show reference frame only"},
+ {SEQ_DRAW_OVERLAY_CURRENT, "CURRENT", 0, "Current", "Show current frame only"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem preview_channels_items[] = {
+ {SEQ_USE_ALPHA,
+ "COLOR_ALPHA",
+ ICON_IMAGE_RGB_ALPHA,
+ "Color and Alpha",
+ "Display image with RGB colors and alpha transparency"},
+ {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem waveform_type_display_items[] = {
+ {SEQ_NO_WAVEFORMS,
+ "NO_WAVEFORMS",
+ 0,
+ "Waveforms Off",
+ "No waveforms drawn for any sound strips"},
+ {SEQ_ALL_WAVEFORMS,
+ "ALL_WAVEFORMS",
+ 0,
+ "Waveforms On",
+ "Waveforms drawn for all sound strips"},
+ {0,
+ "DEFAULT_WAVEFORMS",
+ 0,
+ "Use Strip Option",
+ "Waveforms drawn according to strip setting"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceSequenceEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceSeq");
+ RNA_def_struct_ui_text(srna, "Space Sequence Editor", "Sequence editor space data");
+
+ /* view type, fairly important */
+ prop = RNA_def_property(srna, "view_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "view");
+ RNA_def_property_enum_items(prop, view_type_items);
+ RNA_def_property_ui_text(
+ prop, "View Type", "Type of the Sequencer view (sequencer, preview or both)");
+ RNA_def_property_update(prop, 0, "rna_Sequencer_view_type_update");
+
+ /* display type, fairly important */
+ prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mainb");
+ RNA_def_property_enum_items(prop, display_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Display Mode", "View mode to use for displaying sequencer output");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ /* flags */
+ prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_NO_DRAW_CFRANUM);
+ RNA_def_property_ui_text(prop,
+ "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
+ RNA_def_property_ui_text(prop, "Display Frames", "Display frames rather than seconds");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_MARKER_TRANS);
+ RNA_def_property_ui_text(prop, "Sync Markers", "Transform markers as well as strips");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_separate_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_DRAW_COLOR_SEPARATED);
+ RNA_def_property_ui_text(prop, "Separate Colors", "Separate color channels in preview");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_safe_areas", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_MARGINS);
+ RNA_def_property_ui_text(
+ prop, "Safe Areas", "Show TV title safe and action safe areas in preview");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_safe_center", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_SAFE_CENTER);
+ RNA_def_property_ui_text(
+ prop, "Center-Cut Safe Areas", "Show safe areas to fit content in a different aspect ratio");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_METADATA);
+ RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of first visible strip");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SEQ_DRAWFRAMES);
+ RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines", "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SEQ_SHOW_GPENCIL);
+ RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "display_channel", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "chanshown");
+ RNA_def_property_ui_text(
+ prop,
+ "Display Channel",
+ "The channel number shown in the image preview. 0 is the result of all strips combined");
+ RNA_def_property_range(prop, -5, MAXSEQ);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "preview_channels", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, preview_channels_items);
+ RNA_def_property_ui_text(prop, "Display Channels", "Channels of the preview to draw");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "waveform_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, waveform_type_display_items);
+ RNA_def_property_ui_text(prop, "Waveform Displaying", "How Waveforms are drawn");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_overexposed", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "zebra");
+ RNA_def_property_ui_text(prop, "Show Overexposed", "Show overexposed areas with zebra stripes");
+ RNA_def_property_range(prop, 0, 110);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "proxy_render_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "render_size");
+ RNA_def_property_enum_items(prop, proxy_render_size_items);
+ RNA_def_property_ui_text(prop,
+ "Proxy Render Size",
+ "Display preview using full resolution or different proxy resolutions");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil data for this Preview region");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "overlay_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "overlay_type");
+ RNA_def_property_enum_items(prop, overlay_type_items);
+ RNA_def_property_ui_text(prop, "Overlay Type", "Overlay draw type");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_BACKDROP);
+ RNA_def_property_ui_text(prop, "Use Backdrop", "Display result under strips");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
+
+ prop = RNA_def_property(srna, "show_strip_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "draw_flag", SEQ_DRAW_OFFSET_EXT);
+ RNA_def_property_ui_text(prop, "Show Offsets", "Display strip in/out offsets");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_SEQUENCER, NULL);
}
static void rna_def_space_text(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceTextEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceText");
- RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data");
-
- /* text */
- prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL, NULL);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- /* display */
- prop = RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
- RNA_def_property_ui_text(prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
- RNA_def_property_ui_icon(prop, ICON_WORDWRAP_ON, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
- RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
- RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_ON, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
- RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
- RNA_def_property_ui_icon(prop, ICON_SYNTAX_ON, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
- RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "tabnumber");
- RNA_def_property_range(prop, 2, 8);
- RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, "rna_SpaceTextEditor_updateEdited");
-
- prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "lheight");
- RNA_def_property_range(prop, 8, 32);
- RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN);
- RNA_def_property_ui_text(prop, "Show Margin", "Show right margin");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "margin_column");
- RNA_def_property_range(prop, 0, 1024);
- RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "top", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "top");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Top Line", "Top line visible");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "visible_lines", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_sdna(prop, NULL, "viewlines");
- RNA_def_property_ui_text(prop, "Visible Lines", "Amount of lines that can be visible in current editor");
-
- /* functionality options */
- prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
- RNA_def_property_ui_text(prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "live_edit", 1);
- RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- /* find */
- prop = RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
- RNA_def_property_ui_text(prop, "Find All", "Search in all text data-blocks, instead of only the active one");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "use_find_wrap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
- RNA_def_property_ui_text(prop, "Find Wrap", "Search again from the start of the file when reaching the end");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "use_match_case", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_MATCH_CASE);
- RNA_def_property_ui_text(prop, "Match case", "Search string is sensitive to uppercase and lowercase letters");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "findstr");
- RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- prop = RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "replacestr");
- RNA_def_property_ui_text(prop, "Replace Text", "Text to replace selected text with using the replace tool");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
-
- RNA_api_space_text(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceTextEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceText");
+ RNA_def_struct_ui_text(srna, "Space Text Editor", "Text editor space data");
+
+ /* text */
+ prop = RNA_def_property(srna, "text", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Text", "Text displayed and edited in this space");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceTextEditor_text_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ /* display */
+ prop = RNA_def_property(srna, "show_word_wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "wordwrap", 0);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_SpaceTextEditor_word_wrap_set");
+ RNA_def_property_ui_text(
+ prop, "Word Wrap", "Wrap words if there is not enough horizontal space");
+ RNA_def_property_ui_icon(prop, ICON_WORDWRAP_ON, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "show_line_numbers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "showlinenrs", 0);
+ RNA_def_property_ui_text(prop, "Line Numbers", "Show line numbers next to the text");
+ RNA_def_property_ui_icon(prop, ICON_LINENUMBERS_ON, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "show_syntax_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "showsyntax", 0);
+ RNA_def_property_ui_text(prop, "Syntax Highlight", "Syntax highlight for scripting");
+ RNA_def_property_ui_icon(prop, ICON_SYNTAX_ON, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "show_line_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "line_hlight", 0);
+ RNA_def_property_ui_text(prop, "Highlight Line", "Highlight the current line");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "tab_width", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "tabnumber");
+ RNA_def_property_range(prop, 2, 8);
+ RNA_def_property_ui_text(prop, "Tab Width", "Number of spaces to display tabs with");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, "rna_SpaceTextEditor_updateEdited");
+
+ prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "lheight");
+ RNA_def_property_range(prop, 8, 32);
+ RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "show_margin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_SHOW_MARGIN);
+ RNA_def_property_ui_text(prop, "Show Margin", "Show right margin");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "margin_column", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "margin_column");
+ RNA_def_property_range(prop, 0, 1024);
+ RNA_def_property_ui_text(prop, "Margin Column", "Column number to show right margin at");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "top", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "top");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Top Line", "Top line visible");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "visible_lines", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_sdna(prop, NULL, "viewlines");
+ RNA_def_property_ui_text(
+ prop, "Visible Lines", "Amount of lines that can be visible in current editor");
+
+ /* functionality options */
+ prop = RNA_def_property(srna, "use_overwrite", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "overwrite", 1);
+ RNA_def_property_ui_text(
+ prop, "Overwrite", "Overwrite characters when typing rather than inserting them");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "use_live_edit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "live_edit", 1);
+ RNA_def_property_ui_text(prop, "Live Edit", "Run python while editing");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ /* find */
+ prop = RNA_def_property(srna, "use_find_all", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_ALL);
+ RNA_def_property_ui_text(
+ prop, "Find All", "Search in all text data-blocks, instead of only the active one");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "use_find_wrap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_FIND_WRAP);
+ RNA_def_property_ui_text(
+ prop, "Find Wrap", "Search again from the start of the file when reaching the end");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "use_match_case", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", ST_MATCH_CASE);
+ RNA_def_property_ui_text(
+ prop, "Match case", "Search string is sensitive to uppercase and lowercase letters");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "find_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "findstr");
+ RNA_def_property_ui_text(prop, "Find Text", "Text to search for with the find tool");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ prop = RNA_def_property(srna, "replace_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "replacestr");
+ RNA_def_property_ui_text(
+ prop, "Replace Text", "Text to replace selected text with using the replace tool");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TEXT, NULL);
+
+ RNA_api_space_text(srna);
}
static void rna_def_space_dopesheet(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceAction");
- RNA_def_struct_ui_text(srna, "Space Dope Sheet Editor", "Dope Sheet space data");
-
- /* data */
- prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL,
- "rna_Action_actedit_assign_poll");
- RNA_def_property_ui_text(prop, "Action", "Action displayed and edited in this space");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
-
- /* mode (hidden in the UI, see 'ui_mode') */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_space_action_mode_all_items);
- RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
-
- prop = RNA_def_property(srna, "ui_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_space_action_ui_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
-
- /* display */
- prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_DRAWTIME);
- RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
- "Show frame number beside the current frame indicator line");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SLIDERS);
- RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW);
- RNA_def_property_ui_text(prop, "Show Pose Markers",
- "Show markers belonging to the active action instead of Scene markers "
- "(Action and Shape Key Editors only)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWGCOLORS);
- RNA_def_property_ui_text(prop, "Show Group Colors",
- "Display groups and channels with colors matching their corresponding groups "
- "(pose bones only currently)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_interpolation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_INTERPOLATION);
- RNA_def_property_ui_text(prop, "Show Handles And Interpolation",
- "Display keyframe handle types and non-bezier interpolation modes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_extremes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_EXTREMES);
- RNA_def_property_ui_text(prop, "Show Curve Extremes",
- "Mark keyframes where the key value flow changes direction, based on comparison with adjacent keys");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_MARKER_LINES);
- RNA_def_property_ui_text(prop, "Show Marker Lines",
- "Show a vertical line for every marker");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* editing */
- prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
- RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES);
- RNA_def_property_ui_text(prop, "Realtime Updates",
- "When transforming keyframes, changes to the animation data are flushed to other views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_MARKERS_MOVE);
- RNA_def_property_ui_text(prop, "Sync Markers", "Sync Markers with keyframe edits");
-
- /* dopesheet */
- prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "DopeSheet");
- RNA_def_property_pointer_sdna(prop, NULL, "ads");
- RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
-
- /* autosnap */
- prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "autosnap");
- RNA_def_property_enum_items(prop, autosnap_items);
- RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
-
- /* displaying cache status */
- prop = RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DISPLAY);
- RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
-
- prop = RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SOFTBODY);
- RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
-
- prop = RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
- RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
-
- prop = RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
- RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
-
- prop = RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
- RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
-
- prop = RNA_def_property(srna, "cache_dynamicpaint", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DYNAMICPAINT);
- RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
-
- prop = RNA_def_property(srna, "cache_rigidbody", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_RIGIDBODY);
- RNA_def_property_ui_text(prop, "Rigid Body", "Show the active object's Rigid Body cache");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceDopeSheetEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceAction");
+ RNA_def_struct_ui_text(srna, "Space Dope Sheet Editor", "Dope Sheet space data");
+
+ /* data */
+ prop = RNA_def_property(srna, "action", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_SpaceDopeSheetEditor_action_set", NULL, "rna_Action_actedit_assign_poll");
+ RNA_def_property_ui_text(prop, "Action", "Action displayed and edited in this space");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, "rna_SpaceDopeSheetEditor_action_update");
+
+ /* mode (hidden in the UI, see 'ui_mode') */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_space_action_mode_all_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
+
+ prop = RNA_def_property(srna, "ui_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_space_action_ui_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_SpaceDopeSheetEditor_mode_update");
+
+ /* display */
+ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_DRAWTIME);
+ RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWCFRANUM);
+ RNA_def_property_ui_text(prop,
+ "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SLIDERS);
+ RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_pose_markers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_POSEMARKERS_SHOW);
+ RNA_def_property_ui_text(prop,
+ "Show Pose Markers",
+ "Show markers belonging to the active action instead of Scene markers "
+ "(Action and Shape Key Editors only)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NODRAWGCOLORS);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Group Colors",
+ "Display groups and channels with colors matching their corresponding groups "
+ "(pose bones only currently)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_interpolation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_INTERPOLATION);
+ RNA_def_property_ui_text(prop,
+ "Show Handles And Interpolation",
+ "Display keyframe handle types and non-bezier interpolation modes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_extremes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_EXTREMES);
+ RNA_def_property_ui_text(prop,
+ "Show Curve Extremes",
+ "Mark keyframes where the key value flow changes direction, based on "
+ "comparison with adjacent keys");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_SHOW_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines", "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* editing */
+ prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOTRANSKEYCULL);
+ RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SACTION_NOREALTIMEUPDATES);
+ RNA_def_property_ui_text(
+ prop,
+ "Realtime Updates",
+ "When transforming keyframes, changes to the animation data are flushed to other views");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ prop = RNA_def_property(srna, "use_marker_sync", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SACTION_MARKERS_MOVE);
+ RNA_def_property_ui_text(prop, "Sync Markers", "Sync Markers with keyframe edits");
+
+ /* dopesheet */
+ prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "DopeSheet");
+ RNA_def_property_pointer_sdna(prop, NULL, "ads");
+ RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
+
+ /* autosnap */
+ prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "autosnap");
+ RNA_def_property_enum_items(prop, autosnap_items);
+ RNA_def_property_ui_text(
+ prop, "Auto Snap", "Automatic time snapping settings for transformations");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, NULL);
+
+ /* displaying cache status */
+ prop = RNA_def_property(srna, "show_cache", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DISPLAY);
+ RNA_def_property_ui_text(prop, "Show Cache", "Show the status of cached frames in the timeline");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_softbody", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SOFTBODY);
+ RNA_def_property_ui_text(prop, "Softbody", "Show the active object's softbody point cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_particles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_PARTICLES);
+ RNA_def_property_ui_text(prop, "Particles", "Show the active object's particle point cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_cloth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_CLOTH);
+ RNA_def_property_ui_text(prop, "Cloth", "Show the active object's cloth point cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_smoke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_SMOKE);
+ RNA_def_property_ui_text(prop, "Smoke", "Show the active object's smoke cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_dynamicpaint", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_DYNAMICPAINT);
+ RNA_def_property_ui_text(prop, "Dynamic Paint", "Show the active object's Dynamic Paint cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
+
+ prop = RNA_def_property(srna, "cache_rigidbody", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "cache_display", TIME_CACHE_RIGIDBODY);
+ RNA_def_property_ui_text(prop, "Rigid Body", "Show the active object's Rigid Body cache");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_TIME, NULL);
}
static void rna_def_space_graph(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* this is basically the same as the one for the 3D-View, but with some entries omitted */
- static const EnumPropertyItem gpivot_items[] = {
- {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center", ""},
- {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
- {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL, "Individual Centers", ""},
- /*{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", 0, "Median Point", ""}, */
- /*{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
- {0, NULL, 0, NULL, NULL},
- };
-
-
- srna = RNA_def_struct(brna, "SpaceGraphEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceGraph");
- RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data");
-
- /* mode */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_space_graph_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
-
- /* display */
- prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_DRAWTIME);
- RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
- "Show frame number beside the current frame indicator line");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SLIDERS);
- RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOHANDLES);
- RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
- RNA_def_property_ui_text(prop, "Only Selected Curve Keyframes",
- "Only keyframes of selected F-Curves are visible and editable");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
- RNA_def_property_ui_text(prop, "Only Selected Keyframes Handles",
- "Only show and edit handles of selected keyframes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
- RNA_def_property_ui_text(prop, "Use High Quality Display",
- "Display F-Curves using Anti-Aliasing and other fancy effects "
- "(disable for better performance)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWGCOLORS);
- RNA_def_property_ui_text(prop, "Show Group Colors",
- "Display groups and channels with colors matching their corresponding groups");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_MARKER_LINES);
- RNA_def_property_ui_text(prop, "Show Marker Lines",
- "Show a vertical line for every marker");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* editing */
- prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
- RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES);
- RNA_def_property_ui_text(prop, "Realtime Updates",
- "When transforming keyframes, changes to the animation data are flushed to other views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* cursor */
- prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCURSOR);
- RNA_def_property_ui_text(prop, "Show Cursor", "Show 2D cursor");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "cursor_position_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cursorTime");
- RNA_def_property_ui_text(prop, "Cursor X-Value", "Graph Editor 2D-Value cursor - X-Value component");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "cursor_position_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cursorVal");
- RNA_def_property_ui_text(prop, "Cursor Y-Value", "Graph Editor 2D-Value cursor - Y-Value component");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "around");
- RNA_def_property_enum_items(prop, gpivot_items);
- RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* dopesheet */
- prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "DopeSheet");
- RNA_def_property_pointer_sdna(prop, NULL, "ads");
- RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
-
- /* autosnap */
- prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "autosnap");
- RNA_def_property_enum_items(prop, autosnap_items);
- RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* readonly state info */
- prop = RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
-
- /* nromalize curves */
- prop = RNA_def_property(srna, "use_normalization", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_NORMALIZE);
- RNA_def_property_ui_text(prop, "Use Normalization", "Display curves in normalized to -1..1 range, "
- "for easier editing of multiple curves with different ranges");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- prop = RNA_def_property(srna, "use_auto_normalization", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NORMALIZE_FREEZE);
- RNA_def_property_ui_text(prop, "Auto Normalization",
- "Automatically recalculate curve normalization on every curve edit");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* this is basically the same as the one for the 3D-View, but with some entries omitted */
+ static const EnumPropertyItem gpivot_items[] = {
+ {V3D_AROUND_CENTER_BOUNDS,
+ "BOUNDING_BOX_CENTER",
+ ICON_PIVOT_BOUNDBOX,
+ "Bounding Box Center",
+ ""},
+ {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", ""},
+ {V3D_AROUND_LOCAL_ORIGINS,
+ "INDIVIDUAL_ORIGINS",
+ ICON_PIVOT_INDIVIDUAL,
+ "Individual Centers",
+ ""},
+ /*{V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", 0, "Median Point", ""}, */
+ /*{V3D_AROUND_ACTIVE, "ACTIVE_ELEMENT", 0, "Active Element", ""}, */
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceGraphEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceGraph");
+ RNA_def_struct_ui_text(srna, "Space Graph Editor", "Graph Editor space data");
+
+ /* mode */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_space_graph_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_GRAPH, "rna_SpaceGraphEditor_display_mode_update");
+
+ /* display */
+ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_DRAWTIME);
+ RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCFRANUM);
+ RNA_def_property_ui_text(prop,
+ "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "show_sliders", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SLIDERS);
+ RNA_def_property_ui_text(prop, "Show Sliders", "Show sliders beside F-Curve channels");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "show_handles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOHANDLES);
+ RNA_def_property_ui_text(prop, "Show Handles", "Show handles of Bezier control points");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "use_only_selected_curves_handles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELCUVERTSONLY);
+ RNA_def_property_ui_text(prop,
+ "Only Selected Curve Keyframes",
+ "Only keyframes of selected F-Curves are visible and editable");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "use_only_selected_keyframe_handles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_SELVHANDLESONLY);
+ RNA_def_property_ui_text(
+ prop, "Only Selected Keyframes Handles", "Only show and edit handles of selected keyframes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "use_beauty_drawing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_BEAUTYDRAW_OFF);
+ RNA_def_property_ui_text(prop,
+ "Use High Quality Display",
+ "Display F-Curves using Anti-Aliasing and other fancy effects "
+ "(disable for better performance)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "show_group_colors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWGCOLORS);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Group Colors",
+ "Display groups and channels with colors matching their corresponding groups");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines", "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* editing */
+ prop = RNA_def_property(srna, "use_auto_merge_keyframes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOTRANSKEYCULL);
+ RNA_def_property_ui_text(prop, "AutoMerge Keyframes", "Automatically merge nearby keyframes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NOREALTIMEUPDATES);
+ RNA_def_property_ui_text(
+ prop,
+ "Realtime Updates",
+ "When transforming keyframes, changes to the animation data are flushed to other views");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* cursor */
+ prop = RNA_def_property(srna, "show_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NODRAWCURSOR);
+ RNA_def_property_ui_text(prop, "Show Cursor", "Show 2D cursor");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "cursor_position_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cursorTime");
+ RNA_def_property_ui_text(
+ prop, "Cursor X-Value", "Graph Editor 2D-Value cursor - X-Value component");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "cursor_position_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cursorVal");
+ RNA_def_property_ui_text(
+ prop, "Cursor Y-Value", "Graph Editor 2D-Value cursor - Y-Value component");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "around");
+ RNA_def_property_enum_items(prop, gpivot_items);
+ RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* dopesheet */
+ prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "DopeSheet");
+ RNA_def_property_pointer_sdna(prop, NULL, "ads");
+ RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
+
+ /* autosnap */
+ prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "autosnap");
+ RNA_def_property_enum_items(prop, autosnap_items);
+ RNA_def_property_ui_text(
+ prop, "Auto Snap", "Automatic time snapping settings for transformations");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* readonly state info */
+ prop = RNA_def_property(srna, "has_ghost_curves", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_SpaceGraphEditor_has_ghost_curves_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Has Ghost Curves", "Graph Editor instance has some ghost curves stored");
+
+ /* nromalize curves */
+ prop = RNA_def_property(srna, "use_normalization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SIPO_NORMALIZE);
+ RNA_def_property_ui_text(prop,
+ "Use Normalization",
+ "Display curves in normalized to -1..1 range, "
+ "for easier editing of multiple curves with different ranges");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ prop = RNA_def_property(srna, "use_auto_normalization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SIPO_NORMALIZE_FREEZE);
+ RNA_def_property_ui_text(prop,
+ "Auto Normalization",
+ "Automatically recalculate curve normalization on every curve edit");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
}
static void rna_def_space_nla(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceNLA", "Space");
- RNA_def_struct_sdna(srna, "SpaceNla");
- RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data");
-
- /* display */
- prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME);
- RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
-
- prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM);
- RNA_def_property_ui_text(prop, "Show Frame Number Indicator",
- "Show frame number beside the current frame indicator line");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
-
- prop = RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES);
- RNA_def_property_ui_text(prop, "Show Control F-Curves", "Show influence F-Curves on strips");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
-
- prop = RNA_def_property(srna, "show_local_markers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOLOCALMARKERS);
- RNA_def_property_ui_text(prop, "Show Local Markers",
- "Show action-local markers on the strips, useful when synchronizing timing across strips");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
-
- prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_SHOW_MARKER_LINES);
- RNA_def_property_ui_text(prop, "Show Marker Lines",
- "Show a vertical line for every marker");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* editing */
- prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES);
- RNA_def_property_ui_text(prop, "Realtime Updates",
- "When transforming strips, changes to the animation data are flushed to other views");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
-
- /* dopesheet */
- prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "DopeSheet");
- RNA_def_property_pointer_sdna(prop, NULL, "ads");
- RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
-
- /* autosnap */
- prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "autosnap");
- RNA_def_property_enum_items(prop, autosnap_items);
- RNA_def_property_ui_text(prop, "Auto Snap", "Automatic time snapping settings for transformations");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceNLA", "Space");
+ RNA_def_struct_sdna(srna, "SpaceNla");
+ RNA_def_struct_ui_text(srna, "Space Nla Editor", "NLA editor space data");
+
+ /* display */
+ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_DRAWTIME);
+ RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+
+ prop = RNA_def_property(srna, "show_frame_indicator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NODRAWCFRANUM);
+ RNA_def_property_ui_text(prop,
+ "Show Frame Number Indicator",
+ "Show frame number beside the current frame indicator line");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+
+ prop = RNA_def_property(srna, "show_strip_curves", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOSTRIPCURVES);
+ RNA_def_property_ui_text(prop, "Show Control F-Curves", "Show influence F-Curves on strips");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+
+ prop = RNA_def_property(srna, "show_local_markers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOLOCALMARKERS);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Local Markers",
+ "Show action-local markers on the strips, useful when synchronizing timing across strips");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+
+ prop = RNA_def_property(srna, "show_marker_lines", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNLA_SHOW_MARKER_LINES);
+ RNA_def_property_ui_text(prop, "Show Marker Lines", "Show a vertical line for every marker");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* editing */
+ prop = RNA_def_property(srna, "use_realtime_update", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNLA_NOREALTIMEUPDATES);
+ RNA_def_property_ui_text(
+ prop,
+ "Realtime Updates",
+ "When transforming strips, changes to the animation data are flushed to other views");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
+
+ /* dopesheet */
+ prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "DopeSheet");
+ RNA_def_property_pointer_sdna(prop, NULL, "ads");
+ RNA_def_property_ui_text(prop, "Dope Sheet", "Settings for filtering animation data");
+
+ /* autosnap */
+ prop = RNA_def_property(srna, "auto_snap", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "autosnap");
+ RNA_def_property_enum_items(prop, autosnap_items);
+ RNA_def_property_ui_text(
+ prop, "Auto Snap", "Automatic time snapping settings for transformations");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NLA, NULL);
}
-
static void rna_def_console_line(BlenderRNA *brna)
{
- static const EnumPropertyItem console_line_type_items[] = {
- {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""},
- {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
- {CONSOLE_LINE_INFO, "INFO", 0, "Info", ""},
- {CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem console_line_type_items[] = {
+ {CONSOLE_LINE_OUTPUT, "OUTPUT", 0, "Output", ""},
+ {CONSOLE_LINE_INPUT, "INPUT", 0, "Input", ""},
+ {CONSOLE_LINE_INFO, "INFO", 0, "Info", ""},
+ {CONSOLE_LINE_ERROR, "ERROR", 0, "Error", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ConsoleLine", NULL);
- RNA_def_struct_ui_text(srna, "Console Input", "Input line for the interactive console");
+ srna = RNA_def_struct(brna, "ConsoleLine", NULL);
+ RNA_def_struct_ui_text(srna, "Console Input", "Input line for the interactive console");
- prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length",
- "rna_ConsoleLine_body_set");
- RNA_def_property_ui_text(prop, "Line", "Text in the line");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT);
+ prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_ConsoleLine_body_get", "rna_ConsoleLine_body_length", "rna_ConsoleLine_body_set");
+ RNA_def_property_ui_text(prop, "Line", "Text in the line");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT);
- prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */
- RNA_def_property_int_sdna(prop, NULL, "cursor");
- RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
+ prop = RNA_def_property(
+ srna, "current_character", PROP_INT, PROP_NONE); /* copied from text editor */
+ RNA_def_property_int_sdna(prop, NULL, "cursor");
+ RNA_def_property_int_funcs(prop, NULL, NULL, "rna_ConsoleLine_cursor_index_range");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, console_line_type_items);
- RNA_def_property_ui_text(prop, "Type", "Console line type when used in scrollback");
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, console_line_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Console line type when used in scrollback");
}
static void rna_def_space_console(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceConsole", "Space");
- RNA_def_struct_sdna(srna, "SpaceConsole");
- RNA_def_struct_ui_text(srna, "Space Console", "Interactive python console");
+ StructRNA *srna;
+ PropertyRNA *prop;
- /* display */
- prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */
- RNA_def_property_int_sdna(prop, NULL, "lheight");
- RNA_def_property_range(prop, 8, 32);
- RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
- RNA_def_property_update(prop, 0, "rna_SpaceConsole_rect_update");
+ srna = RNA_def_struct(brna, "SpaceConsole", "Space");
+ RNA_def_struct_sdna(srna, "SpaceConsole");
+ RNA_def_struct_ui_text(srna, "Space Console", "Interactive python console");
+ /* display */
+ prop = RNA_def_property(srna, "font_size", PROP_INT, PROP_NONE); /* copied from text editor */
+ RNA_def_property_int_sdna(prop, NULL, "lheight");
+ RNA_def_property_range(prop, 8, 32);
+ RNA_def_property_ui_text(prop, "Font Size", "Font size to use for displaying the text");
+ RNA_def_property_update(prop, 0, "rna_SpaceConsole_rect_update");
- prop = RNA_def_property(srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
- RNA_def_property_int_sdna(prop, NULL, "sel_start");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
+ prop = RNA_def_property(
+ srna, "select_start", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
+ RNA_def_property_int_sdna(prop, NULL, "sel_start");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
- prop = RNA_def_property(srna, "select_end", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
- RNA_def_property_int_sdna(prop, NULL, "sel_end");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
+ prop = RNA_def_property(
+ srna, "select_end", PROP_INT, PROP_UNSIGNED); /* copied from text editor */
+ RNA_def_property_int_sdna(prop, NULL, "sel_end");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CONSOLE, NULL);
- prop = RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
+ prop = RNA_def_property(srna, "prompt", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Prompt", "Command line prompt");
- prop = RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Language", "Command line prompt language");
+ prop = RNA_def_property(srna, "language", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Language", "Command line prompt language");
- prop = RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "history", NULL);
- RNA_def_property_struct_type(prop, "ConsoleLine");
- RNA_def_property_ui_text(prop, "History", "Command history");
+ prop = RNA_def_property(srna, "history", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "history", NULL);
+ RNA_def_property_struct_type(prop, "ConsoleLine");
+ RNA_def_property_ui_text(prop, "History", "Command history");
- prop = RNA_def_property(srna, "scrollback", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "scrollback", NULL);
- RNA_def_property_struct_type(prop, "ConsoleLine");
- RNA_def_property_ui_text(prop, "Output", "Command output");
+ prop = RNA_def_property(srna, "scrollback", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "scrollback", NULL);
+ RNA_def_property_struct_type(prop, "ConsoleLine");
+ RNA_def_property_ui_text(prop, "Output", "Command output");
}
static void rna_def_fileselect_params(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem file_display_items[] = {
- {FILE_SHORTDISPLAY, "LIST_SHORT", ICON_SHORTDISPLAY, "Short List", "Display files as short list"},
- {FILE_LONGDISPLAY, "LIST_LONG", ICON_LONGDISPLAY, "Long List", "Display files as a detailed list"},
- {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem display_size_items[] = {
- {32, "TINY", 0, "Tiny", ""},
- {64, "SMALL", 0, "Small", ""},
- {128, "NORMAL", 0, "Regular", ""},
- {256, "LARGE", 0, "Large", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem file_filter_idtypes_items[] = {
- {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action data-blocks"},
- {FILTER_ID_AR, "ARMATURE", ICON_ARMATURE_DATA, "Armatures", "Show/hide Armature data-blocks"},
- {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushes data-blocks"},
- {FILTER_ID_CA, "CAMERA", ICON_CAMERA_DATA, "Cameras", "Show/hide Camera data-blocks"},
- {FILTER_ID_CF, "CACHEFILE", ICON_FILE, "Cache Files", "Show/hide Cache File data-blocks"},
- {FILTER_ID_CU, "CURVE", ICON_CURVE_DATA, "Curves", "Show/hide Curve data-blocks"},
- {FILTER_ID_GD, "GREASE_PENCIL", ICON_GREASEPENCIL, "Grease Pencil", "Show/hide Grease pencil data-blocks"},
- {FILTER_ID_GR, "GROUP", ICON_GROUP, "Collections", "Show/hide Collection data-blocks"},
- {FILTER_ID_IM, "IMAGE", ICON_IMAGE_DATA, "Images", "Show/hide Image data-blocks"},
- {FILTER_ID_LA, "LIGHT", ICON_LIGHT_DATA, "Lights", "Show/hide Light data-blocks"},
- {FILTER_ID_LS, "LINESTYLE", ICON_LINE_DATA,
- "Freestyle Linestyles", "Show/hide Freestyle's Line Style data-blocks"},
- {FILTER_ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattices", "Show/hide Lattice data-blocks"},
- {FILTER_ID_MA, "MATERIAL", ICON_MATERIAL_DATA, "Materials", "Show/hide Material data-blocks"},
- {FILTER_ID_MB, "METABALL", ICON_META_DATA, "Metaballs", "Show/hide Metaball data-blocks"},
- {FILTER_ID_MC, "MOVIE_CLIP", ICON_TRACKER_DATA, "Movie Clips", "Show/hide Movie Clip data-blocks"},
- {FILTER_ID_ME, "MESH", ICON_MESH_DATA, "Meshes", "Show/hide Mesh data-blocks"},
- {FILTER_ID_MSK, "MASK", ICON_MOD_MASK, "Masks", "Show/hide Mask data-blocks"},
- {FILTER_ID_NT, "NODE_TREE", ICON_NODETREE, "Node Trees", "Show/hide Node Tree data-blocks"},
- {FILTER_ID_OB, "OBJECT", ICON_OBJECT_DATA, "Objects", "Show/hide Object data-blocks"},
- {FILTER_ID_PA, "PARTICLE_SETTINGS", ICON_PARTICLE_DATA,
- "Particles Settings", "Show/hide Particle Settings data-blocks"},
- {FILTER_ID_PAL, "PALETTE", ICON_COLOR, "Palettes", "Show/hide Palette data-blocks"},
- {FILTER_ID_PC, "PAINT_CURVE", ICON_CURVE_BEZCURVE, "Paint Curves", "Show/hide Paint Curve data-blocks"},
- {FILTER_ID_LP, "LIGHT_PROBE", ICON_LIGHTPROBE_CUBEMAP, "Light Probes", "Show/hide Light Probe data-blocks"},
- {FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene data-blocks"},
- {FILTER_ID_SPK, "SPEAKER", ICON_SPEAKER, "Speakers", "Show/hide Speaker data-blocks"},
- {FILTER_ID_SO, "SOUND", ICON_SOUND, "Sounds", "Show/hide Sound data-blocks"},
- {FILTER_ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Textures", "Show/hide Texture data-blocks"},
- {FILTER_ID_TXT, "TEXT", ICON_TEXT, "Texts", "Show/hide Text data-blocks"},
- {FILTER_ID_VF, "FONT", ICON_FONT_DATA, "Fonts", "Show/hide Font data-blocks"},
- {FILTER_ID_WO, "WORLD", ICON_WORLD_DATA, "Worlds", "Show/hide World data-blocks"},
- {FILTER_ID_WS, "WORK_SPACE", ICON_NONE, "Workspaces", "Show/hide workspace data-blocks"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem file_filter_idcategories_items[] = {
- {FILTER_ID_SCE,
- "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"},
- {FILTER_ID_AC,
- "ANIMATION", ICON_ANIM_DATA, "Animations", "Show/hide animation data"},
- {FILTER_ID_OB | FILTER_ID_GR,
- "OBJECT", ICON_GROUP, "Objects & Collections", "Show/hide objects and groups"},
- {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME,
- "GEOMETRY", ICON_MESH_DATA, "Geometry", "Show/hide meshes, curves, lattice, armatures and metaballs data"},
- {FILTER_ID_LS | FILTER_ID_MA | FILTER_ID_NT | FILTER_ID_TE,
- "SHADING", ICON_MATERIAL_DATA, "Shading",
- "Show/hide materials, nodetrees, textures and Freestyle's linestyles"},
- {FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO,
- "IMAGE", ICON_IMAGE_DATA, "Images & Sounds", "Show/hide images, movie clips, sounds and masks"},
- {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_SPK | FILTER_ID_WO | FILTER_ID_WS,
- "ENVIRONMENT", ICON_WORLD_DATA, "Environment", "Show/hide worlds, lights, cameras and speakers"},
- {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT | FILTER_ID_VF | FILTER_ID_CF,
- "MISC", ICON_GREASEPENCIL, "Miscellaneous", "Show/hide other data types"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "FileSelectParams", NULL);
- RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
-
- prop = RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "title");
- RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "dir");
- RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
- RNA_def_property_string_sdna(prop, NULL, "file");
- RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_library_browsing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Library Browser", "Whether we may browse blender files' content or not");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_FileSelectParams_use_lib_get", NULL);
-
- prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "display");
- RNA_def_property_enum_items(prop, file_display_items);
- RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "recursion_level", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, fileselectparams_recursion_level_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FileSelectParams_recursion_level_itemf");
- RNA_def_property_ui_text(prop, "Recursion", "Numbers of dirtree levels to show simultaneously");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER);
- RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
- RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sort");
- RNA_def_property_enum_items(prop, rna_enum_file_sort_items);
- RNA_def_property_ui_text(prop, "Sort", "");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_IMAGE);
- RNA_def_property_ui_text(prop, "Filter Images", "Show image files");
- RNA_def_property_ui_icon(prop, ICON_FILE_IMAGE, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_blender", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDER);
- RNA_def_property_ui_text(prop, "Filter Blender", "Show .blend files");
- RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_backup", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDER_BACKUP);
- RNA_def_property_ui_text(prop, "Filter BlenderBackup files", "Show .blend1, .blend2, etc. files");
- RNA_def_property_ui_icon(prop, ICON_FILE_BACKUP, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_movie", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_MOVIE);
- RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files");
- RNA_def_property_ui_icon(prop, ICON_FILE_MOVIE, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_script", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_PYSCRIPT);
- RNA_def_property_ui_text(prop, "Filter Script", "Show script files");
- RNA_def_property_ui_icon(prop, ICON_FILE_SCRIPT, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_font", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_FTFONT);
- RNA_def_property_ui_text(prop, "Filter Fonts", "Show font files");
- RNA_def_property_ui_icon(prop, ICON_FILE_FONT, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_sound", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_SOUND);
- RNA_def_property_ui_text(prop, "Filter Sound", "Show sound files");
- RNA_def_property_ui_icon(prop, ICON_FILE_SOUND, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_TEXT);
- RNA_def_property_ui_text(prop, "Filter Text", "Show text files");
- RNA_def_property_ui_icon(prop, ICON_FILE_TEXT, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_FOLDER);
- RNA_def_property_ui_text(prop, "Filter Folder", "Show folders");
- RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "use_filter_blendid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDERLIB);
- RNA_def_property_ui_text(prop, "Filter Blender IDs", "Show .blend files items (objects, materials, etc.)");
- RNA_def_property_ui_icon(prop, ICON_BLENDER, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "filter_id", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filter_id");
- RNA_def_property_enum_items(prop, file_filter_idtypes_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Filter ID types", "Which ID types to show/hide, when browsing a library");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "filter_id_category", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filter_id");
- RNA_def_property_enum_items(prop, file_filter_idcategories_items);
- RNA_def_property_flag(prop, PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Filter ID categories", "Which ID categories to show/hide, when browsing a library");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
-
- prop = RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "filter_glob");
- RNA_def_property_ui_text(prop, "Extension Filter",
- "UNIX shell-like filename patterns matching, supports wildcards ('*') "
- "and list of patterns separated by ';'");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FileSelectPrams_filter_glob_set");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
-
- prop = RNA_def_property(srna, "filter_search", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "filter_search");
- RNA_def_property_ui_text(prop, "Name Filter", "Filter by name, supports '*' wildcard");
- RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
-
- prop = RNA_def_property(srna, "display_size", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "thumbnail_size");
- RNA_def_property_enum_items(prop, display_size_items);
- RNA_def_property_ui_text(prop, "Display Size",
- "Change the size of the display (width of columns or thumbnails size)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem file_display_items[] = {
+ {FILE_SHORTDISPLAY,
+ "LIST_SHORT",
+ ICON_SHORTDISPLAY,
+ "Short List",
+ "Display files as short list"},
+ {FILE_LONGDISPLAY,
+ "LIST_LONG",
+ ICON_LONGDISPLAY,
+ "Long List",
+ "Display files as a detailed list"},
+ {FILE_IMGDISPLAY, "THUMBNAIL", ICON_IMGDISPLAY, "Thumbnails", "Display files as thumbnails"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem display_size_items[] = {
+ {32, "TINY", 0, "Tiny", ""},
+ {64, "SMALL", 0, "Small", ""},
+ {128, "NORMAL", 0, "Regular", ""},
+ {256, "LARGE", 0, "Large", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem file_filter_idtypes_items[] = {
+ {FILTER_ID_AC, "ACTION", ICON_ANIM_DATA, "Actions", "Show/hide Action data-blocks"},
+ {FILTER_ID_AR,
+ "ARMATURE",
+ ICON_ARMATURE_DATA,
+ "Armatures",
+ "Show/hide Armature data-blocks"},
+ {FILTER_ID_BR, "BRUSH", ICON_BRUSH_DATA, "Brushes", "Show/hide Brushes data-blocks"},
+ {FILTER_ID_CA, "CAMERA", ICON_CAMERA_DATA, "Cameras", "Show/hide Camera data-blocks"},
+ {FILTER_ID_CF, "CACHEFILE", ICON_FILE, "Cache Files", "Show/hide Cache File data-blocks"},
+ {FILTER_ID_CU, "CURVE", ICON_CURVE_DATA, "Curves", "Show/hide Curve data-blocks"},
+ {FILTER_ID_GD,
+ "GREASE_PENCIL",
+ ICON_GREASEPENCIL,
+ "Grease Pencil",
+ "Show/hide Grease pencil data-blocks"},
+ {FILTER_ID_GR, "GROUP", ICON_GROUP, "Collections", "Show/hide Collection data-blocks"},
+ {FILTER_ID_IM, "IMAGE", ICON_IMAGE_DATA, "Images", "Show/hide Image data-blocks"},
+ {FILTER_ID_LA, "LIGHT", ICON_LIGHT_DATA, "Lights", "Show/hide Light data-blocks"},
+ {FILTER_ID_LS,
+ "LINESTYLE",
+ ICON_LINE_DATA,
+ "Freestyle Linestyles",
+ "Show/hide Freestyle's Line Style data-blocks"},
+ {FILTER_ID_LT, "LATTICE", ICON_LATTICE_DATA, "Lattices", "Show/hide Lattice data-blocks"},
+ {FILTER_ID_MA,
+ "MATERIAL",
+ ICON_MATERIAL_DATA,
+ "Materials",
+ "Show/hide Material data-blocks"},
+ {FILTER_ID_MB, "METABALL", ICON_META_DATA, "Metaballs", "Show/hide Metaball data-blocks"},
+ {FILTER_ID_MC,
+ "MOVIE_CLIP",
+ ICON_TRACKER_DATA,
+ "Movie Clips",
+ "Show/hide Movie Clip data-blocks"},
+ {FILTER_ID_ME, "MESH", ICON_MESH_DATA, "Meshes", "Show/hide Mesh data-blocks"},
+ {FILTER_ID_MSK, "MASK", ICON_MOD_MASK, "Masks", "Show/hide Mask data-blocks"},
+ {FILTER_ID_NT, "NODE_TREE", ICON_NODETREE, "Node Trees", "Show/hide Node Tree data-blocks"},
+ {FILTER_ID_OB, "OBJECT", ICON_OBJECT_DATA, "Objects", "Show/hide Object data-blocks"},
+ {FILTER_ID_PA,
+ "PARTICLE_SETTINGS",
+ ICON_PARTICLE_DATA,
+ "Particles Settings",
+ "Show/hide Particle Settings data-blocks"},
+ {FILTER_ID_PAL, "PALETTE", ICON_COLOR, "Palettes", "Show/hide Palette data-blocks"},
+ {FILTER_ID_PC,
+ "PAINT_CURVE",
+ ICON_CURVE_BEZCURVE,
+ "Paint Curves",
+ "Show/hide Paint Curve data-blocks"},
+ {FILTER_ID_LP,
+ "LIGHT_PROBE",
+ ICON_LIGHTPROBE_CUBEMAP,
+ "Light Probes",
+ "Show/hide Light Probe data-blocks"},
+ {FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide Scene data-blocks"},
+ {FILTER_ID_SPK, "SPEAKER", ICON_SPEAKER, "Speakers", "Show/hide Speaker data-blocks"},
+ {FILTER_ID_SO, "SOUND", ICON_SOUND, "Sounds", "Show/hide Sound data-blocks"},
+ {FILTER_ID_TE, "TEXTURE", ICON_TEXTURE_DATA, "Textures", "Show/hide Texture data-blocks"},
+ {FILTER_ID_TXT, "TEXT", ICON_TEXT, "Texts", "Show/hide Text data-blocks"},
+ {FILTER_ID_VF, "FONT", ICON_FONT_DATA, "Fonts", "Show/hide Font data-blocks"},
+ {FILTER_ID_WO, "WORLD", ICON_WORLD_DATA, "Worlds", "Show/hide World data-blocks"},
+ {FILTER_ID_WS, "WORK_SPACE", ICON_NONE, "Workspaces", "Show/hide workspace data-blocks"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem file_filter_idcategories_items[] = {
+ {FILTER_ID_SCE, "SCENE", ICON_SCENE_DATA, "Scenes", "Show/hide scenes"},
+ {FILTER_ID_AC, "ANIMATION", ICON_ANIM_DATA, "Animations", "Show/hide animation data"},
+ {FILTER_ID_OB | FILTER_ID_GR,
+ "OBJECT",
+ ICON_GROUP,
+ "Objects & Collections",
+ "Show/hide objects and groups"},
+ {FILTER_ID_AR | FILTER_ID_CU | FILTER_ID_LT | FILTER_ID_MB | FILTER_ID_ME,
+ "GEOMETRY",
+ ICON_MESH_DATA,
+ "Geometry",
+ "Show/hide meshes, curves, lattice, armatures and metaballs data"},
+ {FILTER_ID_LS | FILTER_ID_MA | FILTER_ID_NT | FILTER_ID_TE,
+ "SHADING",
+ ICON_MATERIAL_DATA,
+ "Shading",
+ "Show/hide materials, nodetrees, textures and Freestyle's linestyles"},
+ {FILTER_ID_IM | FILTER_ID_MC | FILTER_ID_MSK | FILTER_ID_SO,
+ "IMAGE",
+ ICON_IMAGE_DATA,
+ "Images & Sounds",
+ "Show/hide images, movie clips, sounds and masks"},
+ {FILTER_ID_CA | FILTER_ID_LA | FILTER_ID_SPK | FILTER_ID_WO | FILTER_ID_WS,
+ "ENVIRONMENT",
+ ICON_WORLD_DATA,
+ "Environment",
+ "Show/hide worlds, lights, cameras and speakers"},
+ {FILTER_ID_BR | FILTER_ID_GD | FILTER_ID_PA | FILTER_ID_PAL | FILTER_ID_PC | FILTER_ID_TXT |
+ FILTER_ID_VF | FILTER_ID_CF,
+ "MISC",
+ ICON_GREASEPENCIL,
+ "Miscellaneous",
+ "Show/hide other data types"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "FileSelectParams", NULL);
+ RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
+
+ prop = RNA_def_property(srna, "title", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "title");
+ RNA_def_property_ui_text(prop, "Title", "Title for the file browser");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "dir");
+ RNA_def_property_ui_text(prop, "Directory", "Directory displayed in the file browser");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "filename", PROP_STRING, PROP_FILENAME);
+ RNA_def_property_string_sdna(prop, NULL, "file");
+ RNA_def_property_ui_text(prop, "File Name", "Active file in the file browser");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_library_browsing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Library Browser", "Whether we may browse blender files' content or not");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_FileSelectParams_use_lib_get", NULL);
+
+ prop = RNA_def_property(srna, "display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "display");
+ RNA_def_property_enum_items(prop, file_display_items);
+ RNA_def_property_ui_text(prop, "Display Mode", "Display mode for the file list");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "recursion_level", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, fileselectparams_recursion_level_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_FileSelectParams_recursion_level_itemf");
+ RNA_def_property_ui_text(prop, "Recursion", "Numbers of dirtree levels to show simultaneously");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", FILE_FILTER);
+ RNA_def_property_ui_text(prop, "Filter Files", "Enable filtering of files");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", FILE_HIDE_DOT);
+ RNA_def_property_ui_text(prop, "Show Hidden", "Show hidden dot files");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sort");
+ RNA_def_property_enum_items(prop, rna_enum_file_sort_items);
+ RNA_def_property_ui_text(prop, "Sort", "");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_image", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_IMAGE);
+ RNA_def_property_ui_text(prop, "Filter Images", "Show image files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_IMAGE, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_blender", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDER);
+ RNA_def_property_ui_text(prop, "Filter Blender", "Show .blend files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_BLEND, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_backup", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDER_BACKUP);
+ RNA_def_property_ui_text(
+ prop, "Filter BlenderBackup files", "Show .blend1, .blend2, etc. files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_BACKUP, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_movie", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_MOVIE);
+ RNA_def_property_ui_text(prop, "Filter Movies", "Show movie files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_MOVIE, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_script", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_PYSCRIPT);
+ RNA_def_property_ui_text(prop, "Filter Script", "Show script files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_SCRIPT, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_font", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_FTFONT);
+ RNA_def_property_ui_text(prop, "Filter Fonts", "Show font files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_FONT, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_sound", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_SOUND);
+ RNA_def_property_ui_text(prop, "Filter Sound", "Show sound files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_SOUND, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_text", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_TEXT);
+ RNA_def_property_ui_text(prop, "Filter Text", "Show text files");
+ RNA_def_property_ui_icon(prop, ICON_FILE_TEXT, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_folder", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_FOLDER);
+ RNA_def_property_ui_text(prop, "Filter Folder", "Show folders");
+ RNA_def_property_ui_icon(prop, ICON_FILE_FOLDER, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "use_filter_blendid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter", FILE_TYPE_BLENDERLIB);
+ RNA_def_property_ui_text(
+ prop, "Filter Blender IDs", "Show .blend files items (objects, materials, etc.)");
+ RNA_def_property_ui_icon(prop, ICON_BLENDER, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "filter_id", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter_id");
+ RNA_def_property_enum_items(prop, file_filter_idtypes_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(
+ prop, "Filter ID types", "Which ID types to show/hide, when browsing a library");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "filter_id_category", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter_id");
+ RNA_def_property_enum_items(prop, file_filter_idcategories_items);
+ RNA_def_property_flag(prop, PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(
+ prop, "Filter ID categories", "Which ID categories to show/hide, when browsing a library");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, NULL);
+
+ prop = RNA_def_property(srna, "filter_glob", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "filter_glob");
+ RNA_def_property_ui_text(prop,
+ "Extension Filter",
+ "UNIX shell-like filename patterns matching, supports wildcards ('*') "
+ "and list of patterns separated by ';'");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_FileSelectPrams_filter_glob_set");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
+
+ prop = RNA_def_property(srna, "filter_search", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "filter_search");
+ RNA_def_property_ui_text(prop, "Name Filter", "Filter by name, supports '*' wildcard");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
+
+ prop = RNA_def_property(srna, "display_size", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "thumbnail_size");
+ RNA_def_property_enum_items(prop, display_size_items);
+ RNA_def_property_ui_text(prop,
+ "Display Size",
+ "Change the size of the display (width of columns or thumbnails size)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_LIST, NULL);
}
static void rna_def_filemenu_entry(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "FileBrowserFSMenuEntry", NULL);
- RNA_def_struct_sdna(srna, "FSMenuEntry");
- RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
-
- prop = RNA_def_property(srna, "path", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_funcs(prop, "rna_FileBrowser_FSMenuEntry_path_get",
- "rna_FileBrowser_FSMenuEntry_path_length",
- "rna_FileBrowser_FSMenuEntry_path_set");
- RNA_def_property_ui_text(prop, "Path", "");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_FileBrowser_FSMenuEntry_name_get",
- "rna_FileBrowser_FSMenuEntry_name_length",
- "rna_FileBrowser_FSMenuEntry_name_set");
- RNA_def_property_editable_func(prop, "rna_FileBrowser_FSMenuEntry_name_get_editable");
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "use_save", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_FileBrowser_FSMenuEntry_use_save_get", NULL);
- RNA_def_property_ui_text(prop, "Save", "Whether this path is saved in bookmarks, or generated from OS");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_FileBrowser_FSMenuEntry_is_valid_get", NULL);
- RNA_def_property_ui_text(prop, "Valid", "Whether this path is currently reachable");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "FileBrowserFSMenuEntry", NULL);
+ RNA_def_struct_sdna(srna, "FSMenuEntry");
+ RNA_def_struct_ui_text(srna, "File Select Parameters", "File Select Parameters");
+
+ prop = RNA_def_property(srna, "path", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_funcs(prop,
+ "rna_FileBrowser_FSMenuEntry_path_get",
+ "rna_FileBrowser_FSMenuEntry_path_length",
+ "rna_FileBrowser_FSMenuEntry_path_set");
+ RNA_def_property_ui_text(prop, "Path", "");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(prop,
+ "rna_FileBrowser_FSMenuEntry_name_get",
+ "rna_FileBrowser_FSMenuEntry_name_length",
+ "rna_FileBrowser_FSMenuEntry_name_set");
+ RNA_def_property_editable_func(prop, "rna_FileBrowser_FSMenuEntry_name_get_editable");
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "use_save", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_FileBrowser_FSMenuEntry_use_save_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Save", "Whether this path is saved in bookmarks, or generated from OS");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_FileBrowser_FSMenuEntry_is_valid_get", NULL);
+ RNA_def_property_ui_text(prop, "Valid", "Whether this path is currently reachable");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_space_filebrowser(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "SpaceFileBrowser", "Space");
- RNA_def_struct_sdna(srna, "SpaceFile");
- RNA_def_struct_ui_text(srna, "Space File Browser", "File browser space data");
-
- prop = RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "params");
- RNA_def_property_ui_text(prop, "Filebrowser Parameter", "Parameters and Settings for the Filebrowser");
-
- prop = RNA_def_property(srna, "active_operator", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "op");
- RNA_def_property_ui_text(prop, "Active Operator", "");
-
- /* keep this for compatibility with existing presets,
- * not exposed in c++ api because of keyword conflict */
- prop = RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "op");
- RNA_def_property_ui_text(prop, "Active Operator", "");
-
- /* bookmarks, recent files etc. */
- prop = RNA_def_collection(srna, "system_folders", "FileBrowserFSMenuEntry", "System Folders",
- "System's folders (usually root, available hard drives, etc)");
- RNA_def_property_collection_funcs(prop, "rna_FileBrowser_FSMenuSystem_data_begin", "rna_FileBrowser_FSMenu_next",
- "rna_FileBrowser_FSMenu_end", "rna_FileBrowser_FSMenu_get",
- "rna_FileBrowser_FSMenuSystem_data_length", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_int(srna, "system_folders_active", -1, -1, INT_MAX, "Active System Folder",
- "Index of active system folder (-1 if none)", -1, INT_MAX);
- RNA_def_property_int_sdna(prop, NULL, "systemnr");
- RNA_def_property_int_funcs(prop, "rna_FileBrowser_FSMenuSystem_active_get",
- "rna_FileBrowser_FSMenuSystem_active_set", "rna_FileBrowser_FSMenuSystem_active_range");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
-
- prop = RNA_def_collection(srna, "system_bookmarks", "FileBrowserFSMenuEntry", "System Bookmarks",
- "System's bookmarks");
- RNA_def_property_collection_funcs(prop, "rna_FileBrowser_FSMenuSystemBookmark_data_begin", "rna_FileBrowser_FSMenu_next",
- "rna_FileBrowser_FSMenu_end", "rna_FileBrowser_FSMenu_get",
- "rna_FileBrowser_FSMenuSystemBookmark_data_length", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_int(srna, "system_bookmarks_active", -1, -1, INT_MAX, "Active System Bookmark",
- "Index of active system bookmark (-1 if none)", -1, INT_MAX);
- RNA_def_property_int_sdna(prop, NULL, "system_bookmarknr");
- RNA_def_property_int_funcs(prop, "rna_FileBrowser_FSMenuSystemBookmark_active_get",
- "rna_FileBrowser_FSMenuSystemBookmark_active_set", "rna_FileBrowser_FSMenuSystemBookmark_active_range");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
-
- prop = RNA_def_collection(srna, "bookmarks", "FileBrowserFSMenuEntry", "Bookmarks",
- "User's bookmarks");
- RNA_def_property_collection_funcs(prop, "rna_FileBrowser_FSMenuBookmark_data_begin", "rna_FileBrowser_FSMenu_next",
- "rna_FileBrowser_FSMenu_end", "rna_FileBrowser_FSMenu_get",
- "rna_FileBrowser_FSMenuBookmark_data_length", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_int(srna, "bookmarks_active", -1, -1, INT_MAX, "Active Bookmark",
- "Index of active bookmark (-1 if none)", -1, INT_MAX);
- RNA_def_property_int_sdna(prop, NULL, "bookmarknr");
- RNA_def_property_int_funcs(prop, "rna_FileBrowser_FSMenuBookmark_active_get",
- "rna_FileBrowser_FSMenuBookmark_active_set", "rna_FileBrowser_FSMenuBookmark_active_range");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
-
- prop = RNA_def_collection(srna, "recent_folders", "FileBrowserFSMenuEntry", "Recent Folders",
- "");
- RNA_def_property_collection_funcs(prop, "rna_FileBrowser_FSMenuRecent_data_begin", "rna_FileBrowser_FSMenu_next",
- "rna_FileBrowser_FSMenu_end", "rna_FileBrowser_FSMenu_get",
- "rna_FileBrowser_FSMenuRecent_data_length", NULL, NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_int(srna, "recent_folders_active", -1, -1, INT_MAX, "Active Recent Folder",
- "Index of active recent folder (-1 if none)", -1, INT_MAX);
- RNA_def_property_int_sdna(prop, NULL, "recentnr");
- RNA_def_property_int_funcs(prop, "rna_FileBrowser_FSMenuRecent_active_get",
- "rna_FileBrowser_FSMenuRecent_active_set", "rna_FileBrowser_FSMenuRecent_active_range");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "SpaceFileBrowser", "Space");
+ RNA_def_struct_sdna(srna, "SpaceFile");
+ RNA_def_struct_ui_text(srna, "Space File Browser", "File browser space data");
+
+ prop = RNA_def_property(srna, "params", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "params");
+ RNA_def_property_ui_text(
+ prop, "Filebrowser Parameter", "Parameters and Settings for the Filebrowser");
+
+ prop = RNA_def_property(srna, "active_operator", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "op");
+ RNA_def_property_ui_text(prop, "Active Operator", "");
+
+ /* keep this for compatibility with existing presets,
+ * not exposed in c++ api because of keyword conflict */
+ prop = RNA_def_property(srna, "operator", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "op");
+ RNA_def_property_ui_text(prop, "Active Operator", "");
+
+ /* bookmarks, recent files etc. */
+ prop = RNA_def_collection(srna,
+ "system_folders",
+ "FileBrowserFSMenuEntry",
+ "System Folders",
+ "System's folders (usually root, available hard drives, etc)");
+ RNA_def_property_collection_funcs(prop,
+ "rna_FileBrowser_FSMenuSystem_data_begin",
+ "rna_FileBrowser_FSMenu_next",
+ "rna_FileBrowser_FSMenu_end",
+ "rna_FileBrowser_FSMenu_get",
+ "rna_FileBrowser_FSMenuSystem_data_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_int(srna,
+ "system_folders_active",
+ -1,
+ -1,
+ INT_MAX,
+ "Active System Folder",
+ "Index of active system folder (-1 if none)",
+ -1,
+ INT_MAX);
+ RNA_def_property_int_sdna(prop, NULL, "systemnr");
+ RNA_def_property_int_funcs(prop,
+ "rna_FileBrowser_FSMenuSystem_active_get",
+ "rna_FileBrowser_FSMenuSystem_active_set",
+ "rna_FileBrowser_FSMenuSystem_active_range");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
+
+ prop = RNA_def_collection(srna,
+ "system_bookmarks",
+ "FileBrowserFSMenuEntry",
+ "System Bookmarks",
+ "System's bookmarks");
+ RNA_def_property_collection_funcs(prop,
+ "rna_FileBrowser_FSMenuSystemBookmark_data_begin",
+ "rna_FileBrowser_FSMenu_next",
+ "rna_FileBrowser_FSMenu_end",
+ "rna_FileBrowser_FSMenu_get",
+ "rna_FileBrowser_FSMenuSystemBookmark_data_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_int(srna,
+ "system_bookmarks_active",
+ -1,
+ -1,
+ INT_MAX,
+ "Active System Bookmark",
+ "Index of active system bookmark (-1 if none)",
+ -1,
+ INT_MAX);
+ RNA_def_property_int_sdna(prop, NULL, "system_bookmarknr");
+ RNA_def_property_int_funcs(prop,
+ "rna_FileBrowser_FSMenuSystemBookmark_active_get",
+ "rna_FileBrowser_FSMenuSystemBookmark_active_set",
+ "rna_FileBrowser_FSMenuSystemBookmark_active_range");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
+
+ prop = RNA_def_collection(
+ srna, "bookmarks", "FileBrowserFSMenuEntry", "Bookmarks", "User's bookmarks");
+ RNA_def_property_collection_funcs(prop,
+ "rna_FileBrowser_FSMenuBookmark_data_begin",
+ "rna_FileBrowser_FSMenu_next",
+ "rna_FileBrowser_FSMenu_end",
+ "rna_FileBrowser_FSMenu_get",
+ "rna_FileBrowser_FSMenuBookmark_data_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_int(srna,
+ "bookmarks_active",
+ -1,
+ -1,
+ INT_MAX,
+ "Active Bookmark",
+ "Index of active bookmark (-1 if none)",
+ -1,
+ INT_MAX);
+ RNA_def_property_int_sdna(prop, NULL, "bookmarknr");
+ RNA_def_property_int_funcs(prop,
+ "rna_FileBrowser_FSMenuBookmark_active_get",
+ "rna_FileBrowser_FSMenuBookmark_active_set",
+ "rna_FileBrowser_FSMenuBookmark_active_range");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
+
+ prop = RNA_def_collection(
+ srna, "recent_folders", "FileBrowserFSMenuEntry", "Recent Folders", "");
+ RNA_def_property_collection_funcs(prop,
+ "rna_FileBrowser_FSMenuRecent_data_begin",
+ "rna_FileBrowser_FSMenu_next",
+ "rna_FileBrowser_FSMenu_end",
+ "rna_FileBrowser_FSMenu_get",
+ "rna_FileBrowser_FSMenuRecent_data_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_int(srna,
+ "recent_folders_active",
+ -1,
+ -1,
+ INT_MAX,
+ "Active Recent Folder",
+ "Index of active recent folder (-1 if none)",
+ -1,
+ INT_MAX);
+ RNA_def_property_int_sdna(prop, NULL, "recentnr");
+ RNA_def_property_int_funcs(prop,
+ "rna_FileBrowser_FSMenuRecent_active_get",
+ "rna_FileBrowser_FSMenuRecent_active_set",
+ "rna_FileBrowser_FSMenuRecent_active_range");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_FILE_PARAMS, "rna_FileBrowser_FSMenu_active_update");
}
static void rna_def_space_info(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SpaceInfo", "Space");
- RNA_def_struct_sdna(srna, "SpaceInfo");
- RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
+ srna = RNA_def_struct(brna, "SpaceInfo", "Space");
+ RNA_def_struct_sdna(srna, "SpaceInfo");
+ RNA_def_struct_ui_text(srna, "Space Info", "Info space data");
- /* reporting display */
- prop = RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_DEBUG);
- RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ /* reporting display */
+ prop = RNA_def_property(srna, "show_report_debug", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_DEBUG);
+ RNA_def_property_ui_text(prop, "Show Debug", "Display debug reporting info");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
- prop = RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_INFO);
- RNA_def_property_ui_text(prop, "Show Info", "Display general information");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ prop = RNA_def_property(srna, "show_report_info", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_INFO);
+ RNA_def_property_ui_text(prop, "Show Info", "Display general information");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
- prop = RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_OP);
- RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ prop = RNA_def_property(srna, "show_report_operator", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_OP);
+ RNA_def_property_ui_text(prop, "Show Operator", "Display the operator log");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
- prop = RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_WARN);
- RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ prop = RNA_def_property(srna, "show_report_warning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_WARN);
+ RNA_def_property_ui_text(prop, "Show Warn", "Display warnings");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
- prop = RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
- RNA_def_property_ui_text(prop, "Show Error", "Display error text");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
+ prop = RNA_def_property(srna, "show_report_error", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "rpt_mask", INFO_RPT_ERR);
+ RNA_def_property_ui_text(prop, "Show Error", "Display error text");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_INFO_REPORT, NULL);
}
static void rna_def_space_userpref(BlenderRNA *brna)
{
- static const EnumPropertyItem filter_type_items[] = {
- {0, "NAME", 0, "Name", "Filter based on the operator name"},
- {1, "KEY", 0, "Key-Binding", "Filter based on key bindings"},
- {0, NULL, 0, NULL, NULL},
- };
+ static const EnumPropertyItem filter_type_items[] = {
+ {0, "NAME", 0, "Name", "Filter based on the operator name"},
+ {1, "KEY", 0, "Key-Binding", "Filter based on key bindings"},
+ {0, NULL, 0, NULL, NULL},
+ };
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "SpacePreferences", "Space");
- RNA_def_struct_sdna(srna, "SpaceUserPref");
- RNA_def_struct_ui_text(srna, "Space Preferences", "Blender preferences space data");
+ srna = RNA_def_struct(brna, "SpacePreferences", "Space");
+ RNA_def_struct_sdna(srna, "SpaceUserPref");
+ RNA_def_struct_ui_text(srna, "Space Preferences", "Blender preferences space data");
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filter_type");
- RNA_def_property_enum_items(prop, filter_type_items);
- RNA_def_property_ui_text(prop, "Filter Type", "Filter method");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
-
- prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "filter");
- RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
- RNA_def_property_ui_text(prop, "Filter", "Search term for filtering in the UI");
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter_type");
+ RNA_def_property_enum_items(prop, filter_type_items);
+ RNA_def_property_ui_text(prop, "Filter Type", "Filter method");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
+ prop = RNA_def_property(srna, "filter_text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "filter");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_ui_text(prop, "Filter", "Search term for filtering in the UI");
}
static void rna_def_node_tree_path(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "NodeTreePath", NULL);
- RNA_def_struct_sdna(srna, "bNodeTreePath");
- RNA_def_struct_ui_text(srna, "Node Tree Path", "Element of the node space tree path");
+ srna = RNA_def_struct(brna, "NodeTreePath", NULL);
+ RNA_def_struct_sdna(srna, "bNodeTreePath");
+ RNA_def_struct_ui_text(srna, "Node Tree Path", "Element of the node space tree path");
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Node Tree", "Base node tree from context");
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Node Tree", "Base node tree from context");
}
static void rna_def_space_node_path_api(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop, *parm;
- FunctionRNA *func;
-
- RNA_def_property_srna(cprop, "SpaceNodeEditorPath");
- srna = RNA_def_struct(brna, "SpaceNodeEditorPath", NULL);
- RNA_def_struct_sdna(srna, "SpaceNode");
- RNA_def_struct_ui_text(srna, "Space Node Editor Path", "History of node trees in the editor");
-
- prop = RNA_def_property(srna, "to_string", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_SpaceNodeEditor_path_get", "rna_SpaceNodeEditor_path_length", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_ui_text(srna, "Path", "Get the node tree path as a string");
-
- func = RNA_def_function(srna, "clear", "rna_SpaceNodeEditor_path_clear");
- RNA_def_function_ui_description(func, "Reset the node tree path");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- func = RNA_def_function(srna, "start", "rna_SpaceNodeEditor_path_start");
- RNA_def_function_ui_description(func, "Set the root node tree");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
-
- func = RNA_def_function(srna, "append", "rna_SpaceNodeEditor_path_append");
- RNA_def_function_ui_description(func, "Append a node group tree to the path");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "Node tree to append to the node editor path");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "node", "Node", "Node", "Group node linking to this node tree");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
-
- func = RNA_def_function(srna, "pop", "rna_SpaceNodeEditor_path_pop");
- RNA_def_function_ui_description(func, "Remove the last node tree from the path");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ StructRNA *srna;
+ PropertyRNA *prop, *parm;
+ FunctionRNA *func;
+
+ RNA_def_property_srna(cprop, "SpaceNodeEditorPath");
+ srna = RNA_def_struct(brna, "SpaceNodeEditorPath", NULL);
+ RNA_def_struct_sdna(srna, "SpaceNode");
+ RNA_def_struct_ui_text(srna, "Space Node Editor Path", "History of node trees in the editor");
+
+ prop = RNA_def_property(srna, "to_string", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_SpaceNodeEditor_path_get", "rna_SpaceNodeEditor_path_length", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_ui_text(srna, "Path", "Get the node tree path as a string");
+
+ func = RNA_def_function(srna, "clear", "rna_SpaceNodeEditor_path_clear");
+ RNA_def_function_ui_description(func, "Reset the node tree path");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ func = RNA_def_function(srna, "start", "rna_SpaceNodeEditor_path_start");
+ RNA_def_function_ui_description(func, "Set the root node tree");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "node_tree", "NodeTree", "Node Tree", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "append", "rna_SpaceNodeEditor_path_append");
+ RNA_def_function_ui_description(func, "Append a node group tree to the path");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(
+ func, "node_tree", "NodeTree", "Node Tree", "Node tree to append to the node editor path");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "node", "Node", "Node", "Group node linking to this node tree");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "pop", "rna_SpaceNodeEditor_path_pop");
+ RNA_def_function_ui_description(func, "Remove the last node tree from the path");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
}
static void rna_def_space_node(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem texture_id_type_items[] = {
- {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"},
- {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"},
-#ifdef WITH_FREESTYLE
- {SNODE_TEX_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "Line Style", "Edit texture nodes from Line Style"},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem shader_type_items[] = {
- {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"},
- {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"},
-#ifdef WITH_FREESTYLE
- {SNODE_SHADER_LINESTYLE, "LINESTYLE", ICON_LINE_DATA, "Line Style", "Edit shader nodes from Line Style"},
-#endif
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem backdrop_channels_items[] = {
- {SNODE_USE_ALPHA, "COLOR_ALPHA", ICON_IMAGE_RGB_ALPHA, "Color and Alpha",
- "Display image with RGB colors and alpha transparency"},
- {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
- {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Display alpha transparency channel"},
- {SNODE_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
- {SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
- {SNODE_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem insert_ofs_dir_items[] = {
- {SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"},
- {SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem dummy_items[] = {
- {0, "DUMMY", 0, "", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SpaceNodeEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceNode");
- RNA_def_struct_ui_text(srna, "Space Node Editor", "Node editor space data");
-
- prop = RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, dummy_items);
- RNA_def_property_enum_funcs(prop, "rna_SpaceNodeEditor_tree_type_get", "rna_SpaceNodeEditor_tree_type_set",
- "rna_SpaceNodeEditor_tree_type_itemf");
- RNA_def_property_ui_text(prop, "Tree Type", "Node tree type to display and edit");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
-
- prop = RNA_def_property(srna, "texture_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texfrom");
- RNA_def_property_enum_items(prop, texture_id_type_items);
- RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
-
- prop = RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "shaderfrom");
- RNA_def_property_enum_items(prop, shader_type_items);
- RNA_def_property_ui_text(prop, "Shader Type", "Type of data to take shader from");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
-
- prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "ID", "Data-block whose nodes are being edited");
-
- prop = RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "from");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "ID From", "Data-block from which the edited data-block is linked");
-
- prop = RNA_def_property(srna, "path", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "treepath", NULL);
- RNA_def_property_struct_type(prop, "NodeTreePath");
- RNA_def_property_ui_text(prop, "Node Tree Path", "Path from the data-block to the currently edited node tree");
- rna_def_space_node_path_api(brna, prop);
-
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceNodeEditor_node_tree_set", NULL,
- "rna_SpaceNodeEditor_node_tree_poll");
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Node Tree", "Base node tree from context");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, "rna_SpaceNodeEditor_node_tree_update");
-
- prop = RNA_def_property(srna, "edit_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "edittree");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Edit Tree", "Node tree being displayed and edited");
-
- prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_PIN);
- RNA_def_property_ui_text(prop, "Pinned", "Use the pinned node tree");
- RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
-
- prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW);
- RNA_def_property_ui_text(prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, "rna_SpaceNodeEditor_show_backdrop_update");
-
- prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_GPENCIL);
- RNA_def_property_ui_text(prop, "Show Annotation",
- "Show annotations for this view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- prop = RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER);
- RNA_def_property_ui_text(prop, "Auto Render", "Re-render and composite changed layers on 3D edits");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- prop = RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "zoom");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_range(prop, 0.01f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
- RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- prop = RNA_def_property(srna, "backdrop_offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "xof");
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Backdrop Offset", "Backdrop offset");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- prop = RNA_def_property(srna, "backdrop_channels", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, backdrop_channels_items);
- RNA_def_property_ui_text(prop, "Display Channels", "Channels of the image to draw");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- /* the mx/my "cursor" in the node editor is used only by operators to store the mouse position */
- prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_sdna(prop, NULL, "cursor");
- RNA_def_property_ui_text(prop, "Cursor Location", "Location for adding new nodes");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- /* insert offset (called "Auto-offset" in UI) */
- prop = RNA_def_property(srna, "use_insert_offset", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNODE_SKIP_INSOFFSET);
- RNA_def_property_ui_text(prop, "Auto-offset", "Automatically offset the following or previous nodes in a "
- "chain when inserting a new node");
- RNA_def_property_ui_icon(prop, ICON_NODE_INSERT_ON, 1);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- prop = RNA_def_property(srna, "insert_offset_direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "insert_ofs_dir");
- RNA_def_property_enum_items(prop, insert_ofs_dir_items);
- RNA_def_property_ui_text(prop, "Auto-offset Direction", "Direction to offset nodes on insertion");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
-
- RNA_api_space_node(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem texture_id_type_items[] = {
+ {SNODE_TEX_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit texture nodes from World"},
+ {SNODE_TEX_BRUSH, "BRUSH", ICON_BRUSH_DATA, "Brush", "Edit texture nodes from Brush"},
+# ifdef WITH_FREESTYLE
+ {SNODE_TEX_LINESTYLE,
+ "LINESTYLE",
+ ICON_LINE_DATA,
+ "Line Style",
+ "Edit texture nodes from Line Style"},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem shader_type_items[] = {
+ {SNODE_SHADER_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Edit shader nodes from Object"},
+ {SNODE_SHADER_WORLD, "WORLD", ICON_WORLD_DATA, "World", "Edit shader nodes from World"},
+# ifdef WITH_FREESTYLE
+ {SNODE_SHADER_LINESTYLE,
+ "LINESTYLE",
+ ICON_LINE_DATA,
+ "Line Style",
+ "Edit shader nodes from Line Style"},
+# endif
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem backdrop_channels_items[] = {
+ {SNODE_USE_ALPHA,
+ "COLOR_ALPHA",
+ ICON_IMAGE_RGB_ALPHA,
+ "Color and Alpha",
+ "Display image with RGB colors and alpha transparency"},
+ {0, "COLOR", ICON_IMAGE_RGB, "Color", "Display image with RGB colors"},
+ {SNODE_SHOW_ALPHA, "ALPHA", ICON_IMAGE_ALPHA, "Alpha", "Display alpha transparency channel"},
+ {SNODE_SHOW_R, "RED", ICON_COLOR_RED, "Red", ""},
+ {SNODE_SHOW_G, "GREEN", ICON_COLOR_GREEN, "Green", ""},
+ {SNODE_SHOW_B, "BLUE", ICON_COLOR_BLUE, "Blue", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem insert_ofs_dir_items[] = {
+ {SNODE_INSERTOFS_DIR_RIGHT, "RIGHT", 0, "Right"},
+ {SNODE_INSERTOFS_DIR_LEFT, "LEFT", 0, "Left"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem dummy_items[] = {
+ {0, "DUMMY", 0, "", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceNodeEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceNode");
+ RNA_def_struct_ui_text(srna, "Space Node Editor", "Node editor space data");
+
+ prop = RNA_def_property(srna, "tree_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, dummy_items);
+ RNA_def_property_enum_funcs(prop,
+ "rna_SpaceNodeEditor_tree_type_get",
+ "rna_SpaceNodeEditor_tree_type_set",
+ "rna_SpaceNodeEditor_tree_type_itemf");
+ RNA_def_property_ui_text(prop, "Tree Type", "Node tree type to display and edit");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
+
+ prop = RNA_def_property(srna, "texture_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texfrom");
+ RNA_def_property_enum_items(prop, texture_id_type_items);
+ RNA_def_property_ui_text(prop, "Texture Type", "Type of data to take texture from");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
+
+ prop = RNA_def_property(srna, "shader_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "shaderfrom");
+ RNA_def_property_enum_items(prop, shader_type_items);
+ RNA_def_property_ui_text(prop, "Shader Type", "Type of data to take shader from");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
+
+ prop = RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "ID", "Data-block whose nodes are being edited");
+
+ prop = RNA_def_property(srna, "id_from", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "from");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "ID From", "Data-block from which the edited data-block is linked");
+
+ prop = RNA_def_property(srna, "path", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "treepath", NULL);
+ RNA_def_property_struct_type(prop, "NodeTreePath");
+ RNA_def_property_ui_text(
+ prop, "Node Tree Path", "Path from the data-block to the currently edited node tree");
+ rna_def_space_node_path_api(brna, prop);
+
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_funcs(
+ prop, NULL, "rna_SpaceNodeEditor_node_tree_set", NULL, "rna_SpaceNodeEditor_node_tree_poll");
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Node Tree", "Base node tree from context");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, "rna_SpaceNodeEditor_node_tree_update");
+
+ prop = RNA_def_property(srna, "edit_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "edittree");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Edit Tree", "Node tree being displayed and edited");
+
+ prop = RNA_def_property(srna, "pin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_PIN);
+ RNA_def_property_ui_text(prop, "Pinned", "Use the pinned node tree");
+ RNA_def_property_ui_icon(prop, ICON_UNPINNED, 1);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE, NULL);
+
+ prop = RNA_def_property(srna, "show_backdrop", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_BACKDRAW);
+ RNA_def_property_ui_text(
+ prop, "Backdrop", "Use active Viewer Node output as backdrop for compositing nodes");
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_NODE_VIEW, "rna_SpaceNodeEditor_show_backdrop_update");
+
+ prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_SHOW_GPENCIL);
+ RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ prop = RNA_def_property(srna, "use_auto_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SNODE_AUTO_RENDER);
+ RNA_def_property_ui_text(
+ prop, "Auto Render", "Re-render and composite changed layers on 3D edits");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ prop = RNA_def_property(srna, "backdrop_zoom", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "zoom");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_range(prop, 0.01f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.01, 100, 1, 2);
+ RNA_def_property_ui_text(prop, "Backdrop Zoom", "Backdrop zoom factor");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ prop = RNA_def_property(srna, "backdrop_offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "xof");
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Backdrop Offset", "Backdrop offset");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ prop = RNA_def_property(srna, "backdrop_channels", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, backdrop_channels_items);
+ RNA_def_property_ui_text(prop, "Display Channels", "Channels of the image to draw");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ /* the mx/my "cursor" in the node editor is used only by operators to store the mouse position */
+ prop = RNA_def_property(srna, "cursor_location", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_sdna(prop, NULL, "cursor");
+ RNA_def_property_ui_text(prop, "Cursor Location", "Location for adding new nodes");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ /* insert offset (called "Auto-offset" in UI) */
+ prop = RNA_def_property(srna, "use_insert_offset", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SNODE_SKIP_INSOFFSET);
+ RNA_def_property_ui_text(prop,
+ "Auto-offset",
+ "Automatically offset the following or previous nodes in a "
+ "chain when inserting a new node");
+ RNA_def_property_ui_icon(prop, ICON_NODE_INSERT_ON, 1);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ prop = RNA_def_property(srna, "insert_offset_direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "insert_ofs_dir");
+ RNA_def_property_enum_items(prop, insert_ofs_dir_items);
+ RNA_def_property_ui_text(
+ prop, "Auto-offset Direction", "Direction to offset nodes on insertion");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_NODE_VIEW, NULL);
+
+ RNA_api_space_node(srna);
}
static void rna_def_space_clip(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem view_items[] = {
- {SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
- {SC_VIEW_GRAPH, "GRAPH", ICON_GRAPH, "Graph", "Show graph view for active element"},
- {SC_VIEW_DOPESHEET, "DOPESHEET", ICON_ACTION, "Dopesheet", "Dopesheet view for tracking data"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem gpencil_source_items[] = {
- {SC_GPENCIL_SRC_CLIP, "CLIP", 0, "Clip", "Show annotation data-block which belongs to movie clip"},
- {SC_GPENCIL_SRC_TRACK, "TRACK", 0, "Track", "Show annotation data-block which belongs to active track"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem pivot_items[] = {
- {V3D_AROUND_CENTER_BOUNDS, "BOUNDING_BOX_CENTER", ICON_PIVOT_BOUNDBOX, "Bounding Box Center",
- "Pivot around bounding box center of selected object(s)"},
- {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
- {V3D_AROUND_LOCAL_ORIGINS, "INDIVIDUAL_ORIGINS", ICON_PIVOT_INDIVIDUAL,
- "Individual Origins", "Pivot around each object's own origin"},
- {V3D_AROUND_CENTER_MEDIAN, "MEDIAN_POINT", ICON_PIVOT_MEDIAN, "Median Point",
- "Pivot around the median point of selected objects"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "SpaceClipEditor", "Space");
- RNA_def_struct_sdna(srna, "SpaceClip");
- RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
-
- /* movieclip */
- prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Movie Clip", "Movie clip displayed and edited in this space");
- RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_clip_set", NULL, NULL);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* clip user */
- prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "MovieClipUser");
- RNA_def_property_pointer_sdna(prop, NULL, "user");
- RNA_def_property_ui_text(prop, "Movie Clip User",
- "Parameters defining which frame of the movie clip is displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* mask */
- rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_mask_set");
-
- /* mode */
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, rna_enum_clip_editor_mode_items);
- RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");
-
- /* view */
- prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "view");
- RNA_def_property_enum_items(prop, view_items);
- RNA_def_property_ui_text(prop, "View", "Type of the clip editor view");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_view_type_update");
-
- /* show pattern */
- prop = RNA_def_property(srna, "show_marker_pattern", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Show Marker Pattern", "Show pattern boundbox for markers");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_PATTERN);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show search */
- prop = RNA_def_property(srna, "show_marker_search", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Show Marker Search", "Show search boundbox for markers");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_SEARCH);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* lock to selection */
- prop = RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Lock to Selection", "Lock viewport to selected markers during playback");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_SELECTION);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_lock_selection_update");
-
- /* lock to time cursor */
- prop = RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Lock to Time Cursor",
- "Lock curves view to time cursor during playback and tracking");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_TIMECURSOR);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show markers paths */
- prop = RNA_def_property(srna, "show_track_path", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TRACK_PATH);
- RNA_def_property_ui_text(prop, "Show Track Path", "Show path of how track moves");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* path length */
- prop = RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "path_length");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Path Length", "Length of displaying path, in frames");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show tiny markers */
- prop = RNA_def_property(srna, "show_tiny_markers", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Show Tiny Markers", "Show markers in a more compact manner");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TINY_MARKER);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show bundles */
- prop = RNA_def_property(srna, "show_bundles", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Show Bundles", "Show projection of 3D markers into footage");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_BUNDLES);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* mute footage */
- prop = RNA_def_property(srna, "use_mute_footage", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Mute Footage", "Mute footage and show black background instead");
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MUTE_FOOTAGE);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* hide disabled */
- prop = RNA_def_property(srna, "show_disabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_ui_text(prop, "Show Disabled", "Show disabled tracks from the footage");
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SC_HIDE_DISABLED);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_METADATA);
- RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of clip");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* scopes */
- prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "scopes");
- RNA_def_property_struct_type(prop, "MovieClipScopes");
- RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize movie clip statistics");
-
- /* show names */
- prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_NAMES);
- RNA_def_property_ui_text(prop, "Show Names", "Show track names and status");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show grid */
- prop = RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRID);
- RNA_def_property_ui_text(prop, "Show Grid", "Show grid showing lens distortion");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show stable */
- prop = RNA_def_property(srna, "show_stable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_STABLE);
- RNA_def_property_ui_text(prop, "Show Stable", "Show stable footage in editor (if stabilization is enabled)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* manual calibration */
- prop = RNA_def_property(srna, "use_manual_calibration", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MANUAL_CALIBRATION);
- RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show annotation */
- prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_ANNOTATION);
- RNA_def_property_ui_text(prop, "Show Annotation",
- "Show annotations for this view");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show filters */
- prop = RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_FILTERS);
- RNA_def_property_ui_text(prop, "Show Filters", "Show filters for graph editor");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show graph_frames */
- prop = RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_FRAMES);
- RNA_def_property_ui_text(prop, "Show Frames",
- "Show curve for per-frame average error (camera motion should be solved first)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show graph tracks motion */
- prop = RNA_def_property(srna, "show_graph_tracks_motion", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS_MOTION);
- RNA_def_property_ui_text(prop, "Show Tracks Motion",
- "Display the speed curves (in \"x\" direction red, in \"y\" direction green) "
- "for the selected tracks");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show graph tracks motion */
- prop = RNA_def_property(srna, "show_graph_tracks_error", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS_ERROR);
- RNA_def_property_ui_text(prop, "Show Tracks Error",
- "Display the reprojection error curve for selected tracks");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show_only_selected */
- prop = RNA_def_property(srna, "show_graph_only_selected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_SEL_ONLY);
- RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show_hidden */
- prop = RNA_def_property(srna, "show_graph_hidden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_HIDDEN);
- RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
- RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* ** channels ** */
-
- /* show_red_channel */
- prop = RNA_def_property(srna, "show_red_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_RED);
- RNA_def_property_ui_text(prop, "Show Red Channel", "Show red channel in the frame");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show_green_channel */
- prop = RNA_def_property(srna, "show_green_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_GREEN);
- RNA_def_property_ui_text(prop, "Show Green Channel", "Show green channel in the frame");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* show_blue_channel */
- prop = RNA_def_property(srna, "show_blue_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_BLUE);
- RNA_def_property_ui_text(prop, "Show Blue Channel", "Show blue channel in the frame");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
-
- /* preview_grayscale */
- prop = RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "postproc_flag", MOVIECLIP_PREVIEW_GRAYSCALE);
- RNA_def_property_ui_text(prop, "Grayscale", "Display frame in grayscale mode");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* timeline */
- prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_SECONDS);
- RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* grease pencil source */
- prop = RNA_def_property(srna, "grease_pencil_source", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "gpencil_src");
- RNA_def_property_enum_items(prop, gpencil_source_items);
- RNA_def_property_ui_text(prop, "Grease Pencil Source", "Where the grease pencil comes from");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP);
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* pivot point */
- prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "around");
- RNA_def_property_enum_items(prop, pivot_items);
- RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem view_items[] = {
+ {SC_VIEW_CLIP, "CLIP", ICON_SEQUENCE, "Clip", "Show editing clip preview"},
+ {SC_VIEW_GRAPH, "GRAPH", ICON_GRAPH, "Graph", "Show graph view for active element"},
+ {SC_VIEW_DOPESHEET,
+ "DOPESHEET",
+ ICON_ACTION,
+ "Dopesheet",
+ "Dopesheet view for tracking data"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem gpencil_source_items[] = {
+ {SC_GPENCIL_SRC_CLIP,
+ "CLIP",
+ 0,
+ "Clip",
+ "Show annotation data-block which belongs to movie clip"},
+ {SC_GPENCIL_SRC_TRACK,
+ "TRACK",
+ 0,
+ "Track",
+ "Show annotation data-block which belongs to active track"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem pivot_items[] = {
+ {V3D_AROUND_CENTER_BOUNDS,
+ "BOUNDING_BOX_CENTER",
+ ICON_PIVOT_BOUNDBOX,
+ "Bounding Box Center",
+ "Pivot around bounding box center of selected object(s)"},
+ {V3D_AROUND_CURSOR, "CURSOR", ICON_PIVOT_CURSOR, "2D Cursor", "Pivot around the 2D cursor"},
+ {V3D_AROUND_LOCAL_ORIGINS,
+ "INDIVIDUAL_ORIGINS",
+ ICON_PIVOT_INDIVIDUAL,
+ "Individual Origins",
+ "Pivot around each object's own origin"},
+ {V3D_AROUND_CENTER_MEDIAN,
+ "MEDIAN_POINT",
+ ICON_PIVOT_MEDIAN,
+ "Median Point",
+ "Pivot around the median point of selected objects"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "SpaceClipEditor", "Space");
+ RNA_def_struct_sdna(srna, "SpaceClip");
+ RNA_def_struct_ui_text(srna, "Space Clip Editor", "Clip editor space data");
+
+ /* movieclip */
+ prop = RNA_def_property(srna, "clip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Movie Clip", "Movie clip displayed and edited in this space");
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_SpaceClipEditor_clip_set", NULL, NULL);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* clip user */
+ prop = RNA_def_property(srna, "clip_user", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "MovieClipUser");
+ RNA_def_property_pointer_sdna(prop, NULL, "user");
+ RNA_def_property_ui_text(
+ prop, "Movie Clip User", "Parameters defining which frame of the movie clip is displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* mask */
+ rna_def_space_mask_info(srna, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_mask_set");
+
+ /* mode */
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, rna_enum_clip_editor_mode_items);
+ RNA_def_property_ui_text(prop, "Mode", "Editing context being displayed");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_clip_mode_update");
+
+ /* view */
+ prop = RNA_def_property(srna, "view", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "view");
+ RNA_def_property_enum_items(prop, view_items);
+ RNA_def_property_ui_text(prop, "View", "Type of the clip editor view");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_view_type_update");
+
+ /* show pattern */
+ prop = RNA_def_property(srna, "show_marker_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Marker Pattern", "Show pattern boundbox for markers");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_PATTERN);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show search */
+ prop = RNA_def_property(srna, "show_marker_search", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Marker Search", "Show search boundbox for markers");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_MARKER_SEARCH);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* lock to selection */
+ prop = RNA_def_property(srna, "lock_selection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Lock to Selection", "Lock viewport to selected markers during playback");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_SELECTION);
+ RNA_def_property_update(
+ prop, NC_SPACE | ND_SPACE_CLIP, "rna_SpaceClipEditor_lock_selection_update");
+
+ /* lock to time cursor */
+ prop = RNA_def_property(srna, "lock_time_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "Lock to Time Cursor", "Lock curves view to time cursor during playback and tracking");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_LOCK_TIMECURSOR);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show markers paths */
+ prop = RNA_def_property(srna, "show_track_path", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TRACK_PATH);
+ RNA_def_property_ui_text(prop, "Show Track Path", "Show path of how track moves");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* path length */
+ prop = RNA_def_property(srna, "path_length", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "path_length");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(prop, "Path Length", "Length of displaying path, in frames");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show tiny markers */
+ prop = RNA_def_property(srna, "show_tiny_markers", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Tiny Markers", "Show markers in a more compact manner");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_TINY_MARKER);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show bundles */
+ prop = RNA_def_property(srna, "show_bundles", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Bundles", "Show projection of 3D markers into footage");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_BUNDLES);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* mute footage */
+ prop = RNA_def_property(srna, "use_mute_footage", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Mute Footage", "Mute footage and show black background instead");
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MUTE_FOOTAGE);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* hide disabled */
+ prop = RNA_def_property(srna, "show_disabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Show Disabled", "Show disabled tracks from the footage");
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", SC_HIDE_DISABLED);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ prop = RNA_def_property(srna, "show_metadata", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_METADATA);
+ RNA_def_property_ui_text(prop, "Show Metadata", "Show metadata of clip");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* scopes */
+ prop = RNA_def_property(srna, "scopes", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "scopes");
+ RNA_def_property_struct_type(prop, "MovieClipScopes");
+ RNA_def_property_ui_text(prop, "Scopes", "Scopes to visualize movie clip statistics");
+
+ /* show names */
+ prop = RNA_def_property(srna, "show_names", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_NAMES);
+ RNA_def_property_ui_text(prop, "Show Names", "Show track names and status");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show grid */
+ prop = RNA_def_property(srna, "show_grid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRID);
+ RNA_def_property_ui_text(prop, "Show Grid", "Show grid showing lens distortion");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show stable */
+ prop = RNA_def_property(srna, "show_stable", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_STABLE);
+ RNA_def_property_ui_text(
+ prop, "Show Stable", "Show stable footage in editor (if stabilization is enabled)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* manual calibration */
+ prop = RNA_def_property(srna, "use_manual_calibration", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_MANUAL_CALIBRATION);
+ RNA_def_property_ui_text(prop, "Manual Calibration", "Use manual calibration helpers");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show annotation */
+ prop = RNA_def_property(srna, "show_annotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_ANNOTATION);
+ RNA_def_property_ui_text(prop, "Show Annotation", "Show annotations for this view");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show filters */
+ prop = RNA_def_property(srna, "show_filters", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_FILTERS);
+ RNA_def_property_ui_text(prop, "Show Filters", "Show filters for graph editor");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show graph_frames */
+ prop = RNA_def_property(srna, "show_graph_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_FRAMES);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Frames",
+ "Show curve for per-frame average error (camera motion should be solved first)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show graph tracks motion */
+ prop = RNA_def_property(srna, "show_graph_tracks_motion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS_MOTION);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Tracks Motion",
+ "Display the speed curves (in \"x\" direction red, in \"y\" direction green) "
+ "for the selected tracks");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show graph tracks motion */
+ prop = RNA_def_property(srna, "show_graph_tracks_error", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS_ERROR);
+ RNA_def_property_ui_text(
+ prop, "Show Tracks Error", "Display the reprojection error curve for selected tracks");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show_only_selected */
+ prop = RNA_def_property(srna, "show_graph_only_selected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_SEL_ONLY);
+ RNA_def_property_ui_text(
+ prop, "Only Selected", "Only include channels relating to selected objects and data");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show_hidden */
+ prop = RNA_def_property(srna, "show_graph_hidden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_HIDDEN);
+ RNA_def_property_ui_text(
+ prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
+ RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* ** channels ** */
+
+ /* show_red_channel */
+ prop = RNA_def_property(srna, "show_red_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_RED);
+ RNA_def_property_ui_text(prop, "Show Red Channel", "Show red channel in the frame");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show_green_channel */
+ prop = RNA_def_property(srna, "show_green_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_GREEN);
+ RNA_def_property_ui_text(prop, "Show Green Channel", "Show green channel in the frame");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* show_blue_channel */
+ prop = RNA_def_property(srna, "show_blue_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "postproc_flag", MOVIECLIP_DISABLE_BLUE);
+ RNA_def_property_ui_text(prop, "Show Blue Channel", "Show blue channel in the frame");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
+
+ /* preview_grayscale */
+ prop = RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "postproc_flag", MOVIECLIP_PREVIEW_GRAYSCALE);
+ RNA_def_property_ui_text(prop, "Grayscale", "Display frame in grayscale mode");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* timeline */
+ prop = RNA_def_property(srna, "show_seconds", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_SECONDS);
+ RNA_def_property_ui_text(prop, "Show Seconds", "Show timing in seconds not frames");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* grease pencil source */
+ prop = RNA_def_property(srna, "grease_pencil_source", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "gpencil_src");
+ RNA_def_property_enum_items(prop, gpencil_source_items);
+ RNA_def_property_ui_text(prop, "Grease Pencil Source", "Where the grease pencil comes from");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_MOVIECLIP);
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* pivot point */
+ prop = RNA_def_property(srna, "pivot_point", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "around");
+ RNA_def_property_enum_items(prop, pivot_items);
+ RNA_def_property_ui_text(prop, "Pivot Point", "Pivot center for rotation/scaling");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_CLIP, NULL);
}
-
void RNA_def_space(BlenderRNA *brna)
{
- rna_def_space(brna);
- rna_def_space_image(brna);
- rna_def_space_sequencer(brna);
- rna_def_space_text(brna);
- rna_def_fileselect_params(brna);
- rna_def_filemenu_entry(brna);
- rna_def_space_filebrowser(brna);
- rna_def_space_outliner(brna);
- rna_def_space_view3d(brna);
- rna_def_space_buttons(brna);
- rna_def_space_dopesheet(brna);
- rna_def_space_graph(brna);
- rna_def_space_nla(brna);
- rna_def_space_console(brna);
- rna_def_console_line(brna);
- rna_def_space_info(brna);
- rna_def_space_userpref(brna);
- rna_def_node_tree_path(brna);
- rna_def_space_node(brna);
- rna_def_space_clip(brna);
+ rna_def_space(brna);
+ rna_def_space_image(brna);
+ rna_def_space_sequencer(brna);
+ rna_def_space_text(brna);
+ rna_def_fileselect_params(brna);
+ rna_def_filemenu_entry(brna);
+ rna_def_space_filebrowser(brna);
+ rna_def_space_outliner(brna);
+ rna_def_space_view3d(brna);
+ rna_def_space_buttons(brna);
+ rna_def_space_dopesheet(brna);
+ rna_def_space_graph(brna);
+ rna_def_space_nla(brna);
+ rna_def_space_console(brna);
+ rna_def_console_line(brna);
+ rna_def_space_info(brna);
+ rna_def_space_userpref(brna);
+ rna_def_node_tree_path(brna);
+ rna_def_space_node(brna);
+ rna_def_space_clip(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_space_api.c b/source/blender/makesrna/intern/rna_space_api.c
index 947eff8c73b..58a9429e528 100644
--- a/source/blender/makesrna/intern/rna_space_api.c
+++ b/source/blender/makesrna/intern/rna_space_api.c
@@ -25,90 +25,93 @@
#ifdef RNA_RUNTIME
-#include "BKE_global.h"
+# include "BKE_global.h"
-#include "ED_screen.h"
-#include "ED_text.h"
+# include "ED_screen.h"
+# include "ED_text.h"
static void rna_RegionView3D_update(ID *id, RegionView3D *rv3d, bContext *C)
{
- bScreen *sc = (bScreen *)id;
+ bScreen *sc = (bScreen *)id;
- ScrArea *sa;
- ARegion *ar;
+ ScrArea *sa;
+ ARegion *ar;
- area_region_from_regiondata(sc, rv3d, &sa, &ar);
+ area_region_from_regiondata(sc, rv3d, &sa, &ar);
- if (sa && ar && sa->spacetype == SPACE_VIEW3D) {
- View3D *v3d = sa->spacedata.first;
- wmWindowManager *wm = CTX_wm_manager(C);
- wmWindow *win;
+ if (sa && ar && sa->spacetype == SPACE_VIEW3D) {
+ View3D *v3d = sa->spacedata.first;
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmWindow *win;
- for (win = wm->windows.first; win; win = win->next) {
- if (WM_window_get_active_screen(win) == sc) {
- Scene *scene = WM_window_get_active_scene(win);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
+ for (win = wm->windows.first; win; win = win->next) {
+ if (WM_window_get_active_screen(win) == sc) {
+ Scene *scene = WM_window_get_active_scene(win);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ Depsgraph *depsgraph = BKE_scene_get_depsgraph(scene, view_layer, true);
- ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL);
- break;
- }
- }
- }
+ ED_view3d_update_viewmat(depsgraph, scene, v3d, ar, NULL, NULL, NULL);
+ break;
+ }
+ }
+ }
}
static void rna_SpaceTextEditor_region_location_from_cursor(
- ID *id, SpaceText *st,
- int line, int column, int r_pixel_pos[2])
+ ID *id, SpaceText *st, int line, int column, int r_pixel_pos[2])
{
- bScreen *sc = (bScreen *)id;
- ScrArea *sa = BKE_screen_find_area_from_space(sc, (SpaceLink *)st);
- if (sa) {
- ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
- const int cursor_co[2] = {line, column};
- ED_text_region_location_from_cursor(st, ar, cursor_co, r_pixel_pos);
- }
+ bScreen *sc = (bScreen *)id;
+ ScrArea *sa = BKE_screen_find_area_from_space(sc, (SpaceLink *)st);
+ if (sa) {
+ ARegion *ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
+ const int cursor_co[2] = {line, column};
+ ED_text_region_location_from_cursor(st, ar, cursor_co, r_pixel_pos);
+ }
}
#else
void RNA_api_region_view3d(StructRNA *srna)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = RNA_def_function(srna, "update", "rna_RegionView3D_update");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Recalculate the view matrices");
+ func = RNA_def_function(srna, "update", "rna_RegionView3D_update");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Recalculate the view matrices");
}
void RNA_api_space_node(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "cursor_location_from_region", "rna_SpaceNodeEditor_cursor_location_from_region");
- RNA_def_function_ui_description(func, "Set the cursor location using region coordinates");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(
+ srna, "cursor_location_from_region", "rna_SpaceNodeEditor_cursor_location_from_region");
+ RNA_def_function_ui_description(func, "Set the cursor location using region coordinates");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "x", "Region x coordinate", -10000, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "y", "Region y coordinate", -10000, 10000);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_api_space_text(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "region_location_from_cursor", "rna_SpaceTextEditor_region_location_from_cursor");
- RNA_def_function_ui_description(func, "Retrieve the region position from the given line and character position");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_int(func, "line", 0, INT_MIN, INT_MAX, "Line", "Line index", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "column", 0, INT_MIN, INT_MAX, "Column", "Column index", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int_array(func, "result", 2, NULL, -1, INT_MAX, "", "Region coordinates", -1, INT_MAX);
- RNA_def_function_output(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(
+ srna, "region_location_from_cursor", "rna_SpaceTextEditor_region_location_from_cursor");
+ RNA_def_function_ui_description(
+ func, "Retrieve the region position from the given line and character position");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_int(func, "line", 0, INT_MIN, INT_MAX, "Line", "Line index", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "column", 0, INT_MIN, INT_MAX, "Column", "Column index", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int_array(
+ func, "result", 2, NULL, -1, INT_MAX, "", "Region coordinates", -1, INT_MAX);
+ RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_speaker.c b/source/blender/makesrna/intern/rna_speaker.c
index b589421f6dc..0c63cf5eae8 100644
--- a/source/blender/makesrna/intern/rna_speaker.c
+++ b/source/blender/makesrna/intern/rna_speaker.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include "RNA_define.h"
@@ -33,121 +32,130 @@
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "BKE_main.h"
+# include "BKE_main.h"
-#include "WM_api.h"
-#include "WM_types.h"
+# include "WM_api.h"
+# include "WM_types.h"
#else
static void rna_def_speaker(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Speaker", "ID");
- RNA_def_struct_ui_text(srna, "Speaker", "Speaker data-block for 3D audio speaker objects");
- RNA_def_struct_ui_icon(srna, ICON_SPEAKER);
-
- prop = RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_MUTED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Mute", "Mute the speaker");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- 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_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this speaker");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_sound_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_min_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Maximum Distance",
- "Maximum distance for volume calculation, no matter how far away the object is");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_max_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Reference Distance", "Reference distance at which volume is 100 %");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_reference_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_text(prop, "Attenuation", "How strong the distance affects volume, depending on distance model");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_attenuation_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 360.0f);
- RNA_def_property_ui_text(prop, "Outer Cone Angle",
- "Angle of the outer cone, in degrees, outside this cone the volume is "
- "the outer cone volume, between inner and outer cone the volume is interpolated");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_outer_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 360.0f);
- RNA_def_property_ui_text(prop, "Inner Cone Angle",
- "Angle of the inner cone, in degrees, inside the cone the volume is 100 %");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_inner_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_volume_outer_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.1f, 10.0f);
- RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
- /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL); */
- /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
-
- /* common */
- rna_def_animdata_common(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Speaker", "ID");
+ RNA_def_struct_ui_text(srna, "Speaker", "Speaker data-block for 3D audio speaker objects");
+ RNA_def_struct_ui_icon(srna, ICON_SPEAKER);
+
+ prop = RNA_def_property(srna, "muted", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SPK_MUTED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Mute", "Mute the speaker");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ 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_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Sound", "Sound data-block used by this speaker");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_sound_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "volume_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Maximum Volume", "Maximum volume, no matter how near the object is");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_max_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "volume_min", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Minimum Volume", "Minimum volume, no matter how far away the object is");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_min_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "distance_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Maximum Distance",
+ "Maximum distance for volume calculation, no matter how far away the object is");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_max_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "distance_reference", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Reference Distance", "Reference distance at which volume is 100 %");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_distance_reference_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "attenuation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Attenuation", "How strong the distance affects volume, depending on distance model");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_attenuation_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "cone_angle_outer", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 360.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Outer Cone Angle",
+ "Angle of the outer cone, in degrees, outside this cone the volume is "
+ "the outer cone volume, between inner and outer cone the volume is interpolated");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_outer_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "cone_angle_inner", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 360.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Inner Cone Angle",
+ "Angle of the inner cone, in degrees, inside the cone the volume is 100 %");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_angle_inner_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "cone_volume_outer", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Outer Cone Volume", "Volume outside the outer cone");
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_cone_volume_outer_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "volume", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Volume", "How loud the sound is");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_volume_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ prop = RNA_def_property(srna, "pitch", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.1f, 10.0f);
+ RNA_def_property_ui_text(prop, "Pitch", "Playback pitch of the sound");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_SOUND);
+ /* RNA_def_property_float_funcs(prop, NULL, "rna_Speaker_pitch_set", NULL); */
+ /* RNA_def_property_update(prop, 0, "rna_Speaker_update"); */
+
+ /* common */
+ rna_def_animdata_common(srna);
}
-
void RNA_def_speaker(BlenderRNA *brna)
{
- rna_def_speaker(brna);
+ rna_def_speaker(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_test.c b/source/blender/makesrna/intern/rna_test.c
index e850cf9aec9..f7b9779279d 100644
--- a/source/blender/makesrna/intern/rna_test.c
+++ b/source/blender/makesrna/intern/rna_test.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
/* Defines a structure with properties used for array manipulation tests in BPY. */
#include <stdlib.h>
@@ -30,58 +29,58 @@
#ifdef RNA_RUNTIME
-#ifdef ARRAY_SIZE
-# undef ARRAY_SIZE
-#endif
-
-#define ARRAY_SIZE 3
-#define DYNAMIC_ARRAY_SIZE 64
-#define MARRAY_DIM [3][4][5]
-#define MARRAY_TOTDIM 3
-#define MARRAY_DIMSIZE 4, 5
-#define MARRAY_SIZE(type) (sizeof(type MARRAY_DIM) / sizeof(type))
-#define DYNAMIC_MARRAY_DIM [3][4][5]
-#define DYNAMIC_MARRAY_SIZE(type) (sizeof(type DYNAMIC_MARRAY_DIM) / sizeof(type))
-
-#ifdef UNIT_TEST
-
-#define DEF_VARS(type, prefix) \
- static type prefix ## arr[ARRAY_SIZE]; \
- static type prefix ## darr[DYNAMIC_ARRAY_SIZE]; \
- static int prefix ## darr_len = ARRAY_SIZE; \
- static type prefix ## marr MARRAY_DIM; \
- static type prefix ## dmarr DYNAMIC_MARRAY_DIM; \
- static int prefix ## dmarr_len = sizeof(prefix ## dmarr); \
- (void)0
-
-#define DEF_GET_SET(type, arr) \
- void rna_Test_ ## arr ## _get(PointerRNA *ptr, type * values) \
- { \
- memcpy(values, arr, sizeof(arr)); \
- } \
- \
- void rna_Test_ ## arr ## _set(PointerRNA *ptr, const type * values) \
- { \
- memcpy(arr, values, sizeof(arr)); \
- } \
- ((void)0)
-
-#define DEF_GET_SET_LEN(arr, max) \
- static int rna_Test_ ## arr ## _get_length(PointerRNA * ptr) \
- { \
- return arr ## _len; \
- } \
- \
- static int rna_Test_ ## arr ## _set_length(PointerRNA *ptr, int length) \
- { \
- if (length > max) \
- return 0; \
- \
- arr ## _len = length; \
- \
- return 1; \
- } \
- ((void)0)
+# ifdef ARRAY_SIZE
+# undef ARRAY_SIZE
+# endif
+
+# define ARRAY_SIZE 3
+# define DYNAMIC_ARRAY_SIZE 64
+# define MARRAY_DIM [3][4][5]
+# define MARRAY_TOTDIM 3
+# define MARRAY_DIMSIZE 4, 5
+# define MARRAY_SIZE(type) (sizeof(type MARRAY_DIM) / sizeof(type))
+# define DYNAMIC_MARRAY_DIM [3][4][5]
+# define DYNAMIC_MARRAY_SIZE(type) (sizeof(type DYNAMIC_MARRAY_DIM) / sizeof(type))
+
+# ifdef UNIT_TEST
+
+# define DEF_VARS(type, prefix) \
+ static type prefix##arr[ARRAY_SIZE]; \
+ static type prefix##darr[DYNAMIC_ARRAY_SIZE]; \
+ static int prefix##darr_len = ARRAY_SIZE; \
+ static type prefix##marr MARRAY_DIM; \
+ static type prefix##dmarr DYNAMIC_MARRAY_DIM; \
+ static int prefix##dmarr_len = sizeof(prefix##dmarr); \
+ (void)0
+
+# define DEF_GET_SET(type, arr) \
+ void rna_Test_##arr##_get(PointerRNA *ptr, type *values) \
+ { \
+ memcpy(values, arr, sizeof(arr)); \
+ } \
+\
+ void rna_Test_##arr##_set(PointerRNA *ptr, const type *values) \
+ { \
+ memcpy(arr, values, sizeof(arr)); \
+ } \
+ ((void)0)
+
+# define DEF_GET_SET_LEN(arr, max) \
+ static int rna_Test_##arr##_get_length(PointerRNA *ptr) \
+ { \
+ return arr##_len; \
+ } \
+\
+ static int rna_Test_##arr##_set_length(PointerRNA *ptr, int length) \
+ { \
+ if (length > max) \
+ return 0; \
+\
+ arr##_len = length; \
+\
+ return 1; \
+ } \
+ ((void)0)
DEF_VARS(float, f);
DEF_VARS(int, i);
@@ -109,83 +108,100 @@ DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(int));
DEF_GET_SET(int, bdmarr);
DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(int));
-#endif
+# endif
#else
void RNA_def_test(BlenderRNA *brna)
{
-#ifdef UNIT_TEST
- StructRNA *srna;
- PropertyRNA *prop;
- unsigned short dimsize[] = {MARRAY_DIMSIZE};
-
- srna = RNA_def_struct(brna, "Test", NULL);
- RNA_def_struct_sdna(srna, "Test");
-
- prop = RNA_def_float_array(srna, "farr", ARRAY_SIZE, NULL, 0.0f, 0.0f, "farr", "float array", 0.0f, 0.0f);
- RNA_def_property_float_funcs(prop, "rna_Test_farr_get", "rna_Test_farr_set", NULL);
-
- prop = RNA_def_int_array(srna, "iarr", ARRAY_SIZE, NULL, 0, 0, "iarr", "int array", 0, 0);
- RNA_def_property_int_funcs(prop, "rna_Test_iarr_get", "rna_Test_iarr_set", NULL);
-
- prop = RNA_def_boolean_array(srna, "barr", ARRAY_SIZE, NULL, "barr", "boolean array");
- RNA_def_property_boolean_funcs(prop, "rna_Test_barr_get", "rna_Test_barr_set");
-
- /* dynamic arrays */
-
- prop = RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr",
- "dynamic float array", 0.0f, 0.0f);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length");
- RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL);
-
- prop = RNA_def_int_array(srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idarr_get_length", "rna_Test_idarr_set_length");
- RNA_def_property_int_funcs(prop, "rna_Test_idarr_get", "rna_Test_idarr_set", NULL);
-
- prop = RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array");
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdarr_get_length", "rna_Test_bdarr_set_length");
- RNA_def_property_boolean_funcs(prop, "rna_Test_bdarr_get", "rna_Test_bdarr_set");
-
- /* multidimensional arrays */
-
- prop = RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE);
- RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
- RNA_def_property_float_funcs(prop, "rna_Test_fmarr_get", "rna_Test_fmarr_set", NULL);
-
- prop = RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE);
- RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
- RNA_def_property_int_funcs(prop, "rna_Test_imarr_get", "rna_Test_imarr_set", NULL);
-
- prop = RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
- RNA_def_property_boolean_funcs(prop, "rna_Test_bmarr_get", "rna_Test_bmarr_set");
-
- /* dynamic multidimensional arrays */
-
- prop = RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE);
- RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdmarr_get_length", "rna_Test_fdmarr_set_length");
- RNA_def_property_float_funcs(prop, "rna_Test_fdmarr_get", "rna_Test_fdmarr_set", NULL);
-
- prop = RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE);
- RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idmarr_get_length", "rna_Test_idmarr_set_length");
- RNA_def_property_int_funcs(prop, "rna_Test_idmarr_get", "rna_Test_idmarr_set", NULL);
-
- prop = RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
- RNA_def_property_flag(prop, PROP_DYNAMIC);
- RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length");
- RNA_def_property_boolean_funcs(prop, "rna_Test_bdmarr_get", "rna_Test_bdmarr_set");
-#else
- (void)brna;
-#endif
+# ifdef UNIT_TEST
+ StructRNA *srna;
+ PropertyRNA *prop;
+ unsigned short dimsize[] = {MARRAY_DIMSIZE};
+
+ srna = RNA_def_struct(brna, "Test", NULL);
+ RNA_def_struct_sdna(srna, "Test");
+
+ prop = RNA_def_float_array(
+ srna, "farr", ARRAY_SIZE, NULL, 0.0f, 0.0f, "farr", "float array", 0.0f, 0.0f);
+ RNA_def_property_float_funcs(prop, "rna_Test_farr_get", "rna_Test_farr_set", NULL);
+
+ prop = RNA_def_int_array(srna, "iarr", ARRAY_SIZE, NULL, 0, 0, "iarr", "int array", 0, 0);
+ RNA_def_property_int_funcs(prop, "rna_Test_iarr_get", "rna_Test_iarr_set", NULL);
+
+ prop = RNA_def_boolean_array(srna, "barr", ARRAY_SIZE, NULL, "barr", "boolean array");
+ RNA_def_property_boolean_funcs(prop, "rna_Test_barr_get", "rna_Test_barr_set");
+
+ /* dynamic arrays */
+
+ prop = RNA_def_float_array(srna,
+ "fdarr",
+ DYNAMIC_ARRAY_SIZE,
+ NULL,
+ 0.0f,
+ 0.0f,
+ "fdarr",
+ "dynamic float array",
+ 0.0f,
+ 0.0f);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length");
+ RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL);
+
+ prop = RNA_def_int_array(
+ srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_Test_idarr_get_length", "rna_Test_idarr_set_length");
+ RNA_def_property_int_funcs(prop, "rna_Test_idarr_get", "rna_Test_idarr_set", NULL);
+
+ prop = RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array");
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_Test_bdarr_get_length", "rna_Test_bdarr_set_length");
+ RNA_def_property_boolean_funcs(prop, "rna_Test_bdarr_get", "rna_Test_bdarr_set");
+
+ /* multidimensional arrays */
+
+ prop = RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
+ RNA_def_property_float_funcs(prop, "rna_Test_fmarr_get", "rna_Test_fmarr_set", NULL);
+
+ prop = RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE);
+ RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+ RNA_def_property_int_funcs(prop, "rna_Test_imarr_get", "rna_Test_imarr_set", NULL);
+
+ prop = RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+ RNA_def_property_boolean_funcs(prop, "rna_Test_bmarr_get", "rna_Test_bmarr_set");
+
+ /* dynamic multidimensional arrays */
+
+ prop = RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_multidimensional_array(
+ prop, DYNAMIC_MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_Test_fdmarr_get_length", "rna_Test_fdmarr_set_length");
+ RNA_def_property_float_funcs(prop, "rna_Test_fdmarr_get", "rna_Test_fdmarr_set", NULL);
+
+ prop = RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE);
+ RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_Test_idmarr_get_length", "rna_Test_idmarr_set_length");
+ RNA_def_property_int_funcs(prop, "rna_Test_idmarr_get", "rna_Test_idmarr_set", NULL);
+
+ prop = RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+ RNA_def_property_flag(prop, PROP_DYNAMIC);
+ RNA_def_property_dynamic_array_funcs(
+ prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length");
+ RNA_def_property_boolean_funcs(prop, "rna_Test_bdmarr_get", "rna_Test_bdmarr_set");
+# else
+ (void)brna;
+# endif
}
-#endif /* RNA_RUNTIME */
+#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_text.c b/source/blender/makesrna/intern/rna_text.c
index 527687e6c78..5b75937ce72 100644
--- a/source/blender/makesrna/intern/rna_text.c
+++ b/source/blender/makesrna/intern/rna_text.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <limits.h>
@@ -40,183 +39,196 @@
static void rna_Text_filename_get(PointerRNA *ptr, char *value)
{
- Text *text = (Text *)ptr->data;
+ Text *text = (Text *)ptr->data;
- if (text->name)
- strcpy(value, text->name);
- else
- value[0] = '\0';
+ if (text->name)
+ strcpy(value, text->name);
+ else
+ value[0] = '\0';
}
static int rna_Text_filename_length(PointerRNA *ptr)
{
- Text *text = (Text *)ptr->data;
- return (text->name) ? strlen(text->name) : 0;
+ Text *text = (Text *)ptr->data;
+ return (text->name) ? strlen(text->name) : 0;
}
static void rna_Text_filename_set(PointerRNA *ptr, const char *value)
{
- Text *text = (Text *)ptr->data;
+ Text *text = (Text *)ptr->data;
- if (text->name)
- MEM_freeN(text->name);
+ if (text->name)
+ MEM_freeN(text->name);
- if (value[0])
- text->name = BLI_strdup(value);
- else
- text->name = NULL;
+ if (value[0])
+ text->name = BLI_strdup(value);
+ else
+ text->name = NULL;
}
static bool rna_Text_modified_get(PointerRNA *ptr)
{
- Text *text = (Text *)ptr->data;
- return BKE_text_file_modified_check(text) != 0;
+ Text *text = (Text *)ptr->data;
+ return BKE_text_file_modified_check(text) != 0;
}
static int rna_Text_current_line_index_get(PointerRNA *ptr)
{
- Text *text = (Text *)ptr->data;
- return BLI_findindex(&text->lines, text->curl);
+ Text *text = (Text *)ptr->data;
+ return BLI_findindex(&text->lines, text->curl);
}
static void rna_Text_current_line_index_set(PointerRNA *ptr, int value)
{
- Text *text = (Text *)ptr->data;
- txt_move_toline(text, value, 0);
+ Text *text = (Text *)ptr->data;
+ txt_move_toline(text, value, 0);
}
static void rna_TextLine_body_get(PointerRNA *ptr, char *value)
{
- TextLine *line = (TextLine *)ptr->data;
+ TextLine *line = (TextLine *)ptr->data;
- if (line->line)
- strcpy(value, line->line);
- else
- value[0] = '\0';
+ if (line->line)
+ strcpy(value, line->line);
+ else
+ value[0] = '\0';
}
static int rna_TextLine_body_length(PointerRNA *ptr)
{
- TextLine *line = (TextLine *)ptr->data;
- return line->len;
+ TextLine *line = (TextLine *)ptr->data;
+ return line->len;
}
static void rna_TextLine_body_set(PointerRNA *ptr, const char *value)
{
- TextLine *line = (TextLine *)ptr->data;
- int len = strlen(value);
+ TextLine *line = (TextLine *)ptr->data;
+ int len = strlen(value);
- if (line->line)
- MEM_freeN(line->line);
+ if (line->line)
+ MEM_freeN(line->line);
- line->line = MEM_mallocN((len + 1) * sizeof(char), "rna_text_body");
- line->len = len;
- memcpy(line->line, value, len + 1);
+ line->line = MEM_mallocN((len + 1) * sizeof(char), "rna_text_body");
+ line->len = len;
+ memcpy(line->line, value, len + 1);
- if (line->format) {
- MEM_freeN(line->format);
- line->format = NULL;
- }
+ if (line->format) {
+ MEM_freeN(line->format);
+ line->format = NULL;
+ }
}
#else
static void rna_def_text_line(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TextLine", NULL);
- RNA_def_struct_ui_text(srna, "Text Line", "Line of text in a Text data-block");
-
- prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_TextLine_body_get", "rna_TextLine_body_length", "rna_TextLine_body_set");
- RNA_def_property_ui_text(prop, "Line", "Text in the line");
- RNA_def_property_update(prop, NC_TEXT | NA_EDITED, NULL);
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TextLine", NULL);
+ RNA_def_struct_ui_text(srna, "Text Line", "Line of text in a Text data-block");
+
+ prop = RNA_def_property(srna, "body", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_TextLine_body_get", "rna_TextLine_body_length", "rna_TextLine_body_set");
+ RNA_def_property_ui_text(prop, "Line", "Text in the line");
+ RNA_def_property_update(prop, NC_TEXT | NA_EDITED, NULL);
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_TEXT);
}
static void rna_def_text(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Text", "ID");
- RNA_def_struct_ui_text(srna, "Text", "Text data-block referencing an external or packed text file");
- RNA_def_struct_ui_icon(srna, ICON_TEXT);
- RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
-
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set");
- RNA_def_property_ui_text(prop, "File Path", "Filename of the text file");
-
- prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISDIRTY);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Dirty", "Text file has been edited since last save");
-
- prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Text_modified_get", NULL);
- RNA_def_property_ui_text(prop, "Modified", "Text file on disk is different than the one in memory");
-
- prop = RNA_def_property(srna, "is_in_memory", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISMEM);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Memory", "Text file is in memory, without a corresponding file on disk");
-
- prop = RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT);
- RNA_def_property_ui_text(prop, "Register",
- "Register this text as a module on loading, Text name must end with \".py\"");
-
- prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES);
- RNA_def_property_ui_text(prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces");
-
- prop = RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "TextLine");
- RNA_def_property_ui_text(prop, "Lines", "Lines of text");
-
- prop = RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "curl");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "TextLine");
- RNA_def_property_ui_text(prop, "Current Line", "Current line, and start line of selection if one exists");
-
- prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "curc");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Current Character",
- "Index of current character in current line, and also start index of "
- "character in selection if one exists");
-
- prop = RNA_def_property(srna, "current_line_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_funcs(prop, "rna_Text_current_line_index_get", "rna_Text_current_line_index_set", NULL);
- RNA_def_property_ui_text(prop, "Current Line Index", "Index of current TextLine in TextLine collection");
- RNA_def_property_update(prop, NC_TEXT | ND_CURSOR, NULL);
-
- prop = RNA_def_property(srna, "select_end_line", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "sell");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "TextLine");
- RNA_def_property_ui_text(prop, "Selection End Line", "End line of selection");
-
- prop = RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "selc");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Selection End Character",
- "Index of character after end of selection in the selection end line");
-
- RNA_api_text(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Text", "ID");
+ RNA_def_struct_ui_text(
+ srna, "Text", "Text data-block referencing an external or packed text file");
+ RNA_def_struct_ui_icon(srna, ICON_TEXT);
+ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_Text_filename_get", "rna_Text_filename_length", "rna_Text_filename_set");
+ RNA_def_property_ui_text(prop, "File Path", "Filename of the text file");
+
+ prop = RNA_def_property(srna, "is_dirty", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISDIRTY);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Dirty", "Text file has been edited since last save");
+
+ prop = RNA_def_property(srna, "is_modified", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Text_modified_get", NULL);
+ RNA_def_property_ui_text(
+ prop, "Modified", "Text file on disk is different than the one in memory");
+
+ prop = RNA_def_property(srna, "is_in_memory", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISMEM);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Memory", "Text file is in memory, without a corresponding file on disk");
+
+ prop = RNA_def_property(srna, "use_module", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_ISSCRIPT);
+ RNA_def_property_ui_text(
+ prop,
+ "Register",
+ "Register this text as a module on loading, Text name must end with \".py\"");
+
+ prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", TXT_TABSTOSPACES);
+ RNA_def_property_ui_text(
+ prop, "Tabs as Spaces", "Automatically converts all new tabs into spaces");
+
+ prop = RNA_def_property(srna, "lines", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "TextLine");
+ RNA_def_property_ui_text(prop, "Lines", "Lines of text");
+
+ prop = RNA_def_property(srna, "current_line", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "curl");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "TextLine");
+ RNA_def_property_ui_text(
+ prop, "Current Line", "Current line, and start line of selection if one exists");
+
+ prop = RNA_def_property(srna, "current_character", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "curc");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop,
+ "Current Character",
+ "Index of current character in current line, and also start index of "
+ "character in selection if one exists");
+
+ prop = RNA_def_property(srna, "current_line_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_funcs(
+ prop, "rna_Text_current_line_index_get", "rna_Text_current_line_index_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Current Line Index", "Index of current TextLine in TextLine collection");
+ RNA_def_property_update(prop, NC_TEXT | ND_CURSOR, NULL);
+
+ prop = RNA_def_property(srna, "select_end_line", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "sell");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "TextLine");
+ RNA_def_property_ui_text(prop, "Selection End Line", "End line of selection");
+
+ prop = RNA_def_property(srna, "select_end_character", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "selc");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop,
+ "Selection End Character",
+ "Index of character after end of selection in the selection end line");
+
+ RNA_api_text(srna);
}
void RNA_def_text(BlenderRNA *brna)
{
- rna_def_text_line(brna);
- rna_def_text(brna);
+ rna_def_text_line(brna);
+ rna_def_text(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_text_api.c b/source/blender/makesrna/intern/rna_text_api.c
index 3ea10ea6c69..ad36a56ac6a 100644
--- a/source/blender/makesrna/intern/rna_text_api.c
+++ b/source/blender/makesrna/intern/rna_text_api.c
@@ -25,39 +25,40 @@
#include "RNA_define.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "WM_api.h"
-#include "WM_types.h"
+# include "WM_api.h"
+# include "WM_types.h"
static void rna_Text_clear(Text *text)
{
- BKE_text_clear(text, NULL);
- WM_main_add_notifier(NC_TEXT | NA_EDITED, text);
+ BKE_text_clear(text, NULL);
+ WM_main_add_notifier(NC_TEXT | NA_EDITED, text);
}
static void rna_Text_write(Text *text, const char *str)
{
- BKE_text_write(text, NULL, str);
- WM_main_add_notifier(NC_TEXT | NA_EDITED, text);
+ BKE_text_write(text, NULL, str);
+ WM_main_add_notifier(NC_TEXT | NA_EDITED, text);
}
#else
void RNA_api_text(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- func = RNA_def_function(srna, "clear", "rna_Text_clear");
- RNA_def_function_ui_description(func, "clear the text block");
+ func = RNA_def_function(srna, "clear", "rna_Text_clear");
+ RNA_def_function_ui_description(func, "clear the text block");
- func = RNA_def_function(srna, "write", "rna_Text_write");
- RNA_def_function_ui_description(func, "write text at the cursor location and advance to the end of the text block");
- parm = RNA_def_string(func, "text", "Text", 0, "", "New text for this data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ func = RNA_def_function(srna, "write", "rna_Text_write");
+ RNA_def_function_ui_description(
+ func, "write text at the cursor location and advance to the end of the text block");
+ parm = RNA_def_string(func, "text", "Text", 0, "", "New text for this data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c
index ca1859895f5..17e01899e26 100644
--- a/source/blender/makesrna/intern/rna_texture.c
+++ b/source/blender/makesrna/intern/rna_texture.c
@@ -47,1484 +47,1599 @@
#ifndef RNA_RUNTIME
static const EnumPropertyItem texture_filter_items[] = {
- {TXF_BOX, "BOX", 0, "Box", ""},
- {TXF_EWA, "EWA", 0, "EWA", ""},
- {TXF_FELINE, "FELINE", 0, "FELINE", ""},
- {TXF_AREA, "AREA", 0, "Area", ""},
- {0, NULL, 0, NULL, NULL},
+ {TXF_BOX, "BOX", 0, "Box", ""},
+ {TXF_EWA, "EWA", 0, "EWA", ""},
+ {TXF_FELINE, "FELINE", 0, "FELINE", ""},
+ {TXF_AREA, "AREA", 0, "Area", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_texture_type_items[] = {
- {0, "NONE", 0, "None", ""},
- {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - create a ramp texture"},
- {TEX_CLOUDS, "CLOUDS", ICON_TEXTURE, "Clouds", "Procedural - create a cloud-like fractal noise texture"},
- {TEX_DISTNOISE, "DISTORTED_NOISE", ICON_TEXTURE,
- "Distorted Noise", "Procedural - noise texture distorted by two noise algorithms"},
- {TEX_IMAGE, "IMAGE", ICON_IMAGE_DATA, "Image or Movie", "Allow for images or movies to be used as textures"},
- {TEX_MAGIC, "MAGIC", ICON_TEXTURE, "Magic", "Procedural - color texture based on trigonometric functions"},
- {TEX_MARBLE, "MARBLE", ICON_TEXTURE, "Marble", "Procedural - marble-like noise texture with wave generated bands"},
- {TEX_MUSGRAVE, "MUSGRAVE", ICON_TEXTURE, "Musgrave", "Procedural - highly flexible fractal noise texture"},
- {TEX_NOISE, "NOISE", ICON_TEXTURE, "Noise",
- "Procedural - random noise, gives a different result every time, for every frame, for every pixel"},
- {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
- {TEX_VORONOI, "VORONOI", ICON_TEXTURE, "Voronoi", "Procedural - create cell-like patterns based on Worley noise"},
- {TEX_WOOD, "WOOD", ICON_TEXTURE, "Wood", "Procedural - wave generated bands or rings, with optional noise"},
- {0, NULL, 0, NULL, NULL},
+ {0, "NONE", 0, "None", ""},
+ {TEX_BLEND, "BLEND", ICON_TEXTURE, "Blend", "Procedural - create a ramp texture"},
+ {TEX_CLOUDS,
+ "CLOUDS",
+ ICON_TEXTURE,
+ "Clouds",
+ "Procedural - create a cloud-like fractal noise texture"},
+ {TEX_DISTNOISE,
+ "DISTORTED_NOISE",
+ ICON_TEXTURE,
+ "Distorted Noise",
+ "Procedural - noise texture distorted by two noise algorithms"},
+ {TEX_IMAGE,
+ "IMAGE",
+ ICON_IMAGE_DATA,
+ "Image or Movie",
+ "Allow for images or movies to be used as textures"},
+ {TEX_MAGIC,
+ "MAGIC",
+ ICON_TEXTURE,
+ "Magic",
+ "Procedural - color texture based on trigonometric functions"},
+ {TEX_MARBLE,
+ "MARBLE",
+ ICON_TEXTURE,
+ "Marble",
+ "Procedural - marble-like noise texture with wave generated bands"},
+ {TEX_MUSGRAVE,
+ "MUSGRAVE",
+ ICON_TEXTURE,
+ "Musgrave",
+ "Procedural - highly flexible fractal noise texture"},
+ {TEX_NOISE,
+ "NOISE",
+ ICON_TEXTURE,
+ "Noise",
+ "Procedural - random noise, gives a different result every time, for every frame, for every "
+ "pixel"},
+ {TEX_STUCCI, "STUCCI", ICON_TEXTURE, "Stucci", "Procedural - create a fractal noise texture"},
+ {TEX_VORONOI,
+ "VORONOI",
+ ICON_TEXTURE,
+ "Voronoi",
+ "Procedural - create cell-like patterns based on Worley noise"},
+ {TEX_WOOD,
+ "WOOD",
+ ICON_TEXTURE,
+ "Wood",
+ "Procedural - wave generated bands or rings, with optional noise"},
+ {0, NULL, 0, NULL, NULL},
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem blend_type_items[] = {
- {MTEX_BLEND, "MIX", 0, "Mix", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MTEX_DARK, "DARKEN", 0, "Darken", ""},
- {MTEX_MUL, "MULTIPLY", 0, "Multiply", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MTEX_LIGHT, "LIGHTEN", 0, "Lighten", ""},
- {MTEX_SCREEN, "SCREEN", 0, "Screen", ""},
- {MTEX_ADD, "ADD", 0, "Add", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MTEX_OVERLAY, "OVERLAY", 0, "Overlay", ""},
- {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
- {MTEX_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MTEX_DIFF, "DIFFERENCE", 0, "Difference", ""},
- {MTEX_SUB, "SUBTRACT", 0, "Subtract", ""},
- {MTEX_DIV, "DIVIDE", 0, "Divide", ""},
- {0, "", ICON_NONE, NULL, NULL},
- {MTEX_BLEND_HUE, "HUE", 0, "Hue", ""},
- {MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
- {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
- {MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
- {0, NULL, 0, NULL, NULL},
+ {MTEX_BLEND, "MIX", 0, "Mix", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MTEX_DARK, "DARKEN", 0, "Darken", ""},
+ {MTEX_MUL, "MULTIPLY", 0, "Multiply", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MTEX_LIGHT, "LIGHTEN", 0, "Lighten", ""},
+ {MTEX_SCREEN, "SCREEN", 0, "Screen", ""},
+ {MTEX_ADD, "ADD", 0, "Add", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MTEX_OVERLAY, "OVERLAY", 0, "Overlay", ""},
+ {MTEX_SOFT_LIGHT, "SOFT_LIGHT", 0, "Soft Light", ""},
+ {MTEX_LIN_LIGHT, "LINEAR_LIGHT", 0, "Linear Light", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MTEX_DIFF, "DIFFERENCE", 0, "Difference", ""},
+ {MTEX_SUB, "SUBTRACT", 0, "Subtract", ""},
+ {MTEX_DIV, "DIVIDE", 0, "Divide", ""},
+ {0, "", ICON_NONE, NULL, NULL},
+ {MTEX_BLEND_HUE, "HUE", 0, "Hue", ""},
+ {MTEX_BLEND_SAT, "SATURATION", 0, "Saturation", ""},
+ {MTEX_BLEND_COLOR, "COLOR", 0, "Color", ""},
+ {MTEX_BLEND_VAL, "VALUE", 0, "Value", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "BKE_colorband.h"
-#include "BKE_context.h"
-#include "BKE_image.h"
-#include "BKE_texture.h"
-#include "BKE_main.h"
+# include "BKE_colorband.h"
+# include "BKE_context.h"
+# include "BKE_image.h"
+# include "BKE_texture.h"
+# include "BKE_main.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "ED_node.h"
-#include "ED_render.h"
+# include "ED_node.h"
+# include "ED_render.h"
static StructRNA *rna_Texture_refine(struct PointerRNA *ptr)
{
- Tex *tex = (Tex *)ptr->data;
-
- switch (tex->type) {
- case TEX_BLEND:
- return &RNA_BlendTexture;
- case TEX_CLOUDS:
- return &RNA_CloudsTexture;
- case TEX_DISTNOISE:
- return &RNA_DistortedNoiseTexture;
- case TEX_IMAGE:
- return &RNA_ImageTexture;
- case TEX_MAGIC:
- return &RNA_MagicTexture;
- case TEX_MARBLE:
- return &RNA_MarbleTexture;
- case TEX_MUSGRAVE:
- return &RNA_MusgraveTexture;
- case TEX_NOISE:
- return &RNA_NoiseTexture;
- case TEX_STUCCI:
- return &RNA_StucciTexture;
- case TEX_VORONOI:
- return &RNA_VoronoiTexture;
- case TEX_WOOD:
- return &RNA_WoodTexture;
- default:
- return &RNA_Texture;
- }
+ Tex *tex = (Tex *)ptr->data;
+
+ switch (tex->type) {
+ case TEX_BLEND:
+ return &RNA_BlendTexture;
+ case TEX_CLOUDS:
+ return &RNA_CloudsTexture;
+ case TEX_DISTNOISE:
+ return &RNA_DistortedNoiseTexture;
+ case TEX_IMAGE:
+ return &RNA_ImageTexture;
+ case TEX_MAGIC:
+ return &RNA_MagicTexture;
+ case TEX_MARBLE:
+ return &RNA_MarbleTexture;
+ case TEX_MUSGRAVE:
+ return &RNA_MusgraveTexture;
+ case TEX_NOISE:
+ return &RNA_NoiseTexture;
+ case TEX_STUCCI:
+ return &RNA_StucciTexture;
+ case TEX_VORONOI:
+ return &RNA_VoronoiTexture;
+ case TEX_WOOD:
+ return &RNA_WoodTexture;
+ default:
+ return &RNA_Texture;
+ }
}
static void rna_Texture_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- ID *id = ptr->id.data;
-
- if (GS(id->name) == ID_TE) {
- Tex *tex = ptr->id.data;
-
- DEG_id_tag_update(&tex->id, 0);
- DEG_id_tag_update(&tex->id, ID_RECALC_EDITORS);
- WM_main_add_notifier(NC_TEXTURE, tex);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, NULL);
- }
- else if (GS(id->name) == ID_NT) {
- bNodeTree *ntree = ptr->id.data;
- ED_node_tag_update_nodetree(bmain, ntree, NULL);
- }
+ ID *id = ptr->id.data;
+
+ if (GS(id->name) == ID_TE) {
+ Tex *tex = ptr->id.data;
+
+ DEG_id_tag_update(&tex->id, 0);
+ DEG_id_tag_update(&tex->id, ID_RECALC_EDITORS);
+ WM_main_add_notifier(NC_TEXTURE, tex);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, NULL);
+ }
+ else if (GS(id->name) == ID_NT) {
+ bNodeTree *ntree = ptr->id.data;
+ ED_node_tag_update_nodetree(bmain, ntree, NULL);
+ }
}
static void rna_Texture_mapping_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- TexMapping *texmap = ptr->data;
- BKE_texture_mapping_init(texmap);
- rna_Texture_update(bmain, scene, ptr);
+ TexMapping *texmap = ptr->data;
+ BKE_texture_mapping_init(texmap);
+ rna_Texture_update(bmain, scene, ptr);
}
-static void rna_Color_mapping_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_Color_mapping_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- /* nothing to do */
+ /* nothing to do */
}
/* Used for Texture Properties, used (also) for/in Nodes */
static void rna_Texture_nodes_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- Tex *tex = ptr->id.data;
+ Tex *tex = ptr->id.data;
- DEG_id_tag_update(&tex->id, 0);
- DEG_id_tag_update(&tex->id, ID_RECALC_EDITORS);
- WM_main_add_notifier(NC_TEXTURE | ND_NODES, tex);
+ DEG_id_tag_update(&tex->id, 0);
+ DEG_id_tag_update(&tex->id, ID_RECALC_EDITORS);
+ WM_main_add_notifier(NC_TEXTURE | ND_NODES, tex);
}
static void rna_Texture_type_set(PointerRNA *ptr, int value)
{
- Tex *tex = (Tex *)ptr->data;
+ Tex *tex = (Tex *)ptr->data;
- BKE_texture_type_set(tex, value);
+ BKE_texture_type_set(tex, value);
}
void rna_TextureSlot_update(bContext *C, PointerRNA *ptr)
{
- ID *id = ptr->id.data;
-
- DEG_id_tag_update(id, 0);
-
- switch (GS(id->name)) {
- case ID_MA:
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING, id);
- WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, id);
- break;
- case ID_WO:
- WM_main_add_notifier(NC_WORLD, id);
- break;
- case ID_LA:
- WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id);
- WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
- break;
- case ID_BR:
- {
- Scene *scene = CTX_data_scene(C);
- MTex *mtex = ptr->data;
- ViewLayer *view_layer = CTX_data_view_layer(C);
- BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex);
- WM_main_add_notifier(NC_BRUSH, id);
- break;
- }
- case ID_LS:
- WM_main_add_notifier(NC_LINESTYLE, id);
- break;
- case ID_PA:
- {
- MTex *mtex = ptr->data;
- int recalc = ID_RECALC_GEOMETRY;
-
- if (mtex->mapto & PAMAP_INIT)
- recalc |= ID_RECALC_PSYS_RESET;
- if (mtex->mapto & PAMAP_CHILD)
- recalc |= ID_RECALC_PSYS_CHILD;
-
- DEG_id_tag_update(id, recalc);
- WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
- break;
- }
- default:
- break;
- }
+ ID *id = ptr->id.data;
+
+ DEG_id_tag_update(id, 0);
+
+ switch (GS(id->name)) {
+ case ID_MA:
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING, id);
+ WM_main_add_notifier(NC_MATERIAL | ND_SHADING_DRAW, id);
+ break;
+ case ID_WO:
+ WM_main_add_notifier(NC_WORLD, id);
+ break;
+ case ID_LA:
+ WM_main_add_notifier(NC_LAMP | ND_LIGHTING, id);
+ WM_main_add_notifier(NC_LAMP | ND_LIGHTING_DRAW, id);
+ break;
+ case ID_BR: {
+ Scene *scene = CTX_data_scene(C);
+ MTex *mtex = ptr->data;
+ ViewLayer *view_layer = CTX_data_view_layer(C);
+ BKE_paint_invalidate_overlay_tex(scene, view_layer, mtex->tex);
+ WM_main_add_notifier(NC_BRUSH, id);
+ break;
+ }
+ case ID_LS:
+ WM_main_add_notifier(NC_LINESTYLE, id);
+ break;
+ case ID_PA: {
+ MTex *mtex = ptr->data;
+ int recalc = ID_RECALC_GEOMETRY;
+
+ if (mtex->mapto & PAMAP_INIT)
+ recalc |= ID_RECALC_PSYS_RESET;
+ if (mtex->mapto & PAMAP_CHILD)
+ recalc |= ID_RECALC_PSYS_CHILD;
+
+ DEG_id_tag_update(id, recalc);
+ WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, NULL);
+ break;
+ }
+ default:
+ break;
+ }
}
char *rna_TextureSlot_path(PointerRNA *ptr)
{
- MTex *mtex = ptr->data;
-
- /* if there is ID-data, resolve the path using the index instead of by name,
- * since the name used is the name of the texture assigned, but the texture
- * may be used multiple times in the same stack
- */
- if (ptr->id.data) {
- if (GS(((ID *)ptr->id.data)->name) == ID_BR) {
- return BLI_strdup("texture_slot");
- }
- else {
- PointerRNA id_ptr;
- PropertyRNA *prop;
-
- /* find the 'textures' property of the ID-struct */
- RNA_id_pointer_create(ptr->id.data, &id_ptr);
- prop = RNA_struct_find_property(&id_ptr, "texture_slots");
-
- /* get an iterator for this property, and try to find the relevant index */
- if (prop) {
- int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
-
- if (index != -1) {
- return BLI_sprintfN("texture_slots[%d]", index);
- }
- }
- }
- }
-
- /* this is a compromise for the remaining cases... */
- if (mtex->tex) {
- char name_esc[(sizeof(mtex->tex->id.name) - 2) * 2];
-
- BLI_strescape(name_esc, mtex->tex->id.name + 2, sizeof(name_esc));
- return BLI_sprintfN("texture_slots[\"%s\"]", name_esc);
- }
- else {
- return BLI_strdup("texture_slots[0]");
- }
+ MTex *mtex = ptr->data;
+
+ /* if there is ID-data, resolve the path using the index instead of by name,
+ * since the name used is the name of the texture assigned, but the texture
+ * may be used multiple times in the same stack
+ */
+ if (ptr->id.data) {
+ if (GS(((ID *)ptr->id.data)->name) == ID_BR) {
+ return BLI_strdup("texture_slot");
+ }
+ else {
+ PointerRNA id_ptr;
+ PropertyRNA *prop;
+
+ /* find the 'textures' property of the ID-struct */
+ RNA_id_pointer_create(ptr->id.data, &id_ptr);
+ prop = RNA_struct_find_property(&id_ptr, "texture_slots");
+
+ /* get an iterator for this property, and try to find the relevant index */
+ if (prop) {
+ int index = RNA_property_collection_lookup_index(&id_ptr, prop, ptr);
+
+ if (index != -1) {
+ return BLI_sprintfN("texture_slots[%d]", index);
+ }
+ }
+ }
+ }
+
+ /* this is a compromise for the remaining cases... */
+ if (mtex->tex) {
+ char name_esc[(sizeof(mtex->tex->id.name) - 2) * 2];
+
+ BLI_strescape(name_esc, mtex->tex->id.name + 2, sizeof(name_esc));
+ return BLI_sprintfN("texture_slots[\"%s\"]", name_esc);
+ }
+ else {
+ return BLI_strdup("texture_slots[0]");
+ }
}
static int rna_TextureSlot_name_length(PointerRNA *ptr)
{
- MTex *mtex = ptr->data;
+ MTex *mtex = ptr->data;
- if (mtex->tex)
- return strlen(mtex->tex->id.name + 2);
+ if (mtex->tex)
+ return strlen(mtex->tex->id.name + 2);
- return 0;
+ return 0;
}
static void rna_TextureSlot_name_get(PointerRNA *ptr, char *str)
{
- MTex *mtex = ptr->data;
+ MTex *mtex = ptr->data;
- if (mtex->tex)
- strcpy(str, mtex->tex->id.name + 2);
- else
- str[0] = '\0';
+ if (mtex->tex)
+ strcpy(str, mtex->tex->id.name + 2);
+ else
+ str[0] = '\0';
}
static int rna_TextureSlot_output_node_get(PointerRNA *ptr)
{
- MTex *mtex = ptr->data;
- Tex *tex = mtex->tex;
- int cur = mtex->which_output;
-
- if (tex) {
- bNodeTree *ntree = tex->nodetree;
- bNode *node;
- if (ntree) {
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->type == TEX_NODE_OUTPUT) {
- if (cur == node->custom1)
- return cur;
- }
- }
- }
- }
-
- mtex->which_output = 0;
- return 0;
+ MTex *mtex = ptr->data;
+ Tex *tex = mtex->tex;
+ int cur = mtex->which_output;
+
+ if (tex) {
+ bNodeTree *ntree = tex->nodetree;
+ bNode *node;
+ if (ntree) {
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == TEX_NODE_OUTPUT) {
+ if (cur == node->custom1)
+ return cur;
+ }
+ }
+ }
+ }
+
+ mtex->which_output = 0;
+ return 0;
}
-
-static const EnumPropertyItem *rna_TextureSlot_output_node_itemf(
- bContext *UNUSED(C), PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_TextureSlot_output_node_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- MTex *mtex = ptr->data;
- Tex *tex = mtex->tex;
- EnumPropertyItem *item = NULL;
- int totitem = 0;
-
- if (tex) {
- bNodeTree *ntree = tex->nodetree;
- if (ntree) {
- EnumPropertyItem tmp = {0, "", 0, "", ""};
- bNode *node;
-
- tmp.value = 0;
- tmp.name = "Not Specified";
- tmp.identifier = "NOT_SPECIFIED";
- RNA_enum_item_add(&item, &totitem, &tmp);
-
- for (node = ntree->nodes.first; node; node = node->next) {
- if (node->type == TEX_NODE_OUTPUT) {
- tmp.value = node->custom1;
- tmp.name = ((TexNodeOutput *)node->storage)->name;
- tmp.identifier = tmp.name;
- RNA_enum_item_add(&item, &totitem, &tmp);
- }
- }
- }
- }
-
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
-
- return item;
+ MTex *mtex = ptr->data;
+ Tex *tex = mtex->tex;
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
+
+ if (tex) {
+ bNodeTree *ntree = tex->nodetree;
+ if (ntree) {
+ EnumPropertyItem tmp = {0, "", 0, "", ""};
+ bNode *node;
+
+ tmp.value = 0;
+ tmp.name = "Not Specified";
+ tmp.identifier = "NOT_SPECIFIED";
+ RNA_enum_item_add(&item, &totitem, &tmp);
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (node->type == TEX_NODE_OUTPUT) {
+ tmp.value = node->custom1;
+ tmp.name = ((TexNodeOutput *)node->storage)->name;
+ tmp.identifier = tmp.name;
+ RNA_enum_item_add(&item, &totitem, &tmp);
+ }
+ }
+ }
+ }
+
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
+
+ return item;
}
static void rna_Texture_use_color_ramp_set(PointerRNA *ptr, bool value)
{
- Tex *tex = (Tex *)ptr->data;
+ Tex *tex = (Tex *)ptr->data;
- if (value) tex->flag |= TEX_COLORBAND;
- else tex->flag &= ~TEX_COLORBAND;
+ if (value)
+ tex->flag |= TEX_COLORBAND;
+ else
+ tex->flag &= ~TEX_COLORBAND;
- if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
- tex->coba = BKE_colorband_add(false);
+ if ((tex->flag & TEX_COLORBAND) && tex->coba == NULL)
+ tex->coba = BKE_colorband_add(false);
}
static void rna_Texture_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- Tex *tex = (Tex *)ptr->data;
+ Tex *tex = (Tex *)ptr->data;
- if (tex->use_nodes) {
- tex->type = 0;
+ if (tex->use_nodes) {
+ tex->type = 0;
- if (tex->nodetree == NULL)
- ED_node_texture_default(C, tex);
- }
+ if (tex->nodetree == NULL)
+ ED_node_texture_default(C, tex);
+ }
- rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr);
+ rna_Texture_nodes_update(CTX_data_main(C), CTX_data_scene(C), ptr);
}
static void rna_ImageTexture_mipmap_set(PointerRNA *ptr, bool value)
{
- Tex *tex = (Tex *)ptr->data;
+ Tex *tex = (Tex *)ptr->data;
- if (value) tex->imaflag |= TEX_MIPMAP;
- else tex->imaflag &= ~TEX_MIPMAP;
+ if (value)
+ tex->imaflag |= TEX_MIPMAP;
+ else
+ tex->imaflag &= ~TEX_MIPMAP;
}
#else
static void rna_def_texmapping(BlenderRNA *brna)
{
- static const EnumPropertyItem prop_mapping_items[] = {
- {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
- {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
- {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
- {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_vect_type_items[] = {
- {TEXMAP_TYPE_TEXTURE, "TEXTURE", 0, "Texture", "Transform a texture by inverse mapping the texture coordinate"},
- {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
- {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
- {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_xyz_mapping_items[] = {
- {0, "NONE", 0, "None", ""},
- {1, "X", 0, "X", ""},
- {2, "Y", 0, "Y", ""},
- {3, "Z", 0, "Z", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TexMapping", NULL);
- RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings");
-
- prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, prop_vect_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "loc");
- RNA_def_property_ui_text(prop, "Location", "");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- /* Not PROP_XYZ, this is now in radians, no more degrees */
- prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
- RNA_def_property_float_sdna(prop, NULL, "rot");
- RNA_def_property_ui_text(prop, "Rotation", "");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL);
- RNA_def_property_ui_text(prop, "Scale", "");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "min");
- RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "max");
- RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
- RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
- RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projx");
- RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
- RNA_def_property_ui_text(prop, "X Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projy");
- RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
- RNA_def_property_ui_text(prop, "Y Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "projz");
- RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
- RNA_def_property_ui_text(prop, "Z Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
-
- prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, prop_mapping_items);
- RNA_def_property_ui_text(prop, "Mapping", "");
- RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+ static const EnumPropertyItem prop_mapping_items[] = {
+ {MTEX_FLAT, "FLAT", 0, "Flat", "Map X and Y coordinates directly"},
+ {MTEX_CUBE, "CUBE", 0, "Cube", "Map using the normal vector"},
+ {MTEX_TUBE, "TUBE", 0, "Tube", "Map with Z as central axis"},
+ {MTEX_SPHERE, "SPHERE", 0, "Sphere", "Map with Z as central axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_vect_type_items[] = {
+ {TEXMAP_TYPE_TEXTURE,
+ "TEXTURE",
+ 0,
+ "Texture",
+ "Transform a texture by inverse mapping the texture coordinate"},
+ {TEXMAP_TYPE_POINT, "POINT", 0, "Point", "Transform a point"},
+ {TEXMAP_TYPE_VECTOR, "VECTOR", 0, "Vector", "Transform a direction vector"},
+ {TEXMAP_TYPE_NORMAL, "NORMAL", 0, "Normal", "Transform a normal vector with unit length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_xyz_mapping_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {1, "X", 0, "X", ""},
+ {2, "Y", 0, "Y", ""},
+ {3, "Z", 0, "Z", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TexMapping", NULL);
+ RNA_def_struct_ui_text(srna, "Texture Mapping", "Texture coordinate mapping settings");
+
+ prop = RNA_def_property(srna, "vector_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, prop_vect_type_items);
+ RNA_def_property_ui_text(prop, "Type", "Type of vector that the mapping transforms");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "translation", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "loc");
+ RNA_def_property_ui_text(prop, "Location", "");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ /* Not PROP_XYZ, this is now in radians, no more degrees */
+ prop = RNA_def_property(srna, "rotation", PROP_FLOAT, PROP_EULER);
+ RNA_def_property_float_sdna(prop, NULL, "rot");
+ RNA_def_property_ui_text(prop, "Rotation", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL);
+ RNA_def_property_ui_text(prop, "Scale", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "min", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "min");
+ RNA_def_property_ui_text(prop, "Minimum", "Minimum value for clipping");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "max", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "max");
+ RNA_def_property_ui_text(prop, "Maximum", "Maximum value for clipping");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "use_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MIN);
+ RNA_def_property_ui_text(prop, "Has Minimum", "Whether to use minimum clipping value");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "use_max", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEXMAP_CLIP_MAX);
+ RNA_def_property_ui_text(prop, "Has Maximum", "Whether to use maximum clipping value");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "mapping_x", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projx");
+ RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
+ RNA_def_property_ui_text(prop, "X Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "mapping_y", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projy");
+ RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
+ RNA_def_property_ui_text(prop, "Y Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "mapping_z", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "projz");
+ RNA_def_property_enum_items(prop, prop_xyz_mapping_items);
+ RNA_def_property_ui_text(prop, "Z Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
+
+ prop = RNA_def_property(srna, "mapping", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, prop_mapping_items);
+ RNA_def_property_ui_text(prop, "Mapping", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_mapping_update");
}
static void rna_def_colormapping(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ColorMapping", NULL);
- RNA_def_struct_ui_text(srna, "Color Mapping", "Color mapping settings");
-
- prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMAP_USE_RAMP);
- RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "coba");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Color Ramp", "");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bright");
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 5);
- RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, blend_type_items);
- RNA_def_property_ui_text(prop, "Blend Type", "Mode used to mix with texture output color");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "blend_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color", "Blend color to mix with texture output color");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
-
- prop = RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Blend Factor", "");
- RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ColorMapping", NULL);
+ RNA_def_struct_ui_text(srna, "Color Mapping", "Color mapping settings");
+
+ prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLORMAP_USE_RAMP);
+ RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "coba");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Color Ramp", "");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "brightness", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bright");
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 5);
+ RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, blend_type_items);
+ RNA_def_property_ui_text(prop, "Blend Type", "Mode used to mix with texture output color");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "blend_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color", "Blend color to mix with texture output color");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
+
+ prop = RNA_def_property(srna, "blend_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Blend Factor", "");
+ RNA_def_property_update(prop, 0, "rna_Color_mapping_update");
}
static void rna_def_mtex(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem output_node_items[] = {
- {0, "DUMMY", 0, "Dummy", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "TextureSlot", NULL);
- RNA_def_struct_sdna(srna, "MTex");
- RNA_def_struct_ui_text(srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture");
- RNA_def_struct_path_func(srna, "rna_TextureSlot_path");
- RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
-
- prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "tex");
- RNA_def_property_struct_type(prop, "Texture");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Texture", "Texture data-block used by this texture slot");
- RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "Texture slot name");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- /* mapping */
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_float_sdna(prop, NULL, "ofs");
- RNA_def_property_ui_range(prop, -10, 10, 10, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "size");
- RNA_def_property_flag(prop, PROP_PROPORTIONAL | PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_range(prop, -100, 100, 10, 2);
- RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "r");
- RNA_def_property_array(prop, 3);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Color",
- "Default color for textures that don't return RGB or when RGB to intensity is enabled");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "blendtype");
- RNA_def_property_enum_items(prop, blend_type_items);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "def_var");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_range(prop, 0, 1, 10, 3);
- RNA_def_property_ui_text(prop, "Default Value",
- "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
-
- prop = RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "which_output");
- RNA_def_property_enum_items(prop, output_node_items);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_enum_funcs(prop, "rna_TextureSlot_output_node_get", NULL, "rna_TextureSlot_output_node_itemf");
- RNA_def_property_ui_text(prop, "Output Node", "Which output node to use, for node-based textures");
- RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem output_node_items[] = {
+ {0, "DUMMY", 0, "Dummy", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "TextureSlot", NULL);
+ RNA_def_struct_sdna(srna, "MTex");
+ RNA_def_struct_ui_text(
+ srna, "Texture Slot", "Texture slot defining the mapping and influence of a texture");
+ RNA_def_struct_path_func(srna, "rna_TextureSlot_path");
+ RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
+
+ prop = RNA_def_property(srna, "texture", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "tex");
+ RNA_def_property_struct_type(prop, "Texture");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Texture", "Texture data-block used by this texture slot");
+ RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING_LINKS, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_TextureSlot_name_get", "rna_TextureSlot_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "Texture slot name");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ /* mapping */
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_float_sdna(prop, NULL, "ofs");
+ RNA_def_property_ui_range(prop, -10, 10, 10, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(
+ prop, "Offset", "Fine tune of the texture mapping X, Y and Z locations");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "size");
+ RNA_def_property_flag(prop, PROP_PROPORTIONAL | PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_range(prop, -100, 100, 10, 2);
+ RNA_def_property_ui_text(prop, "Size", "Set scaling for the texture's X, Y and Z sizes");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "r");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(
+ prop,
+ "Color",
+ "Default color for textures that don't return RGB or when RGB to intensity is enabled");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "blend_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "blendtype");
+ RNA_def_property_enum_items(prop, blend_type_items);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Blend Type", "Mode used to apply the texture");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "default_value", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "def_var");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_range(prop, 0, 1, 10, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Default Value",
+ "Value to use for Ref, Spec, Amb, Emit, Alpha, RayMir, TransLu and Hard");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
+
+ prop = RNA_def_property(srna, "output_node", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "which_output");
+ RNA_def_property_enum_items(prop, output_node_items);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_enum_funcs(
+ prop, "rna_TextureSlot_output_node_get", NULL, "rna_TextureSlot_output_node_itemf");
+ RNA_def_property_ui_text(
+ prop, "Output Node", "Which output node to use, for node-based textures");
+ RNA_def_property_update(prop, 0, "rna_TextureSlot_update");
}
static void rna_def_filter_common(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
- RNA_def_property_ui_text(prop, "MIP Map", "Use auto-generated MIP maps for the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
- RNA_def_property_ui_text(prop, "MIP Map Gaussian filter", "Use Gauss filter to sample down MIP maps");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "texfilter");
- RNA_def_property_enum_items(prop, texture_filter_items);
- RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "filter_lightprobes", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "afmax");
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_ui_text(prop, "Filter Probes",
- "Maximum number of samples (higher gives less blur at distant/oblique angles, "
- "but is also slower)");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "afmax");
- RNA_def_property_range(prop, 1, 256);
- RNA_def_property_ui_text(prop, "Filter Eccentricity",
- "Maximum eccentricity (higher gives less blur at distant/oblique angles, "
- "but is also slower)");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_FILTER_MIN);
- RNA_def_property_ui_text(prop, "Minimum Filter Size", "Use Filter Size as a minimal filter value in pixels");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "filtersize");
- RNA_def_property_range(prop, 0.1, 50.0);
- RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 2);
- RNA_def_property_ui_text(prop, "Filter Size", "Multiply the filter size used by MIP Map and Interpolation");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "use_mipmap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_MIPMAP);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_ImageTexture_mipmap_set");
+ RNA_def_property_ui_text(prop, "MIP Map", "Use auto-generated MIP maps for the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_mipmap_gauss", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_GAUSS_MIP);
+ RNA_def_property_ui_text(
+ prop, "MIP Map Gaussian filter", "Use Gauss filter to sample down MIP maps");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "texfilter");
+ RNA_def_property_enum_items(prop, texture_filter_items);
+ RNA_def_property_ui_text(prop, "Filter", "Texture filter to use for sampling image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "filter_lightprobes", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "afmax");
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_ui_text(
+ prop,
+ "Filter Probes",
+ "Maximum number of samples (higher gives less blur at distant/oblique angles, "
+ "but is also slower)");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "filter_eccentricity", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "afmax");
+ RNA_def_property_range(prop, 1, 256);
+ RNA_def_property_ui_text(
+ prop,
+ "Filter Eccentricity",
+ "Maximum eccentricity (higher gives less blur at distant/oblique angles, "
+ "but is also slower)");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_filter_size_min", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_FILTER_MIN);
+ RNA_def_property_ui_text(
+ prop, "Minimum Filter Size", "Use Filter Size as a minimal filter value in pixels");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "filter_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "filtersize");
+ RNA_def_property_range(prop, 0.1, 50.0);
+ RNA_def_property_ui_range(prop, 0.1, 50.0, 1, 2);
+ RNA_def_property_ui_text(
+ prop, "Filter Size", "Multiply the filter size used by MIP Map and Interpolation");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static const EnumPropertyItem prop_noise_basis_items[] = {
- {TEX_BLENDER, "BLENDER_ORIGINAL", 0, "Blender Original",
- "Noise algorithm - Blender original: Smooth interpolated noise"},
- {TEX_STDPERLIN, "ORIGINAL_PERLIN", 0, "Original Perlin",
- "Noise algorithm - Original Perlin: Smooth interpolated noise"},
- {TEX_NEWPERLIN, "IMPROVED_PERLIN", 0, "Improved Perlin",
- "Noise algorithm - Improved Perlin: Smooth interpolated noise"},
- {TEX_VORONOI_F1, "VORONOI_F1", 0, "Voronoi F1",
- "Noise algorithm - Voronoi F1: Returns distance to the closest feature point"},
- {TEX_VORONOI_F2, "VORONOI_F2", 0, "Voronoi F2",
- "Noise algorithm - Voronoi F2: Returns distance to the 2nd closest feature point"},
- {TEX_VORONOI_F3, "VORONOI_F3", 0, "Voronoi F3",
- "Noise algorithm - Voronoi F3: Returns distance to the 3rd closest feature point"},
- {TEX_VORONOI_F4, "VORONOI_F4", 0, "Voronoi F4",
- "Noise algorithm - Voronoi F4: Returns distance to the 4th closest feature point"},
- {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", "Noise algorithm - Voronoi F1-F2"},
- {TEX_VORONOI_CRACKLE, "VORONOI_CRACKLE", 0, "Voronoi Crackle",
- "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"},
- {TEX_CELLNOISE, "CELL_NOISE", 0, "Cell Noise",
- "Noise algorithm - Cell Noise: Square cell tessellation"},
- {0, NULL, 0, NULL, NULL},
+ {TEX_BLENDER,
+ "BLENDER_ORIGINAL",
+ 0,
+ "Blender Original",
+ "Noise algorithm - Blender original: Smooth interpolated noise"},
+ {TEX_STDPERLIN,
+ "ORIGINAL_PERLIN",
+ 0,
+ "Original Perlin",
+ "Noise algorithm - Original Perlin: Smooth interpolated noise"},
+ {TEX_NEWPERLIN,
+ "IMPROVED_PERLIN",
+ 0,
+ "Improved Perlin",
+ "Noise algorithm - Improved Perlin: Smooth interpolated noise"},
+ {TEX_VORONOI_F1,
+ "VORONOI_F1",
+ 0,
+ "Voronoi F1",
+ "Noise algorithm - Voronoi F1: Returns distance to the closest feature point"},
+ {TEX_VORONOI_F2,
+ "VORONOI_F2",
+ 0,
+ "Voronoi F2",
+ "Noise algorithm - Voronoi F2: Returns distance to the 2nd closest feature point"},
+ {TEX_VORONOI_F3,
+ "VORONOI_F3",
+ 0,
+ "Voronoi F3",
+ "Noise algorithm - Voronoi F3: Returns distance to the 3rd closest feature point"},
+ {TEX_VORONOI_F4,
+ "VORONOI_F4",
+ 0,
+ "Voronoi F4",
+ "Noise algorithm - Voronoi F4: Returns distance to the 4th closest feature point"},
+ {TEX_VORONOI_F2F1, "VORONOI_F2_F1", 0, "Voronoi F2-F1", "Noise algorithm - Voronoi F1-F2"},
+ {TEX_VORONOI_CRACKLE,
+ "VORONOI_CRACKLE",
+ 0,
+ "Voronoi Crackle",
+ "Noise algorithm - Voronoi Crackle: Voronoi tessellation with sharp edges"},
+ {TEX_CELLNOISE,
+ "CELL_NOISE",
+ 0,
+ "Cell Noise",
+ "Noise algorithm - Cell Noise: Square cell tessellation"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem prop_noise_type[] = {
- {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"},
- {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"},
- {0, NULL, 0, NULL, NULL},
+ {TEX_NOISESOFT, "SOFT_NOISE", 0, "Soft", "Generate soft noise (smooth transitions)"},
+ {TEX_NOISEPERL, "HARD_NOISE", 0, "Hard", "Generate hard noise (sharp transitions)"},
+ {0, NULL, 0, NULL, NULL},
};
-
static void rna_def_texture_clouds(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_clouds_stype[] = {
- {TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""},
- {TEX_COLOR, "COLOR", 0, "Color", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "CloudsTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Clouds Texture", "Procedural noise texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "noisedepth");
- RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_range(prop, 0, 24, 0, 2);
- RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisetype");
- RNA_def_property_enum_items(prop, prop_noise_type);
- RNA_def_property_ui_text(prop, "Noise Type", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_clouds_stype);
- RNA_def_property_ui_text(prop, "Color", "Determine whether Noise returns grayscale or RGB values");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
- RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_clouds_stype[] = {
+ {TEX_DEFAULT, "GRAYSCALE", 0, "Grayscale", ""},
+ {TEX_COLOR, "COLOR", 0, "Color", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "CloudsTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Clouds Texture", "Procedural noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "noisedepth");
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_range(prop, 0, 24, 0, 2);
+ RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisetype");
+ RNA_def_property_enum_items(prop, prop_noise_type);
+ RNA_def_property_ui_text(prop, "Noise Type", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "cloud_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_clouds_stype);
+ RNA_def_property_ui_text(
+ prop, "Color", "Determine whether Noise returns grayscale or RGB values");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
+ RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_wood(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_wood_stype[] = {
- {TEX_BAND, "BANDS", 0, "Bands", "Use standard wood texture in bands"},
- {TEX_RING, "RINGS", 0, "Rings", "Use wood texture in rings"},
- {TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Add noise to standard wood"},
- {TEX_RINGNOISE, "RINGNOISE", 0, "Ring Noise", "Add noise to rings"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_wood_noisebasis2[] = {
- {TEX_SIN, "SIN", 0, "Sine", "Use a sine wave to produce bands"},
- {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
- {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "WoodTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Wood Texture", "Procedural noise texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "turbul");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
- RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisetype");
- RNA_def_property_enum_items(prop, prop_noise_type);
- RNA_def_property_ui_text(prop, "Noise Type", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_wood_stype);
- RNA_def_property_ui_text(prop, "Pattern", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
- RNA_def_property_enum_items(prop, prop_wood_noisebasis2);
- RNA_def_property_ui_text(prop, "Noise Basis 2", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
- RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_wood_stype[] = {
+ {TEX_BAND, "BANDS", 0, "Bands", "Use standard wood texture in bands"},
+ {TEX_RING, "RINGS", 0, "Rings", "Use wood texture in rings"},
+ {TEX_BANDNOISE, "BANDNOISE", 0, "Band Noise", "Add noise to standard wood"},
+ {TEX_RINGNOISE, "RINGNOISE", 0, "Ring Noise", "Add noise to rings"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_wood_noisebasis2[] = {
+ {TEX_SIN, "SIN", 0, "Sine", "Use a sine wave to produce bands"},
+ {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
+ {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "WoodTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Wood Texture", "Procedural noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "turbul");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
+ RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisetype");
+ RNA_def_property_enum_items(prop, prop_noise_type);
+ RNA_def_property_ui_text(prop, "Noise Type", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "wood_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_wood_stype);
+ RNA_def_property_ui_text(prop, "Pattern", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
+ RNA_def_property_enum_items(prop, prop_wood_noisebasis2);
+ RNA_def_property_ui_text(prop, "Noise Basis 2", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
+ RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_marble(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_marble_stype[] = {
- {TEX_SOFT, "SOFT", 0, "Soft", "Use soft marble"},
- {TEX_SHARP, "SHARP", 0, "Sharp", "Use more clearly defined marble"},
- {TEX_SHARPER, "SHARPER", 0, "Sharper", "Use very clearly defined marble"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_marble_noisebasis2[] = {
- {TEX_SIN, "SIN", 0, "Sin", "Use a sine wave to produce bands"},
- {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
- {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MarbleTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Marble Texture", "Procedural noise texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "turbul");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
- RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "noisedepth");
- RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_range(prop, 0, 24, 0, 2);
- RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisetype");
- RNA_def_property_enum_items(prop, prop_noise_type);
- RNA_def_property_ui_text(prop, "Noise Type", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_marble_stype);
- RNA_def_property_ui_text(prop, "Pattern", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
- RNA_def_property_enum_items(prop, prop_marble_noisebasis2);
- RNA_def_property_ui_text(prop, "Noise Basis 2", "");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
- RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_marble_stype[] = {
+ {TEX_SOFT, "SOFT", 0, "Soft", "Use soft marble"},
+ {TEX_SHARP, "SHARP", 0, "Sharp", "Use more clearly defined marble"},
+ {TEX_SHARPER, "SHARPER", 0, "Sharper", "Use very clearly defined marble"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_marble_noisebasis2[] = {
+ {TEX_SIN, "SIN", 0, "Sin", "Use a sine wave to produce bands"},
+ {TEX_SAW, "SAW", 0, "Saw", "Use a saw wave to produce bands"},
+ {TEX_TRI, "TRI", 0, "Tri", "Use a triangle wave to produce bands"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MarbleTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Marble Texture", "Procedural noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "turbul");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
+ RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the bandnoise and ringnoise types");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "noisedepth");
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_range(prop, 0, 24, 0, 2);
+ RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the cloud calculation");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisetype");
+ RNA_def_property_enum_items(prop, prop_noise_type);
+ RNA_def_property_ui_text(prop, "Noise Type", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "marble_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_marble_stype);
+ RNA_def_property_ui_text(prop, "Pattern", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_basis_2", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
+ RNA_def_property_enum_items(prop, prop_marble_noisebasis2);
+ RNA_def_property_ui_text(prop, "Noise Basis 2", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
+ RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_magic(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MagicTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Magic Texture", "Procedural noise texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "turbul");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
- RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "noisedepth");
- RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_range(prop, 0, 24, 0, 2);
- RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the noise");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MagicTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Magic Texture", "Procedural noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "turbul");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
+ RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_depth", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "noisedepth");
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_range(prop, 0, 24, 0, 2);
+ RNA_def_property_ui_text(prop, "Noise Depth", "Depth of the noise");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_blend(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_blend_progression[] = {
- {TEX_LIN, "LINEAR", 0, "Linear", "Create a linear progression"},
- {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
- {TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
- {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
- {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
- {TEX_HALO, "QUADRATIC_SPHERE", 0, "Quadratic sphere",
- "Create a quadratic progression in the shape of a sphere"},
- {TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_flip_axis_items[] = {
- {0, "HORIZONTAL", 0, "Horizontal", "No flipping"},
- {TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flip the texture's X and Y axis"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "BlendTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Blend Texture", "Procedural color blending texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_blend_progression);
- RNA_def_property_ui_text(prop, "Progression", "Style of the color blending");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, prop_flip_axis_items);
- RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_blend_progression[] = {
+ {TEX_LIN, "LINEAR", 0, "Linear", "Create a linear progression"},
+ {TEX_QUAD, "QUADRATIC", 0, "Quadratic", "Create a quadratic progression"},
+ {TEX_EASE, "EASING", 0, "Easing", "Create a progression easing from one step to the next"},
+ {TEX_DIAG, "DIAGONAL", 0, "Diagonal", "Create a diagonal progression"},
+ {TEX_SPHERE, "SPHERICAL", 0, "Spherical", "Create a spherical progression"},
+ {TEX_HALO,
+ "QUADRATIC_SPHERE",
+ 0,
+ "Quadratic sphere",
+ "Create a quadratic progression in the shape of a sphere"},
+ {TEX_RAD, "RADIAL", 0, "Radial", "Create a radial progression"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_flip_axis_items[] = {
+ {0, "HORIZONTAL", 0, "Horizontal", "No flipping"},
+ {TEX_FLIPBLEND, "VERTICAL", 0, "Vertical", "Flip the texture's X and Y axis"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "BlendTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Blend Texture", "Procedural color blending texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "progression", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_blend_progression);
+ RNA_def_property_ui_text(prop, "Progression", "Style of the color blending");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "use_flip_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, prop_flip_axis_items);
+ RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
}
static void rna_def_texture_stucci(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_stucci_stype[] = {
- {TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Use standard stucci"},
- {TEX_WALLIN, "WALL_IN", 0, "Wall in", "Create Dimples"},
- {TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Create Ridges"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "StucciTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Stucci Texture", "Procedural noise texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "turbul");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
- RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisetype");
- RNA_def_property_enum_items(prop, prop_noise_type);
- RNA_def_property_ui_text(prop, "Noise Type", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_stucci_stype);
- RNA_def_property_ui_text(prop, "Pattern", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_stucci_stype[] = {
+ {TEX_PLASTIC, "PLASTIC", 0, "Plastic", "Use standard stucci"},
+ {TEX_WALLIN, "WALL_IN", 0, "Wall in", "Create Dimples"},
+ {TEX_WALLOUT, "WALL_OUT", 0, "Wall out", "Create Ridges"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "StucciTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Stucci Texture", "Procedural noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "turbulence", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "turbul");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 200, 10, 2);
+ RNA_def_property_ui_text(prop, "Turbulence", "Turbulence of the noise");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisetype");
+ RNA_def_property_enum_items(prop, prop_noise_type);
+ RNA_def_property_ui_text(prop, "Noise Type", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "stucci_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_stucci_stype);
+ RNA_def_property_ui_text(prop, "Pattern", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_noise(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- srna = RNA_def_struct(brna, "NoiseTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Noise Texture", "Procedural noise texture");
- RNA_def_struct_sdna(srna, "Tex");
+ srna = RNA_def_struct(brna, "NoiseTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Noise Texture", "Procedural noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
}
static void rna_def_texture_image(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_image_extension[] = {
- {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
- {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
- {TEX_CLIPCUBE, "CLIP_CUBE", 0, "Clip Cube",
- "Clip to cubic-shaped area around the image and set exterior pixels as transparent"},
- {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
- {TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ImageTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Image Texture", "");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL);
- RNA_def_property_ui_text(prop, "Interpolation", "Interpolate pixels using selected filter");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- /* XXX: I think flip_axis should be a generic Texture property, enabled for all the texture types */
- prop = RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_IMAROT);
- RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA);
- RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA);
- RNA_def_property_ui_text(prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGALPHA);
- RNA_def_property_ui_text(prop, "Invert Alpha", "Invert all the alpha values in the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- rna_def_filter_common(srna);
-
- prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "extend");
- RNA_def_property_enum_items(prop, prop_image_extension);
- RNA_def_property_ui_text(prop, "Extension", "How the image is extrapolated past its original bounds");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "xrepeat");
- RNA_def_property_range(prop, 1, 512);
- RNA_def_property_ui_text(prop, "Repeat X", "Repetition multiplier in the X direction");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "yrepeat");
- RNA_def_property_range(prop, 1, 512);
- RNA_def_property_ui_text(prop, "Repeat Y", "Repetition multiplier in the Y direction");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_XMIR);
- RNA_def_property_ui_text(prop, "Mirror X", "Mirror the image repetition on the X direction");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_YMIR);
- RNA_def_property_ui_text(prop, "Mirror Y", "Mirror the image repetition on the Y direction");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_ODD);
- RNA_def_property_ui_text(prop, "Checker Odd", "Odd checker tiles");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_EVEN);
- RNA_def_property_ui_text(prop, "Checker Even", "Even checker tiles");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "checkerdist");
- RNA_def_property_range(prop, 0.0, 0.99);
- RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 2);
- RNA_def_property_ui_text(prop, "Checker Distance", "Distance between checker tiles");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
-#if 0
-
- /* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
- * perhaps a new subtype could be added?
- * --I actually used single values for this, maybe change later with a RNA_Rect thing? */
- prop = RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cropxmin");
- RNA_def_property_array(prop, 4);
- RNA_def_property_range(prop, -10, 10);
- RNA_def_property_ui_text(prop, "Crop Rectangle", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
-#endif
-
- prop = RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cropxmin");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
- RNA_def_property_ui_text(prop, "Crop Minimum X", "Minimum X value to crop the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cropymin");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
- RNA_def_property_ui_text(prop, "Crop Minimum Y", "Minimum Y value to crop the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cropxmax");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
- RNA_def_property_ui_text(prop, "Crop Maximum X", "Maximum X value to crop the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "cropymax");
- RNA_def_property_range(prop, -10.0, 10.0);
- RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
- RNA_def_property_ui_text(prop, "Crop Maximum Y", "Maximum Y value to crop the image");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "ima");
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "iuser");
- RNA_def_property_ui_text(prop, "Image User",
- "Parameters defining which layer, pass and frame of the image is displayed");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- /* Normal Map */
- prop = RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP);
- RNA_def_property_ui_text(prop, "Normal Map", "Use image RGB values for normal mapping");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_image_extension[] = {
+ {TEX_EXTEND, "EXTEND", 0, "Extend", "Extend by repeating edge pixels of the image"},
+ {TEX_CLIP, "CLIP", 0, "Clip", "Clip to image size and set exterior pixels as transparent"},
+ {TEX_CLIPCUBE,
+ "CLIP_CUBE",
+ 0,
+ "Clip Cube",
+ "Clip to cubic-shaped area around the image and set exterior pixels as transparent"},
+ {TEX_REPEAT, "REPEAT", 0, "Repeat", "Cause the image to repeat horizontally and vertically"},
+ {TEX_CHECKER, "CHECKER", 0, "Checker", "Cause the image to repeat in checker board pattern"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ImageTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Image Texture", "");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "use_interpolation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_INTERPOL);
+ RNA_def_property_ui_text(prop, "Interpolation", "Interpolate pixels using selected filter");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ /* XXX: I think flip_axis should be a generic Texture property, enabled for all the texture types */
+ prop = RNA_def_property(srna, "use_flip_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_IMAROT);
+ RNA_def_property_ui_text(prop, "Flip Axis", "Flip the texture's X and Y axis");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_USEALPHA);
+ RNA_def_property_ui_text(prop, "Use Alpha", "Use the alpha channel information in the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_calculate_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_CALCALPHA);
+ RNA_def_property_ui_text(
+ prop, "Calculate Alpha", "Calculate an alpha channel based on RGB values in the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "invert_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_NEGALPHA);
+ RNA_def_property_ui_text(prop, "Invert Alpha", "Invert all the alpha values in the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ rna_def_filter_common(srna);
+
+ prop = RNA_def_property(srna, "extension", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "extend");
+ RNA_def_property_enum_items(prop, prop_image_extension);
+ RNA_def_property_ui_text(
+ prop, "Extension", "How the image is extrapolated past its original bounds");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "repeat_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "xrepeat");
+ RNA_def_property_range(prop, 1, 512);
+ RNA_def_property_ui_text(prop, "Repeat X", "Repetition multiplier in the X direction");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "repeat_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "yrepeat");
+ RNA_def_property_range(prop, 1, 512);
+ RNA_def_property_ui_text(prop, "Repeat Y", "Repetition multiplier in the Y direction");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_mirror_x", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_XMIR);
+ RNA_def_property_ui_text(prop, "Mirror X", "Mirror the image repetition on the X direction");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_mirror_y", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_REPEAT_YMIR);
+ RNA_def_property_ui_text(prop, "Mirror Y", "Mirror the image repetition on the Y direction");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_checker_odd", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_ODD);
+ RNA_def_property_ui_text(prop, "Checker Odd", "Odd checker tiles");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_checker_even", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_CHECKER_EVEN);
+ RNA_def_property_ui_text(prop, "Checker Even", "Even checker tiles");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "checker_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "checkerdist");
+ RNA_def_property_range(prop, 0.0, 0.99);
+ RNA_def_property_ui_range(prop, 0.0, 0.99, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Checker Distance", "Distance between checker tiles");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+# if 0
+
+ /* XXX: did this as an array, but needs better descriptions than "1 2 3 4"
+ * perhaps a new subtype could be added?
+ * --I actually used single values for this, maybe change later with a RNA_Rect thing? */
+ prop = RNA_def_property(srna, "crop_rectangle", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cropxmin");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_range(prop, -10, 10);
+ RNA_def_property_ui_text(prop, "Crop Rectangle", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+# endif
+
+ prop = RNA_def_property(srna, "crop_min_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cropxmin");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Crop Minimum X", "Minimum X value to crop the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "crop_min_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cropymin");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Crop Minimum Y", "Minimum Y value to crop the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "crop_max_x", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cropxmax");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Crop Maximum X", "Maximum X value to crop the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "crop_max_y", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "cropymax");
+ RNA_def_property_range(prop, -10.0, 10.0);
+ RNA_def_property_ui_range(prop, -10.0, 10.0, 1, 2);
+ RNA_def_property_ui_text(prop, "Crop Maximum Y", "Maximum Y value to crop the image");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "ima");
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Image", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "image_user", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "iuser");
+ RNA_def_property_ui_text(
+ prop,
+ "Image User",
+ "Parameters defining which layer, pass and frame of the image is displayed");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ /* Normal Map */
+ prop = RNA_def_property(srna, "use_normal_map", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "imaflag", TEX_NORMALMAP);
+ RNA_def_property_ui_text(prop, "Normal Map", "Use image RGB values for normal mapping");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_musgrave(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_musgrave_type[] = {
- {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Use Perlin noise as a basis"},
- {TEX_RIDGEDMF, "RIDGED_MULTIFRACTAL", 0, "Ridged Multifractal",
- "Use Perlin noise with inflection as a basis"},
- {TEX_HYBRIDMF, "HYBRID_MULTIFRACTAL", 0, "Hybrid Multifractal",
- "Use Perlin noise as a basis, with extended controls"},
- {TEX_FBM, "FBM", 0, "fBM", "Fractal Brownian Motion, use Brownian noise as a basis"},
- {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Similar to multifractal"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MusgraveTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Musgrave", "Procedural musgrave texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "stype");
- RNA_def_property_enum_items(prop, prop_musgrave_type);
- RNA_def_property_ui_text(prop, "Type", "Fractal noise algorithm");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mg_H");
- RNA_def_property_range(prop, 0.0001, 2);
- RNA_def_property_ui_text(prop, "Highest Dimension", "Highest fractal dimension");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mg_lacunarity");
- RNA_def_property_range(prop, 0, 6);
- RNA_def_property_ui_text(prop, "Lacunarity", "Gap between successive frequencies");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mg_octaves");
- RNA_def_property_range(prop, 0, 8);
- RNA_def_property_ui_text(prop, "Octaves", "Number of frequencies used");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mg_offset");
- RNA_def_property_range(prop, 0, 6);
- RNA_def_property_ui_text(prop, "Offset", "The fractal offset");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "mg_gain");
- RNA_def_property_range(prop, 0, 6);
- RNA_def_property_ui_text(prop, "Gain", "The gain multiplier");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Noise Intensity", "Intensity of the noise");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
- RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_musgrave_type[] = {
+ {TEX_MFRACTAL, "MULTIFRACTAL", 0, "Multifractal", "Use Perlin noise as a basis"},
+ {TEX_RIDGEDMF,
+ "RIDGED_MULTIFRACTAL",
+ 0,
+ "Ridged Multifractal",
+ "Use Perlin noise with inflection as a basis"},
+ {TEX_HYBRIDMF,
+ "HYBRID_MULTIFRACTAL",
+ 0,
+ "Hybrid Multifractal",
+ "Use Perlin noise as a basis, with extended controls"},
+ {TEX_FBM, "FBM", 0, "fBM", "Fractal Brownian Motion, use Brownian noise as a basis"},
+ {TEX_HTERRAIN, "HETERO_TERRAIN", 0, "Hetero Terrain", "Similar to multifractal"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MusgraveTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Musgrave", "Procedural musgrave texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "musgrave_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "stype");
+ RNA_def_property_enum_items(prop, prop_musgrave_type);
+ RNA_def_property_ui_text(prop, "Type", "Fractal noise algorithm");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "dimension_max", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mg_H");
+ RNA_def_property_range(prop, 0.0001, 2);
+ RNA_def_property_ui_text(prop, "Highest Dimension", "Highest fractal dimension");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "lacunarity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mg_lacunarity");
+ RNA_def_property_range(prop, 0, 6);
+ RNA_def_property_ui_text(prop, "Lacunarity", "Gap between successive frequencies");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "octaves", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mg_octaves");
+ RNA_def_property_range(prop, 0, 8);
+ RNA_def_property_ui_text(prop, "Octaves", "Number of frequencies used");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mg_offset");
+ RNA_def_property_range(prop, 0, 6);
+ RNA_def_property_ui_text(prop, "Offset", "The fractal offset");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "gain", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "mg_gain");
+ RNA_def_property_range(prop, 0, 6);
+ RNA_def_property_ui_text(prop, "Gain", "The gain multiplier");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(prop, "Noise Intensity", "Intensity of the noise");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
+ RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_voronoi(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem prop_distance_metric_items[] = {
- {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "sqrt(x*x+y*y+z*z)"},
- {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "(x*x+y*y+z*z)"},
- {TEX_MANHATTAN, "MANHATTAN", 0, "Manhattan",
- "The length of the distance in axial directions"},
- {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev",
- "The length of the longest Axial journey"},
- {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkowski 1/2",
- "Set Minkowski variable to 0.5"},
- {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkowski 4",
- "Set Minkowski variable to 4"},
- {TEX_MINKOVSKY, "MINKOVSKY", 0, "Minkowski",
- "Use the Minkowski function to calculate distance "
- "(exponent value determines the shape of the boundaries)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem prop_coloring_items[] = {
- /* XXX: OK names / descriptions? */
- {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
- {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"},
- {TEX_COL2, "POSITION_OUTLINE", 0, "Position and Outline", "Use position plus an outline based on F2-F1"},
- {TEX_COL3, "POSITION_OUTLINE_INTENSITY", 0, "Position, Outline, and Intensity",
- "Multiply position and outline by intensity"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "VoronoiTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vn_w1");
- RNA_def_property_range(prop, -2, 2);
- RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vn_w2");
- RNA_def_property_range(prop, -2, 2);
- RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vn_w3");
- RNA_def_property_range(prop, -2, 2);
- RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vn_w4");
- RNA_def_property_range(prop, -2, 2);
- RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
- RNA_def_property_range(prop, 0.01, 10);
- RNA_def_property_ui_text(prop, "Minkowski Exponent", "Minkowski exponent");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "vn_distm");
- RNA_def_property_enum_items(prop, prop_distance_metric_items);
- RNA_def_property_ui_text(prop, "Distance Metric",
- "Algorithm used to calculate distance of sample points to feature points");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "vn_coltype");
- RNA_def_property_enum_items(prop, prop_coloring_items);
- RNA_def_property_ui_text(prop, "Coloring", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
- RNA_def_property_range(prop, 0.01, 10);
- RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
- RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem prop_distance_metric_items[] = {
+ {TEX_DISTANCE, "DISTANCE", 0, "Actual Distance", "sqrt(x*x+y*y+z*z)"},
+ {TEX_DISTANCE_SQUARED, "DISTANCE_SQUARED", 0, "Distance Squared", "(x*x+y*y+z*z)"},
+ {TEX_MANHATTAN,
+ "MANHATTAN",
+ 0,
+ "Manhattan",
+ "The length of the distance in axial directions"},
+ {TEX_CHEBYCHEV, "CHEBYCHEV", 0, "Chebychev", "The length of the longest Axial journey"},
+ {TEX_MINKOVSKY_HALF, "MINKOVSKY_HALF", 0, "Minkowski 1/2", "Set Minkowski variable to 0.5"},
+ {TEX_MINKOVSKY_FOUR, "MINKOVSKY_FOUR", 0, "Minkowski 4", "Set Minkowski variable to 4"},
+ {TEX_MINKOVSKY,
+ "MINKOVSKY",
+ 0,
+ "Minkowski",
+ "Use the Minkowski function to calculate distance "
+ "(exponent value determines the shape of the boundaries)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem prop_coloring_items[] = {
+ /* XXX: OK names / descriptions? */
+ {TEX_INTENSITY, "INTENSITY", 0, "Intensity", "Only calculate intensity"},
+ {TEX_COL1, "POSITION", 0, "Position", "Color cells by position"},
+ {TEX_COL2,
+ "POSITION_OUTLINE",
+ 0,
+ "Position and Outline",
+ "Use position plus an outline based on F2-F1"},
+ {TEX_COL3,
+ "POSITION_OUTLINE_INTENSITY",
+ 0,
+ "Position, Outline, and Intensity",
+ "Multiply position and outline by intensity"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "VoronoiTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Voronoi", "Procedural voronoi texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "weight_1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w1");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 1", "Voronoi feature weight 1");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "weight_2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w2");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 2", "Voronoi feature weight 2");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "weight_3", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w3");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 3", "Voronoi feature weight 3");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "weight_4", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_w4");
+ RNA_def_property_range(prop, -2, 2);
+ RNA_def_property_ui_text(prop, "Weight 4", "Voronoi feature weight 4");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "minkovsky_exponent", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "vn_mexp");
+ RNA_def_property_range(prop, 0.01, 10);
+ RNA_def_property_ui_text(prop, "Minkowski Exponent", "Minkowski exponent");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "distance_metric", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "vn_distm");
+ RNA_def_property_enum_items(prop, prop_distance_metric_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Distance Metric",
+ "Algorithm used to calculate distance of sample points to feature points");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "color_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "vn_coltype");
+ RNA_def_property_enum_items(prop, prop_coloring_items);
+ RNA_def_property_ui_text(prop, "Coloring", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "ns_outscale");
+ RNA_def_property_range(prop, 0.01, 10);
+ RNA_def_property_ui_text(prop, "Noise Intensity", "Scales the intensity of the noise");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
+ RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture_distorted_noise(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
- RNA_def_struct_ui_text(srna, "Distorted Noise", "Procedural distorted noise texture");
- RNA_def_struct_sdna(srna, "Tex");
-
- prop = RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "dist_amount");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "noisesize");
- RNA_def_property_range(prop, 0.0001, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
- RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
- RNA_def_property_enum_items(prop, prop_noise_basis_items);
- RNA_def_property_ui_text(prop, "Noise Distortion", "Noise basis for the distortion");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.001, 0.1);
- RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
- RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "DistortedNoiseTexture", "Texture");
+ RNA_def_struct_ui_text(srna, "Distorted Noise", "Procedural distorted noise texture");
+ RNA_def_struct_sdna(srna, "Tex");
+
+ prop = RNA_def_property(srna, "distortion", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "dist_amount");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(prop, "Distortion Amount", "Amount of distortion");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "noisesize");
+ RNA_def_property_range(prop, 0.0001, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001, 2, 10, 2);
+ RNA_def_property_ui_text(prop, "Noise Size", "Scaling for noise input");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "noise_basis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis2");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Basis", "Noise basis used for turbulence");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "noise_distortion", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "noisebasis");
+ RNA_def_property_enum_items(prop, prop_noise_basis_items);
+ RNA_def_property_ui_text(prop, "Noise Distortion", "Noise basis for the distortion");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ prop = RNA_def_property(srna, "nabla", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.001, 0.1);
+ RNA_def_property_ui_range(prop, 0.001, 0.1, 1, 2);
+ RNA_def_property_ui_text(prop, "Nabla", "Size of derivative offset used for calculating normal");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
}
static void rna_def_texture(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Texture", "ID");
- RNA_def_struct_sdna(srna, "Tex");
- RNA_def_struct_ui_text(srna, "Texture", "Texture data-block used by materials, lights, worlds and brushes");
- RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
- RNA_def_struct_refine_func(srna, "rna_Texture_refine");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_texture_type_items);
- RNA_def_property_enum_funcs(prop, NULL, "rna_Texture_type_set", NULL);
- RNA_def_property_ui_text(prop, "Type", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TEX_NO_CLAMP);
- RNA_def_property_ui_text(prop, "Clamp", "Set negative texture RGB and intensity values to zero, for some uses like displacement this option can be disabled to get the full range");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND);
- RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set");
- RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "coba");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Color Ramp", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bright");
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.0, 5);
- RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- /* RGB Factor */
- prop = RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "rfac");
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Factor Red", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "gfac");
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Factor Green", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- prop = RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "bfac");
- RNA_def_property_range(prop, 0, 2);
- RNA_def_property_ui_text(prop, "Factor Blue", "");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- /* Alpha for preview render */
- prop = RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PRV_ALPHA);
- RNA_def_property_ui_text(prop, "Show Alpha", "Show Alpha in Preview Render");
- RNA_def_property_update(prop, 0, "rna_Texture_update");
-
- /* nodetree */
- prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture");
- RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update");
-
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based textures");
- RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
-
- rna_def_animdata_common(srna);
-
- /* specific types */
- rna_def_texture_clouds(brna);
- rna_def_texture_wood(brna);
- rna_def_texture_marble(brna);
- rna_def_texture_magic(brna);
- rna_def_texture_blend(brna);
- rna_def_texture_stucci(brna);
- rna_def_texture_noise(brna);
- rna_def_texture_image(brna);
- rna_def_texture_musgrave(brna);
- rna_def_texture_voronoi(brna);
- rna_def_texture_distorted_noise(brna);
- /* XXX add more types here .. */
-
- RNA_api_texture(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Texture", "ID");
+ RNA_def_struct_sdna(srna, "Tex");
+ RNA_def_struct_ui_text(
+ srna, "Texture", "Texture data-block used by materials, lights, worlds and brushes");
+ RNA_def_struct_ui_icon(srna, ICON_TEXTURE_DATA);
+ RNA_def_struct_refine_func(srna, "rna_Texture_refine");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ /*RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_texture_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, "rna_Texture_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Type", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_clamp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TEX_NO_CLAMP);
+ RNA_def_property_ui_text(prop,
+ "Clamp",
+ "Set negative texture RGB and intensity values to zero, for some uses "
+ "like displacement this option can be disabled to get the full range");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "use_color_ramp", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_COLORBAND);
+ RNA_def_property_boolean_funcs(prop, NULL, "rna_Texture_use_color_ramp_set");
+ RNA_def_property_ui_text(prop, "Use Color Ramp", "Toggle color ramp operations");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "color_ramp", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "coba");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop, "Color Ramp", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bright");
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Brightness", "Adjust the brightness of the texture");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "contrast", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.0, 5);
+ RNA_def_property_ui_text(prop, "Contrast", "Adjust the contrast of the texture");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "saturation", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Saturation", "Adjust the saturation of colors in the texture");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ /* RGB Factor */
+ prop = RNA_def_property(srna, "factor_red", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "rfac");
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Factor Red", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "factor_green", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "gfac");
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Factor Green", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ prop = RNA_def_property(srna, "factor_blue", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "bfac");
+ RNA_def_property_range(prop, 0, 2);
+ RNA_def_property_ui_text(prop, "Factor Blue", "");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ /* Alpha for preview render */
+ prop = RNA_def_property(srna, "use_preview_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TEX_PRV_ALPHA);
+ RNA_def_property_ui_text(prop, "Show Alpha", "Show Alpha in Preview Render");
+ RNA_def_property_update(prop, 0, "rna_Texture_update");
+
+ /* nodetree */
+ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Use Nodes", "Make this a node-based texture");
+ RNA_def_property_update(prop, 0, "rna_Texture_use_nodes_update");
+
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node-based textures");
+ RNA_def_property_update(prop, 0, "rna_Texture_nodes_update");
+
+ rna_def_animdata_common(srna);
+
+ /* specific types */
+ rna_def_texture_clouds(brna);
+ rna_def_texture_wood(brna);
+ rna_def_texture_marble(brna);
+ rna_def_texture_magic(brna);
+ rna_def_texture_blend(brna);
+ rna_def_texture_stucci(brna);
+ rna_def_texture_noise(brna);
+ rna_def_texture_image(brna);
+ rna_def_texture_musgrave(brna);
+ rna_def_texture_voronoi(brna);
+ rna_def_texture_distorted_noise(brna);
+ /* XXX add more types here .. */
+
+ RNA_api_texture(srna);
}
void RNA_def_texture(BlenderRNA *brna)
{
- rna_def_texture(brna);
- rna_def_mtex(brna);
- rna_def_texmapping(brna);
- rna_def_colormapping(brna);
+ rna_def_texture(brna);
+ rna_def_mtex(brna);
+ rna_def_texmapping(brna);
+ rna_def_colormapping(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c
index b3bd55e3ee3..059c0b8208c 100644
--- a/source/blender/makesrna/intern/rna_texture_api.c
+++ b/source/blender/makesrna/intern/rna_texture_api.c
@@ -26,49 +26,49 @@
#include "RNA_define.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "IMB_imbuf.h"
-#include "IMB_imbuf_types.h"
-#include "DNA_scene_types.h"
-#include "BKE_context.h"
-#include "BKE_global.h"
-#include "RE_pipeline.h"
-#include "RE_shader_ext.h"
+# include "IMB_imbuf.h"
+# include "IMB_imbuf_types.h"
+# include "DNA_scene_types.h"
+# include "BKE_context.h"
+# include "BKE_global.h"
+# include "RE_pipeline.h"
+# include "RE_shader_ext.h"
static void texture_evaluate(struct Tex *tex, float value[3], float r_color[4])
{
- TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
+ TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL};
- /* TODO(sergey): always use color management now. */
- multitex_ext(tex, value, NULL, NULL, 1, &texres, 0, NULL, true, false);
+ /* TODO(sergey): always use color management now. */
+ multitex_ext(tex, value, NULL, NULL, 1, &texres, 0, NULL, true, false);
- r_color[0] = texres.tr;
- r_color[1] = texres.tg;
- r_color[2] = texres.tb;
- r_color[3] = texres.tin;
+ r_color[0] = texres.tr;
+ r_color[1] = texres.tg;
+ r_color[2] = texres.tb;
+ r_color[3] = texres.tin;
}
#else
void RNA_api_texture(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- func = RNA_def_function(srna, "evaluate", "texture_evaluate");
- RNA_def_function_ui_description(func, "Evaluate the texture at the coordinates given");
+ func = RNA_def_function(srna, "evaluate", "texture_evaluate");
+ RNA_def_function_ui_description(func, "Evaluate the texture at the coordinates given");
- parm = RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* return location and normal */
- parm = RNA_def_float_vector(func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ parm = RNA_def_float_vector(func, "value", 3, NULL, -FLT_MAX, FLT_MAX, "", "", -1e4, 1e4);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return location and normal */
+ parm = RNA_def_float_vector(
+ func, "result", 4, NULL, -FLT_MAX, FLT_MAX, "Result", NULL, -1e4, 1e4);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_timeline.c b/source/blender/makesrna/intern/rna_timeline.c
index d3dea9a769d..3308a493212 100644
--- a/source/blender/makesrna/intern/rna_timeline.c
+++ b/source/blender/makesrna/intern/rna_timeline.c
@@ -30,52 +30,53 @@
#ifdef RNA_RUNTIME
-#include "WM_api.h"
+# include "WM_api.h"
-static void rna_TimelineMarker_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_TimelineMarker_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
- WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_SCENE | ND_MARKERS, NULL);
+ WM_main_add_notifier(NC_ANIMATION | ND_MARKERS, NULL);
}
#else
static void rna_def_timeline_marker(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "TimelineMarker", NULL);
- RNA_def_struct_sdna(srna, "TimeMarker");
- RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline");
-
- /* String values */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
-
- prop = RNA_def_property(srna, "frame", PROP_INT, PROP_TIME);
- RNA_def_property_ui_text(prop, "Frame", "The frame on which the timeline marker appears");
- RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
-
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", 1 /*SELECT*/);
- RNA_def_property_ui_text(prop, "Select", "Marker selection state");
- RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
-
-#ifdef DURIAN_CAMERA_SWITCH
- prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Camera", "Camera that becomes active on this frame");
-#endif
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "TimelineMarker", NULL);
+ RNA_def_struct_sdna(srna, "TimeMarker");
+ RNA_def_struct_ui_text(srna, "Marker", "Marker for noting points in the timeline");
+
+ /* String values */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
+
+ prop = RNA_def_property(srna, "frame", PROP_INT, PROP_TIME);
+ RNA_def_property_ui_text(prop, "Frame", "The frame on which the timeline marker appears");
+ RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
+
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", 1 /*SELECT*/);
+ RNA_def_property_ui_text(prop, "Select", "Marker selection state");
+ RNA_def_property_update(prop, 0, "rna_TimelineMarker_update");
+
+# ifdef DURIAN_CAMERA_SWITCH
+ prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
+ RNA_def_property_ui_text(prop, "Camera", "Camera that becomes active on this frame");
+# endif
}
void RNA_def_timeline_marker(BlenderRNA *brna)
{
- rna_def_timeline_marker(brna);
+ rna_def_timeline_marker(brna);
}
-
#endif
diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c
index 154388e4228..1fbdac9df38 100644
--- a/source/blender/makesrna/intern/rna_tracking.c
+++ b/source/blender/makesrna/intern/rna_tracking.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <limits.h>
@@ -33,2177 +32,2493 @@
#include "rna_internal.h"
#include "DNA_movieclip_types.h"
-#include "DNA_object_types.h" /* SELECT */
+#include "DNA_object_types.h" /* SELECT */
#include "DNA_scene_types.h"
#include "WM_types.h"
#ifdef RNA_RUNTIME
-#include "BLI_math.h"
+# include "BLI_math.h"
-#include "DNA_anim_types.h"
+# include "DNA_anim_types.h"
-#include "BKE_animsys.h"
-#include "BKE_node.h"
+# include "BKE_animsys.h"
+# include "BKE_node.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "IMB_imbuf.h"
+# include "IMB_imbuf.h"
-#include "WM_api.h"
+# include "WM_api.h"
static char *rna_tracking_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tracking");
+ return BLI_strdup("tracking");
}
-static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_tracking_defaultSettings_patternUpdate(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingSettings *settings = &tracking->settings;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingSettings *settings = &tracking->settings;
- if (settings->default_search_size < settings->default_pattern_size)
- settings->default_search_size = settings->default_pattern_size;
+ if (settings->default_search_size < settings->default_pattern_size)
+ settings->default_search_size = settings->default_pattern_size;
}
-static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_tracking_defaultSettings_searchUpdate(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingSettings *settings = &tracking->settings;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingSettings *settings = &tracking->settings;
- if (settings->default_pattern_size > settings->default_search_size)
- settings->default_pattern_size = settings->default_search_size;
+ if (settings->default_pattern_size > settings->default_search_size)
+ settings->default_pattern_size = settings->default_search_size;
}
static char *rna_trackingTrack_path(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
- /* Escaped object name, escaped track name, rest of the path. */
- char rna_path[MAX_NAME * 4 + 64];
- BKE_tracking_get_rna_path_for_track(&clip->tracking,
- track,
- rna_path, sizeof(rna_path));
- return BLI_strdup(rna_path);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
+ /* Escaped object name, escaped track name, rest of the path. */
+ char rna_path[MAX_NAME * 4 + 64];
+ BKE_tracking_get_rna_path_for_track(&clip->tracking, track, rna_path, sizeof(rna_path));
+ return BLI_strdup(rna_path);
}
static void rna_trackingTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
+ rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
}
static void rna_trackingPlaneTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.plane_tracks, NULL);
+ rna_iterator_listbase_begin(iter, &clip->tracking.plane_tracks, NULL);
}
static void rna_trackingObjects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.objects, NULL);
+ rna_iterator_listbase_begin(iter, &clip->tracking.objects, NULL);
}
static int rna_tracking_active_object_index_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- return clip->tracking.objectnr;
+ return clip->tracking.objectnr;
}
static void rna_tracking_active_object_index_set(PointerRNA *ptr, int value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- clip->tracking.objectnr = value;
- BKE_tracking_dopesheet_tag_update(&clip->tracking);
+ clip->tracking.objectnr = value;
+ BKE_tracking_dopesheet_tag_update(&clip->tracking);
}
-static void rna_tracking_active_object_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_tracking_active_object_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, clip->tracking.tot_object - 1);
+ *min = 0;
+ *max = max_ii(0, clip->tracking.tot_object - 1);
}
static PointerRNA rna_tracking_active_track_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingTrack *act_track = BKE_tracking_track_get_active(&clip->tracking);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingTrack *act_track = BKE_tracking_track_get_active(&clip->tracking);
- return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingTrack, act_track);
+ return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingTrack, act_track);
}
static void rna_tracking_active_track_set(PointerRNA *ptr, PointerRNA value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingTrack *track = (MovieTrackingTrack *)value.data;
- ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
- int index = BLI_findindex(tracksbase, track);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)value.data;
+ ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
+ int index = BLI_findindex(tracksbase, track);
- if (index != -1)
- clip->tracking.act_track = track;
- else
- clip->tracking.act_track = NULL;
+ if (index != -1)
+ clip->tracking.act_track = track;
+ else
+ clip->tracking.act_track = NULL;
}
static PointerRNA rna_tracking_active_plane_track_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingPlaneTrack *act_plane_track = BKE_tracking_plane_track_get_active(&clip->tracking);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingPlaneTrack *act_plane_track = BKE_tracking_plane_track_get_active(&clip->tracking);
- return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingPlaneTrack, act_plane_track);
+ return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingPlaneTrack, act_plane_track);
}
static void rna_tracking_active_plane_track_set(PointerRNA *ptr, PointerRNA value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *) value.data;
- ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(&clip->tracking);
- int index = BLI_findindex(plane_tracks_base, plane_track);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)value.data;
+ ListBase *plane_tracks_base = BKE_tracking_get_active_plane_tracks(&clip->tracking);
+ int index = BLI_findindex(plane_tracks_base, plane_track);
- if (index != -1)
- clip->tracking.act_plane_track = plane_track;
- else
- clip->tracking.act_plane_track = NULL;
+ if (index != -1)
+ clip->tracking.act_plane_track = plane_track;
+ else
+ clip->tracking.act_plane_track = NULL;
}
static void rna_trackingTrack_name_set(PointerRNA *ptr, const char *value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
- ListBase *tracksbase =
- BKE_tracking_find_tracks_list_for_track(&clip->tracking, track);
- /* Store old name, for the animation fix later. */
- char old_name[sizeof(track->name)];
- BLI_strncpy(old_name, track->name, sizeof(track->name));
- /* Update the name, */
- BLI_strncpy(track->name, value, sizeof(track->name));
- BKE_tracking_track_unique_name(tracksbase, track);
- /* Fix animation paths. */
- AnimData *adt = BKE_animdata_from_id(&clip->id);
- if (adt != NULL) {
- char rna_path[MAX_NAME * 2 + 64];
- BKE_tracking_get_rna_path_prefix_for_track(&clip->tracking,
- track,
- rna_path, sizeof(rna_path));
- BKE_animdata_fix_paths_rename(&clip->id, adt, NULL,
- rna_path,
- old_name, track->name,
- 0, 0, 1);
- }
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
+ ListBase *tracksbase = BKE_tracking_find_tracks_list_for_track(&clip->tracking, track);
+ /* Store old name, for the animation fix later. */
+ char old_name[sizeof(track->name)];
+ BLI_strncpy(old_name, track->name, sizeof(track->name));
+ /* Update the name, */
+ BLI_strncpy(track->name, value, sizeof(track->name));
+ BKE_tracking_track_unique_name(tracksbase, track);
+ /* Fix animation paths. */
+ AnimData *adt = BKE_animdata_from_id(&clip->id);
+ if (adt != NULL) {
+ char rna_path[MAX_NAME * 2 + 64];
+ BKE_tracking_get_rna_path_prefix_for_track(&clip->tracking, track, rna_path, sizeof(rna_path));
+ BKE_animdata_fix_paths_rename(&clip->id, adt, NULL, rna_path, old_name, track->name, 0, 0, 1);
+ }
}
static bool rna_trackingTrack_select_get(PointerRNA *ptr)
{
- MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
- return TRACK_SELECTED(track);
+ return TRACK_SELECTED(track);
}
static void rna_trackingTrack_select_set(PointerRNA *ptr, bool value)
{
- MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data;
- if (value) {
- track->flag |= SELECT;
- track->pat_flag |= SELECT;
- track->search_flag |= SELECT;
- }
- else {
- track->flag &= ~SELECT;
- track->pat_flag &= ~SELECT;
- track->search_flag &= ~SELECT;
- }
+ if (value) {
+ track->flag |= SELECT;
+ track->pat_flag |= SELECT;
+ track->search_flag |= SELECT;
+ }
+ else {
+ track->flag &= ~SELECT;
+ track->pat_flag &= ~SELECT;
+ track->search_flag &= ~SELECT;
+ }
}
static void rna_trackingPlaneMarker_frame_set(PointerRNA *ptr, int value)
{
- MovieClip *clip = (MovieClip *) ptr->id.data;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingPlaneMarker *plane_marker = (MovieTrackingPlaneMarker *) ptr->data;
- MovieTrackingObject *tracking_object;
- bool found = false;
- MovieTrackingPlaneTrack *plane_track = NULL;
-
- for (tracking_object = tracking->objects.first;
- tracking_object;
- tracking_object = tracking_object->next)
- {
- ListBase *tracksbase = BKE_tracking_object_get_plane_tracks(tracking, tracking_object);
-
- for (plane_track = tracksbase->first;
- plane_track;
- plane_track = plane_track->next)
- {
- if (plane_marker >= plane_track->markers && plane_marker < plane_track->markers + plane_track->markersnr) {
- found = true;
- break;
- }
- }
-
- if (found) {
- break;
- }
- }
-
- if (found) {
- MovieTrackingPlaneMarker new_plane_marker = *plane_marker;
- new_plane_marker.framenr = value;
-
- BKE_tracking_plane_marker_delete(plane_track, plane_marker->framenr);
- BKE_tracking_plane_marker_insert(plane_track, &new_plane_marker);
- }
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingPlaneMarker *plane_marker = (MovieTrackingPlaneMarker *)ptr->data;
+ MovieTrackingObject *tracking_object;
+ bool found = false;
+ MovieTrackingPlaneTrack *plane_track = NULL;
+
+ for (tracking_object = tracking->objects.first; tracking_object;
+ tracking_object = tracking_object->next) {
+ ListBase *tracksbase = BKE_tracking_object_get_plane_tracks(tracking, tracking_object);
+
+ for (plane_track = tracksbase->first; plane_track; plane_track = plane_track->next) {
+ if (plane_marker >= plane_track->markers &&
+ plane_marker < plane_track->markers + plane_track->markersnr) {
+ found = true;
+ break;
+ }
+ }
+
+ if (found) {
+ break;
+ }
+ }
+
+ if (found) {
+ MovieTrackingPlaneMarker new_plane_marker = *plane_marker;
+ new_plane_marker.framenr = value;
+
+ BKE_tracking_plane_marker_delete(plane_track, plane_marker->framenr);
+ BKE_tracking_plane_marker_insert(plane_track, &new_plane_marker);
+ }
}
static char *rna_trackingPlaneTrack_path(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data;
- /* Escaped object name, escaped track name, rest of the path. */
- char rna_path[MAX_NAME * 4 + 64];
- BKE_tracking_get_rna_path_for_plane_track(&clip->tracking,
- plane_track,
- rna_path, sizeof(rna_path));
- return BLI_strdup(rna_path);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data;
+ /* Escaped object name, escaped track name, rest of the path. */
+ char rna_path[MAX_NAME * 4 + 64];
+ BKE_tracking_get_rna_path_for_plane_track(
+ &clip->tracking, plane_track, rna_path, sizeof(rna_path));
+ return BLI_strdup(rna_path);
}
static void rna_trackingPlaneTrack_name_set(PointerRNA *ptr, const char *value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data;
- ListBase *plane_tracks_base =
- BKE_tracking_find_tracks_list_for_plane_track(&clip->tracking,
- plane_track);
- /* Store old name, for the animation fix later. */
- char old_name[sizeof(plane_track->name)];
- BLI_strncpy(old_name, plane_track->name, sizeof(plane_track->name));
- /* Update the name, */
- BLI_strncpy(plane_track->name, value, sizeof(plane_track->name));
- BKE_tracking_plane_track_unique_name(plane_tracks_base, plane_track);
- /* Fix animation paths. */
- AnimData *adt = BKE_animdata_from_id(&clip->id);
- if (adt != NULL) {
- char rna_path[MAX_NAME * 2 + 64];
- BKE_tracking_get_rna_path_prefix_for_plane_track(&clip->tracking,
- plane_track,
- rna_path,
- sizeof(rna_path));
- BKE_animdata_fix_paths_rename(&clip->id, adt, NULL,
- rna_path,
- old_name, plane_track->name,
- 0, 0, 1);
- }
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingPlaneTrack *plane_track = (MovieTrackingPlaneTrack *)ptr->data;
+ ListBase *plane_tracks_base = BKE_tracking_find_tracks_list_for_plane_track(&clip->tracking,
+ plane_track);
+ /* Store old name, for the animation fix later. */
+ char old_name[sizeof(plane_track->name)];
+ BLI_strncpy(old_name, plane_track->name, sizeof(plane_track->name));
+ /* Update the name, */
+ BLI_strncpy(plane_track->name, value, sizeof(plane_track->name));
+ BKE_tracking_plane_track_unique_name(plane_tracks_base, plane_track);
+ /* Fix animation paths. */
+ AnimData *adt = BKE_animdata_from_id(&clip->id);
+ if (adt != NULL) {
+ char rna_path[MAX_NAME * 2 + 64];
+ BKE_tracking_get_rna_path_prefix_for_plane_track(
+ &clip->tracking, plane_track, rna_path, sizeof(rna_path));
+ BKE_animdata_fix_paths_rename(
+ &clip->id, adt, NULL, rna_path, old_name, plane_track->name, 0, 0, 1);
+ }
}
static char *rna_trackingCamera_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tracking.camera");
+ return BLI_strdup("tracking.camera");
}
static float rna_trackingCamera_focal_mm_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingCamera *camera = &clip->tracking.camera;
- float val = camera->focal;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingCamera *camera = &clip->tracking.camera;
+ float val = camera->focal;
- if (clip->lastsize[0])
- val = val * camera->sensor_width / (float)clip->lastsize[0];
+ if (clip->lastsize[0])
+ val = val * camera->sensor_width / (float)clip->lastsize[0];
- return val;
+ return val;
}
static void rna_trackingCamera_focal_mm_set(PointerRNA *ptr, float value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingCamera *camera = &clip->tracking.camera;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingCamera *camera = &clip->tracking.camera;
- if (clip->lastsize[0])
- value = clip->lastsize[0] * value / camera->sensor_width;
+ if (clip->lastsize[0])
+ value = clip->lastsize[0] * value / camera->sensor_width;
- if (value >= 0.0001f)
- camera->focal = value;
+ if (value >= 0.0001f)
+ camera->focal = value;
}
static char *rna_trackingStabilization_path(PointerRNA *UNUSED(ptr))
{
- return BLI_strdup("tracking.stabilization");
+ return BLI_strdup("tracking.stabilization");
}
static int rna_track_2d_stabilization(CollectionPropertyIterator *UNUSED(iter), void *data)
{
- MovieTrackingTrack *track = (MovieTrackingTrack *)data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)data;
- if ((track->flag & TRACK_USE_2D_STAB) == 0)
- return 1;
+ if ((track->flag & TRACK_USE_2D_STAB) == 0)
+ return 1;
- return 0;
+ return 0;
}
-static int rna_track_2d_stabilization_rotation(CollectionPropertyIterator *UNUSED(iter), void *data)
+static int rna_track_2d_stabilization_rotation(CollectionPropertyIterator *UNUSED(iter),
+ void *data)
{
- MovieTrackingTrack *track = (MovieTrackingTrack *)data;
+ MovieTrackingTrack *track = (MovieTrackingTrack *)data;
- if ((track->flag & TRACK_USE_2D_STAB_ROT) == 0)
- return 1;
+ if ((track->flag & TRACK_USE_2D_STAB_ROT) == 0)
+ return 1;
- return 0;
+ return 0;
}
static void rna_tracking_stabTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization);
}
static int rna_tracking_stabTracks_active_index_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- return clip->tracking.stabilization.act_track;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ return clip->tracking.stabilization.act_track;
}
static void rna_tracking_stabTracks_active_index_set(PointerRNA *ptr, int value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- clip->tracking.stabilization.act_track = value;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ clip->tracking.stabilization.act_track = value;
}
-static void rna_tracking_stabTracks_active_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_tracking_stabTracks_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, clip->tracking.stabilization.tot_track - 1);
+ *min = 0;
+ *max = max_ii(0, clip->tracking.stabilization.tot_track - 1);
}
static void rna_tracking_stabRotTracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization_rotation);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ rna_iterator_listbase_begin(iter, &clip->tracking.tracks, rna_track_2d_stabilization_rotation);
}
static int rna_tracking_stabRotTracks_active_index_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- return clip->tracking.stabilization.act_rot_track;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ return clip->tracking.stabilization.act_rot_track;
}
static void rna_tracking_stabRotTracks_active_index_set(PointerRNA *ptr, int value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- clip->tracking.stabilization.act_rot_track = value;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ clip->tracking.stabilization.act_rot_track = value;
}
-static void rna_tracking_stabRotTracks_active_index_range(PointerRNA *ptr, int *min, int *max,
- int *UNUSED(softmin), int *UNUSED(softmax))
+static void rna_tracking_stabRotTracks_active_index_range(
+ PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- *min = 0;
- *max = max_ii(0, clip->tracking.stabilization.tot_rot_track - 1);
+ *min = 0;
+ *max = max_ii(0, clip->tracking.stabilization.tot_rot_track - 1);
}
static void rna_tracking_flushUpdate(Main *UNUSED(bmain), Scene *scene, PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- nodeUpdateID(scene->nodetree, &clip->id);
+ nodeUpdateID(scene->nodetree, &clip->id);
- WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
- WM_main_add_notifier(NC_SCENE, NULL);
- DEG_id_tag_update(&clip->id, 0);
+ WM_main_add_notifier(NC_SCENE | ND_NODES, NULL);
+ WM_main_add_notifier(NC_SCENE, NULL);
+ DEG_id_tag_update(&clip->id, 0);
}
-static void rna_tracking_resetIntrinsics(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_tracking_resetIntrinsics(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTracking *tracking = &clip->tracking;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTracking *tracking = &clip->tracking;
- if (tracking->camera.intrinsics) {
- BKE_tracking_distortion_free(tracking->camera.intrinsics);
- tracking->camera.intrinsics = NULL;
- }
+ if (tracking->camera.intrinsics) {
+ BKE_tracking_distortion_free(tracking->camera.intrinsics);
+ tracking->camera.intrinsics = NULL;
+ }
}
static void rna_trackingObject_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
+ MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
- if (object->flag & TRACKING_OBJECT_CAMERA) {
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
- }
- else {
- rna_iterator_listbase_begin(iter, &object->tracks, NULL);
- }
+ rna_iterator_listbase_begin(iter, &clip->tracking.tracks, NULL);
+ }
+ else {
+ rna_iterator_listbase_begin(iter, &object->tracks, NULL);
+ }
}
-static void rna_trackingObject_plane_tracks_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_trackingObject_plane_tracks_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
+ MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
- if (object->flag & TRACKING_OBJECT_CAMERA) {
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- rna_iterator_listbase_begin(iter, &clip->tracking.plane_tracks, NULL);
- }
- else {
- rna_iterator_listbase_begin(iter, &object->plane_tracks, NULL);
- }
+ rna_iterator_listbase_begin(iter, &clip->tracking.plane_tracks, NULL);
+ }
+ else {
+ rna_iterator_listbase_begin(iter, &object->plane_tracks, NULL);
+ }
}
static PointerRNA rna_trackingObject_reconstruction_get(PointerRNA *ptr)
{
- MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
+ MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
- if (object->flag & TRACKING_OBJECT_CAMERA) {
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingReconstruction, &clip->tracking.reconstruction);
- }
- else {
- return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingReconstruction, &object->reconstruction);
- }
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_MovieTrackingReconstruction, &clip->tracking.reconstruction);
+ }
+ else {
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_MovieTrackingReconstruction, &object->reconstruction);
+ }
}
static PointerRNA rna_tracking_active_object_get(PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingObject *object = BLI_findlink(&clip->tracking.objects, clip->tracking.objectnr);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingObject *object = BLI_findlink(&clip->tracking.objects, clip->tracking.objectnr);
- return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingObject, object);
+ return rna_pointer_inherit_refine(ptr, &RNA_MovieTrackingObject, object);
}
static void rna_tracking_active_object_set(PointerRNA *ptr, PointerRNA value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingObject *object = (MovieTrackingObject *)value.data;
- int index = BLI_findindex(&clip->tracking.objects, object);
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingObject *object = (MovieTrackingObject *)value.data;
+ int index = BLI_findindex(&clip->tracking.objects, object);
- if (index != -1) clip->tracking.objectnr = index;
- else clip->tracking.objectnr = 0;
+ if (index != -1)
+ clip->tracking.objectnr = index;
+ else
+ clip->tracking.objectnr = 0;
}
static void rna_trackingObject_name_set(PointerRNA *ptr, const char *value)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingObject *object = (MovieTrackingObject *)ptr->data;
- BLI_strncpy(object->name, value, sizeof(object->name));
+ BLI_strncpy(object->name, value, sizeof(object->name));
- BKE_tracking_object_unique_name(&clip->tracking, object);
+ BKE_tracking_object_unique_name(&clip->tracking, object);
}
-static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_trackingObject_flushUpdate(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
- WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, NULL);
- DEG_id_tag_update(&clip->id, 0);
+ WM_main_add_notifier(NC_OBJECT | ND_TRANSFORM, NULL);
+ DEG_id_tag_update(&clip->id, 0);
}
static void rna_trackingMarker_frame_set(PointerRNA *ptr, int value)
{
- MovieClip *clip = (MovieClip *) ptr->id.data;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingMarker *marker = (MovieTrackingMarker *) ptr->data;
- MovieTrackingObject *tracking_object;
- bool found = false;
- MovieTrackingTrack *track = NULL;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
+ MovieTrackingObject *tracking_object;
+ bool found = false;
+ MovieTrackingTrack *track = NULL;
- for (tracking_object = tracking->objects.first;
- tracking_object;
- tracking_object = tracking_object->next)
- {
- ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
+ for (tracking_object = tracking->objects.first; tracking_object;
+ tracking_object = tracking_object->next) {
+ ListBase *tracksbase = BKE_tracking_object_get_tracks(tracking, tracking_object);
- for (track = tracksbase->first;
- track;
- track = track->next)
- {
- if (marker >= track->markers && marker < track->markers + track->markersnr) {
- found = true;
- break;
- }
- }
+ for (track = tracksbase->first; track; track = track->next) {
+ if (marker >= track->markers && marker < track->markers + track->markersnr) {
+ found = true;
+ break;
+ }
+ }
- if (found) {
- break;
- }
- }
+ if (found) {
+ break;
+ }
+ }
- if (found) {
- MovieTrackingMarker new_marker = *marker;
- new_marker.framenr = value;
+ if (found) {
+ MovieTrackingMarker new_marker = *marker;
+ new_marker.framenr = value;
- BKE_tracking_marker_delete(track, marker->framenr);
- BKE_tracking_marker_insert(track, &new_marker);
- }
+ BKE_tracking_marker_delete(track, marker->framenr);
+ BKE_tracking_marker_insert(track, &new_marker);
+ }
}
-static void rna_tracking_markerPattern_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_tracking_markerPattern_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
+ MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
- BKE_tracking_marker_clamp(marker, CLAMP_PAT_DIM);
+ BKE_tracking_marker_clamp(marker, CLAMP_PAT_DIM);
}
-static void rna_tracking_markerSearch_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_tracking_markerSearch_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
+ MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
- BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM);
+ BKE_tracking_marker_clamp(marker, CLAMP_SEARCH_DIM);
}
static void rna_tracking_markerPattern_boundbox_get(PointerRNA *ptr, float *values)
{
- MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
- float min[2], max[2];
+ MovieTrackingMarker *marker = (MovieTrackingMarker *)ptr->data;
+ float min[2], max[2];
- BKE_tracking_marker_pattern_minmax(marker, min, max);
+ BKE_tracking_marker_pattern_minmax(marker, min, max);
- copy_v2_v2(values, min);
- copy_v2_v2(values + 2, max);
+ copy_v2_v2(values, min);
+ copy_v2_v2(values + 2, max);
}
-static void rna_trackingDopesheet_tagUpdate(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_trackingDopesheet_tagUpdate(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- MovieClip *clip = (MovieClip *)ptr->id.data;
- MovieTrackingDopesheet *dopesheet = &clip->tracking.dopesheet;
+ MovieClip *clip = (MovieClip *)ptr->id.data;
+ MovieTrackingDopesheet *dopesheet = &clip->tracking.dopesheet;
- dopesheet->ok = 0;
+ dopesheet->ok = 0;
}
/* API */
-static MovieTrackingTrack *add_track_to_base(MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase,
- const char *name, int frame)
+static MovieTrackingTrack *add_track_to_base(
+ MovieClip *clip, MovieTracking *tracking, ListBase *tracksbase, const char *name, int frame)
{
- int width, height;
- MovieClipUser user = {0};
- MovieTrackingTrack *track;
+ int width, height;
+ MovieClipUser user = {0};
+ MovieTrackingTrack *track;
- user.framenr = 1;
+ user.framenr = 1;
- BKE_movieclip_get_size(clip, &user, &width, &height);
+ BKE_movieclip_get_size(clip, &user, &width, &height);
- track = BKE_tracking_track_add(tracking, tracksbase, 0, 0, frame, width, height);
+ track = BKE_tracking_track_add(tracking, tracksbase, 0, 0, frame, width, height);
- if (name && name[0]) {
- BLI_strncpy(track->name, name, sizeof(track->name));
- BKE_tracking_track_unique_name(tracksbase, track);
- }
+ if (name && name[0]) {
+ BLI_strncpy(track->name, name, sizeof(track->name));
+ BKE_tracking_track_unique_name(tracksbase, track);
+ }
- return track;
+ return track;
}
-static MovieTrackingTrack *rna_trackingTracks_new(ID *id, MovieTracking *tracking, const char *name, int frame)
+static MovieTrackingTrack *rna_trackingTracks_new(ID *id,
+ MovieTracking *tracking,
+ const char *name,
+ int frame)
{
- MovieClip *clip = (MovieClip *) id;
- MovieTrackingTrack *track;
+ MovieClip *clip = (MovieClip *)id;
+ MovieTrackingTrack *track;
- track = add_track_to_base(clip, tracking, &tracking->tracks, name, frame);
+ track = add_track_to_base(clip, tracking, &tracking->tracks, name, frame);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, clip);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, clip);
- return track;
+ return track;
}
-static MovieTrackingTrack *rna_trackingObject_tracks_new(ID *id, MovieTrackingObject *object, const char *name,
+static MovieTrackingTrack *rna_trackingObject_tracks_new(ID *id,
+ MovieTrackingObject *object,
+ const char *name,
int frame)
{
- MovieClip *clip = (MovieClip *) id;
- ListBase *tracksbase = &object->tracks;
- MovieTrackingTrack *track;
+ MovieClip *clip = (MovieClip *)id;
+ ListBase *tracksbase = &object->tracks;
+ MovieTrackingTrack *track;
- if (object->flag & TRACKING_OBJECT_CAMERA)
- tracksbase = &clip->tracking.tracks;
+ if (object->flag & TRACKING_OBJECT_CAMERA)
+ tracksbase = &clip->tracking.tracks;
- track = add_track_to_base(clip, &clip->tracking, tracksbase, name, frame);
+ track = add_track_to_base(clip, &clip->tracking, tracksbase, name, frame);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
- return track;
+ return track;
}
static MovieTrackingObject *rna_trackingObject_new(MovieTracking *tracking, const char *name)
{
- MovieTrackingObject *object = BKE_tracking_object_add(tracking, name);
+ MovieTrackingObject *object = BKE_tracking_object_add(tracking, name);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
- return object;
+ return object;
}
-static void rna_trackingObject_remove(MovieTracking *tracking, ReportList *reports, PointerRNA *object_ptr)
+static void rna_trackingObject_remove(MovieTracking *tracking,
+ ReportList *reports,
+ PointerRNA *object_ptr)
{
- MovieTrackingObject *object = object_ptr->data;
- if (BKE_tracking_object_delete(tracking, object) == false) {
- BKE_reportf(reports, RPT_ERROR, "MovieTracking '%s' cannot be removed", object->name);
- return;
- }
+ MovieTrackingObject *object = object_ptr->data;
+ if (BKE_tracking_object_delete(tracking, object) == false) {
+ BKE_reportf(reports, RPT_ERROR, "MovieTracking '%s' cannot be removed", object->name);
+ return;
+ }
- RNA_POINTER_INVALIDATE(object_ptr);
+ RNA_POINTER_INVALIDATE(object_ptr);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
}
-static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track, int framenr, bool exact)
+static MovieTrackingMarker *rna_trackingMarkers_find_frame(MovieTrackingTrack *track,
+ int framenr,
+ bool exact)
{
- if (exact)
- return BKE_tracking_marker_get_exact(track, framenr);
- else
- return BKE_tracking_marker_get(track, framenr);
+ if (exact)
+ return BKE_tracking_marker_get_exact(track, framenr);
+ else
+ return BKE_tracking_marker_get(track, framenr);
}
-static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack *track, int framenr, float *co)
+static MovieTrackingMarker *rna_trackingMarkers_insert_frame(MovieTrackingTrack *track,
+ int framenr,
+ float *co)
{
- MovieTrackingMarker marker, *new_marker;
+ MovieTrackingMarker marker, *new_marker;
- memset(&marker, 0, sizeof(marker));
- marker.framenr = framenr;
- copy_v2_v2(marker.pos, co);
+ memset(&marker, 0, sizeof(marker));
+ marker.framenr = framenr;
+ copy_v2_v2(marker.pos, co);
- /* a bit arbitrary, but better than creating markers with zero pattern
- * which is forbidden actually
- */
- copy_v2_v2(marker.pattern_corners[0], track->markers[0].pattern_corners[0]);
- copy_v2_v2(marker.pattern_corners[1], track->markers[0].pattern_corners[1]);
- copy_v2_v2(marker.pattern_corners[2], track->markers[0].pattern_corners[2]);
- copy_v2_v2(marker.pattern_corners[3], track->markers[0].pattern_corners[3]);
+ /* a bit arbitrary, but better than creating markers with zero pattern
+ * which is forbidden actually
+ */
+ copy_v2_v2(marker.pattern_corners[0], track->markers[0].pattern_corners[0]);
+ copy_v2_v2(marker.pattern_corners[1], track->markers[0].pattern_corners[1]);
+ copy_v2_v2(marker.pattern_corners[2], track->markers[0].pattern_corners[2]);
+ copy_v2_v2(marker.pattern_corners[3], track->markers[0].pattern_corners[3]);
- new_marker = BKE_tracking_marker_insert(track, &marker);
+ new_marker = BKE_tracking_marker_insert(track, &marker);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
- return new_marker;
+ return new_marker;
}
static void rna_trackingMarkers_delete_frame(MovieTrackingTrack *track, int framenr)
{
- if (track->markersnr == 1)
- return;
+ if (track->markersnr == 1)
+ return;
- BKE_tracking_marker_delete(track, framenr);
+ BKE_tracking_marker_delete(track, framenr);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
}
-static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(MovieTrackingPlaneTrack *plane_track,
- int framenr, bool exact)
+static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_find_frame(
+ MovieTrackingPlaneTrack *plane_track, int framenr, bool exact)
{
- if (exact)
- return BKE_tracking_plane_marker_get_exact(plane_track, framenr);
- else
- return BKE_tracking_plane_marker_get(plane_track, framenr);
+ if (exact)
+ return BKE_tracking_plane_marker_get_exact(plane_track, framenr);
+ else
+ return BKE_tracking_plane_marker_get(plane_track, framenr);
}
-static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_insert_frame(MovieTrackingPlaneTrack *plane_track,
- int framenr)
+static MovieTrackingPlaneMarker *rna_trackingPlaneMarkers_insert_frame(
+ MovieTrackingPlaneTrack *plane_track, int framenr)
{
- MovieTrackingPlaneMarker plane_marker, *new_plane_marker;
+ MovieTrackingPlaneMarker plane_marker, *new_plane_marker;
- memset(&plane_marker, 0, sizeof(plane_marker));
- plane_marker.framenr = framenr;
+ memset(&plane_marker, 0, sizeof(plane_marker));
+ plane_marker.framenr = framenr;
- /* a bit arbitrary, but better than creating zero markers */
- copy_v2_v2(plane_marker.corners[0], plane_track->markers[0].corners[0]);
- copy_v2_v2(plane_marker.corners[1], plane_track->markers[0].corners[1]);
- copy_v2_v2(plane_marker.corners[2], plane_track->markers[0].corners[2]);
- copy_v2_v2(plane_marker.corners[3], plane_track->markers[0].corners[3]);
+ /* a bit arbitrary, but better than creating zero markers */
+ copy_v2_v2(plane_marker.corners[0], plane_track->markers[0].corners[0]);
+ copy_v2_v2(plane_marker.corners[1], plane_track->markers[0].corners[1]);
+ copy_v2_v2(plane_marker.corners[2], plane_track->markers[0].corners[2]);
+ copy_v2_v2(plane_marker.corners[3], plane_track->markers[0].corners[3]);
- new_plane_marker = BKE_tracking_plane_marker_insert(plane_track, &plane_marker);
+ new_plane_marker = BKE_tracking_plane_marker_insert(plane_track, &plane_marker);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
- return new_plane_marker;
+ return new_plane_marker;
}
-static void rna_trackingPlaneMarkers_delete_frame(MovieTrackingPlaneTrack *plane_track, int framenr)
+static void rna_trackingPlaneMarkers_delete_frame(MovieTrackingPlaneTrack *plane_track,
+ int framenr)
{
- if (plane_track->markersnr == 1)
- return;
+ if (plane_track->markersnr == 1)
+ return;
- BKE_tracking_plane_marker_delete(plane_track, framenr);
+ BKE_tracking_plane_marker_delete(plane_track, framenr);
- WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_MOVIECLIP | NA_EDITED, NULL);
}
-static MovieTrackingObject *find_object_for_reconstruction(MovieTracking *tracking,
- MovieTrackingReconstruction *reconstruction)
+static MovieTrackingObject *find_object_for_reconstruction(
+ MovieTracking *tracking, MovieTrackingReconstruction *reconstruction)
{
- MovieTrackingObject *object;
+ MovieTrackingObject *object;
- for (object = tracking->objects.first; object; object = object->next) {
- if (object->flag & TRACKING_OBJECT_CAMERA) {
- if (&tracking->reconstruction == reconstruction) {
- return object;
- }
- }
- else if (&object->reconstruction == reconstruction) {
- return object;
- }
- }
+ for (object = tracking->objects.first; object; object = object->next) {
+ if (object->flag & TRACKING_OBJECT_CAMERA) {
+ if (&tracking->reconstruction == reconstruction) {
+ return object;
+ }
+ }
+ else if (&object->reconstruction == reconstruction) {
+ return object;
+ }
+ }
- return NULL;
+ return NULL;
}
-static MovieReconstructedCamera *rna_trackingCameras_find_frame(ID *id, MovieTrackingReconstruction *reconstruction, int framenr)
+static MovieReconstructedCamera *rna_trackingCameras_find_frame(
+ ID *id, MovieTrackingReconstruction *reconstruction, int framenr)
{
- MovieClip *clip = (MovieClip *) id;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingObject *object = find_object_for_reconstruction(tracking, reconstruction);
- return BKE_tracking_camera_get_reconstructed(tracking, object, framenr);
+ MovieClip *clip = (MovieClip *)id;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingObject *object = find_object_for_reconstruction(tracking, reconstruction);
+ return BKE_tracking_camera_get_reconstructed(tracking, object, framenr);
}
-static void rna_trackingCameras_matrix_from_frame(ID *id, MovieTrackingReconstruction *reconstruction, int framenr, float matrix[16])
+static void rna_trackingCameras_matrix_from_frame(ID *id,
+ MovieTrackingReconstruction *reconstruction,
+ int framenr,
+ float matrix[16])
{
- float mat[4][4];
+ float mat[4][4];
- MovieClip *clip = (MovieClip *) id;
- MovieTracking *tracking = &clip->tracking;
- MovieTrackingObject *object = find_object_for_reconstruction(tracking, reconstruction);
- BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, framenr, mat);
+ MovieClip *clip = (MovieClip *)id;
+ MovieTracking *tracking = &clip->tracking;
+ MovieTrackingObject *object = find_object_for_reconstruction(tracking, reconstruction);
+ BKE_tracking_camera_get_reconstructed_interpolate(tracking, object, framenr, mat);
- memcpy(matrix, mat, sizeof(float) * 16);
+ memcpy(matrix, mat, sizeof(float) * 16);
}
#else
static const EnumPropertyItem tracker_motion_model[] = {
- {TRACK_MOTION_MODEL_HOMOGRAPHY, "Perspective", 0, "Perspective",
- "Search for markers that are perspectively deformed (homography) between frames"},
- {TRACK_MOTION_MODEL_AFFINE, "Affine", 0, "Affine",
- "Search for markers that are affine-deformed (t, r, k, and skew) between frames"},
- {TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE, "LocRotScale", 0, "LocRotScale",
- "Search for markers that are translated, rotated, and scaled between frames"},
- {TRACK_MOTION_MODEL_TRANSLATION_SCALE, "LocScale", 0, "LocScale",
- "Search for markers that are translated and scaled between frames"},
- {TRACK_MOTION_MODEL_TRANSLATION_ROTATION, "LocRot", 0, "LocRot",
- "Search for markers that are translated and rotated between frames"},
- {TRACK_MOTION_MODEL_TRANSLATION, "Loc", 0, "Loc",
- "Search for markers that are translated between frames"},
- {0, NULL, 0, NULL, NULL},
+ {TRACK_MOTION_MODEL_HOMOGRAPHY,
+ "Perspective",
+ 0,
+ "Perspective",
+ "Search for markers that are perspectively deformed (homography) between frames"},
+ {TRACK_MOTION_MODEL_AFFINE,
+ "Affine",
+ 0,
+ "Affine",
+ "Search for markers that are affine-deformed (t, r, k, and skew) between frames"},
+ {TRACK_MOTION_MODEL_TRANSLATION_ROTATION_SCALE,
+ "LocRotScale",
+ 0,
+ "LocRotScale",
+ "Search for markers that are translated, rotated, and scaled between frames"},
+ {TRACK_MOTION_MODEL_TRANSLATION_SCALE,
+ "LocScale",
+ 0,
+ "LocScale",
+ "Search for markers that are translated and scaled between frames"},
+ {TRACK_MOTION_MODEL_TRANSLATION_ROTATION,
+ "LocRot",
+ 0,
+ "LocRot",
+ "Search for markers that are translated and rotated between frames"},
+ {TRACK_MOTION_MODEL_TRANSLATION,
+ "Loc",
+ 0,
+ "Loc",
+ "Search for markers that are translated between frames"},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem pattern_match_items[] = {
- {TRACK_MATCH_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Track pattern from keyframe to next frame"},
- {TRACK_MATCH_PREVFRAME, "PREV_FRAME", 0, "Previous frame", "Track pattern from current frame to next frame"},
- {0, NULL, 0, NULL, NULL},
+ {TRACK_MATCH_KEYFRAME, "KEYFRAME", 0, "Keyframe", "Track pattern from keyframe to next frame"},
+ {TRACK_MATCH_PREVFRAME,
+ "PREV_FRAME",
+ 0,
+ "Previous frame",
+ "Track pattern from current frame to next frame"},
+ {0, NULL, 0, NULL, NULL},
};
static void rna_def_trackingSettings(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem speed_items[] = {
- {0, "FASTEST", 0, "Fastest", "Track as fast as it's possible"},
- {TRACKING_SPEED_DOUBLE, "DOUBLE", 0, "Double", "Track with double speed"},
- {TRACKING_SPEED_REALTIME, "REALTIME", 0, "Realtime", "Track with realtime speed"},
- {TRACKING_SPEED_HALF, "HALF", 0, "Half", "Track with half of realtime speed"},
- {TRACKING_SPEED_QUARTER, "QUARTER", 0, "Quarter", "Track with quarter of realtime speed"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem cleanup_items[] = {
- {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
- {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
- {TRACKING_CLEAN_DELETE_SEGMENT, "DELETE_SEGMENTS", 0, "Delete Segments", "Delete unclean segments of tracks"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem refine_items[] = {
- {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
- {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
- {REFINE_FOCAL_LENGTH | REFINE_RADIAL_DISTORTION_K1, "FOCAL_LENGTH_RADIAL_K1", 0, "Focal length, K1",
- "Refine focal length and radial distortion K1"},
- {REFINE_FOCAL_LENGTH |
- REFINE_RADIAL_DISTORTION_K1 |
- REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_RADIAL_K1_K2", 0, "Focal length, K1, K2",
- "Refine focal length and radial distortion K1 and K2"},
- {REFINE_FOCAL_LENGTH |
- REFINE_PRINCIPAL_POINT |
- REFINE_RADIAL_DISTORTION_K1 |
- REFINE_RADIAL_DISTORTION_K2, "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2", 0,
- "Focal Length, Optical Center, K1, K2",
- "Refine focal length, optical center and radial distortion K1 and K2"},
- {REFINE_FOCAL_LENGTH |
- REFINE_PRINCIPAL_POINT, "FOCAL_LENGTH_PRINCIPAL_POINT", 0, "Focal Length, Optical Center",
- "Refine focal length and optical center"},
- {REFINE_RADIAL_DISTORTION_K1 |
- REFINE_RADIAL_DISTORTION_K2, "RADIAL_K1_K2", 0, "K1, K2",
- "Refine radial distortion K1 and K2"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieTrackingSettings", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings");
-
- /* speed */
- prop = RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, speed_items);
- RNA_def_property_ui_text(prop, "Speed",
- "Limit speed of tracking to make visual feedback easier "
- "(this does not affect the tracking quality)");
-
- /* use keyframe selection */
- prop = RNA_def_property(srna, "use_keyframe_selection", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "reconstruction_flag", TRACKING_USE_KEYFRAME_SELECTION);
- RNA_def_property_ui_text(prop, "Keyframe Selection",
- "Automatically select keyframes when solving camera/object motion");
-
- /* intrinsics refinement during bundle adjustment */
- prop = RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, refine_items);
- RNA_def_property_ui_text(prop, "Refine", "Refine intrinsics during camera solving");
-
- /* tool settings */
-
- /* distance */
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "dist");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for scene scaling");
-
- /* frames count */
- prop = RNA_def_property(srna, "clean_frames", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "clean_frames");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_text(prop, "Tracked Frames",
- "Effect on tracks which are tracked less than the specified amount of frames");
-
- /* re-projection error */
- prop = RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "clean_error");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_text(prop, "Reprojection Error", "Effect on tracks which have a larger re-projection error");
-
- /* cleanup action */
- prop = RNA_def_property(srna, "clean_action", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "clean_action");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, cleanup_items);
- RNA_def_property_ui_text(prop, "Action", "Cleanup action to execute");
-
- /* ** default tracker settings ** */
- prop = RNA_def_property(srna, "show_default_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED);
- RNA_def_property_ui_text(prop, "Show Expanded", "Show default options expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- /* ** extra tracker settings ** */
- prop = RNA_def_property(srna, "show_extra_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_EXTRA_EXPANDED);
- RNA_def_property_ui_text(prop, "Show Expanded", "Show extra options expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- /* solver settings */
- prop = RNA_def_property(srna, "use_tripod_solver", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "motion_flag", TRACKING_MOTION_TRIPOD);
- RNA_def_property_ui_text(prop, "Tripod Motion",
- "Use special solver to track a stable camera position, such as a tripod");
-
- /* default_limit_frames */
- prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "default_frames_limit");
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
-
- /* default_pattern_match */
- prop = RNA_def_property(srna, "default_pattern_match", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "default_pattern_match");
- RNA_def_property_enum_items(prop, pattern_match_items);
- RNA_def_property_ui_text(prop, "Pattern Match",
- "Track pattern from given frame when tracking marker to next frame");
-
- /* default_margin */
- prop = RNA_def_property(srna, "default_margin", PROP_INT, PROP_PIXEL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "default_margin");
- RNA_def_property_range(prop, 0, 300);
- RNA_def_property_ui_text(prop, "Margin", "Default distance from image boundary at which marker stops tracking");
-
- /* default_tracking_motion_model */
- prop = RNA_def_property(srna, "default_motion_model", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, tracker_motion_model);
- RNA_def_property_ui_text(prop, "Motion model", "Default motion model to use for tracking");
-
- /* default_use_brute */
- prop = RNA_def_property(srna, "use_default_brute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_BRUTE);
- RNA_def_property_ui_text(prop, "Prepass", "Use a brute-force translation-only initialization when tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* default_use_brute */
- prop = RNA_def_property(srna, "use_default_mask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
- RNA_def_property_ui_text(prop, "Use Mask",
- "Use a grease pencil data-block as a mask to use only specified areas of pattern "
- "when tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* default_use_normalization */
- prop = RNA_def_property(srna, "use_default_normalization", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_NORMALIZATION);
- RNA_def_property_ui_text(prop, "Normalize", "Normalize light intensities while tracking (slower)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* default minmal correlation */
- prop = RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
- RNA_def_property_ui_text(prop, "Correlation",
- "Default minimum value of correlation between matched pattern and reference "
- "that is still treated as successful tracking");
-
- /* default pattern size */
- prop = RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "default_pattern_size");
- RNA_def_property_range(prop, 5, 1000);
- RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_patternUpdate");
- RNA_def_property_ui_text(prop, "Pattern Size", "Size of pattern area for newly created tracks");
-
- /* default search size */
- prop = RNA_def_property(srna, "default_search_size", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "default_search_size");
- RNA_def_property_range(prop, 5, 1000);
- RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_searchUpdate");
- RNA_def_property_ui_text(prop, "Search Size", "Size of search area for newly created tracks");
-
- /* default use_red_channel */
- prop = RNA_def_property(srna, "use_default_red_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_RED);
- RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* default_use_green_channel */
- prop = RNA_def_property(srna, "use_default_green_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_GREEN);
- RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* default_use_blue_channel */
- prop = RNA_def_property(srna, "use_default_blue_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_BLUE);
- RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Weight", "Influence of newly created track on a final solution");
-
- /* ** object tracking ** */
-
- /* object distance */
- prop = RNA_def_property(srna, "object_distance", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "object_distance");
- RNA_def_property_ui_text(prop, "Distance", "Distance between two bundles used for object scaling");
- RNA_def_property_range(prop, 0.001, 10000);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_range(prop, 0.001, 10000.0, 1, 3);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem speed_items[] = {
+ {0, "FASTEST", 0, "Fastest", "Track as fast as it's possible"},
+ {TRACKING_SPEED_DOUBLE, "DOUBLE", 0, "Double", "Track with double speed"},
+ {TRACKING_SPEED_REALTIME, "REALTIME", 0, "Realtime", "Track with realtime speed"},
+ {TRACKING_SPEED_HALF, "HALF", 0, "Half", "Track with half of realtime speed"},
+ {TRACKING_SPEED_QUARTER, "QUARTER", 0, "Quarter", "Track with quarter of realtime speed"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem cleanup_items[] = {
+ {TRACKING_CLEAN_SELECT, "SELECT", 0, "Select", "Select unclean tracks"},
+ {TRACKING_CLEAN_DELETE_TRACK, "DELETE_TRACK", 0, "Delete Track", "Delete unclean tracks"},
+ {TRACKING_CLEAN_DELETE_SEGMENT,
+ "DELETE_SEGMENTS",
+ 0,
+ "Delete Segments",
+ "Delete unclean segments of tracks"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem refine_items[] = {
+ {0, "NONE", 0, "Nothing", "Do not refine camera intrinsics"},
+ {REFINE_FOCAL_LENGTH, "FOCAL_LENGTH", 0, "Focal Length", "Refine focal length"},
+ {REFINE_FOCAL_LENGTH | REFINE_RADIAL_DISTORTION_K1,
+ "FOCAL_LENGTH_RADIAL_K1",
+ 0,
+ "Focal length, K1",
+ "Refine focal length and radial distortion K1"},
+ {REFINE_FOCAL_LENGTH | REFINE_RADIAL_DISTORTION_K1 | REFINE_RADIAL_DISTORTION_K2,
+ "FOCAL_LENGTH_RADIAL_K1_K2",
+ 0,
+ "Focal length, K1, K2",
+ "Refine focal length and radial distortion K1 and K2"},
+ {REFINE_FOCAL_LENGTH | REFINE_PRINCIPAL_POINT | REFINE_RADIAL_DISTORTION_K1 |
+ REFINE_RADIAL_DISTORTION_K2,
+ "FOCAL_LENGTH_PRINCIPAL_POINT_RADIAL_K1_K2",
+ 0,
+ "Focal Length, Optical Center, K1, K2",
+ "Refine focal length, optical center and radial distortion K1 and K2"},
+ {REFINE_FOCAL_LENGTH | REFINE_PRINCIPAL_POINT,
+ "FOCAL_LENGTH_PRINCIPAL_POINT",
+ 0,
+ "Focal Length, Optical Center",
+ "Refine focal length and optical center"},
+ {REFINE_RADIAL_DISTORTION_K1 | REFINE_RADIAL_DISTORTION_K2,
+ "RADIAL_K1_K2",
+ 0,
+ "K1, K2",
+ "Refine radial distortion K1 and K2"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieTrackingSettings", NULL);
+ RNA_def_struct_ui_text(srna, "Movie tracking settings", "Match moving settings");
+
+ /* speed */
+ prop = RNA_def_property(srna, "speed", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, speed_items);
+ RNA_def_property_ui_text(prop,
+ "Speed",
+ "Limit speed of tracking to make visual feedback easier "
+ "(this does not affect the tracking quality)");
+
+ /* use keyframe selection */
+ prop = RNA_def_property(srna, "use_keyframe_selection", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "reconstruction_flag", TRACKING_USE_KEYFRAME_SELECTION);
+ RNA_def_property_ui_text(prop,
+ "Keyframe Selection",
+ "Automatically select keyframes when solving camera/object motion");
+
+ /* intrinsics refinement during bundle adjustment */
+ prop = RNA_def_property(srna, "refine_intrinsics", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "refine_camera_intrinsics");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, refine_items);
+ RNA_def_property_ui_text(prop, "Refine", "Refine intrinsics during camera solving");
+
+ /* tool settings */
+
+ /* distance */
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "dist");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Distance", "Distance between two bundles used for scene scaling");
+
+ /* frames count */
+ prop = RNA_def_property(srna, "clean_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "clean_frames");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_text(
+ prop,
+ "Tracked Frames",
+ "Effect on tracks which are tracked less than the specified amount of frames");
+
+ /* re-projection error */
+ prop = RNA_def_property(srna, "clean_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "clean_error");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Reprojection Error", "Effect on tracks which have a larger re-projection error");
+
+ /* cleanup action */
+ prop = RNA_def_property(srna, "clean_action", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "clean_action");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, cleanup_items);
+ RNA_def_property_ui_text(prop, "Action", "Cleanup action to execute");
+
+ /* ** default tracker settings ** */
+ prop = RNA_def_property(srna, "show_default_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_DEFAULT_EXPANDED);
+ RNA_def_property_ui_text(
+ prop, "Show Expanded", "Show default options expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ /* ** extra tracker settings ** */
+ prop = RNA_def_property(srna, "show_extra_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SETTINGS_SHOW_EXTRA_EXPANDED);
+ RNA_def_property_ui_text(
+ prop, "Show Expanded", "Show extra options expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ /* solver settings */
+ prop = RNA_def_property(srna, "use_tripod_solver", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "motion_flag", TRACKING_MOTION_TRIPOD);
+ RNA_def_property_ui_text(
+ prop,
+ "Tripod Motion",
+ "Use special solver to track a stable camera position, such as a tripod");
+
+ /* default_limit_frames */
+ prop = RNA_def_property(srna, "default_frames_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_frames_limit");
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
+
+ /* default_pattern_match */
+ prop = RNA_def_property(srna, "default_pattern_match", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "default_pattern_match");
+ RNA_def_property_enum_items(prop, pattern_match_items);
+ RNA_def_property_ui_text(
+ prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+
+ /* default_margin */
+ prop = RNA_def_property(srna, "default_margin", PROP_INT, PROP_PIXEL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_margin");
+ RNA_def_property_range(prop, 0, 300);
+ RNA_def_property_ui_text(
+ prop, "Margin", "Default distance from image boundary at which marker stops tracking");
+
+ /* default_tracking_motion_model */
+ prop = RNA_def_property(srna, "default_motion_model", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, tracker_motion_model);
+ RNA_def_property_ui_text(prop, "Motion model", "Default motion model to use for tracking");
+
+ /* default_use_brute */
+ prop = RNA_def_property(srna, "use_default_brute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_BRUTE);
+ RNA_def_property_ui_text(
+ prop, "Prepass", "Use a brute-force translation-only initialization when tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* default_use_brute */
+ prop = RNA_def_property(srna, "use_default_mask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Mask",
+ "Use a grease pencil data-block as a mask to use only specified areas of pattern "
+ "when tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* default_use_normalization */
+ prop = RNA_def_property(srna, "use_default_normalization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "default_algorithm_flag", TRACK_ALGORITHM_FLAG_USE_NORMALIZATION);
+ RNA_def_property_ui_text(
+ prop, "Normalize", "Normalize light intensities while tracking (slower)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* default minmal correlation */
+ prop = RNA_def_property(srna, "default_correlation_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "default_minimum_correlation");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Correlation",
+ "Default minimum value of correlation between matched pattern and reference "
+ "that is still treated as successful tracking");
+
+ /* default pattern size */
+ prop = RNA_def_property(srna, "default_pattern_size", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_pattern_size");
+ RNA_def_property_range(prop, 5, 1000);
+ RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_patternUpdate");
+ RNA_def_property_ui_text(prop, "Pattern Size", "Size of pattern area for newly created tracks");
+
+ /* default search size */
+ prop = RNA_def_property(srna, "default_search_size", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "default_search_size");
+ RNA_def_property_range(prop, 5, 1000);
+ RNA_def_property_update(prop, 0, "rna_tracking_defaultSettings_searchUpdate");
+ RNA_def_property_ui_text(prop, "Search Size", "Size of search area for newly created tracks");
+
+ /* default use_red_channel */
+ prop = RNA_def_property(srna, "use_default_red_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_RED);
+ RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* default_use_green_channel */
+ prop = RNA_def_property(srna, "use_default_green_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_GREEN);
+ RNA_def_property_ui_text(
+ prop, "Use Green Channel", "Use green channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* default_use_blue_channel */
+ prop = RNA_def_property(srna, "use_default_blue_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "default_flag", TRACK_DISABLE_BLUE);
+ RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ prop = RNA_def_property(srna, "default_weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Influence of newly created track on a final solution");
+
+ /* ** object tracking ** */
+
+ /* object distance */
+ prop = RNA_def_property(srna, "object_distance", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "object_distance");
+ RNA_def_property_ui_text(
+ prop, "Distance", "Distance between two bundles used for object scaling");
+ RNA_def_property_range(prop, 0.001, 10000);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_range(prop, 0.001, 10000.0, 1, 3);
}
static void rna_def_trackingCamera(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem distortion_model_items[] = {
- {TRACKING_DISTORTION_MODEL_POLYNOMIAL, "POLYNOMIAL", 0, "Polynomial", "Radial distortion model which fits common cameras"},
- {TRACKING_DISTORTION_MODEL_DIVISION, "DIVISION", 0, "Divisions", "Division distortion model which "
- "better represents wide-angle cameras"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem camera_units_items[] = {
- {CAMERA_UNITS_PX, "PIXELS", 0, "px", "Use pixels for units of focal length"},
- {CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieTrackingCamera", NULL);
- RNA_def_struct_path_func(srna, "rna_trackingCamera_path");
- RNA_def_struct_ui_text(srna, "Movie tracking camera data", "Match-moving camera data for tracking");
-
- /* Distortion model */
- prop = RNA_def_property(srna, "distortion_model", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, distortion_model_items);
- RNA_def_property_ui_text(prop, "Distortion Model", "Distortion model used for camera lenses");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_resetIntrinsics");
-
- /* Sensor */
- prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "sensor_width");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, 500.0f);
- RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* Focal Length */
- prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "focal");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0001f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0001f, 5000.0f, 1, 2);
- RNA_def_property_float_funcs(prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL);
- RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* Focal Length in pixels */
- prop = RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "focal");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.0f, 5000.f, 1, 2);
- RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* Units */
- prop = RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "units");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, camera_units_items);
- RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length");
-
- /* Principal Point */
- prop = RNA_def_property(srna, "principal", PROP_FLOAT, PROP_PIXEL);
- RNA_def_property_array(prop, 2);
- RNA_def_property_float_sdna(prop, NULL, "principal");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* Radial distortion parameters */
- prop = RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "k1");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
- RNA_def_property_ui_text(prop, "K1", "First coefficient of third order polynomial radial distortion");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
-
- prop = RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "k2");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
- RNA_def_property_ui_text(prop, "K2", "Second coefficient of third order polynomial radial distortion");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
-
- prop = RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "k3");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
- RNA_def_property_ui_text(prop, "K3", "Third coefficient of third order polynomial radial distortion");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
-
- /* Division distortion parameters */
- prop = RNA_def_property(srna, "division_k1", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
- RNA_def_property_ui_text(prop, "K1", "First coefficient of second order division distortion");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
-
- prop = RNA_def_property(srna, "division_k2", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
- RNA_def_property_ui_text(prop, "K2", "First coefficient of second order division distortion");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
-
- /* pixel aspect */
- prop = RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_float_sdna(prop, NULL, "pixel_aspect");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.1f, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem distortion_model_items[] = {
+ {TRACKING_DISTORTION_MODEL_POLYNOMIAL,
+ "POLYNOMIAL",
+ 0,
+ "Polynomial",
+ "Radial distortion model which fits common cameras"},
+ {TRACKING_DISTORTION_MODEL_DIVISION,
+ "DIVISION",
+ 0,
+ "Divisions",
+ "Division distortion model which "
+ "better represents wide-angle cameras"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem camera_units_items[] = {
+ {CAMERA_UNITS_PX, "PIXELS", 0, "px", "Use pixels for units of focal length"},
+ {CAMERA_UNITS_MM, "MILLIMETERS", 0, "mm", "Use millimeters for units of focal length"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieTrackingCamera", NULL);
+ RNA_def_struct_path_func(srna, "rna_trackingCamera_path");
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking camera data", "Match-moving camera data for tracking");
+
+ /* Distortion model */
+ prop = RNA_def_property(srna, "distortion_model", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, distortion_model_items);
+ RNA_def_property_ui_text(prop, "Distortion Model", "Distortion model used for camera lenses");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_resetIntrinsics");
+
+ /* Sensor */
+ prop = RNA_def_property(srna, "sensor_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "sensor_width");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, 500.0f);
+ RNA_def_property_ui_text(prop, "Sensor", "Width of CCD sensor in millimeters");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* Focal Length */
+ prop = RNA_def_property(srna, "focal_length", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "focal");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0001f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0001f, 5000.0f, 1, 2);
+ RNA_def_property_float_funcs(
+ prop, "rna_trackingCamera_focal_mm_get", "rna_trackingCamera_focal_mm_set", NULL);
+ RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* Focal Length in pixels */
+ prop = RNA_def_property(srna, "focal_length_pixels", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "focal");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.0f, 5000.f, 1, 2);
+ RNA_def_property_ui_text(prop, "Focal Length", "Camera's focal length");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* Units */
+ prop = RNA_def_property(srna, "units", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "units");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, camera_units_items);
+ RNA_def_property_ui_text(prop, "Units", "Units used for camera focal length");
+
+ /* Principal Point */
+ prop = RNA_def_property(srna, "principal", PROP_FLOAT, PROP_PIXEL);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_float_sdna(prop, NULL, "principal");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Principal Point", "Optical center of lens");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* Radial distortion parameters */
+ prop = RNA_def_property(srna, "k1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "k1");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K1", "First coefficient of third order polynomial radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "k2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "k2");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K2", "Second coefficient of third order polynomial radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "k3", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "k3");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(
+ prop, "K3", "Third coefficient of third order polynomial radial distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ /* Division distortion parameters */
+ prop = RNA_def_property(srna, "division_k1", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(prop, "K1", "First coefficient of second order division distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ prop = RNA_def_property(srna, "division_k2", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_range(prop, -10, 10, 0.1, 3);
+ RNA_def_property_ui_text(prop, "K2", "First coefficient of second order division distortion");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_flushUpdate");
+
+ /* pixel aspect */
+ prop = RNA_def_property(srna, "pixel_aspect", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_float_sdna(prop, NULL, "pixel_aspect");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.1f, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0.1f, 5000.0f, 1, 2);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Pixel Aspect Ratio", "Pixel aspect ratio");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
}
static void rna_def_trackingMarker(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static int boundbox_dimsize[] = {2, 2};
-
- srna = RNA_def_struct(brna, "MovieTrackingMarker", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking marker data", "Match-moving marker data for tracking");
-
- /* position */
- prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_float_sdna(prop, NULL, "pos");
- RNA_def_property_ui_text(prop, "Position", "Marker position at frame in normalized coordinates");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* frame */
- prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "framenr");
- RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
- RNA_def_property_int_funcs(prop, NULL, "rna_trackingMarker_frame_set", NULL);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* enable */
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED);
- RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* pattern */
- prop = RNA_def_property(srna, "pattern_corners", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "pattern_corners");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_ui_text(prop, "Pattern Corners",
- "Array of coordinates which represents pattern's corners in "
- "normalized coordinates relative to marker position");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerPattern_update");
-
- prop = RNA_def_property(srna, "pattern_bound_box", PROP_FLOAT, PROP_NONE);
- RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_tracking_markerPattern_boundbox_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Pattern Bounding Box", "Pattern area bounding box in normalized coordinates");
-
- /* search */
- prop = RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_float_sdna(prop, NULL, "search_min");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Search Min",
- "Left-bottom corner of search area in normalized coordinates relative "
- "to marker position");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerSearch_update");
-
- prop = RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_float_sdna(prop, NULL, "search_max");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Search Max",
- "Right-bottom corner of search area in normalized coordinates relative "
- "to marker position");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerSearch_update");
-
- /* is marker keyframed */
- prop = RNA_def_property(srna, "is_keyed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_TRACKED);
- RNA_def_property_ui_text(prop, "Keyframed", "Whether the position of the marker is keyframed or tracked");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static int boundbox_dimsize[] = {2, 2};
+
+ srna = RNA_def_struct(brna, "MovieTrackingMarker", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking marker data", "Match-moving marker data for tracking");
+
+ /* position */
+ prop = RNA_def_property(srna, "co", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_float_sdna(prop, NULL, "pos");
+ RNA_def_property_ui_text(prop, "Position", "Marker position at frame in normalized coordinates");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* frame */
+ prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
+ RNA_def_property_int_funcs(prop, NULL, "rna_trackingMarker_frame_set", NULL);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* enable */
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MARKER_DISABLED);
+ RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* pattern */
+ prop = RNA_def_property(srna, "pattern_corners", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "pattern_corners");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_ui_text(prop,
+ "Pattern Corners",
+ "Array of coordinates which represents pattern's corners in "
+ "normalized coordinates relative to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerPattern_update");
+
+ prop = RNA_def_property(srna, "pattern_bound_box", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_multi_array(prop, 2, boundbox_dimsize);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_tracking_markerPattern_boundbox_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Pattern Bounding Box", "Pattern area bounding box in normalized coordinates");
+
+ /* search */
+ prop = RNA_def_property(srna, "search_min", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_float_sdna(prop, NULL, "search_min");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Search Min",
+ "Left-bottom corner of search area in normalized coordinates relative "
+ "to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerSearch_update");
+
+ prop = RNA_def_property(srna, "search_max", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_float_sdna(prop, NULL, "search_max");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop,
+ "Search Max",
+ "Right-bottom corner of search area in normalized coordinates relative "
+ "to marker position");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_tracking_markerSearch_update");
+
+ /* is marker keyframed */
+ prop = RNA_def_property(srna, "is_keyed", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MARKER_TRACKED);
+ RNA_def_property_ui_text(
+ prop, "Keyframed", "Whether the position of the marker is keyframed or tracked");
}
static void rna_def_trackingMarkers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MovieTrackingMarkers");
- srna = RNA_def_struct(brna, "MovieTrackingMarkers", NULL);
- RNA_def_struct_sdna(srna, "MovieTrackingTrack");
- RNA_def_struct_ui_text(srna, "Movie Tracking Markers", "Collection of markers for movie tracking track");
-
- func = RNA_def_function(srna, "find_frame", "rna_trackingMarkers_find_frame");
- RNA_def_function_ui_description(func, "Get marker for specified frame");
- parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to find marker for", MINFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "exact", true, "Exact",
- "Get marker at exact frame number rather than get estimated marker");
- parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "insert_frame", "rna_trackingMarkers_insert_frame");
- RNA_def_function_ui_description(func, "Insert a new marker at the specified frame");
- parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to insert marker to", MINFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float_vector(func, "co", 2, NULL, -1.0, 1.0, "Coordinate",
- "Place new marker at the given frame using specified in normalized space coordinates",
- -1.0, 1.0);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Newly created marker");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "delete_frame", "rna_trackingMarkers_delete_frame");
- RNA_def_function_ui_description(func, "Delete marker at specified frame");
- parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to delete marker from", MINFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MovieTrackingMarkers");
+ srna = RNA_def_struct(brna, "MovieTrackingMarkers", NULL);
+ RNA_def_struct_sdna(srna, "MovieTrackingTrack");
+ RNA_def_struct_ui_text(
+ srna, "Movie Tracking Markers", "Collection of markers for movie tracking track");
+
+ func = RNA_def_function(srna, "find_frame", "rna_trackingMarkers_find_frame");
+ RNA_def_function_ui_description(func, "Get marker for specified frame");
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to find marker for",
+ MINFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "exact",
+ true,
+ "Exact",
+ "Get marker at exact frame number rather than get estimated marker");
+ parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Marker for specified frame");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "insert_frame", "rna_trackingMarkers_insert_frame");
+ RNA_def_function_ui_description(func, "Insert a new marker at the specified frame");
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to insert marker to",
+ MINFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_float_vector(
+ func,
+ "co",
+ 2,
+ NULL,
+ -1.0,
+ 1.0,
+ "Coordinate",
+ "Place new marker at the given frame using specified in normalized space coordinates",
+ -1.0,
+ 1.0);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "marker", "MovieTrackingMarker", "", "Newly created marker");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "delete_frame", "rna_trackingMarkers_delete_frame");
+ RNA_def_function_ui_description(func, "Delete marker at specified frame");
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to delete marker from",
+ MINFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_trackingTrack(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_trackingMarker(brna);
-
- srna = RNA_def_struct(brna, "MovieTrackingTrack", NULL);
- RNA_def_struct_path_func(srna, "rna_trackingTrack_path");
- RNA_def_struct_ui_text(srna, "Movie tracking track data", "Match-moving track data for tracking");
- RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
-
- /* name */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Unique name of track");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingTrack_name_set");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- /* limit frames */
- prop = RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "frames_limit");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, SHRT_MAX);
- RNA_def_property_ui_text(prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
-
- /* pattern match */
- prop = RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_sdna(prop, NULL, "pattern_match");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, pattern_match_items);
- RNA_def_property_ui_text(prop, "Pattern Match",
- "Track pattern from given frame when tracking marker to next frame");
-
- /* margin */
- prop = RNA_def_property(srna, "margin", PROP_INT, PROP_PIXEL);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "margin");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0, 300);
- RNA_def_property_ui_text(prop, "Margin", "Distance from image boundary at which marker stops tracking");
-
- /* tracking motion model */
- prop = RNA_def_property(srna, "motion_model", PROP_ENUM, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_enum_items(prop, tracker_motion_model);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Motion model", "Default motion model to use for tracking");
-
- /* minimum correlation */
- prop = RNA_def_property(srna, "correlation_min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
- RNA_def_property_ui_text(prop, "Correlation",
- "Minimal value of correlation between matched pattern and reference "
- "that is still treated as successful tracking");
-
- /* use_brute */
- prop = RNA_def_property(srna, "use_brute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_BRUTE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Prepass", "Use a brute-force translation only pre-track before refinement");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* use_brute */
- prop = RNA_def_property(srna, "use_mask", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
- RNA_def_property_ui_text(prop, "Use Mask",
- "Use a grease pencil data-block as a mask to use only specified areas of pattern "
- "when tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* use_normalization */
- prop = RNA_def_property(srna, "use_normalization", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_NORMALIZATION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Normalize", "Normalize light intensities while tracking. Slower");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* markers */
- prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingMarker");
- RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
- RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
- rna_def_trackingMarkers(brna, prop);
-
- /* ** channels ** */
-
- /* use_red_channel */
- prop = RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* use_green_channel */
- prop = RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Green Channel", "Use green channel from footage for tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* use_blue_channel */
- prop = RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* preview_grayscale */
- prop = RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_GRAYSCALE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Grayscale", "Display what the tracking algorithm sees in the preview");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* preview_alpha */
- prop = RNA_def_property(srna, "use_alpha_preview", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_ALPHA);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Alpha", "Apply track's mask on displaying preview");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* has bundle */
- prop = RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HAS_BUNDLE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has Bundle", "True if track has a valid bundle");
-
- /* bundle position */
- prop = RNA_def_property(srna, "bundle", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_sdna(prop, NULL, "bundle_pos");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Bundle", "Position of bundle reconstructed from this track");
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
-
- /* hide */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Hide", "Track is hidden");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* select */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_trackingTrack_select_get", "rna_trackingTrack_select_set");
- RNA_def_property_ui_text(prop, "Select", "Track is selected");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* select_anchor */
- prop = RNA_def_property(srna, "select_anchor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select Anchor", "Track's anchor point is selected");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* select_pattern */
- prop = RNA_def_property(srna, "select_pattern", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "pat_flag", SELECT);
- RNA_def_property_ui_text(prop, "Select Pattern", "Track's pattern area is selected");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* select_search */
- prop = RNA_def_property(srna, "select_search", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "search_flag", SELECT);
- RNA_def_property_ui_text(prop, "Select Search", "Track's search area is selected");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* locked */
- prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* custom color */
- prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* color */
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Color",
- "Color of the track in the Movie Clip Editor and the 3D viewport after a solve");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* average error */
- prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Average Error", "Average error of re-projection");
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "gpd");
- RNA_def_property_struct_type(prop, "GreasePencil");
- RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
- RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this track");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* weight */
- prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "weight");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Weight", "Influence of this track on a final solution");
-
- /* weight_stab */
- prop = RNA_def_property(srna, "weight_stab", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "weight_stab");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Stab Weight", "Influence of this track on 2D stabilization");
-
- /* offset */
- prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_float_sdna(prop, NULL, "offset");
- RNA_def_property_ui_text(prop, "Offset", "Offset of track from the parenting point");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_trackingMarker(brna);
+
+ srna = RNA_def_struct(brna, "MovieTrackingTrack", NULL);
+ RNA_def_struct_path_func(srna, "rna_trackingTrack_path");
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking track data", "Match-moving track data for tracking");
+ RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
+
+ /* name */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique name of track");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingTrack_name_set");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* limit frames */
+ prop = RNA_def_property(srna, "frames_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "frames_limit");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, SHRT_MAX);
+ RNA_def_property_ui_text(
+ prop, "Frames Limit", "Every tracking cycle, this number of frames are tracked");
+
+ /* pattern match */
+ prop = RNA_def_property(srna, "pattern_match", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_sdna(prop, NULL, "pattern_match");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, pattern_match_items);
+ RNA_def_property_ui_text(
+ prop, "Pattern Match", "Track pattern from given frame when tracking marker to next frame");
+
+ /* margin */
+ prop = RNA_def_property(srna, "margin", PROP_INT, PROP_PIXEL);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "margin");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0, 300);
+ RNA_def_property_ui_text(
+ prop, "Margin", "Distance from image boundary at which marker stops tracking");
+
+ /* tracking motion model */
+ prop = RNA_def_property(srna, "motion_model", PROP_ENUM, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_enum_items(prop, tracker_motion_model);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Motion model", "Default motion model to use for tracking");
+
+ /* minimum correlation */
+ prop = RNA_def_property(srna, "correlation_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "minimum_correlation");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.05, 3);
+ RNA_def_property_ui_text(prop,
+ "Correlation",
+ "Minimal value of correlation between matched pattern and reference "
+ "that is still treated as successful tracking");
+
+ /* use_brute */
+ prop = RNA_def_property(srna, "use_brute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_BRUTE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Prepass", "Use a brute-force translation only pre-track before refinement");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* use_brute */
+ prop = RNA_def_property(srna, "use_mask", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_MASK);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Mask",
+ "Use a grease pencil data-block as a mask to use only specified areas of pattern "
+ "when tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* use_normalization */
+ prop = RNA_def_property(srna, "use_normalization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(
+ prop, NULL, "algorithm_flag", TRACK_ALGORITHM_FLAG_USE_NORMALIZATION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Normalize", "Normalize light intensities while tracking. Slower");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* markers */
+ prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingMarker");
+ RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
+ RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
+ rna_def_trackingMarkers(brna, prop);
+
+ /* ** channels ** */
+
+ /* use_red_channel */
+ prop = RNA_def_property(srna, "use_red_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_RED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Use Red Channel", "Use red channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* use_green_channel */
+ prop = RNA_def_property(srna, "use_green_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_GREEN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Use Green Channel", "Use green channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* use_blue_channel */
+ prop = RNA_def_property(srna, "use_blue_channel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", TRACK_DISABLE_BLUE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Use Blue Channel", "Use blue channel from footage for tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* preview_grayscale */
+ prop = RNA_def_property(srna, "use_grayscale_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_GRAYSCALE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Grayscale", "Display what the tracking algorithm sees in the preview");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* preview_alpha */
+ prop = RNA_def_property(srna, "use_alpha_preview", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_PREVIEW_ALPHA);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Alpha", "Apply track's mask on displaying preview");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* has bundle */
+ prop = RNA_def_property(srna, "has_bundle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HAS_BUNDLE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has Bundle", "True if track has a valid bundle");
+
+ /* bundle position */
+ prop = RNA_def_property(srna, "bundle", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_sdna(prop, NULL, "bundle_pos");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Bundle", "Position of bundle reconstructed from this track");
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+
+ /* hide */
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_HIDDEN);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Hide", "Track is hidden");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* select */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_trackingTrack_select_get", "rna_trackingTrack_select_set");
+ RNA_def_property_ui_text(prop, "Select", "Track is selected");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* select_anchor */
+ prop = RNA_def_property(srna, "select_anchor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select Anchor", "Track's anchor point is selected");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* select_pattern */
+ prop = RNA_def_property(srna, "select_pattern", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "pat_flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select Pattern", "Track's pattern area is selected");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* select_search */
+ prop = RNA_def_property(srna, "select_search", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "search_flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select Search", "Track's search area is selected");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* locked */
+ prop = RNA_def_property(srna, "lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_LOCKED);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Lock", "Track is locked and all changes to it are disabled");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* custom color */
+ prop = RNA_def_property(srna, "use_custom_color", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACK_CUSTOMCOLOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Custom Color", "Use custom color instead of theme-defined");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* color */
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Color",
+ "Color of the track in the Movie Clip Editor and the 3D viewport after a solve");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* average error */
+ prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error of re-projection");
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "gpd");
+ RNA_def_property_struct_type(prop, "GreasePencil");
+ RNA_def_property_pointer_funcs(
+ prop, NULL, NULL, NULL, "rna_GPencil_datablocks_annotations_poll");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_REFCOUNT);
+ RNA_def_property_ui_text(prop, "Grease Pencil", "Grease pencil data for this track");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* weight */
+ prop = RNA_def_property(srna, "weight", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "weight");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Weight", "Influence of this track on a final solution");
+
+ /* weight_stab */
+ prop = RNA_def_property(srna, "weight_stab", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "weight_stab");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Stab Weight", "Influence of this track on 2D stabilization");
+
+ /* offset */
+ prop = RNA_def_property(srna, "offset", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_float_sdna(prop, NULL, "offset");
+ RNA_def_property_ui_text(prop, "Offset", "Offset of track from the parenting point");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
}
static void rna_def_trackingPlaneMarker(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MovieTrackingPlaneMarker", NULL);
- RNA_def_struct_ui_text(srna, "Movie Tracking Plane Marker Data", "Match-moving plane marker data for tracking");
-
- /* frame */
- prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "framenr");
- RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
- RNA_def_property_int_funcs(prop, NULL, "rna_trackingPlaneMarker_frame_set", NULL);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* Corners */
- prop = RNA_def_property(srna, "corners", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "corners");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
- RNA_def_property_ui_text(prop, "Corners",
- "Array of coordinates which represents UI rectangle corners in "
- "frame normalized coordinates");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
-
- /* enable */
- prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PLANE_MARKER_DISABLED);
- RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MovieTrackingPlaneMarker", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Movie Tracking Plane Marker Data", "Match-moving plane marker data for tracking");
+
+ /* frame */
+ prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
+ RNA_def_property_int_funcs(prop, NULL, "rna_trackingPlaneMarker_frame_set", NULL);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* Corners */
+ prop = RNA_def_property(srna, "corners", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "corners");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x2);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, RNA_TRANSLATION_PREC_DEFAULT);
+ RNA_def_property_ui_text(prop,
+ "Corners",
+ "Array of coordinates which represents UI rectangle corners in "
+ "frame normalized coordinates");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+
+ /* enable */
+ prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PLANE_MARKER_DISABLED);
+ RNA_def_property_ui_text(prop, "Mode", "Is marker muted for current frame");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
}
static void rna_def_trackingPlaneMarkers(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MovieTrackingPlaneMarkers");
- srna = RNA_def_struct(brna, "MovieTrackingPlaneMarkers", NULL);
- RNA_def_struct_sdna(srna, "MovieTrackingPlaneTrack");
- RNA_def_struct_ui_text(srna, "Movie Tracking Plane Markers",
- "Collection of markers for movie tracking plane track");
-
- func = RNA_def_function(srna, "find_frame", "rna_trackingPlaneMarkers_find_frame");
- RNA_def_function_ui_description(func, "Get plane marker for specified frame");
- parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to find marker for", MINFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "exact", true, "Exact",
- "Get plane marker at exact frame number rather than get estimated marker");
- parm = RNA_def_pointer(func, "plane_marker", "MovieTrackingPlaneMarker", "", "Plane marker for specified frame");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "insert_frame", "rna_trackingPlaneMarkers_insert_frame");
- RNA_def_function_ui_description(func, "Insert a new plane marker at the specified frame");
- parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to insert marker to", MINFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "plane_marker", "MovieTrackingPlaneMarker", "", "Newly created plane marker");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "delete_frame", "rna_trackingPlaneMarkers_delete_frame");
- RNA_def_function_ui_description(func, "Delete plane marker at specified frame");
- parm = RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame",
- "Frame number to delete plane marker from", MINFRAME, MAXFRAME);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MovieTrackingPlaneMarkers");
+ srna = RNA_def_struct(brna, "MovieTrackingPlaneMarkers", NULL);
+ RNA_def_struct_sdna(srna, "MovieTrackingPlaneTrack");
+ RNA_def_struct_ui_text(srna,
+ "Movie Tracking Plane Markers",
+ "Collection of markers for movie tracking plane track");
+
+ func = RNA_def_function(srna, "find_frame", "rna_trackingPlaneMarkers_find_frame");
+ RNA_def_function_ui_description(func, "Get plane marker for specified frame");
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to find marker for",
+ MINFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func,
+ "exact",
+ true,
+ "Exact",
+ "Get plane marker at exact frame number rather than get estimated marker");
+ parm = RNA_def_pointer(
+ func, "plane_marker", "MovieTrackingPlaneMarker", "", "Plane marker for specified frame");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "insert_frame", "rna_trackingPlaneMarkers_insert_frame");
+ RNA_def_function_ui_description(func, "Insert a new plane marker at the specified frame");
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to insert marker to",
+ MINFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "plane_marker", "MovieTrackingPlaneMarker", "", "Newly created plane marker");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "delete_frame", "rna_trackingPlaneMarkers_delete_frame");
+ RNA_def_function_ui_description(func, "Delete plane marker at specified frame");
+ parm = RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to delete plane marker from",
+ MINFRAME,
+ MAXFRAME);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void rna_def_trackingPlaneTrack(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_trackingPlaneMarker(brna);
-
- srna = RNA_def_struct(brna, "MovieTrackingPlaneTrack", NULL);
- RNA_def_struct_path_func(srna, "rna_trackingPlaneTrack_path");
- RNA_def_struct_ui_text(srna, "Movie tracking plane track data", "Match-moving plane track data for tracking");
- RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
-
- /* name */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Unique name of track");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingPlaneTrack_name_set");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- /* markers */
- prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingPlaneMarker");
- RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
- RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
- rna_def_trackingPlaneMarkers(brna, prop);
-
- /* select */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
- RNA_def_property_ui_text(prop, "Select", "Plane track is selected");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* auto keyframing */
- prop = RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PLANE_TRACK_AUTOKEY);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Auto Keyframe", "Automatic keyframe insertion when moving plane corners");
- RNA_def_property_ui_icon(prop, ICON_REC, 0);
-
- /* image */
- prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Image");
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Image", "Image displayed in the track during editing in clip editor");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* image opacity */
- prop = RNA_def_property(srna, "image_opacity", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, 0.0, 1.0);
- RNA_def_property_ui_text(prop, "Image Opacity", "Opacity of the image");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_trackingPlaneMarker(brna);
+
+ srna = RNA_def_struct(brna, "MovieTrackingPlaneTrack", NULL);
+ RNA_def_struct_path_func(srna, "rna_trackingPlaneTrack_path");
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking plane track data", "Match-moving plane track data for tracking");
+ RNA_def_struct_ui_icon(srna, ICON_ANIM_DATA);
+
+ /* name */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique name of track");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingPlaneTrack_name_set");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* markers */
+ prop = RNA_def_property(srna, "markers", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingPlaneMarker");
+ RNA_def_property_collection_sdna(prop, NULL, "markers", "markersnr");
+ RNA_def_property_ui_text(prop, "Markers", "Collection of markers in track");
+ rna_def_trackingPlaneMarkers(brna, prop);
+
+ /* select */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", SELECT);
+ RNA_def_property_ui_text(prop, "Select", "Plane track is selected");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* auto keyframing */
+ prop = RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PLANE_TRACK_AUTOKEY);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Auto Keyframe", "Automatic keyframe insertion when moving plane corners");
+ RNA_def_property_ui_icon(prop, ICON_REC, 0);
+
+ /* image */
+ prop = RNA_def_property(srna, "image", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Image");
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Image", "Image displayed in the track during editing in clip editor");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* image opacity */
+ prop = RNA_def_property(srna, "image_opacity", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, 0.0, 1.0);
+ RNA_def_property_ui_text(prop, "Image Opacity", "Opacity of the image");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
}
static void rna_def_trackingStabilization(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem filter_items[] = {
- {TRACKING_FILTER_NEAREST, "NEAREST", 0, "Nearest", "No interpolation, use nearest neighbor pixel"},
- {TRACKING_FILTER_BILINEAR, "BILINEAR", 0, "Bilinear", "Simple interpolation between adjacent pixels"},
- {TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", "High quality pixel interpolation"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
- RNA_def_struct_path_func(srna, "rna_trackingStabilization_path");
- RNA_def_struct_ui_text(srna, "Movie tracking stabilization data", "2D stabilization based on tracking markers");
-
- /* 2d stabilization */
- prop = RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* use_stabilize_rotation */
- prop = RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION);
- RNA_def_property_ui_text(prop, "Stabilize Rotation", "Stabilize detected rotation around center of frame");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* use_stabilize_scale */
- prop = RNA_def_property(srna, "use_stabilize_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_SCALE);
- RNA_def_property_ui_text(prop, "Stabilize Scale", "Compensate any scale changes relative to center of rotation");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* tracks */
- prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_tracking_stabTracks_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_ui_text(prop, "Translation Tracks",
- "Collection of tracks used for 2D stabilization (translation)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* active track index */
- prop = RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "act_track");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_tracking_stabTracks_active_index_get",
- "rna_tracking_stabTracks_active_index_set",
- "rna_tracking_stabTracks_active_index_range");
- RNA_def_property_ui_text(prop, "Active Track Index",
- "Index of active track in translation stabilization tracks list");
-
- /* tracks used for rotation stabilization */
- prop = RNA_def_property(srna, "rotation_tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_tracking_stabRotTracks_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_ui_text(prop, "Rotation Tracks", "Collection of tracks used for 2D stabilization (translation)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* active rotation track index */
- prop = RNA_def_property(srna, "active_rotation_track_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "act_rot_track");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_tracking_stabRotTracks_active_index_get",
- "rna_tracking_stabRotTracks_active_index_set",
- "rna_tracking_stabRotTracks_active_index_range");
- RNA_def_property_ui_text(prop, "Active Rotation Track Index",
- "Index of active track in rotation stabilization tracks list");
-
- /* anchor frame */
- prop = RNA_def_property(srna, "anchor_frame", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "anchor_frame");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_range(prop, MINFRAME, MAXFRAME);
- RNA_def_property_ui_text(prop, "Anchor Frame",
- "Reference point to anchor stabilization "
- "(other frames will be adjusted relative to this frame's position)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* target position */
- prop = RNA_def_property(srna, "target_position", PROP_FLOAT, PROP_TRANSLATION);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 1, 3); /* increment in steps of 0.01 and show 3 digit after point */
- RNA_def_property_float_sdna(prop, NULL, "target_pos");
- RNA_def_property_ui_text(prop, "Expected Position",
- "Known relative offset of original shot, will be subtracted "
- "(e.g. for panning shot, can be animated)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* target rotation */
- prop = RNA_def_property(srna, "target_rotation", PROP_FLOAT, PROP_ANGLE);
- RNA_def_property_float_sdna(prop, NULL, "target_rot");
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 10.0f, 3);
- RNA_def_property_ui_text(prop, "Expected Rotation",
- "Rotation present on original shot, will be compensated (e.g. for deliberate tilting)");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* target scale */
- prop = RNA_def_property(srna, "target_scale", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_range(prop, FLT_EPSILON, FLT_MAX);
- RNA_def_property_ui_range(prop, 0.01f, 10.0f, 0.001f, 3); /* increment in steps of 0.001. Show 3 digit after point */
- RNA_def_property_ui_text(prop, "Expected Scale",
- "Explicitly scale resulting frame to compensate zoom of original shot");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* autoscale */
- prop = RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_ui_text(prop, "Autoscale",
- "Automatically scale footage to cover unfilled areas when stabilizing");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* max scale */
- prop = RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "maxscale");
- RNA_def_property_range(prop, 0.0f, 10.0f);
- RNA_def_property_ui_text(prop, "Maximal Scale", "Limit the amount of automatic scaling");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* influence_location */
- prop = RNA_def_property(srna, "influence_location", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "locinf");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Location Influence", "Influence of stabilization algorithm on footage location");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* influence_scale */
- prop = RNA_def_property(srna, "influence_scale", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "scaleinf");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Scale Influence", "Influence of stabilization algorithm on footage scale");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* influence_rotation */
- prop = RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "rotinf");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* filter */
- prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "filter");
- RNA_def_property_enum_items(prop, filter_items);
- RNA_def_property_ui_text(prop, "Interpolate",
- "Interpolation to use for sub-pixel shifts and rotations due to stabilization");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
-
- /* UI display : show participating tracks */
- prop = RNA_def_property(srna, "show_tracks_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SHOW_STAB_TRACKS);
- RNA_def_property_ui_text(prop, "Show Tracks", "Show UI list of tracks participating in stabilization");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem filter_items[] = {
+ {TRACKING_FILTER_NEAREST,
+ "NEAREST",
+ 0,
+ "Nearest",
+ "No interpolation, use nearest neighbor pixel"},
+ {TRACKING_FILTER_BILINEAR,
+ "BILINEAR",
+ 0,
+ "Bilinear",
+ "Simple interpolation between adjacent pixels"},
+ {TRACKING_FILTER_BICUBIC, "BICUBIC", 0, "Bicubic", "High quality pixel interpolation"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieTrackingStabilization", NULL);
+ RNA_def_struct_path_func(srna, "rna_trackingStabilization_path");
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking stabilization data", "2D stabilization based on tracking markers");
+
+ /* 2d stabilization */
+ prop = RNA_def_property(srna, "use_2d_stabilization", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_2D_STABILIZATION);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Use 2D stabilization", "Use 2D stabilization for footage");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* use_stabilize_rotation */
+ prop = RNA_def_property(srna, "use_stabilize_rotation", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_ROTATION);
+ RNA_def_property_ui_text(
+ prop, "Stabilize Rotation", "Stabilize detected rotation around center of frame");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* use_stabilize_scale */
+ prop = RNA_def_property(srna, "use_stabilize_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_STABILIZE_SCALE);
+ RNA_def_property_ui_text(
+ prop, "Stabilize Scale", "Compensate any scale changes relative to center of rotation");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* tracks */
+ prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_tracking_stabTracks_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_ui_text(
+ prop, "Translation Tracks", "Collection of tracks used for 2D stabilization (translation)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* active track index */
+ prop = RNA_def_property(srna, "active_track_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "act_track");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_tracking_stabTracks_active_index_get",
+ "rna_tracking_stabTracks_active_index_set",
+ "rna_tracking_stabTracks_active_index_range");
+ RNA_def_property_ui_text(prop,
+ "Active Track Index",
+ "Index of active track in translation stabilization tracks list");
+
+ /* tracks used for rotation stabilization */
+ prop = RNA_def_property(srna, "rotation_tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_tracking_stabRotTracks_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_ui_text(
+ prop, "Rotation Tracks", "Collection of tracks used for 2D stabilization (translation)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* active rotation track index */
+ prop = RNA_def_property(srna, "active_rotation_track_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "act_rot_track");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_tracking_stabRotTracks_active_index_get",
+ "rna_tracking_stabRotTracks_active_index_set",
+ "rna_tracking_stabRotTracks_active_index_range");
+ RNA_def_property_ui_text(prop,
+ "Active Rotation Track Index",
+ "Index of active track in rotation stabilization tracks list");
+
+ /* anchor frame */
+ prop = RNA_def_property(srna, "anchor_frame", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "anchor_frame");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_range(prop, MINFRAME, MAXFRAME);
+ RNA_def_property_ui_text(prop,
+ "Anchor Frame",
+ "Reference point to anchor stabilization "
+ "(other frames will be adjusted relative to this frame's position)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* target position */
+ prop = RNA_def_property(srna, "target_position", PROP_FLOAT, PROP_TRANSLATION);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_range(
+ prop, -FLT_MAX, FLT_MAX, 1, 3); /* increment in steps of 0.01 and show 3 digit after point */
+ RNA_def_property_float_sdna(prop, NULL, "target_pos");
+ RNA_def_property_ui_text(prop,
+ "Expected Position",
+ "Known relative offset of original shot, will be subtracted "
+ "(e.g. for panning shot, can be animated)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* target rotation */
+ prop = RNA_def_property(srna, "target_rotation", PROP_FLOAT, PROP_ANGLE);
+ RNA_def_property_float_sdna(prop, NULL, "target_rot");
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -FLT_MAX, FLT_MAX, 10.0f, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Expected Rotation",
+ "Rotation present on original shot, will be compensated (e.g. for deliberate tilting)");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* target scale */
+ prop = RNA_def_property(srna, "target_scale", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_range(prop, FLT_EPSILON, FLT_MAX);
+ RNA_def_property_ui_range(
+ prop, 0.01f, 10.0f, 0.001f, 3); /* increment in steps of 0.001. Show 3 digit after point */
+ RNA_def_property_ui_text(prop,
+ "Expected Scale",
+ "Explicitly scale resulting frame to compensate zoom of original shot");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* autoscale */
+ prop = RNA_def_property(srna, "use_autoscale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_AUTOSCALE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(
+ prop, "Autoscale", "Automatically scale footage to cover unfilled areas when stabilizing");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* max scale */
+ prop = RNA_def_property(srna, "scale_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "maxscale");
+ RNA_def_property_range(prop, 0.0f, 10.0f);
+ RNA_def_property_ui_text(prop, "Maximal Scale", "Limit the amount of automatic scaling");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* influence_location */
+ prop = RNA_def_property(srna, "influence_location", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "locinf");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Location Influence", "Influence of stabilization algorithm on footage location");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* influence_scale */
+ prop = RNA_def_property(srna, "influence_scale", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "scaleinf");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Scale Influence", "Influence of stabilization algorithm on footage scale");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* influence_rotation */
+ prop = RNA_def_property(srna, "influence_rotation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "rotinf");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Rotation Influence", "Influence of stabilization algorithm on footage rotation");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* filter */
+ prop = RNA_def_property(srna, "filter_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "filter");
+ RNA_def_property_enum_items(prop, filter_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Interpolate",
+ "Interpolation to use for sub-pixel shifts and rotations due to stabilization");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, "rna_tracking_flushUpdate");
+
+ /* UI display : show participating tracks */
+ prop = RNA_def_property(srna, "show_tracks_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_SHOW_STAB_TRACKS);
+ RNA_def_property_ui_text(
+ prop, "Show Tracks", "Show UI list of tracks participating in stabilization");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
}
static void rna_def_reconstructedCamera(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking reconstructed camera data",
- "Match-moving reconstructed camera data from tracker");
+ srna = RNA_def_struct(brna, "MovieReconstructedCamera", NULL);
+ RNA_def_struct_ui_text(srna,
+ "Movie tracking reconstructed camera data",
+ "Match-moving reconstructed camera data from tracker");
- /* frame */
- prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_int_sdna(prop, NULL, "framenr");
- RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
+ /* frame */
+ prop = RNA_def_property(srna, "frame", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_int_sdna(prop, NULL, "framenr");
+ RNA_def_property_ui_text(prop, "Frame", "Frame number marker is keyframed on");
- /* matrix */
- prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_float_sdna(prop, NULL, "mat");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Matrix", "Worldspace transformation matrix");
+ /* matrix */
+ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_float_sdna(prop, NULL, "mat");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Matrix", "Worldspace transformation matrix");
- /* average_error */
- prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Average Error", "Average error of reconstruction");
+ /* average_error */
+ prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error of reconstruction");
}
static void rna_def_trackingReconstructedCameras(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "MovieTrackingReconstructedCameras", NULL);
- RNA_def_struct_sdna(srna, "MovieTrackingReconstruction");
- RNA_def_struct_ui_text(srna, "Reconstructed Cameras", "Collection of solved cameras");
-
- func = RNA_def_function(srna, "find_frame", "rna_trackingCameras_find_frame");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Find a reconstructed camera for a give frame number");
- RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to find camera for", MINFRAME, MAXFRAME);
- parm = RNA_def_pointer(func, "camera", "MovieReconstructedCamera", "", "Camera for a given frame");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "matrix_from_frame", "rna_trackingCameras_matrix_from_frame");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Return interpolated camera matrix for a given frame");
- RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to find camera for", MINFRAME, MAXFRAME);
- parm = RNA_def_float_matrix(func, "matrix", 4, 4, NULL, -FLT_MAX, FLT_MAX, "Matrix",
- "Interpolated camera matrix for a given frame", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
- RNA_def_function_output(func, parm);
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "MovieTrackingReconstructedCameras", NULL);
+ RNA_def_struct_sdna(srna, "MovieTrackingReconstruction");
+ RNA_def_struct_ui_text(srna, "Reconstructed Cameras", "Collection of solved cameras");
+
+ func = RNA_def_function(srna, "find_frame", "rna_trackingCameras_find_frame");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Find a reconstructed camera for a give frame number");
+ RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to find camera for",
+ MINFRAME,
+ MAXFRAME);
+ parm = RNA_def_pointer(
+ func, "camera", "MovieReconstructedCamera", "", "Camera for a given frame");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "matrix_from_frame", "rna_trackingCameras_matrix_from_frame");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Return interpolated camera matrix for a given frame");
+ RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to find camera for",
+ MINFRAME,
+ MAXFRAME);
+ parm = RNA_def_float_matrix(func,
+ "matrix",
+ 4,
+ 4,
+ NULL,
+ -FLT_MAX,
+ FLT_MAX,
+ "Matrix",
+ "Interpolated camera matrix for a given frame",
+ -FLT_MAX,
+ FLT_MAX);
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0); /* needed for string return value */
+ RNA_def_function_output(func, parm);
}
static void rna_def_trackingReconstruction(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- rna_def_reconstructedCamera(brna);
+ rna_def_reconstructedCamera(brna);
- srna = RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking reconstruction data",
- "Match-moving reconstruction data from tracker");
+ srna = RNA_def_struct(brna, "MovieTrackingReconstruction", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking reconstruction data", "Match-moving reconstruction data from tracker");
- /* is_valid */
- prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_RECONSTRUCTED);
- RNA_def_property_ui_text(prop, "Reconstructed", "Is tracking data contains valid reconstruction information");
+ /* is_valid */
+ prop = RNA_def_property(srna, "is_valid", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_RECONSTRUCTED);
+ RNA_def_property_ui_text(
+ prop, "Reconstructed", "Is tracking data contains valid reconstruction information");
- /* average_error */
- prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "error");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Average Error", "Average error of reconstruction");
-
- /* cameras */
- prop = RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieReconstructedCamera");
- RNA_def_property_collection_sdna(prop, NULL, "cameras", "camnr");
- RNA_def_property_ui_text(prop, "Cameras", "Collection of solved cameras");
- RNA_def_property_srna(prop, "MovieTrackingReconstructedCameras");
+ /* average_error */
+ prop = RNA_def_property(srna, "average_error", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "error");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Average Error", "Average error of reconstruction");
+ /* cameras */
+ prop = RNA_def_property(srna, "cameras", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieReconstructedCamera");
+ RNA_def_property_collection_sdna(prop, NULL, "cameras", "camnr");
+ RNA_def_property_ui_text(prop, "Cameras", "Collection of solved cameras");
+ RNA_def_property_srna(prop, "MovieTrackingReconstructedCameras");
}
static void rna_def_trackingTracks(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "MovieTrackingTracks", NULL);
- RNA_def_struct_sdna(srna, "MovieTracking");
- RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
-
- func = RNA_def_function(srna, "new", "rna_trackingTracks_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "Create new motion track in this movie clip");
- RNA_def_string(func, "name", NULL, 0, "", "Name of new track");
- RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add track on", MINFRAME, MAXFRAME);
- parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "Newly created track");
- RNA_def_function_return(func, parm);
-
- /* active track */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "MovieTrackingTracks", NULL);
+ RNA_def_struct_sdna(srna, "MovieTracking");
+ RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
+
+ func = RNA_def_function(srna, "new", "rna_trackingTracks_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "Create new motion track in this movie clip");
+ RNA_def_string(func, "name", NULL, 0, "", "Name of new track");
+ RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to add track on",
+ MINFRAME,
+ MAXFRAME);
+ parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "Newly created track");
+ RNA_def_function_return(func, parm);
+
+ /* active track */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
}
static void rna_def_trackingPlaneTracks(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MovieTrackingPlaneTracks", NULL);
- RNA_def_struct_sdna(srna, "MovieTracking");
- RNA_def_struct_ui_text(srna, "Movie Plane Tracks", "Collection of movie tracking plane tracks");
+ srna = RNA_def_struct(brna, "MovieTrackingPlaneTracks", NULL);
+ RNA_def_struct_sdna(srna, "MovieTracking");
+ RNA_def_struct_ui_text(srna, "Movie Plane Tracks", "Collection of movie tracking plane tracks");
- /* TODO(sergey): Add API to create new plane tracks */
+ /* TODO(sergey): Add API to create new plane tracks */
- /* active plane track */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingPlaneTrack");
- RNA_def_property_pointer_funcs(prop, "rna_tracking_active_plane_track_get", "rna_tracking_active_plane_track_set",
- NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Plane Track", "Active plane track in this tracking data object");
+ /* active plane track */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingPlaneTrack");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_tracking_active_plane_track_get",
+ "rna_tracking_active_plane_track_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(
+ prop, "Active Plane Track", "Active plane track in this tracking data object");
}
static void rna_def_trackingObjectTracks(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *prop;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "MovieTrackingObjectTracks", NULL);
- RNA_def_struct_sdna(srna, "MovieTrackingObject");
- RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
-
- func = RNA_def_function(srna, "new", "rna_trackingObject_tracks_new");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- RNA_def_function_ui_description(func, "create new motion track in this movie clip");
- RNA_def_string(func, "name", NULL, 0, "", "Name of new track");
- RNA_def_int(func, "frame", 1, MINFRAME, MAXFRAME, "Frame", "Frame number to add tracks on", MINFRAME, MAXFRAME);
- parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "Newly created track");
- RNA_def_function_return(func, parm);
-
- /* active track */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_pointer_funcs(prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "MovieTrackingObjectTracks", NULL);
+ RNA_def_struct_sdna(srna, "MovieTrackingObject");
+ RNA_def_struct_ui_text(srna, "Movie Tracks", "Collection of movie tracking tracks");
+
+ func = RNA_def_function(srna, "new", "rna_trackingObject_tracks_new");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ RNA_def_function_ui_description(func, "create new motion track in this movie clip");
+ RNA_def_string(func, "name", NULL, 0, "", "Name of new track");
+ RNA_def_int(func,
+ "frame",
+ 1,
+ MINFRAME,
+ MAXFRAME,
+ "Frame",
+ "Frame number to add tracks on",
+ MINFRAME,
+ MAXFRAME);
+ parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "Newly created track");
+ RNA_def_function_return(func, parm);
+
+ /* active track */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_tracking_active_track_get", "rna_tracking_active_track_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
}
static void rna_def_trackingObjectPlaneTracks(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "MovieTrackingObjectPlaneTracks", NULL);
- RNA_def_struct_sdna(srna, "MovieTrackingObject");
- RNA_def_struct_ui_text(srna, "Plane Tracks", "Collection of tracking plane tracks");
+ srna = RNA_def_struct(brna, "MovieTrackingObjectPlaneTracks", NULL);
+ RNA_def_struct_sdna(srna, "MovieTrackingObject");
+ RNA_def_struct_ui_text(srna, "Plane Tracks", "Collection of tracking plane tracks");
- /* active track */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_pointer_funcs(prop, "rna_tracking_active_plane_track_get", "rna_tracking_active_plane_track_set",
- NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
+ /* active track */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_tracking_active_plane_track_get",
+ "rna_tracking_active_plane_track_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Track", "Active track in this tracking data object");
}
static void rna_def_trackingObject(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "MovieTrackingObject", NULL);
- RNA_def_struct_ui_text(srna, "Movie tracking object data", "Match-moving object tracking and reconstruction data");
-
- /* name */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Unique name of object");
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingObject_name_set");
- RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
- RNA_def_struct_name_property(srna, prop);
-
- /* is_camera */
- prop = RNA_def_property(srna, "is_camera", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_OBJECT_CAMERA);
- RNA_def_property_ui_text(prop, "Camera", "Object is used for camera tracking");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* tracks */
- prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingObject_tracks_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
- RNA_def_property_srna(prop, "MovieTrackingObjectTracks");
-
- /* plane tracks */
- prop = RNA_def_property(srna, "plane_tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingObject_plane_tracks_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingPlaneTrack");
- RNA_def_property_ui_text(prop, "Plane Tracks", "Collection of plane tracks in this tracking data object");
- RNA_def_property_srna(prop, "MovieTrackingObjectPlaneTracks");
-
- /* reconstruction */
- prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
- RNA_def_property_pointer_funcs(prop, "rna_trackingObject_reconstruction_get", NULL, NULL, NULL);
-
- /* scale */
- prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_float_sdna(prop, NULL, "scale");
- RNA_def_property_range(prop, 0.0001f, 10000.0f);
- RNA_def_property_ui_range(prop, 0.0001f, 10000.0, 1, 4);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Scale", "Scale of object solution in camera space");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingObject_flushUpdate");
-
- /* keyframe_a */
- prop = RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "keyframe1");
- RNA_def_property_ui_text(prop, "Keyframe A", "First keyframe used for reconstruction initialization");
-
- /* keyframe_b */
- prop = RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_sdna(prop, NULL, "keyframe2");
- RNA_def_property_ui_text(prop, "Keyframe B", "Second keyframe used for reconstruction initialization");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "MovieTrackingObject", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Movie tracking object data", "Match-moving object tracking and reconstruction data");
+
+ /* name */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Unique name of object");
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_trackingObject_name_set");
+ RNA_def_property_string_maxlength(prop, MAX_ID_NAME - 2);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, NULL);
+ RNA_def_struct_name_property(srna, prop);
+
+ /* is_camera */
+ prop = RNA_def_property(srna, "is_camera", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_OBJECT_CAMERA);
+ RNA_def_property_ui_text(prop, "Camera", "Object is used for camera tracking");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* tracks */
+ prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_trackingObject_tracks_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
+ RNA_def_property_srna(prop, "MovieTrackingObjectTracks");
+
+ /* plane tracks */
+ prop = RNA_def_property(srna, "plane_tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_trackingObject_plane_tracks_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingPlaneTrack");
+ RNA_def_property_ui_text(
+ prop, "Plane Tracks", "Collection of plane tracks in this tracking data object");
+ RNA_def_property_srna(prop, "MovieTrackingObjectPlaneTracks");
+
+ /* reconstruction */
+ prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
+ RNA_def_property_pointer_funcs(prop, "rna_trackingObject_reconstruction_get", NULL, NULL, NULL);
+
+ /* scale */
+ prop = RNA_def_property(srna, "scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_float_sdna(prop, NULL, "scale");
+ RNA_def_property_range(prop, 0.0001f, 10000.0f);
+ RNA_def_property_ui_range(prop, 0.0001f, 10000.0, 1, 4);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(prop, "Scale", "Scale of object solution in camera space");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingObject_flushUpdate");
+
+ /* keyframe_a */
+ prop = RNA_def_property(srna, "keyframe_a", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "keyframe1");
+ RNA_def_property_ui_text(
+ prop, "Keyframe A", "First keyframe used for reconstruction initialization");
+
+ /* keyframe_b */
+ prop = RNA_def_property(srna, "keyframe_b", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_sdna(prop, NULL, "keyframe2");
+ RNA_def_property_ui_text(
+ prop, "Keyframe B", "Second keyframe used for reconstruction initialization");
}
static void rna_def_trackingObjects(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "MovieTrackingObjects");
- srna = RNA_def_struct(brna, "MovieTrackingObjects", NULL);
- RNA_def_struct_sdna(srna, "MovieTracking");
- RNA_def_struct_ui_text(srna, "Movie Objects", "Collection of movie tracking objects");
-
- func = RNA_def_function(srna, "new", "rna_trackingObject_new");
- RNA_def_function_ui_description(func, "Add tracking object to this movie clip");
- parm = RNA_def_string(func, "name", NULL, 0, "", "Name of new object");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "object", "MovieTrackingObject", "", "New motion tracking object");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_trackingObject_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove tracking object from this movie clip");
- parm = RNA_def_pointer(func, "object", "MovieTrackingObject", "", "Motion tracking object to be removed");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* active object */
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingObject");
- RNA_def_property_pointer_funcs(prop, "rna_tracking_active_object_get",
- "rna_tracking_active_object_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
- RNA_def_property_ui_text(prop, "Active Object", "Active object in this tracking data object");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "MovieTrackingObjects");
+ srna = RNA_def_struct(brna, "MovieTrackingObjects", NULL);
+ RNA_def_struct_sdna(srna, "MovieTracking");
+ RNA_def_struct_ui_text(srna, "Movie Objects", "Collection of movie tracking objects");
+
+ func = RNA_def_function(srna, "new", "rna_trackingObject_new");
+ RNA_def_function_ui_description(func, "Add tracking object to this movie clip");
+ parm = RNA_def_string(func, "name", NULL, 0, "", "Name of new object");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "object", "MovieTrackingObject", "", "New motion tracking object");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_trackingObject_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove tracking object from this movie clip");
+ parm = RNA_def_pointer(
+ func, "object", "MovieTrackingObject", "", "Motion tracking object to be removed");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* active object */
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingObject");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_tracking_active_object_get", "rna_tracking_active_object_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK);
+ RNA_def_property_ui_text(prop, "Active Object", "Active object in this tracking data object");
}
static void rna_def_trackingDopesheet(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem sort_items[] = {
- {TRACKING_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"},
- {TRACKING_DOPE_SORT_LONGEST, "LONGEST", 0, "Longest", "Sort channels by longest tracked segment"},
- {TRACKING_DOPE_SORT_TOTAL, "TOTAL", 0, "Total", "Sort channels by overall amount of tracked segments"},
- {TRACKING_DOPE_SORT_AVERAGE_ERROR, "AVERAGE_ERROR", 0, "Average Error",
- "Sort channels by average reprojection error of tracks after solve"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "MovieTrackingDopesheet", NULL);
- RNA_def_struct_ui_text(srna, "Movie Tracking Dopesheet", "Match-moving dopesheet data");
-
- /* dopesheet sort */
- prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sort_method");
- RNA_def_property_enum_items(prop, sort_items);
- RNA_def_property_ui_text(prop, "Dopesheet Sort Field", "Method to be used to sort channels in dopesheet view");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
-
- /* invert_dopesheet_sort */
- prop = RNA_def_property(srna, "use_invert_sort", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SORT_INVERSE);
- RNA_def_property_ui_text(prop, "Invert Dopesheet Sort", "Invert sort order of dopesheet channels");
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
-
- /* show_only_selected */
- prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SELECTED_ONLY);
- RNA_def_property_ui_text(prop, "Only Selected", "Only include channels relating to selected objects and data");
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
-
- /* show_hidden */
- prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SHOW_HIDDEN);
- RNA_def_property_ui_text(prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
- RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
- RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem sort_items[] = {
+ {TRACKING_DOPE_SORT_NAME, "NAME", 0, "Name", "Sort channels by their names"},
+ {TRACKING_DOPE_SORT_LONGEST,
+ "LONGEST",
+ 0,
+ "Longest",
+ "Sort channels by longest tracked segment"},
+ {TRACKING_DOPE_SORT_TOTAL,
+ "TOTAL",
+ 0,
+ "Total",
+ "Sort channels by overall amount of tracked segments"},
+ {TRACKING_DOPE_SORT_AVERAGE_ERROR,
+ "AVERAGE_ERROR",
+ 0,
+ "Average Error",
+ "Sort channels by average reprojection error of tracks after solve"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "MovieTrackingDopesheet", NULL);
+ RNA_def_struct_ui_text(srna, "Movie Tracking Dopesheet", "Match-moving dopesheet data");
+
+ /* dopesheet sort */
+ prop = RNA_def_property(srna, "sort_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "sort_method");
+ RNA_def_property_enum_items(prop, sort_items);
+ RNA_def_property_ui_text(
+ prop, "Dopesheet Sort Field", "Method to be used to sort channels in dopesheet view");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
+
+ /* invert_dopesheet_sort */
+ prop = RNA_def_property(srna, "use_invert_sort", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SORT_INVERSE);
+ RNA_def_property_ui_text(
+ prop, "Invert Dopesheet Sort", "Invert sort order of dopesheet channels");
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
+
+ /* show_only_selected */
+ prop = RNA_def_property(srna, "show_only_selected", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SELECTED_ONLY);
+ RNA_def_property_ui_text(
+ prop, "Only Selected", "Only include channels relating to selected objects and data");
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 0);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
+
+ /* show_hidden */
+ prop = RNA_def_property(srna, "show_hidden", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TRACKING_DOPE_SHOW_HIDDEN);
+ RNA_def_property_ui_text(
+ prop, "Display Hidden", "Include channels from objects/bone that aren't visible");
+ RNA_def_property_ui_icon(prop, ICON_GHOST_ENABLED, 0);
+ RNA_def_property_update(prop, NC_MOVIECLIP | NA_EDITED, "rna_trackingDopesheet_tagUpdate");
}
static void rna_def_tracking(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_trackingSettings(brna);
- rna_def_trackingCamera(brna);
- rna_def_trackingTrack(brna);
- rna_def_trackingPlaneTrack(brna);
- rna_def_trackingTracks(brna);
- rna_def_trackingPlaneTracks(brna);
- rna_def_trackingObjectTracks(brna);
- rna_def_trackingObjectPlaneTracks(brna);
- rna_def_trackingStabilization(brna);
- rna_def_trackingReconstructedCameras(brna);
- rna_def_trackingReconstruction(brna);
- rna_def_trackingObject(brna);
- rna_def_trackingDopesheet(brna);
-
- srna = RNA_def_struct(brna, "MovieTracking", NULL);
- RNA_def_struct_path_func(srna, "rna_tracking_path");
- RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking");
-
- /* settings */
- prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingSettings");
-
- /* camera properties */
- prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingCamera");
-
- /* tracks */
- prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingTracks_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingTrack");
- RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
- RNA_def_property_srna(prop, "MovieTrackingTracks");
-
- /* tracks */
- prop = RNA_def_property(srna, "plane_tracks", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingPlaneTracks_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingPlaneTrack");
- RNA_def_property_ui_text(prop, "Plane Tracks", "Collection of plane tracks in this tracking data object");
- RNA_def_property_srna(prop, "MovieTrackingPlaneTracks");
-
- /* stabilization */
- prop = RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingStabilization");
-
- /* reconstruction */
- prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
-
- /* objects */
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_funcs(prop, "rna_trackingObjects_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_struct_type(prop, "MovieTrackingObject");
- RNA_def_property_ui_text(prop, "Objects", "Collection of objects in this tracking data object");
- rna_def_trackingObjects(brna, prop);
-
- /* active object index */
- prop = RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "objectnr");
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_int_funcs(prop, "rna_tracking_active_object_index_get", "rna_tracking_active_object_index_set",
- "rna_tracking_active_object_index_range");
- RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object");
- RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
-
- /* dopesheet */
- prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "MovieTrackingDopesheet");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_trackingSettings(brna);
+ rna_def_trackingCamera(brna);
+ rna_def_trackingTrack(brna);
+ rna_def_trackingPlaneTrack(brna);
+ rna_def_trackingTracks(brna);
+ rna_def_trackingPlaneTracks(brna);
+ rna_def_trackingObjectTracks(brna);
+ rna_def_trackingObjectPlaneTracks(brna);
+ rna_def_trackingStabilization(brna);
+ rna_def_trackingReconstructedCameras(brna);
+ rna_def_trackingReconstruction(brna);
+ rna_def_trackingObject(brna);
+ rna_def_trackingDopesheet(brna);
+
+ srna = RNA_def_struct(brna, "MovieTracking", NULL);
+ RNA_def_struct_path_func(srna, "rna_tracking_path");
+ RNA_def_struct_ui_text(srna, "Movie tracking data", "Match-moving data for tracking");
+
+ /* settings */
+ prop = RNA_def_property(srna, "settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingSettings");
+
+ /* camera properties */
+ prop = RNA_def_property(srna, "camera", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingCamera");
+
+ /* tracks */
+ prop = RNA_def_property(srna, "tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_trackingTracks_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingTrack");
+ RNA_def_property_ui_text(prop, "Tracks", "Collection of tracks in this tracking data object");
+ RNA_def_property_srna(prop, "MovieTrackingTracks");
+
+ /* tracks */
+ prop = RNA_def_property(srna, "plane_tracks", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_trackingPlaneTracks_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingPlaneTrack");
+ RNA_def_property_ui_text(
+ prop, "Plane Tracks", "Collection of plane tracks in this tracking data object");
+ RNA_def_property_srna(prop, "MovieTrackingPlaneTracks");
+
+ /* stabilization */
+ prop = RNA_def_property(srna, "stabilization", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingStabilization");
+
+ /* reconstruction */
+ prop = RNA_def_property(srna, "reconstruction", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingReconstruction");
+
+ /* objects */
+ prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_funcs(prop,
+ "rna_trackingObjects_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_struct_type(prop, "MovieTrackingObject");
+ RNA_def_property_ui_text(prop, "Objects", "Collection of objects in this tracking data object");
+ rna_def_trackingObjects(brna, prop);
+
+ /* active object index */
+ prop = RNA_def_property(srna, "active_object_index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "objectnr");
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_int_funcs(prop,
+ "rna_tracking_active_object_index_get",
+ "rna_tracking_active_object_index_set",
+ "rna_tracking_active_object_index_range");
+ RNA_def_property_ui_text(prop, "Active Object Index", "Index of active object");
+ RNA_def_property_update(prop, NC_MOVIECLIP | ND_DISPLAY, NULL);
+
+ /* dopesheet */
+ prop = RNA_def_property(srna, "dopesheet", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "MovieTrackingDopesheet");
}
void RNA_def_tracking(BlenderRNA *brna)
{
- rna_def_tracking(brna);
+ rna_def_tracking(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c
index b6e75cf3507..1941f1bc1b2 100644
--- a/source/blender/makesrna/intern/rna_ui.c
+++ b/source/blender/makesrna/intern/rna_ui.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include "DNA_screen_types.h"
@@ -40,1513 +39,1624 @@
/* see WM_types.h */
const EnumPropertyItem rna_enum_operator_context_items[] = {
- {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""},
- {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""},
- {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, "Invoke Region Channels", ""},
- {WM_OP_INVOKE_REGION_PREVIEW, "INVOKE_REGION_PREVIEW", 0, "Invoke Region Preview", ""},
- {WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""},
- {WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""},
- {WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""},
- {WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region Window", ""},
- {WM_OP_EXEC_REGION_CHANNELS, "EXEC_REGION_CHANNELS", 0, "Exec Region Channels", ""},
- {WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec Region Preview", ""},
- {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""},
- {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""},
- {0, NULL, 0, NULL, NULL},
+ {WM_OP_INVOKE_DEFAULT, "INVOKE_DEFAULT", 0, "Invoke Default", ""},
+ {WM_OP_INVOKE_REGION_WIN, "INVOKE_REGION_WIN", 0, "Invoke Region Window", ""},
+ {WM_OP_INVOKE_REGION_CHANNELS, "INVOKE_REGION_CHANNELS", 0, "Invoke Region Channels", ""},
+ {WM_OP_INVOKE_REGION_PREVIEW, "INVOKE_REGION_PREVIEW", 0, "Invoke Region Preview", ""},
+ {WM_OP_INVOKE_AREA, "INVOKE_AREA", 0, "Invoke Area", ""},
+ {WM_OP_INVOKE_SCREEN, "INVOKE_SCREEN", 0, "Invoke Screen", ""},
+ {WM_OP_EXEC_DEFAULT, "EXEC_DEFAULT", 0, "Exec Default", ""},
+ {WM_OP_EXEC_REGION_WIN, "EXEC_REGION_WIN", 0, "Exec Region Window", ""},
+ {WM_OP_EXEC_REGION_CHANNELS, "EXEC_REGION_CHANNELS", 0, "Exec Region Channels", ""},
+ {WM_OP_EXEC_REGION_PREVIEW, "EXEC_REGION_PREVIEW", 0, "Exec Region Preview", ""},
+ {WM_OP_EXEC_AREA, "EXEC_AREA", 0, "Exec Area", ""},
+ {WM_OP_EXEC_SCREEN, "EXEC_SCREEN", 0, "Exec Screen", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_uilist_layout_type_items[] = {
- {UILST_LAYOUT_DEFAULT, "DEFAULT", 0, "Default Layout", "Use the default, multi-rows layout"},
- {UILST_LAYOUT_COMPACT, "COMPACT", 0, "Compact Layout", "Use the compact, single-row layout"},
- {UILST_LAYOUT_GRID, "GRID", 0, "Grid Layout", "Use the grid-based layout"},
- {0, NULL, 0, NULL, NULL},
+ {UILST_LAYOUT_DEFAULT, "DEFAULT", 0, "Default Layout", "Use the default, multi-rows layout"},
+ {UILST_LAYOUT_COMPACT, "COMPACT", 0, "Compact Layout", "Use the compact, single-row layout"},
+ {UILST_LAYOUT_GRID, "GRID", 0, "Grid Layout", "Use the grid-based layout"},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include <assert.h>
+# include <assert.h>
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "BLI_dynstr.h"
+# include "BLI_dynstr.h"
-#include "BKE_context.h"
-#include "BKE_report.h"
-#include "BKE_screen.h"
+# include "BKE_context.h"
+# include "BKE_report.h"
+# include "BKE_screen.h"
-#include "WM_api.h"
+# include "WM_api.h"
static ARegionType *region_type_find(ReportList *reports, int space_type, int region_type)
{
- SpaceType *st;
- ARegionType *art;
+ SpaceType *st;
+ ARegionType *art;
- st = BKE_spacetype_from_id(space_type);
+ st = BKE_spacetype_from_id(space_type);
- for (art = (st) ? st->regiontypes.first : NULL; art; art = art->next) {
- if (art->regionid == region_type)
- break;
- }
+ for (art = (st) ? st->regiontypes.first : NULL; art; art = art->next) {
+ if (art->regionid == region_type)
+ break;
+ }
- /* region type not found? abort */
- if (art == NULL) {
- BKE_report(reports, RPT_ERROR, "Region not found in space type");
- return NULL;
- }
+ /* region type not found? abort */
+ if (art == NULL) {
+ BKE_report(reports, RPT_ERROR, "Region not found in space type");
+ return NULL;
+ }
- return art;
+ return art;
}
/* Panel */
static bool panel_poll(const bContext *C, PanelType *pt)
{
- extern FunctionRNA rna_Panel_poll_func;
+ extern FunctionRNA rna_Panel_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
+ func = &rna_Panel_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- pt->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pt->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static void panel_draw(const bContext *C, Panel *pnl)
{
- extern FunctionRNA rna_Panel_draw_func;
+ extern FunctionRNA rna_Panel_draw_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
- func = &rna_Panel_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
+ RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
+ func = &rna_Panel_draw_func; /* RNA_struct_find_function(&ptr, "draw"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- pnl->type->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pnl->type->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void panel_draw_header(const bContext *C, Panel *pnl)
{
- extern FunctionRNA rna_Panel_draw_header_func;
+ extern FunctionRNA rna_Panel_draw_header_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
- func = &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */
+ RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
+ func = &rna_Panel_draw_header_func; /* RNA_struct_find_function(&ptr, "draw_header"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- pnl->type->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pnl->type->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void panel_draw_header_preset(const bContext *C, Panel *pnl)
{
- extern FunctionRNA rna_Panel_draw_header_preset_func;
+ extern FunctionRNA rna_Panel_draw_header_preset_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
- func = &rna_Panel_draw_header_preset_func;
+ RNA_pointer_create(&CTX_wm_screen(C)->id, pnl->type->ext.srna, pnl, &ptr);
+ func = &rna_Panel_draw_header_preset_func;
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- pnl->type->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pnl->type->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Panel_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- ARegionType *art;
- PanelType *pt = RNA_struct_blender_type_get(type);
-
- if (!pt)
- return;
- if (!(art = region_type_find(NULL, pt->space_type, pt->region_type)))
- return;
-
- RNA_struct_free_extension(type, &pt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
-
- if (pt->parent) {
- LinkData *link = BLI_findptr(&pt->parent->children, pt, offsetof(LinkData, data));
- BLI_freelinkN(&pt->parent->children, link);
- }
-
- WM_paneltype_remove(pt);
-
- for (LinkData *link = pt->children.first; link; link = link->next) {
- PanelType *child_pt = link->data;
- child_pt->parent = NULL;
- }
-
- BLI_freelistN(&pt->children);
- BLI_freelinkN(&art->paneltypes, pt);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
-}
-
-static StructRNA *rna_Panel_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- ARegionType *art;
- PanelType *pt, *parent = NULL, dummypt = {NULL};
- Panel dummypanel = {NULL};
- PointerRNA dummyptr;
- int have_function[4];
-
- /* setup dummy panel & panel type to store static properties in */
- dummypanel.type = &dummypt;
- RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr);
-
- /* We have to set default context! Else we get a void string... */
- strcpy(dummypt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
-
- /* validate the python class */
- if (validate(&dummyptr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummypt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering panel class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummypt.idname));
- return NULL;
- }
-
- if ((1 << dummypt.region_type) & RGN_TYPE_HAS_CATEGORY_MASK) {
- if (dummypt.category[0] == '\0') {
- /* Use a fallback, otherwise an empty value will draw the panel in every category. */
- strcpy(dummypt.category, PNL_CATEGORY_FALLBACK);
-#ifndef NDEBUG
- printf("Registering panel class: '%s' misses category, please update the script\n", dummypt.idname);
-#endif
- }
- }
- else {
- if (dummypt.category[0] != '\0') {
- if ((1 << dummypt.space_type) & WM_TOOLSYSTEM_SPACE_MASK) {
- BKE_reportf(reports, RPT_ERROR, "Registering panel class: '%s' has category '%s' ",
- dummypt.idname, dummypt.category);
- return NULL;
- }
- }
- }
-
- if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type)))
- return NULL;
-
- /* check if we have registered this panel type before, and remove it */
- for (pt = art->paneltypes.first; pt; pt = pt->next) {
- if (STREQ(pt->idname, dummypt.idname)) {
- if (pt->ext.srna)
- rna_Panel_unregister(bmain, pt->ext.srna);
- else
- BLI_freelinkN(&art->paneltypes, pt);
- break;
- }
-
- if (dummypt.parent_id[0] && STREQ(pt->idname, dummypt.parent_id)) {
- parent = pt;
- }
- }
- if (!RNA_struct_available_or_report(reports, dummypt.idname)) {
- return NULL;
- }
- if (!RNA_struct_bl_idname_ok_or_report(reports, dummypt.idname, "_PT_")) {
- return NULL;
- }
- if (dummypt.parent_id[0] && !parent) {
- BKE_reportf(reports, RPT_ERROR, "Registering panel class: parent '%s' for '%s' not found",
- dummypt.parent_id, dummypt.idname);
- return NULL;
- }
-
- /* create a new panel type */
- pt = MEM_callocN(sizeof(PanelType), "python buttons panel");
- memcpy(pt, &dummypt, sizeof(dummypt));
-
- pt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, pt->idname, &RNA_Panel);
- RNA_def_struct_translation_context(pt->ext.srna, pt->translation_context);
- pt->ext.data = data;
- pt->ext.call = call;
- pt->ext.free = free;
- RNA_struct_blender_type_set(pt->ext.srna, pt);
- RNA_def_struct_flag(pt->ext.srna, STRUCT_NO_IDPROPERTIES);
-
- pt->poll = (have_function[0]) ? panel_poll : NULL;
- pt->draw = (have_function[1]) ? panel_draw : NULL;
- pt->draw_header = (have_function[2]) ? panel_draw_header : NULL;
- pt->draw_header_preset = (have_function[3]) ? panel_draw_header_preset : NULL;
-
- /* XXX use "no header" flag for some ordering of panels until we have real panel ordering */
- if (pt->flag & PNL_NO_HEADER) {
- PanelType *pth = art->paneltypes.first;
- while (pth && pth->flag & PNL_NO_HEADER)
- pth = pth->next;
-
- if (pth)
- BLI_insertlinkbefore(&art->paneltypes, pth, pt);
- else
- BLI_addtail(&art->paneltypes, pt);
- }
- else
- BLI_addtail(&art->paneltypes, pt);
-
- if (parent) {
- pt->parent = parent;
- BLI_addtail(&parent->children, BLI_genericNodeN(pt));
- }
-
- {
- const char *owner_id = RNA_struct_state_owner_get();
- if (owner_id) {
- BLI_strncpy(pt->owner_id, owner_id, sizeof(pt->owner_id));
- }
- }
-
- WM_paneltype_add(pt);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
-
- return pt->ext.srna;
+ ARegionType *art;
+ PanelType *pt = RNA_struct_blender_type_get(type);
+
+ if (!pt)
+ return;
+ if (!(art = region_type_find(NULL, pt->space_type, pt->region_type)))
+ return;
+
+ RNA_struct_free_extension(type, &pt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
+
+ if (pt->parent) {
+ LinkData *link = BLI_findptr(&pt->parent->children, pt, offsetof(LinkData, data));
+ BLI_freelinkN(&pt->parent->children, link);
+ }
+
+ WM_paneltype_remove(pt);
+
+ for (LinkData *link = pt->children.first; link; link = link->next) {
+ PanelType *child_pt = link->data;
+ child_pt->parent = NULL;
+ }
+
+ BLI_freelistN(&pt->children);
+ BLI_freelinkN(&art->paneltypes, pt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+}
+
+static StructRNA *rna_Panel_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ ARegionType *art;
+ PanelType *pt, *parent = NULL, dummypt = {NULL};
+ Panel dummypanel = {NULL};
+ PointerRNA dummyptr;
+ int have_function[4];
+
+ /* setup dummy panel & panel type to store static properties in */
+ dummypanel.type = &dummypt;
+ RNA_pointer_create(NULL, &RNA_Panel, &dummypanel, &dummyptr);
+
+ /* We have to set default context! Else we get a void string... */
+ strcpy(dummypt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+
+ /* validate the python class */
+ if (validate(&dummyptr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummypt.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering panel class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummypt.idname));
+ return NULL;
+ }
+
+ if ((1 << dummypt.region_type) & RGN_TYPE_HAS_CATEGORY_MASK) {
+ if (dummypt.category[0] == '\0') {
+ /* Use a fallback, otherwise an empty value will draw the panel in every category. */
+ strcpy(dummypt.category, PNL_CATEGORY_FALLBACK);
+# ifndef NDEBUG
+ printf("Registering panel class: '%s' misses category, please update the script\n",
+ dummypt.idname);
+# endif
+ }
+ }
+ else {
+ if (dummypt.category[0] != '\0') {
+ if ((1 << dummypt.space_type) & WM_TOOLSYSTEM_SPACE_MASK) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering panel class: '%s' has category '%s' ",
+ dummypt.idname,
+ dummypt.category);
+ return NULL;
+ }
+ }
+ }
+
+ if (!(art = region_type_find(reports, dummypt.space_type, dummypt.region_type)))
+ return NULL;
+
+ /* check if we have registered this panel type before, and remove it */
+ for (pt = art->paneltypes.first; pt; pt = pt->next) {
+ if (STREQ(pt->idname, dummypt.idname)) {
+ if (pt->ext.srna)
+ rna_Panel_unregister(bmain, pt->ext.srna);
+ else
+ BLI_freelinkN(&art->paneltypes, pt);
+ break;
+ }
+
+ if (dummypt.parent_id[0] && STREQ(pt->idname, dummypt.parent_id)) {
+ parent = pt;
+ }
+ }
+ if (!RNA_struct_available_or_report(reports, dummypt.idname)) {
+ return NULL;
+ }
+ if (!RNA_struct_bl_idname_ok_or_report(reports, dummypt.idname, "_PT_")) {
+ return NULL;
+ }
+ if (dummypt.parent_id[0] && !parent) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering panel class: parent '%s' for '%s' not found",
+ dummypt.parent_id,
+ dummypt.idname);
+ return NULL;
+ }
+
+ /* create a new panel type */
+ pt = MEM_callocN(sizeof(PanelType), "python buttons panel");
+ memcpy(pt, &dummypt, sizeof(dummypt));
+
+ pt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, pt->idname, &RNA_Panel);
+ RNA_def_struct_translation_context(pt->ext.srna, pt->translation_context);
+ pt->ext.data = data;
+ pt->ext.call = call;
+ pt->ext.free = free;
+ RNA_struct_blender_type_set(pt->ext.srna, pt);
+ RNA_def_struct_flag(pt->ext.srna, STRUCT_NO_IDPROPERTIES);
+
+ pt->poll = (have_function[0]) ? panel_poll : NULL;
+ pt->draw = (have_function[1]) ? panel_draw : NULL;
+ pt->draw_header = (have_function[2]) ? panel_draw_header : NULL;
+ pt->draw_header_preset = (have_function[3]) ? panel_draw_header_preset : NULL;
+
+ /* XXX use "no header" flag for some ordering of panels until we have real panel ordering */
+ if (pt->flag & PNL_NO_HEADER) {
+ PanelType *pth = art->paneltypes.first;
+ while (pth && pth->flag & PNL_NO_HEADER)
+ pth = pth->next;
+
+ if (pth)
+ BLI_insertlinkbefore(&art->paneltypes, pth, pt);
+ else
+ BLI_addtail(&art->paneltypes, pt);
+ }
+ else
+ BLI_addtail(&art->paneltypes, pt);
+
+ if (parent) {
+ pt->parent = parent;
+ BLI_addtail(&parent->children, BLI_genericNodeN(pt));
+ }
+
+ {
+ const char *owner_id = RNA_struct_state_owner_get();
+ if (owner_id) {
+ BLI_strncpy(pt->owner_id, owner_id, sizeof(pt->owner_id));
+ }
+ }
+
+ WM_paneltype_add(pt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+
+ return pt->ext.srna;
}
static StructRNA *rna_Panel_refine(PointerRNA *ptr)
{
- Panel *menu = (Panel *)ptr->data;
- return (menu->type && menu->type->ext.srna) ? menu->type->ext.srna : &RNA_Panel;
+ Panel *menu = (Panel *)ptr->data;
+ return (menu->type && menu->type->ext.srna) ? menu->type->ext.srna : &RNA_Panel;
}
/* UIList */
static unsigned int rna_UIList_filter_const_FILTER_ITEM_get(PointerRNA *UNUSED(ptr))
{
- return UILST_FLT_ITEM;
+ return UILST_FLT_ITEM;
}
static IDProperty *rna_UIList_idprops(PointerRNA *ptr, bool create)
{
- uiList *ui_list = (uiList *)ptr->data;
- if (create && !ui_list->properties) {
- IDPropertyTemplate val = {0};
- ui_list->properties = IDP_New(IDP_GROUP, &val, "RNA_UIList IDproperties group");
- }
+ uiList *ui_list = (uiList *)ptr->data;
+ if (create && !ui_list->properties) {
+ IDPropertyTemplate val = {0};
+ ui_list->properties = IDP_New(IDP_GROUP, &val, "RNA_UIList IDproperties group");
+ }
- return ui_list->properties;
+ return ui_list->properties;
}
-static void uilist_draw_item(uiList *ui_list, bContext *C, uiLayout *layout, PointerRNA *dataptr, PointerRNA *itemptr,
- int icon, PointerRNA *active_dataptr, const char *active_propname, int index, int flt_flag)
+static void uilist_draw_item(uiList *ui_list,
+ bContext *C,
+ uiLayout *layout,
+ PointerRNA *dataptr,
+ PointerRNA *itemptr,
+ int icon,
+ PointerRNA *active_dataptr,
+ const char *active_propname,
+ int index,
+ int flt_flag)
{
- extern FunctionRNA rna_UIList_draw_item_func;
+ extern FunctionRNA rna_UIList_draw_item_func;
- PointerRNA ul_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ul_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr);
- func = &rna_UIList_draw_item_func; /* RNA_struct_find_function(&ul_ptr, "draw_item"); */
+ RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr);
+ func = &rna_UIList_draw_item_func; /* RNA_struct_find_function(&ul_ptr, "draw_item"); */
- RNA_parameter_list_create(&list, &ul_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "layout", &layout);
- RNA_parameter_set_lookup(&list, "data", dataptr);
- RNA_parameter_set_lookup(&list, "item", itemptr);
- RNA_parameter_set_lookup(&list, "icon", &icon);
- RNA_parameter_set_lookup(&list, "active_data", active_dataptr);
- RNA_parameter_set_lookup(&list, "active_property", &active_propname);
- RNA_parameter_set_lookup(&list, "index", &index);
- RNA_parameter_set_lookup(&list, "flt_flag", &flt_flag);
- ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
+ RNA_parameter_list_create(&list, &ul_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "layout", &layout);
+ RNA_parameter_set_lookup(&list, "data", dataptr);
+ RNA_parameter_set_lookup(&list, "item", itemptr);
+ RNA_parameter_set_lookup(&list, "icon", &icon);
+ RNA_parameter_set_lookup(&list, "active_data", active_dataptr);
+ RNA_parameter_set_lookup(&list, "active_property", &active_propname);
+ RNA_parameter_set_lookup(&list, "index", &index);
+ RNA_parameter_set_lookup(&list, "flt_flag", &flt_flag);
+ ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void uilist_draw_filter(uiList *ui_list, bContext *C, uiLayout *layout)
{
- extern FunctionRNA rna_UIList_draw_filter_func;
-
- PointerRNA ul_ptr;
- ParameterList list;
- FunctionRNA *func;
-
- RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr);
- func = &rna_UIList_draw_filter_func; /* RNA_struct_find_function(&ul_ptr, "draw_filter"); */
-
- RNA_parameter_list_create(&list, &ul_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "layout", &layout);
- ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
-
- RNA_parameter_list_free(&list);
-}
-
-static void uilist_filter_items(uiList *ui_list, bContext *C, PointerRNA *dataptr, const char *propname)
-{
- extern FunctionRNA rna_UIList_filter_items_func;
-
- PointerRNA ul_ptr;
- ParameterList list;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- uiListDyn *flt_data = ui_list->dyn_data;
- int *filter_flags, *filter_neworder;
- void *ret1, *ret2;
- int ret_len;
- int len = flt_data->items_len = RNA_collection_length(dataptr, propname);
-
- RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr);
- func = &rna_UIList_filter_items_func; /* RNA_struct_find_function(&ul_ptr, "filter_items"); */
-
- RNA_parameter_list_create(&list, &ul_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "data", dataptr);
- RNA_parameter_set_lookup(&list, "property", &propname);
-
- ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
-
- parm = RNA_function_find_parameter(NULL, func, "filter_flags");
- ret_len = RNA_parameter_dynamic_length_get(&list, parm);
- if (ret_len != len && ret_len != 0) {
- printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n", __func__,
- RNA_parameter_dynamic_length_get(&list, parm), "filter_flags", len);
- /* Note: we cannot return here, we would let flt_data in inconsistent state... see T38356. */
- filter_flags = NULL;
- }
- else {
- RNA_parameter_get(&list, parm, &ret1);
- filter_flags = (int *)ret1;
- }
-
- parm = RNA_function_find_parameter(NULL, func, "filter_neworder");
- ret_len = RNA_parameter_dynamic_length_get(&list, parm);
- if (ret_len != len && ret_len != 0) {
- printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n", __func__,
- RNA_parameter_dynamic_length_get(&list, parm), "filter_neworder", len);
- /* Note: we cannot return here, we would let flt_data in inconsistent state... see T38356. */
- filter_neworder = NULL;
- }
- else {
- RNA_parameter_get(&list, parm, &ret2);
- filter_neworder = (int *)ret2;
- }
-
- /* We have to do some final checks and transforms... */
- {
- int i, filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE;
- if (filter_flags) {
- flt_data->items_filter_flags = MEM_mallocN(sizeof(int) * len, __func__);
- memcpy(flt_data->items_filter_flags, filter_flags, sizeof(int) * len);
-
- if (filter_neworder) {
- /* For sake of simplicity, py filtering is expected to filter all items, but we actually only want
- * reordering data for shown items!
- */
- int items_shown, shown_idx;
- int t_idx, t_ni, prev_ni;
- flt_data->items_shown = 0;
- for (i = 0, shown_idx = 0; i < len; i++) {
- if ((filter_flags[i] & UILST_FLT_ITEM) ^ filter_exclude) {
- filter_neworder[shown_idx++] = filter_neworder[i];
- }
- }
- items_shown = flt_data->items_shown = shown_idx;
- flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * items_shown, __func__);
- /* And now, bring back new indices into the [0, items_shown[ range!
- * XXX This is O(N²)... :/
- */
- for (shown_idx = 0, prev_ni = -1; shown_idx < items_shown; shown_idx++) {
- for (i = 0, t_ni = len, t_idx = -1; i < items_shown; i++) {
- int ni = filter_neworder[i];
- if (ni > prev_ni && ni < t_ni) {
- t_idx = i;
- t_ni = ni;
- }
- }
- if (t_idx >= 0) {
- prev_ni = t_ni;
- flt_data->items_filter_neworder[t_idx] = shown_idx;
- }
- }
- }
- else {
- /* we still have to set flt_data->items_shown... */
- flt_data->items_shown = 0;
- for (i = 0; i < len; i++) {
- if ((filter_flags[i] & UILST_FLT_ITEM) ^ filter_exclude) {
- flt_data->items_shown++;
- }
- }
- }
- }
- else {
- flt_data->items_shown = len;
-
- if (filter_neworder) {
- flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * len, __func__);
- memcpy(flt_data->items_filter_neworder, filter_neworder, sizeof(int) * len);
- }
- }
- }
-
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_UIList_draw_filter_func;
+
+ PointerRNA ul_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+
+ RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr);
+ func = &rna_UIList_draw_filter_func; /* RNA_struct_find_function(&ul_ptr, "draw_filter"); */
+
+ RNA_parameter_list_create(&list, &ul_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "layout", &layout);
+ ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
+
+ RNA_parameter_list_free(&list);
+}
+
+static void uilist_filter_items(uiList *ui_list,
+ bContext *C,
+ PointerRNA *dataptr,
+ const char *propname)
+{
+ extern FunctionRNA rna_UIList_filter_items_func;
+
+ PointerRNA ul_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ uiListDyn *flt_data = ui_list->dyn_data;
+ int *filter_flags, *filter_neworder;
+ void *ret1, *ret2;
+ int ret_len;
+ int len = flt_data->items_len = RNA_collection_length(dataptr, propname);
+
+ RNA_pointer_create(&CTX_wm_screen(C)->id, ui_list->type->ext.srna, ui_list, &ul_ptr);
+ func = &rna_UIList_filter_items_func; /* RNA_struct_find_function(&ul_ptr, "filter_items"); */
+
+ RNA_parameter_list_create(&list, &ul_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "data", dataptr);
+ RNA_parameter_set_lookup(&list, "property", &propname);
+
+ ui_list->type->ext.call((bContext *)C, &ul_ptr, func, &list);
+
+ parm = RNA_function_find_parameter(NULL, func, "filter_flags");
+ ret_len = RNA_parameter_dynamic_length_get(&list, parm);
+ if (ret_len != len && ret_len != 0) {
+ printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n",
+ __func__,
+ RNA_parameter_dynamic_length_get(&list, parm),
+ "filter_flags",
+ len);
+ /* Note: we cannot return here, we would let flt_data in inconsistent state... see T38356. */
+ filter_flags = NULL;
+ }
+ else {
+ RNA_parameter_get(&list, parm, &ret1);
+ filter_flags = (int *)ret1;
+ }
+
+ parm = RNA_function_find_parameter(NULL, func, "filter_neworder");
+ ret_len = RNA_parameter_dynamic_length_get(&list, parm);
+ if (ret_len != len && ret_len != 0) {
+ printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n",
+ __func__,
+ RNA_parameter_dynamic_length_get(&list, parm),
+ "filter_neworder",
+ len);
+ /* Note: we cannot return here, we would let flt_data in inconsistent state... see T38356. */
+ filter_neworder = NULL;
+ }
+ else {
+ RNA_parameter_get(&list, parm, &ret2);
+ filter_neworder = (int *)ret2;
+ }
+
+ /* We have to do some final checks and transforms... */
+ {
+ int i, filter_exclude = ui_list->filter_flag & UILST_FLT_EXCLUDE;
+ if (filter_flags) {
+ flt_data->items_filter_flags = MEM_mallocN(sizeof(int) * len, __func__);
+ memcpy(flt_data->items_filter_flags, filter_flags, sizeof(int) * len);
+
+ if (filter_neworder) {
+ /* For sake of simplicity, py filtering is expected to filter all items, but we actually only want
+ * reordering data for shown items!
+ */
+ int items_shown, shown_idx;
+ int t_idx, t_ni, prev_ni;
+ flt_data->items_shown = 0;
+ for (i = 0, shown_idx = 0; i < len; i++) {
+ if ((filter_flags[i] & UILST_FLT_ITEM) ^ filter_exclude) {
+ filter_neworder[shown_idx++] = filter_neworder[i];
+ }
+ }
+ items_shown = flt_data->items_shown = shown_idx;
+ flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * items_shown, __func__);
+ /* And now, bring back new indices into the [0, items_shown[ range!
+ * XXX This is O(N²)... :/
+ */
+ for (shown_idx = 0, prev_ni = -1; shown_idx < items_shown; shown_idx++) {
+ for (i = 0, t_ni = len, t_idx = -1; i < items_shown; i++) {
+ int ni = filter_neworder[i];
+ if (ni > prev_ni && ni < t_ni) {
+ t_idx = i;
+ t_ni = ni;
+ }
+ }
+ if (t_idx >= 0) {
+ prev_ni = t_ni;
+ flt_data->items_filter_neworder[t_idx] = shown_idx;
+ }
+ }
+ }
+ else {
+ /* we still have to set flt_data->items_shown... */
+ flt_data->items_shown = 0;
+ for (i = 0; i < len; i++) {
+ if ((filter_flags[i] & UILST_FLT_ITEM) ^ filter_exclude) {
+ flt_data->items_shown++;
+ }
+ }
+ }
+ }
+ else {
+ flt_data->items_shown = len;
+
+ if (filter_neworder) {
+ flt_data->items_filter_neworder = MEM_mallocN(sizeof(int) * len, __func__);
+ memcpy(flt_data->items_filter_neworder, filter_neworder, sizeof(int) * len);
+ }
+ }
+ }
+
+ RNA_parameter_list_free(&list);
}
static void rna_UIList_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- uiListType *ult = RNA_struct_blender_type_get(type);
+ uiListType *ult = RNA_struct_blender_type_get(type);
- if (!ult)
- return;
+ if (!ult)
+ return;
- RNA_struct_free_extension(type, &ult->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &ult->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- WM_uilisttype_freelink(ult);
+ WM_uilisttype_freelink(ult);
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
-static StructRNA *rna_UIList_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_UIList_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- uiListType *ult, dummyult = {NULL};
- uiList dummyuilist = {NULL};
- PointerRNA dummyul_ptr;
- int have_function[3];
- size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */
+ uiListType *ult, dummyult = {NULL};
+ uiList dummyuilist = {NULL};
+ PointerRNA dummyul_ptr;
+ int have_function[3];
+ size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */
- /* setup dummy menu & menu type to store static properties in */
- dummyuilist.type = &dummyult;
- RNA_pointer_create(NULL, &RNA_UIList, &dummyuilist, &dummyul_ptr);
+ /* setup dummy menu & menu type to store static properties in */
+ dummyuilist.type = &dummyult;
+ RNA_pointer_create(NULL, &RNA_UIList, &dummyuilist, &dummyul_ptr);
- /* validate the python class */
- if (validate(&dummyul_ptr, data, have_function) != 0)
- return NULL;
+ /* validate the python class */
+ if (validate(&dummyul_ptr, data, have_function) != 0)
+ return NULL;
- if (strlen(identifier) >= sizeof(dummyult.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering uilist class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyult.idname));
- return NULL;
- }
+ if (strlen(identifier) >= sizeof(dummyult.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering uilist class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummyult.idname));
+ return NULL;
+ }
- /* check if we have registered this uilist type before, and remove it */
- ult = WM_uilisttype_find(dummyult.idname, true);
- if (ult && ult->ext.srna) {
- rna_UIList_unregister(bmain, ult->ext.srna);
- }
- if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
- return NULL;
- }
- if (!RNA_struct_bl_idname_ok_or_report(reports, dummyult.idname, "_UL_")) {
- return NULL;
- }
+ /* check if we have registered this uilist type before, and remove it */
+ ult = WM_uilisttype_find(dummyult.idname, true);
+ if (ult && ult->ext.srna) {
+ rna_UIList_unregister(bmain, ult->ext.srna);
+ }
+ if (!RNA_struct_available_or_report(reports, dummyult.idname)) {
+ return NULL;
+ }
+ if (!RNA_struct_bl_idname_ok_or_report(reports, dummyult.idname, "_UL_")) {
+ return NULL;
+ }
- /* create a new menu type */
- ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist");
- memcpy(ult, &dummyult, sizeof(dummyult));
+ /* create a new menu type */
+ ult = MEM_callocN(sizeof(uiListType) + over_alloc, "python uilist");
+ memcpy(ult, &dummyult, sizeof(dummyult));
- ult->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ult->idname, &RNA_UIList);
- ult->ext.data = data;
- ult->ext.call = call;
- ult->ext.free = free;
- RNA_struct_blender_type_set(ult->ext.srna, ult);
+ ult->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ult->idname, &RNA_UIList);
+ ult->ext.data = data;
+ ult->ext.call = call;
+ ult->ext.free = free;
+ RNA_struct_blender_type_set(ult->ext.srna, ult);
- ult->draw_item = (have_function[0]) ? uilist_draw_item : NULL;
- ult->draw_filter = (have_function[1]) ? uilist_draw_filter : NULL;
- ult->filter_items = (have_function[2]) ? uilist_filter_items : NULL;
+ ult->draw_item = (have_function[0]) ? uilist_draw_item : NULL;
+ ult->draw_filter = (have_function[1]) ? uilist_draw_filter : NULL;
+ ult->filter_items = (have_function[2]) ? uilist_filter_items : NULL;
- WM_uilisttype_add(ult);
+ WM_uilisttype_add(ult);
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
- return ult->ext.srna;
+ return ult->ext.srna;
}
static StructRNA *rna_UIList_refine(PointerRNA *ptr)
{
- uiList *ui_list = (uiList *)ptr->data;
- return (ui_list->type && ui_list->type->ext.srna) ? ui_list->type->ext.srna : &RNA_UIList;
+ uiList *ui_list = (uiList *)ptr->data;
+ return (ui_list->type && ui_list->type->ext.srna) ? ui_list->type->ext.srna : &RNA_UIList;
}
/* Header */
static void header_draw(const bContext *C, Header *hdr)
{
- extern FunctionRNA rna_Header_draw_func;
+ extern FunctionRNA rna_Header_draw_func;
- PointerRNA htr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA htr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr);
- func = &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */
+ RNA_pointer_create(&CTX_wm_screen(C)->id, hdr->type->ext.srna, hdr, &htr);
+ func = &rna_Header_draw_func; /* RNA_struct_find_function(&htr, "draw"); */
- RNA_parameter_list_create(&list, &htr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- hdr->type->ext.call((bContext *)C, &htr, func, &list);
+ RNA_parameter_list_create(&list, &htr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ hdr->type->ext.call((bContext *)C, &htr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Header_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- ARegionType *art;
- HeaderType *ht = RNA_struct_blender_type_get(type);
-
- if (!ht)
- return;
- if (!(art = region_type_find(NULL, ht->space_type, ht->region_type)))
- return;
-
- RNA_struct_free_extension(type, &ht->ext);
- RNA_struct_free(&BLENDER_RNA, type);
-
- BLI_freelinkN(&art->headertypes, ht);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
-}
-
-static StructRNA *rna_Header_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- ARegionType *art;
- HeaderType *ht, dummyht = {NULL};
- Header dummyheader = {NULL};
- PointerRNA dummyhtr;
- int have_function[1];
-
- /* setup dummy header & header type to store static properties in */
- dummyheader.type = &dummyht;
- dummyht.region_type = RGN_TYPE_HEADER; /* RGN_TYPE_HEADER by default, may be overridden */
- RNA_pointer_create(NULL, &RNA_Header, &dummyheader, &dummyhtr);
-
- /* validate the python class */
- if (validate(&dummyhtr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummyht.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering header class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyht.idname));
- return NULL;
- }
-
- if (!(art = region_type_find(reports, dummyht.space_type, dummyht.region_type)))
- return NULL;
-
- /* check if we have registered this header type before, and remove it */
- for (ht = art->headertypes.first; ht; ht = ht->next) {
- if (STREQ(ht->idname, dummyht.idname)) {
- if (ht->ext.srna)
- rna_Header_unregister(bmain, ht->ext.srna);
- break;
- }
- }
- if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
- return NULL;
- }
- if (!RNA_struct_bl_idname_ok_or_report(reports, dummyht.idname, "_HT_")) {
- return NULL;
- }
-
- /* create a new header type */
- ht = MEM_callocN(sizeof(HeaderType), "python buttons header");
- memcpy(ht, &dummyht, sizeof(dummyht));
-
- ht->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ht->idname, &RNA_Header);
- ht->ext.data = data;
- ht->ext.call = call;
- ht->ext.free = free;
- RNA_struct_blender_type_set(ht->ext.srna, ht);
-
- ht->draw = (have_function[0]) ? header_draw : NULL;
-
- BLI_addtail(&art->headertypes, ht);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
-
- return ht->ext.srna;
+ ARegionType *art;
+ HeaderType *ht = RNA_struct_blender_type_get(type);
+
+ if (!ht)
+ return;
+ if (!(art = region_type_find(NULL, ht->space_type, ht->region_type)))
+ return;
+
+ RNA_struct_free_extension(type, &ht->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
+
+ BLI_freelinkN(&art->headertypes, ht);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+}
+
+static StructRNA *rna_Header_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ ARegionType *art;
+ HeaderType *ht, dummyht = {NULL};
+ Header dummyheader = {NULL};
+ PointerRNA dummyhtr;
+ int have_function[1];
+
+ /* setup dummy header & header type to store static properties in */
+ dummyheader.type = &dummyht;
+ dummyht.region_type = RGN_TYPE_HEADER; /* RGN_TYPE_HEADER by default, may be overridden */
+ RNA_pointer_create(NULL, &RNA_Header, &dummyheader, &dummyhtr);
+
+ /* validate the python class */
+ if (validate(&dummyhtr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummyht.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering header class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummyht.idname));
+ return NULL;
+ }
+
+ if (!(art = region_type_find(reports, dummyht.space_type, dummyht.region_type)))
+ return NULL;
+
+ /* check if we have registered this header type before, and remove it */
+ for (ht = art->headertypes.first; ht; ht = ht->next) {
+ if (STREQ(ht->idname, dummyht.idname)) {
+ if (ht->ext.srna)
+ rna_Header_unregister(bmain, ht->ext.srna);
+ break;
+ }
+ }
+ if (!RNA_struct_available_or_report(reports, dummyht.idname)) {
+ return NULL;
+ }
+ if (!RNA_struct_bl_idname_ok_or_report(reports, dummyht.idname, "_HT_")) {
+ return NULL;
+ }
+
+ /* create a new header type */
+ ht = MEM_callocN(sizeof(HeaderType), "python buttons header");
+ memcpy(ht, &dummyht, sizeof(dummyht));
+
+ ht->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, ht->idname, &RNA_Header);
+ ht->ext.data = data;
+ ht->ext.call = call;
+ ht->ext.free = free;
+ RNA_struct_blender_type_set(ht->ext.srna, ht);
+
+ ht->draw = (have_function[0]) ? header_draw : NULL;
+
+ BLI_addtail(&art->headertypes, ht);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+
+ return ht->ext.srna;
}
static StructRNA *rna_Header_refine(PointerRNA *htr)
{
- Header *hdr = (Header *)htr->data;
- return (hdr->type && hdr->type->ext.srna) ? hdr->type->ext.srna : &RNA_Header;
+ Header *hdr = (Header *)htr->data;
+ return (hdr->type && hdr->type->ext.srna) ? hdr->type->ext.srna : &RNA_Header;
}
/* Menu */
static bool menu_poll(const bContext *C, MenuType *pt)
{
- extern FunctionRNA rna_Menu_poll_func;
+ extern FunctionRNA rna_Menu_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, pt->ext.srna, NULL, &ptr); /* dummy */
+ func = &rna_Menu_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- pt->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ pt->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static void menu_draw(const bContext *C, Menu *menu)
{
- extern FunctionRNA rna_Menu_draw_func;
+ extern FunctionRNA rna_Menu_draw_func;
- PointerRNA mtr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA mtr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(&CTX_wm_screen(C)->id, menu->type->ext.srna, menu, &mtr);
- func = &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */
+ RNA_pointer_create(&CTX_wm_screen(C)->id, menu->type->ext.srna, menu, &mtr);
+ func = &rna_Menu_draw_func; /* RNA_struct_find_function(&mtr, "draw"); */
- RNA_parameter_list_create(&list, &mtr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- menu->type->ext.call((bContext *)C, &mtr, func, &list);
+ RNA_parameter_list_create(&list, &mtr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ menu->type->ext.call((bContext *)C, &mtr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Menu_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- MenuType *mt = RNA_struct_blender_type_get(type);
-
- if (!mt)
- return;
-
- RNA_struct_free_extension(type, &mt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
-
- WM_menutype_freelink(mt);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
-}
-
-static StructRNA *rna_Menu_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- MenuType *mt, dummymt = {NULL};
- Menu dummymenu = {NULL};
- PointerRNA dummymtr;
- int have_function[2];
- size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */
- size_t description_size = 0;
- char _menu_descr[RNA_DYN_DESCR_MAX];
-
- /* setup dummy menu & menu type to store static properties in */
- dummymenu.type = &dummymt;
- _menu_descr[0] = '\0';
- dummymenu.type->description = _menu_descr;
- RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr);
-
- /* We have to set default context! Else we get a void string... */
- strcpy(dummymt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
-
- /* validate the python class */
- if (validate(&dummymtr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummymt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering menu class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummymt.idname));
- return NULL;
- }
-
- /* check if we have registered this menu type before, and remove it */
- mt = WM_menutype_find(dummymt.idname, true);
- if (mt && mt->ext.srna) {
- rna_Menu_unregister(bmain, mt->ext.srna);
- }
- if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
- return NULL;
- }
- if (!RNA_struct_bl_idname_ok_or_report(reports, dummymt.idname, "_MT_")) {
- return NULL;
- }
-
- /* create a new menu type */
- if (_menu_descr[0]) {
- description_size = strlen(_menu_descr) + 1;
- over_alloc += description_size;
- }
-
- mt = MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu");
- memcpy(mt, &dummymt, sizeof(dummymt));
-
- if (_menu_descr[0]) {
- char *buf = (char *)(mt + 1);
- memcpy(buf, _menu_descr, description_size);
- mt->description = buf;
- }
- else {
- mt->description = NULL;
- }
-
- mt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, mt->idname, &RNA_Menu);
- RNA_def_struct_translation_context(mt->ext.srna, mt->translation_context);
- mt->ext.data = data;
- mt->ext.call = call;
- mt->ext.free = free;
- RNA_struct_blender_type_set(mt->ext.srna, mt);
- RNA_def_struct_flag(mt->ext.srna, STRUCT_NO_IDPROPERTIES);
-
- mt->poll = (have_function[0]) ? menu_poll : NULL;
- mt->draw = (have_function[1]) ? menu_draw : NULL;
-
- {
- const char *owner_id = RNA_struct_state_owner_get();
- if (owner_id) {
- BLI_strncpy(mt->owner_id, owner_id, sizeof(mt->owner_id));
- }
- }
-
- WM_menutype_add(mt);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
-
- return mt->ext.srna;
+ MenuType *mt = RNA_struct_blender_type_get(type);
+
+ if (!mt)
+ return;
+
+ RNA_struct_free_extension(type, &mt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
+
+ WM_menutype_freelink(mt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+}
+
+static StructRNA *rna_Menu_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ MenuType *mt, dummymt = {NULL};
+ Menu dummymenu = {NULL};
+ PointerRNA dummymtr;
+ int have_function[2];
+ size_t over_alloc = 0; /* warning, if this becomes a bess, we better do another alloc */
+ size_t description_size = 0;
+ char _menu_descr[RNA_DYN_DESCR_MAX];
+
+ /* setup dummy menu & menu type to store static properties in */
+ dummymenu.type = &dummymt;
+ _menu_descr[0] = '\0';
+ dummymenu.type->description = _menu_descr;
+ RNA_pointer_create(NULL, &RNA_Menu, &dummymenu, &dummymtr);
+
+ /* We have to set default context! Else we get a void string... */
+ strcpy(dummymt.translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+
+ /* validate the python class */
+ if (validate(&dummymtr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummymt.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering menu class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummymt.idname));
+ return NULL;
+ }
+
+ /* check if we have registered this menu type before, and remove it */
+ mt = WM_menutype_find(dummymt.idname, true);
+ if (mt && mt->ext.srna) {
+ rna_Menu_unregister(bmain, mt->ext.srna);
+ }
+ if (!RNA_struct_available_or_report(reports, dummymt.idname)) {
+ return NULL;
+ }
+ if (!RNA_struct_bl_idname_ok_or_report(reports, dummymt.idname, "_MT_")) {
+ return NULL;
+ }
+
+ /* create a new menu type */
+ if (_menu_descr[0]) {
+ description_size = strlen(_menu_descr) + 1;
+ over_alloc += description_size;
+ }
+
+ mt = MEM_callocN(sizeof(MenuType) + over_alloc, "python buttons menu");
+ memcpy(mt, &dummymt, sizeof(dummymt));
+
+ if (_menu_descr[0]) {
+ char *buf = (char *)(mt + 1);
+ memcpy(buf, _menu_descr, description_size);
+ mt->description = buf;
+ }
+ else {
+ mt->description = NULL;
+ }
+
+ mt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, mt->idname, &RNA_Menu);
+ RNA_def_struct_translation_context(mt->ext.srna, mt->translation_context);
+ mt->ext.data = data;
+ mt->ext.call = call;
+ mt->ext.free = free;
+ RNA_struct_blender_type_set(mt->ext.srna, mt);
+ RNA_def_struct_flag(mt->ext.srna, STRUCT_NO_IDPROPERTIES);
+
+ mt->poll = (have_function[0]) ? menu_poll : NULL;
+ mt->draw = (have_function[1]) ? menu_draw : NULL;
+
+ {
+ const char *owner_id = RNA_struct_state_owner_get();
+ if (owner_id) {
+ BLI_strncpy(mt->owner_id, owner_id, sizeof(mt->owner_id));
+ }
+ }
+
+ WM_menutype_add(mt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+
+ return mt->ext.srna;
}
static StructRNA *rna_Menu_refine(PointerRNA *mtr)
{
- Menu *menu = (Menu *)mtr->data;
- return (menu->type && menu->type->ext.srna) ? menu->type->ext.srna : &RNA_Menu;
+ Menu *menu = (Menu *)mtr->data;
+ return (menu->type && menu->type->ext.srna) ? menu->type->ext.srna : &RNA_Menu;
}
static void rna_Menu_bl_description_set(PointerRNA *ptr, const char *value)
{
- Menu *data = (Menu *)(ptr->data);
- char *str = (char *)data->type->description;
- if (!str[0]) BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
- else assert(!"setting the bl_description on a non-builtin menu");
+ Menu *data = (Menu *)(ptr->data);
+ char *str = (char *)data->type->description;
+ if (!str[0])
+ BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_description on a non-builtin menu");
}
/* UILayout */
static bool rna_UILayout_active_get(PointerRNA *ptr)
{
- return uiLayoutGetActive(ptr->data);
+ return uiLayoutGetActive(ptr->data);
}
static void rna_UILayout_active_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetActive(ptr->data, value);
+ uiLayoutSetActive(ptr->data, value);
}
static bool rna_UILayout_active_default_get(PointerRNA *ptr)
{
- return uiLayoutGetActiveDefault(ptr->data);
+ return uiLayoutGetActiveDefault(ptr->data);
}
static void rna_UILayout_active_default_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetActiveDefault(ptr->data, value);
+ uiLayoutSetActiveDefault(ptr->data, value);
}
static bool rna_UILayout_activate_init_get(PointerRNA *ptr)
{
- return uiLayoutGetActivateInit(ptr->data);
+ return uiLayoutGetActivateInit(ptr->data);
}
static void rna_UILayout_activate_init_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetActivateInit(ptr->data, value);
+ uiLayoutSetActivateInit(ptr->data, value);
}
static bool rna_UILayout_alert_get(PointerRNA *ptr)
{
- return uiLayoutGetRedAlert(ptr->data);
+ return uiLayoutGetRedAlert(ptr->data);
}
static void rna_UILayout_alert_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetRedAlert(ptr->data, value);
+ uiLayoutSetRedAlert(ptr->data, value);
}
static void rna_UILayout_op_context_set(PointerRNA *ptr, int value)
{
- uiLayoutSetOperatorContext(ptr->data, value);
+ uiLayoutSetOperatorContext(ptr->data, value);
}
static int rna_UILayout_op_context_get(PointerRNA *ptr)
{
- return uiLayoutGetOperatorContext(ptr->data);
+ return uiLayoutGetOperatorContext(ptr->data);
}
static bool rna_UILayout_enabled_get(PointerRNA *ptr)
{
- return uiLayoutGetEnabled(ptr->data);
+ return uiLayoutGetEnabled(ptr->data);
}
static void rna_UILayout_enabled_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetEnabled(ptr->data, value);
+ uiLayoutSetEnabled(ptr->data, value);
}
-#if 0
+# if 0
static int rna_UILayout_red_alert_get(PointerRNA *ptr)
{
- return uiLayoutGetRedAlert(ptr->data);
+ return uiLayoutGetRedAlert(ptr->data);
}
static void rna_UILayout_red_alert_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetRedAlert(ptr->data, value);
+ uiLayoutSetRedAlert(ptr->data, value);
}
static bool rna_UILayout_keep_aspect_get(PointerRNA *ptr)
{
- return uiLayoutGetKeepAspect(ptr->data);
+ return uiLayoutGetKeepAspect(ptr->data);
}
static void rna_UILayout_keep_aspect_set(PointerRNA *ptr, int value)
{
- uiLayoutSetKeepAspect(ptr->data, value);
+ uiLayoutSetKeepAspect(ptr->data, value);
}
-#endif
+# endif
static int rna_UILayout_alignment_get(PointerRNA *ptr)
{
- return uiLayoutGetAlignment(ptr->data);
+ return uiLayoutGetAlignment(ptr->data);
}
static void rna_UILayout_alignment_set(PointerRNA *ptr, int value)
{
- uiLayoutSetAlignment(ptr->data, value);
+ uiLayoutSetAlignment(ptr->data, value);
}
static int rna_UILayout_direction_get(PointerRNA *ptr)
{
- return uiLayoutGetLocalDir(ptr->data);
+ return uiLayoutGetLocalDir(ptr->data);
}
static float rna_UILayout_scale_x_get(PointerRNA *ptr)
{
- return uiLayoutGetScaleX(ptr->data);
+ return uiLayoutGetScaleX(ptr->data);
}
static void rna_UILayout_scale_x_set(PointerRNA *ptr, float value)
{
- uiLayoutSetScaleX(ptr->data, value);
+ uiLayoutSetScaleX(ptr->data, value);
}
static float rna_UILayout_scale_y_get(PointerRNA *ptr)
{
- return uiLayoutGetScaleY(ptr->data);
+ return uiLayoutGetScaleY(ptr->data);
}
static void rna_UILayout_scale_y_set(PointerRNA *ptr, float value)
{
- uiLayoutSetScaleY(ptr->data, value);
+ uiLayoutSetScaleY(ptr->data, value);
}
static float rna_UILayout_units_x_get(PointerRNA *ptr)
{
- return uiLayoutGetUnitsX(ptr->data);
+ return uiLayoutGetUnitsX(ptr->data);
}
static void rna_UILayout_units_x_set(PointerRNA *ptr, float value)
{
- uiLayoutSetUnitsX(ptr->data, value);
+ uiLayoutSetUnitsX(ptr->data, value);
}
static float rna_UILayout_units_y_get(PointerRNA *ptr)
{
- return uiLayoutGetUnitsY(ptr->data);
+ return uiLayoutGetUnitsY(ptr->data);
}
static void rna_UILayout_units_y_set(PointerRNA *ptr, float value)
{
- uiLayoutSetUnitsY(ptr->data, value);
+ uiLayoutSetUnitsY(ptr->data, value);
}
static int rna_UILayout_emboss_get(PointerRNA *ptr)
{
- return uiLayoutGetEmboss(ptr->data);
+ return uiLayoutGetEmboss(ptr->data);
}
static void rna_UILayout_emboss_set(PointerRNA *ptr, int value)
{
- uiLayoutSetEmboss(ptr->data, value);
+ uiLayoutSetEmboss(ptr->data, value);
}
static bool rna_UILayout_property_split_get(PointerRNA *ptr)
{
- return uiLayoutGetPropSep(ptr->data);
+ return uiLayoutGetPropSep(ptr->data);
}
static void rna_UILayout_property_split_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetPropSep(ptr->data, value);
+ uiLayoutSetPropSep(ptr->data, value);
}
static bool rna_UILayout_property_decorate_get(PointerRNA *ptr)
{
- return uiLayoutGetPropDecorate(ptr->data);
+ return uiLayoutGetPropDecorate(ptr->data);
}
static void rna_UILayout_property_decorate_set(PointerRNA *ptr, bool value)
{
- uiLayoutSetPropDecorate(ptr->data, value);
+ uiLayoutSetPropDecorate(ptr->data, value);
}
#else /* RNA_RUNTIME */
static void rna_def_ui_layout(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem alignment_items[] = {
- {UI_LAYOUT_ALIGN_EXPAND, "EXPAND", 0, "Expand", ""},
- {UI_LAYOUT_ALIGN_LEFT, "LEFT", 0, "Left", ""},
- {UI_LAYOUT_ALIGN_CENTER, "CENTER", 0, "Center", ""},
- {UI_LAYOUT_ALIGN_RIGHT, "RIGHT", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem direction_items[] = {
- {UI_LAYOUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
- {UI_LAYOUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem emboss_items[] = {
- {UI_EMBOSS, "NORMAL", 0, "Regular", "Draw standard button emboss style"},
- {UI_EMBOSS_NONE, "NONE", 0, "None", "Draw only text and icons"},
- {UI_EMBOSS_PULLDOWN, "PULLDOWN_MENU", 0, "Pulldown Menu", "Draw pulldown menu style"},
- {UI_EMBOSS_RADIAL, "RADIAL_MENU", 0, "Radial Menu", "Draw radial menu style"},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* layout */
-
- srna = RNA_def_struct(brna, "UILayout", NULL);
- RNA_def_struct_sdna(srna, "uiLayout");
- RNA_def_struct_ui_text(srna, "UI Layout", "User interface layout in a panel or header");
-
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set");
-
- prop = RNA_def_property(srna, "active_default", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_default_get", "rna_UILayout_active_default_set");
- RNA_def_property_ui_text(
- prop, "Active Default",
- "When true, an operator button defined after this will be activated when pressing return"
- "(use with popup dialogs)");
-
- prop = RNA_def_property(srna, "activate_init", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_activate_init_get", "rna_UILayout_activate_init_set");
- RNA_def_property_ui_text(
- prop, "Activate on Init",
- "When true, buttons defined in popups will be activated on first display "
- "(use so you can type into a field without having to click on it first)");
-
- prop = RNA_def_property(srna, "operator_context", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_operator_context_items);
- RNA_def_property_enum_funcs(prop, "rna_UILayout_op_context_get", "rna_UILayout_op_context_set", NULL);
-
- prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set");
- RNA_def_property_ui_text(prop, "Enabled", "When false, this (sub)layout is grayed out");
-
- prop = RNA_def_property(srna, "alert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_alert_get", "rna_UILayout_alert_set");
-
- prop = RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, alignment_items);
- RNA_def_property_enum_funcs(prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL);
-
- prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, direction_items);
- RNA_def_property_enum_funcs(prop, "rna_UILayout_direction_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
-#if 0
- prop = RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set");
-#endif
-
- prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_funcs(prop, "rna_UILayout_scale_x_get", "rna_UILayout_scale_x_set", NULL);
- RNA_def_property_ui_text(prop, "Scale X", "Scale factor along the X for items in this (sub)layout");
-
- prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL);
- RNA_def_property_ui_text(prop, "Scale Y", "Scale factor along the Y for items in this (sub)layout");
-
- prop = RNA_def_property(srna, "ui_units_x", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_funcs(prop, "rna_UILayout_units_x_get", "rna_UILayout_units_x_set", NULL);
- RNA_def_property_ui_text(prop, "Units X", "Fixed Size along the X for items in this (sub)layout");
-
- prop = RNA_def_property(srna, "ui_units_y", PROP_FLOAT, PROP_UNSIGNED);
- RNA_def_property_float_funcs(prop, "rna_UILayout_units_y_get", "rna_UILayout_units_y_set", NULL);
- RNA_def_property_ui_text(prop, "Units Y", "Fixed Size along the Y for items in this (sub)layout");
- RNA_api_ui_layout(srna);
-
- prop = RNA_def_property(srna, "emboss", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, emboss_items);
- RNA_def_property_enum_funcs(prop, "rna_UILayout_emboss_get", "rna_UILayout_emboss_set", NULL);
-
- prop = RNA_def_property(srna, "use_property_split", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_property_split_get", "rna_UILayout_property_split_set");
-
- prop = RNA_def_property(srna, "use_property_decorate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UILayout_property_decorate_get", "rna_UILayout_property_decorate_set");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem alignment_items[] = {
+ {UI_LAYOUT_ALIGN_EXPAND, "EXPAND", 0, "Expand", ""},
+ {UI_LAYOUT_ALIGN_LEFT, "LEFT", 0, "Left", ""},
+ {UI_LAYOUT_ALIGN_CENTER, "CENTER", 0, "Center", ""},
+ {UI_LAYOUT_ALIGN_RIGHT, "RIGHT", 0, "Right", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem direction_items[] = {
+ {UI_LAYOUT_HORIZONTAL, "HORIZONTAL", 0, "Horizontal", ""},
+ {UI_LAYOUT_VERTICAL, "VERTICAL", 0, "Vertical", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem emboss_items[] = {
+ {UI_EMBOSS, "NORMAL", 0, "Regular", "Draw standard button emboss style"},
+ {UI_EMBOSS_NONE, "NONE", 0, "None", "Draw only text and icons"},
+ {UI_EMBOSS_PULLDOWN, "PULLDOWN_MENU", 0, "Pulldown Menu", "Draw pulldown menu style"},
+ {UI_EMBOSS_RADIAL, "RADIAL_MENU", 0, "Radial Menu", "Draw radial menu style"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* layout */
+
+ srna = RNA_def_struct(brna, "UILayout", NULL);
+ RNA_def_struct_sdna(srna, "uiLayout");
+ RNA_def_struct_ui_text(srna, "UI Layout", "User interface layout in a panel or header");
+
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_UILayout_active_get", "rna_UILayout_active_set");
+
+ prop = RNA_def_property(srna, "active_default", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_UILayout_active_default_get", "rna_UILayout_active_default_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Active Default",
+ "When true, an operator button defined after this will be activated when pressing return"
+ "(use with popup dialogs)");
+
+ prop = RNA_def_property(srna, "activate_init", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_UILayout_activate_init_get", "rna_UILayout_activate_init_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Activate on Init",
+ "When true, buttons defined in popups will be activated on first display "
+ "(use so you can type into a field without having to click on it first)");
+
+ prop = RNA_def_property(srna, "operator_context", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_operator_context_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_UILayout_op_context_get", "rna_UILayout_op_context_set", NULL);
+
+ prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_UILayout_enabled_get", "rna_UILayout_enabled_set");
+ RNA_def_property_ui_text(prop, "Enabled", "When false, this (sub)layout is grayed out");
+
+ prop = RNA_def_property(srna, "alert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_UILayout_alert_get", "rna_UILayout_alert_set");
+
+ prop = RNA_def_property(srna, "alignment", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, alignment_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_UILayout_alignment_get", "rna_UILayout_alignment_set", NULL);
+
+ prop = RNA_def_property(srna, "direction", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, direction_items);
+ RNA_def_property_enum_funcs(prop, "rna_UILayout_direction_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+# if 0
+ prop = RNA_def_property(srna, "keep_aspect", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_UILayout_keep_aspect_get", "rna_UILayout_keep_aspect_set");
+# endif
+
+ prop = RNA_def_property(srna, "scale_x", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_scale_x_get", "rna_UILayout_scale_x_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Scale X", "Scale factor along the X for items in this (sub)layout");
+
+ prop = RNA_def_property(srna, "scale_y", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_scale_y_get", "rna_UILayout_scale_y_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Scale Y", "Scale factor along the Y for items in this (sub)layout");
+
+ prop = RNA_def_property(srna, "ui_units_x", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_units_x_get", "rna_UILayout_units_x_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Units X", "Fixed Size along the X for items in this (sub)layout");
+
+ prop = RNA_def_property(srna, "ui_units_y", PROP_FLOAT, PROP_UNSIGNED);
+ RNA_def_property_float_funcs(prop, "rna_UILayout_units_y_get", "rna_UILayout_units_y_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Units Y", "Fixed Size along the Y for items in this (sub)layout");
+ RNA_api_ui_layout(srna);
+
+ prop = RNA_def_property(srna, "emboss", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, emboss_items);
+ RNA_def_property_enum_funcs(prop, "rna_UILayout_emboss_get", "rna_UILayout_emboss_set", NULL);
+
+ prop = RNA_def_property(srna, "use_property_split", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_UILayout_property_split_get", "rna_UILayout_property_split_set");
+
+ prop = RNA_def_property(srna, "use_property_decorate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_UILayout_property_decorate_get", "rna_UILayout_property_decorate_set");
}
static void rna_def_panel(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- static const EnumPropertyItem panel_flag_items[] = {
- {PNL_DEFAULT_CLOSED, "DEFAULT_CLOSED", 0, "Default Closed",
- "Defines if the panel has to be open or collapsed at the time of its creation"},
- {PNL_NO_HEADER, "HIDE_HEADER", 0, "Hide Header",
- "If set to False, the panel shows a header, which contains a clickable "
- "arrow to collapse the panel and the label (see bl_label)"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Panel", NULL);
- RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements");
- RNA_def_struct_sdna(srna, "Panel");
- RNA_def_struct_refine_func(srna, "rna_Panel_refine");
- RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
- RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "If this method returns a non-null output, then the panel can be drawn");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* draw */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_header", NULL);
- RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_header_preset", NULL);
- RNA_def_function_ui_description(func, "Draw UI elements for presets in the panel's header");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "UILayout");
- RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the panel in the UI");
-
- prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "drawname");
- RNA_def_property_ui_text(prop, "Text", "XXX todo");
-
- /* registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name",
- "If this is set, the panel gets a custom ID, otherwise it takes the "
- "name of the class used to define the panel. For example, if the "
- "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the "
- "script, then bl_idname = \"OBJECT_PT_hello\"");
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->label");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Label",
- "The panel label, shows up in the panel header at the right of the "
- "triangle used to collapse the panel");
-
- prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
- RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_define_verify_sdna(true);
-
- prop = RNA_def_property(srna, "bl_category", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->category");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->owner_id");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in");
-
- prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
- RNA_def_property_enum_items(prop, rna_enum_region_type_items);
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Region Type", "The region where the panel is going to be used in");
-
- prop = RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->context");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); /* Only used in Properties Editor and 3D View - Thomas */
- RNA_def_property_ui_text(prop, "Context",
- "The context in which the panel belongs to. (TODO: explain the "
- "possible combinations bl_context/bl_region_type/bl_space_type)");
-
- prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->flag");
- RNA_def_property_enum_items(prop, panel_flag_items);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Options", "Options for this panel type");
-
- prop = RNA_def_property(srna, "bl_parent_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->parent_id");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Parent ID Name", "If this is set, the panel becomes a sub-panel");
-
- prop = RNA_def_property(srna, "bl_ui_units_x", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "type->ui_units_x");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Units X", "When set, defines popup panel width");
-
- prop = RNA_def_property(srna, "use_pin", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PNL_PIN);
- RNA_def_property_ui_text(prop, "Pin", "");
- /* XXX, should only tag region for redraw */
- RNA_def_property_update(prop, NC_WINDOW, NULL);
-
- prop = RNA_def_property(srna, "is_popover", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", PNL_POPOVER);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Popover", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ static const EnumPropertyItem panel_flag_items[] = {
+ {PNL_DEFAULT_CLOSED,
+ "DEFAULT_CLOSED",
+ 0,
+ "Default Closed",
+ "Defines if the panel has to be open or collapsed at the time of its creation"},
+ {PNL_NO_HEADER,
+ "HIDE_HEADER",
+ 0,
+ "Hide Header",
+ "If set to False, the panel shows a header, which contains a clickable "
+ "arrow to collapse the panel and the label (see bl_label)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Panel", NULL);
+ RNA_def_struct_ui_text(srna, "Panel", "Panel containing UI elements");
+ RNA_def_struct_sdna(srna, "Panel");
+ RNA_def_struct_refine_func(srna, "rna_Panel_refine");
+ RNA_def_struct_register_funcs(srna, "rna_Panel_register", "rna_Panel_unregister", NULL);
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(
+ func, "If this method returns a non-null output, then the panel can be drawn");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* draw */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw UI elements into the panel UI layout");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_header", NULL);
+ RNA_def_function_ui_description(func, "Draw UI elements into the panel's header UI layout");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_header_preset", NULL);
+ RNA_def_function_ui_description(func, "Draw UI elements for presets in the panel's header");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "UILayout");
+ RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the panel in the UI");
+
+ prop = RNA_def_property(srna, "text", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "drawname");
+ RNA_def_property_ui_text(prop, "Text", "XXX todo");
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop,
+ "ID Name",
+ "If this is set, the panel gets a custom ID, otherwise it takes the "
+ "name of the class used to define the panel. For example, if the "
+ "class name is \"OBJECT_PT_hello\", and bl_idname is not set by the "
+ "script, then bl_idname = \"OBJECT_PT_hello\"");
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->label");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop,
+ "Label",
+ "The panel label, shows up in the panel header at the right of the "
+ "triangle used to collapse the panel");
+
+ prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
+ RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_define_verify_sdna(true);
+
+ prop = RNA_def_property(srna, "bl_category", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->category");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->owner_id");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in");
+
+ prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
+ RNA_def_property_enum_items(prop, rna_enum_region_type_items);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(
+ prop, "Region Type", "The region where the panel is going to be used in");
+
+ prop = RNA_def_property(srna, "bl_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->context");
+ RNA_def_property_flag(
+ prop, PROP_REGISTER_OPTIONAL); /* Only used in Properties Editor and 3D View - Thomas */
+ RNA_def_property_ui_text(prop,
+ "Context",
+ "The context in which the panel belongs to. (TODO: explain the "
+ "possible combinations bl_context/bl_region_type/bl_space_type)");
+
+ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->flag");
+ RNA_def_property_enum_items(prop, panel_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Options for this panel type");
+
+ prop = RNA_def_property(srna, "bl_parent_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->parent_id");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_ui_text(
+ prop, "Parent ID Name", "If this is set, the panel becomes a sub-panel");
+
+ prop = RNA_def_property(srna, "bl_ui_units_x", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "type->ui_units_x");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_ui_text(prop, "Units X", "When set, defines popup panel width");
+
+ prop = RNA_def_property(srna, "use_pin", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PNL_PIN);
+ RNA_def_property_ui_text(prop, "Pin", "");
+ /* XXX, should only tag region for redraw */
+ RNA_def_property_update(prop, NC_WINDOW, NULL);
+
+ prop = RNA_def_property(srna, "is_popover", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", PNL_POPOVER);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Popover", "");
}
static void rna_def_uilist(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "UIList", NULL);
- RNA_def_struct_ui_text(srna, "UIList", "UI list containing the elements of a collection");
- RNA_def_struct_sdna(srna, "uiList");
- RNA_def_struct_refine_func(srna, "rna_UIList_refine");
- RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL);
- RNA_def_struct_idprops_func(srna, "rna_UIList_idprops");
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT);
-
- /* Registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name",
- "If this is set, the uilist gets a custom ID, otherwise it takes the "
- "name of the class used to define the uilist (for example, if the "
- "class name is \"OBJECT_UL_vgroups\", and bl_idname is not set by the "
- "script, then bl_idname = \"OBJECT_UL_vgroups\")");
-
- /* Data */
- prop = RNA_def_property(srna, "layout_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_uilist_layout_type_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- /* Filter options */
- prop = RNA_def_property(srna, "use_filter_show", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_SHOW);
- RNA_def_property_ui_text(prop, "Show Filter", "Show filtering options");
-
- prop = RNA_def_property(srna, "filter_name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "filter_byname");
- RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
- RNA_def_property_ui_text(prop, "Filter by Name", "Only show items matching this name (use '*' as wildcard)");
-
- prop = RNA_def_property(srna, "use_filter_invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE);
- RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)");
-
- /* WARNING: This is sort of an abuse, sort-by-alpha is actually a value, should even be an enum in full logic
- * (of two values, sort by index and sort by name).
- * But for default UIList, it's nicer (better UI-wise) to show this as a boolean bit-flag option,
- * avoids having to define custom setters/getters using UILST_FLT_SORT_MASK to mask out
- * actual bitflags on same var, etc.
- */
- prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA);
- RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
- RNA_def_property_ui_text(prop, "Sort by Name", "Sort items by their name");
-
- prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_REVERSE);
- RNA_def_property_ui_text(prop, "Reverse", "Reverse the order of shown items");
-
- prop = RNA_def_property(srna, "use_filter_sort_lock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_LOCK);
- RNA_def_property_ui_text(prop, "Lock Order", "Lock the order of shown items (user cannot change it)");
-
- /* draw_item */
- func = RNA_def_function(srna, "draw_item", NULL);
- RNA_def_function_ui_description(func, "Draw an item in the list (NOTE: when you define your own draw_item "
- "function, you may want to check given 'item' is of the right type...)");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_int(func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "active_data", "AnyType", "",
- "Data from which to take property for the active element");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "active_property", NULL, 0, "",
- "Identifier of property in active_data, for the active element");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL);
- prop = RNA_def_property(func, "flt_flag", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "", "The filter-flag result for this item");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL);
-
- /* draw_filter */
- func = RNA_def_function(srna, "draw_filter", NULL);
- RNA_def_function_ui_description(func, "Draw filtering options");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* filter */
- func = RNA_def_function(srna, "filter_items", NULL);
- RNA_def_function_ui_description(func, "Filter and/or re-order items of the collection (output filter results in "
- "filter_flags, and reorder results in filter_neworder arrays)");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take Collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data, for the collection");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- prop = RNA_def_property(func, "filter_flags", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC);
- RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */
- RNA_def_property_ui_text(prop, "", "An array of filter flags, one for each item in the collection (NOTE: "
- "FILTER_ITEM bit is reserved, it defines whether the item is shown or not)");
- RNA_def_function_output(func, prop);
- prop = RNA_def_property(func, "filter_neworder", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC);
- RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */
- RNA_def_property_ui_text(prop, "", "An array of indices, one for each item in the collection, mapping the org "
- "index to the new one");
- RNA_def_function_output(func, prop);
-
- /* "Constants"! */
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "bitflag_filter_item", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(prop, "FILTER_ITEM",
- "The value of the reserved bitflag 'FILTER_ITEM' (in filter_flags values)");
- RNA_def_property_int_funcs(prop, "rna_UIList_filter_const_FILTER_ITEM_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "UIList", NULL);
+ RNA_def_struct_ui_text(srna, "UIList", "UI list containing the elements of a collection");
+ RNA_def_struct_sdna(srna, "uiList");
+ RNA_def_struct_refine_func(srna, "rna_UIList_refine");
+ RNA_def_struct_register_funcs(srna, "rna_UIList_register", "rna_UIList_unregister", NULL);
+ RNA_def_struct_idprops_func(srna, "rna_UIList_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES | STRUCT_PUBLIC_NAMESPACE_INHERIT);
+
+ /* Registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop,
+ "ID Name",
+ "If this is set, the uilist gets a custom ID, otherwise it takes the "
+ "name of the class used to define the uilist (for example, if the "
+ "class name is \"OBJECT_UL_vgroups\", and bl_idname is not set by the "
+ "script, then bl_idname = \"OBJECT_UL_vgroups\")");
+
+ /* Data */
+ prop = RNA_def_property(srna, "layout_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_uilist_layout_type_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ /* Filter options */
+ prop = RNA_def_property(srna, "use_filter_show", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_SHOW);
+ RNA_def_property_ui_text(prop, "Show Filter", "Show filtering options");
+
+ prop = RNA_def_property(srna, "filter_name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "filter_byname");
+ RNA_def_property_flag(prop, PROP_TEXTEDIT_UPDATE);
+ RNA_def_property_ui_text(
+ prop, "Filter by Name", "Only show items matching this name (use '*' as wildcard)");
+
+ prop = RNA_def_property(srna, "use_filter_invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter_flag", UILST_FLT_EXCLUDE);
+ RNA_def_property_ui_text(prop, "Invert", "Invert filtering (show hidden items, and vice-versa)");
+
+ /* WARNING: This is sort of an abuse, sort-by-alpha is actually a value, should even be an enum in full logic
+ * (of two values, sort by index and sort by name).
+ * But for default UIList, it's nicer (better UI-wise) to show this as a boolean bit-flag option,
+ * avoids having to define custom setters/getters using UILST_FLT_SORT_MASK to mask out
+ * actual bitflags on same var, etc.
+ */
+ prop = RNA_def_property(srna, "use_filter_sort_alpha", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_ALPHA);
+ RNA_def_property_ui_icon(prop, ICON_SORTALPHA, 0);
+ RNA_def_property_ui_text(prop, "Sort by Name", "Sort items by their name");
+
+ prop = RNA_def_property(srna, "use_filter_sort_reverse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_REVERSE);
+ RNA_def_property_ui_text(prop, "Reverse", "Reverse the order of shown items");
+
+ prop = RNA_def_property(srna, "use_filter_sort_lock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "filter_sort_flag", UILST_FLT_SORT_LOCK);
+ RNA_def_property_ui_text(
+ prop, "Lock Order", "Lock the order of shown items (user cannot change it)");
+
+ /* draw_item */
+ func = RNA_def_function(srna, "draw_item", NULL);
+ RNA_def_function_ui_description(
+ func,
+ "Draw an item in the list (NOTE: when you define your own draw_item "
+ "function, you may want to check given 'item' is of the right type...)");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "data", "AnyType", "", "Data from which to take Collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "item", "AnyType", "", "Item of the collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_int(
+ func, "icon", 0, 0, INT_MAX, "", "Icon of the item in the collection", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func,
+ "active_data",
+ "AnyType",
+ "",
+ "Data from which to take property for the active element");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func,
+ "active_property",
+ NULL,
+ 0,
+ "",
+ "Identifier of property in active_data, for the active element");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, INT_MAX, "", "Index of the item in the collection", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL);
+ prop = RNA_def_property(func, "flt_flag", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(prop, "", "The filter-flag result for this item");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_PYFUNC_OPTIONAL);
+
+ /* draw_filter */
+ func = RNA_def_function(srna, "draw_filter", NULL);
+ RNA_def_function_ui_description(func, "Draw filtering options");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Layout to draw the item");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* filter */
+ func = RNA_def_function(srna, "filter_items", NULL);
+ RNA_def_function_ui_description(
+ func,
+ "Filter and/or re-order items of the collection (output filter results in "
+ "filter_flags, and reorder results in filter_neworder arrays)");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "data", "AnyType", "", "Data from which to take Collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "property", NULL, 0, "", "Identifier of property in data, for the collection");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ prop = RNA_def_property(func, "filter_flags", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC);
+ RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */
+ RNA_def_property_ui_text(
+ prop,
+ "",
+ "An array of filter flags, one for each item in the collection (NOTE: "
+ "FILTER_ITEM bit is reserved, it defines whether the item is shown or not)");
+ RNA_def_function_output(func, prop);
+ prop = RNA_def_property(func, "filter_neworder", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_flag(prop, PARM_REQUIRED | PROP_DYNAMIC);
+ RNA_def_property_array(prop, 1); /* XXX Dummy value, default 0 does not work */
+ RNA_def_property_ui_text(
+ prop,
+ "",
+ "An array of indices, one for each item in the collection, mapping the org "
+ "index to the new one");
+ RNA_def_function_output(func, prop);
+
+ /* "Constants"! */
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "bitflag_filter_item", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(
+ prop,
+ "FILTER_ITEM",
+ "The value of the reserved bitflag 'FILTER_ITEM' (in filter_flags values)");
+ RNA_def_property_int_funcs(prop, "rna_UIList_filter_const_FILTER_ITEM_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
}
static void rna_def_header(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "Header", NULL);
- RNA_def_struct_ui_text(srna, "Header", "Editor header containing UI elements");
- RNA_def_struct_sdna(srna, "Header");
- RNA_def_struct_refine_func(srna, "rna_Header_refine");
- RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
- RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
-
- /* draw */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "layout");
- RNA_def_property_struct_type(prop, "UILayout");
- RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI");
-
- /* registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name",
- "If this is set, the header gets a custom ID, otherwise it takes the "
- "name of the class used to define the panel; for example, if the "
- "class name is \"OBJECT_HT_hello\", and bl_idname is not set by the "
- "script, then bl_idname = \"OBJECT_HT_hello\"");
-
- prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Space type", "The space where the header is going to be used in");
-
- prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
- RNA_def_property_enum_default(prop, RGN_TYPE_HEADER);
- RNA_def_property_enum_items(prop, rna_enum_region_type_items);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_ui_text(prop, "Region Type", "The region where the header is going to be used in "
- "(defaults to header region)");
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "Header", NULL);
+ RNA_def_struct_ui_text(srna, "Header", "Editor header containing UI elements");
+ RNA_def_struct_sdna(srna, "Header");
+ RNA_def_struct_refine_func(srna, "rna_Header_refine");
+ RNA_def_struct_register_funcs(srna, "rna_Header_register", "rna_Header_unregister", NULL);
+ RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
+
+ /* draw */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw UI elements into the header UI layout");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "layout");
+ RNA_def_property_struct_type(prop, "UILayout");
+ RNA_def_property_ui_text(prop, "Layout", "Structure of the header in the UI");
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop,
+ "ID Name",
+ "If this is set, the header gets a custom ID, otherwise it takes the "
+ "name of the class used to define the panel; for example, if the "
+ "class name is \"OBJECT_HT_hello\", and bl_idname is not set by the "
+ "script, then bl_idname = \"OBJECT_HT_hello\"");
+
+ prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->space_type");
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(
+ prop, "Space type", "The space where the header is going to be used in");
+
+ prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->region_type");
+ RNA_def_property_enum_default(prop, RGN_TYPE_HEADER);
+ RNA_def_property_enum_items(prop, rna_enum_region_type_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_ui_text(prop,
+ "Region Type",
+ "The region where the header is going to be used in "
+ "(defaults to header region)");
+
+ RNA_define_verify_sdna(1);
}
static void rna_def_menu(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- PropertyRNA *parm;
- FunctionRNA *func;
-
- srna = RNA_def_struct(brna, "Menu", NULL);
- RNA_def_struct_ui_text(srna, "Menu", "Editor menu containing buttons");
- RNA_def_struct_sdna(srna, "Menu");
- RNA_def_struct_refine_func(srna, "rna_Menu_refine");
- RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
- RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "If this method returns a non-null output, then the menu can be drawn");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* draw */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw UI elements into the menu UI layout");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- RNA_define_verify_sdna(false); /* not in sdna */
-
- prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "layout");
- RNA_def_property_struct_type(prop, "UILayout");
- RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the menu in the UI");
-
- /* registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "ID Name",
- "If this is set, the menu gets a custom ID, otherwise it takes the "
- "name of the class used to define the menu (for example, if the "
- "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the "
- "script, then bl_idname = \"OBJECT_MT_hello\")");
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->label");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Label", "The menu label");
-
- prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
- RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->description");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->owner_id");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- RNA_define_verify_sdna(1);
+ StructRNA *srna;
+ PropertyRNA *prop;
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ srna = RNA_def_struct(brna, "Menu", NULL);
+ RNA_def_struct_ui_text(srna, "Menu", "Editor menu containing buttons");
+ RNA_def_struct_sdna(srna, "Menu");
+ RNA_def_struct_refine_func(srna, "rna_Menu_refine");
+ RNA_def_struct_register_funcs(srna, "rna_Menu_register", "rna_Menu_unregister", NULL);
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(
+ func, "If this method returns a non-null output, then the menu can be drawn");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* draw */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw UI elements into the menu UI layout");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ RNA_define_verify_sdna(false); /* not in sdna */
+
+ prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "layout");
+ RNA_def_property_struct_type(prop, "UILayout");
+ RNA_def_property_ui_text(prop, "Layout", "Defines the structure of the menu in the UI");
+
+ /* registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop,
+ "ID Name",
+ "If this is set, the menu gets a custom ID, otherwise it takes the "
+ "name of the class used to define the menu (for example, if the "
+ "class name is \"OBJECT_MT_hello\", and bl_idname is not set by the "
+ "script, then bl_idname = \"OBJECT_MT_hello\")");
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->label");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "Label", "The menu label");
+
+ prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
+ RNA_def_property_string_default(prop, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->description");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Menu_bl_description_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->owner_id");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ RNA_define_verify_sdna(1);
}
void RNA_def_ui(BlenderRNA *brna)
{
- rna_def_ui_layout(brna);
- rna_def_panel(brna);
- rna_def_uilist(brna);
- rna_def_header(brna);
- rna_def_menu(brna);
+ rna_def_ui_layout(brna);
+ rna_def_panel(brna);
+ rna_def_uilist(brna);
+ rna_def_header(brna);
+ rna_def_menu(brna);
}
#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c
index e6c1038c48d..d8e13fda114 100644
--- a/source/blender/makesrna/intern/rna_ui_api.c
+++ b/source/blender/makesrna/intern/rna_ui_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -46,1168 +45,1438 @@
#define DEF_ICON_BLANK(name)
const EnumPropertyItem rna_enum_icon_items[] = {
#include "UI_icons.h"
- {0, NULL, 0, NULL, NULL},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
const char *rna_translate_ui_text(
- const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate)
+ const char *text, const char *text_ctxt, StructRNA *type, PropertyRNA *prop, bool translate)
{
- /* Also return text if UI labels translation is disabled. */
- if (!text || !text[0] || !translate || !BLT_translate_iface()) {
- return text;
- }
-
- /* If a text_ctxt is specified, use it! */
- if (text_ctxt && text_ctxt[0]) {
- return BLT_pgettext(text_ctxt, text);
- }
-
- /* Else, if an RNA type or property is specified, use its context. */
-#if 0
- /* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
- * to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
- * script can't determine the correct context it should use for such 'text' messages...
- * So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
- * if default context is not suitable.
- */
- if (prop) {
- return BLT_pgettext(RNA_property_translation_context(prop), text);
- }
-#else
- (void)prop;
-#endif
- if (type) {
- return BLT_pgettext(RNA_struct_translation_context(type), text);
- }
-
- /* Else, default context! */
- return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text);
+ /* Also return text if UI labels translation is disabled. */
+ if (!text || !text[0] || !translate || !BLT_translate_iface()) {
+ return text;
+ }
+
+ /* If a text_ctxt is specified, use it! */
+ if (text_ctxt && text_ctxt[0]) {
+ return BLT_pgettext(text_ctxt, text);
+ }
+
+ /* Else, if an RNA type or property is specified, use its context. */
+# if 0
+ /* XXX Disabled for now. Unfortunately, their is absolutely no way from py code to get the RNA struct corresponding
+ * to the 'data' (in functions like prop() & co), as this is pure runtime data. Hence, messages extraction
+ * script can't determine the correct context it should use for such 'text' messages...
+ * So for now, one have to explicitly specify the 'text_ctxt' when using prop() etc. functions,
+ * if default context is not suitable.
+ */
+ if (prop) {
+ return BLT_pgettext(RNA_property_translation_context(prop), text);
+ }
+# else
+ (void)prop;
+# endif
+ if (type) {
+ return BLT_pgettext(RNA_struct_translation_context(type), text);
+ }
+
+ /* Else, default context! */
+ return BLT_pgettext(BLT_I18NCONTEXT_DEFAULT, text);
}
-static void rna_uiItemR(
- uiLayout *layout, PointerRNA *ptr, const char *propname, const char *name, const char *text_ctxt,
- bool translate, int icon, bool expand, bool slider, bool toggle, bool icon_only, bool event,
- bool full_event, bool emboss, int index, int icon_value)
+static void rna_uiItemR(uiLayout *layout,
+ PointerRNA *ptr,
+ const char *propname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ bool expand,
+ bool slider,
+ bool toggle,
+ bool icon_only,
+ bool event,
+ bool full_event,
+ bool emboss,
+ int index,
+ int icon_value)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- int flag = 0;
-
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
-
- if (icon_value && !icon) {
- icon = icon_value;
- }
-
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
-
- flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
- flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
- flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
- flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
- flag |= (event) ? UI_ITEM_R_EVENT : 0;
- flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0;
- flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
-
- uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ int flag = 0;
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ flag |= (slider) ? UI_ITEM_R_SLIDER : 0;
+ flag |= (expand) ? UI_ITEM_R_EXPAND : 0;
+ flag |= (toggle) ? UI_ITEM_R_TOGGLE : 0;
+ flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
+ flag |= (event) ? UI_ITEM_R_EVENT : 0;
+ flag |= (full_event) ? UI_ITEM_R_FULL_EVENT : 0;
+ flag |= (emboss) ? 0 : UI_ITEM_R_NO_BG;
+
+ uiItemFullR(layout, ptr, prop, index, 0, flag, name, icon);
}
-static void rna_uiItemR_with_popover(
- uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
- const char *text_ctxt, bool translate, int icon,
- bool icon_only,
- const char *panel_type)
+static void rna_uiItemR_with_popover(uiLayout *layout,
+ struct PointerRNA *ptr,
+ const char *propname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ bool icon_only,
+ const char *panel_type)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
-
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
- if (RNA_property_type(prop) != PROP_ENUM) {
- RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
- int flag = 0;
-
- flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
-
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
- uiItemFullR_with_popover(layout, ptr, prop, -1, 0, flag, name, icon, panel_type);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+ if (RNA_property_type(prop) != PROP_ENUM) {
+ RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+ int flag = 0;
+
+ flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+ uiItemFullR_with_popover(layout, ptr, prop, -1, 0, flag, name, icon, panel_type);
}
-static void rna_uiItemR_with_menu(
- uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
- const char *text_ctxt, bool translate, int icon,
- bool icon_only,
- const char *menu_type)
+static void rna_uiItemR_with_menu(uiLayout *layout,
+ struct PointerRNA *ptr,
+ const char *propname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ bool icon_only,
+ const char *menu_type)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
-
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
- if (RNA_property_type(prop) != PROP_ENUM) {
- RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
- int flag = 0;
-
- flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
-
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
- uiItemFullR_with_menu(layout, ptr, prop, -1, 0, flag, name, icon, menu_type);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+ if (RNA_property_type(prop) != PROP_ENUM) {
+ RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+ int flag = 0;
+
+ flag |= (icon_only) ? UI_ITEM_R_ICON_ONLY : 0;
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+ uiItemFullR_with_menu(layout, ptr, prop, -1, 0, flag, name, icon, menu_type);
}
-
-static void rna_uiItemMenuEnumR(
- uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *name,
- const char *text_ctxt, bool translate, int icon)
+static void rna_uiItemMenuEnumR(uiLayout *layout,
+ struct PointerRNA *ptr,
+ const char *propname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
- uiItemMenuEnumR_prop(layout, ptr, prop, name, icon);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+ uiItemMenuEnumR_prop(layout, ptr, prop, name, icon);
}
static void rna_uiItemTabsEnumR(
- uiLayout *layout, bContext *C,
- struct PointerRNA *ptr, const char *propname,
- bool icon_only)
+ uiLayout *layout, bContext *C, struct PointerRNA *ptr, const char *propname, bool icon_only)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
-
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
- if (RNA_property_type(prop) != PROP_ENUM) {
- RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
-
- uiItemTabsEnumR_prop(layout, C, ptr, prop, icon_only);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+ if (RNA_property_type(prop) != PROP_ENUM) {
+ RNA_warning("property is not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+
+ uiItemTabsEnumR_prop(layout, C, ptr, prop, icon_only);
}
-static void rna_uiItemEnumR_string(
- uiLayout *layout, struct PointerRNA *ptr, const char *propname, const char *value,
- const char *name, const char *text_ctxt, bool translate, int icon)
+static void rna_uiItemEnumR_string(uiLayout *layout,
+ struct PointerRNA *ptr,
+ const char *propname,
+ const char *value,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
- uiItemEnumR_string_prop(layout, ptr, prop, value, name, icon);
+ uiItemEnumR_string_prop(layout, ptr, prop, value, name, icon);
}
-static void rna_uiItemPointerR(
- uiLayout *layout, struct PointerRNA *ptr, const char *propname,
- struct PointerRNA *searchptr, const char *searchpropname,
- const char *name, const char *text_ctxt, bool translate, int icon)
+static void rna_uiItemPointerR(uiLayout *layout,
+ struct PointerRNA *ptr,
+ const char *propname,
+ struct PointerRNA *searchptr,
+ const char *searchpropname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
- PropertyRNA *searchprop = RNA_struct_find_property(searchptr, searchpropname);
- if (!searchprop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(searchptr->type), searchpropname);
- return;
- }
-
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
-
- uiItemPointerR_prop(layout, ptr, prop, searchptr, searchprop, name, icon);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
+ PropertyRNA *searchprop = RNA_struct_find_property(searchptr, searchpropname);
+ if (!searchprop) {
+ RNA_warning(
+ "property not found: %s.%s", RNA_struct_identifier(searchptr->type), searchpropname);
+ return;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+
+ uiItemPointerR_prop(layout, ptr, prop, searchptr, searchprop, name, icon);
}
-static PointerRNA rna_uiItemO(
- uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
- bool translate, int icon, bool emboss, bool depress, int icon_value)
+static PointerRNA rna_uiItemO(uiLayout *layout,
+ const char *opname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ bool emboss,
+ bool depress,
+ int icon_value)
{
- wmOperatorType *ot;
-
- ot = WM_operatortype_find(opname, 0); /* print error next */
- if (!ot || !ot->srna) {
- RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
- return PointerRNA_NULL;
- }
-
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
-
- if (icon_value && !icon) {
- icon = icon_value;
- }
- int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
- flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;
-
- PointerRNA opptr;
- uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, &opptr);
- return opptr;
+ wmOperatorType *ot;
+
+ ot = WM_operatortype_find(opname, 0); /* print error next */
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return PointerRNA_NULL;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
+ int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
+ flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;
+
+ PointerRNA opptr;
+ uiItemFullO_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, &opptr);
+ return opptr;
}
-static PointerRNA rna_uiItemOMenuHold(
- uiLayout *layout, const char *opname, const char *name, const char *text_ctxt,
- bool translate, int icon, bool emboss, bool depress, int icon_value,
- const char *menu)
+static PointerRNA rna_uiItemOMenuHold(uiLayout *layout,
+ const char *opname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ bool emboss,
+ bool depress,
+ int icon_value,
+ const char *menu)
{
- wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
- if (!ot || !ot->srna) {
- RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
- return PointerRNA_NULL;
- }
-
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
- if (icon_value && !icon) {
- icon = icon_value;
- }
- int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
- flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;
-
- PointerRNA opptr;
- uiItemFullOMenuHold_ptr(layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, menu, &opptr);
- return opptr;
+ wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return PointerRNA_NULL;
+ }
+
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
+ int flag = (emboss) ? 0 : UI_ITEM_R_NO_BG;
+ flag |= (depress) ? UI_ITEM_O_DEPRESS : 0;
+
+ PointerRNA opptr;
+ uiItemFullOMenuHold_ptr(
+ layout, ot, name, icon, NULL, uiLayoutGetOperatorContext(layout), flag, menu, &opptr);
+ return opptr;
}
-
-static void rna_uiItemMenuEnumO(
- uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name,
- const char *text_ctxt, bool translate, int icon)
+static void rna_uiItemMenuEnumO(uiLayout *layout,
+ bContext *C,
+ const char *opname,
+ const char *propname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon)
{
- wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
+ wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
- if (!ot || !ot->srna) {
- RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
- return;
- }
+ if (!ot || !ot->srna) {
+ RNA_warning("%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return;
+ }
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, ot->srna, NULL, translate);
- uiItemMenuEnumO_ptr(layout, C, ot, propname, name, icon);
+ uiItemMenuEnumO_ptr(layout, C, ot, propname, name, icon);
}
-static void rna_uiItemL(
- uiLayout *layout, const char *name, const char *text_ctxt, bool translate,
- int icon, int icon_value)
+static void rna_uiItemL(uiLayout *layout,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ int icon_value)
{
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
- if (icon_value && !icon) {
- icon = icon_value;
- }
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
- uiItemL(layout, name, icon);
+ uiItemL(layout, name, icon);
}
-static void rna_uiItemM(
- uiLayout *layout, const char *menuname, const char *name, const char *text_ctxt,
- bool translate, int icon, int icon_value)
+static void rna_uiItemM(uiLayout *layout,
+ const char *menuname,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ int icon_value)
{
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
- if (icon_value && !icon) {
- icon = icon_value;
- }
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
- uiItemM(layout, menuname, name, icon);
+ uiItemM(layout, menuname, name, icon);
}
-static void rna_uiItemM_contents(
- uiLayout *layout, const char *menuname)
+static void rna_uiItemM_contents(uiLayout *layout, const char *menuname)
{
- uiItemMContents(layout, menuname);
+ uiItemMContents(layout, menuname);
}
-static void rna_uiItemPopoverPanel(
- uiLayout *layout, bContext *C,
- const char *panel_type, const char *name, const char *text_ctxt,
- bool translate, int icon, int icon_value)
+static void rna_uiItemPopoverPanel(uiLayout *layout,
+ bContext *C,
+ const char *panel_type,
+ const char *name,
+ const char *text_ctxt,
+ bool translate,
+ int icon,
+ int icon_value)
{
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, NULL, translate);
- if (icon_value && !icon) {
- icon = icon_value;
- }
+ if (icon_value && !icon) {
+ icon = icon_value;
+ }
- uiItemPopoverPanel(layout, C, panel_type, name, icon);
+ uiItemPopoverPanel(layout, C, panel_type, name, icon);
}
-static void rna_uiItemPopoverPanelFromGroup(
- uiLayout *layout, bContext *C,
- int space_id, int region_id, const char *context, const char *category)
+static void rna_uiItemPopoverPanelFromGroup(uiLayout *layout,
+ bContext *C,
+ int space_id,
+ int region_id,
+ const char *context,
+ const char *category)
{
- uiItemPopoverPanelFromGroup(layout, C, space_id, region_id, context, category);
+ uiItemPopoverPanelFromGroup(layout, C, space_id, region_id, context, category);
}
-static void rna_uiTemplateAnyID(
- uiLayout *layout, PointerRNA *ptr, const char *propname, const char *proptypename,
- const char *name, const char *text_ctxt, bool translate)
+static void rna_uiTemplateAnyID(uiLayout *layout,
+ PointerRNA *ptr,
+ const char *propname,
+ const char *proptypename,
+ const char *name,
+ const char *text_ctxt,
+ bool translate)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
- /* XXX This will search property again :( */
- uiTemplateAnyID(layout, ptr, propname, proptypename, name);
+ /* XXX This will search property again :( */
+ uiTemplateAnyID(layout, ptr, propname, proptypename, name);
}
-static void rna_uiTemplatePathBuilder(
- uiLayout *layout, PointerRNA *ptr, const char *propname, PointerRNA *root_ptr,
- const char *name, const char *text_ctxt, bool translate)
+static void rna_uiTemplatePathBuilder(uiLayout *layout,
+ PointerRNA *ptr,
+ const char *propname,
+ PointerRNA *root_ptr,
+ const char *name,
+ const char *text_ctxt,
+ bool translate)
{
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- if (!prop) {
- RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return;
- }
+ if (!prop) {
+ RNA_warning("property not found: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return;
+ }
- /* Get translated name (label). */
- name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
+ /* Get translated name (label). */
+ name = rna_translate_ui_text(name, text_ctxt, NULL, prop, translate);
- /* XXX This will search property again :( */
- uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
+ /* XXX This will search property again :( */
+ uiTemplatePathBuilder(layout, ptr, propname, root_ptr, name);
}
static int rna_ui_get_rnaptr_icon(bContext *C, PointerRNA *ptr_icon)
{
- return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
+ return UI_rnaptr_icon_get(C, ptr_icon, RNA_struct_ui_icon(ptr_icon->type), false);
}
-static const char *rna_ui_get_enum_name(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
+static const char *rna_ui_get_enum_name(bContext *C,
+ PointerRNA *ptr,
+ const char *propname,
+ const char *identifier)
{
- PropertyRNA *prop = NULL;
- const EnumPropertyItem *items = NULL, *item;
- bool free;
- const char *name = "";
-
- prop = RNA_struct_find_property(ptr, propname);
- if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
- RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return name;
- }
-
- RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
-
- if (items) {
- for (item = items; item->identifier; item++) {
- if (item->identifier[0] && STREQ(item->identifier, identifier)) {
- name = item->name;
- break;
- }
- }
- if (free) {
- MEM_freeN((void *)items);
- }
- }
-
- return name;
+ PropertyRNA *prop = NULL;
+ const EnumPropertyItem *items = NULL, *item;
+ bool free;
+ const char *name = "";
+
+ prop = RNA_struct_find_property(ptr, propname);
+ if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
+ RNA_warning(
+ "Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return name;
+ }
+
+ RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
+
+ if (items) {
+ for (item = items; item->identifier; item++) {
+ if (item->identifier[0] && STREQ(item->identifier, identifier)) {
+ name = item->name;
+ break;
+ }
+ }
+ if (free) {
+ MEM_freeN((void *)items);
+ }
+ }
+
+ return name;
}
-static const char *rna_ui_get_enum_description(
- bContext *C, PointerRNA *ptr, const char *propname,
- const char *identifier)
+static const char *rna_ui_get_enum_description(bContext *C,
+ PointerRNA *ptr,
+ const char *propname,
+ const char *identifier)
{
- PropertyRNA *prop = NULL;
- const EnumPropertyItem *items = NULL, *item;
- bool free;
- const char *desc = "";
-
- prop = RNA_struct_find_property(ptr, propname);
- if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
- RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return desc;
- }
-
- RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
-
- if (items) {
- for (item = items; item->identifier; item++) {
- if (item->identifier[0] && STREQ(item->identifier, identifier)) {
- desc = item->description;
- break;
- }
- }
- if (free) {
- MEM_freeN((void *)items);
- }
- }
-
- return desc;
+ PropertyRNA *prop = NULL;
+ const EnumPropertyItem *items = NULL, *item;
+ bool free;
+ const char *desc = "";
+
+ prop = RNA_struct_find_property(ptr, propname);
+ if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
+ RNA_warning(
+ "Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return desc;
+ }
+
+ RNA_property_enum_items_gettexted(C, ptr, prop, &items, NULL, &free);
+
+ if (items) {
+ for (item = items; item->identifier; item++) {
+ if (item->identifier[0] && STREQ(item->identifier, identifier)) {
+ desc = item->description;
+ break;
+ }
+ }
+ if (free) {
+ MEM_freeN((void *)items);
+ }
+ }
+
+ return desc;
}
-static int rna_ui_get_enum_icon(bContext *C, PointerRNA *ptr, const char *propname, const char *identifier)
+static int rna_ui_get_enum_icon(bContext *C,
+ PointerRNA *ptr,
+ const char *propname,
+ const char *identifier)
{
- PropertyRNA *prop = NULL;
- const EnumPropertyItem *items = NULL, *item;
- bool free;
- int icon = ICON_NONE;
-
- prop = RNA_struct_find_property(ptr, propname);
- if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
- RNA_warning("Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
- return icon;
- }
-
- RNA_property_enum_items(C, ptr, prop, &items, NULL, &free);
-
- if (items) {
- for (item = items; item->identifier; item++) {
- if (item->identifier[0] && STREQ(item->identifier, identifier)) {
- icon = item->icon;
- break;
- }
- }
- if (free) {
- MEM_freeN((void *)items);
- }
- }
-
- return icon;
+ PropertyRNA *prop = NULL;
+ const EnumPropertyItem *items = NULL, *item;
+ bool free;
+ int icon = ICON_NONE;
+
+ prop = RNA_struct_find_property(ptr, propname);
+ if (!prop || (RNA_property_type(prop) != PROP_ENUM)) {
+ RNA_warning(
+ "Property not found or not an enum: %s.%s", RNA_struct_identifier(ptr->type), propname);
+ return icon;
+ }
+
+ RNA_property_enum_items(C, ptr, prop, &items, NULL, &free);
+
+ if (items) {
+ for (item = items; item->identifier; item++) {
+ if (item->identifier[0] && STREQ(item->identifier, identifier)) {
+ icon = item->icon;
+ break;
+ }
+ }
+ if (free) {
+ MEM_freeN((void *)items);
+ }
+ }
+
+ return icon;
}
#else
static void api_ui_item_common_text(FunctionRNA *func)
{
- PropertyRNA *prop;
-
- prop = RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item");
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL);
- prop = RNA_def_string(func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text");
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL);
- RNA_def_boolean(func, "translate", true, "", "Translate the given text, when UI translation is enabled");
+ PropertyRNA *prop;
+
+ prop = RNA_def_string(func, "text", NULL, 0, "", "Override automatic text of the item");
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL);
+ prop = RNA_def_string(
+ func, "text_ctxt", NULL, 0, "", "Override automatic translation context of the given text");
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL);
+ RNA_def_boolean(
+ func, "translate", true, "", "Translate the given text, when UI translation is enabled");
}
static void api_ui_item_common(FunctionRNA *func)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- api_ui_item_common_text(func);
+ api_ui_item_common_text(func);
- prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_icon_items);
- RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
+ prop = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_icon_items);
+ RNA_def_property_ui_text(prop, "Icon", "Override automatic icon of the item");
}
static void api_ui_item_op(FunctionRNA *func)
{
- PropertyRNA *parm;
- parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ PropertyRNA *parm;
+ parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
static void api_ui_item_op_common(FunctionRNA *func)
{
- api_ui_item_op(func);
- api_ui_item_common(func);
+ api_ui_item_op(func);
+ api_ui_item_common(func);
}
static void api_ui_item_rna_common(FunctionRNA *func)
{
- PropertyRNA *parm;
+ PropertyRNA *parm;
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
void RNA_api_ui_layout(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- static const EnumPropertyItem curve_type_items[] = {
- {0, "NONE", 0, "None", ""},
- {'v', "VECTOR", 0, "Vector", ""},
- {'c', "COLOR", 0, "Color", ""},
- {'h', "HUE", 0, "Hue", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem id_template_filter_items[] = {
- {UI_TEMPLATE_ID_FILTER_ALL, "ALL", 0, "All", ""},
- {UI_TEMPLATE_ID_FILTER_AVAILABLE, "AVAILABLE", 0, "Available", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static float node_socket_color_default[] = { 0.0f, 0.0f, 0.0f, 1.0f };
-
- /* simple layout specifiers */
- func = RNA_def_function(srna, "row", "uiLayoutRow");
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func,
- "Sub-layout. Items placed in this sublayout are placed next to each other "
- "in a row");
- RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
-
- func = RNA_def_function(srna, "column", "uiLayoutColumn");
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func,
- "Sub-layout. Items placed in this sublayout are placed under each other "
- "in a column");
- RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
-
- func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
- RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
- RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
-
- func = RNA_def_function(srna, "grid_flow", "uiLayoutGridFlow");
- RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column");
- RNA_def_int(func, "columns", 0, INT_MIN, INT_MAX, "",
- "Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are "
- "automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. "
- "columns for row major layout, and 2, 4, 6 etc. rows for column major layout)",
- INT_MIN, INT_MAX);
- RNA_def_boolean(func, "even_columns", false, "", "All columns will have the same width");
- RNA_def_boolean(func, "even_rows", false, "", "All rows will have the same height");
- RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
-
- /* box layout */
- func = RNA_def_function(srna, "box", "uiLayoutBox");
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func, "Sublayout (items placed in this sublayout are placed "
- "under each other in a column and are surrounded by a box)");
-
- /* split layout */
- func = RNA_def_function(srna, "split", "uiLayoutSplit");
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
- RNA_def_float(
- func, "factor", 0.0f, 0.0f, 1.0f, "Percentage",
- "Percentage of width to split at (leave unset for automatic calculation)",
- 0.0f, 1.0f);
- RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
-
- /* radial/pie layout */
- func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial");
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func, "Sublayout. Items placed in this sublayout are placed "
- "in a radial fashion around the menu center)");
-
- /* Icon of a rna pointer */
- func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
- parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
- RNA_def_function_return(func, parm);
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_function_ui_description(func, "Return the custom icon for this data, "
- "use it e.g. to get materials or texture icons");
-
- /* UI name, description and icon of an enum item */
- func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
- parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item");
- RNA_def_function_return(func, parm);
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "Return the UI name for this enum item");
-
- func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
- parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item");
- RNA_def_function_return(func, parm);
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "Return the UI description for this enum item");
-
- func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
- parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
- RNA_def_function_return(func, parm);
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "Return the icon for this enum item");
-
- /* items */
- func = RNA_def_function(srna, "prop", "rna_uiItemR");
- RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
- api_ui_item_rna_common(func);
- api_ui_item_common(func);
- RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
- RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values");
- RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values");
- RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
- RNA_def_boolean(func, "event", false, "", "Use button to input key events");
- RNA_def_boolean(func, "full_event", false, "", "Use button to input full events including modifiers");
- RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
- RNA_def_int(func, "index", -1, -2, INT_MAX, "",
- "The index of this button, when set a single member of an array can be accessed, "
- "when set to -1 all array members are used", -2, INT_MAX); /* RNA_NO_INDEX == -1 */
- parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
-
- func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
- api_ui_item_rna_common(func);
- api_ui_item_common(func);
-
- func = RNA_def_function(srna, "prop_with_popover", "rna_uiItemR_with_popover");
- api_ui_item_rna_common(func);
- api_ui_item_common(func);
- RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
- parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "prop_with_menu", "rna_uiItemR_with_menu");
- api_ui_item_rna_common(func);
- api_ui_item_common(func);
- RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
- parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "prop_tabs_enum", "rna_uiItemTabsEnumR");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
-
- func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
- api_ui_item_rna_common(func);
- parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- api_ui_item_common(func);
-
- func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- api_ui_item_common(func);
-
- for (int is_menu_hold = 0; is_menu_hold < 2; is_menu_hold++) {
- func = (is_menu_hold) ?
- RNA_def_function(srna, "operator_menu_hold", "rna_uiItemOMenuHold") :
- RNA_def_function(srna, "operator", "rna_uiItemO");
- api_ui_item_op_common(func);
- RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
- RNA_def_boolean(func, "depress", false, "", "Draw pressed in");
- parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
- if (is_menu_hold) {
- parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- }
- parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_function_return(func, parm);
- RNA_def_function_ui_description(func, "Item. Places a button into the layout to call an Operator");
- }
-
- func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
- parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- api_ui_item_common(func);
-
- /* useful in C but not in python */
-#if 0
-
- func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
- api_ui_item_op_common(func);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
- api_ui_item_op_common(func);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "value", false, "", "Value of the property to call the operator with");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
-
- func = RNA_def_function(srna, "operator_int", "uiItemIntO");
- api_ui_item_op_common(func);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
- "Value of the property to call the operator with", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
-
- func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
- api_ui_item_op_common(func);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
- "Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
-
- func = RNA_def_function(srna, "operator_string", "uiItemStringO");
- api_ui_item_op_common(func);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "value", NULL, 0, "", "Value of the property to call the operator with");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-#endif
-
- func = RNA_def_function(srna, "label", "rna_uiItemL");
- RNA_def_function_ui_description(func, "Item. Displays text and/or icon in the layout");
- api_ui_item_common(func);
- parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
-
- func = RNA_def_function(srna, "menu", "rna_uiItemM");
- parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
- api_ui_item_common(func);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
-
- func = RNA_def_function(srna, "menu_contents", "rna_uiItemM_contents");
- parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "popover", "rna_uiItemPopoverPanel");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
- api_ui_item_common(func);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
-
- func = RNA_def_function(srna, "popover_group", "rna_uiItemPopoverPanelFromGroup");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_enum(func, "space_type", rna_enum_space_type_items, 0, "Space Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "context", NULL, 0, "", "panel type context");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "category", NULL, 0, "", "panel type category");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "separator", "uiItemS_ex");
- RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
- RNA_def_float(
- func, "factor", 1.0f, 0.0f, FLT_MAX, "Percentage",
- "Percentage of width to space (leave unset for default space)",
- 0.0f, FLT_MAX);
-
- func = RNA_def_function(srna, "separator_spacer", "uiItemSpacer");
- RNA_def_function_ui_description(func, "Item. Inserts horizontal spacing empty space into the layout between items");
-
- /* context */
- func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
-
- /* templates */
- func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Inserts common Space header UI (editor type selector)");
-
- func = RNA_def_function(srna, "template_ID", "uiTemplateID");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
- RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
- RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
- RNA_def_enum(func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL,
- "", "Optionally limit the items which can be selected");
- RNA_def_boolean(func, "live_icon", false, "", "Show preview instead of fixed icon");
-
- func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
- RNA_def_string(func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
- RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
- RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
- RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
- RNA_def_enum(func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL,
- "", "Optionally limit the items which can be selected");
- RNA_def_boolean(func, "hide_buttons", false, "", "Show only list, no buttons");
-
- func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "type_property", NULL, 0, "",
- "Identifier of property in data giving the type of the ID-blocks to use");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- api_ui_item_common_text(func);
-
- func = RNA_def_function(srna, "template_ID_tabs", "uiTemplateIDTabs");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
- RNA_def_string(func, "menu", NULL, 0, "", "Context menu identifier");
- RNA_def_enum(func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL,
- "", "Optionally limit the items which can be selected");
-
- func = RNA_def_function(srna, "template_search", "uiTemplateSearch");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection");
- RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink or delete the active "
- "item from the collection");
-
- func = RNA_def_function(srna, "template_search_preview", "uiTemplateSearchPreview");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "search_data", "AnyType", "", "Data from which to take collection to search in");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "search_property", NULL, 0, "", "Identifier of search collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection");
- RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink or delete the active "
- "item from the collection");
- RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
- RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
-
- func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- api_ui_item_common_text(func);
-
- func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Generates the UI layout for modifiers");
- parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "template_greasepencil_modifier", "uiTemplateGpencilModifier");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Generates the UI layout for grease pencil modifiers");
- parm = RNA_def_pointer(func, "data", "GpencilModifier", "", "Modifier data");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "template_shaderfx", "uiTemplateShaderFx");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Generates the UI layout for shader effect");
- parm = RNA_def_pointer(func, "data", "ShaderFx", "", "Shader data");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "template_greasepencil_color", "uiTemplateGpencilColorPreview");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- RNA_def_int(func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
- RNA_def_int(func, "cols", 0, 0, INT_MAX, "Number of thumbnail preview columns to display", "", 0, INT_MAX);
- RNA_def_float(func, "scale", 1.0f, 0.1f, 1.5f, "Scale of the image thumbnails", "", 0.5f, 1.0f);
- RNA_def_enum(
- func, "filter", id_template_filter_items, UI_TEMPLATE_ID_FILTER_ALL,
- "", "Optionally limit the items which can be selected");
-
- func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
- RNA_def_function_ui_description(func, "Generates the UI layout for constraints");
- parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
- RNA_def_function_ui_description(func, "Item. A preview window for materials, textures, lights or worlds");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?");
- RNA_def_pointer(func, "parent", "ID", "", "ID data-block");
- RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
- RNA_def_string(func, "preview_id", NULL, 0, "",
- "Identifier of this preview widget, if not set the ID type will be used "
- "(i.e. all previews of materials without explicit ID will have the same size...)");
-
- func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
- RNA_def_function_ui_description(func, "Item. A curve mapping widget used for e.g falloff curves for lights");
- api_ui_item_rna_common(func);
- RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
- RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
- RNA_def_boolean(func, "brush", false, "", "Show brush options");
- RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");
- RNA_def_boolean(func, "show_tone", false, "", "Show tone options");
-
- func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
- RNA_def_function_ui_description(func, "Item. A color ramp widget");
- api_ui_item_rna_common(func);
- RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
-
- func = RNA_def_function(srna, "template_icon", "uiTemplateIcon");
- RNA_def_function_ui_description(func, "Display a large icon");
- parm = RNA_def_int(func, "icon_value", 0, 0, INT_MAX, "Icon to display", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_float(func, "scale", 1.0f, 1.0f, 100.0f, "Scale", "Scale the icon size (by the button size)", 1.0f, 100.0f);
-
- func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
- RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
- api_ui_item_rna_common(func);
- RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons");
- RNA_def_float(func, "scale", 6.0f, 1.0f, 100.0f, "UI Units", "Scale the button icon size (by the button size)", 1.0f, 100.0f);
- RNA_def_float(func, "scale_popup", 5.0f, 1.0f, 100.0f, "Scale", "Scale the popup icon size (by the button size)", 1.0f, 100.0f);
-
- func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
- RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
- RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data");
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
- RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data");
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "used_layers_data", "AnyType", "", "Data from which to take property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "used_layers_property", NULL, 0, "", "Identifier of property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
- RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors");
- api_ui_item_rna_common(func);
- RNA_def_boolean(func, "value_slider", false, "", "Display the value slider to the right of the color wheel");
- RNA_def_boolean(func, "lock", false, "", "Lock the color wheel display to value 1.0 regardless of actual color");
- RNA_def_boolean(func, "lock_luminosity", false, "", "Keep the color at its original vector length");
- RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white");
-
- func = RNA_def_function(srna, "template_palette", "uiTemplatePalette");
- RNA_def_function_ui_description(func, "Item. A palette used to pick colors");
- api_ui_item_rna_common(func);
- RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values");
-
- func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "image", "Image", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "template_image", "uiTemplateImage");
- RNA_def_function_ui_description(func, "Item(s). User interface for selecting images and their source paths");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
- RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options");
-
- func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
- RNA_def_function_ui_description(func, "User interface for setting image format options");
- parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_boolean(func, "color_management", false, "", "Show color management settings");
-
- func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d");
- RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options");
- parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-
- func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews");
- RNA_def_function_ui_description(func, "User interface for setting image views output options");
- parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-
- func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
- RNA_def_function_ui_description(func, "Item(s). User interface for selecting movie clips and their source paths");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
-
- func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
- RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
- RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
-
- func = RNA_def_function(srna, "template_movieclip_information", "uiTemplateMovieclipInformation");
- RNA_def_function_ui_description(func, "Item. Movie clip information data.");
- api_ui_item_rna_common(func);
- parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-
- func = RNA_def_function(srna, "template_list", "uiTemplateList");
- RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "list_id", NULL, 0, "",
- "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
- "\" class). "
- "If this not an empty string, the uilist gets a custom ID, otherwise it takes the "
- "name of the class used to define the uilist (for example, if the "
- "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
- "script, then bl_idname = \"OBJECT_UL_vgroups\")");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "propname", NULL, 0, "", "Identifier of the Collection property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "active_dataptr", "AnyType", "",
- "Data from which to take the integer property, index of the active item");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "active_propname", NULL, 0, "",
- "Identifier of the integer property in active_data, index of the active item");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "item_dyntip_propname", NULL, 0, "",
- "Identifier of a string property in items, to use as tooltip content");
- RNA_def_int(func, "rows", 5, 0, INT_MAX, "", "Default and minimum number of rows to display", 0, INT_MAX);
- RNA_def_int(func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
- RNA_def_enum(func, "type", rna_enum_uilist_layout_type_items, UILST_LAYOUT_DEFAULT, "Type", "Type of layout to use");
- RNA_def_int(func, "columns", 9, 0, INT_MAX, "", "Number of items to display per row, for GRID layout", 0, INT_MAX);
- RNA_def_boolean(func, "sort_reverse", false, "", "Display items in reverse order by default");
- RNA_def_boolean(func, "sort_lock", false, "", "Lock display order to default value");
-
- func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");
-
- func = RNA_def_function(srna, "template_header_3D_mode", "uiTemplateHeader3D_mode");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "");
-
- func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Inserts common 3DView Edit modes header UI (selector for selection mode)");
-
- func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- func = RNA_def_function(srna, "template_input_status", "uiTemplateInputStatus");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
- parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "node", "Node", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "node", "Node", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
-
- func = RNA_def_function(srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
-
- func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
- RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_string(func, "name", NULL, 0, "", "");
-
- /* color management templates */
- func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
- RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
- RNA_def_function_ui_description(func, "Item. A widget to control color managed view settings settings.");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
- /* RNA_def_boolean(func, "show_global_settings", false, "", "Show widgets to control global color management settings"); */
-
- /* node socket icon */
- func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
- RNA_def_function_ui_description(func, "Node Socket Icon");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_float_array(func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
-
- func = RNA_def_function(srna, "template_cache_file", "uiTemplateCacheFile");
- RNA_def_function_ui_description(func, "Item(s). User interface for selecting cache files and their source paths");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- api_ui_item_rna_common(func);
-
- func = RNA_def_function(srna, "template_recent_files", "uiTemplateRecentFiles");
- RNA_def_function_ui_description(func, "Show list of recently saved .blend files");
- RNA_def_int(func, "rows", 5, 1, INT_MAX, "", "Maximum number of items to show", 1, INT_MAX);
- parm = RNA_def_int(func, "found", 0, 0, INT_MAX, "", "Number of items drawn", 0, INT_MAX);
- RNA_def_function_return(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ static const EnumPropertyItem curve_type_items[] = {
+ {0, "NONE", 0, "None", ""},
+ {'v', "VECTOR", 0, "Vector", ""},
+ {'c', "COLOR", 0, "Color", ""},
+ {'h', "HUE", 0, "Hue", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem id_template_filter_items[] = {
+ {UI_TEMPLATE_ID_FILTER_ALL, "ALL", 0, "All", ""},
+ {UI_TEMPLATE_ID_FILTER_AVAILABLE, "AVAILABLE", 0, "Available", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static float node_socket_color_default[] = {0.0f, 0.0f, 0.0f, 1.0f};
+
+ /* simple layout specifiers */
+ func = RNA_def_function(srna, "row", "uiLayoutRow");
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_ui_description(
+ func,
+ "Sub-layout. Items placed in this sublayout are placed next to each other "
+ "in a row");
+ RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
+
+ func = RNA_def_function(srna, "column", "uiLayoutColumn");
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_ui_description(
+ func,
+ "Sub-layout. Items placed in this sublayout are placed under each other "
+ "in a column");
+ RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
+
+ func = RNA_def_function(srna, "column_flow", "uiLayoutColumnFlow");
+ RNA_def_int(func, "columns", 0, 0, INT_MAX, "", "Number of columns, 0 is automatic", 0, INT_MAX);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+ RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
+
+ func = RNA_def_function(srna, "grid_flow", "uiLayoutGridFlow");
+ RNA_def_boolean(func, "row_major", false, "", "Fill row by row, instead of column by column");
+ RNA_def_int(
+ func,
+ "columns",
+ 0,
+ INT_MIN,
+ INT_MAX,
+ "",
+ "Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are "
+ "automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. "
+ "columns for row major layout, and 2, 4, 6 etc. rows for column major layout)",
+ INT_MIN,
+ INT_MAX);
+ RNA_def_boolean(func, "even_columns", false, "", "All columns will have the same width");
+ RNA_def_boolean(func, "even_rows", false, "", "All rows will have the same height");
+ RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+
+ /* box layout */
+ func = RNA_def_function(srna, "box", "uiLayoutBox");
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_ui_description(func,
+ "Sublayout (items placed in this sublayout are placed "
+ "under each other in a column and are surrounded by a box)");
+
+ /* split layout */
+ func = RNA_def_function(srna, "split", "uiLayoutSplit");
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+ RNA_def_float(func,
+ "factor",
+ 0.0f,
+ 0.0f,
+ 1.0f,
+ "Percentage",
+ "Percentage of width to split at (leave unset for automatic calculation)",
+ 0.0f,
+ 1.0f);
+ RNA_def_boolean(func, "align", false, "", "Align buttons to each other");
+
+ /* radial/pie layout */
+ func = RNA_def_function(srna, "menu_pie", "uiLayoutRadial");
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_ui_description(func,
+ "Sublayout. Items placed in this sublayout are placed "
+ "in a radial fashion around the menu center)");
+
+ /* Icon of a rna pointer */
+ func = RNA_def_function(srna, "icon", "rna_ui_get_rnaptr_icon");
+ parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take the icon");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_function_ui_description(func,
+ "Return the custom icon for this data, "
+ "use it e.g. to get materials or texture icons");
+
+ /* UI name, description and icon of an enum item */
+ func = RNA_def_function(srna, "enum_item_name", "rna_ui_get_enum_name");
+ parm = RNA_def_string(func, "name", NULL, 0, "", "UI name of the enum item");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "Return the UI name for this enum item");
+
+ func = RNA_def_function(srna, "enum_item_description", "rna_ui_get_enum_description");
+ parm = RNA_def_string(func, "description", NULL, 0, "", "UI description of the enum item");
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "Return the UI description for this enum item");
+
+ func = RNA_def_function(srna, "enum_item_icon", "rna_ui_get_enum_icon");
+ parm = RNA_def_int(func, "icon_value", ICON_NONE, 0, INT_MAX, "", "Icon identifier", 0, INT_MAX);
+ RNA_def_function_return(func, parm);
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "identifier", NULL, 0, "", "Identifier of the enum item");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "Return the icon for this enum item");
+
+ /* items */
+ func = RNA_def_function(srna, "prop", "rna_uiItemR");
+ RNA_def_function_ui_description(func, "Item. Exposes an RNA item and places it into the layout");
+ api_ui_item_rna_common(func);
+ api_ui_item_common(func);
+ RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
+ RNA_def_boolean(func, "slider", false, "", "Use slider widget for numeric values");
+ RNA_def_boolean(func, "toggle", false, "", "Use toggle widget for boolean values");
+ RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in buttons, no text");
+ RNA_def_boolean(func, "event", false, "", "Use button to input key events");
+ RNA_def_boolean(
+ func, "full_event", false, "", "Use button to input full events including modifiers");
+ RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
+ RNA_def_int(func,
+ "index",
+ -1,
+ -2,
+ INT_MAX,
+ "",
+ "The index of this button, when set a single member of an array can be accessed, "
+ "when set to -1 all array members are used",
+ -2,
+ INT_MAX); /* RNA_NO_INDEX == -1 */
+ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
+
+ func = RNA_def_function(srna, "props_enum", "uiItemsEnumR");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "prop_menu_enum", "rna_uiItemMenuEnumR");
+ api_ui_item_rna_common(func);
+ api_ui_item_common(func);
+
+ func = RNA_def_function(srna, "prop_with_popover", "rna_uiItemR_with_popover");
+ api_ui_item_rna_common(func);
+ api_ui_item_common(func);
+ RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
+ parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "prop_with_menu", "rna_uiItemR_with_menu");
+ api_ui_item_rna_common(func);
+ api_ui_item_common(func);
+ RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
+ parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "prop_tabs_enum", "rna_uiItemTabsEnumR");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "icon_only", false, "", "Draw only icons in tabs, no text");
+
+ func = RNA_def_function(srna, "prop_enum", "rna_uiItemEnumR_string");
+ api_ui_item_rna_common(func);
+ parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ api_ui_item_common(func);
+
+ func = RNA_def_function(srna, "prop_search", "rna_uiItemPointerR");
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(
+ func, "search_data", "AnyType", "", "Data from which to take collection to search in");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "search_property", NULL, 0, "", "Identifier of search collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ api_ui_item_common(func);
+
+ for (int is_menu_hold = 0; is_menu_hold < 2; is_menu_hold++) {
+ func = (is_menu_hold) ? RNA_def_function(srna, "operator_menu_hold", "rna_uiItemOMenuHold") :
+ RNA_def_function(srna, "operator", "rna_uiItemO");
+ api_ui_item_op_common(func);
+ RNA_def_boolean(func, "emboss", true, "", "Draw the button itself, not just the icon/text");
+ RNA_def_boolean(func, "depress", false, "", "Draw pressed in");
+ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
+ if (is_menu_hold) {
+ parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ }
+ parm = RNA_def_pointer(
+ func, "properties", "OperatorProperties", "", "Operator properties to fill in");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+ RNA_def_function_ui_description(func,
+ "Item. Places a button into the layout to call an Operator");
+ }
+
+ func = RNA_def_function(srna, "operator_enum", "uiItemsEnumO");
+ parm = RNA_def_string(func, "operator", NULL, 0, "", "Identifier of the operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ api_ui_item_common(func);
+
+ /* useful in C but not in python */
+# if 0
+
+ func = RNA_def_function(srna, "operator_enum_single", "uiItemEnumO_string");
+ api_ui_item_op_common(func);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "value", NULL, 0, "", "Enum property value");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "operator_boolean", "uiItemBooleanO");
+ api_ui_item_op_common(func);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "value", false, "", "Value of the property to call the operator with");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
+
+ func = RNA_def_function(srna, "operator_int", "uiItemIntO");
+ api_ui_item_op_common(func);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "value", 0, INT_MIN, INT_MAX, "",
+ "Value of the property to call the operator with", INT_MIN, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
+
+ func = RNA_def_function(srna, "operator_float", "uiItemFloatO");
+ api_ui_item_op_common(func);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_float(func, "value", 0, -FLT_MAX, FLT_MAX, "",
+ "Value of the property to call the operator with", -FLT_MAX, FLT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); */
+
+ func = RNA_def_function(srna, "operator_string", "uiItemStringO");
+ api_ui_item_op_common(func);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "value", NULL, 0, "", "Value of the property to call the operator with");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+# endif
+
+ func = RNA_def_function(srna, "label", "rna_uiItemL");
+ RNA_def_function_ui_description(func, "Item. Displays text and/or icon in the layout");
+ api_ui_item_common(func);
+ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
+
+ func = RNA_def_function(srna, "menu", "rna_uiItemM");
+ parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
+ api_ui_item_common(func);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
+
+ func = RNA_def_function(srna, "menu_contents", "rna_uiItemM_contents");
+ parm = RNA_def_string(func, "menu", NULL, 0, "", "Identifier of the menu");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "popover", "rna_uiItemPopoverPanel");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "panel", NULL, 0, "", "Identifier of the panel");
+ api_ui_item_common(func);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "icon_value", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_ui_text(parm, "Icon Value", "Override automatic icon of the item");
+
+ func = RNA_def_function(srna, "popover_group", "rna_uiItemPopoverPanelFromGroup");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_enum(func, "space_type", rna_enum_space_type_items, 0, "Space Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(
+ func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "context", NULL, 0, "", "panel type context");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "category", NULL, 0, "", "panel type category");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "separator", "uiItemS_ex");
+ RNA_def_function_ui_description(func, "Item. Inserts empty space into the layout between items");
+ RNA_def_float(func,
+ "factor",
+ 1.0f,
+ 0.0f,
+ FLT_MAX,
+ "Percentage",
+ "Percentage of width to space (leave unset for default space)",
+ 0.0f,
+ FLT_MAX);
+
+ func = RNA_def_function(srna, "separator_spacer", "uiItemSpacer");
+ RNA_def_function_ui_description(
+ func, "Item. Inserts horizontal spacing empty space into the layout between items");
+
+ /* context */
+ func = RNA_def_function(srna, "context_pointer_set", "uiLayoutSetContextPointer");
+ parm = RNA_def_string(func, "name", NULL, 0, "Name", "Name of entry in the context");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Pointer to put in context");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+
+ /* templates */
+ func = RNA_def_function(srna, "template_header", "uiTemplateHeader");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Inserts common Space header UI (editor type selector)");
+
+ func = RNA_def_function(srna, "template_ID", "uiTemplateID");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
+ RNA_def_string(
+ func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
+ RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
+ RNA_def_enum(func,
+ "filter",
+ id_template_filter_items,
+ UI_TEMPLATE_ID_FILTER_ALL,
+ "",
+ "Optionally limit the items which can be selected");
+ RNA_def_boolean(func, "live_icon", false, "", "Show preview instead of fixed icon");
+
+ func = RNA_def_function(srna, "template_ID_preview", "uiTemplateIDPreview");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
+ RNA_def_string(
+ func, "open", NULL, 0, "", "Operator identifier to open a file for creating a new ID block");
+ RNA_def_string(func, "unlink", NULL, 0, "", "Operator identifier to unlink the ID block");
+ RNA_def_int(
+ func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
+ RNA_def_int(func,
+ "cols",
+ 0,
+ 0,
+ INT_MAX,
+ "Number of thumbnail preview columns to display",
+ "",
+ 0,
+ INT_MAX);
+ RNA_def_enum(func,
+ "filter",
+ id_template_filter_items,
+ UI_TEMPLATE_ID_FILTER_ALL,
+ "",
+ "Optionally limit the items which can be selected");
+ RNA_def_boolean(func, "hide_buttons", false, "", "Show only list, no buttons");
+
+ func = RNA_def_function(srna, "template_any_ID", "rna_uiTemplateAnyID");
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func,
+ "type_property",
+ NULL,
+ 0,
+ "",
+ "Identifier of property in data giving the type of the ID-blocks to use");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ api_ui_item_common_text(func);
+
+ func = RNA_def_function(srna, "template_ID_tabs", "uiTemplateIDTabs");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_string(func, "new", NULL, 0, "", "Operator identifier to create a new ID block");
+ RNA_def_string(func, "menu", NULL, 0, "", "Context menu identifier");
+ RNA_def_enum(func,
+ "filter",
+ id_template_filter_items,
+ UI_TEMPLATE_ID_FILTER_ALL,
+ "",
+ "Optionally limit the items which can be selected");
+
+ func = RNA_def_function(srna, "template_search", "uiTemplateSearch");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(
+ func, "search_data", "AnyType", "", "Data from which to take collection to search in");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "search_property", NULL, 0, "", "Identifier of search collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(
+ func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection");
+ RNA_def_string(func,
+ "unlink",
+ NULL,
+ 0,
+ "",
+ "Operator identifier to unlink or delete the active "
+ "item from the collection");
+
+ func = RNA_def_function(srna, "template_search_preview", "uiTemplateSearchPreview");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(
+ func, "search_data", "AnyType", "", "Data from which to take collection to search in");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "search_property", NULL, 0, "", "Identifier of search collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(
+ func, "new", NULL, 0, "", "Operator identifier to create a new item for the collection");
+ RNA_def_string(func,
+ "unlink",
+ NULL,
+ 0,
+ "",
+ "Operator identifier to unlink or delete the active "
+ "item from the collection");
+ RNA_def_int(
+ func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
+ RNA_def_int(func,
+ "cols",
+ 0,
+ 0,
+ INT_MAX,
+ "Number of thumbnail preview columns to display",
+ "",
+ 0,
+ INT_MAX);
+
+ func = RNA_def_function(srna, "template_path_builder", "rna_uiTemplatePathBuilder");
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "root", "ID", "", "ID-block from which path is evaluated from");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ api_ui_item_common_text(func);
+
+ func = RNA_def_function(srna, "template_modifier", "uiTemplateModifier");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Generates the UI layout for modifiers");
+ parm = RNA_def_pointer(func, "data", "Modifier", "", "Modifier data");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "template_greasepencil_modifier", "uiTemplateGpencilModifier");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Generates the UI layout for grease pencil modifiers");
+ parm = RNA_def_pointer(func, "data", "GpencilModifier", "", "Modifier data");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "template_shaderfx", "uiTemplateShaderFx");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Generates the UI layout for shader effect");
+ parm = RNA_def_pointer(func, "data", "ShaderFx", "", "Shader data");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "template_greasepencil_color", "uiTemplateGpencilColorPreview");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_int(
+ func, "rows", 0, 0, INT_MAX, "Number of thumbnail preview rows to display", "", 0, INT_MAX);
+ RNA_def_int(func,
+ "cols",
+ 0,
+ 0,
+ INT_MAX,
+ "Number of thumbnail preview columns to display",
+ "",
+ 0,
+ INT_MAX);
+ RNA_def_float(func, "scale", 1.0f, 0.1f, 1.5f, "Scale of the image thumbnails", "", 0.5f, 1.0f);
+ RNA_def_enum(func,
+ "filter",
+ id_template_filter_items,
+ UI_TEMPLATE_ID_FILTER_ALL,
+ "",
+ "Optionally limit the items which can be selected");
+
+ func = RNA_def_function(srna, "template_constraint", "uiTemplateConstraint");
+ RNA_def_function_ui_description(func, "Generates the UI layout for constraints");
+ parm = RNA_def_pointer(func, "data", "Constraint", "", "Constraint data");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "layout", "UILayout", "", "Sub-layout to put items in");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "template_preview", "uiTemplatePreview");
+ RNA_def_function_ui_description(
+ func, "Item. A preview window for materials, textures, lights or worlds");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "id", "ID", "", "ID data-block");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "show_buttons", true, "", "Show preview buttons?");
+ RNA_def_pointer(func, "parent", "ID", "", "ID data-block");
+ RNA_def_pointer(func, "slot", "TextureSlot", "", "Texture slot");
+ RNA_def_string(
+ func,
+ "preview_id",
+ NULL,
+ 0,
+ "",
+ "Identifier of this preview widget, if not set the ID type will be used "
+ "(i.e. all previews of materials without explicit ID will have the same size...)");
+
+ func = RNA_def_function(srna, "template_curve_mapping", "uiTemplateCurveMapping");
+ RNA_def_function_ui_description(
+ func, "Item. A curve mapping widget used for e.g falloff curves for lights");
+ api_ui_item_rna_common(func);
+ RNA_def_enum(func, "type", curve_type_items, 0, "Type", "Type of curves to display");
+ RNA_def_boolean(func, "levels", false, "", "Show black/white levels");
+ RNA_def_boolean(func, "brush", false, "", "Show brush options");
+ RNA_def_boolean(func, "use_negative_slope", false, "", "Use a negative slope by default");
+ RNA_def_boolean(func, "show_tone", false, "", "Show tone options");
+
+ func = RNA_def_function(srna, "template_color_ramp", "uiTemplateColorRamp");
+ RNA_def_function_ui_description(func, "Item. A color ramp widget");
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "expand", false, "", "Expand button to show more detail");
+
+ func = RNA_def_function(srna, "template_icon", "uiTemplateIcon");
+ RNA_def_function_ui_description(func, "Display a large icon");
+ parm = RNA_def_int(func, "icon_value", 0, 0, INT_MAX, "Icon to display", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_float(func,
+ "scale",
+ 1.0f,
+ 1.0f,
+ 100.0f,
+ "Scale",
+ "Scale the icon size (by the button size)",
+ 1.0f,
+ 100.0f);
+
+ func = RNA_def_function(srna, "template_icon_view", "uiTemplateIconView");
+ RNA_def_function_ui_description(func, "Enum. Large widget showing Icon previews");
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "show_labels", false, "", "Show enum label in preview buttons");
+ RNA_def_float(func,
+ "scale",
+ 6.0f,
+ 1.0f,
+ 100.0f,
+ "UI Units",
+ "Scale the button icon size (by the button size)",
+ 1.0f,
+ 100.0f);
+ RNA_def_float(func,
+ "scale_popup",
+ 5.0f,
+ 1.0f,
+ 100.0f,
+ "Scale",
+ "Scale the popup icon size (by the button size)",
+ 1.0f,
+ 100.0f);
+
+ func = RNA_def_function(srna, "template_histogram", "uiTemplateHistogram");
+ RNA_def_function_ui_description(func, "Item. A histogramm widget to analyze imaga data");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_waveform", "uiTemplateWaveform");
+ RNA_def_function_ui_description(func, "Item. A waveform widget to analyze imaga data");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_vectorscope", "uiTemplateVectorscope");
+ RNA_def_function_ui_description(func, "Item. A vectorscope widget to analyze imaga data");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_layers", "uiTemplateLayers");
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(
+ func, "used_layers_data", "AnyType", "", "Data from which to take property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "used_layers_property", NULL, 0, "", "Identifier of property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "active_layer", 0, 0, INT_MAX, "Active Layer", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "template_color_picker", "uiTemplateColorPicker");
+ RNA_def_function_ui_description(func, "Item. A color wheel widget to pick colors");
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(
+ func, "value_slider", false, "", "Display the value slider to the right of the color wheel");
+ RNA_def_boolean(func,
+ "lock",
+ false,
+ "",
+ "Lock the color wheel display to value 1.0 regardless of actual color");
+ RNA_def_boolean(
+ func, "lock_luminosity", false, "", "Keep the color at its original vector length");
+ RNA_def_boolean(func, "cubic", false, "", "Cubic saturation for picking values close to white");
+
+ func = RNA_def_function(srna, "template_palette", "uiTemplatePalette");
+ RNA_def_function_ui_description(func, "Item. A palette used to pick colors");
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "color", 0, "", "Display the colors as colors or values");
+
+ func = RNA_def_function(srna, "template_image_layers", "uiTemplateImageLayers");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "image", "Image", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "template_image", "uiTemplateImage");
+ RNA_def_function_ui_description(
+ func, "Item(s). User interface for selecting images and their source paths");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(func, "image_user", "ImageUser", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
+ RNA_def_boolean(func, "multiview", false, "", "Expose Multi-View options");
+
+ func = RNA_def_function(srna, "template_image_settings", "uiTemplateImageSettings");
+ RNA_def_function_ui_description(func, "User interface for setting image format options");
+ parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_boolean(func, "color_management", false, "", "Show color management settings");
+
+ func = RNA_def_function(srna, "template_image_stereo_3d", "uiTemplateImageStereo3d");
+ RNA_def_function_ui_description(func, "User interface for setting image stereo 3d options");
+ parm = RNA_def_pointer(func, "stereo_3d_format", "Stereo3dFormat", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "template_image_views", "uiTemplateImageViews");
+ RNA_def_function_ui_description(func, "User interface for setting image views output options");
+ parm = RNA_def_pointer(func, "image_settings", "ImageFormatSettings", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "template_movieclip", "uiTemplateMovieClip");
+ RNA_def_function_ui_description(
+ func, "Item(s). User interface for selecting movie clips and their source paths");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
+
+ func = RNA_def_function(srna, "template_track", "uiTemplateTrack");
+ RNA_def_function_ui_description(func, "Item. A movie-track widget to preview tracking image.");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_marker", "uiTemplateMarker");
+ RNA_def_function_ui_description(func, "Item. A widget to control single marker settings.");
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_pointer(func, "track", "MovieTrackingTrack", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_boolean(func, "compact", false, "", "Use more compact layout");
+
+ func = RNA_def_function(
+ srna, "template_movieclip_information", "uiTemplateMovieclipInformation");
+ RNA_def_function_ui_description(func, "Item. Movie clip information data.");
+ api_ui_item_rna_common(func);
+ parm = RNA_def_pointer(func, "clip_user", "MovieClipUser", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "template_list", "uiTemplateList");
+ RNA_def_function_ui_description(func, "Item. A list widget to display data, e.g. vertexgroups.");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "listtype_name", NULL, 0, "", "Identifier of the list type to use");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(
+ func,
+ "list_id",
+ NULL,
+ 0,
+ "",
+ "Identifier of this list widget (mandatory when using default \"" UI_UL_DEFAULT_CLASS_NAME
+ "\" class). "
+ "If this not an empty string, the uilist gets a custom ID, otherwise it takes the "
+ "name of the class used to define the uilist (for example, if the "
+ "class name is \"OBJECT_UL_vgroups\", and list_id is not set by the "
+ "script, then bl_idname = \"OBJECT_UL_vgroups\")");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "dataptr", "AnyType", "", "Data from which to take the Collection property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func, "propname", NULL, 0, "", "Identifier of the Collection property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func,
+ "active_dataptr",
+ "AnyType",
+ "",
+ "Data from which to take the integer property, index of the active item");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(
+ func,
+ "active_propname",
+ NULL,
+ 0,
+ "",
+ "Identifier of the integer property in active_data, index of the active item");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(func,
+ "item_dyntip_propname",
+ NULL,
+ 0,
+ "",
+ "Identifier of a string property in items, to use as tooltip content");
+ RNA_def_int(func,
+ "rows",
+ 5,
+ 0,
+ INT_MAX,
+ "",
+ "Default and minimum number of rows to display",
+ 0,
+ INT_MAX);
+ RNA_def_int(
+ func, "maxrows", 5, 0, INT_MAX, "", "Default maximum number of rows to display", 0, INT_MAX);
+ RNA_def_enum(func,
+ "type",
+ rna_enum_uilist_layout_type_items,
+ UILST_LAYOUT_DEFAULT,
+ "Type",
+ "Type of layout to use");
+ RNA_def_int(func,
+ "columns",
+ 9,
+ 0,
+ INT_MAX,
+ "",
+ "Number of items to display per row, for GRID layout",
+ 0,
+ INT_MAX);
+ RNA_def_boolean(func, "sort_reverse", false, "", "Display items in reverse order by default");
+ RNA_def_boolean(func, "sort_lock", false, "", "Lock display order to default value");
+
+ func = RNA_def_function(srna, "template_running_jobs", "uiTemplateRunningJobs");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ RNA_def_function(srna, "template_operator_search", "uiTemplateOperatorSearch");
+
+ func = RNA_def_function(srna, "template_header_3D_mode", "uiTemplateHeader3D_mode");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "");
+
+ func = RNA_def_function(srna, "template_edit_mode_selection", "uiTemplateEditModeSelection");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(
+ func, "Inserts common 3DView Edit modes header UI (selector for selection mode)");
+
+ func = RNA_def_function(srna, "template_reports_banner", "uiTemplateReportsBanner");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ func = RNA_def_function(srna, "template_input_status", "uiTemplateInputStatus");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ func = RNA_def_function(srna, "template_node_link", "uiTemplateNodeLink");
+ parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "node", "Node", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "template_node_view", "uiTemplateNodeView");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "ntree", "NodeTree", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "node", "Node", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "socket", "NodeSocket", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "template_texture_user", "uiTemplateTextureUser");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+
+ func = RNA_def_function(
+ srna, "template_keymap_item_properties", "uiTemplateKeymapItemProperties");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+
+ func = RNA_def_function(srna, "template_component_menu", "uiTemplateComponentMenu");
+ RNA_def_function_ui_description(func, "Item. Display expanded property in a popup menu");
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_string(func, "name", NULL, 0, "", "");
+
+ /* color management templates */
+ func = RNA_def_function(srna, "template_colorspace_settings", "uiTemplateColorspaceSettings");
+ RNA_def_function_ui_description(func, "Item. A widget to control input color space settings.");
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(
+ srna, "template_colormanaged_view_settings", "uiTemplateColormanagedViewSettings");
+ RNA_def_function_ui_description(
+ func, "Item. A widget to control color managed view settings settings.");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+ /* RNA_def_boolean(func, "show_global_settings", false, "", "Show widgets to control global color management settings"); */
+
+ /* node socket icon */
+ func = RNA_def_function(srna, "template_node_socket", "uiTemplateNodeSocket");
+ RNA_def_function_ui_description(func, "Node Socket Icon");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_float_array(
+ func, "color", 4, node_socket_color_default, 0.0f, 1.0f, "Color", "", 0.0f, 1.0f);
+
+ func = RNA_def_function(srna, "template_cache_file", "uiTemplateCacheFile");
+ RNA_def_function_ui_description(
+ func, "Item(s). User interface for selecting cache files and their source paths");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ api_ui_item_rna_common(func);
+
+ func = RNA_def_function(srna, "template_recent_files", "uiTemplateRecentFiles");
+ RNA_def_function_ui_description(func, "Show list of recently saved .blend files");
+ RNA_def_int(func, "rows", 5, 1, INT_MAX, "", "Maximum number of items to show", 1, INT_MAX);
+ parm = RNA_def_int(func, "found", 0, 0, INT_MAX, "", "Number of items drawn", 0, INT_MAX);
+ RNA_def_function_return(func, parm);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index da41134f4ab..5a017e96fa7 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -51,745 +51,789 @@
#ifdef WITH_OPENSUBDIV
static const EnumPropertyItem opensubdiv_compute_type_items[] = {
- {USER_OPENSUBDIV_COMPUTE_NONE, "NONE", 0, "None", ""},
- {USER_OPENSUBDIV_COMPUTE_CPU, "CPU", 0, "CPU", ""},
- {USER_OPENSUBDIV_COMPUTE_OPENMP, "OPENMP", 0, "OpenMP", ""},
- {USER_OPENSUBDIV_COMPUTE_OPENCL, "OPENCL", 0, "OpenCL", ""},
- {USER_OPENSUBDIV_COMPUTE_CUDA, "CUDA", 0, "CUDA", ""},
- {USER_OPENSUBDIV_COMPUTE_GLSL_TRANSFORM_FEEDBACK, "GLSL_TRANSFORM_FEEDBACK", 0, "GLSL Transform Feedback", ""},
- {USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE, "GLSL_COMPUTE", 0, "GLSL Compute", ""},
- {0, NULL, 0, NULL, NULL},
+ {USER_OPENSUBDIV_COMPUTE_NONE, "NONE", 0, "None", ""},
+ {USER_OPENSUBDIV_COMPUTE_CPU, "CPU", 0, "CPU", ""},
+ {USER_OPENSUBDIV_COMPUTE_OPENMP, "OPENMP", 0, "OpenMP", ""},
+ {USER_OPENSUBDIV_COMPUTE_OPENCL, "OPENCL", 0, "OpenCL", ""},
+ {USER_OPENSUBDIV_COMPUTE_CUDA, "CUDA", 0, "CUDA", ""},
+ {USER_OPENSUBDIV_COMPUTE_GLSL_TRANSFORM_FEEDBACK,
+ "GLSL_TRANSFORM_FEEDBACK",
+ 0,
+ "GLSL Transform Feedback",
+ ""},
+ {USER_OPENSUBDIV_COMPUTE_GLSL_COMPUTE, "GLSL_COMPUTE", 0, "GLSL Compute", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem audio_device_items[] = {
- {0, "Null", 0, "None", "Null device - there will be no audio output"},
- {0, NULL, 0, NULL, NULL},
+ {0, "Null", 0, "None", "Null device - there will be no audio output"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_navigation_mode_items[] = {
- {VIEW_NAVIGATION_WALK, "WALK", 0, "Walk", "Interactively walk or free navigate around the scene"},
- {VIEW_NAVIGATION_FLY, "FLY", 0, "Fly", "Use fly dynamics to navigate the scene"},
- {0, NULL, 0, NULL, NULL},
+ {VIEW_NAVIGATION_WALK,
+ "WALK",
+ 0,
+ "Walk",
+ "Interactively walk or free navigate around the scene"},
+ {VIEW_NAVIGATION_FLY, "FLY", 0, "Fly", "Use fly dynamics to navigate the scene"},
+ {0, NULL, 0, NULL, NULL},
};
-
#if defined(WITH_INTERNATIONAL) || !defined(RNA_RUNTIME)
static const EnumPropertyItem rna_enum_language_default_items[] = {
- {0, "DEFAULT", 0, "Automatic (Automatic)",
- "Automatically choose system's defined language if available, or fall-back to English"},
- {0, NULL, 0, NULL, NULL},
+ {0,
+ "DEFAULT",
+ 0,
+ "Automatic (Automatic)",
+ "Automatically choose system's defined language if available, or fall-back to English"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
static const EnumPropertyItem rna_enum_studio_light_type_items[] = {
- {STUDIOLIGHT_TYPE_STUDIO, "STUDIO", 0, "Studio", ""},
- {STUDIOLIGHT_TYPE_WORLD, "WORLD", 0, "World", ""},
- {STUDIOLIGHT_TYPE_MATCAP, "MATCAP", 0, "MatCap", ""},
- {0, NULL, 0, NULL, NULL},
+ {STUDIOLIGHT_TYPE_STUDIO, "STUDIO", 0, "Studio", ""},
+ {STUDIOLIGHT_TYPE_WORLD, "WORLD", 0, "World", ""},
+ {STUDIOLIGHT_TYPE_MATCAP, "MATCAP", 0, "MatCap", ""},
+ {0, NULL, 0, NULL, NULL},
};
-
#ifdef RNA_RUNTIME
-#include "BLI_math_vector.h"
+# include "BLI_math_vector.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
+# include "DNA_object_types.h"
+# include "DNA_screen_types.h"
-#include "BKE_blender.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
-#include "BKE_main.h"
-#include "BKE_mesh_runtime.h"
-#include "BKE_pbvh.h"
-#include "BKE_paint.h"
-#include "BKE_screen.h"
+# include "BKE_blender.h"
+# include "BKE_global.h"
+# include "BKE_idprop.h"
+# include "BKE_main.h"
+# include "BKE_mesh_runtime.h"
+# include "BKE_pbvh.h"
+# include "BKE_paint.h"
+# include "BKE_screen.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "GPU_draw.h"
-#include "GPU_select.h"
+# include "GPU_draw.h"
+# include "GPU_select.h"
-#include "BLF_api.h"
+# include "BLF_api.h"
-#include "MEM_guardedalloc.h"
-#include "MEM_CacheLimiterC-Api.h"
+# include "MEM_guardedalloc.h"
+# include "MEM_CacheLimiterC-Api.h"
-#include "UI_interface.h"
+# include "UI_interface.h"
-#ifdef WITH_OPENSUBDIV
-# include "opensubdiv_capi.h"
-#endif
-
-#ifdef WITH_SDL_DYNLOAD
-# include "sdlew.h"
-#endif
+# ifdef WITH_OPENSUBDIV
+# include "opensubdiv_capi.h"
+# endif
+# ifdef WITH_SDL_DYNLOAD
+# include "sdlew.h"
+# endif
static void rna_userdef_version_get(PointerRNA *ptr, int *value)
{
- UserDef *userdef = (UserDef *)ptr->data;
- value[0] = userdef->versionfile / 100;
- value[1] = userdef->versionfile % 100;
- value[2] = userdef->subversionfile;
+ UserDef *userdef = (UserDef *)ptr->data;
+ value[0] = userdef->versionfile / 100;
+ value[1] = userdef->versionfile % 100;
+ value[2] = userdef->subversionfile;
}
static void rna_userdef_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
- WM_main_add_notifier(NC_WINDOW, NULL);
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
static void rna_userdef_theme_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- /* Recreate gizmos when changing themes. */
- WM_reinit_gizmomap_all(bmain);
+ /* Recreate gizmos when changing themes. */
+ WM_reinit_gizmomap_all(bmain);
- rna_userdef_update(bmain, scene, ptr);
+ rna_userdef_update(bmain, scene, ptr);
}
/* also used by buffer swap switching */
-static void rna_userdef_dpi_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_dpi_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- /* font's are stored at each DPI level, without this we can easy load 100's of fonts */
- BLF_cache_clear();
+ /* font's are stored at each DPI level, without this we can easy load 100's of fonts */
+ BLF_cache_clear();
- WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
+ WM_main_add_notifier(NC_WINDOW, NULL); /* full redraw */
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
}
-static void rna_userdef_update_ui(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_update_ui(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_main_add_notifier(NC_WINDOW, NULL);
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL); /* refresh region sizes */
}
static void rna_userdef_update_ui_header_default(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- if (U.uiflag & USER_HEADER_FROM_PREF) {
- for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
- BKE_screen_header_alignment_reset(screen);
- }
- rna_userdef_update_ui(bmain, scene, ptr);
- }
+ if (U.uiflag & USER_HEADER_FROM_PREF) {
+ for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
+ BKE_screen_header_alignment_reset(screen);
+ }
+ rna_userdef_update_ui(bmain, scene, ptr);
+ }
}
-static void rna_userdef_language_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_language_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- BLF_cache_clear();
- BLT_lang_set(NULL);
- UI_reinit_font();
+ BLF_cache_clear();
+ BLT_lang_set(NULL);
+ UI_reinit_font();
}
-static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- UserDef *userdef = (UserDef *)ptr->data;
- if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE) G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
- else G.f |= G_FLAG_SCRIPT_AUTOEXEC;
+ UserDef *userdef = (UserDef *)ptr->data;
+ if (userdef->flag & USER_SCRIPT_AUTOEXEC_DISABLE)
+ G.f &= ~G_FLAG_SCRIPT_AUTOEXEC;
+ else
+ G.f |= G_FLAG_SCRIPT_AUTOEXEC;
}
static void rna_userdef_load_ui_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- UserDef *userdef = (UserDef *)ptr->data;
- if (userdef->flag & USER_FILENOUI) G.fileflags |= G_FILE_NO_UI;
- else G.fileflags &= ~G_FILE_NO_UI;
+ UserDef *userdef = (UserDef *)ptr->data;
+ if (userdef->flag & USER_FILENOUI)
+ G.fileflags |= G_FILE_NO_UI;
+ else
+ G.fileflags &= ~G_FILE_NO_UI;
}
static void rna_userdef_anisotropic_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_set_anisotropic(bmain, U.anisotropic_filter);
- rna_userdef_update(bmain, scene, ptr);
+ GPU_set_anisotropic(bmain, U.anisotropic_filter);
+ rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_gl_texture_limit_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- GPU_free_images(bmain);
- rna_userdef_update(bmain, scene, ptr);
+ GPU_free_images(bmain);
+ rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_undo_steps_set(PointerRNA *ptr, int value)
{
- UserDef *userdef = (UserDef *)ptr->data;
+ UserDef *userdef = (UserDef *)ptr->data;
- /* Do not allow 1 undo steps, useless and breaks undo/redo process (see T42531). */
- userdef->undosteps = (value == 1) ? 2 : value;
+ /* Do not allow 1 undo steps, useless and breaks undo/redo process (see T42531). */
+ userdef->undosteps = (value == 1) ? 2 : value;
}
static int rna_userdef_autokeymode_get(PointerRNA *ptr)
{
- UserDef *userdef = (UserDef *)ptr->data;
- short retval = userdef->autokey_mode;
+ UserDef *userdef = (UserDef *)ptr->data;
+ short retval = userdef->autokey_mode;
- if (!(userdef->autokey_mode & AUTOKEY_ON))
- retval |= AUTOKEY_ON;
+ if (!(userdef->autokey_mode & AUTOKEY_ON))
+ retval |= AUTOKEY_ON;
- return retval;
+ return retval;
}
static void rna_userdef_autokeymode_set(PointerRNA *ptr, int value)
{
- UserDef *userdef = (UserDef *)ptr->data;
+ UserDef *userdef = (UserDef *)ptr->data;
- if (value == AUTOKEY_MODE_NORMAL) {
- userdef->autokey_mode |= (AUTOKEY_MODE_NORMAL - AUTOKEY_ON);
- userdef->autokey_mode &= ~(AUTOKEY_MODE_EDITKEYS - AUTOKEY_ON);
- }
- else if (value == AUTOKEY_MODE_EDITKEYS) {
- userdef->autokey_mode |= (AUTOKEY_MODE_EDITKEYS - AUTOKEY_ON);
- userdef->autokey_mode &= ~(AUTOKEY_MODE_NORMAL - AUTOKEY_ON);
- }
+ if (value == AUTOKEY_MODE_NORMAL) {
+ userdef->autokey_mode |= (AUTOKEY_MODE_NORMAL - AUTOKEY_ON);
+ userdef->autokey_mode &= ~(AUTOKEY_MODE_EDITKEYS - AUTOKEY_ON);
+ }
+ else if (value == AUTOKEY_MODE_EDITKEYS) {
+ userdef->autokey_mode |= (AUTOKEY_MODE_EDITKEYS - AUTOKEY_ON);
+ userdef->autokey_mode &= ~(AUTOKEY_MODE_NORMAL - AUTOKEY_ON);
+ }
}
-static void rna_userdef_tablet_api_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_tablet_api_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_init_tablet_api();
+ WM_init_tablet_api();
}
-#ifdef WITH_INPUT_NDOF
-static void rna_userdef_ndof_deadzone_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+# ifdef WITH_INPUT_NDOF
+static void rna_userdef_ndof_deadzone_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- UserDef *userdef = ptr->data;
- WM_ndof_deadzone_set(userdef->ndof_deadzone);
+ UserDef *userdef = ptr->data;
+ WM_ndof_deadzone_set(userdef->ndof_deadzone);
}
-#endif
+# endif
-static void rna_userdef_keyconfig_reload_update(bContext *C, Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_keyconfig_reload_update(bContext *C,
+ Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_keyconfig_reload(C);
+ WM_keyconfig_reload(C);
}
static void rna_userdef_timecode_style_set(PointerRNA *ptr, int value)
{
- UserDef *userdef = (UserDef *)ptr->data;
- int required_size = userdef->v2d_min_gridsize;
-
- /* set the timecode style */
- userdef->timecode_style = value;
-
- /* adjust the v2d gridsize if needed so that timecodes don't overlap
- * NOTE: most of these have been hand-picked to avoid overlaps while still keeping
- * things from getting too blown out
- */
- switch (value) {
- case USER_TIMECODE_MINIMAL:
- case USER_TIMECODE_SECONDS_ONLY:
- /* 35 is great most of the time, but not that great for full-blown */
- required_size = 35;
- break;
- case USER_TIMECODE_SMPTE_MSF:
- required_size = 50;
- break;
- case USER_TIMECODE_SMPTE_FULL:
- /* the granddaddy! */
- required_size = 65;
- break;
- case USER_TIMECODE_MILLISECONDS:
- required_size = 45;
- break;
- }
-
- if (U.v2d_min_gridsize < required_size)
- U.v2d_min_gridsize = required_size;
+ UserDef *userdef = (UserDef *)ptr->data;
+ int required_size = userdef->v2d_min_gridsize;
+
+ /* set the timecode style */
+ userdef->timecode_style = value;
+
+ /* adjust the v2d gridsize if needed so that timecodes don't overlap
+ * NOTE: most of these have been hand-picked to avoid overlaps while still keeping
+ * things from getting too blown out
+ */
+ switch (value) {
+ case USER_TIMECODE_MINIMAL:
+ case USER_TIMECODE_SECONDS_ONLY:
+ /* 35 is great most of the time, but not that great for full-blown */
+ required_size = 35;
+ break;
+ case USER_TIMECODE_SMPTE_MSF:
+ required_size = 50;
+ break;
+ case USER_TIMECODE_SMPTE_FULL:
+ /* the granddaddy! */
+ required_size = 65;
+ break;
+ case USER_TIMECODE_MILLISECONDS:
+ required_size = 45;
+ break;
+ }
+
+ if (U.v2d_min_gridsize < required_size)
+ U.v2d_min_gridsize = required_size;
}
static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_PreferencesView, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_PreferencesView, ptr->data);
}
static PointerRNA rna_UserDef_edit_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_PreferencesEdit, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_PreferencesEdit, ptr->data);
}
static PointerRNA rna_UserDef_input_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_PreferencesInput, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_PreferencesInput, ptr->data);
}
static PointerRNA rna_UserDef_keymap_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_PreferencesKeymap, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_PreferencesKeymap, ptr->data);
}
static PointerRNA rna_UserDef_filepaths_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_PreferencesFilePaths, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_PreferencesFilePaths, ptr->data);
}
static PointerRNA rna_UserDef_system_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_PreferencesSystem, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_PreferencesSystem, ptr->data);
}
static void rna_UserDef_audio_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
{
- BKE_sound_init(bmain);
+ BKE_sound_init(bmain);
}
-static void rna_Userdef_memcache_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_Userdef_memcache_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- MEM_CacheLimiter_set_maximum(((size_t) U.memcachelimit) * 1024 * 1024);
+ MEM_CacheLimiter_set_maximum(((size_t)U.memcachelimit) * 1024 * 1024);
}
static void rna_UserDef_weight_color_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- Object *ob;
+ Object *ob;
- for (ob = bmain->objects.first; ob; ob = ob->id.next) {
- if (ob->mode & OB_MODE_WEIGHT_PAINT)
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
+ for (ob = bmain->objects.first; ob; ob = ob->id.next) {
+ if (ob->mode & OB_MODE_WEIGHT_PAINT)
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
- rna_userdef_update(bmain, scene, ptr);
+ rna_userdef_update(bmain, scene, ptr);
}
static void rna_UserDef_viewport_lights_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- /* if all lights are off gpu_draw resets them all, [#27627]
- * so disallow them all to be disabled */
- if (U.light_param[0].flag == 0 &&
- U.light_param[1].flag == 0 &&
- U.light_param[2].flag == 0 &&
- U.light_param[3].flag == 0)
- {
- SolidLight *light = ptr->data;
- light->flag |= 1;
- }
+ /* if all lights are off gpu_draw resets them all, [#27627]
+ * so disallow them all to be disabled */
+ if (U.light_param[0].flag == 0 && U.light_param[1].flag == 0 && U.light_param[2].flag == 0 &&
+ U.light_param[3].flag == 0) {
+ SolidLight *light = ptr->data;
+ light->flag |= 1;
+ }
- WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_GPU, NULL);
- rna_userdef_update(bmain, scene, ptr);
+ WM_main_add_notifier(NC_SPACE | ND_SPACE_VIEW3D | NS_VIEW3D_GPU, NULL);
+ rna_userdef_update(bmain, scene, ptr);
}
static void rna_userdef_autosave_update(Main *bmain, Scene *scene, PointerRNA *ptr)
{
- wmWindowManager *wm = bmain->wm.first;
+ wmWindowManager *wm = bmain->wm.first;
- if (wm)
- WM_autosave_init(wm);
- rna_userdef_update(bmain, scene, ptr);
+ if (wm)
+ WM_autosave_init(wm);
+ rna_userdef_update(bmain, scene, ptr);
}
static bAddon *rna_userdef_addon_new(void)
{
- ListBase *addons_list = &U.addons;
- bAddon *addon = BKE_addon_new();
- BLI_addtail(addons_list, addon);
- return addon;
+ ListBase *addons_list = &U.addons;
+ bAddon *addon = BKE_addon_new();
+ BLI_addtail(addons_list, addon);
+ return addon;
}
static void rna_userdef_addon_remove(ReportList *reports, PointerRNA *addon_ptr)
{
- ListBase *addons_list = &U.addons;
- bAddon *addon = addon_ptr->data;
- if (BLI_findindex(addons_list, addon) == -1) {
- BKE_report(reports, RPT_ERROR, "Add-on is no longer valid");
- return;
- }
- BLI_remlink(addons_list, addon);
- BKE_addon_free(addon);
- RNA_POINTER_INVALIDATE(addon_ptr);
+ ListBase *addons_list = &U.addons;
+ bAddon *addon = addon_ptr->data;
+ if (BLI_findindex(addons_list, addon) == -1) {
+ BKE_report(reports, RPT_ERROR, "Add-on is no longer valid");
+ return;
+ }
+ BLI_remlink(addons_list, addon);
+ BKE_addon_free(addon);
+ RNA_POINTER_INVALIDATE(addon_ptr);
}
static bPathCompare *rna_userdef_pathcompare_new(void)
{
- bPathCompare *path_cmp = MEM_callocN(sizeof(bPathCompare), "bPathCompare");
- BLI_addtail(&U.autoexec_paths, path_cmp);
- return path_cmp;
+ bPathCompare *path_cmp = MEM_callocN(sizeof(bPathCompare), "bPathCompare");
+ BLI_addtail(&U.autoexec_paths, path_cmp);
+ return path_cmp;
}
static void rna_userdef_pathcompare_remove(ReportList *reports, PointerRNA *path_cmp_ptr)
{
- bPathCompare *path_cmp = path_cmp_ptr->data;
- if (BLI_findindex(&U.autoexec_paths, path_cmp) == -1) {
- BKE_report(reports, RPT_ERROR, "Excluded path is no longer valid");
- return;
- }
+ bPathCompare *path_cmp = path_cmp_ptr->data;
+ if (BLI_findindex(&U.autoexec_paths, path_cmp) == -1) {
+ BKE_report(reports, RPT_ERROR, "Excluded path is no longer valid");
+ return;
+ }
- BLI_freelinkN(&U.autoexec_paths, path_cmp);
- RNA_POINTER_INVALIDATE(path_cmp_ptr);
+ BLI_freelinkN(&U.autoexec_paths, path_cmp);
+ RNA_POINTER_INVALIDATE(path_cmp_ptr);
}
-static void rna_userdef_temp_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_temp_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- BKE_tempdir_init(U.tempdir);
+ BKE_tempdir_init(U.tempdir);
}
-static void rna_userdef_text_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_text_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- BLF_cache_clear();
- UI_reinit_font();
- WM_main_add_notifier(NC_WINDOW, NULL);
+ BLF_cache_clear();
+ UI_reinit_font();
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
static PointerRNA rna_Theme_space_generic_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGeneric, ptr->data);
}
static PointerRNA rna_Theme_gradient_colors_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ThemeGradientColors, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_ThemeGradientColors, ptr->data);
}
static PointerRNA rna_Theme_space_gradient_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGradient, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceGradient, ptr->data);
}
static PointerRNA rna_Theme_space_list_generic_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceListGeneric, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_ThemeSpaceListGeneric, ptr->data);
}
-
-#ifdef WITH_OPENSUBDIV
-static const EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+# ifdef WITH_OPENSUBDIV
+static const EnumPropertyItem *rna_userdef_opensubdiv_compute_type_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- EnumPropertyItem *item = NULL;
- int totitem = 0;
- int evaluators = openSubdiv_getAvailableEvaluators();
+ EnumPropertyItem *item = NULL;
+ int totitem = 0;
+ int evaluators = openSubdiv_getAvailableEvaluators();
- RNA_enum_items_add_value(&item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_NONE);
+ RNA_enum_items_add_value(
+ &item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_NONE);
-#define APPEND_COMPUTE(compute) \
- if (evaluators & OPENSUBDIV_EVALUATOR_## compute) { \
- RNA_enum_items_add_value(&item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_ ## compute); \
- } ((void)0)
+# define APPEND_COMPUTE(compute) \
+ if (evaluators & OPENSUBDIV_EVALUATOR_##compute) { \
+ RNA_enum_items_add_value( \
+ &item, &totitem, opensubdiv_compute_type_items, USER_OPENSUBDIV_COMPUTE_##compute); \
+ } \
+ ((void)0)
- APPEND_COMPUTE(CPU);
- APPEND_COMPUTE(OPENMP);
- APPEND_COMPUTE(OPENCL);
- APPEND_COMPUTE(CUDA);
- APPEND_COMPUTE(GLSL_TRANSFORM_FEEDBACK);
- APPEND_COMPUTE(GLSL_COMPUTE);
+ APPEND_COMPUTE(CPU);
+ APPEND_COMPUTE(OPENMP);
+ APPEND_COMPUTE(OPENCL);
+ APPEND_COMPUTE(CUDA);
+ APPEND_COMPUTE(GLSL_TRANSFORM_FEEDBACK);
+ APPEND_COMPUTE(GLSL_COMPUTE);
-#undef APPEND_COMPUTE
+# undef APPEND_COMPUTE
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
-static void rna_userdef_opensubdiv_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_userdef_opensubdiv_update(Main *bmain,
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- Object *object;
+ Object *object;
- for (object = bmain->objects.first;
- object;
- object = object->id.next)
- {
- DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM);
- }
+ for (object = bmain->objects.first; object; object = object->id.next) {
+ DEG_id_tag_update(&object->id, ID_RECALC_TRANSFORM);
+ }
}
-#endif
+# endif
-static const EnumPropertyItem *rna_userdef_audio_device_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *r_free)
+static const EnumPropertyItem *rna_userdef_audio_device_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *r_free)
{
- int index = 0;
- int totitem = 0;
- EnumPropertyItem *item = NULL;
+ int index = 0;
+ int totitem = 0;
+ EnumPropertyItem *item = NULL;
- int i;
+ int i;
- char **names = BKE_sound_get_device_names();
+ char **names = BKE_sound_get_device_names();
- for (i = 0; names[i]; i++) {
- EnumPropertyItem new_item = {i, names[i], 0, names[i], names[i]};
- RNA_enum_item_add(&item, &totitem, &new_item);
- }
+ for (i = 0; names[i]; i++) {
+ EnumPropertyItem new_item = {i, names[i], 0, names[i], names[i]};
+ RNA_enum_item_add(&item, &totitem, &new_item);
+ }
-#ifndef NDEBUG
- if (i == 0) {
- EnumPropertyItem new_item = {i, "SOUND_NONE", 0, "No Sound", ""};
- RNA_enum_item_add(&item, &totitem, &new_item);
- }
-#endif
+# ifndef NDEBUG
+ if (i == 0) {
+ EnumPropertyItem new_item = {i, "SOUND_NONE", 0, "No Sound", ""};
+ RNA_enum_item_add(&item, &totitem, &new_item);
+ }
+# endif
- /* may be unused */
- UNUSED_VARS(index, audio_device_items);
+ /* may be unused */
+ UNUSED_VARS(index, audio_device_items);
- RNA_enum_item_end(&item, &totitem);
- *r_free = true;
+ RNA_enum_item_end(&item, &totitem);
+ *r_free = true;
- return item;
+ return item;
}
-#ifdef WITH_INTERNATIONAL
-static const EnumPropertyItem *rna_lang_enum_properties_itemf(
- bContext *UNUSED(C), PointerRNA *UNUSED(ptr),
- PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+# ifdef WITH_INTERNATIONAL
+static const EnumPropertyItem *rna_lang_enum_properties_itemf(bContext *UNUSED(C),
+ PointerRNA *UNUSED(ptr),
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- const EnumPropertyItem *items = BLT_lang_RNA_enum_properties();
- if (items == NULL) {
- items = rna_enum_language_default_items;
- }
- return items;
+ const EnumPropertyItem *items = BLT_lang_RNA_enum_properties();
+ if (items == NULL) {
+ items = rna_enum_language_default_items;
+ }
+ return items;
}
-#endif
+# endif
static IDProperty *rna_AddonPref_idprops(PointerRNA *ptr, bool create)
{
- if (create && !ptr->data) {
- IDPropertyTemplate val = {0};
- ptr->data = IDP_New(IDP_GROUP, &val, "RNA_AddonPreferences group");
- }
+ if (create && !ptr->data) {
+ IDPropertyTemplate val = {0};
+ ptr->data = IDP_New(IDP_GROUP, &val, "RNA_AddonPreferences group");
+ }
- return ptr->data;
+ return ptr->data;
}
static PointerRNA rna_Addon_preferences_get(PointerRNA *ptr)
{
- bAddon *addon = (bAddon *)ptr->data;
- bAddonPrefType *apt = BKE_addon_pref_type_find(addon->module, true);
- if (apt) {
- if (addon->prop == NULL) {
- IDPropertyTemplate val = {0};
- addon->prop = IDP_New(IDP_GROUP, &val, addon->module); /* name is unimportant */
- }
- return rna_pointer_inherit_refine(ptr, apt->ext.srna, addon->prop);
- }
- else {
- return PointerRNA_NULL;
- }
+ bAddon *addon = (bAddon *)ptr->data;
+ bAddonPrefType *apt = BKE_addon_pref_type_find(addon->module, true);
+ if (apt) {
+ if (addon->prop == NULL) {
+ IDPropertyTemplate val = {0};
+ addon->prop = IDP_New(IDP_GROUP, &val, addon->module); /* name is unimportant */
+ }
+ return rna_pointer_inherit_refine(ptr, apt->ext.srna, addon->prop);
+ }
+ else {
+ return PointerRNA_NULL;
+ }
}
static void rna_AddonPref_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- bAddonPrefType *apt = RNA_struct_blender_type_get(type);
+ bAddonPrefType *apt = RNA_struct_blender_type_get(type);
- if (!apt)
- return;
+ if (!apt)
+ return;
- RNA_struct_free_extension(type, &apt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &apt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- BKE_addon_pref_type_remove(apt);
+ BKE_addon_pref_type_remove(apt);
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
-static StructRNA *rna_AddonPref_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_AddonPref_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- bAddonPrefType *apt, dummy_apt = {{'\0'}};
- bAddon dummy_addon = {NULL};
- PointerRNA dummy_ptr;
- // int have_function[1];
+ bAddonPrefType *apt, dummy_apt = {{'\0'}};
+ bAddon dummy_addon = {NULL};
+ PointerRNA dummy_ptr;
+ // int have_function[1];
- /* setup dummy addon-pref & addon-pref type to store static properties in */
- RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_ptr);
+ /* setup dummy addon-pref & addon-pref type to store static properties in */
+ RNA_pointer_create(NULL, &RNA_AddonPreferences, &dummy_addon, &dummy_ptr);
- /* validate the python class */
- if (validate(&dummy_ptr, data, NULL /* have_function */ ) != 0)
- return NULL;
+ /* validate the python class */
+ if (validate(&dummy_ptr, data, NULL /* have_function */) != 0)
+ return NULL;
- BLI_strncpy(dummy_apt.idname, dummy_addon.module, sizeof(dummy_apt.idname));
- if (strlen(identifier) >= sizeof(dummy_apt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering add-on preferences class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummy_apt.idname));
- return NULL;
- }
+ BLI_strncpy(dummy_apt.idname, dummy_addon.module, sizeof(dummy_apt.idname));
+ if (strlen(identifier) >= sizeof(dummy_apt.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering add-on preferences class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummy_apt.idname));
+ return NULL;
+ }
- /* check if we have registered this addon-pref type before, and remove it */
- apt = BKE_addon_pref_type_find(dummy_addon.module, true);
- if (apt && apt->ext.srna) {
- rna_AddonPref_unregister(bmain, apt->ext.srna);
- }
+ /* check if we have registered this addon-pref type before, and remove it */
+ apt = BKE_addon_pref_type_find(dummy_addon.module, true);
+ if (apt && apt->ext.srna) {
+ rna_AddonPref_unregister(bmain, apt->ext.srna);
+ }
- /* create a new addon-pref type */
- apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype");
- memcpy(apt, &dummy_apt, sizeof(dummy_apt));
- BKE_addon_pref_type_add(apt);
+ /* create a new addon-pref type */
+ apt = MEM_mallocN(sizeof(bAddonPrefType), "addonpreftype");
+ memcpy(apt, &dummy_apt, sizeof(dummy_apt));
+ BKE_addon_pref_type_add(apt);
- apt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_AddonPreferences);
- apt->ext.data = data;
- apt->ext.call = call;
- apt->ext.free = free;
- RNA_struct_blender_type_set(apt->ext.srna, apt);
+ apt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_AddonPreferences);
+ apt->ext.data = data;
+ apt->ext.call = call;
+ apt->ext.free = free;
+ RNA_struct_blender_type_set(apt->ext.srna, apt);
-// apt->draw = (have_function[0]) ? header_draw : NULL;
+ // apt->draw = (have_function[0]) ? header_draw : NULL;
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
- return apt->ext.srna;
+ return apt->ext.srna;
}
/* placeholder, doesn't do anything useful yet */
static StructRNA *rna_AddonPref_refine(PointerRNA *ptr)
{
- return (ptr->type) ? ptr->type : &RNA_AddonPreferences;
+ return (ptr->type) ? ptr->type : &RNA_AddonPreferences;
}
static float rna_ThemeUI_roundness_get(PointerRNA *ptr)
{
- /* Remap from relative radius to 0..1 range. */
- uiWidgetColors *tui = (uiWidgetColors *)ptr->data;
- return tui->roundness * 2.0f;
+ /* Remap from relative radius to 0..1 range. */
+ uiWidgetColors *tui = (uiWidgetColors *)ptr->data;
+ return tui->roundness * 2.0f;
}
static void rna_ThemeUI_roundness_set(PointerRNA *ptr, float value)
{
- uiWidgetColors *tui = (uiWidgetColors *)ptr->data;
- tui->roundness = value * 0.5f;
+ uiWidgetColors *tui = (uiWidgetColors *)ptr->data;
+ tui->roundness = value * 0.5f;
}
/* Studio Light */
-static void rna_UserDef_studiolight_begin(CollectionPropertyIterator *iter, PointerRNA *UNUSED(ptr))
+static void rna_UserDef_studiolight_begin(CollectionPropertyIterator *iter,
+ PointerRNA *UNUSED(ptr))
{
- rna_iterator_listbase_begin(iter, BKE_studiolight_listbase(), NULL);
+ rna_iterator_listbase_begin(iter, BKE_studiolight_listbase(), NULL);
}
static void rna_StudioLights_refresh(UserDef *UNUSED(userdef))
{
- BKE_studiolight_refresh();
+ BKE_studiolight_refresh();
}
static void rna_StudioLights_remove(UserDef *UNUSED(userdef), StudioLight *studio_light)
{
- BKE_studiolight_remove(studio_light);
+ BKE_studiolight_remove(studio_light);
}
static StudioLight *rna_StudioLights_load(UserDef *UNUSED(userdef), const char *path, int type)
{
- return BKE_studiolight_load(path, type);
+ return BKE_studiolight_load(path, type);
}
/* TODO: Make it accept arguments. */
static StudioLight *rna_StudioLights_new(UserDef *userdef, const char *name)
{
- return BKE_studiolight_create(name, userdef->light_param, userdef->light_ambient);
+ return BKE_studiolight_create(name, userdef->light_param, userdef->light_ambient);
}
/* StudioLight.name */
static void rna_UserDef_studiolight_name_get(PointerRNA *ptr, char *value)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- BLI_strncpy(value, sl->name, FILE_MAXFILE);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ BLI_strncpy(value, sl->name, FILE_MAXFILE);
}
static int rna_UserDef_studiolight_name_length(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- return strlen(sl->name);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ return strlen(sl->name);
}
/* StudioLight.path */
static void rna_UserDef_studiolight_path_get(PointerRNA *ptr, char *value)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- BLI_strncpy(value, sl->path, FILE_MAX);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ BLI_strncpy(value, sl->path, FILE_MAX);
}
static int rna_UserDef_studiolight_path_length(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- return strlen(sl->path);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ return strlen(sl->path);
}
/* StudioLight.path_irr_cache */
static void rna_UserDef_studiolight_path_irr_cache_get(PointerRNA *ptr, char *value)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- if (sl->path_irr_cache) {
- BLI_strncpy(value, sl->path_irr_cache, FILE_MAX);
- }
- else {
- value[0] = '\0';
- }
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_irr_cache) {
+ BLI_strncpy(value, sl->path_irr_cache, FILE_MAX);
+ }
+ else {
+ value[0] = '\0';
+ }
}
static int rna_UserDef_studiolight_path_irr_cache_length(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- if (sl->path_irr_cache) {
- return strlen(sl->path_irr_cache);
- }
- return 0;
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_irr_cache) {
+ return strlen(sl->path_irr_cache);
+ }
+ return 0;
}
/* StudioLight.path_sh_cache */
static void rna_UserDef_studiolight_path_sh_cache_get(PointerRNA *ptr, char *value)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- if (sl->path_sh_cache) {
- BLI_strncpy(value, sl->path_sh_cache, FILE_MAX);
- }
- else {
- value[0] = '\0';
- }
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_sh_cache) {
+ BLI_strncpy(value, sl->path_sh_cache, FILE_MAX);
+ }
+ else {
+ value[0] = '\0';
+ }
}
static int rna_UserDef_studiolight_path_sh_cache_length(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- if (sl->path_sh_cache) {
- return strlen(sl->path_sh_cache);
- }
- return 0;
+ StudioLight *sl = (StudioLight *)ptr->data;
+ if (sl->path_sh_cache) {
+ return strlen(sl->path_sh_cache);
+ }
+ return 0;
}
/* StudioLight.index */
static int rna_UserDef_studiolight_index_get(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- return sl->index;
+ StudioLight *sl = (StudioLight *)ptr->data;
+ return sl->index;
}
/* StudioLight.is_user_defined */
static bool rna_UserDef_studiolight_is_user_defined_get(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- return (sl->flag & STUDIOLIGHT_USER_DEFINED) != 0;
+ StudioLight *sl = (StudioLight *)ptr->data;
+ return (sl->flag & STUDIOLIGHT_USER_DEFINED) != 0;
}
/* StudioLight.type */
static int rna_UserDef_studiolight_type_get(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- return sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS;
+ StudioLight *sl = (StudioLight *)ptr->data;
+ return sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS;
}
-static void rna_UserDef_studiolight_spherical_harmonics_coefficients_get(PointerRNA *ptr, float *values)
+static void rna_UserDef_studiolight_spherical_harmonics_coefficients_get(PointerRNA *ptr,
+ float *values)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- float *value = values;
- for (int i = 0; i < STUDIOLIGHT_SH_EFFECTIVE_COEFS_LEN; i++) {
- copy_v3_v3(value, sl->spherical_harmonics_coefs[i]);
- value += 3;
- }
+ StudioLight *sl = (StudioLight *)ptr->data;
+ float *value = values;
+ for (int i = 0; i < STUDIOLIGHT_SH_EFFECTIVE_COEFS_LEN; i++) {
+ copy_v3_v3(value, sl->spherical_harmonics_coefs[i]);
+ value += 3;
+ }
}
/* StudioLight.solid_lights */
-static void rna_UserDef_studiolight_solid_lights_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_UserDef_studiolight_solid_lights_begin(CollectionPropertyIterator *iter,
+ PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- rna_iterator_array_begin(iter, sl->light, sizeof(*sl->light), ARRAY_SIZE(sl->light), 0, NULL);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ rna_iterator_array_begin(iter, sl->light, sizeof(*sl->light), ARRAY_SIZE(sl->light), 0, NULL);
}
static int rna_UserDef_studiolight_solid_lights_length(PointerRNA *ptr)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- return ARRAY_SIZE(sl->light);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ return ARRAY_SIZE(sl->light);
}
/* StudioLight.light_ambient */
static void rna_UserDef_studiolight_light_ambient_get(PointerRNA *ptr, float *values)
{
- StudioLight *sl = (StudioLight *)ptr->data;
- copy_v3_v3(values, sl->light_ambient);
+ StudioLight *sl = (StudioLight *)ptr->data;
+ copy_v3_v3(values, sl->light_ambient);
}
#else
@@ -801,4427 +845,4730 @@ static void rna_UserDef_studiolight_light_ambient_get(PointerRNA *ptr, float *va
/* Get maximum addressable memory in megabytes, */
static size_t max_memory_in_megabytes(void)
{
- /* Maximum addressable bytes on this platform. */
- const size_t limit_bytes = (((size_t)1) << ((sizeof(size_t) * 8) - 1));
- /* Convert it to megabytes and return. */
- return (limit_bytes >> 20);
+ /* Maximum addressable bytes on this platform. */
+ const size_t limit_bytes = (((size_t)1) << ((sizeof(size_t) * 8) - 1));
+ /* Convert it to megabytes and return. */
+ return (limit_bytes >> 20);
}
/* Same as above, but clipped to int capacity. */
static int max_memory_in_megabytes_int(void)
{
- const size_t limit_megabytes = max_memory_in_megabytes();
- /* NOTE: The result will fit into integer. */
- return (int)min_zz(limit_megabytes, (size_t)INT_MAX);
+ const size_t limit_megabytes = max_memory_in_megabytes();
+ /* NOTE: The result will fit into integer. */
+ return (int)min_zz(limit_megabytes, (size_t)INT_MAX);
}
static void rna_def_userdef_theme_ui_font_style(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem font_kerning_style[] = {
- {0, "UNFITTED", 0, "Unfitted", "Use scaled but un-grid-fitted kerning distances"},
- {1, "FITTED", 0, "Fitted", "Use scaled and grid-fitted kerning distances"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "ThemeFontStyle", NULL);
- RNA_def_struct_sdna(srna, "uiFontStyle");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Font Style", "Theme settings for Font");
-
- prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 6, 48);
- RNA_def_property_ui_text(prop, "Points", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "kerning");
- RNA_def_property_enum_items(prop, font_kerning_style);
- RNA_def_property_ui_text(prop, "Kerning Style", "Which style to use for font kerning");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadow", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 0, 5);
- RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size (0, 3 and 5 supported)");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadow_offset_x", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "shadx");
- RNA_def_property_range(prop, -10, 10);
- RNA_def_property_ui_text(prop, "Shadow X Offset", "Shadow offset in pixels");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadow_offset_y", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "shady");
- RNA_def_property_range(prop, -10, 10);
- RNA_def_property_ui_text(prop, "Shadow Y Offset", "Shadow offset in pixels");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadow_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "shadowalpha");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shadow Alpha", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadow_value", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "shadowcolor");
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in gray value");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem font_kerning_style[] = {
+ {0, "UNFITTED", 0, "Unfitted", "Use scaled but un-grid-fitted kerning distances"},
+ {1, "FITTED", 0, "Fitted", "Use scaled and grid-fitted kerning distances"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "ThemeFontStyle", NULL);
+ RNA_def_struct_sdna(srna, "uiFontStyle");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Font Style", "Theme settings for Font");
+
+ prop = RNA_def_property(srna, "points", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 6, 48);
+ RNA_def_property_ui_text(prop, "Points", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "font_kerning_style", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "kerning");
+ RNA_def_property_enum_items(prop, font_kerning_style);
+ RNA_def_property_ui_text(prop, "Kerning Style", "Which style to use for font kerning");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadow", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, 5);
+ RNA_def_property_ui_text(prop, "Shadow Size", "Shadow size (0, 3 and 5 supported)");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadow_offset_x", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "shadx");
+ RNA_def_property_range(prop, -10, 10);
+ RNA_def_property_ui_text(prop, "Shadow X Offset", "Shadow offset in pixels");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadow_offset_y", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "shady");
+ RNA_def_property_range(prop, -10, 10);
+ RNA_def_property_ui_text(prop, "Shadow Y Offset", "Shadow offset in pixels");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadow_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "shadowalpha");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Shadow Alpha", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadow_value", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "shadowcolor");
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Shadow Brightness", "Shadow color in gray value");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_style(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_userdef_theme_ui_font_style(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeStyle", NULL);
- RNA_def_struct_sdna(srna, "uiStyle");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets");
+ rna_def_userdef_theme_ui_font_style(brna);
+ srna = RNA_def_struct(brna, "ThemeStyle", NULL);
+ RNA_def_struct_sdna(srna, "uiStyle");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Style", "Theme settings for style sets");
- prop = RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
- RNA_def_property_struct_type(prop, "ThemeFontStyle");
- RNA_def_property_ui_text(prop, "Panel Title Font", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "panel_title", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "paneltitle");
+ RNA_def_property_struct_type(prop, "ThemeFontStyle");
+ RNA_def_property_ui_text(prop, "Panel Title Font", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel");
- RNA_def_property_struct_type(prop, "ThemeFontStyle");
- RNA_def_property_ui_text(prop, "Widget Label Style", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "widget");
- RNA_def_property_struct_type(prop, "ThemeFontStyle");
- RNA_def_property_ui_text(prop, "Widget Style", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "widget_label", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "widgetlabel");
+ RNA_def_property_struct_type(prop, "ThemeFontStyle");
+ RNA_def_property_ui_text(prop, "Widget Label Style", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "widget", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "widget");
+ RNA_def_property_struct_type(prop, "ThemeFontStyle");
+ RNA_def_property_ui_text(prop, "Widget Style", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_wcol(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ThemeWidgetColors", NULL);
- RNA_def_struct_sdna(srna, "uiWidgetColors");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Widget Color Set", "Theme settings for widget color sets");
-
- prop = RNA_def_property(srna, "outline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Outline", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Inner", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Inner Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "item", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Item", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "text_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "show_shaded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shaded", 1);
- RNA_def_property_ui_text(prop, "Shaded", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadetop", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, -100, 100);
- RNA_def_property_ui_text(prop, "Shade Top", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shadedown", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, -100, 100);
- RNA_def_property_ui_text(prop, "Shade Down", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "roundness", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_funcs(prop, "rna_ThemeUI_roundness_get", "rna_ThemeUI_roundness_set", NULL);
- RNA_def_property_ui_text(prop, "Roundness", "Amount of edge rounding");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ThemeWidgetColors", NULL);
+ RNA_def_struct_sdna(srna, "uiWidgetColors");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Widget Color Set", "Theme settings for widget color sets");
+
+ prop = RNA_def_property(srna, "outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Outline", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Inner", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Inner Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "item", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Item", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "text_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "show_shaded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shaded", 1);
+ RNA_def_property_ui_text(prop, "Shaded", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadetop", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, -100, 100);
+ RNA_def_property_ui_text(prop, "Shade Top", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shadedown", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, -100, 100);
+ RNA_def_property_ui_text(prop, "Shade Down", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "roundness", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_funcs(
+ prop, "rna_ThemeUI_roundness_get", "rna_ThemeUI_roundness_set", NULL);
+ RNA_def_property_ui_text(prop, "Roundness", "Amount of edge rounding");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_wcol_state(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "ThemeWidgetStateColors", NULL);
- RNA_def_struct_sdna(srna, "uiWidgetStateColors");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Widget State Color", "Theme settings for widget state colors");
-
- prop = RNA_def_property(srna, "inner_anim", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Animated", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_anim_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Animated Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_key", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Keyframe", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_key_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Keyframe Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_driven", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Driven", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_driven_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Driven Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_overridden", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Overridden", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_overridden_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Overridden Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_changed", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Changed", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "inner_changed_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Changed Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "blend", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Blend", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "ThemeWidgetStateColors", NULL);
+ RNA_def_struct_sdna(srna, "uiWidgetStateColors");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(
+ srna, "Theme Widget State Color", "Theme settings for widget state colors");
+
+ prop = RNA_def_property(srna, "inner_anim", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Animated", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_anim_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Animated Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_key", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Keyframe", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_key_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Keyframe Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_driven", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Driven", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_driven_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Driven Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_overridden", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Overridden", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_overridden_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Overridden Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_changed", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Changed", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "inner_changed_sel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Changed Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "blend", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(prop, "Blend", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemePanelColors", NULL);
- RNA_def_struct_sdna(srna, "uiPanelColors");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
+ srna = RNA_def_struct(brna, "ThemePanelColors", NULL);
+ RNA_def_struct_sdna(srna, "uiPanelColors");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Panel Color", "Theme settings for panel colors");
- prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Header", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Header", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "sub_back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_ui_text(prop, "Sub Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "sub_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_ui_text(prop, "Sub Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna)
{
- /* Fake struct, keep this for compatible theme presets. */
- StructRNA *srna;
- PropertyRNA *prop;
+ /* Fake struct, keep this for compatible theme presets. */
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeGradientColors", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Background Color", "Theme settings for background colors and gradient");
+ srna = RNA_def_struct(brna, "ThemeGradientColors", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(
+ srna, "Theme Background Color", "Theme settings for background colors and gradient");
- prop = RNA_def_property(srna, "show_grad", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "show_back_grad", 1);
- RNA_def_property_ui_text(prop, "Use Gradient",
- "Do a gradient for the background of the viewport working area");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "show_grad", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "show_back_grad", 1);
+ RNA_def_property_ui_text(
+ prop, "Use Gradient", "Do a gradient for the background of the viewport working area");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "back");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gradient High/Off", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "high_gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "back");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gradient High/Off", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "back_grad");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gradient Low", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "gradient", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "back_grad");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gradient Low", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_ui(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- rna_def_userdef_theme_ui_wcol(brna);
- rna_def_userdef_theme_ui_wcol_state(brna);
- rna_def_userdef_theme_ui_panel(brna);
- rna_def_userdef_theme_ui_gradient(brna);
-
- srna = RNA_def_struct(brna, "ThemeUserInterface", NULL);
- RNA_def_struct_sdna(srna, "ThemeUI");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme User Interface", "Theme settings for user interface elements");
-
- prop = RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Regular Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Tool Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_toolbar_item", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Toolbar Item Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Radio Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Text Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Option Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Number Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Slider Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Box Backdrop Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Menu Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Pulldown Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Menu Backdrop Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_pie_menu", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Pie Menu Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_tooltip", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Tooltip Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Menu Item Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "List Item Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "State Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wcol_tab", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Tab Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "menu_shadow_fac", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Menu Shadow Strength", "Blending factor for menu shadows");
- RNA_def_property_range(prop, 0.01f, 1.0f);
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "menu_shadow_width", PROP_INT, PROP_PIXEL);
- RNA_def_property_ui_text(prop, "Menu Shadow Width", "Width of menu shadows, set to zero to disable");
- RNA_def_property_range(prop, 0.0f, 24.0f);
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "icon_saturation", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_ui_text(prop, "Icon Saturation", "Saturation of icons in the interface");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "widget_emboss", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "widget_emboss");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Widget Emboss", "Color of the 1px shadow line underlying widgets");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "editor_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "editor_outline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Editor Outline", "Color of the outline of the editors and their round corners");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* axis */
- prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "xaxis");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "X Axis", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "yaxis");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Y Axis", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "zaxis");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Z Axis", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* Generic gizmo colors. */
- prop = RNA_def_property(srna, "gizmo_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gizmo_hi");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gizmo Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "gizmo_primary", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gizmo_primary");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gizmo Primary", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "gizmo_secondary", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gizmo_secondary");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gizmo Secondary", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "gizmo_a", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gizmo_a");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gizmo A", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "gizmo_b", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gizmo_b");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Gizmo B", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* Icon colors. */
- prop = RNA_def_property(srna, "icon_collection", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "icon_collection");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Collection", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "icon_object", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "icon_object");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Object", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "icon_object_data", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "icon_object_data");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Object Data", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "icon_modifier", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "icon_modifier");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Modifier", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "icon_shading", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "icon_shading");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Shading", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ rna_def_userdef_theme_ui_wcol(brna);
+ rna_def_userdef_theme_ui_wcol_state(brna);
+ rna_def_userdef_theme_ui_panel(brna);
+ rna_def_userdef_theme_ui_gradient(brna);
+
+ srna = RNA_def_struct(brna, "ThemeUserInterface", NULL);
+ RNA_def_struct_sdna(srna, "ThemeUI");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(
+ srna, "Theme User Interface", "Theme settings for user interface elements");
+
+ prop = RNA_def_property(srna, "wcol_regular", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Regular Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_tool", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Tool Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_toolbar_item", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Toolbar Item Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_radio", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Radio Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_text", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Text Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_option", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Option Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_toggle", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Toggle Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_num", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Number Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_numslider", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Slider Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_box", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Box Backdrop Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_menu", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Menu Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_pulldown", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Pulldown Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_menu_back", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Menu Backdrop Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_pie_menu", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Pie Menu Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_tooltip", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Tooltip Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_menu_item", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Menu Item Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_scroll", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Scroll Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_progress", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Progress Bar Widget Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_list_item", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "List Item Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_state", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "State Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wcol_tab", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Tab Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "menu_shadow_fac", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(prop, "Menu Shadow Strength", "Blending factor for menu shadows");
+ RNA_def_property_range(prop, 0.01f, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "menu_shadow_width", PROP_INT, PROP_PIXEL);
+ RNA_def_property_ui_text(
+ prop, "Menu Shadow Width", "Width of menu shadows, set to zero to disable");
+ RNA_def_property_range(prop, 0.0f, 24.0f);
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "icon_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(
+ prop, "Icon Alpha", "Transparency of icons in the interface, to reduce contrast");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "icon_saturation", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_ui_text(prop, "Icon Saturation", "Saturation of icons in the interface");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "widget_emboss", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "widget_emboss");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(
+ prop, "Widget Emboss", "Color of the 1px shadow line underlying widgets");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "editor_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "editor_outline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Editor Outline", "Color of the outline of the editors and their round corners");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* axis */
+ prop = RNA_def_property(srna, "axis_x", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "xaxis");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "X Axis", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "axis_y", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "yaxis");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Y Axis", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "axis_z", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "zaxis");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Z Axis", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* Generic gizmo colors. */
+ prop = RNA_def_property(srna, "gizmo_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gizmo_hi");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gizmo Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "gizmo_primary", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gizmo_primary");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gizmo Primary", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "gizmo_secondary", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gizmo_secondary");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gizmo Secondary", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "gizmo_a", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gizmo_a");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gizmo A", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "gizmo_b", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gizmo_b");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Gizmo B", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* Icon colors. */
+ prop = RNA_def_property(srna, "icon_collection", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "icon_collection");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Collection", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "icon_object", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "icon_object");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Object", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "icon_object_data", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "icon_object_data");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Object Data", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "icon_modifier", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "icon_modifier");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Modifier", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "icon_shading", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "icon_shading");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Shading", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_common(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Title", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* header */
- prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Header", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Header Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Header Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* panel settings */
- prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_ui_text(prop, "Panel Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* buttons */
-/* if (! ELEM(spacetype, SPACE_PROPERTIES, SPACE_OUTLINER)) { */
- prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Region Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Region Text Titles", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Region Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Region Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "navigation_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Navigation Bar Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "execution_buts", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Execution Region Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* tabs */
- prop = RNA_def_property(srna, "tab_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Tab Active", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "tab_inactive", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Tab Inactive", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "tab_back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Tab Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "tab_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Tab Outline", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
-/* } */
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "title", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Title", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* header */
+ prop = RNA_def_property(srna, "header", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Header", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "header_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Header Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "header_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Header Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* panel settings */
+ prop = RNA_def_property(srna, "panelcolors", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_ui_text(prop, "Panel Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* buttons */
+ /* if (! ELEM(spacetype, SPACE_PROPERTIES, SPACE_OUTLINER)) { */
+ prop = RNA_def_property(srna, "button", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Region Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "button_title", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Region Text Titles", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "button_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Region Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "button_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Region Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "navigation_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Navigation Bar Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "execution_buts", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Execution Region Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* tabs */
+ prop = RNA_def_property(srna, "tab_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Tab Active", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "tab_inactive", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Tab Inactive", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "tab_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Tab Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "tab_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Tab Outline", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* } */
}
static void rna_def_userdef_theme_space_gradient(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeSpaceGradient", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
+ srna = RNA_def_struct(brna, "ThemeSpaceGradient", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
- /* gradient/background settings */
- prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ThemeGradientColors");
- RNA_def_property_pointer_funcs(prop, "rna_Theme_gradient_colors_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Gradient Colors", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ /* gradient/background settings */
+ prop = RNA_def_property(srna, "gradients", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeGradientColors");
+ RNA_def_property_pointer_funcs(prop, "rna_Theme_gradient_colors_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Gradient Colors", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- rna_def_userdef_theme_space_common(srna);
+ rna_def_userdef_theme_space_common(srna);
}
static void rna_def_userdef_theme_space_generic(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeSpaceGeneric", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
+ srna = RNA_def_struct(brna, "ThemeSpaceGeneric", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Space Settings", "");
- prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Window Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Window Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- rna_def_userdef_theme_space_common(srna);
+ rna_def_userdef_theme_space_common(srna);
}
/* list / channels */
static void rna_def_userdef_theme_space_list_generic(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeSpaceListGeneric", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_ui_text(srna, "Theme Space List Settings", "");
+ srna = RNA_def_struct(brna, "ThemeSpaceListGeneric", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_ui_text(srna, "Theme Space List Settings", "");
- prop = RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Source List", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "list", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Source List", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "list_title", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Source List Title", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "list_title", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Source List Title", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "list_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Source List Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "list_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Source List Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "list_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Source List Text Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "list_text_hi", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Source List Text Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_main(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ThemeSpaceGeneric");
- RNA_def_property_pointer_funcs(prop, "rna_Theme_space_generic_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Theme Space", "Settings for space");
+ prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeSpaceGeneric");
+ RNA_def_property_pointer_funcs(prop, "rna_Theme_space_generic_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Theme Space", "Settings for space");
}
static void rna_def_userdef_theme_spaces_gradient(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ThemeSpaceGradient");
- RNA_def_property_pointer_funcs(prop, "rna_Theme_space_gradient_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Theme Space", "Settings for space");
+ prop = RNA_def_property(srna, "space", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeSpaceGradient");
+ RNA_def_property_pointer_funcs(prop, "rna_Theme_space_gradient_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Theme Space", "Settings for space");
}
static void rna_def_userdef_theme_spaces_list_main(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "space_list", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "ThemeSpaceListGeneric");
- RNA_def_property_pointer_funcs(prop, "rna_Theme_space_list_generic_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Theme Space List", "Settings for space list");
+ prop = RNA_def_property(srna, "space_list", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "ThemeSpaceListGeneric");
+ RNA_def_property_pointer_funcs(prop, "rna_Theme_space_list_generic_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Theme Space List", "Settings for space list");
}
static void rna_def_userdef_theme_spaces_vertex(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vertex", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vertex", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vertex Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vertex Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "vertex_size", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 32);
- RNA_def_property_ui_text(prop, "Vertex Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "vertex_size", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 32);
+ RNA_def_property_ui_text(prop, "Vertex Size", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "vertex_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vertex Bevel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "vertex_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vertex Bevel", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "vertex_unreferenced", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vertex Group Unreferenced", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_edge(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "edge_seam", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Seam", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "edge_seam", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Seam", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "edge_sharp", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Sharp", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "edge_sharp", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Sharp", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "edge_crease", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Crease", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "edge_crease", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Crease", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "edge_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Bevel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "edge_bevel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Bevel", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge UV Face Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "edge_facesel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge UV Face Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "freestyle_edge_mark", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "freestyle_edge_mark", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Freestyle Edge Mark", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_face(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "face", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Face", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "face", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Face", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "face_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Face Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "face_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Face Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "face_dot", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Face Dot Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "face_dot", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Face Dot Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "facedot_size", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_text(prop, "Face Dot Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "facedot_size", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(prop, "Face Dot Size", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "freestyle_face_mark", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Freestyle Face Mark", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "freestyle_face_mark", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Freestyle Face Mark", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_spaces_paint_curves(StructRNA *srna)
{
- PropertyRNA *prop;
-
- prop = RNA_def_property(srna, "paint_curve_handle", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Paint Curve Handle", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "paint_curve_pivot", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Paint Curve Pivot", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-}
-
-static void rna_def_userdef_theme_spaces_curves(StructRNA *srna, bool incl_nurbs, bool incl_lastsel,
- bool incl_vector, bool incl_verthandle)
-{
- PropertyRNA *prop;
-
- if (incl_nurbs) {
- prop = RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nurb_uline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "NURBS U-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nurb_vline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "NURBS V-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "NURBS active U-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "NURBS active V-lines", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "act_spline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Active spline", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- }
-
- prop = RNA_def_property(srna, "handle_free", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_free");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Free handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_auto");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Auto handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- if (incl_vector) {
- prop = RNA_def_property(srna, "handle_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_vect");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vector handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_sel_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_sel_vect");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vector handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- }
-
- prop = RNA_def_property(srna, "handle_align", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_align");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Align handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_sel_free", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_sel_free");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Free handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_sel_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Auto handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_sel_align", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_sel_align");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Align handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- if (!incl_nurbs) {
- /* assume that when nurbs are off, this is for 2D (i.e. anim) editors */
- prop = RNA_def_property(srna, "handle_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_auto_clamped");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Auto-Clamped handle color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto_clamped");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Auto-Clamped handle selected color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- }
-
- if (incl_lastsel) {
- prop = RNA_def_property(srna, "lastsel_point", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "lastsel_point");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Last selected point", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- }
-
- if (incl_verthandle) {
- prop = RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Handle Vertex", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Handle Vertex Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 100);
- RNA_def_property_ui_text(prop, "Handle Vertex Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- }
+ PropertyRNA *prop;
+
+ prop = RNA_def_property(srna, "paint_curve_handle", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Paint Curve Handle", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "paint_curve_pivot", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Paint Curve Pivot", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+}
+
+static void rna_def_userdef_theme_spaces_curves(
+ StructRNA *srna, bool incl_nurbs, bool incl_lastsel, bool incl_vector, bool incl_verthandle)
+{
+ PropertyRNA *prop;
+
+ if (incl_nurbs) {
+ prop = RNA_def_property(srna, "nurb_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nurb_uline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "NURBS U-lines", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "nurb_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nurb_vline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "NURBS V-lines", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "nurb_sel_uline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nurb_sel_uline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "NURBS active U-lines", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "nurb_sel_vline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nurb_sel_vline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "NURBS active V-lines", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "act_spline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "act_spline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active spline", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ }
+
+ prop = RNA_def_property(srna, "handle_free", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_free");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Free handle color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_auto");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Auto handle color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ if (incl_vector) {
+ prop = RNA_def_property(srna, "handle_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_vect");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vector handle color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_sel_vect", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_sel_vect");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vector handle selected color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ }
+
+ prop = RNA_def_property(srna, "handle_align", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_align");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Align handle color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_sel_free", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_sel_free");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Free handle selected color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_sel_auto", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Auto handle selected color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_sel_align", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_sel_align");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Align handle selected color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ if (!incl_nurbs) {
+ /* assume that when nurbs are off, this is for 2D (i.e. anim) editors */
+ prop = RNA_def_property(srna, "handle_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_auto_clamped");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Auto-Clamped handle color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_sel_auto_clamped", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "handle_sel_auto_clamped");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Auto-Clamped handle selected color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ }
+
+ if (incl_lastsel) {
+ prop = RNA_def_property(srna, "lastsel_point", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "lastsel_point");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Last selected point", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ }
+
+ if (incl_verthandle) {
+ prop = RNA_def_property(srna, "handle_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Handle Vertex", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Handle Vertex Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "handle_vertex_size", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 100);
+ RNA_def_property_ui_text(prop, "Handle Vertex Size", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ }
}
static void rna_def_userdef_theme_spaces_gpencil(StructRNA *srna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "gp_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grease Pencil Vertex", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "gp_vertex", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grease Pencil Vertex", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "gp_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grease Pencil Vertex Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "gp_vertex_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grease Pencil Vertex Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "gp_vertex_size", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 10);
- RNA_def_property_ui_text(prop, "Grease Pencil Vertex Size", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "gp_vertex_size", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 10);
+ RNA_def_property_ui_text(prop, "Grease Pencil Vertex Size", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_view3d */
-
- srna = RNA_def_struct(brna, "ThemeView3D", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme 3D View", "Theme settings for the 3D View");
-
- rna_def_userdef_theme_spaces_gradient(srna);
-
- /* General Viewport options */
-
- prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "clipping_border_3d", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Clipping Border", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Wire", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Wire Edit", "Color for wireframe when in edit mode, but edge selection is active");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
-
- /* Grease Pencil */
-
- rna_def_userdef_theme_spaces_gpencil(srna);
-
- prop = RNA_def_property(srna, "text_grease_pencil", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "time_gp_keyframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grease Pencil Keyframe", "Color for indicating Grease Pencil keyframes");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* Object specific options */
-
- prop = RNA_def_property(srna, "object_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Object Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "object_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "active");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Active Object", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "text_keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "time_keyframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Object Keyframe", "Color for indicating Object keyframes");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* Object type options */
-
- prop = RNA_def_property(srna, "camera", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Camera", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "empty", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Empty", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "light", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "lamp");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Light", "");
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Speaker", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* Mesh Object specific */
-
- rna_def_userdef_theme_spaces_vertex(srna);
- rna_def_userdef_theme_spaces_edge(srna);
- rna_def_userdef_theme_spaces_face(srna);
-
- /* Mesh Object specific curves*/
-
- rna_def_userdef_theme_spaces_curves(srna, true, true, true, false);
-
- prop = RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Length Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "extra_edge_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Angle Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Face Angle Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Face Area Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Face Normal", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "vertex_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vertex Normal", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
- prop = RNA_def_property(srna, "split_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "loop_normal");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Split Normal", "");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* Armature Object specific */
-
- prop = RNA_def_property(srna, "bone_pose", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Bone Pose", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "bone_pose_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Bone Pose Active", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "bone_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Bone Solid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* misc */
-
- prop = RNA_def_property(srna, "bundle_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "bundle_solid");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Bundle Solid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ /* space_view3d */
- prop = RNA_def_property(srna, "camera_path", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "camera_path");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Camera Path", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "skin_root", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Skin Root", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ srna = RNA_def_struct(brna, "ThemeView3D", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme 3D View", "Theme settings for the 3D View");
- prop = RNA_def_property(srna, "view_overlay", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "View Overlay", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ rna_def_userdef_theme_spaces_gradient(srna);
- prop = RNA_def_property(srna, "transform", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Transform", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- rna_def_userdef_theme_spaces_paint_curves(srna);
-
- prop = RNA_def_property(srna, "outline_width", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 5);
- RNA_def_property_ui_text(prop, "Outline Width", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ /* General Viewport options */
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "clipping_border_3d", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Clipping Border", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Wire", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Wire Edit", "Color for wireframe when in edit mode, but edge selection is active");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* Grease Pencil */
+
+ rna_def_userdef_theme_spaces_gpencil(srna);
+
+ prop = RNA_def_property(srna, "text_grease_pencil", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "time_gp_keyframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Grease Pencil Keyframe", "Color for indicating Grease Pencil keyframes");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* Object specific options */
+
+ prop = RNA_def_property(srna, "object_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Object Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "object_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "active");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Object", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "text_keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "time_keyframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Object Keyframe", "Color for indicating Object keyframes");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* Object type options */
+
+ prop = RNA_def_property(srna, "camera", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Camera", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "empty", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Empty", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "light", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "lamp");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Light", "");
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_ID_LIGHT);
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "speaker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Speaker", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* Mesh Object specific */
+
+ rna_def_userdef_theme_spaces_vertex(srna);
+ rna_def_userdef_theme_spaces_edge(srna);
+ rna_def_userdef_theme_spaces_face(srna);
+
+ /* Mesh Object specific curves*/
+
+ rna_def_userdef_theme_spaces_curves(srna, true, true, true, false);
+
+ prop = RNA_def_property(srna, "extra_edge_len", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Length Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "extra_edge_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Angle Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "extra_face_angle", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Face Angle Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "extra_face_area", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Face Area Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Face Normal", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "vertex_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vertex Normal", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "split_normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "loop_normal");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Split Normal", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* Armature Object specific */
+
+ prop = RNA_def_property(srna, "bone_pose", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bone Pose", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "bone_pose_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bone Pose Active", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "bone_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bone Solid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* misc */
+
+ prop = RNA_def_property(srna, "bundle_solid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "bundle_solid");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Bundle Solid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "camera_path", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "camera_path");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Camera Path", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "skin_root", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Skin Root", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "view_overlay", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "View Overlay", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "transform", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Transform", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ rna_def_userdef_theme_spaces_paint_curves(srna);
+
+ prop = RNA_def_property(srna, "outline_width", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 5);
+ RNA_def_property_ui_text(prop, "Outline Width", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
-
static void rna_def_userdef_theme_space_graph(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_graph */
- srna = RNA_def_struct(brna, "ThemeGraphEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Graph Editor", "Theme settings for the graph editor");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_list_main(srna);
-
- prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Window Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "channels_region", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade2");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Channels Region", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "ds_channel");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "group");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "group_active");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Active Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- rna_def_userdef_theme_spaces_vertex(srna);
- rna_def_userdef_theme_spaces_curves(srna, false, true, true, true);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_graph */
+ srna = RNA_def_struct(brna, "ThemeGraphEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Graph Editor", "Theme settings for the graph editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_list_main(srna);
+
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade1");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Window Sliders", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "channels_region", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade2");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Channels Region", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "ds_channel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "group");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Channel Group", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "group_active");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Channel Group", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ rna_def_userdef_theme_spaces_vertex(srna);
+ rna_def_userdef_theme_spaces_curves(srna, false, true, true, true);
}
static void rna_def_userdef_theme_space_file(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- /* space_file */
+ /* space_file */
- srna = RNA_def_struct(brna, "ThemeFileBrowser", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme File Browser", "Theme settings for the File Browser");
+ srna = RNA_def_struct(brna, "ThemeFileBrowser", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme File Browser", "Theme settings for the File Browser");
- rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_main(srna);
- prop = RNA_def_property(srna, "selected_file", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "hilite");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected File", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "selected_file", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "hilite");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected File", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_outliner(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- /* space_outliner */
+ /* space_outliner */
- srna = RNA_def_struct(brna, "ThemeOutliner", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Outliner", "Theme settings for the Outliner");
+ srna = RNA_def_struct(brna, "ThemeOutliner", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Outliner", "Theme settings for the Outliner");
- rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_main(srna);
- prop = RNA_def_property(srna, "match", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Filter Match", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "match", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Filter Match", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "selected_highlight", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Highlight", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "selected_highlight", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Highlight", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_userpref(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- /* space_userpref */
+ /* space_userpref */
- srna = RNA_def_struct(brna, "ThemePreferences", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Preferences", "Theme settings for the Blender Preferences");
+ srna = RNA_def_struct(brna, "ThemePreferences", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Preferences", "Theme settings for the Blender Preferences");
- rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_main(srna);
}
static void rna_def_userdef_theme_space_console(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_console */
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeConsole", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Console", "Theme settings for the Console");
+ /* space_console */
- rna_def_userdef_theme_spaces_main(srna);
+ srna = RNA_def_struct(brna, "ThemeConsole", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Console", "Theme settings for the Console");
- prop = RNA_def_property(srna, "line_output", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_output");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Line Output", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ rna_def_userdef_theme_spaces_main(srna);
- prop = RNA_def_property(srna, "line_input", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_input");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Line Input", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "line_output", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_output");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Line Output", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "line_info", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_info");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Line Info", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "line_input", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_input");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Line Input", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "line_error", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_error");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Line Error", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "line_info", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_info");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Line Info", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_cursor");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Cursor", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "line_error", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_error");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Line Error", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_select");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Selection", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_cursor");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Cursor", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_select");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Selection", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_info(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_info */
-
- srna = RNA_def_struct(brna, "ThemeInfo", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Info", "Theme settings for Info");
-
- rna_def_userdef_theme_spaces_main(srna);
-
- prop = RNA_def_property(srna, "info_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_selected");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Line Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_selected_text");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Line Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_error", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_error");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Error Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_error_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_error_text");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Error Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_warning", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_warning");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Warning Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_warning_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_warning_text");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Warning Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_info", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_info");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Info Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_info_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_info_text");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Info Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_debug", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_debug");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Debug Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "info_debug_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "info_debug_text");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Debug Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_info */
+
+ srna = RNA_def_struct(brna, "ThemeInfo", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Info", "Theme settings for Info");
+
+ rna_def_userdef_theme_spaces_main(srna);
+
+ prop = RNA_def_property(srna, "info_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_selected");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Line Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_selected_text");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Line Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_error", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_error");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Error Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_error_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_error_text");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Error Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_warning", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_warning");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Warning Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_warning_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_warning_text");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Warning Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_info", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_info");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Info Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_info_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_info_text");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Info Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_debug", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_debug");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Debug Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "info_debug_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "info_debug_text");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Debug Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
-
static void rna_def_userdef_theme_space_text(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_text */
-
- srna = RNA_def_struct(brna, "ThemeTextEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Text Editor", "Theme settings for the Text Editor");
-
- rna_def_userdef_theme_spaces_main(srna);
-
- prop = RNA_def_property(srna, "line_numbers_background", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "grid");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Line Numbers Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- /* no longer used */
-#if 0
- prop = RNA_def_property(srna, "scroll_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Scroll Bar", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-#endif
-
- prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade2");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "hilite");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Cursor", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_builtin", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxb");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax Built-in", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_symbols", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxs");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax Symbols", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxv");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax Special", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_preprocessor", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxd");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax PreProcessor", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_reserved", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxr");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax Reserved", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxc");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax Comment", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_string", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxl");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax String", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "syntax_numbers", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxn");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Syntax Numbers", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_text */
+
+ srna = RNA_def_struct(brna, "ThemeTextEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Text Editor", "Theme settings for the Text Editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+
+ prop = RNA_def_property(srna, "line_numbers_background", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "grid");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Line Numbers Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ /* no longer used */
+# if 0
+ prop = RNA_def_property(srna, "scroll_bar", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade1");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Scroll Bar", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+# endif
+
+ prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade2");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "cursor", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "hilite");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Cursor", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_builtin", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxb");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax Built-in", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_symbols", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxs");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax Symbols", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxv");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax Special", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_preprocessor", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxd");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax PreProcessor", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_reserved", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxr");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax Reserved", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxc");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax Comment", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_string", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxl");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax String", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "syntax_numbers", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxn");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Syntax Numbers", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_node(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_node */
-
- srna = RNA_def_struct(brna, "ThemeNodeEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Node Editor", "Theme settings for the Node Editor");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_list_main(srna);
-
- rna_def_userdef_theme_spaces_gpencil(srna);
-
- prop = RNA_def_property(srna, "node_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Node Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "node_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "active");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Active Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "wire");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Wires", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wire_inner", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxr");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Wire Color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wire_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "edge_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Wire Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade2");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "node_backdrop", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxl");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Node Backdrop", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "converter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxv");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Converter Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "color_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxb");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Color Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "group_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxc");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Group Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "group_socket_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "console_output");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Group Socket Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "movie");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Frame Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "matte_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxs");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Matte Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "distor_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxd");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Distort Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
- RNA_def_property_int_default(prop, 5);
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Noodle curving", "Curving of the noodle");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "input_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "syntaxn");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Input Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "output_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_output");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Output Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "filter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_filter");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Filter Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "vector_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_vector");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Vector Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "texture_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_texture");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Texture Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "shader_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_shader");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Shader Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "script_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_script");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Script Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "pattern_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_pattern");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Pattern Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "layout_node", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nodeclass_layout");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Layout Node", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_node */
+
+ srna = RNA_def_struct(brna, "ThemeNodeEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Node Editor", "Theme settings for the Node Editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_list_main(srna);
+
+ rna_def_userdef_theme_spaces_gpencil(srna);
+
+ prop = RNA_def_property(srna, "node_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Node Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "node_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "active");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wire", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "wire");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Wires", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wire_inner", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxr");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Wire Color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wire_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "edge_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Wire Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade2");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "node_backdrop", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxl");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Node Backdrop", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "converter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxv");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Converter Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "color_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxb");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Color Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "group_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxc");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Group Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "group_socket_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "console_output");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Group Socket Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "movie");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Frame Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "matte_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxs");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Matte Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "distor_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxd");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Distort Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "noodle_curving", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "noodle_curving");
+ RNA_def_property_int_default(prop, 5);
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(prop, "Noodle curving", "Curving of the noodle");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "input_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "syntaxn");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Input Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "output_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_output");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Output Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "filter_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_filter");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Filter Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "vector_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_vector");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Vector Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "texture_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_texture");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Texture Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "shader_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_shader");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Shader Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "script_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_script");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Script Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "pattern_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_pattern");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Pattern Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "layout_node", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nodeclass_layout");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Layout Node", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_buts(BlenderRNA *brna)
{
- StructRNA *srna;
-// PropertyRNA *prop;
+ StructRNA *srna;
+ // PropertyRNA *prop;
- /* space_buts */
+ /* space_buts */
- srna = RNA_def_struct(brna, "ThemeProperties", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Properties", "Theme settings for the Properties");
-
- rna_def_userdef_theme_spaces_main(srna);
+ srna = RNA_def_struct(brna, "ThemeProperties", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Properties", "Theme settings for the Properties");
+ rna_def_userdef_theme_spaces_main(srna);
}
static void rna_def_userdef_theme_space_image(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_image */
-
- srna = RNA_def_struct(brna, "ThemeImageEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Image Editor", "Theme settings for the Image Editor");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_gpencil(srna);
- rna_def_userdef_theme_spaces_vertex(srna);
- rna_def_userdef_theme_spaces_face(srna);
-
-
- prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Wire Edit", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Edge Select", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "scope_back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_back");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Scope region background color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_stitch_face", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_stitch_face");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Stitch preview face color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_stitch_edge", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_stitch_edge");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Stitch preview edge color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_stitch_vert", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_stitch_vert");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Stitch preview vertex color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_stitch_stitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_stitch_stitchable");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Stitch preview stitchable color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_stitch_unstitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_stitch_unstitchable");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Stitch preview unstitchable color", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_stitch_active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_stitch_active");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Stitch preview active island", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "uv_shadow", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "uv_shadow");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Texture paint/Modifier UVs", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "uv_others", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "uv_others");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Other Object UVs", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "metadatabg");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Metadata Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "metadatatext");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Metadata Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
-
- rna_def_userdef_theme_spaces_paint_curves(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_image */
+
+ srna = RNA_def_struct(brna, "ThemeImageEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Image Editor", "Theme settings for the Image Editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_gpencil(srna);
+ rna_def_userdef_theme_spaces_vertex(srna);
+ rna_def_userdef_theme_spaces_face(srna);
+
+ prop = RNA_def_property(srna, "editmesh_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Active Vert/Edge/Face", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "wire_edit", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Wire Edit", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "edge_select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Edge Select", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "scope_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_back");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Scope region background color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_stitch_face", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_stitch_face");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Stitch preview face color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_stitch_edge", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_stitch_edge");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Stitch preview edge color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_stitch_vert", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_stitch_vert");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Stitch preview vertex color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_stitch_stitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_stitch_stitchable");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Stitch preview stitchable color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_stitch_unstitchable", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_stitch_unstitchable");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Stitch preview unstitchable color", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_stitch_active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_stitch_active");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Stitch preview active island", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "uv_shadow", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "uv_shadow");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Texture paint/Modifier UVs", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "uv_others", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "uv_others");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Other Object UVs", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "metadatabg");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Metadata Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "metadatatext");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Metadata Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
+
+ rna_def_userdef_theme_spaces_paint_curves(srna);
}
static void rna_def_userdef_theme_space_seq(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_seq */
-
- srna = RNA_def_struct(brna, "ThemeSequenceEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Sequence Editor", "Theme settings for the Sequence Editor");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_gpencil(srna);
-
- prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Window Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "movie_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "movie");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Movie Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "movieclip_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "movieclip");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Clip Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "image_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "image");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Image Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "scene_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "scene");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Scene Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "audio_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "audio");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Audio Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "effect_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "effect");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Effect Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "transition_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "transition");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Transition Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "meta_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "meta");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Meta Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "text_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Text Strip", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "vertex_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Keyframe", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "draw_action", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "bone_pose");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Draw Action", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_back", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "preview_back");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Preview Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "metadatabg");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Metadata Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "metadatatext");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Metadata Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_seq */
+
+ srna = RNA_def_struct(brna, "ThemeSequenceEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Sequence Editor", "Theme settings for the Sequence Editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_gpencil(srna);
+
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "window_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade1");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Window Sliders", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "movie_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "movie");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Movie Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "movieclip_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "movieclip");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Clip Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "image_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "image");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Image Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "scene_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "scene");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Scene Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "audio_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "audio");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Audio Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "effect_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "effect");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Effect Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "transition_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "transition");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Transition Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "meta_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "meta");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Meta Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "text_strip", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Text Strip", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "vertex_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Keyframe", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "draw_action", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "bone_pose");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Draw Action", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_back", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "preview_back");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Preview Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "metadatabg");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Metadata Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "metadatatext");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Metadata Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_action(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_action */
-
- srna = RNA_def_struct(brna, "ThemeDopeSheet", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Dope Sheet", "Theme settings for the Dope Sheet");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_list_main(srna);
-
- prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "value_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "face");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Value Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "View Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
-
- prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "ds_channel");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
-
- prop = RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade2");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Channels", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "hilite");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Channels Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "group");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "group_active");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Active Channel Group", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
-
- prop = RNA_def_property(srna, "long_key", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "strip");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Long Key", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "long_key_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "strip_select");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Long Key Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
-
-
- prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Keyframe", "Color of Keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Keyframe Selected", "Color of selected keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_extreme", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_extreme");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Extreme Keyframe", "Color of extreme keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_extreme_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_extreme_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Extreme Keyframe Selected", "Color of selected extreme keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_breakdown", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Breakdown Keyframe", "Color of breakdown keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_breakdown_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Breakdown Keyframe Selected", "Color of selected breakdown keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_jitter", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_jitter");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Jitter Keyframe", "Color of jitter keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_jitter_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_jitter_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Jitter Keyframe Selected", "Color of selected jitter keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_movehold", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_movehold");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Moving Hold Keyframe", "Color of moving hold keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_movehold_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keytype_movehold_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Moving Hold Keyframe Selected", "Color of selected moving hold keyframe");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keyborder");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Keyframe Border", "Color of keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of selected keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_scale_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "keyframe_scale_fac");
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_text(prop, "Keyframe Scale Factor", "Scale factor for adjusting the height of keyframes");
- RNA_def_property_range(prop, 0.8f, 5.0f); /* Note: These limits prevent buttons overlapping (min), and excessive size... (max) */
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "summary", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "anim_active");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Summary", "Color of summary channel");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "interpolation_line", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "ds_ipoline");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Interpolation Line", "Color of lines showing non-bezier interpolation modes");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_action */
+
+ srna = RNA_def_struct(brna, "ThemeDopeSheet", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Dope Sheet", "Theme settings for the Dope Sheet");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_list_main(srna);
+
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "value_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "face");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Value Sliders", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade1");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "View Sliders", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "dopesheet_channel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "ds_channel");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Dope Sheet Channel", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "dopesheet_subchannel", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "ds_subchannel");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Dope Sheet Sub-Channel", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "channels", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade2");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Channels", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "channels_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "hilite");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Channels Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "channel_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "group");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Channel Group", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "active_channels_group", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "group_active");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Active Channel Group", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "long_key", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "strip");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Long Key", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "long_key_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "strip_select");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Long Key Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Keyframe", "Color of Keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_keyframe_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Keyframe Selected", "Color of selected keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_extreme", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_extreme");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Extreme Keyframe", "Color of extreme keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_extreme_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_extreme_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Extreme Keyframe Selected", "Color of selected extreme keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_breakdown", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Breakdown Keyframe", "Color of breakdown keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_breakdown_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_breakdown_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Breakdown Keyframe Selected", "Color of selected breakdown keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_jitter", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_jitter");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Jitter Keyframe", "Color of jitter keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_jitter_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_jitter_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Jitter Keyframe Selected", "Color of selected jitter keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_movehold", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_movehold");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Moving Hold Keyframe", "Color of moving hold keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_movehold_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keytype_movehold_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Moving Hold Keyframe Selected", "Color of selected moving hold keyframe");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keyborder");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Keyframe Border", "Color of keyframe border");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of selected keyframe border");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_scale_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "keyframe_scale_fac");
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Keyframe Scale Factor", "Scale factor for adjusting the height of keyframes");
+ RNA_def_property_range(
+ prop,
+ 0.8f,
+ 5.0f); /* Note: These limits prevent buttons overlapping (min), and excessive size... (max) */
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_DOPESHEET, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "summary", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "anim_active");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Summary", "Color of summary channel");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "interpolation_line", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "ds_ipoline");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(
+ prop, "Interpolation Line", "Color of lines showing non-bezier interpolation modes");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_nla(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_nla */
- srna = RNA_def_struct(brna, "ThemeNLAEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Nonlinear Animation", "Theme settings for the NLA Editor");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_list_main(srna);
-
- prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Grid", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "shade1");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "View Sliders", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "anim_active");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Active Action", "Animation data-block has active action");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "active_action_unset", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "anim_non_active");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "No Active Action", "Animation data-block doesn't have active action");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "strip");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Strips", "Action-Clip Strip - Unselected");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "strip_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Strips Selected", "Action-Clip Strip - Selected");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "transition_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_transition");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Transitions", "Transition Strip - Unselected");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "transition_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_transition_sel");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Transitions Selected", "Transition Strip - Selected");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "meta_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_meta");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Meta Strips", "Meta Strip - Unselected (for grouping related strips)");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "meta_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_meta_sel");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Meta Strips Selected", "Meta Strip - Selected (for grouping related strips)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "sound_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_sound");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Sound Strips",
- "Sound Strip - Unselected (for timing speaker sounds)");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "sound_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_sound_sel");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Sound Strips Selected",
- "Sound Strip - Selected (for timing speaker sounds)");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "tweak", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_tweaking");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Tweak", "Color for strip/action being 'tweaked' or edited");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "tweak_duplicate", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "nla_tweakdupli");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Tweak Duplicate Flag",
- "Warning/error indicator color for strips referencing the strip being tweaked");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keyborder");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Keyframe Border", "Color of keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of selected keyframe border");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_nla */
+ srna = RNA_def_struct(brna, "ThemeNLAEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Nonlinear Animation", "Theme settings for the NLA Editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_list_main(srna);
+
+ prop = RNA_def_property(srna, "grid", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Grid", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "view_sliders", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "shade1");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "View Sliders", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "active_action", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "anim_active");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Active Action", "Animation data-block has active action");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "active_action_unset", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "anim_non_active");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(
+ prop, "No Active Action", "Animation data-block doesn't have active action");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "preview_range", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "anim_preview_range");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Preview Range", "Color of preview range overlay");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "strip");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Strips", "Action-Clip Strip - Unselected");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "strip_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Strips Selected", "Action-Clip Strip - Selected");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "transition_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_transition");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Transitions", "Transition Strip - Unselected");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "transition_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_transition_sel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Transitions Selected", "Transition Strip - Selected");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "meta_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_meta");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Meta Strips", "Meta Strip - Unselected (for grouping related strips)");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "meta_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_meta_sel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Meta Strips Selected", "Meta Strip - Selected (for grouping related strips)");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "sound_strips", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_sound");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Sound Strips", "Sound Strip - Unselected (for timing speaker sounds)");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "sound_strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_sound_sel");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Sound Strips Selected", "Sound Strip - Selected (for timing speaker sounds)");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "tweak", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_tweaking");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Tweak", "Color for strip/action being 'tweaked' or edited");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "tweak_duplicate", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "nla_tweakdupli");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop,
+ "Tweak Duplicate Flag",
+ "Warning/error indicator color for strips referencing the strip being tweaked");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_border", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keyborder");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Keyframe Border", "Color of keyframe border");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "keyframe_border_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "keyborder_select");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Keyframe Border Selected", "Color of selected keyframe border");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_colorset(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "ThemeBoneColorSet", NULL);
- RNA_def_struct_sdna(srna, "ThemeWireColor");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Bone Color Set", "Theme settings for bone color sets");
+ srna = RNA_def_struct(brna, "ThemeBoneColorSet", NULL);
+ RNA_def_struct_sdna(srna, "ThemeWireColor");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Bone Color Set", "Theme settings for bone color sets");
- prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "solid");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Regular", "Color used for the surface of bones");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "normal", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "solid");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Regular", "Color used for the surface of bones");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Select", "Color used for selected bones");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "select", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Select", "Color used for selected bones");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "active", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Active", "Color used for active bones");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "active", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active", "Color used for active bones");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
- prop = RNA_def_property(srna, "show_colored_constraints", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", TH_WIRECOLOR_CONSTCOLS);
- RNA_def_property_ui_text(prop, "Colored Constraints",
- "Allow the use of colors indicating constraints/keyed status");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+ prop = RNA_def_property(srna, "show_colored_constraints", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", TH_WIRECOLOR_CONSTCOLS);
+ RNA_def_property_ui_text(
+ prop, "Colored Constraints", "Allow the use of colors indicating constraints/keyed status");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
}
static void rna_def_userdef_theme_space_clip(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- /* space_clip */
-
- srna = RNA_def_struct(brna, "ThemeClipEditor", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Clip Editor", "Theme settings for the Movie Clip Editor");
-
- rna_def_userdef_theme_spaces_main(srna);
- rna_def_userdef_theme_spaces_list_main(srna);
-
- rna_def_userdef_theme_spaces_gpencil(srna);
-
- prop = RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "marker_outline");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outline");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "marker");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Marker Color", "Color of marker");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "active_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "act_marker");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Active Marker", "Color of active marker");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "selected_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "sel_marker");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Selected Marker", "Color of selected marker");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "dis_marker");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Disabled Marker", "Color of disabled marker");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "locked_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "lock_marker");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Locked Marker", "Color of locked marker");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "path_before", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "path_before");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Path Before", "Color of path before current frame");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "path_after", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "path_after");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Path After", "Color of path after current frame");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "cframe");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Current Frame", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "strip");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Strips", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "strip_select");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Strips Selected", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "metadatabg");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Metadata Background", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "metadatatext");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Metadata Text", "");
- RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
-
- rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ /* space_clip */
+
+ srna = RNA_def_struct(brna, "ThemeClipEditor", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Clip Editor", "Theme settings for the Movie Clip Editor");
+
+ rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_list_main(srna);
+
+ rna_def_userdef_theme_spaces_gpencil(srna);
+
+ prop = RNA_def_property(srna, "marker_outline", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "marker_outline");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Marker Outline Color", "Color of marker's outline");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Marker Color", "Color of marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "active_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "act_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Active Marker", "Color of active marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "selected_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "sel_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Selected Marker", "Color of selected marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "disabled_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "dis_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Disabled Marker", "Color of disabled marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "locked_marker", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "lock_marker");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Locked Marker", "Color of locked marker");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "path_before", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "path_before");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Path Before", "Color of path before current frame");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "path_after", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "path_after");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Path After", "Color of path after current frame");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "frame_current", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "cframe");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Current Frame", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "strips", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "strip");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Strips", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "strips_selected", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "strip_select");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Strips Selected", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "metadatabg", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "metadatabg");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Metadata Background", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ prop = RNA_def_property(srna, "metadatatext", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "metadatatext");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Metadata Text", "");
+ RNA_def_property_update(prop, 0, "rna_userdef_theme_update");
+
+ rna_def_userdef_theme_spaces_curves(srna, false, false, false, true);
}
static void rna_def_userdef_theme_space_topbar(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- /* space_topbar */
+ /* space_topbar */
- srna = RNA_def_struct(brna, "ThemeTopBar", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Top Bar", "Theme settings for the Top Bar");
+ srna = RNA_def_struct(brna, "ThemeTopBar", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Top Bar", "Theme settings for the Top Bar");
- rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_main(srna);
}
static void rna_def_userdef_theme_space_statusbar(BlenderRNA *brna)
{
- StructRNA *srna;
+ StructRNA *srna;
- /* space_statusbar */
+ /* space_statusbar */
- srna = RNA_def_struct(brna, "ThemeStatusBar", NULL);
- RNA_def_struct_sdna(srna, "ThemeSpace");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme Status Bar", "Theme settings for the Status Bar");
+ srna = RNA_def_struct(brna, "ThemeStatusBar", NULL);
+ RNA_def_struct_sdna(srna, "ThemeSpace");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Theme Status Bar", "Theme settings for the Status Bar");
- rna_def_userdef_theme_spaces_main(srna);
+ rna_def_userdef_theme_spaces_main(srna);
}
static void rna_def_userdef_themes(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem active_theme_area[] = {
- {0, "USER_INTERFACE", ICON_WORKSPACE, "User Interface", ""},
- {19, "STYLE", ICON_FONTPREVIEW, "Text Style", ""},
- {18, "BONE_COLOR_SETS", ICON_COLOR, "Bone Color Sets", ""},
- {1, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
- {3, "GRAPH_EDITOR", ICON_GRAPH, "Graph Editor", ""},
- {4, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", ""},
- {5, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", ""},
- {6, "IMAGE_EDITOR", ICON_IMAGE, "UV/Image Editor", ""},
- {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""},
- {8, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""},
- {9, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""},
- {11, "PROPERTIES", ICON_PROPERTIES, "Properties", ""},
- {12, "OUTLINER", ICON_OUTLINER, "Outliner", ""},
- {14, "PREFERENCES", ICON_PREFERENCES, "Preferences", ""},
- {15, "INFO", ICON_INFO, "Info", ""},
- {16, "FILE_BROWSER", ICON_FILEBROWSER, "File Browser", ""},
- {17, "CONSOLE", ICON_CONSOLE, "Python Console", ""},
- {20, "CLIP_EDITOR", ICON_TRACKER, "Movie Clip Editor", ""},
- {21, "TOPBAR", ICON_NONE, "Top Bar", ""},
- {22, "STATUSBAR", ICON_NONE, "Status Bar", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "Theme", NULL);
- RNA_def_struct_sdna(srna, "bTheme");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Theme", "Theme settings defining draw style and colors in the user interface");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "Name of the theme");
- RNA_def_struct_name_property(srna, prop);
- /* XXX: for now putting this in presets is silly - its just Default */
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
-
- prop = RNA_def_property(srna, "theme_area", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "active_theme_area");
- RNA_def_property_flag(prop, PROP_SKIP_SAVE);
- RNA_def_property_enum_items(prop, active_theme_area);
- RNA_def_property_ui_text(prop, "Active Theme Area", "");
-
- prop = RNA_def_property(srna, "user_interface", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "tui");
- RNA_def_property_struct_type(prop, "ThemeUserInterface");
- RNA_def_property_ui_text(prop, "User Interface", "");
-
- /* Space Types */
- prop = RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_view3d");
- RNA_def_property_struct_type(prop, "ThemeView3D");
- RNA_def_property_ui_text(prop, "3D View", "");
-
- prop = RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_graph");
- RNA_def_property_struct_type(prop, "ThemeGraphEditor");
- RNA_def_property_ui_text(prop, "Graph Editor", "");
-
- prop = RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_file");
- RNA_def_property_struct_type(prop, "ThemeFileBrowser");
- RNA_def_property_ui_text(prop, "File Browser", "");
-
- prop = RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_nla");
- RNA_def_property_struct_type(prop, "ThemeNLAEditor");
- RNA_def_property_ui_text(prop, "Nonlinear Animation", "");
-
- prop = RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_action");
- RNA_def_property_struct_type(prop, "ThemeDopeSheet");
- RNA_def_property_ui_text(prop, "Dope Sheet", "");
-
- prop = RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_image");
- RNA_def_property_struct_type(prop, "ThemeImageEditor");
- RNA_def_property_ui_text(prop, "Image Editor", "");
-
- prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_sequencer");
- RNA_def_property_struct_type(prop, "ThemeSequenceEditor");
- RNA_def_property_ui_text(prop, "Sequence Editor", "");
-
- prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_properties");
- RNA_def_property_struct_type(prop, "ThemeProperties");
- RNA_def_property_ui_text(prop, "Properties", "");
-
- prop = RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_text");
- RNA_def_property_struct_type(prop, "ThemeTextEditor");
- RNA_def_property_ui_text(prop, "Text Editor", "");
-
- prop = RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_node");
- RNA_def_property_struct_type(prop, "ThemeNodeEditor");
- RNA_def_property_ui_text(prop, "Node 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, "space_outliner");
- RNA_def_property_struct_type(prop, "ThemeOutliner");
- RNA_def_property_ui_text(prop, "Outliner", "");
-
- prop = RNA_def_property(srna, "info", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_info");
- RNA_def_property_struct_type(prop, "ThemeInfo");
- RNA_def_property_ui_text(prop, "Info", "");
-
- prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_preferences");
- RNA_def_property_struct_type(prop, "ThemePreferences");
- RNA_def_property_ui_text(prop, "Preferences", "");
-
- prop = RNA_def_property(srna, "console", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_console");
- RNA_def_property_struct_type(prop, "ThemeConsole");
- RNA_def_property_ui_text(prop, "Console", "");
-
- prop = RNA_def_property(srna, "clip_editor", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_clip");
- RNA_def_property_struct_type(prop, "ThemeClipEditor");
- RNA_def_property_ui_text(prop, "Clip Editor", "");
-
- prop = RNA_def_property(srna, "topbar", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_topbar");
- RNA_def_property_struct_type(prop, "ThemeTopBar");
- RNA_def_property_ui_text(prop, "Top Bar", "");
-
- prop = RNA_def_property(srna, "statusbar", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "space_statusbar");
- RNA_def_property_struct_type(prop, "ThemeStatusBar");
- RNA_def_property_ui_text(prop, "Status Bar", "");
- /* end space types */
-
- prop = RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
- RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
- RNA_def_property_ui_text(prop, "Bone Color Sets", "");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem active_theme_area[] = {
+ {0, "USER_INTERFACE", ICON_WORKSPACE, "User Interface", ""},
+ {19, "STYLE", ICON_FONTPREVIEW, "Text Style", ""},
+ {18, "BONE_COLOR_SETS", ICON_COLOR, "Bone Color Sets", ""},
+ {1, "VIEW_3D", ICON_VIEW3D, "3D View", ""},
+ {3, "GRAPH_EDITOR", ICON_GRAPH, "Graph Editor", ""},
+ {4, "DOPESHEET_EDITOR", ICON_ACTION, "Dope Sheet", ""},
+ {5, "NLA_EDITOR", ICON_NLA, "Nonlinear Animation", ""},
+ {6, "IMAGE_EDITOR", ICON_IMAGE, "UV/Image Editor", ""},
+ {7, "SEQUENCE_EDITOR", ICON_SEQUENCE, "Video Sequence Editor", ""},
+ {8, "TEXT_EDITOR", ICON_TEXT, "Text Editor", ""},
+ {9, "NODE_EDITOR", ICON_NODETREE, "Node Editor", ""},
+ {11, "PROPERTIES", ICON_PROPERTIES, "Properties", ""},
+ {12, "OUTLINER", ICON_OUTLINER, "Outliner", ""},
+ {14, "PREFERENCES", ICON_PREFERENCES, "Preferences", ""},
+ {15, "INFO", ICON_INFO, "Info", ""},
+ {16, "FILE_BROWSER", ICON_FILEBROWSER, "File Browser", ""},
+ {17, "CONSOLE", ICON_CONSOLE, "Python Console", ""},
+ {20, "CLIP_EDITOR", ICON_TRACKER, "Movie Clip Editor", ""},
+ {21, "TOPBAR", ICON_NONE, "Top Bar", ""},
+ {22, "STATUSBAR", ICON_NONE, "Status Bar", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "Theme", NULL);
+ RNA_def_struct_sdna(srna, "bTheme");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(
+ srna, "Theme", "Theme settings defining draw style and colors in the user interface");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "Name of the theme");
+ RNA_def_struct_name_property(srna, prop);
+ /* XXX: for now putting this in presets is silly - its just Default */
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+
+ prop = RNA_def_property(srna, "theme_area", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "active_theme_area");
+ RNA_def_property_flag(prop, PROP_SKIP_SAVE);
+ RNA_def_property_enum_items(prop, active_theme_area);
+ RNA_def_property_ui_text(prop, "Active Theme Area", "");
+
+ prop = RNA_def_property(srna, "user_interface", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "tui");
+ RNA_def_property_struct_type(prop, "ThemeUserInterface");
+ RNA_def_property_ui_text(prop, "User Interface", "");
+
+ /* Space Types */
+ prop = RNA_def_property(srna, "view_3d", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_view3d");
+ RNA_def_property_struct_type(prop, "ThemeView3D");
+ RNA_def_property_ui_text(prop, "3D View", "");
+
+ prop = RNA_def_property(srna, "graph_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_graph");
+ RNA_def_property_struct_type(prop, "ThemeGraphEditor");
+ RNA_def_property_ui_text(prop, "Graph Editor", "");
+
+ prop = RNA_def_property(srna, "file_browser", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_file");
+ RNA_def_property_struct_type(prop, "ThemeFileBrowser");
+ RNA_def_property_ui_text(prop, "File Browser", "");
+
+ prop = RNA_def_property(srna, "nla_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_nla");
+ RNA_def_property_struct_type(prop, "ThemeNLAEditor");
+ RNA_def_property_ui_text(prop, "Nonlinear Animation", "");
+
+ prop = RNA_def_property(srna, "dopesheet_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_action");
+ RNA_def_property_struct_type(prop, "ThemeDopeSheet");
+ RNA_def_property_ui_text(prop, "Dope Sheet", "");
+
+ prop = RNA_def_property(srna, "image_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_image");
+ RNA_def_property_struct_type(prop, "ThemeImageEditor");
+ RNA_def_property_ui_text(prop, "Image Editor", "");
+
+ prop = RNA_def_property(srna, "sequence_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_sequencer");
+ RNA_def_property_struct_type(prop, "ThemeSequenceEditor");
+ RNA_def_property_ui_text(prop, "Sequence Editor", "");
+
+ prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_properties");
+ RNA_def_property_struct_type(prop, "ThemeProperties");
+ RNA_def_property_ui_text(prop, "Properties", "");
+
+ prop = RNA_def_property(srna, "text_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_text");
+ RNA_def_property_struct_type(prop, "ThemeTextEditor");
+ RNA_def_property_ui_text(prop, "Text Editor", "");
+
+ prop = RNA_def_property(srna, "node_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_node");
+ RNA_def_property_struct_type(prop, "ThemeNodeEditor");
+ RNA_def_property_ui_text(prop, "Node 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, "space_outliner");
+ RNA_def_property_struct_type(prop, "ThemeOutliner");
+ RNA_def_property_ui_text(prop, "Outliner", "");
+
+ prop = RNA_def_property(srna, "info", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_info");
+ RNA_def_property_struct_type(prop, "ThemeInfo");
+ RNA_def_property_ui_text(prop, "Info", "");
+
+ prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_preferences");
+ RNA_def_property_struct_type(prop, "ThemePreferences");
+ RNA_def_property_ui_text(prop, "Preferences", "");
+
+ prop = RNA_def_property(srna, "console", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_console");
+ RNA_def_property_struct_type(prop, "ThemeConsole");
+ RNA_def_property_ui_text(prop, "Console", "");
+
+ prop = RNA_def_property(srna, "clip_editor", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_clip");
+ RNA_def_property_struct_type(prop, "ThemeClipEditor");
+ RNA_def_property_ui_text(prop, "Clip Editor", "");
+
+ prop = RNA_def_property(srna, "topbar", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_topbar");
+ RNA_def_property_struct_type(prop, "ThemeTopBar");
+ RNA_def_property_ui_text(prop, "Top Bar", "");
+
+ prop = RNA_def_property(srna, "statusbar", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "space_statusbar");
+ RNA_def_property_struct_type(prop, "ThemeStatusBar");
+ RNA_def_property_ui_text(prop, "Status Bar", "");
+ /* end space types */
+
+ prop = RNA_def_property(srna, "bone_color_sets", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_collection_sdna(prop, NULL, "tarm", "");
+ RNA_def_property_struct_type(prop, "ThemeBoneColorSet");
+ RNA_def_property_ui_text(prop, "Bone Color Sets", "");
}
static void rna_def_userdef_addon(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "Addon", NULL);
- RNA_def_struct_sdna(srna, "bAddon");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Add-on", "Python add-ons to be loaded automatically");
+ srna = RNA_def_struct(brna, "Addon", NULL);
+ RNA_def_struct_sdna(srna, "bAddon");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Add-on", "Python add-ons to be loaded automatically");
- prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Module", "Module name");
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "module", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Module", "Module name");
+ RNA_def_struct_name_property(srna, prop);
- /* Collection active property */
- prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "AddonPreferences");
- RNA_def_property_pointer_funcs(prop, "rna_Addon_preferences_get", NULL, NULL, NULL);
+ /* Collection active property */
+ prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "AddonPreferences");
+ RNA_def_property_pointer_funcs(prop, "rna_Addon_preferences_get", NULL, NULL, NULL);
}
static void rna_def_userdef_studiolights(BlenderRNA *brna)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "StudioLights", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_ui_text(srna, "Studio Lights", "Collection of studio lights");
-
- func = RNA_def_function(srna, "load", "rna_StudioLights_load");
- RNA_def_function_ui_description(func, "Load studiolight from file");
- parm = RNA_def_string(func, "path", NULL, 0, "File Path", "File path where the studio light file can be found");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_studio_light_type_items, STUDIOLIGHT_TYPE_WORLD, "Type", "The type for the new studio light");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new", "rna_StudioLights_new");
- RNA_def_function_ui_description(func, "Create studiolight from default lighting");
- parm = RNA_def_string(func, "path", NULL, 0, "Path", "Path to the file that will contain the lighing info (without extension)");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_StudioLights_remove");
- RNA_def_function_ui_description(func, "Remove a studio light");
- parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "The studio light to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "refresh", "rna_StudioLights_refresh");
- RNA_def_function_ui_description(func, "Refresh Studio Lights from disk");
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "StudioLights", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_ui_text(srna, "Studio Lights", "Collection of studio lights");
+
+ func = RNA_def_function(srna, "load", "rna_StudioLights_load");
+ RNA_def_function_ui_description(func, "Load studiolight from file");
+ parm = RNA_def_string(
+ func, "path", NULL, 0, "File Path", "File path where the studio light file can be found");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func,
+ "type",
+ rna_enum_studio_light_type_items,
+ STUDIOLIGHT_TYPE_WORLD,
+ "Type",
+ "The type for the new studio light");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new", "rna_StudioLights_new");
+ RNA_def_function_ui_description(func, "Create studiolight from default lighting");
+ parm = RNA_def_string(func,
+ "path",
+ NULL,
+ 0,
+ "Path",
+ "Path to the file that will contain the lighing info (without extension)");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "Newly created StudioLight");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_StudioLights_remove");
+ RNA_def_function_ui_description(func, "Remove a studio light");
+ parm = RNA_def_pointer(func, "studio_light", "StudioLight", "", "The studio light to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "refresh", "rna_StudioLights_refresh");
+ RNA_def_function_ui_description(func, "Refresh Studio Lights from disk");
}
static void rna_def_userdef_studiolight(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_define_verify_sdna(false);
- srna = RNA_def_struct(brna, "StudioLight", NULL);
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Studio Light", "Studio light");
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
- RNA_def_property_int_funcs(prop, "rna_UserDef_studiolight_index_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Index", "");
-
- prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_UserDef_studiolight_is_user_defined_get", NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "User Defined", "");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_studio_light_type_items);
- RNA_def_property_enum_funcs(prop, "rna_UserDef_studiolight_type_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_name_get", "rna_UserDef_studiolight_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_get", "rna_UserDef_studiolight_path_length", NULL);
- RNA_def_property_ui_text(prop, "Path", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
- RNA_def_property_struct_type(prop, "UserSolidLight");
- RNA_def_property_collection_funcs(prop, "rna_UserDef_studiolight_solid_lights_begin", "rna_iterator_array_next",
- "rna_iterator_array_end", "rna_iterator_array_get",
- "rna_UserDef_studiolight_solid_lights_length", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Solid Lights", "Lights user to display objects in solid draw mode");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "light_ambient", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_UserDef_studiolight_light_ambient_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Ambient Color", "Color of the ambient light that uniformly lit the scene");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "path_irr_cache", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_irr_cache_get", "rna_UserDef_studiolight_path_irr_cache_length", NULL);
- RNA_def_property_ui_text(prop, "Irradiance Cache Path", "Path where the irradiance cache is stored");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "path_sh_cache", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_funcs(prop, "rna_UserDef_studiolight_path_sh_cache_get", "rna_UserDef_studiolight_path_sh_cache_length", NULL);
- RNA_def_property_ui_text(prop, "SH Cache Path", "Path where the spherical harmonics cache is stored");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- const int spherical_harmonics_dim[] = {STUDIOLIGHT_SH_EFFECTIVE_COEFS_LEN, 3};
- prop = RNA_def_property(srna, "spherical_harmonics_coefficients", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_multi_array(prop, 2, spherical_harmonics_dim);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_UserDef_studiolight_spherical_harmonics_coefficients_get", NULL, NULL);
-
- RNA_define_verify_sdna(true);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_define_verify_sdna(false);
+ srna = RNA_def_struct(brna, "StudioLight", NULL);
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Studio Light", "Studio light");
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_int_funcs(prop, "rna_UserDef_studiolight_index_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Index", "");
+
+ prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_UserDef_studiolight_is_user_defined_get", NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "User Defined", "");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_studio_light_type_items);
+ RNA_def_property_enum_funcs(prop, "rna_UserDef_studiolight_type_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_UserDef_studiolight_name_get", "rna_UserDef_studiolight_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_funcs(
+ prop, "rna_UserDef_studiolight_path_get", "rna_UserDef_studiolight_path_length", NULL);
+ RNA_def_property_ui_text(prop, "Path", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
+ RNA_def_property_struct_type(prop, "UserSolidLight");
+ RNA_def_property_collection_funcs(prop,
+ "rna_UserDef_studiolight_solid_lights_begin",
+ "rna_iterator_array_next",
+ "rna_iterator_array_end",
+ "rna_iterator_array_get",
+ "rna_UserDef_studiolight_solid_lights_length",
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Solid Lights", "Lights user to display objects in solid draw mode");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "light_ambient", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_UserDef_studiolight_light_ambient_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Ambient Color", "Color of the ambient light that uniformly lit the scene");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "path_irr_cache", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_funcs(prop,
+ "rna_UserDef_studiolight_path_irr_cache_get",
+ "rna_UserDef_studiolight_path_irr_cache_length",
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "Irradiance Cache Path", "Path where the irradiance cache is stored");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "path_sh_cache", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_funcs(prop,
+ "rna_UserDef_studiolight_path_sh_cache_get",
+ "rna_UserDef_studiolight_path_sh_cache_length",
+ NULL);
+ RNA_def_property_ui_text(
+ prop, "SH Cache Path", "Path where the spherical harmonics cache is stored");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ const int spherical_harmonics_dim[] = {STUDIOLIGHT_SH_EFFECTIVE_COEFS_LEN, 3};
+ prop = RNA_def_property(srna, "spherical_harmonics_coefficients", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_multi_array(prop, 2, spherical_harmonics_dim);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(
+ prop, "rna_UserDef_studiolight_spherical_harmonics_coefficients_get", NULL, NULL);
+
+ RNA_define_verify_sdna(true);
}
static void rna_def_userdef_pathcompare(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "PathCompare", NULL);
- RNA_def_struct_sdna(srna, "bPathCompare");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Path Compare", "Match paths against this value");
+ srna = RNA_def_struct(brna, "PathCompare", NULL);
+ RNA_def_struct_sdna(srna, "bPathCompare");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Path Compare", "Match paths against this value");
- prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_ui_text(prop, "Path", "");
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_ui_text(prop, "Path", "");
+ RNA_def_struct_name_property(srna, prop);
- prop = RNA_def_property(srna, "use_glob", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_PATHCMP_GLOB);
- RNA_def_property_ui_text(prop, "Use Wildcard", "Enable wildcard globbing");
+ prop = RNA_def_property(srna, "use_glob", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_PATHCMP_GLOB);
+ RNA_def_property_ui_text(prop, "Use Wildcard", "Enable wildcard globbing");
}
static void rna_def_userdef_addon_pref(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "AddonPreferences", NULL);
- RNA_def_struct_ui_text(srna, "Add-on Preferences", "");
- RNA_def_struct_sdna(srna, "bAddon"); /* WARNING: only a bAddon during registration */
+ srna = RNA_def_struct(brna, "AddonPreferences", NULL);
+ RNA_def_struct_ui_text(srna, "Add-on Preferences", "");
+ RNA_def_struct_sdna(srna, "bAddon"); /* WARNING: only a bAddon during registration */
- RNA_def_struct_refine_func(srna, "rna_AddonPref_refine");
- RNA_def_struct_register_funcs(srna, "rna_AddonPref_register", "rna_AddonPref_unregister", NULL);
- RNA_def_struct_idprops_func(srna, "rna_AddonPref_idprops");
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); /* Mandatory! */
+ RNA_def_struct_refine_func(srna, "rna_AddonPref_refine");
+ RNA_def_struct_register_funcs(srna, "rna_AddonPref_register", "rna_AddonPref_unregister", NULL);
+ RNA_def_struct_idprops_func(srna, "rna_AddonPref_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); /* Mandatory! */
- /* registration */
- RNA_define_verify_sdna(0);
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "module");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_define_verify_sdna(1);
+ /* registration */
+ RNA_define_verify_sdna(0);
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "module");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_define_verify_sdna(1);
}
-
static void rna_def_userdef_dothemes(BlenderRNA *brna)
{
- rna_def_userdef_theme_ui_style(brna);
- rna_def_userdef_theme_ui(brna);
-
- rna_def_userdef_theme_space_generic(brna);
- rna_def_userdef_theme_space_gradient(brna);
- rna_def_userdef_theme_space_list_generic(brna);
-
- rna_def_userdef_theme_space_view3d(brna);
- rna_def_userdef_theme_space_graph(brna);
- rna_def_userdef_theme_space_file(brna);
- rna_def_userdef_theme_space_nla(brna);
- rna_def_userdef_theme_space_action(brna);
- rna_def_userdef_theme_space_image(brna);
- rna_def_userdef_theme_space_seq(brna);
- rna_def_userdef_theme_space_buts(brna);
- rna_def_userdef_theme_space_text(brna);
- rna_def_userdef_theme_space_node(brna);
- rna_def_userdef_theme_space_outliner(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_clip(brna);
- rna_def_userdef_theme_space_topbar(brna);
- rna_def_userdef_theme_space_statusbar(brna);
- rna_def_userdef_theme_colorset(brna);
- rna_def_userdef_themes(brna);
+ rna_def_userdef_theme_ui_style(brna);
+ rna_def_userdef_theme_ui(brna);
+
+ rna_def_userdef_theme_space_generic(brna);
+ rna_def_userdef_theme_space_gradient(brna);
+ rna_def_userdef_theme_space_list_generic(brna);
+
+ rna_def_userdef_theme_space_view3d(brna);
+ rna_def_userdef_theme_space_graph(brna);
+ rna_def_userdef_theme_space_file(brna);
+ rna_def_userdef_theme_space_nla(brna);
+ rna_def_userdef_theme_space_action(brna);
+ rna_def_userdef_theme_space_image(brna);
+ rna_def_userdef_theme_space_seq(brna);
+ rna_def_userdef_theme_space_buts(brna);
+ rna_def_userdef_theme_space_text(brna);
+ rna_def_userdef_theme_space_node(brna);
+ rna_def_userdef_theme_space_outliner(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_clip(brna);
+ rna_def_userdef_theme_space_topbar(brna);
+ rna_def_userdef_theme_space_statusbar(brna);
+ rna_def_userdef_theme_colorset(brna);
+ rna_def_userdef_themes(brna);
}
static void rna_def_userdef_solidlight(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
- static float default_dir[3] = {0.f, 0.f, 1.f};
- static float default_col[3] = {0.8f, 0.8f, 0.8f};
-
- srna = RNA_def_struct(brna, "UserSolidLight", NULL);
- RNA_def_struct_sdna(srna, "SolidLight");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Solid Light", "Light used for Studio lighting in solid draw mode");
-
- prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
- RNA_def_property_boolean_default(prop, true);
- RNA_def_property_ui_text(prop, "Enabled", "Enable this light in solid draw mode");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
-
- prop = RNA_def_property(srna, "smooth", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "smooth");
- RNA_def_property_float_default(prop, 0.5f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Smooth", "Smooth the lighting from this light");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
-
- prop = RNA_def_property(srna, "direction", PROP_FLOAT, PROP_DIRECTION);
- RNA_def_property_float_sdna(prop, NULL, "vec");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_dir);
- RNA_def_property_ui_text(prop, "Direction", "Direction that the light is shining");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
-
- prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "spec");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_col);
- RNA_def_property_ui_text(prop, "Specular Color", "Color of the light's specular highlight");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
-
- prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "col");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_col);
- RNA_def_property_ui_text(prop, "Diffuse Color", "Color of the light's diffuse highlight");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ static float default_dir[3] = {0.f, 0.f, 1.f};
+ static float default_col[3] = {0.8f, 0.8f, 0.8f};
+
+ srna = RNA_def_struct(brna, "UserSolidLight", NULL);
+ RNA_def_struct_sdna(srna, "SolidLight");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Solid Light", "Light used for Studio lighting in solid draw mode");
+
+ prop = RNA_def_property(srna, "use", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", 1);
+ RNA_def_property_boolean_default(prop, true);
+ RNA_def_property_ui_text(prop, "Enabled", "Enable this light in solid draw mode");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+
+ prop = RNA_def_property(srna, "smooth", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "smooth");
+ RNA_def_property_float_default(prop, 0.5f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(prop, "Smooth", "Smooth the lighting from this light");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+
+ prop = RNA_def_property(srna, "direction", PROP_FLOAT, PROP_DIRECTION);
+ RNA_def_property_float_sdna(prop, NULL, "vec");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_dir);
+ RNA_def_property_ui_text(prop, "Direction", "Direction that the light is shining");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+
+ prop = RNA_def_property(srna, "specular_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "spec");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_col);
+ RNA_def_property_ui_text(prop, "Specular Color", "Color of the light's specular highlight");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+
+ prop = RNA_def_property(srna, "diffuse_color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "col");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_col);
+ RNA_def_property_ui_text(prop, "Diffuse Color", "Color of the light's diffuse highlight");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
}
static void rna_def_userdef_walk_navigation(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "WalkNavigation", NULL);
- RNA_def_struct_sdna(srna, "WalkNavigation");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Walk Navigation", "Walk navigation settings");
+ srna = RNA_def_struct(brna, "WalkNavigation", NULL);
+ RNA_def_struct_sdna(srna, "WalkNavigation");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Walk Navigation", "Walk navigation settings");
- prop = RNA_def_property(srna, "mouse_speed", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01f, 10.0f);
- RNA_def_property_ui_text(prop, "Mouse Sensitivity", "Speed factor for when looking around, high values mean faster mouse movement");
+ prop = RNA_def_property(srna, "mouse_speed", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01f, 10.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Mouse Sensitivity",
+ "Speed factor for when looking around, high values mean faster mouse movement");
- prop = RNA_def_property(srna, "walk_speed", PROP_FLOAT, PROP_VELOCITY);
- RNA_def_property_range(prop, 0.01f, 100.f);
- RNA_def_property_ui_text(prop, "Walk Speed", "Base speed for walking and flying");
+ prop = RNA_def_property(srna, "walk_speed", PROP_FLOAT, PROP_VELOCITY);
+ RNA_def_property_range(prop, 0.01f, 100.f);
+ RNA_def_property_ui_text(prop, "Walk Speed", "Base speed for walking and flying");
- prop = RNA_def_property(srna, "walk_speed_factor", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01f, 10.f);
- RNA_def_property_ui_text(prop, "Speed Factor", "Multiplication factor when using the fast or slow modifiers");
+ prop = RNA_def_property(srna, "walk_speed_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01f, 10.f);
+ RNA_def_property_ui_text(
+ prop, "Speed Factor", "Multiplication factor when using the fast or slow modifiers");
- prop = RNA_def_property(srna, "view_height", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_ui_range(prop, 0.1f, 10.f, 0.1, 2);
- RNA_def_property_range(prop, 0.f, 1000.f);
- RNA_def_property_ui_text(prop, "View Height", "View distance from the floor when walking");
+ prop = RNA_def_property(srna, "view_height", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_ui_range(prop, 0.1f, 10.f, 0.1, 2);
+ RNA_def_property_range(prop, 0.f, 1000.f);
+ RNA_def_property_ui_text(prop, "View Height", "View distance from the floor when walking");
- prop = RNA_def_property(srna, "jump_height", PROP_FLOAT, PROP_UNIT_LENGTH);
- RNA_def_property_ui_range(prop, 0.1f, 10.f, 0.1, 2);
- RNA_def_property_range(prop, 0.1f, 100.f);
- RNA_def_property_ui_text(prop, "Jump Height", "Maximum height of a jump");
+ prop = RNA_def_property(srna, "jump_height", PROP_FLOAT, PROP_UNIT_LENGTH);
+ RNA_def_property_ui_range(prop, 0.1f, 10.f, 0.1, 2);
+ RNA_def_property_range(prop, 0.1f, 100.f);
+ RNA_def_property_ui_text(prop, "Jump Height", "Maximum height of a jump");
- prop = RNA_def_property(srna, "teleport_time", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.f, 10.f);
- RNA_def_property_ui_text(prop, "Teleport Duration", "Interval of time warp when teleporting in navigation mode");
+ prop = RNA_def_property(srna, "teleport_time", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.f, 10.f);
+ RNA_def_property_ui_text(
+ prop, "Teleport Duration", "Interval of time warp when teleporting in navigation mode");
- prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_WALK_GRAVITY);
- RNA_def_property_ui_text(prop, "Gravity", "Walk with gravity, or free navigate");
+ prop = RNA_def_property(srna, "use_gravity", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_WALK_GRAVITY);
+ RNA_def_property_ui_text(prop, "Gravity", "Walk with gravity, or free navigate");
- prop = RNA_def_property(srna, "use_mouse_reverse", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_WALK_MOUSE_REVERSE);
- RNA_def_property_ui_text(prop, "Reverse Mouse", "Reverse the vertical movement of the mouse");
+ prop = RNA_def_property(srna, "use_mouse_reverse", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_WALK_MOUSE_REVERSE);
+ RNA_def_property_ui_text(prop, "Reverse Mouse", "Reverse the vertical movement of the mouse");
}
static void rna_def_userdef_view(BlenderRNA *brna)
{
- static const EnumPropertyItem timecode_styles[] = {
- {USER_TIMECODE_MINIMAL, "MINIMAL", 0, "Minimal Info",
- "Most compact representation, uses '+' as separator for sub-second frame numbers, "
- "with left and right truncation of the timecode as necessary"},
- {USER_TIMECODE_SMPTE_FULL, "SMPTE", 0, "SMPTE (Full)", "Full SMPTE timecode (format is HH:MM:SS:FF)"},
- {USER_TIMECODE_SMPTE_MSF, "SMPTE_COMPACT", 0, "SMPTE (Compact)",
- "SMPTE timecode showing minutes, seconds, and frames only - "
- "hours are also shown if necessary, but not by default"},
- {USER_TIMECODE_MILLISECONDS, "MILLISECONDS", 0, "Compact with Milliseconds",
- "Similar to SMPTE (Compact), except that instead of frames, "
- "milliseconds are shown instead"},
- {USER_TIMECODE_SECONDS_ONLY, "SECONDS_ONLY", 0, "Only Seconds",
- "Direct conversion of frame numbers to seconds"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem color_picker_types[] = {
- {USER_CP_CIRCLE_HSV, "CIRCLE_HSV", 0, "Circle (HSV)", "A circular Hue/Saturation color wheel, with "
- "Value slider"},
- {USER_CP_CIRCLE_HSL, "CIRCLE_HSL", 0, "Circle (HSL)", "A circular Hue/Saturation color wheel, with "
- "Lightness slider"},
- {USER_CP_SQUARE_SV, "SQUARE_SV", 0, "Square (SV + H)", "A square showing Saturation/Value, with Hue slider"},
- {USER_CP_SQUARE_HS, "SQUARE_HS", 0, "Square (HS + V)", "A square showing Hue/Saturation, with Value slider"},
- {USER_CP_SQUARE_HV, "SQUARE_HV", 0, "Square (HV + S)", "A square showing Hue/Value, with Saturation slider"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem zoom_frame_modes[] = {
- {ZOOM_FRAME_MODE_KEEP_RANGE, "KEEP_RANGE", 0, "Keep Range", ""},
- {ZOOM_FRAME_MODE_SECONDS, "SECONDS", 0, "Seconds", ""},
- {ZOOM_FRAME_MODE_KEYFRAMES, "KEYFRAMES", 0, "Keyframes", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem line_width[] = {
- {-1, "THIN", 0, "Thin", "Thinner lines than the default"},
- { 0, "AUTO", 0, "Auto", "Automatic line width based on UI scale"},
- { 1, "THICK", 0, "Thick", "Thicker lines than the default"},
- {0, NULL, 0, NULL, NULL},
- };
-
- PropertyRNA *prop;
- StructRNA *srna;
-
- srna = RNA_def_struct(brna, "PreferencesView", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_nested(brna, srna, "Preferences");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "View & Controls", "Preferences related to viewing data");
-
- /* View */
- prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "UI Scale", "Changes the size of the fonts and widgets in the interface");
- RNA_def_property_range(prop, 0.25f, 4.0f);
- RNA_def_property_ui_range(prop, 0.5f, 2.0f, 1, 2);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
- prop = RNA_def_property(srna, "ui_line_width", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, line_width);
- RNA_def_property_ui_text(prop, "UI Line Width",
- "Changes the thickness of widget outlines, lines and points in the interface, "
- "for high DPI displays");
- RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
- /* display */
- prop = RNA_def_property(srna, "show_tooltips", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS);
- RNA_def_property_ui_text(prop, "Tooltips", "Display tooltips (when off hold Alt to force display)");
-
- prop = RNA_def_property(srna, "show_tooltips_python", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS_PYTHON);
- RNA_def_property_ui_text(prop, "Python Tooltips", "Show Python references in tooltips");
-
- prop = RNA_def_property(srna, "show_developer_ui", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DEVELOPER_UI);
- RNA_def_property_ui_text(
- prop, "Developer Extras",
- "Show options for developers (edit source in context menu, geometry indices)");
-
- prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
- RNA_def_property_ui_text(prop, "Display Object Info", "Display objects name and frame number in 3D view");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "show_large_cursors", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "curssize", 0);
- RNA_def_property_ui_text(prop, "Large Cursors", "Use large mouse cursors when available");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "show_view_name", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_VIEWPORTNAME);
- RNA_def_property_ui_text(prop, "Show View Name", "Show the name of the view's direction in each 3D View");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
- RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");
-
-
- prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS);
- RNA_def_property_ui_text(prop, "Show Playback FPS",
- "Show the frames per second screen refresh rate, while animation is played back");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- static const EnumPropertyItem factor_display_items[] = {
- {USER_FACTOR_AS_FACTOR, "FACTOR", 0, "Factor", "Display factors as values between 0 and 1"},
- {USER_FACTOR_AS_PERCENTAGE, "PERCENTAGE", 0, "Percentage", "Display factors as percentages"},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "factor_display_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, factor_display_items);
- RNA_def_property_ui_text(prop, "Factor Display Type", "How factor values are displayed");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* Weight Paint */
-
- prop = RNA_def_property(srna, "use_weight_color_range", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_CUSTOM_RANGE);
- RNA_def_property_ui_text(prop, "Use Weight Color Range",
- "Enable color range used for weight visualization in weight painting mode");
- RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
-
- prop = RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "coba_weight");
- RNA_def_property_struct_type(prop, "ColorRamp");
- RNA_def_property_ui_text(prop, "Weight Color Range",
- "Color range used for weight visualization in weight painting mode");
- RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
-
- prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "app_flag", USER_APP_LOCK_UI_LAYOUT);
- RNA_def_property_ui_text(prop, "Editor Corner Splitting", "Split and join editors by dragging from corners");
- RNA_def_property_update(prop, 0, "rna_userdef_update_ui");
-
- /* menus */
- prop = RNA_def_property(srna, "use_mouse_over_open", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MENUOPENAUTO);
- RNA_def_property_ui_text(prop, "Open On Mouse Over",
- "Open menu buttons and pulldowns automatically when the mouse is hovering");
-
- prop = RNA_def_property(srna, "open_toplevel_delay", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "menuthreshold1");
- RNA_def_property_range(prop, 1, 40);
- RNA_def_property_ui_text(prop, "Top Level Menu Open Delay",
- "Time delay in 1/10 seconds before automatically opening top level menus");
-
- prop = RNA_def_property(srna, "open_sublevel_delay", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "menuthreshold2");
- RNA_def_property_range(prop, 1, 40);
- RNA_def_property_ui_text(prop, "Sub Level Menu Open Delay",
- "Time delay in 1/10 seconds before automatically opening sub level menus");
-
- prop = RNA_def_property(srna, "color_picker_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, color_picker_types);
- RNA_def_property_enum_sdna(prop, NULL, "color_picker_type");
- RNA_def_property_ui_text(prop, "Color Picker Type", "Different styles of displaying the color picker widget");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* pie menus */
- prop = RNA_def_property(srna, "pie_initial_timeout", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Recenter Timeout",
- "Pie menus will use the initial mouse position as center for this amount of time "
- "(in 1/100ths of sec)");
-
- prop = RNA_def_property(srna, "pie_tap_timeout", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Tap Key Timeout",
- "Pie menu button held longer than this will dismiss menu on release."
- "(in 1/100ths of sec)");
-
- prop = RNA_def_property(srna, "pie_animation_timeout", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Animation Timeout",
- "Time needed to fully animate the pie to unfolded state (in 1/100ths of sec)");
-
- prop = RNA_def_property(srna, "pie_menu_radius", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Radius", "Pie menu size in pixels");
-
- prop = RNA_def_property(srna, "pie_menu_threshold", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Threshold", "Distance from center needed before a selection can be made");
-
- prop = RNA_def_property(srna, "pie_menu_confirm", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Confirm Threshold",
- "Distance threshold after which selection is made (zero to disable)");
-
- prop = RNA_def_property(srna, "use_save_prompt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SAVE_PROMPT);
- RNA_def_property_ui_text(prop, "Save Prompt",
- "Ask for confirmation when quitting with unsaved changes");
-
- prop = RNA_def_property(srna, "show_column_layout", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_PLAINMENUS);
- RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox");
-
- prop = RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER);
- RNA_def_property_ui_text(prop, "Contents Follow Opening Direction",
- "Otherwise menus, etc will always be top to bottom, left to right, "
- "no matter opening direction");
-
- static const EnumPropertyItem header_align_items[] = {
- {0, "NONE", 0, "Default", "Keep existing header alignment"},
- {USER_HEADER_FROM_PREF, "TOP", 0, "Top", "Top aligned on load"},
- {USER_HEADER_FROM_PREF | USER_HEADER_BOTTOM, "BOTTOM", 0, "Bottom", "Bottom align on load (except for property editors)"},
- {0, NULL, 0, NULL, NULL},
- };
- prop = RNA_def_property(srna, "header_align", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, header_align_items);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
- RNA_def_property_ui_text(prop, "Header Position", "Default header position for new space-types");
- RNA_def_property_update(prop, 0, "rna_userdef_update_ui_header_default");
-
- static const EnumPropertyItem text_hinting_items[] = {
- {0, "AUTO", 0, "Auto", ""},
- {USER_TEXT_HINTING_NONE, "NONE", 0, "None", ""},
- {USER_TEXT_HINTING_SLIGHT, "SLIGHT", 0, "Slight", ""},
- {USER_TEXT_HINTING_FULL, "FULL", 0, "Full", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* mini axis */
- static const EnumPropertyItem mini_axis_type_items[] = {
- {0, "MINIMAL", 0, "Simple Axis", ""},
- {USER_SHOW_GIZMO_AXIS, "GIZMO", 0, "Interactive Navigation", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- prop = RNA_def_property(srna, "mini_axis_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, mini_axis_type_items);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
- RNA_def_property_ui_text(prop, "Mini Axes Type",
- "Show a small rotating 3D axes in the top right corner of the 3D View");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rvisize");
- RNA_def_property_range(prop, 10, 64);
- RNA_def_property_ui_text(prop, "Mini Axes Size", "The axes icon's size");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "mini_axis_brightness", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "rvibright");
- RNA_def_property_range(prop, 0, 10);
- RNA_def_property_ui_text(prop, "Mini Axes Brightness", "Brightness of the icon");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "smooth_view", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "smooth_viewtx");
- RNA_def_property_range(prop, 0, 1000);
- RNA_def_property_ui_text(prop, "Smooth View", "Time to animate the view in milliseconds, zero to disable");
-
- prop = RNA_def_property(srna, "rotation_angle", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "pad_rot_angle");
- RNA_def_property_range(prop, 0, 90);
- RNA_def_property_ui_text(prop, "Rotation Angle", "Rotation step for numerical pad keys (2 4 6 8)");
-
- /* 3D transform widget */
- prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gizmo_flag", USER_GIZMO_DRAW);
- RNA_def_property_ui_text(prop, "Gizmos", "Use transform gizmos by default");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "gizmo_size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "gizmo_size");
- RNA_def_property_range(prop, 10, 200);
- RNA_def_property_int_default(prop, 75);
- RNA_def_property_ui_text(prop, "Gizmo Size", "Diameter of the gizmo");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
- RNA_def_property_range(prop, 4, 10);
- RNA_def_property_ui_text(prop, "Object Origin Size", "Diameter in Pixels for Object/Light origin display");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* View2D Grid Displays */
- prop = RNA_def_property(srna, "view2d_grid_spacing_min", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize");
- RNA_def_property_range(prop, 1, 500); /* XXX: perhaps the lower range should only go down to 5? */
- RNA_def_property_ui_text(prop, "2D View Minimum Grid Spacing",
- "Minimum number of pixels between each gridline in 2D Viewports");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* TODO: add a setter for this, so that we can bump up the minimum size as necessary... */
- prop = RNA_def_property(srna, "timecode_style", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, timecode_styles);
- RNA_def_property_enum_sdna(prop, NULL, "timecode_style");
- RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
- RNA_def_property_ui_text(prop, "TimeCode Style",
- "Format of Time Codes displayed when not displaying timing in terms of frames");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "view_frame_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, zoom_frame_modes);
- RNA_def_property_enum_sdna(prop, NULL, "view_frame_type");
- RNA_def_property_ui_text(prop, "Zoom To Frame Type", "How zooming to frame focuses around current frame");
-
- prop = RNA_def_property(srna, "view_frame_keyframes", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 1, 500);
- RNA_def_property_ui_text(prop, "Zoom Keyframes",
- "Keyframes around cursor that we zoom around");
-
- prop = RNA_def_property(srna, "view_frame_seconds", PROP_FLOAT, PROP_TIME);
- RNA_def_property_range(prop, 0.0, 10000.0);
- RNA_def_property_ui_text(prop, "Zoom Seconds",
- "Seconds around cursor that we zoom around");
-
-
- /* Text. */
-
- prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA);
- RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
- RNA_def_property_update(prop, 0, "rna_userdef_text_update");
-
- prop = RNA_def_property(srna, "text_hinting", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "text_render");
- RNA_def_property_enum_items(prop, text_hinting_items);
- RNA_def_property_ui_text(prop, "Text Hinting", "Method for making user interface text render sharp");
- RNA_def_property_update(prop, 0, "rna_userdef_text_update");
-
- prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "font_path_ui");
- RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font");
- RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
-
- prop = RNA_def_property(srna, "font_path_ui_mono", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "font_path_ui_mono");
- RNA_def_property_ui_text(prop, "Mono-space Font", "Path to interface mono-space Font");
- RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
-
-
- /* Language. */
-
- prop = RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE);
- RNA_def_property_ui_text(prop, "Translate UI", "Enable UI translation and use international fonts");
- RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
-
- prop = RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_language_default_items);
-#ifdef WITH_INTERNATIONAL
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_lang_enum_properties_itemf");
-#endif
- RNA_def_property_ui_text(prop, "Language", "Language used for translation");
- RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
-
- prop = RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS);
- RNA_def_property_ui_text(prop, "Translate Tooltips",
- "Translate the descriptions when hovering UI elements (recommended)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE);
- RNA_def_property_ui_text(prop, "Translate Interface",
- "Translate all labels in menus, buttons and panels "
- "(note that this might make it hard to follow tutorials or the manual)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "use_translate_new_dataname", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_NEWDATANAME);
- RNA_def_property_ui_text(prop, "Translate New Names",
- "Translate the names of new data-blocks (objects, materials...)");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
+ static const EnumPropertyItem timecode_styles[] = {
+ {USER_TIMECODE_MINIMAL,
+ "MINIMAL",
+ 0,
+ "Minimal Info",
+ "Most compact representation, uses '+' as separator for sub-second frame numbers, "
+ "with left and right truncation of the timecode as necessary"},
+ {USER_TIMECODE_SMPTE_FULL,
+ "SMPTE",
+ 0,
+ "SMPTE (Full)",
+ "Full SMPTE timecode (format is HH:MM:SS:FF)"},
+ {USER_TIMECODE_SMPTE_MSF,
+ "SMPTE_COMPACT",
+ 0,
+ "SMPTE (Compact)",
+ "SMPTE timecode showing minutes, seconds, and frames only - "
+ "hours are also shown if necessary, but not by default"},
+ {USER_TIMECODE_MILLISECONDS,
+ "MILLISECONDS",
+ 0,
+ "Compact with Milliseconds",
+ "Similar to SMPTE (Compact), except that instead of frames, "
+ "milliseconds are shown instead"},
+ {USER_TIMECODE_SECONDS_ONLY,
+ "SECONDS_ONLY",
+ 0,
+ "Only Seconds",
+ "Direct conversion of frame numbers to seconds"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem color_picker_types[] = {
+ {USER_CP_CIRCLE_HSV,
+ "CIRCLE_HSV",
+ 0,
+ "Circle (HSV)",
+ "A circular Hue/Saturation color wheel, with "
+ "Value slider"},
+ {USER_CP_CIRCLE_HSL,
+ "CIRCLE_HSL",
+ 0,
+ "Circle (HSL)",
+ "A circular Hue/Saturation color wheel, with "
+ "Lightness slider"},
+ {USER_CP_SQUARE_SV,
+ "SQUARE_SV",
+ 0,
+ "Square (SV + H)",
+ "A square showing Saturation/Value, with Hue slider"},
+ {USER_CP_SQUARE_HS,
+ "SQUARE_HS",
+ 0,
+ "Square (HS + V)",
+ "A square showing Hue/Saturation, with Value slider"},
+ {USER_CP_SQUARE_HV,
+ "SQUARE_HV",
+ 0,
+ "Square (HV + S)",
+ "A square showing Hue/Value, with Saturation slider"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem zoom_frame_modes[] = {
+ {ZOOM_FRAME_MODE_KEEP_RANGE, "KEEP_RANGE", 0, "Keep Range", ""},
+ {ZOOM_FRAME_MODE_SECONDS, "SECONDS", 0, "Seconds", ""},
+ {ZOOM_FRAME_MODE_KEYFRAMES, "KEYFRAMES", 0, "Keyframes", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem line_width[] = {
+ {-1, "THIN", 0, "Thin", "Thinner lines than the default"},
+ {0, "AUTO", 0, "Auto", "Automatic line width based on UI scale"},
+ {1, "THICK", 0, "Thick", "Thicker lines than the default"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ PropertyRNA *prop;
+ StructRNA *srna;
+
+ srna = RNA_def_struct(brna, "PreferencesView", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "Preferences");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "View & Controls", "Preferences related to viewing data");
+
+ /* View */
+ prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(
+ prop, "UI Scale", "Changes the size of the fonts and widgets in the interface");
+ RNA_def_property_range(prop, 0.25f, 4.0f);
+ RNA_def_property_ui_range(prop, 0.5f, 2.0f, 1, 2);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ prop = RNA_def_property(srna, "ui_line_width", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, line_width);
+ RNA_def_property_ui_text(
+ prop,
+ "UI Line Width",
+ "Changes the thickness of widget outlines, lines and points in the interface, "
+ "for high DPI displays");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ /* display */
+ prop = RNA_def_property(srna, "show_tooltips", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS);
+ RNA_def_property_ui_text(
+ prop, "Tooltips", "Display tooltips (when off hold Alt to force display)");
+
+ prop = RNA_def_property(srna, "show_tooltips_python", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TOOLTIPS_PYTHON);
+ RNA_def_property_ui_text(prop, "Python Tooltips", "Show Python references in tooltips");
+
+ prop = RNA_def_property(srna, "show_developer_ui", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DEVELOPER_UI);
+ RNA_def_property_ui_text(
+ prop,
+ "Developer Extras",
+ "Show options for developers (edit source in context menu, geometry indices)");
+
+ prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
+ RNA_def_property_ui_text(
+ prop, "Display Object Info", "Display objects name and frame number in 3D view");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "show_large_cursors", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "curssize", 0);
+ RNA_def_property_ui_text(prop, "Large Cursors", "Use large mouse cursors when available");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "show_view_name", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_VIEWPORTNAME);
+ RNA_def_property_ui_text(
+ prop, "Show View Name", "Show the name of the view's direction in each 3D View");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "show_splash", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_SPLASH_DISABLE);
+ RNA_def_property_ui_text(prop, "Show Splash", "Display splash screen on startup");
+
+ prop = RNA_def_property(srna, "show_playback_fps", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_FPS);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Playback FPS",
+ "Show the frames per second screen refresh rate, while animation is played back");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ static const EnumPropertyItem factor_display_items[] = {
+ {USER_FACTOR_AS_FACTOR, "FACTOR", 0, "Factor", "Display factors as values between 0 and 1"},
+ {USER_FACTOR_AS_PERCENTAGE, "PERCENTAGE", 0, "Percentage", "Display factors as percentages"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "factor_display_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, factor_display_items);
+ RNA_def_property_ui_text(prop, "Factor Display Type", "How factor values are displayed");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* Weight Paint */
+
+ prop = RNA_def_property(srna, "use_weight_color_range", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_CUSTOM_RANGE);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Weight Color Range",
+ "Enable color range used for weight visualization in weight painting mode");
+ RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
+
+ prop = RNA_def_property(srna, "weight_color_range", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "coba_weight");
+ RNA_def_property_struct_type(prop, "ColorRamp");
+ RNA_def_property_ui_text(prop,
+ "Weight Color Range",
+ "Color range used for weight visualization in weight painting mode");
+ RNA_def_property_update(prop, 0, "rna_UserDef_weight_color_update");
+
+ prop = RNA_def_property(srna, "show_layout_ui", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "app_flag", USER_APP_LOCK_UI_LAYOUT);
+ RNA_def_property_ui_text(
+ prop, "Editor Corner Splitting", "Split and join editors by dragging from corners");
+ RNA_def_property_update(prop, 0, "rna_userdef_update_ui");
+
+ /* menus */
+ prop = RNA_def_property(srna, "use_mouse_over_open", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_MENUOPENAUTO);
+ RNA_def_property_ui_text(
+ prop,
+ "Open On Mouse Over",
+ "Open menu buttons and pulldowns automatically when the mouse is hovering");
+
+ prop = RNA_def_property(srna, "open_toplevel_delay", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "menuthreshold1");
+ RNA_def_property_range(prop, 1, 40);
+ RNA_def_property_ui_text(
+ prop,
+ "Top Level Menu Open Delay",
+ "Time delay in 1/10 seconds before automatically opening top level menus");
+
+ prop = RNA_def_property(srna, "open_sublevel_delay", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "menuthreshold2");
+ RNA_def_property_range(prop, 1, 40);
+ RNA_def_property_ui_text(
+ prop,
+ "Sub Level Menu Open Delay",
+ "Time delay in 1/10 seconds before automatically opening sub level menus");
+
+ prop = RNA_def_property(srna, "color_picker_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, color_picker_types);
+ RNA_def_property_enum_sdna(prop, NULL, "color_picker_type");
+ RNA_def_property_ui_text(
+ prop, "Color Picker Type", "Different styles of displaying the color picker widget");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* pie menus */
+ prop = RNA_def_property(srna, "pie_initial_timeout", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(
+ prop,
+ "Recenter Timeout",
+ "Pie menus will use the initial mouse position as center for this amount of time "
+ "(in 1/100ths of sec)");
+
+ prop = RNA_def_property(srna, "pie_tap_timeout", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop,
+ "Tap Key Timeout",
+ "Pie menu button held longer than this will dismiss menu on release."
+ "(in 1/100ths of sec)");
+
+ prop = RNA_def_property(srna, "pie_animation_timeout", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(
+ prop,
+ "Animation Timeout",
+ "Time needed to fully animate the pie to unfolded state (in 1/100ths of sec)");
+
+ prop = RNA_def_property(srna, "pie_menu_radius", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop, "Radius", "Pie menu size in pixels");
+
+ prop = RNA_def_property(srna, "pie_menu_threshold", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(
+ prop, "Threshold", "Distance from center needed before a selection can be made");
+
+ prop = RNA_def_property(srna, "pie_menu_confirm", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(prop,
+ "Confirm Threshold",
+ "Distance threshold after which selection is made (zero to disable)");
+
+ prop = RNA_def_property(srna, "use_save_prompt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SAVE_PROMPT);
+ RNA_def_property_ui_text(
+ prop, "Save Prompt", "Ask for confirmation when quitting with unsaved changes");
+
+ prop = RNA_def_property(srna, "show_column_layout", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_PLAINMENUS);
+ RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox");
+
+ prop = RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_MENUFIXEDORDER);
+ RNA_def_property_ui_text(prop,
+ "Contents Follow Opening Direction",
+ "Otherwise menus, etc will always be top to bottom, left to right, "
+ "no matter opening direction");
+
+ static const EnumPropertyItem header_align_items[] = {
+ {0, "NONE", 0, "Default", "Keep existing header alignment"},
+ {USER_HEADER_FROM_PREF, "TOP", 0, "Top", "Top aligned on load"},
+ {USER_HEADER_FROM_PREF | USER_HEADER_BOTTOM,
+ "BOTTOM",
+ 0,
+ "Bottom",
+ "Bottom align on load (except for property editors)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ prop = RNA_def_property(srna, "header_align", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, header_align_items);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
+ RNA_def_property_ui_text(prop, "Header Position", "Default header position for new space-types");
+ RNA_def_property_update(prop, 0, "rna_userdef_update_ui_header_default");
+
+ static const EnumPropertyItem text_hinting_items[] = {
+ {0, "AUTO", 0, "Auto", ""},
+ {USER_TEXT_HINTING_NONE, "NONE", 0, "None", ""},
+ {USER_TEXT_HINTING_SLIGHT, "SLIGHT", 0, "Slight", ""},
+ {USER_TEXT_HINTING_FULL, "FULL", 0, "Full", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* mini axis */
+ static const EnumPropertyItem mini_axis_type_items[] = {
+ {0, "MINIMAL", 0, "Simple Axis", ""},
+ {USER_SHOW_GIZMO_AXIS, "GIZMO", 0, "Interactive Navigation", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ prop = RNA_def_property(srna, "mini_axis_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, mini_axis_type_items);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
+ RNA_def_property_ui_text(prop,
+ "Mini Axes Type",
+ "Show a small rotating 3D axes in the top right corner of the 3D View");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "mini_axis_size", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rvisize");
+ RNA_def_property_range(prop, 10, 64);
+ RNA_def_property_ui_text(prop, "Mini Axes Size", "The axes icon's size");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "mini_axis_brightness", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "rvibright");
+ RNA_def_property_range(prop, 0, 10);
+ RNA_def_property_ui_text(prop, "Mini Axes Brightness", "Brightness of the icon");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "smooth_view", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "smooth_viewtx");
+ RNA_def_property_range(prop, 0, 1000);
+ RNA_def_property_ui_text(
+ prop, "Smooth View", "Time to animate the view in milliseconds, zero to disable");
+
+ prop = RNA_def_property(srna, "rotation_angle", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "pad_rot_angle");
+ RNA_def_property_range(prop, 0, 90);
+ RNA_def_property_ui_text(
+ prop, "Rotation Angle", "Rotation step for numerical pad keys (2 4 6 8)");
+
+ /* 3D transform widget */
+ prop = RNA_def_property(srna, "show_gizmo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gizmo_flag", USER_GIZMO_DRAW);
+ RNA_def_property_ui_text(prop, "Gizmos", "Use transform gizmos by default");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "gizmo_size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "gizmo_size");
+ RNA_def_property_range(prop, 10, 200);
+ RNA_def_property_int_default(prop, 75);
+ RNA_def_property_ui_text(prop, "Gizmo Size", "Diameter of the gizmo");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "object_origin_size", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "obcenter_dia");
+ RNA_def_property_range(prop, 4, 10);
+ RNA_def_property_ui_text(
+ prop, "Object Origin Size", "Diameter in Pixels for Object/Light origin display");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* View2D Grid Displays */
+ prop = RNA_def_property(srna, "view2d_grid_spacing_min", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "v2d_min_gridsize");
+ RNA_def_property_range(
+ prop, 1, 500); /* XXX: perhaps the lower range should only go down to 5? */
+ RNA_def_property_ui_text(prop,
+ "2D View Minimum Grid Spacing",
+ "Minimum number of pixels between each gridline in 2D Viewports");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* TODO: add a setter for this, so that we can bump up the minimum size as necessary... */
+ prop = RNA_def_property(srna, "timecode_style", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, timecode_styles);
+ RNA_def_property_enum_sdna(prop, NULL, "timecode_style");
+ RNA_def_property_enum_funcs(prop, NULL, "rna_userdef_timecode_style_set", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "TimeCode Style",
+ "Format of Time Codes displayed when not displaying timing in terms of frames");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "view_frame_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, zoom_frame_modes);
+ RNA_def_property_enum_sdna(prop, NULL, "view_frame_type");
+ RNA_def_property_ui_text(
+ prop, "Zoom To Frame Type", "How zooming to frame focuses around current frame");
+
+ prop = RNA_def_property(srna, "view_frame_keyframes", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 1, 500);
+ RNA_def_property_ui_text(prop, "Zoom Keyframes", "Keyframes around cursor that we zoom around");
+
+ prop = RNA_def_property(srna, "view_frame_seconds", PROP_FLOAT, PROP_TIME);
+ RNA_def_property_range(prop, 0.0, 10000.0);
+ RNA_def_property_ui_text(prop, "Zoom Seconds", "Seconds around cursor that we zoom around");
+
+ /* Text. */
+
+ prop = RNA_def_property(srna, "use_text_antialiasing", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "text_render", USER_TEXT_DISABLE_AA);
+ RNA_def_property_ui_text(prop, "Text Anti-aliasing", "Draw user interface text anti-aliased");
+ RNA_def_property_update(prop, 0, "rna_userdef_text_update");
+
+ prop = RNA_def_property(srna, "text_hinting", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "text_render");
+ RNA_def_property_enum_items(prop, text_hinting_items);
+ RNA_def_property_ui_text(
+ prop, "Text Hinting", "Method for making user interface text render sharp");
+ RNA_def_property_update(prop, 0, "rna_userdef_text_update");
+
+ prop = RNA_def_property(srna, "font_path_ui", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "font_path_ui");
+ RNA_def_property_ui_text(prop, "Interface Font", "Path to interface font");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
+
+ prop = RNA_def_property(srna, "font_path_ui_mono", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "font_path_ui_mono");
+ RNA_def_property_ui_text(prop, "Mono-space Font", "Path to interface mono-space Font");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
+
+ /* Language. */
+
+ prop = RNA_def_property(srna, "use_international_fonts", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_DOTRANSLATE);
+ RNA_def_property_ui_text(
+ prop, "Translate UI", "Enable UI translation and use international fonts");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
+
+ prop = RNA_def_property(srna, "language", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_language_default_items);
+# ifdef WITH_INTERNATIONAL
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_lang_enum_properties_itemf");
+# endif
+ RNA_def_property_ui_text(prop, "Language", "Language used for translation");
+ RNA_def_property_update(prop, NC_WINDOW, "rna_userdef_language_update");
+
+ prop = RNA_def_property(srna, "use_translate_tooltips", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_TOOLTIPS);
+ RNA_def_property_ui_text(prop,
+ "Translate Tooltips",
+ "Translate the descriptions when hovering UI elements (recommended)");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "use_translate_interface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_IFACE);
+ RNA_def_property_ui_text(
+ prop,
+ "Translate Interface",
+ "Translate all labels in menus, buttons and panels "
+ "(note that this might make it hard to follow tutorials or the manual)");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "use_translate_new_dataname", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "transopts", USER_TR_NEWDATANAME);
+ RNA_def_property_ui_text(prop,
+ "Translate New Names",
+ "Translate the names of new data-blocks (objects, materials...)");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
}
static void rna_def_userdef_edit(BlenderRNA *brna)
{
- PropertyRNA *prop;
- StructRNA *srna;
-
- static const EnumPropertyItem auto_key_modes[] = {
- {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""},
- {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem material_link_items[] = {
- {0, "OBDATA", 0, "Object Data", "Toggle whether the material is linked to object data or the object block"},
- {USER_MAT_ON_OB, "OBJECT", 0, "Object",
- "Toggle whether the material is linked to object data or the object block"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem object_align_items[] = {
- {0, "WORLD", 0, "World", "Align newly added objects to the world coordinate system"},
- {USER_ADD_VIEWALIGNED, "VIEW", 0, "View", "Align newly added objects facing the active 3D View direction"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "PreferencesEdit", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_nested(brna, srna, "Preferences");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Edit Methods", "Settings for interacting with Blender data");
-
- /* Edit Methods */
-
- prop = RNA_def_property(srna, "material_link", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, material_link_items);
- RNA_def_property_ui_text(prop, "Material Link To",
- "Toggle whether the material is linked to object data or the object block");
-
- prop = RNA_def_property(srna, "object_align", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, object_align_items);
- RNA_def_property_ui_text(prop, "Align Object To",
- "When adding objects from a 3D View menu, either align them with that view or "
- "with the world");
-
- prop = RNA_def_property(srna, "use_enter_edit_mode", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_ADD_EDITMODE);
- RNA_def_property_ui_text(prop, "Enter Edit Mode", "Enter Edit Mode automatically after adding a new object");
-
- /* Undo */
-
- prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "undosteps");
- RNA_def_property_range(prop, 0, 256);
- RNA_def_property_int_funcs(prop, NULL, "rna_userdef_undo_steps_set", NULL);
- RNA_def_property_ui_text(prop, "Undo Steps", "Number of undo steps available (smaller values conserve memory)");
-
- prop = RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "undomemory");
- RNA_def_property_range(prop, 0, max_memory_in_megabytes_int());
- RNA_def_property_ui_text(prop, "Undo Memory Size", "Maximum memory usage in megabytes (0 means unlimited)");
-
- prop = RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
- RNA_def_property_ui_text(prop, "Global Undo",
- "Global undo works by keeping a full copy of the file itself in memory, "
- "so takes extra memory");
-
-
- /* auto keyframing */
- prop = RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
- RNA_def_property_ui_text(prop, "Auto Keying Enable",
- "Automatic keyframe insertion for Objects and Bones "
- "(default setting used for new Scenes)");
-
- prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, auto_key_modes);
- RNA_def_property_enum_funcs(prop, "rna_userdef_autokeymode_get", "rna_userdef_autokeymode_set", NULL);
- RNA_def_property_ui_text(prop, "Auto Keying Mode",
- "Mode of automatic keyframe insertion for Objects and Bones "
- "(default setting used for new Scenes)");
-
- prop = RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL);
- RNA_def_property_ui_text(prop, "Auto Keyframe Insert Available",
- "Automatic keyframe insertion in available F-Curves");
-
- prop = RNA_def_property(srna, "use_auto_keying_warning", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_NOWARNING);
- RNA_def_property_ui_text(prop, "Show Auto Keying Warning",
- "Show warning indicators when transforming objects and bones if auto keying is enabled");
-
- /* keyframing settings */
- prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
- RNA_def_property_ui_text(prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed");
-
- prop = RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_AUTOMATKEY);
- RNA_def_property_ui_text(prop, "Visual Keying", "Use Visual keying automatically for constrained objects");
-
- prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_XYZ2RGB);
- RNA_def_property_ui_text(prop, "New F-Curve Colors - XYZ to RGB",
- "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
- "and also Color is based on the transform axis");
-
- prop = RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_mode_items);
- RNA_def_property_enum_sdna(prop, NULL, "ipo_new");
- RNA_def_property_ui_text(prop, "New Interpolation Type",
- "Interpolation mode used for first keyframe on newly added F-Curves "
- "(subsequent keyframes take interpolation from preceding keyframe)");
-
- prop = RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
- RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new");
- RNA_def_property_ui_text(prop, "New Handles Type", "Handle type for handles of new keyframes");
-
- /* frame numbers */
- prop = RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NONEGFRAMES);
- RNA_def_property_ui_text(prop, "Allow Negative Frames",
- "Current frame number can be manually set to a negative value");
-
- /* fcurve opacity */
- prop = RNA_def_property(srna, "fcurve_unselected_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "fcu_inactive_alpha");
- RNA_def_property_range(prop, 0.001f, 1.0f);
- RNA_def_property_ui_text(prop, "Unselected F-Curve Visibility",
- "Amount that unselected F-Curves stand out from the background (Graph Editor)");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
-
- /* grease pencil */
- prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "gp_manhattendist");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Grease Pencil Manhattan Distance",
- "Pixels moved by mouse per axis when drawing stroke");
-
- prop = RNA_def_property(srna, "grease_pencil_euclidean_distance", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "gp_euclideandist");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Grease Pencil Euclidean Distance",
- "Distance moved by mouse when drawing stroke to include");
-
- prop = RNA_def_property(srna, "use_grease_pencil_simplify_stroke", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSIMPLIFY);
- RNA_def_property_ui_text(prop, "Grease Pencil Simplify Stroke", "Simplify the final stroke");
-
- prop = RNA_def_property(srna, "grease_pencil_eraser_radius", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
- RNA_def_property_range(prop, 1, 500);
- RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
-
- prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "gpencil_new_layer_col");
- RNA_def_property_array(prop, 4);
- RNA_def_property_ui_text(prop, "Annotation Default Color", "Color of new annotation layers");
-
- /* sculpt and paint */
-
- prop = RNA_def_property(srna, "sculpt_paint_overlay_color", PROP_FLOAT, PROP_COLOR_GAMMA);
- RNA_def_property_float_sdna(prop, NULL, "sculpt_paint_overlay_col");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Sculpt/Paint Overlay Color", "Color of texture overlay");
-
- /* duplication linking */
- prop = RNA_def_property(srna, "use_duplicate_mesh", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MESH);
- RNA_def_property_ui_text(prop, "Duplicate Mesh", "Causes mesh data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_surface", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_SURF);
- RNA_def_property_ui_text(prop, "Duplicate Surface", "Causes surface data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_curve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_CURVE);
- RNA_def_property_ui_text(prop, "Duplicate Curve", "Causes curve data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_text", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_FONT);
- RNA_def_property_ui_text(prop, "Duplicate Text", "Causes text data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_metaball", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MBALL);
- RNA_def_property_ui_text(prop, "Duplicate Metaball", "Causes metaball data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_armature", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ARM);
- RNA_def_property_ui_text(prop, "Duplicate Armature", "Causes armature data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_light", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_LAMP);
- RNA_def_property_ui_text(prop, "Duplicate Light", "Causes light data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_material", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MAT);
- RNA_def_property_ui_text(prop, "Duplicate Material", "Causes material data to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_texture", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_TEX);
- RNA_def_property_ui_text(prop, "Duplicate Texture", "Causes texture data to be duplicated with the object");
-
- /* xxx */
- prop = RNA_def_property(srna, "use_duplicate_fcurve", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_IPO);
- RNA_def_property_ui_text(prop, "Duplicate F-Curve", "Causes F-curve data to be duplicated with the object");
- /* xxx */
- prop = RNA_def_property(srna, "use_duplicate_action", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ACT);
- RNA_def_property_ui_text(prop, "Duplicate Action", "Causes actions to be duplicated with the object");
-
- prop = RNA_def_property(srna, "use_duplicate_particle", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_PSYS);
- RNA_def_property_ui_text(prop, "Duplicate Particle", "Causes particle systems to be duplicated with the object");
-
- /* currently only used for insert offset (aka auto-offset), maybe also be useful for later stuff though */
- prop = RNA_def_property(srna, "node_margin", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "node_margin");
- RNA_def_property_ui_text(prop, "Auto-offset Margin", "Minimum distance between nodes for Auto-offsetting nodes");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* cursor */
- prop = RNA_def_property(srna, "use_cursor_lock_adjust", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCK_CURSOR_ADJUST);
- RNA_def_property_ui_text(prop, "Cursor Lock Adjust",
- "Place the cursor without 'jumping' to the new location (when lock-to-cursor is used)");
-
- prop = RNA_def_property(srna, "use_mouse_depth_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_CURSOR);
- RNA_def_property_ui_text(prop, "Cursor Surface Project",
- "Use the surface depth for cursor placement");
+ PropertyRNA *prop;
+ StructRNA *srna;
+
+ static const EnumPropertyItem auto_key_modes[] = {
+ {AUTOKEY_MODE_NORMAL, "ADD_REPLACE_KEYS", 0, "Add/Replace", ""},
+ {AUTOKEY_MODE_EDITKEYS, "REPLACE_KEYS", 0, "Replace", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem material_link_items[] = {
+ {0,
+ "OBDATA",
+ 0,
+ "Object Data",
+ "Toggle whether the material is linked to object data or the object block"},
+ {USER_MAT_ON_OB,
+ "OBJECT",
+ 0,
+ "Object",
+ "Toggle whether the material is linked to object data or the object block"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem object_align_items[] = {
+ {0, "WORLD", 0, "World", "Align newly added objects to the world coordinate system"},
+ {USER_ADD_VIEWALIGNED,
+ "VIEW",
+ 0,
+ "View",
+ "Align newly added objects facing the active 3D View direction"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "PreferencesEdit", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "Preferences");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Edit Methods", "Settings for interacting with Blender data");
+
+ /* Edit Methods */
+
+ prop = RNA_def_property(srna, "material_link", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, material_link_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Material Link To",
+ "Toggle whether the material is linked to object data or the object block");
+
+ prop = RNA_def_property(srna, "object_align", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, object_align_items);
+ RNA_def_property_ui_text(
+ prop,
+ "Align Object To",
+ "When adding objects from a 3D View menu, either align them with that view or "
+ "with the world");
+
+ prop = RNA_def_property(srna, "use_enter_edit_mode", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_ADD_EDITMODE);
+ RNA_def_property_ui_text(
+ prop, "Enter Edit Mode", "Enter Edit Mode automatically after adding a new object");
+
+ /* Undo */
+
+ prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "undosteps");
+ RNA_def_property_range(prop, 0, 256);
+ RNA_def_property_int_funcs(prop, NULL, "rna_userdef_undo_steps_set", NULL);
+ RNA_def_property_ui_text(
+ prop, "Undo Steps", "Number of undo steps available (smaller values conserve memory)");
+
+ prop = RNA_def_property(srna, "undo_memory_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "undomemory");
+ RNA_def_property_range(prop, 0, max_memory_in_megabytes_int());
+ RNA_def_property_ui_text(
+ prop, "Undo Memory Size", "Maximum memory usage in megabytes (0 means unlimited)");
+
+ prop = RNA_def_property(srna, "use_global_undo", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_GLOBALUNDO);
+ RNA_def_property_ui_text(
+ prop,
+ "Global Undo",
+ "Global undo works by keeping a full copy of the file itself in memory, "
+ "so takes extra memory");
+
+ /* auto keyframing */
+ prop = RNA_def_property(srna, "use_auto_keying", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_mode", AUTOKEY_ON);
+ RNA_def_property_ui_text(prop,
+ "Auto Keying Enable",
+ "Automatic keyframe insertion for Objects and Bones "
+ "(default setting used for new Scenes)");
+
+ prop = RNA_def_property(srna, "auto_keying_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, auto_key_modes);
+ RNA_def_property_enum_funcs(
+ prop, "rna_userdef_autokeymode_get", "rna_userdef_autokeymode_set", NULL);
+ RNA_def_property_ui_text(prop,
+ "Auto Keying Mode",
+ "Mode of automatic keyframe insertion for Objects and Bones "
+ "(default setting used for new Scenes)");
+
+ prop = RNA_def_property(srna, "use_keyframe_insert_available", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTAVAIL);
+ RNA_def_property_ui_text(prop,
+ "Auto Keyframe Insert Available",
+ "Automatic keyframe insertion in available F-Curves");
+
+ prop = RNA_def_property(srna, "use_auto_keying_warning", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_NOWARNING);
+ RNA_def_property_ui_text(
+ prop,
+ "Show Auto Keying Warning",
+ "Show warning indicators when transforming objects and bones if auto keying is enabled");
+
+ /* keyframing settings */
+ prop = RNA_def_property(srna, "use_keyframe_insert_needed", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_INSERTNEEDED);
+ RNA_def_property_ui_text(
+ prop, "Keyframe Insert Needed", "Keyframe insertion only when keyframe needed");
+
+ prop = RNA_def_property(srna, "use_visual_keying", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_AUTOMATKEY);
+ RNA_def_property_ui_text(
+ prop, "Visual Keying", "Use Visual keying automatically for constrained objects");
+
+ prop = RNA_def_property(srna, "use_insertkey_xyz_to_rgb", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "autokey_flag", AUTOKEY_FLAG_XYZ2RGB);
+ RNA_def_property_ui_text(
+ prop,
+ "New F-Curve Colors - XYZ to RGB",
+ "Color for newly added transformation F-Curves (Location, Rotation, Scale) "
+ "and also Color is based on the transform axis");
+
+ prop = RNA_def_property(srna, "keyframe_new_interpolation_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_beztriple_interpolation_mode_items);
+ RNA_def_property_enum_sdna(prop, NULL, "ipo_new");
+ RNA_def_property_ui_text(prop,
+ "New Interpolation Type",
+ "Interpolation mode used for first keyframe on newly added F-Curves "
+ "(subsequent keyframes take interpolation from preceding keyframe)");
+
+ prop = RNA_def_property(srna, "keyframe_new_handle_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_keyframe_handle_type_items);
+ RNA_def_property_enum_sdna(prop, NULL, "keyhandles_new");
+ RNA_def_property_ui_text(prop, "New Handles Type", "Handle type for handles of new keyframes");
+
+ /* frame numbers */
+ prop = RNA_def_property(srna, "use_negative_frames", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_NONEGFRAMES);
+ RNA_def_property_ui_text(prop,
+ "Allow Negative Frames",
+ "Current frame number can be manually set to a negative value");
+
+ /* fcurve opacity */
+ prop = RNA_def_property(srna, "fcurve_unselected_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "fcu_inactive_alpha");
+ RNA_def_property_range(prop, 0.001f, 1.0f);
+ RNA_def_property_ui_text(
+ prop,
+ "Unselected F-Curve Visibility",
+ "Amount that unselected F-Curves stand out from the background (Graph Editor)");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_GRAPH, NULL);
+
+ /* grease pencil */
+ prop = RNA_def_property(srna, "grease_pencil_manhattan_distance", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "gp_manhattendist");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop,
+ "Grease Pencil Manhattan Distance",
+ "Pixels moved by mouse per axis when drawing stroke");
+
+ prop = RNA_def_property(srna, "grease_pencil_euclidean_distance", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "gp_euclideandist");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop,
+ "Grease Pencil Euclidean Distance",
+ "Distance moved by mouse when drawing stroke to include");
+
+ prop = RNA_def_property(srna, "use_grease_pencil_simplify_stroke", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSIMPLIFY);
+ RNA_def_property_ui_text(prop, "Grease Pencil Simplify Stroke", "Simplify the final stroke");
+
+ prop = RNA_def_property(srna, "grease_pencil_eraser_radius", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "gp_eraser");
+ RNA_def_property_range(prop, 1, 500);
+ RNA_def_property_ui_text(prop, "Grease Pencil Eraser Radius", "Radius of eraser 'brush'");
+
+ prop = RNA_def_property(srna, "grease_pencil_default_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "gpencil_new_layer_col");
+ RNA_def_property_array(prop, 4);
+ RNA_def_property_ui_text(prop, "Annotation Default Color", "Color of new annotation layers");
+
+ /* sculpt and paint */
+
+ prop = RNA_def_property(srna, "sculpt_paint_overlay_color", PROP_FLOAT, PROP_COLOR_GAMMA);
+ RNA_def_property_float_sdna(prop, NULL, "sculpt_paint_overlay_col");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(prop, "Sculpt/Paint Overlay Color", "Color of texture overlay");
+
+ /* duplication linking */
+ prop = RNA_def_property(srna, "use_duplicate_mesh", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MESH);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Mesh", "Causes mesh data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_surface", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_SURF);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Surface", "Causes surface data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_curve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_CURVE);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Curve", "Causes curve data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_text", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_FONT);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Text", "Causes text data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_metaball", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MBALL);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Metaball", "Causes metaball data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_armature", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ARM);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Armature", "Causes armature data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_light", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_LAMP);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Light", "Causes light data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_material", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_MAT);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Material", "Causes material data to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_texture", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_TEX);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Texture", "Causes texture data to be duplicated with the object");
+
+ /* xxx */
+ prop = RNA_def_property(srna, "use_duplicate_fcurve", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_IPO);
+ RNA_def_property_ui_text(
+ prop, "Duplicate F-Curve", "Causes F-curve data to be duplicated with the object");
+ /* xxx */
+ prop = RNA_def_property(srna, "use_duplicate_action", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_ACT);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Action", "Causes actions to be duplicated with the object");
+
+ prop = RNA_def_property(srna, "use_duplicate_particle", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "dupflag", USER_DUP_PSYS);
+ RNA_def_property_ui_text(
+ prop, "Duplicate Particle", "Causes particle systems to be duplicated with the object");
+
+ /* currently only used for insert offset (aka auto-offset), maybe also be useful for later stuff though */
+ prop = RNA_def_property(srna, "node_margin", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "node_margin");
+ RNA_def_property_ui_text(
+ prop, "Auto-offset Margin", "Minimum distance between nodes for Auto-offsetting nodes");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* cursor */
+ prop = RNA_def_property(srna, "use_cursor_lock_adjust", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_LOCK_CURSOR_ADJUST);
+ RNA_def_property_ui_text(
+ prop,
+ "Cursor Lock Adjust",
+ "Place the cursor without 'jumping' to the new location (when lock-to-cursor is used)");
+
+ prop = RNA_def_property(srna, "use_mouse_depth_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_CURSOR);
+ RNA_def_property_ui_text(
+ prop, "Cursor Surface Project", "Use the surface depth for cursor placement");
}
static void rna_def_userdef_system(BlenderRNA *brna)
{
- PropertyRNA *prop;
- StructRNA *srna;
-
- static const EnumPropertyItem gl_texture_clamp_items[] = {
- {0, "CLAMP_OFF", 0, "Off", ""},
- {8192, "CLAMP_8192", 0, "8192", ""},
- {4096, "CLAMP_4096", 0, "4096", ""},
- {2048, "CLAMP_2048", 0, "2048", ""},
- {1024, "CLAMP_1024", 0, "1024", ""},
- {512, "CLAMP_512", 0, "512", ""},
- {256, "CLAMP_256", 0, "256", ""},
- {128, "CLAMP_128", 0, "128", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem anisotropic_items[] = {
- {1, "FILTER_0", 0, "Off", ""},
- {2, "FILTER_2", 0, "2x", ""},
- {4, "FILTER_4", 0, "4x", ""},
- {8, "FILTER_8", 0, "8x", ""},
- {16, "FILTER_16", 0, "16x", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem audio_mixing_samples_items[] = {
- {256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
- {512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
- {1024, "SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"},
- {2048, "SAMPLES_2048", 0, "2048", "Set audio mixing buffer size to 2048 samples"},
- {4096, "SAMPLES_4096", 0, "4096", "Set audio mixing buffer size to 4096 samples"},
- {8192, "SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
- {16384, "SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
- {32768, "SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem audio_rate_items[] = {
-/* {8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second"}, */
-/* {11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second"}, */
-/* {16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second"}, */
-/* {22050, "RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second"}, */
-/* {32000, "RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second"}, */
- {44100, "RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second"},
- {48000, "RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second"},
-/* {88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second"}, */
- {96000, "RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second"},
- {192000, "RATE_192000", 0, "192 kHz", "Set audio sampling rate to 192000 samples per second"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem audio_format_items[] = {
- {0x01, "U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer"},
- {0x12, "S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer"},
- {0x13, "S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer"},
- {0x14, "S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer"},
- {0x24, "FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float"},
- {0x28, "DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem audio_channel_items[] = {
- {1, "MONO", 0, "Mono", "Set audio channels to mono"},
- {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
- {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
- {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
- {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem multi_sample_levels[] = {
- {USER_MULTISAMPLE_NONE, "NONE", 0, "No MultiSample", "Do not use OpenGL MultiSample"},
- {USER_MULTISAMPLE_2, "2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample"},
- {USER_MULTISAMPLE_4, "4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample"},
- {USER_MULTISAMPLE_8, "8", 0, "MultiSample: 8", "Use 8x OpenGL MultiSample"},
- {USER_MULTISAMPLE_16, "16", 0, "MultiSample: 16", "Use 16x OpenGL MultiSample"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem image_draw_methods[] = {
- {IMAGE_DRAW_METHOD_2DTEXTURE, "2DTEXTURE", 0, "2D Texture", "Use CPU for display transform and draw image with 2D texture"},
- {IMAGE_DRAW_METHOD_GLSL, "GLSL", 0, "GLSL", "Use GLSL shaders for display transform and draw image with 2D texture"},
- {IMAGE_DRAW_METHOD_DRAWPIXELS, "DRAWPIXELS", 0, "DrawPixels", "Use CPU for display transform and draw image using DrawPixels"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "PreferencesSystem", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_nested(brna, srna, "Preferences");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "System & OpenGL", "Graphics driver and operating system settings");
-
- /* UI settings. */
-
- prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_sdna(prop, NULL, "dpi_fac");
- RNA_def_property_ui_text(prop, "UI Scale",
- "Size multiplier to use when drawing custom user interface elements, so that "
- "they are scaled correctly on screens with different DPI. This value is based "
- "on operating system DPI settings and Blender display scale");
-
- prop = RNA_def_property(srna, "ui_line_width", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_sdna(prop, NULL, "pixelsize");
- RNA_def_property_ui_text(prop, "UI Line Width",
- "Suggested line thickness and point size in pixels, for add-ons drawing custom "
- "user interface elements, based on operating system settings and Blender UI scale");
-
- prop = RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_sdna(prop, NULL, "pixelsize");
-
-
- /* Memory */
-
- prop = RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "prefetchframes");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 500, 1, -1);
- RNA_def_property_ui_text(prop, "Prefetch Frames", "Number of frames to render ahead during playback (sequencer only)");
-
- prop = RNA_def_property(srna, "memory_cache_limit", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "memcachelimit");
- RNA_def_property_range(prop, 0, max_memory_in_megabytes_int());
- RNA_def_property_ui_text(prop, "Memory Cache Limit", "Memory cache limit (in megabytes)");
- RNA_def_property_update(prop, 0, "rna_Userdef_memcache_update");
-
- prop = RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "scrollback");
- RNA_def_property_range(prop, 32, 32768);
- RNA_def_property_ui_text(prop, "Scrollback", "Maximum number of lines to store for the console buffer");
-
- /* OpenGL */
-
- /* Full scene anti-aliasing */
- prop = RNA_def_property(srna, "multi_sample", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");
- RNA_def_property_enum_items(prop, multi_sample_levels);
- RNA_def_property_ui_text(prop, "MultiSample",
- "Enable OpenGL multi-sampling, only for systems that support it");
- RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
- prop = RNA_def_property(srna, "use_edit_mode_smooth_wire", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE);
- RNA_def_property_ui_text(prop, "Edit-Mode Smooth Wires",
- "Enable Edit-Mode edge smoothing, reducing aliasing, requires restart");
- RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
- /* grease pencil anti-aliasing */
- prop = RNA_def_property(srna, "gpencil_multi_sample", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_multisamples");
- RNA_def_property_enum_items(prop, multi_sample_levels);
- RNA_def_property_ui_text(prop, "Gpencil MultiSample",
- "Enable Grease Pencil OpenGL multi-sampling, only for systems that support it");
- RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
- prop = RNA_def_property(srna, "use_region_overlap", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_REGION_OVERLAP);
- RNA_def_property_ui_text(prop, "Region Overlap",
- "Draw tool/property regions over the main region");
- RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
-
- prop = RNA_def_property(srna, "gpu_viewport_quality", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gpu_viewport_quality");
- RNA_def_property_float_default(prop, 0.6f);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Viewport Quality", "Quality setting for Solid mode rendering in the 3d viewport");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
- RNA_def_property_struct_type(prop, "UserSolidLight");
- RNA_def_property_ui_text(prop, "Solid Lights", "Lights user to display objects in solid draw mode");
-
- prop = RNA_def_property(srna, "light_ambient", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "light_ambient");
- RNA_def_property_array(prop, 3);
- RNA_def_property_ui_text(prop, "Ambient Color", "Color of the ambient light that uniformly lit the scene");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
-
- prop = RNA_def_property(srna, "use_studio_light_edit", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "edit_studio_light", 1);
- RNA_def_property_ui_text(prop, "Edit Studio Light",
- "View the result of the studio light editor in the viewport");
- RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
-
- prop = RNA_def_property(srna, "gl_clip_alpha", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "glalphaclip");
- 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");
-
- /* Textures */
-
- prop = RNA_def_property(srna, "image_draw_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, image_draw_methods);
- RNA_def_property_enum_sdna(prop, NULL, "image_draw_method");
- RNA_def_property_ui_text(prop, "Image Display Method", "Method used for displaying images on the screen");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
- RNA_def_property_enum_items(prop, anisotropic_items);
- RNA_def_property_enum_default(prop, 1);
- RNA_def_property_ui_text(prop, "Anisotropic Filter",
- "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic "
- "filtering)");
- RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update");
-
- prop = RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "glreslimit");
- RNA_def_property_enum_items(prop, gl_texture_clamp_items);
- RNA_def_property_ui_text(prop, "GL Texture Limit", "Limit the texture size to save graphics memory");
- RNA_def_property_update(prop, 0, "rna_userdef_gl_texture_limit_update");
-
- prop = RNA_def_property(srna, "texture_time_out", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "textimeout");
- RNA_def_property_range(prop, 0, 3600);
- RNA_def_property_ui_text(prop, "Texture Time Out",
- "Time since last access of a GL texture in seconds after which it is freed "
- "(set to 0 to keep textures allocated)");
-
- prop = RNA_def_property(srna, "texture_collection_rate", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "texcollectrate");
- RNA_def_property_range(prop, 1, 3600);
- RNA_def_property_ui_text(prop, "Texture Collection Rate",
- "Number of seconds between each run of the GL texture garbage collector");
-
- /* Select */
-
- prop = RNA_def_property(srna, "use_select_pick_depth", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_NO_DEPT_PICK);
- RNA_def_property_ui_text(
- prop, "OpenGL Depth Picking",
- "Use the depth buffer for picking 3D View selection "
- "(without this the front most object may not be selected first)");
-
- /* Audio */
-
- prop = RNA_def_property(srna, "audio_mixing_buffer", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mixbufsize");
- RNA_def_property_enum_items(prop, audio_mixing_samples_items);
- RNA_def_property_ui_text(prop, "Audio Mixing Buffer", "Number of samples used by the audio mixing buffer");
- RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
-
- prop = RNA_def_property(srna, "audio_device", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "audiodevice");
- RNA_def_property_enum_items(prop, audio_device_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_audio_device_itemf");
- RNA_def_property_ui_text(prop, "Audio Device", "Audio output device");
- RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
-
- prop = RNA_def_property(srna, "audio_sample_rate", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "audiorate");
- RNA_def_property_enum_items(prop, audio_rate_items);
- RNA_def_property_ui_text(prop, "Audio Sample Rate", "Audio sample rate");
- RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
-
- prop = RNA_def_property(srna, "audio_sample_format", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "audioformat");
- RNA_def_property_enum_items(prop, audio_format_items);
- RNA_def_property_ui_text(prop, "Audio Sample Format", "Audio sample format");
- RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
-
- prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "audiochannels");
- RNA_def_property_enum_items(prop, audio_channel_items);
- RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
- RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
-
-
-#ifdef WITH_OPENSUBDIV
- prop = RNA_def_property(srna, "opensubdiv_compute_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
- RNA_def_property_enum_sdna(prop, NULL, "opensubdiv_compute_type");
- RNA_def_property_enum_items(prop, opensubdiv_compute_type_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_opensubdiv_compute_type_itemf");
- RNA_def_property_ui_text(prop, "OpenSubdiv Compute Type", "Type of computer back-end used with OpenSubdiv");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_userdef_opensubdiv_update");
-#endif
-
-#ifdef WITH_CYCLES
- prop = RNA_def_property(srna, "legacy_compute_device_type", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "compute_device_type");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_HIDDEN);
- RNA_def_property_ui_text(prop, "Legacy Compute Device Type", "For backwards compatibility only");
-#endif
+ PropertyRNA *prop;
+ StructRNA *srna;
+
+ static const EnumPropertyItem gl_texture_clamp_items[] = {
+ {0, "CLAMP_OFF", 0, "Off", ""},
+ {8192, "CLAMP_8192", 0, "8192", ""},
+ {4096, "CLAMP_4096", 0, "4096", ""},
+ {2048, "CLAMP_2048", 0, "2048", ""},
+ {1024, "CLAMP_1024", 0, "1024", ""},
+ {512, "CLAMP_512", 0, "512", ""},
+ {256, "CLAMP_256", 0, "256", ""},
+ {128, "CLAMP_128", 0, "128", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem anisotropic_items[] = {
+ {1, "FILTER_0", 0, "Off", ""},
+ {2, "FILTER_2", 0, "2x", ""},
+ {4, "FILTER_4", 0, "4x", ""},
+ {8, "FILTER_8", 0, "8x", ""},
+ {16, "FILTER_16", 0, "16x", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem audio_mixing_samples_items[] = {
+ {256, "SAMPLES_256", 0, "256", "Set audio mixing buffer size to 256 samples"},
+ {512, "SAMPLES_512", 0, "512", "Set audio mixing buffer size to 512 samples"},
+ {1024, "SAMPLES_1024", 0, "1024", "Set audio mixing buffer size to 1024 samples"},
+ {2048, "SAMPLES_2048", 0, "2048", "Set audio mixing buffer size to 2048 samples"},
+ {4096, "SAMPLES_4096", 0, "4096", "Set audio mixing buffer size to 4096 samples"},
+ {8192, "SAMPLES_8192", 0, "8192", "Set audio mixing buffer size to 8192 samples"},
+ {16384, "SAMPLES_16384", 0, "16384", "Set audio mixing buffer size to 16384 samples"},
+ {32768, "SAMPLES_32768", 0, "32768", "Set audio mixing buffer size to 32768 samples"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem audio_rate_items[] = {
+ /* {8000, "RATE_8000", 0, "8 kHz", "Set audio sampling rate to 8000 samples per second"}, */
+ /* {11025, "RATE_11025", 0, "11.025 kHz", "Set audio sampling rate to 11025 samples per second"}, */
+ /* {16000, "RATE_16000", 0, "16 kHz", "Set audio sampling rate to 16000 samples per second"}, */
+ /* {22050, "RATE_22050", 0, "22.05 kHz", "Set audio sampling rate to 22050 samples per second"}, */
+ /* {32000, "RATE_32000", 0, "32 kHz", "Set audio sampling rate to 32000 samples per second"}, */
+ {44100, "RATE_44100", 0, "44.1 kHz", "Set audio sampling rate to 44100 samples per second"},
+ {48000, "RATE_48000", 0, "48 kHz", "Set audio sampling rate to 48000 samples per second"},
+ /* {88200, "RATE_88200", 0, "88.2 kHz", "Set audio sampling rate to 88200 samples per second"}, */
+ {96000, "RATE_96000", 0, "96 kHz", "Set audio sampling rate to 96000 samples per second"},
+ {192000,
+ "RATE_192000",
+ 0,
+ "192 kHz",
+ "Set audio sampling rate to 192000 samples per second"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem audio_format_items[] = {
+ {0x01, "U8", 0, "8-bit Unsigned", "Set audio sample format to 8 bit unsigned integer"},
+ {0x12, "S16", 0, "16-bit Signed", "Set audio sample format to 16 bit signed integer"},
+ {0x13, "S24", 0, "24-bit Signed", "Set audio sample format to 24 bit signed integer"},
+ {0x14, "S32", 0, "32-bit Signed", "Set audio sample format to 32 bit signed integer"},
+ {0x24, "FLOAT", 0, "32-bit Float", "Set audio sample format to 32 bit float"},
+ {0x28, "DOUBLE", 0, "64-bit Float", "Set audio sample format to 64 bit float"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem audio_channel_items[] = {
+ {1, "MONO", 0, "Mono", "Set audio channels to mono"},
+ {2, "STEREO", 0, "Stereo", "Set audio channels to stereo"},
+ {4, "SURROUND4", 0, "4 Channels", "Set audio channels to 4 channels"},
+ {6, "SURROUND51", 0, "5.1 Surround", "Set audio channels to 5.1 surround sound"},
+ {8, "SURROUND71", 0, "7.1 Surround", "Set audio channels to 7.1 surround sound"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem multi_sample_levels[] = {
+ {USER_MULTISAMPLE_NONE, "NONE", 0, "No MultiSample", "Do not use OpenGL MultiSample"},
+ {USER_MULTISAMPLE_2, "2", 0, "MultiSample: 2", "Use 2x OpenGL MultiSample"},
+ {USER_MULTISAMPLE_4, "4", 0, "MultiSample: 4", "Use 4x OpenGL MultiSample"},
+ {USER_MULTISAMPLE_8, "8", 0, "MultiSample: 8", "Use 8x OpenGL MultiSample"},
+ {USER_MULTISAMPLE_16, "16", 0, "MultiSample: 16", "Use 16x OpenGL MultiSample"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem image_draw_methods[] = {
+ {IMAGE_DRAW_METHOD_2DTEXTURE,
+ "2DTEXTURE",
+ 0,
+ "2D Texture",
+ "Use CPU for display transform and draw image with 2D texture"},
+ {IMAGE_DRAW_METHOD_GLSL,
+ "GLSL",
+ 0,
+ "GLSL",
+ "Use GLSL shaders for display transform and draw image with 2D texture"},
+ {IMAGE_DRAW_METHOD_DRAWPIXELS,
+ "DRAWPIXELS",
+ 0,
+ "DrawPixels",
+ "Use CPU for display transform and draw image using DrawPixels"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "PreferencesSystem", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "Preferences");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "System & OpenGL", "Graphics driver and operating system settings");
+
+ /* UI settings. */
+
+ prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_sdna(prop, NULL, "dpi_fac");
+ RNA_def_property_ui_text(
+ prop,
+ "UI Scale",
+ "Size multiplier to use when drawing custom user interface elements, so that "
+ "they are scaled correctly on screens with different DPI. This value is based "
+ "on operating system DPI settings and Blender display scale");
+
+ prop = RNA_def_property(srna, "ui_line_width", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_sdna(prop, NULL, "pixelsize");
+ RNA_def_property_ui_text(
+ prop,
+ "UI Line Width",
+ "Suggested line thickness and point size in pixels, for add-ons drawing custom "
+ "user interface elements, based on operating system settings and Blender UI scale");
+
+ prop = RNA_def_property(srna, "dpi", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "pixel_size", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_sdna(prop, NULL, "pixelsize");
+
+ /* Memory */
+
+ prop = RNA_def_property(srna, "prefetch_frames", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "prefetchframes");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_range(prop, 0, 500, 1, -1);
+ RNA_def_property_ui_text(prop,
+ "Prefetch Frames",
+ "Number of frames to render ahead during playback (sequencer only)");
+
+ prop = RNA_def_property(srna, "memory_cache_limit", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "memcachelimit");
+ RNA_def_property_range(prop, 0, max_memory_in_megabytes_int());
+ RNA_def_property_ui_text(prop, "Memory Cache Limit", "Memory cache limit (in megabytes)");
+ RNA_def_property_update(prop, 0, "rna_Userdef_memcache_update");
+
+ prop = RNA_def_property(srna, "scrollback", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "scrollback");
+ RNA_def_property_range(prop, 32, 32768);
+ RNA_def_property_ui_text(
+ prop, "Scrollback", "Maximum number of lines to store for the console buffer");
+
+ /* OpenGL */
+
+ /* Full scene anti-aliasing */
+ prop = RNA_def_property(srna, "multi_sample", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ogl_multisamples");
+ RNA_def_property_enum_items(prop, multi_sample_levels);
+ RNA_def_property_ui_text(
+ prop, "MultiSample", "Enable OpenGL multi-sampling, only for systems that support it");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ prop = RNA_def_property(srna, "use_edit_mode_smooth_wire", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "gpu_flag", USER_GPU_FLAG_NO_EDIT_MODE_SMOOTH_WIRE);
+ RNA_def_property_ui_text(prop,
+ "Edit-Mode Smooth Wires",
+ "Enable Edit-Mode edge smoothing, reducing aliasing, requires restart");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ /* grease pencil anti-aliasing */
+ prop = RNA_def_property(srna, "gpencil_multi_sample", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "gpencil_multisamples");
+ RNA_def_property_enum_items(prop, multi_sample_levels);
+ RNA_def_property_ui_text(
+ prop,
+ "Gpencil MultiSample",
+ "Enable Grease Pencil OpenGL multi-sampling, only for systems that support it");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ prop = RNA_def_property(srna, "use_region_overlap", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_REGION_OVERLAP);
+ RNA_def_property_ui_text(
+ prop, "Region Overlap", "Draw tool/property regions over the main region");
+ RNA_def_property_update(prop, 0, "rna_userdef_dpi_update");
+
+ prop = RNA_def_property(srna, "gpu_viewport_quality", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "gpu_viewport_quality");
+ RNA_def_property_float_default(prop, 0.6f);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Viewport Quality", "Quality setting for Solid mode rendering in the 3d viewport");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "solid_lights", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "light_param", "");
+ RNA_def_property_struct_type(prop, "UserSolidLight");
+ RNA_def_property_ui_text(
+ prop, "Solid Lights", "Lights user to display objects in solid draw mode");
+
+ prop = RNA_def_property(srna, "light_ambient", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "light_ambient");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_ui_text(
+ prop, "Ambient Color", "Color of the ambient light that uniformly lit the scene");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+
+ prop = RNA_def_property(srna, "use_studio_light_edit", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "edit_studio_light", 1);
+ RNA_def_property_ui_text(
+ prop, "Edit Studio Light", "View the result of the studio light editor in the viewport");
+ RNA_def_property_update(prop, 0, "rna_UserDef_viewport_lights_update");
+
+ prop = RNA_def_property(srna, "gl_clip_alpha", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "glalphaclip");
+ 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");
+
+ /* Textures */
+
+ prop = RNA_def_property(srna, "image_draw_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, image_draw_methods);
+ RNA_def_property_enum_sdna(prop, NULL, "image_draw_method");
+ RNA_def_property_ui_text(
+ prop, "Image Display Method", "Method used for displaying images on the screen");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ prop = RNA_def_property(srna, "anisotropic_filter", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "anisotropic_filter");
+ RNA_def_property_enum_items(prop, anisotropic_items);
+ RNA_def_property_enum_default(prop, 1);
+ RNA_def_property_ui_text(
+ prop,
+ "Anisotropic Filter",
+ "Quality of the anisotropic filtering (values greater than 1.0 enable anisotropic "
+ "filtering)");
+ RNA_def_property_update(prop, 0, "rna_userdef_anisotropic_update");
+
+ prop = RNA_def_property(srna, "gl_texture_limit", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "glreslimit");
+ RNA_def_property_enum_items(prop, gl_texture_clamp_items);
+ RNA_def_property_ui_text(
+ prop, "GL Texture Limit", "Limit the texture size to save graphics memory");
+ RNA_def_property_update(prop, 0, "rna_userdef_gl_texture_limit_update");
+
+ prop = RNA_def_property(srna, "texture_time_out", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "textimeout");
+ RNA_def_property_range(prop, 0, 3600);
+ RNA_def_property_ui_text(
+ prop,
+ "Texture Time Out",
+ "Time since last access of a GL texture in seconds after which it is freed "
+ "(set to 0 to keep textures allocated)");
+
+ prop = RNA_def_property(srna, "texture_collection_rate", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "texcollectrate");
+ RNA_def_property_range(prop, 1, 3600);
+ RNA_def_property_ui_text(
+ prop,
+ "Texture Collection Rate",
+ "Number of seconds between each run of the GL texture garbage collector");
+
+ /* Select */
+
+ prop = RNA_def_property(srna, "use_select_pick_depth", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "gpu_flag", USER_GPU_FLAG_NO_DEPT_PICK);
+ RNA_def_property_ui_text(prop,
+ "OpenGL Depth Picking",
+ "Use the depth buffer for picking 3D View selection "
+ "(without this the front most object may not be selected first)");
+
+ /* Audio */
+
+ prop = RNA_def_property(srna, "audio_mixing_buffer", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mixbufsize");
+ RNA_def_property_enum_items(prop, audio_mixing_samples_items);
+ RNA_def_property_ui_text(
+ prop, "Audio Mixing Buffer", "Number of samples used by the audio mixing buffer");
+ RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
+
+ prop = RNA_def_property(srna, "audio_device", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "audiodevice");
+ RNA_def_property_enum_items(prop, audio_device_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_audio_device_itemf");
+ RNA_def_property_ui_text(prop, "Audio Device", "Audio output device");
+ RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
+
+ prop = RNA_def_property(srna, "audio_sample_rate", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "audiorate");
+ RNA_def_property_enum_items(prop, audio_rate_items);
+ RNA_def_property_ui_text(prop, "Audio Sample Rate", "Audio sample rate");
+ RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
+
+ prop = RNA_def_property(srna, "audio_sample_format", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "audioformat");
+ RNA_def_property_enum_items(prop, audio_format_items);
+ RNA_def_property_ui_text(prop, "Audio Sample Format", "Audio sample format");
+ RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
+
+ prop = RNA_def_property(srna, "audio_channels", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "audiochannels");
+ RNA_def_property_enum_items(prop, audio_channel_items);
+ RNA_def_property_ui_text(prop, "Audio Channels", "Audio channel count");
+ RNA_def_property_update(prop, 0, "rna_UserDef_audio_update");
+
+# ifdef WITH_OPENSUBDIV
+ prop = RNA_def_property(srna, "opensubdiv_compute_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT);
+ RNA_def_property_enum_sdna(prop, NULL, "opensubdiv_compute_type");
+ RNA_def_property_enum_items(prop, opensubdiv_compute_type_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_userdef_opensubdiv_compute_type_itemf");
+ RNA_def_property_ui_text(
+ prop, "OpenSubdiv Compute Type", "Type of computer back-end used with OpenSubdiv");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, "rna_userdef_opensubdiv_update");
+# endif
+
+# ifdef WITH_CYCLES
+ prop = RNA_def_property(srna, "legacy_compute_device_type", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "compute_device_type");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_HIDDEN);
+ RNA_def_property_ui_text(prop, "Legacy Compute Device Type", "For backwards compatibility only");
+# endif
}
static void rna_def_userdef_input(BlenderRNA *brna)
{
- PropertyRNA *prop;
- StructRNA *srna;
-
- static const EnumPropertyItem view_rotation_items[] = {
- {0, "TURNTABLE", 0, "Turntable", "Turntable keeps the Z-axis upright while orbiting"},
- {USER_TRACKBALL, "TRACKBALL", 0, "Trackball", "Trackball allows you to tumble your view at any angle"},
- {0, NULL, 0, NULL, NULL},
- };
-
-#ifdef WITH_INPUT_NDOF
- static const EnumPropertyItem ndof_view_navigation_items[] = {
- {0, "FREE", 0, "Free", "Use full 6 degrees of freedom by default"},
- {NDOF_MODE_ORBIT, "ORBIT", 0, "Orbit", "Orbit about the view center by default"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem ndof_view_rotation_items[] = {
- {NDOF_TURNTABLE, "TURNTABLE", 0, "Turntable", "Use turntable style rotation in the viewport"},
- {0, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"},
- {0, NULL, 0, NULL, NULL},
- };
-#endif /* WITH_INPUT_NDOF */
-
- static const EnumPropertyItem tablet_api[] = {
- {USER_TABLET_AUTOMATIC, "AUTOMATIC", 0, "Automatic", "Automatically choose Wintab or Windows Ink depending on the device"},
- {USER_TABLET_NATIVE, "WINDOWS_INK", 0, "Windows Ink", "Use native Windows Ink API, for modern tablet and pen devices. Requires Windows 8 or newer"},
- {USER_TABLET_WINTAB, "WINTAB", 0, "Wintab", "Use Wintab driver for older tablets and Windows versions"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem view_zoom_styles[] = {
- {USER_ZOOM_CONT, "CONTINUE", 0, "Continue", "Old style zoom, continues while moving mouse up or down"},
- {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"},
- {USER_ZOOM_SCALE, "SCALE", 0, "Scale",
- "Zoom in and out like scaling the view, mouse movements relative to center"},
- {0, NULL, 0, NULL, NULL},
- };
-
- static const EnumPropertyItem view_zoom_axes[] = {
- {0, "VERTICAL", 0, "Vertical", "Zoom in and out based on vertical mouse movement"},
- {USER_ZOOM_HORIZ, "HORIZONTAL", 0, "Horizontal", "Zoom in and out based on horizontal mouse movement"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "PreferencesInput", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_nested(brna, srna, "Preferences");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Input", "Settings for input devices");
-
- prop = RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "viewzoom");
- RNA_def_property_enum_items(prop, view_zoom_styles);
- RNA_def_property_ui_text(prop, "Zoom Style", "Which style to use for viewport scaling");
-
- prop = RNA_def_property(srna, "view_zoom_axis", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
- RNA_def_property_enum_items(prop, view_zoom_axes);
- RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on");
-
- prop = RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
- RNA_def_property_ui_text(prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");
-
- prop = RNA_def_property(srna, "use_mouse_depth_navigate", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_NAVIGATE);
- RNA_def_property_ui_text(prop, "Auto Depth",
- "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
-
- prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
- RNA_def_property_ui_text(prop, "Camera Parent Lock",
- "When the camera is locked to the view and in fly mode, "
- "transform the parent rather than the camera");
-
- /* view zoom */
- prop = RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
- RNA_def_property_ui_text(prop, "Zoom To Mouse Position",
- "Zoom in towards the mouse pointer's position in the 3D view, "
- "rather than the 2D window center");
-
- /* view rotation */
- prop = RNA_def_property(srna, "use_auto_perspective", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP);
- RNA_def_property_ui_text(prop, "Auto Perspective",
- "Automatically switch between orthographic and perspective when changing "
- "from top/front/side views");
-
- prop = RNA_def_property(srna, "use_rotate_around_active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION);
- RNA_def_property_ui_text(prop, "Orbit Around Selection", "Use selection as the pivot point");
-
- prop = RNA_def_property(srna, "view_rotate_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
- RNA_def_property_enum_items(prop, view_rotation_items);
- RNA_def_property_ui_text(prop, "Orbit Method", "Orbit method in the viewport");
-
- prop = RNA_def_property(srna, "use_mouse_continuous", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE);
- RNA_def_property_ui_text(prop, "Continuous Grab",
- "Allow moving the mouse outside the view on some manipulations "
- "(transform, ui control drag)");
-
- prop = RNA_def_property(srna, "use_drag_immediately", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELEASECONFIRM);
- RNA_def_property_ui_text(prop, "Release Confirms",
- "Moving things with a mouse drag confirms when releasing the button");
-
- prop = RNA_def_property(srna, "use_numeric_input_advanced", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FLAG_NUMINPUT_ADVANCED);
- RNA_def_property_ui_text(
- prop, "Default to Advanced Numeric Input",
- "When entering numbers while transforming, "
- "default to advanced mode for full math expression evaluation");
-
- /* View Navigation */
- prop = RNA_def_property(srna, "navigation_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "navigation_mode");
- RNA_def_property_enum_items(prop, rna_enum_navigation_mode_items);
- RNA_def_property_ui_text(prop, "View Navigation", "Which method to use for viewport navigation");
-
- prop = RNA_def_property(srna, "walk_navigation", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "walk_navigation");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "WalkNavigation");
- RNA_def_property_ui_text(prop, "Walk Navigation", "Settings for walk navigation mode");
-
- /* tweak tablet & mouse preset */
- prop = RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_PIXEL);
- RNA_def_property_int_sdna(prop, NULL, "tweak_threshold");
- RNA_def_property_range(prop, 3, 1024);
- RNA_def_property_ui_text(prop, "Drag Threshold",
- "Number of pixels you have to drag before a tweak/drag event is triggered "
- "(otherwise click events are detected)");
-
- prop = RNA_def_property(srna, "move_threshold", PROP_INT, PROP_PIXEL);
- RNA_def_property_range(prop, 0, 255);
- RNA_def_property_ui_range(prop, 0, 10, 1, -1);
- RNA_def_property_ui_text(prop, "Motion Threshold",
- "Number of pixels you have to before the cursor is considered to have moved "
- "(used for cycling selected items on successive clicks)");
-
- /* tablet pressure curve */
- prop = RNA_def_property(srna, "pressure_threshold_max", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_float_default(prop, 1.0f);
- RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 3);
- RNA_def_property_ui_text(prop, "Max Threshold",
- "Raw input pressure value that is interpreted as 100% by Blender");
-
- prop = RNA_def_property(srna, "pressure_softness", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
- RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1f, 2);
- RNA_def_property_ui_text(prop, "Softness",
- "Adjusts softness of the low pressure response onset using a gamma curve");
-
- prop = RNA_def_property(srna, "tablet_api", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, tablet_api);
- RNA_def_property_ui_text(prop, "Tablet API", "Select the tablet API to use for pressure sensitivity");
- RNA_def_property_update(prop, 0, "rna_userdef_tablet_api_update");
-
-#ifdef WITH_INPUT_NDOF
- /* 3D mouse settings */
- /* global options */
- prop = RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01f, 40.0f);
- RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse for panning");
-
- prop = RNA_def_property(srna, "ndof_orbit_sensitivity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_range(prop, 0.01f, 40.0f);
- RNA_def_property_ui_text(prop, "Orbit Sensitivity", "Overall sensitivity of the 3D Mouse for orbiting");
-
- prop = RNA_def_property(srna, "ndof_deadzone", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_ui_text(prop, "Deadzone", "Threshold of initial movement needed from the device's rest position");
- RNA_def_property_update(prop, 0, "rna_userdef_ndof_deadzone_update");
-
- prop = RNA_def_property(srna, "ndof_pan_yz_swap_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PAN_YZ_SWAP_AXIS);
- RNA_def_property_ui_text(prop, "Y/Z Swap Axis",
- "Pan using up/down on the device (otherwise forward/backward)");
-
- prop = RNA_def_property(srna, "ndof_zoom_invert", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_INVERT);
- RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction");
-
- /* 3D view */
- prop = RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE);
- RNA_def_property_ui_text(prop, "Show Navigation Guide", "Display the center and axis during rotation");
- /* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/
-
- /* 3D view */
- prop = RNA_def_property(srna, "ndof_view_navigate_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
- RNA_def_property_enum_items(prop, ndof_view_navigation_items);
- RNA_def_property_ui_text(prop, "NDOF View Navigate", "Navigation style in the viewport");
-
- prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
- RNA_def_property_enum_items(prop, ndof_view_rotation_items);
- RNA_def_property_ui_text(prop, "NDOF View Rotation", "Rotation style in the viewport");
-
- /* 3D view: yaw */
- prop = RNA_def_property(srna, "ndof_rotx_invert_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTX_INVERT_AXIS);
- RNA_def_property_ui_text(prop, "Invert Pitch (X) Axis", "");
-
- /* 3D view: pitch */
- prop = RNA_def_property(srna, "ndof_roty_invert_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTY_INVERT_AXIS);
- RNA_def_property_ui_text(prop, "Invert Yaw (Y) Axis", "");
-
- /* 3D view: roll */
- prop = RNA_def_property(srna, "ndof_rotz_invert_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTZ_INVERT_AXIS);
- RNA_def_property_ui_text(prop, "Invert Roll (Z) Axis", "");
-
- /* 3D view: pan x */
- prop = RNA_def_property(srna, "ndof_panx_invert_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANX_INVERT_AXIS);
- RNA_def_property_ui_text(prop, "Invert X Axis", "");
-
- /* 3D view: pan y */
- prop = RNA_def_property(srna, "ndof_pany_invert_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANY_INVERT_AXIS);
- RNA_def_property_ui_text(prop, "Invert Y Axis", "");
-
- /* 3D view: pan z */
- prop = RNA_def_property(srna, "ndof_panz_invert_axis", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANZ_INVERT_AXIS);
- RNA_def_property_ui_text(prop, "Invert Z Axis", "");
-
- /* 3D view: fly */
- prop = RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON);
- RNA_def_property_ui_text(prop, "Lock Horizon", "Keep horizon level while flying with 3D Mouse");
-
- prop = RNA_def_property(srna, "ndof_fly_helicopter", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_FLY_HELICOPTER);
- RNA_def_property_ui_text(prop, "Helicopter Mode", "Device up/down directly controls your Z position");
-
- /* let Python know whether NDOF is enabled */
- prop = RNA_def_boolean(srna, "use_ndof", true, "", "");
-#else
- prop = RNA_def_boolean(srna, "use_ndof", false, "", "");
-#endif /* WITH_INPUT_NDOF */
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "dbl_click_time");
- RNA_def_property_range(prop, 1, 1000);
- RNA_def_property_ui_text(prop, "Double Click Timeout", "Time/delay (in ms) for a double click");
-
- prop = RNA_def_property(srna, "use_mouse_emulate_3_button", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE);
- RNA_def_property_ui_text(prop, "Emulate 3 Button Mouse",
- "Emulate Middle Mouse with Alt+Left Mouse");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_userdef_keyconfig_reload_update");
-
- prop = RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD);
- RNA_def_property_ui_text(prop, "Emulate Numpad", "Main 1 to 0 keys act as the numpad ones (useful for laptops)");
-
- prop = RNA_def_property(srna, "invert_zoom_wheel", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
- RNA_def_property_ui_text(prop, "Wheel Invert Zoom", "Swap the Mouse Wheel zoom direction");
-
- prop = RNA_def_property(srna, "wheel_scroll_lines", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "wheellinescroll");
- RNA_def_property_range(prop, 0, 32);
- RNA_def_property_ui_text(prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel");
-
- prop = RNA_def_property(srna, "use_trackpad_natural", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_TRACKPAD_NATURAL);
- RNA_def_property_ui_text(prop, "Trackpad Natural",
- "If your system uses 'natural' scrolling, this option keeps consistent trackpad usage throughout the UI");
+ PropertyRNA *prop;
+ StructRNA *srna;
+
+ static const EnumPropertyItem view_rotation_items[] = {
+ {0, "TURNTABLE", 0, "Turntable", "Turntable keeps the Z-axis upright while orbiting"},
+ {USER_TRACKBALL,
+ "TRACKBALL",
+ 0,
+ "Trackball",
+ "Trackball allows you to tumble your view at any angle"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+# ifdef WITH_INPUT_NDOF
+ static const EnumPropertyItem ndof_view_navigation_items[] = {
+ {0, "FREE", 0, "Free", "Use full 6 degrees of freedom by default"},
+ {NDOF_MODE_ORBIT, "ORBIT", 0, "Orbit", "Orbit about the view center by default"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem ndof_view_rotation_items[] = {
+ {NDOF_TURNTABLE,
+ "TURNTABLE",
+ 0,
+ "Turntable",
+ "Use turntable style rotation in the viewport"},
+ {0, "TRACKBALL", 0, "Trackball", "Use trackball style rotation in the viewport"},
+ {0, NULL, 0, NULL, NULL},
+ };
+# endif /* WITH_INPUT_NDOF */
+
+ static const EnumPropertyItem tablet_api[] = {
+ {USER_TABLET_AUTOMATIC,
+ "AUTOMATIC",
+ 0,
+ "Automatic",
+ "Automatically choose Wintab or Windows Ink depending on the device"},
+ {USER_TABLET_NATIVE,
+ "WINDOWS_INK",
+ 0,
+ "Windows Ink",
+ "Use native Windows Ink API, for modern tablet and pen devices. Requires Windows 8 or "
+ "newer"},
+ {USER_TABLET_WINTAB,
+ "WINTAB",
+ 0,
+ "Wintab",
+ "Use Wintab driver for older tablets and Windows versions"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem view_zoom_styles[] = {
+ {USER_ZOOM_CONT,
+ "CONTINUE",
+ 0,
+ "Continue",
+ "Old style zoom, continues while moving mouse up or down"},
+ {USER_ZOOM_DOLLY, "DOLLY", 0, "Dolly", "Zoom in and out based on vertical mouse movement"},
+ {USER_ZOOM_SCALE,
+ "SCALE",
+ 0,
+ "Scale",
+ "Zoom in and out like scaling the view, mouse movements relative to center"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ static const EnumPropertyItem view_zoom_axes[] = {
+ {0, "VERTICAL", 0, "Vertical", "Zoom in and out based on vertical mouse movement"},
+ {USER_ZOOM_HORIZ,
+ "HORIZONTAL",
+ 0,
+ "Horizontal",
+ "Zoom in and out based on horizontal mouse movement"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "PreferencesInput", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "Preferences");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Input", "Settings for input devices");
+
+ prop = RNA_def_property(srna, "view_zoom_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "viewzoom");
+ RNA_def_property_enum_items(prop, view_zoom_styles);
+ RNA_def_property_ui_text(prop, "Zoom Style", "Which style to use for viewport scaling");
+
+ prop = RNA_def_property(srna, "view_zoom_axis", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "uiflag");
+ RNA_def_property_enum_items(prop, view_zoom_axes);
+ RNA_def_property_ui_text(prop, "Zoom Axis", "Axis of mouse movement to zoom in or out on");
+
+ prop = RNA_def_property(srna, "invert_mouse_zoom", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_INVERT);
+ RNA_def_property_ui_text(
+ prop, "Invert Zoom Direction", "Invert the axis of mouse movement for zooming");
+
+ prop = RNA_def_property(srna, "use_mouse_depth_navigate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DEPTH_NAVIGATE);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Depth",
+ "Use the depth under the mouse to improve view pan/rotate/zoom functionality");
+
+ prop = RNA_def_property(srna, "use_camera_lock_parent", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "uiflag", USER_CAM_LOCK_NO_PARENT);
+ RNA_def_property_ui_text(prop,
+ "Camera Parent Lock",
+ "When the camera is locked to the view and in fly mode, "
+ "transform the parent rather than the camera");
+
+ /* view zoom */
+ prop = RNA_def_property(srna, "use_zoom_to_mouse", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ZOOM_TO_MOUSEPOS);
+ RNA_def_property_ui_text(prop,
+ "Zoom To Mouse Position",
+ "Zoom in towards the mouse pointer's position in the 3D view, "
+ "rather than the 2D window center");
+
+ /* view rotation */
+ prop = RNA_def_property(srna, "use_auto_perspective", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_AUTOPERSP);
+ RNA_def_property_ui_text(
+ prop,
+ "Auto Perspective",
+ "Automatically switch between orthographic and perspective when changing "
+ "from top/front/side views");
+
+ prop = RNA_def_property(srna, "use_rotate_around_active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_ORBIT_SELECTION);
+ RNA_def_property_ui_text(prop, "Orbit Around Selection", "Use selection as the pivot point");
+
+ prop = RNA_def_property(srna, "view_rotate_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "flag");
+ RNA_def_property_enum_items(prop, view_rotation_items);
+ RNA_def_property_ui_text(prop, "Orbit Method", "Orbit method in the viewport");
+
+ prop = RNA_def_property(srna, "use_mouse_continuous", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_CONTINUOUS_MOUSE);
+ RNA_def_property_ui_text(prop,
+ "Continuous Grab",
+ "Allow moving the mouse outside the view on some manipulations "
+ "(transform, ui control drag)");
+
+ prop = RNA_def_property(srna, "use_drag_immediately", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELEASECONFIRM);
+ RNA_def_property_ui_text(prop,
+ "Release Confirms",
+ "Moving things with a mouse drag confirms when releasing the button");
+
+ prop = RNA_def_property(srna, "use_numeric_input_advanced", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FLAG_NUMINPUT_ADVANCED);
+ RNA_def_property_ui_text(prop,
+ "Default to Advanced Numeric Input",
+ "When entering numbers while transforming, "
+ "default to advanced mode for full math expression evaluation");
+
+ /* View Navigation */
+ prop = RNA_def_property(srna, "navigation_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "navigation_mode");
+ RNA_def_property_enum_items(prop, rna_enum_navigation_mode_items);
+ RNA_def_property_ui_text(prop, "View Navigation", "Which method to use for viewport navigation");
+
+ prop = RNA_def_property(srna, "walk_navigation", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "walk_navigation");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "WalkNavigation");
+ RNA_def_property_ui_text(prop, "Walk Navigation", "Settings for walk navigation mode");
+
+ /* tweak tablet & mouse preset */
+ prop = RNA_def_property(srna, "drag_threshold", PROP_INT, PROP_PIXEL);
+ RNA_def_property_int_sdna(prop, NULL, "tweak_threshold");
+ RNA_def_property_range(prop, 3, 1024);
+ RNA_def_property_ui_text(
+ prop,
+ "Drag Threshold",
+ "Number of pixels you have to drag before a tweak/drag event is triggered "
+ "(otherwise click events are detected)");
+
+ prop = RNA_def_property(srna, "move_threshold", PROP_INT, PROP_PIXEL);
+ RNA_def_property_range(prop, 0, 255);
+ RNA_def_property_ui_range(prop, 0, 10, 1, -1);
+ RNA_def_property_ui_text(
+ prop,
+ "Motion Threshold",
+ "Number of pixels you have to before the cursor is considered to have moved "
+ "(used for cycling selected items on successive clicks)");
+
+ /* tablet pressure curve */
+ prop = RNA_def_property(srna, "pressure_threshold_max", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_float_default(prop, 1.0f);
+ RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.01f, 3);
+ RNA_def_property_ui_text(
+ prop, "Max Threshold", "Raw input pressure value that is interpreted as 100% by Blender");
+
+ prop = RNA_def_property(srna, "pressure_softness", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, -FLT_MAX, FLT_MAX);
+ RNA_def_property_ui_range(prop, -1.0f, 1.0f, 0.1f, 2);
+ RNA_def_property_ui_text(
+ prop, "Softness", "Adjusts softness of the low pressure response onset using a gamma curve");
+
+ prop = RNA_def_property(srna, "tablet_api", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, tablet_api);
+ RNA_def_property_ui_text(
+ prop, "Tablet API", "Select the tablet API to use for pressure sensitivity");
+ RNA_def_property_update(prop, 0, "rna_userdef_tablet_api_update");
+
+# ifdef WITH_INPUT_NDOF
+ /* 3D mouse settings */
+ /* global options */
+ prop = RNA_def_property(srna, "ndof_sensitivity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01f, 40.0f);
+ RNA_def_property_ui_text(prop, "Sensitivity", "Overall sensitivity of the 3D Mouse for panning");
+
+ prop = RNA_def_property(srna, "ndof_orbit_sensitivity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_range(prop, 0.01f, 40.0f);
+ RNA_def_property_ui_text(
+ prop, "Orbit Sensitivity", "Overall sensitivity of the 3D Mouse for orbiting");
+
+ prop = RNA_def_property(srna, "ndof_deadzone", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_ui_text(
+ prop, "Deadzone", "Threshold of initial movement needed from the device's rest position");
+ RNA_def_property_update(prop, 0, "rna_userdef_ndof_deadzone_update");
+
+ prop = RNA_def_property(srna, "ndof_pan_yz_swap_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PAN_YZ_SWAP_AXIS);
+ RNA_def_property_ui_text(
+ prop, "Y/Z Swap Axis", "Pan using up/down on the device (otherwise forward/backward)");
+
+ prop = RNA_def_property(srna, "ndof_zoom_invert", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ZOOM_INVERT);
+ RNA_def_property_ui_text(prop, "Invert Zoom", "Zoom using opposite direction");
+
+ /* 3D view */
+ prop = RNA_def_property(srna, "ndof_show_guide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_SHOW_GUIDE);
+ RNA_def_property_ui_text(
+ prop, "Show Navigation Guide", "Display the center and axis during rotation");
+ /* TODO: update description when fly-mode visuals are in place ("projected position in fly mode")*/
+
+ /* 3D view */
+ prop = RNA_def_property(srna, "ndof_view_navigate_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
+ RNA_def_property_enum_items(prop, ndof_view_navigation_items);
+ RNA_def_property_ui_text(prop, "NDOF View Navigate", "Navigation style in the viewport");
+
+ prop = RNA_def_property(srna, "ndof_view_rotate_method", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_bitflag_sdna(prop, NULL, "ndof_flag");
+ RNA_def_property_enum_items(prop, ndof_view_rotation_items);
+ RNA_def_property_ui_text(prop, "NDOF View Rotation", "Rotation style in the viewport");
+
+ /* 3D view: yaw */
+ prop = RNA_def_property(srna, "ndof_rotx_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTX_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert Pitch (X) Axis", "");
+
+ /* 3D view: pitch */
+ prop = RNA_def_property(srna, "ndof_roty_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTY_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert Yaw (Y) Axis", "");
+
+ /* 3D view: roll */
+ prop = RNA_def_property(srna, "ndof_rotz_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_ROTZ_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert Roll (Z) Axis", "");
+
+ /* 3D view: pan x */
+ prop = RNA_def_property(srna, "ndof_panx_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANX_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert X Axis", "");
+
+ /* 3D view: pan y */
+ prop = RNA_def_property(srna, "ndof_pany_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANY_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert Y Axis", "");
+
+ /* 3D view: pan z */
+ prop = RNA_def_property(srna, "ndof_panz_invert_axis", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_PANZ_INVERT_AXIS);
+ RNA_def_property_ui_text(prop, "Invert Z Axis", "");
+
+ /* 3D view: fly */
+ prop = RNA_def_property(srna, "ndof_lock_horizon", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_LOCK_HORIZON);
+ RNA_def_property_ui_text(prop, "Lock Horizon", "Keep horizon level while flying with 3D Mouse");
+
+ prop = RNA_def_property(srna, "ndof_fly_helicopter", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ndof_flag", NDOF_FLY_HELICOPTER);
+ RNA_def_property_ui_text(
+ prop, "Helicopter Mode", "Device up/down directly controls your Z position");
+
+ /* let Python know whether NDOF is enabled */
+ prop = RNA_def_boolean(srna, "use_ndof", true, "", "");
+# else
+ prop = RNA_def_boolean(srna, "use_ndof", false, "", "");
+# endif /* WITH_INPUT_NDOF */
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "mouse_double_click_time", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "dbl_click_time");
+ RNA_def_property_range(prop, 1, 1000);
+ RNA_def_property_ui_text(prop, "Double Click Timeout", "Time/delay (in ms) for a double click");
+
+ prop = RNA_def_property(srna, "use_mouse_emulate_3_button", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_TWOBUTTONMOUSE);
+ RNA_def_property_ui_text(
+ prop, "Emulate 3 Button Mouse", "Emulate Middle Mouse with Alt+Left Mouse");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_userdef_keyconfig_reload_update");
+
+ prop = RNA_def_property(srna, "use_emulate_numpad", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_NONUMPAD);
+ RNA_def_property_ui_text(
+ prop, "Emulate Numpad", "Main 1 to 0 keys act as the numpad ones (useful for laptops)");
+
+ prop = RNA_def_property(srna, "invert_zoom_wheel", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_WHEELZOOMDIR);
+ RNA_def_property_ui_text(prop, "Wheel Invert Zoom", "Swap the Mouse Wheel zoom direction");
+
+ prop = RNA_def_property(srna, "wheel_scroll_lines", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "wheellinescroll");
+ RNA_def_property_range(prop, 0, 32);
+ RNA_def_property_ui_text(
+ prop, "Wheel Scroll Lines", "Number of lines scrolled at a time with the mouse wheel");
+
+ prop = RNA_def_property(srna, "use_trackpad_natural", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag2", USER_TRACKPAD_NATURAL);
+ RNA_def_property_ui_text(prop,
+ "Trackpad Natural",
+ "If your system uses 'natural' scrolling, this option keeps consistent "
+ "trackpad usage throughout the UI");
}
static void rna_def_userdef_keymap(BlenderRNA *brna)
{
- PropertyRNA *prop;
+ PropertyRNA *prop;
- StructRNA *srna = RNA_def_struct(brna, "PreferencesKeymap", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_nested(brna, srna, "Preferences");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Keymap", "Shortcut setup for keyboards and other input devices");
+ StructRNA *srna = RNA_def_struct(brna, "PreferencesKeymap", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "Preferences");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Keymap", "Shortcut setup for keyboards and other input devices");
- prop = RNA_def_property(srna, "show_ui_keyconfig", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "userpref_flag", USER_SECTION_INPUT_HIDE_UI_KEYCONFIG);
- RNA_def_property_ui_text(prop, "Show UI Key-Config", "");
+ prop = RNA_def_property(srna, "show_ui_keyconfig", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(
+ prop, NULL, "userpref_flag", USER_SECTION_INPUT_HIDE_UI_KEYCONFIG);
+ RNA_def_property_ui_text(prop, "Show UI Key-Config", "");
- prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
- RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration");
+ prop = RNA_def_property(srna, "active_keyconfig", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "keyconfigstr");
+ RNA_def_property_ui_text(prop, "Key Config", "The name of the active key configuration");
}
static void rna_def_userdef_filepaths(BlenderRNA *brna)
{
- PropertyRNA *prop;
- StructRNA *srna;
-
- static const EnumPropertyItem anim_player_presets[] = {
- {0, "INTERNAL", 0, "Internal", "Built-in animation player"},
- {2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"},
- {3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"},
- {4, "RV", 0, "rv", "Frame player from Tweak Software"},
- {5, "MPLAYER", 0, "MPlayer", "Media player for video & png/jpeg/sgi image sequences"},
- {50, "CUSTOM", 0, "Custom", "Custom animation player executable path"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "PreferencesFilePaths", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_nested(brna, srna, "Preferences");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "File Paths", "Default paths for external files");
-
- prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT);
- RNA_def_property_ui_text(prop, "Hide Dot Files/Libraries", "Hide files and data-blocks if their name start with a dot (.*)");
-
- prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS);
- RNA_def_property_ui_text(prop, "Filter File Extensions",
- "Display only files with extensions in the image select window");
-
- prop = RNA_def_property(srna, "hide_recent_locations", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_RECENT);
- RNA_def_property_ui_text(prop, "Hide Recent Locations", "Hide recent locations in the file selector");
-
- prop = RNA_def_property(srna, "hide_system_bookmarks", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_SYSTEM_BOOKMARKS);
- RNA_def_property_ui_text(prop, "Hide System Bookmarks", "Hide system bookmarks in the file selector");
-
- prop = RNA_def_property(srna, "show_thumbnails", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_THUMBNAILS);
- RNA_def_property_ui_text(prop, "Show Thumbnails", "Open in thumbnail view for images and movies");
-
- prop = RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELPATHS);
- RNA_def_property_ui_text(prop, "Relative Paths", "Default relative path option for the file selector");
-
- prop = RNA_def_property(srna, "use_file_compression", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
- RNA_def_property_ui_text(prop, "Compress File", "Enable file compression when saving .blend files");
-
- prop = RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_FILENOUI);
- RNA_def_property_ui_text(prop, "Load UI", "Load user interface setup when loading .blend files");
- RNA_def_property_update(prop, 0, "rna_userdef_load_ui_update");
-
-
- prop = RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE);
- RNA_def_property_ui_text(prop, "Auto Run Python Scripts",
- "Allow any .blend file to run scripts automatically "
- "(unsafe with blend files from an untrusted source)");
- RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
-
- prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
- RNA_def_property_ui_text(prop, "Tabs as Spaces",
- "Automatically convert all new tabs into spaces for new and loaded text files");
-
- /* Directories */
-
- prop = RNA_def_property(srna, "font_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "fontdir");
- RNA_def_property_ui_text(prop, "Fonts Directory", "The default directory to search for loading fonts");
-
- prop = RNA_def_property(srna, "texture_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "textudir");
- RNA_def_property_ui_text(prop, "Textures Directory", "The default directory to search for textures");
-
- prop = RNA_def_property(srna, "render_output_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "renderdir");
- RNA_def_property_ui_text(prop, "Render Output Directory",
- "The default directory for rendering output, for new scenes");
-
- prop = RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "pythondir");
- RNA_def_property_ui_text(prop, "Python Scripts Directory",
- "Alternate script path, matching the default layout with subdirs: "
- "startup, add-ons & modules (requires restart)");
- /* TODO, editing should reset sys.path! */
-
- prop = RNA_def_property(srna, "i18n_branches_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "i18ndir");
- RNA_def_property_ui_text(prop, "Translation Branches Directory",
- "The path to the '/branches' directory of your local svn-translation copy, "
- "to allow translating from the UI");
-
- prop = RNA_def_property(srna, "sound_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "sounddir");
- RNA_def_property_ui_text(prop, "Sounds Directory", "The default directory to search for sounds");
-
- prop = RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "tempdir");
- RNA_def_property_ui_text(prop, "Temporary Directory", "The directory for storing temporary save files");
- RNA_def_property_update(prop, 0, "rna_userdef_temp_update");
-
- prop = RNA_def_property(srna, "render_cache_directory", PROP_STRING, PROP_DIRPATH);
- RNA_def_property_string_sdna(prop, NULL, "render_cachedir");
- RNA_def_property_ui_text(prop, "Render Cache Path", "Where to cache raw render results");
-
- prop = RNA_def_property(srna, "image_editor", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "image_editor");
- RNA_def_property_ui_text(prop, "Image Editor", "Path to an image editor");
-
- prop = RNA_def_property(srna, "animation_player", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "anim_player");
- RNA_def_property_ui_text(prop, "Animation Player", "Path to a custom animation/frame sequence player");
-
- prop = RNA_def_property(srna, "animation_player_preset", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "anim_player_preset");
- RNA_def_property_enum_items(prop, anim_player_presets);
- RNA_def_property_ui_text(prop, "Animation Player Preset", "Preset configs for external animation players");
-
- /* Autosave */
-
- prop = RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "versions");
- RNA_def_property_range(prop, 0, 32);
- RNA_def_property_ui_text(prop, "Save Versions",
- "The number of old versions to maintain in the current directory, when manually saving");
-
- prop = RNA_def_property(srna, "use_auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE);
- RNA_def_property_ui_text(prop, "Auto Save Temporary Files",
- "Automatic saving of temporary files in temp directory, uses process ID (Sculpt or edit mode data won't be saved!')");
- RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
-
- prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "savetime");
- RNA_def_property_range(prop, 1, 60);
- RNA_def_property_ui_text(prop, "Auto Save Time",
- "The time (in minutes) to wait between automatic temporary saves");
- RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
-
- prop = RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
- RNA_def_property_range(prop, 0, 30);
- RNA_def_property_ui_text(prop, "Recent Files", "Maximum number of recently opened files to remember");
-
- prop = RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS);
- RNA_def_property_ui_text(prop, "Save Preview Images",
- "Enables automatic saving of preview images in the .blend file");
+ PropertyRNA *prop;
+ StructRNA *srna;
+
+ static const EnumPropertyItem anim_player_presets[] = {
+ {0, "INTERNAL", 0, "Internal", "Built-in animation player"},
+ {2, "DJV", 0, "Djv", "Open source frame player: http://djv.sourceforge.net"},
+ {3, "FRAMECYCLER", 0, "FrameCycler", "Frame player from IRIDAS"},
+ {4, "RV", 0, "rv", "Frame player from Tweak Software"},
+ {5, "MPLAYER", 0, "MPlayer", "Media player for video & png/jpeg/sgi image sequences"},
+ {50, "CUSTOM", 0, "Custom", "Custom animation player executable path"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "PreferencesFilePaths", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_nested(brna, srna, "Preferences");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "File Paths", "Default paths for external files");
+
+ prop = RNA_def_property(srna, "show_hidden_files_datablocks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_DOT);
+ RNA_def_property_ui_text(prop,
+ "Hide Dot Files/Libraries",
+ "Hide files and data-blocks if their name start with a dot (.*)");
+
+ prop = RNA_def_property(srna, "use_filter_files", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_FILTERFILEEXTS);
+ RNA_def_property_ui_text(prop,
+ "Filter File Extensions",
+ "Display only files with extensions in the image select window");
+
+ prop = RNA_def_property(srna, "hide_recent_locations", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_RECENT);
+ RNA_def_property_ui_text(
+ prop, "Hide Recent Locations", "Hide recent locations in the file selector");
+
+ prop = RNA_def_property(srna, "hide_system_bookmarks", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_HIDE_SYSTEM_BOOKMARKS);
+ RNA_def_property_ui_text(
+ prop, "Hide System Bookmarks", "Hide system bookmarks in the file selector");
+
+ prop = RNA_def_property(srna, "show_thumbnails", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_SHOW_THUMBNAILS);
+ RNA_def_property_ui_text(
+ prop, "Show Thumbnails", "Open in thumbnail view for images and movies");
+
+ prop = RNA_def_property(srna, "use_relative_paths", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_RELPATHS);
+ RNA_def_property_ui_text(
+ prop, "Relative Paths", "Default relative path option for the file selector");
+
+ prop = RNA_def_property(srna, "use_file_compression", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FILECOMPRESS);
+ RNA_def_property_ui_text(
+ prop, "Compress File", "Enable file compression when saving .blend files");
+
+ prop = RNA_def_property(srna, "use_load_ui", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_FILENOUI);
+ RNA_def_property_ui_text(prop, "Load UI", "Load user interface setup when loading .blend files");
+ RNA_def_property_update(prop, 0, "rna_userdef_load_ui_update");
+
+ prop = RNA_def_property(srna, "use_scripts_auto_execute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_SCRIPT_AUTOEXEC_DISABLE);
+ RNA_def_property_ui_text(prop,
+ "Auto Run Python Scripts",
+ "Allow any .blend file to run scripts automatically "
+ "(unsafe with blend files from an untrusted source)");
+ RNA_def_property_update(prop, 0, "rna_userdef_script_autoexec_update");
+
+ prop = RNA_def_property(srna, "use_tabs_as_spaces", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", USER_TXT_TABSTOSPACES_DISABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Tabs as Spaces",
+ "Automatically convert all new tabs into spaces for new and loaded text files");
+
+ /* Directories */
+
+ prop = RNA_def_property(srna, "font_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "fontdir");
+ RNA_def_property_ui_text(
+ prop, "Fonts Directory", "The default directory to search for loading fonts");
+
+ prop = RNA_def_property(srna, "texture_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "textudir");
+ RNA_def_property_ui_text(
+ prop, "Textures Directory", "The default directory to search for textures");
+
+ prop = RNA_def_property(srna, "render_output_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "renderdir");
+ RNA_def_property_ui_text(prop,
+ "Render Output Directory",
+ "The default directory for rendering output, for new scenes");
+
+ prop = RNA_def_property(srna, "script_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "pythondir");
+ RNA_def_property_ui_text(prop,
+ "Python Scripts Directory",
+ "Alternate script path, matching the default layout with subdirs: "
+ "startup, add-ons & modules (requires restart)");
+ /* TODO, editing should reset sys.path! */
+
+ prop = RNA_def_property(srna, "i18n_branches_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "i18ndir");
+ RNA_def_property_ui_text(
+ prop,
+ "Translation Branches Directory",
+ "The path to the '/branches' directory of your local svn-translation copy, "
+ "to allow translating from the UI");
+
+ prop = RNA_def_property(srna, "sound_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "sounddir");
+ RNA_def_property_ui_text(prop, "Sounds Directory", "The default directory to search for sounds");
+
+ prop = RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "tempdir");
+ RNA_def_property_ui_text(
+ prop, "Temporary Directory", "The directory for storing temporary save files");
+ RNA_def_property_update(prop, 0, "rna_userdef_temp_update");
+
+ prop = RNA_def_property(srna, "render_cache_directory", PROP_STRING, PROP_DIRPATH);
+ RNA_def_property_string_sdna(prop, NULL, "render_cachedir");
+ RNA_def_property_ui_text(prop, "Render Cache Path", "Where to cache raw render results");
+
+ prop = RNA_def_property(srna, "image_editor", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "image_editor");
+ RNA_def_property_ui_text(prop, "Image Editor", "Path to an image editor");
+
+ prop = RNA_def_property(srna, "animation_player", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "anim_player");
+ RNA_def_property_ui_text(
+ prop, "Animation Player", "Path to a custom animation/frame sequence player");
+
+ prop = RNA_def_property(srna, "animation_player_preset", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "anim_player_preset");
+ RNA_def_property_enum_items(prop, anim_player_presets);
+ RNA_def_property_ui_text(
+ prop, "Animation Player Preset", "Preset configs for external animation players");
+
+ /* Autosave */
+
+ prop = RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "versions");
+ RNA_def_property_range(prop, 0, 32);
+ RNA_def_property_ui_text(
+ prop,
+ "Save Versions",
+ "The number of old versions to maintain in the current directory, when manually saving");
+
+ prop = RNA_def_property(srna, "use_auto_save_temporary_files", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_AUTOSAVE);
+ RNA_def_property_ui_text(prop,
+ "Auto Save Temporary Files",
+ "Automatic saving of temporary files in temp directory, uses process "
+ "ID (Sculpt or edit mode data won't be saved!')");
+ RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
+
+ prop = RNA_def_property(srna, "auto_save_time", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "savetime");
+ RNA_def_property_range(prop, 1, 60);
+ RNA_def_property_ui_text(
+ prop, "Auto Save Time", "The time (in minutes) to wait between automatic temporary saves");
+ RNA_def_property_update(prop, 0, "rna_userdef_autosave_update");
+
+ prop = RNA_def_property(srna, "recent_files", PROP_INT, PROP_NONE);
+ RNA_def_property_range(prop, 0, 30);
+ RNA_def_property_ui_text(
+ prop, "Recent Files", "Maximum number of recently opened files to remember");
+
+ prop = RNA_def_property(srna, "use_save_preview_images", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_SAVE_PREVIEWS);
+ RNA_def_property_ui_text(prop,
+ "Save Preview Images",
+ "Enables automatic saving of preview images in the .blend file");
}
static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "Addons");
- srna = RNA_def_struct(brna, "Addons", NULL);
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "User Add-ons", "Collection of add-ons");
+ RNA_def_property_srna(cprop, "Addons");
+ srna = RNA_def_struct(brna, "Addons", NULL);
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "User Add-ons", "Collection of add-ons");
- func = RNA_def_function(srna, "new", "rna_userdef_addon_new");
- RNA_def_function_flag(func, FUNC_NO_SELF);
- RNA_def_function_ui_description(func, "Add a new add-on");
- /* return type */
- parm = RNA_def_pointer(func, "addon", "Addon", "", "Add-on data");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_userdef_addon_new");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ RNA_def_function_ui_description(func, "Add a new add-on");
+ /* return type */
+ parm = RNA_def_pointer(func, "addon", "Addon", "", "Add-on data");
+ RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "remove", "rna_userdef_addon_remove");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove add-on");
- parm = RNA_def_pointer(func, "addon", "Addon", "", "Add-on to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ func = RNA_def_function(srna, "remove", "rna_userdef_addon_remove");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove add-on");
+ parm = RNA_def_pointer(func, "addon", "Addon", "", "Add-on to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
static void rna_def_userdef_autoexec_path_collection(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- RNA_def_property_srna(cprop, "PathCompareCollection");
- srna = RNA_def_struct(brna, "PathCompareCollection", NULL);
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Paths Compare", "Collection of paths");
+ RNA_def_property_srna(cprop, "PathCompareCollection");
+ srna = RNA_def_struct(brna, "PathCompareCollection", NULL);
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Paths Compare", "Collection of paths");
- func = RNA_def_function(srna, "new", "rna_userdef_pathcompare_new");
- RNA_def_function_flag(func, FUNC_NO_SELF);
- RNA_def_function_ui_description(func, "Add a new path");
- /* return type */
- parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "new", "rna_userdef_pathcompare_new");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ RNA_def_function_ui_description(func, "Add a new path");
+ /* return type */
+ parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
+ RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "remove", "rna_userdef_pathcompare_remove");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove path");
- parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+ func = RNA_def_function(srna, "remove", "rna_userdef_pathcompare_remove");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove path");
+ parm = RNA_def_pointer(func, "pathcmp", "PathCompare", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
}
void RNA_def_userdef(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem preference_section_items[] = {
- {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
- {USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
- {USER_SECTION_VIEWPORT, "VIEWPORT", 0, "Viewport", ""},
- {USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
- {USER_SECTION_EDITING, "EDITING", 0, "Editing", ""},
- {USER_SECTION_ANIMATION, "ANIMATION", 0, "Animation", ""},
- {0, "", 0, NULL, NULL},
- {USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
-#if 0 //def WITH_USERDEF_WORKSPACES
- {0, "", 0, NULL, NULL},
- {USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Configuration File", ""},
- {USER_SECTION_WORKSPACE_ADDONS, "WORKSPACE_ADDONS", 0, "Add-on Overrides", ""},
- {USER_SECTION_WORKSPACE_KEYMAPS, "WORKSPACE_KEYMAPS", 0, "Keymap Overrides", ""},
-#endif
- {0, "", 0, NULL, NULL},
- {USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
- {USER_SECTION_NAVIGATION, "NAVIGATION", 0, "Navigation", ""},
- {USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
- {0, "", 0, NULL, NULL},
- {USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
- {USER_SECTION_SAVE_LOAD, "SAVE_LOAD", 0, "Save & Load", ""},
- {USER_SECTION_FILE_PATHS, "FILE_PATHS", 0, "File Paths", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- rna_def_userdef_dothemes(brna);
- rna_def_userdef_solidlight(brna);
- rna_def_userdef_walk_navigation(brna);
-
- srna = RNA_def_struct(brna, "Preferences", NULL);
- RNA_def_struct_sdna(srna, "UserDef");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Preferences", "Global preferences");
-
- prop = RNA_def_property(srna, "active_section", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "userpref");
- RNA_def_property_enum_items(prop, preference_section_items);
- RNA_def_property_ui_text(prop, "Active Section",
- "Active section of the preferences shown in the user interface");
- RNA_def_property_update(prop, 0, "rna_userdef_update");
-
- /* don't expose this directly via the UI, modify via an operator */
- prop = RNA_def_property(srna, "app_template", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "app_template");
- RNA_def_property_ui_text(prop, "Application Template", "");
-
- prop = RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "themes", NULL);
- RNA_def_property_struct_type(prop, "Theme");
- RNA_def_property_ui_text(prop, "Themes", "");
-
- prop = RNA_def_property(srna, "ui_styles", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "uistyles", NULL);
- RNA_def_property_struct_type(prop, "ThemeStyle");
- RNA_def_property_ui_text(prop, "Styles", "");
-
- prop = RNA_def_property(srna, "addons", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "addons", NULL);
- RNA_def_property_struct_type(prop, "Addon");
- RNA_def_property_ui_text(prop, "Add-on", "");
- rna_def_userdef_addon_collection(brna, prop);
-
- prop = RNA_def_property(srna, "autoexec_paths", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "autoexec_paths", NULL);
- RNA_def_property_struct_type(prop, "PathCompare");
- RNA_def_property_ui_text(prop, "Autoexec Paths", "");
- rna_def_userdef_autoexec_path_collection(brna, prop);
-
- /* nested structs */
- prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PreferencesView");
- RNA_def_property_pointer_funcs(prop, "rna_UserDef_view_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "View & Controls", "Preferences related to viewing data");
-
- prop = RNA_def_property(srna, "edit", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PreferencesEdit");
- RNA_def_property_pointer_funcs(prop, "rna_UserDef_edit_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data");
-
- prop = RNA_def_property(srna, "inputs", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PreferencesInput");
- RNA_def_property_pointer_funcs(prop, "rna_UserDef_input_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Inputs", "Settings for input devices");
-
- prop = RNA_def_property(srna, "keymap", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PreferencesKeymap");
- RNA_def_property_pointer_funcs(prop, "rna_UserDef_keymap_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Keymap", "Shortcut setup for keyboards and other input devices");
-
- prop = RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PreferencesFilePaths");
- RNA_def_property_pointer_funcs(prop, "rna_UserDef_filepaths_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "File Paths", "Default paths for external files");
-
- prop = RNA_def_property(srna, "system", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "PreferencesSystem");
- RNA_def_property_pointer_funcs(prop, "rna_UserDef_system_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "System & OpenGL", "Graphics driver and operating system settings");
-
- prop = RNA_def_int_vector(srna, "version", 3, NULL, 0, INT_MAX,
- "Version", "Version of Blender the userpref.blend was saved with", 0, INT_MAX);
- RNA_def_property_int_funcs(prop, "rna_userdef_version_get", NULL, NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_flag(prop, PROP_THICK_WRAP);
-
- /* StudioLight Collection */
- prop = RNA_def_property(srna, "studio_lights", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "StudioLight");
- RNA_def_property_srna(prop, "StudioLights");
- RNA_def_property_collection_funcs(
- prop, "rna_UserDef_studiolight_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Studio Lights", "");
-
- rna_def_userdef_view(brna);
- rna_def_userdef_edit(brna);
- rna_def_userdef_input(brna);
- rna_def_userdef_keymap(brna);
- rna_def_userdef_filepaths(brna);
- rna_def_userdef_system(brna);
- rna_def_userdef_addon(brna);
- rna_def_userdef_addon_pref(brna);
- rna_def_userdef_studiolights(brna);
- rna_def_userdef_studiolight(brna);
- rna_def_userdef_pathcompare(brna);
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem preference_section_items[] = {
+ {USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
+ {USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
+ {USER_SECTION_VIEWPORT, "VIEWPORT", 0, "Viewport", ""},
+ {USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
+ {USER_SECTION_EDITING, "EDITING", 0, "Editing", ""},
+ {USER_SECTION_ANIMATION, "ANIMATION", 0, "Animation", ""},
+ {0, "", 0, NULL, NULL},
+ {USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
+# if 0 //def WITH_USERDEF_WORKSPACES
+ {0, "", 0, NULL, NULL},
+ {USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Configuration File", ""},
+ {USER_SECTION_WORKSPACE_ADDONS, "WORKSPACE_ADDONS", 0, "Add-on Overrides", ""},
+ {USER_SECTION_WORKSPACE_KEYMAPS, "WORKSPACE_KEYMAPS", 0, "Keymap Overrides", ""},
+# endif
+ {0, "", 0, NULL, NULL},
+ {USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
+ {USER_SECTION_NAVIGATION, "NAVIGATION", 0, "Navigation", ""},
+ {USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
+ {0, "", 0, NULL, NULL},
+ {USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
+ {USER_SECTION_SAVE_LOAD, "SAVE_LOAD", 0, "Save & Load", ""},
+ {USER_SECTION_FILE_PATHS, "FILE_PATHS", 0, "File Paths", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ rna_def_userdef_dothemes(brna);
+ rna_def_userdef_solidlight(brna);
+ rna_def_userdef_walk_navigation(brna);
+
+ srna = RNA_def_struct(brna, "Preferences", NULL);
+ RNA_def_struct_sdna(srna, "UserDef");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Preferences", "Global preferences");
+
+ prop = RNA_def_property(srna, "active_section", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "userpref");
+ RNA_def_property_enum_items(prop, preference_section_items);
+ RNA_def_property_ui_text(
+ prop, "Active Section", "Active section of the preferences shown in the user interface");
+ RNA_def_property_update(prop, 0, "rna_userdef_update");
+
+ /* don't expose this directly via the UI, modify via an operator */
+ prop = RNA_def_property(srna, "app_template", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "app_template");
+ RNA_def_property_ui_text(prop, "Application Template", "");
+
+ prop = RNA_def_property(srna, "themes", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "themes", NULL);
+ RNA_def_property_struct_type(prop, "Theme");
+ RNA_def_property_ui_text(prop, "Themes", "");
+
+ prop = RNA_def_property(srna, "ui_styles", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "uistyles", NULL);
+ RNA_def_property_struct_type(prop, "ThemeStyle");
+ RNA_def_property_ui_text(prop, "Styles", "");
+
+ prop = RNA_def_property(srna, "addons", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "addons", NULL);
+ RNA_def_property_struct_type(prop, "Addon");
+ RNA_def_property_ui_text(prop, "Add-on", "");
+ rna_def_userdef_addon_collection(brna, prop);
+
+ prop = RNA_def_property(srna, "autoexec_paths", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "autoexec_paths", NULL);
+ RNA_def_property_struct_type(prop, "PathCompare");
+ RNA_def_property_ui_text(prop, "Autoexec Paths", "");
+ rna_def_userdef_autoexec_path_collection(brna, prop);
+
+ /* nested structs */
+ prop = RNA_def_property(srna, "view", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PreferencesView");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_view_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "View & Controls", "Preferences related to viewing data");
+
+ prop = RNA_def_property(srna, "edit", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PreferencesEdit");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_edit_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Edit Methods", "Settings for interacting with Blender data");
+
+ prop = RNA_def_property(srna, "inputs", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PreferencesInput");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_input_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Inputs", "Settings for input devices");
+
+ prop = RNA_def_property(srna, "keymap", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PreferencesKeymap");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_keymap_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Keymap", "Shortcut setup for keyboards and other input devices");
+
+ prop = RNA_def_property(srna, "filepaths", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PreferencesFilePaths");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_filepaths_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "File Paths", "Default paths for external files");
+
+ prop = RNA_def_property(srna, "system", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "PreferencesSystem");
+ RNA_def_property_pointer_funcs(prop, "rna_UserDef_system_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "System & OpenGL", "Graphics driver and operating system settings");
+
+ prop = RNA_def_int_vector(srna,
+ "version",
+ 3,
+ NULL,
+ 0,
+ INT_MAX,
+ "Version",
+ "Version of Blender the userpref.blend was saved with",
+ 0,
+ INT_MAX);
+ RNA_def_property_int_funcs(prop, "rna_userdef_version_get", NULL, NULL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_flag(prop, PROP_THICK_WRAP);
+
+ /* StudioLight Collection */
+ prop = RNA_def_property(srna, "studio_lights", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "StudioLight");
+ RNA_def_property_srna(prop, "StudioLights");
+ RNA_def_property_collection_funcs(prop,
+ "rna_UserDef_studiolight_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Studio Lights", "");
+
+ rna_def_userdef_view(brna);
+ rna_def_userdef_edit(brna);
+ rna_def_userdef_input(brna);
+ rna_def_userdef_keymap(brna);
+ rna_def_userdef_filepaths(brna);
+ rna_def_userdef_system(brna);
+ rna_def_userdef_addon(brna);
+ rna_def_userdef_addon_pref(brna);
+ rna_def_userdef_studiolights(brna);
+ rna_def_userdef_studiolight(brna);
+ rna_def_userdef_pathcompare(brna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_vfont.c b/source/blender/makesrna/intern/rna_vfont.c
index f8b62711c5f..cf61fe07c68 100644
--- a/source/blender/makesrna/intern/rna_vfont.c
+++ b/source/blender/makesrna/intern/rna_vfont.c
@@ -28,59 +28,60 @@
#include "WM_types.h"
-
#ifdef RNA_RUNTIME
-#include "BKE_font.h"
-#include "DNA_object_types.h"
+# include "BKE_font.h"
+# include "DNA_object_types.h"
-#include "DEG_depsgraph.h"
+# include "DEG_depsgraph.h"
-#include "WM_api.h"
+# include "WM_api.h"
/* matching fnction in rna_ID.c */
static int rna_VectorFont_filepath_editable(PointerRNA *ptr, const char **UNUSED(r_info))
{
- VFont *vfont = ptr->id.data;
- if (BKE_vfont_is_builtin(vfont)) {
- return 0;
- }
- return PROP_EDITABLE;
+ VFont *vfont = ptr->id.data;
+ if (BKE_vfont_is_builtin(vfont)) {
+ return 0;
+ }
+ return PROP_EDITABLE;
}
-static void rna_VectorFont_reload_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
+static void rna_VectorFont_reload_update(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *ptr)
{
- VFont *vf = ptr->id.data;
- BKE_vfont_free_data(vf);
+ VFont *vf = ptr->id.data;
+ BKE_vfont_free_data(vf);
- /* update */
- WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
- DEG_id_tag_update(&vf->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
+ /* update */
+ WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
+ DEG_id_tag_update(&vf->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY);
}
#else
void RNA_def_vfont(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "VectorFont", "ID");
- RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
- RNA_def_struct_sdna(srna, "VFont");
- RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
+ srna = RNA_def_struct(brna, "VectorFont", "ID");
+ RNA_def_struct_ui_text(srna, "Vector Font", "Vector font for Text objects");
+ RNA_def_struct_sdna(srna, "VFont");
+ RNA_def_struct_ui_icon(srna, ICON_FILE_FONT);
- prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
- RNA_def_property_string_sdna(prop, NULL, "name");
- RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
- RNA_def_property_ui_text(prop, "File Path", "");
- RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
+ prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH);
+ RNA_def_property_string_sdna(prop, NULL, "name");
+ RNA_def_property_editable_func(prop, "rna_VectorFont_filepath_editable");
+ RNA_def_property_ui_text(prop, "File Path", "");
+ RNA_def_property_update(prop, NC_GEOM | ND_DATA, "rna_VectorFont_reload_update");
- prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
- RNA_def_property_ui_text(prop, "Packed File", "");
+ prop = RNA_def_property(srna, "packed_file", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "packedfile");
+ RNA_def_property_ui_text(prop, "Packed File", "");
- RNA_api_vfont(srna);
+ RNA_api_vfont(srna);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_vfont_api.c b/source/blender/makesrna/intern/rna_vfont_api.c
index a6e043c090f..f35a764b1b0 100644
--- a/source/blender/makesrna/intern/rna_vfont_api.c
+++ b/source/blender/makesrna/intern/rna_vfont_api.c
@@ -30,38 +30,39 @@
#ifdef RNA_RUNTIME
-#include "BKE_packedFile.h"
+# include "BKE_packedFile.h"
static void rna_VectorFont_pack(VFont *vfont, Main *bmain, ReportList *reports)
{
- vfont->packedfile = newPackedFile(reports, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
+ vfont->packedfile = newPackedFile(reports, vfont->name, ID_BLEND_PATH(bmain, &vfont->id));
}
static void rna_VectorFont_unpack(VFont *vfont, Main *bmain, ReportList *reports, int method)
{
- if (!vfont->packedfile) {
- BKE_report(reports, RPT_ERROR, "Font not packed");
- }
- else {
- /* reports its own error on failure */
- unpackVFont(bmain, reports, vfont, method);
- }
+ if (!vfont->packedfile) {
+ BKE_report(reports, RPT_ERROR, "Font not packed");
+ }
+ else {
+ /* reports its own error on failure */
+ unpackVFont(bmain, reports, vfont, method);
+ }
}
#else
void RNA_api_vfont(StructRNA *srna)
{
- FunctionRNA *func;
+ FunctionRNA *func;
- func = RNA_def_function(srna, "pack", "rna_VectorFont_pack");
- RNA_def_function_ui_description(func, "Pack the font into the current blend file");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ func = RNA_def_function(srna, "pack", "rna_VectorFont_pack");
+ RNA_def_function_ui_description(func, "Pack the font into the current blend file");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- func = RNA_def_function(srna, "unpack", "rna_VectorFont_unpack");
- RNA_def_function_ui_description(func, "Unpack the font to the samples filename");
- RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
- RNA_def_enum(func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
+ func = RNA_def_function(srna, "unpack", "rna_VectorFont_unpack");
+ RNA_def_function_ui_description(func, "Unpack the font to the samples filename");
+ RNA_def_function_flag(func, FUNC_USE_MAIN | FUNC_USE_REPORTS);
+ RNA_def_enum(
+ func, "method", rna_enum_unpack_method_items, PF_USE_LOCAL, "method", "How to unpack");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c
index d94349d50de..550f90d7e7d 100644
--- a/source/blender/makesrna/intern/rna_wm.c
+++ b/source/blender/makesrna/intern/rna_wm.c
@@ -43,962 +43,998 @@
#ifdef RNA_RUNTIME
static const EnumPropertyItem event_keymouse_value_items[] = {
- {KM_ANY, "ANY", 0, "Any", ""},
- {KM_PRESS, "PRESS", 0, "Press", ""},
- {KM_RELEASE, "RELEASE", 0, "Release", ""},
- {KM_CLICK, "CLICK", 0, "Click", ""},
- {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
- {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
- {0, NULL, 0, NULL, NULL},
+ {KM_ANY, "ANY", 0, "Any", ""},
+ {KM_PRESS, "PRESS", 0, "Press", ""},
+ {KM_RELEASE, "RELEASE", 0, "Release", ""},
+ {KM_CLICK, "CLICK", 0, "Click", ""},
+ {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
+ {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_tweak_value_items[] = {
- {KM_ANY, "ANY", 0, "Any", ""},
- {EVT_GESTURE_N, "NORTH", 0, "North", ""},
- {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
- {EVT_GESTURE_E, "EAST", 0, "East", ""},
- {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
- {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
- {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
- {EVT_GESTURE_W, "WEST", 0, "West", ""},
- {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
- {0, NULL, 0, NULL, NULL},
+ {KM_ANY, "ANY", 0, "Any", ""},
+ {EVT_GESTURE_N, "NORTH", 0, "North", ""},
+ {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
+ {EVT_GESTURE_E, "EAST", 0, "East", ""},
+ {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
+ {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
+ {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
+ {EVT_GESTURE_W, "WEST", 0, "West", ""},
+ {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_tweak_type_items[] = {
- {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
- {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
- {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
- {0, NULL, 0, NULL, NULL},
+ {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Left", ""},
+ {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Middle", ""},
+ {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Right", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_mouse_type_items[] = {
- {LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
- {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
- {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
- {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
- {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
- {BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6", ""},
- {BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7", ""},
- {0, "", 0, NULL, NULL},
- {TABLET_STYLUS, "PEN", 0, "Pen", ""},
- {TABLET_ERASER, "ERASER", 0, "Eraser", ""},
- {0, "", 0, NULL, NULL},
- {MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
- {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""},
- {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""},
- {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""},
- {0, "", 0, NULL, NULL},
- {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
- {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
- {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
- {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
- {0, NULL, 0, NULL, NULL},
+ {LEFTMOUSE, "LEFTMOUSE", 0, "Left", ""},
+ {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle", ""},
+ {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right", ""},
+ {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4", ""},
+ {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5", ""},
+ {BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6", ""},
+ {BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7", ""},
+ {0, "", 0, NULL, NULL},
+ {TABLET_STYLUS, "PEN", 0, "Pen", ""},
+ {TABLET_ERASER, "ERASER", 0, "Eraser", ""},
+ {0, "", 0, NULL, NULL},
+ {MOUSEMOVE, "MOUSEMOVE", 0, "Move", ""},
+ {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", ""},
+ {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", ""},
+ {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", ""},
+ {0, "", 0, NULL, NULL},
+ {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", ""},
+ {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", ""},
+ {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", ""},
+ {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_timer_type_items[] = {
- {TIMER, "TIMER", 0, "Timer", ""},
- {TIMER0, "TIMER0", 0, "Timer 0", ""},
- {TIMER1, "TIMER1", 0, "Timer 1", ""},
- {TIMER2, "TIMER2", 0, "Timer 2", ""},
- {TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", ""},
- {TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", ""},
- {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", ""},
- {TIMERREGION, "TIMERREGION", 0, "Timer Region", ""},
- {0, NULL, 0, NULL, NULL},
+ {TIMER, "TIMER", 0, "Timer", ""},
+ {TIMER0, "TIMER0", 0, "Timer 0", ""},
+ {TIMER1, "TIMER1", 0, "Timer 1", ""},
+ {TIMER2, "TIMER2", 0, "Timer 2", ""},
+ {TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", ""},
+ {TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", ""},
+ {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", ""},
+ {TIMERREGION, "TIMERREGION", 0, "Timer Region", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_textinput_type_items[] = {
- {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
- {0, NULL, 0, NULL, NULL},
+ {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
+ {0, NULL, 0, NULL, NULL},
};
static const EnumPropertyItem event_ndof_type_items[] = {
- {NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""},
- /* buttons on all 3dconnexion devices */
- {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
- {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
- /* view buttons */
- {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""},
- {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""},
- {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""},
- {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""},
- {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""},
- {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""},
- /* more views */
- {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "Isometric 1", ""},
- {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "Isometric 2", ""},
- /* 90 degree rotations */
- {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""},
- {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""},
- {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""},
- {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""},
- {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""},
- {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""},
- /* device control */
- {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""},
- {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""},
- {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""},
- {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""},
- {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""},
- /* keyboard emulation */
- {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"},
- {NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "Alt"},
- {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "Shift"},
- {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "Ctrl"},
- /* general-purpose buttons */
- {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""},
- {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""},
- {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""},
- {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""},
- {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""},
- {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""},
- {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""},
- {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""},
- {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""},
- {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""},
- {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
- {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
- {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
- {0, NULL, 0, NULL, NULL},
+ {NDOF_MOTION, "NDOF_MOTION", 0, "Motion", ""},
+ /* buttons on all 3dconnexion devices */
+ {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "Menu", ""},
+ {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "Fit", ""},
+ /* view buttons */
+ {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "Top", ""},
+ {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "Bottom", ""},
+ {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "Left", ""},
+ {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "Right", ""},
+ {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "Front", ""},
+ {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "Back", ""},
+ /* more views */
+ {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "Isometric 1", ""},
+ {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "Isometric 2", ""},
+ /* 90 degree rotations */
+ {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "Roll CW", ""},
+ {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "Roll CCW", ""},
+ {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "Spin CW", ""},
+ {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "Spin CCW", ""},
+ {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "Tilt CW", ""},
+ {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "Tilt CCW", ""},
+ /* device control */
+ {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "Rotate", ""},
+ {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "Pan/Zoom", ""},
+ {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "Dominant", ""},
+ {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "Plus", ""},
+ {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "Minus", ""},
+ /* keyboard emulation */
+ {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "Esc"},
+ {NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "Alt"},
+ {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "Shift"},
+ {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "Ctrl"},
+ /* general-purpose buttons */
+ {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "Button 1", ""},
+ {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "Button 2", ""},
+ {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "Button 3", ""},
+ {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "Button 4", ""},
+ {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "Button 5", ""},
+ {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "Button 6", ""},
+ {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "Button 7", ""},
+ {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "Button 8", ""},
+ {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "Button 9", ""},
+ {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "Button 10", ""},
+ {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "Button A", ""},
+ {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "Button B", ""},
+ {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "Button C", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif /* RNA_RUNTIME */
/* not returned: CAPSLOCKKEY, UNKNOWNKEY */
const EnumPropertyItem rna_enum_event_type_items[] = {
- /* Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. */
- {0, "NONE", 0, "", ""},
- {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", "LMB"},
- {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", "MMB"},
- {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", "RMB"},
- {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4 Mouse", "MB4"},
- {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", "MB5"},
- {BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6 Mouse", "MB6"},
- {BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7 Mouse", "MB7"},
- {0, "", 0, NULL, NULL},
- {TABLET_STYLUS, "PEN", 0, "Pen", ""},
- {TABLET_ERASER, "ERASER", 0, "Eraser", ""},
- {0, "", 0, NULL, NULL},
- {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", "MsMov"},
- {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", "MsSubMov"},
- {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", "MsPan"},
- {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", "MsZoom"},
- {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", "MsRot"},
- {0, "", 0, NULL, NULL},
- {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", "WhUp"},
- {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", "WhDown"},
- {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", "WhIn"},
- {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", "WhOut"},
- {0, "", 0, NULL, NULL},
- {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", "TwkL"},
- {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"},
- {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"},
- {0, "", 0, NULL, NULL},
- {AKEY, "A", 0, "A", ""},
- {BKEY, "B", 0, "B", ""},
- {CKEY, "C", 0, "C", ""},
- {DKEY, "D", 0, "D", ""},
- {EKEY, "E", 0, "E", ""},
- {FKEY, "F", 0, "F", ""},
- {GKEY, "G", 0, "G", ""},
- {HKEY, "H", 0, "H", ""},
- {IKEY, "I", 0, "I", ""},
- {JKEY, "J", 0, "J", ""},
- {KKEY, "K", 0, "K", ""},
- {LKEY, "L", 0, "L", ""},
- {MKEY, "M", 0, "M", ""},
- {NKEY, "N", 0, "N", ""},
- {OKEY, "O", 0, "O", ""},
- {PKEY, "P", 0, "P", ""},
- {QKEY, "Q", 0, "Q", ""},
- {RKEY, "R", 0, "R", ""},
- {SKEY, "S", 0, "S", ""},
- {TKEY, "T", 0, "T", ""},
- {UKEY, "U", 0, "U", ""},
- {VKEY, "V", 0, "V", ""},
- {WKEY, "W", 0, "W", ""},
- {XKEY, "X", 0, "X", ""},
- {YKEY, "Y", 0, "Y", ""},
- {ZKEY, "Z", 0, "Z", ""},
- {0, "", 0, NULL, NULL},
- {ZEROKEY, "ZERO", 0, "0", ""},
- {ONEKEY, "ONE", 0, "1", ""},
- {TWOKEY, "TWO", 0, "2", ""},
- {THREEKEY, "THREE", 0, "3", ""},
- {FOURKEY, "FOUR", 0, "4", ""},
- {FIVEKEY, "FIVE", 0, "5", ""},
- {SIXKEY, "SIX", 0, "6", ""},
- {SEVENKEY, "SEVEN", 0, "7", ""},
- {EIGHTKEY, "EIGHT", 0, "8", ""},
- {NINEKEY, "NINE", 0, "9", ""},
- {0, "", 0, NULL, NULL},
- {LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"},
- {LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"},
- {LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"},
- {RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"},
- {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"},
- {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"},
- {0, "", 0, NULL, NULL},
- {OSKEY, "OSKEY", 0, "OS Key", "Cmd"},
- {GRLESSKEY, "GRLESS", 0, "Grless", ""},
- {ESCKEY, "ESC", 0, "Esc", ""},
- {TABKEY, "TAB", 0, "Tab", ""},
- {RETKEY, "RET", 0, "Return", "Enter"},
- {SPACEKEY, "SPACE", 0, "Spacebar", "Space"},
- {LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""},
- {BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", "BkSpace"},
- {DELKEY, "DEL", 0, "Delete", "Del"},
- {SEMICOLONKEY, "SEMI_COLON", 0, ";", ""},
- {PERIODKEY, "PERIOD", 0, ".", ""},
- {COMMAKEY, "COMMA", 0, ",", ""},
- {QUOTEKEY, "QUOTE", 0, "\"", ""},
- {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
- {MINUSKEY, "MINUS", 0, "-", ""},
- {PLUSKEY, "PLUS", 0, "+", ""},
- {SLASHKEY, "SLASH", 0, "/", ""},
- {BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
- {EQUALKEY, "EQUAL", 0, "=", ""},
- {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""},
- {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""},
- {LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"},
- {DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"},
- {RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"},
- {UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"},
- {PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"},
- {PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"},
- {PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"},
- {PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"},
- {PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"},
- {PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"},
- {PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"},
- {PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"},
- {PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"},
- {PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."},
- {PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"},
- {PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"},
- {PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"},
- {PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"},
- {PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"},
- {PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"},
- {F1KEY, "F1", 0, "F1", ""},
- {F2KEY, "F2", 0, "F2", ""},
- {F3KEY, "F3", 0, "F3", ""},
- {F4KEY, "F4", 0, "F4", ""},
- {F5KEY, "F5", 0, "F5", ""},
- {F6KEY, "F6", 0, "F6", ""},
- {F7KEY, "F7", 0, "F7", ""},
- {F8KEY, "F8", 0, "F8", ""},
- {F9KEY, "F9", 0, "F9", ""},
- {F10KEY, "F10", 0, "F10", ""},
- {F11KEY, "F11", 0, "F11", ""},
- {F12KEY, "F12", 0, "F12", ""},
- {F13KEY, "F13", 0, "F13", ""},
- {F14KEY, "F14", 0, "F14", ""},
- {F15KEY, "F15", 0, "F15", ""},
- {F16KEY, "F16", 0, "F16", ""},
- {F17KEY, "F17", 0, "F17", ""},
- {F18KEY, "F18", 0, "F18", ""},
- {F19KEY, "F19", 0, "F19", ""},
- {PAUSEKEY, "PAUSE", 0, "Pause", ""},
- {INSERTKEY, "INSERT", 0, "Insert", "Ins"},
- {HOMEKEY, "HOME", 0, "Home", ""},
- {PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"},
- {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"},
- {ENDKEY, "END", 0, "End", ""},
- {0, "", 0, NULL, NULL},
- {MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"},
- {MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"},
- {MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"},
- {MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"},
- {0, "", 0, NULL, NULL},
- {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", "TxtIn"},
- {0, "", 0, NULL, NULL},
- {WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""},
- {TIMER, "TIMER", 0, "Timer", "Tmr"},
- {TIMER0, "TIMER0", 0, "Timer 0", "Tmr0"},
- {TIMER1, "TIMER1", 0, "Timer 1", "Tmr1"},
- {TIMER2, "TIMER2", 0, "Timer 2", "Tmr2"},
- {TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", "TmrJob"},
- {TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", "TmrSave"},
- {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", "TmrReport"},
- {TIMERREGION, "TIMERREGION", 0, "Timer Region", "TmrReg"},
- {0, "", 0, NULL, NULL},
- {NDOF_MOTION, "NDOF_MOTION", 0, "NDOF Motion", "NdofMov"},
- /* buttons on all 3dconnexion devices */
- {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "NDOF Menu", "NdofMenu"},
- {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "NDOF Fit", "NdofFit"},
- /* view buttons */
- {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "NDOF Top", "Ndof↑"},
- {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "NDOF Bottom", "Ndof↓"},
- {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "NDOF Left", "Ndof←"},
- {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "NDOF Right", "Ndof→"},
- {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "NDOF Front", "NdofFront"},
- {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "NDOF Back", "NdofBack"},
- /* more views */
- {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF Isometric 1", "NdofIso1"},
- {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF Isometric 2", "NdofIso2"},
- /* 90 degree rotations */
- {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "NDOF Roll CW", "NdofRCW"},
- {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "NDOF Roll CCW", "NdofRCCW"},
- {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "NDOF Spin CW", "NdofSCW"},
- {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "NDOF Spin CCW", "NdofSCCW"},
- {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "NDOF Tilt CW", "NdofTCW"},
- {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "NDOF Tilt CCW", "NdofTCCW"},
- /* device control */
- {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "NDOF Rotate", "NdofRot"},
- {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "NDOF Pan/Zoom", "NdofPanZoom"},
- {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "NDOF Dominant", "NdofDom"},
- {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "NDOF Plus", "Ndof+"},
- {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "NDOF Minus", "Ndof-"},
- /* keyboard emulation */
- {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "NDOF Esc", "NdofEsc"},
- {NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "NDOF Alt", "NdofAlt"},
- {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift", "NdofShift"},
- {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl", "NdofCtrl"},
- /* general-purpose buttons */
- {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", "NdofB1"},
- {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", "NdofB2"},
- {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "NDOF Button 3", "NdofB3"},
- {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "NDOF Button 4", "NdofB4"},
- {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "NDOF Button 5", "NdofB5"},
- {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "NDOF Button 6", "NdofB6"},
- {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "NDOF Button 7", "NdofB7"},
- {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "NDOF Button 8", "NdofB8"},
- {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "NDOF Button 9", "NdofB9"},
- {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "NDOF Button 10", "NdofB10"},
- {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", "NdofBA"},
- {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", "NdofBB"},
- {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", "NdofBC"},
- /* Action Zones. */
- {EVT_ACTIONZONE_AREA, "ACTIONZONE_AREA", 0, "ActionZone Area", "AZone Area"},
- {EVT_ACTIONZONE_REGION, "ACTIONZONE_REGION", 0, "ActionZone Region", "AZone Region"},
- {EVT_ACTIONZONE_FULLSCREEN, "ACTIONZONE_FULLSCREEN", 0, "ActionZone Fullscreen", "AZone FullScr"},
- {0, NULL, 0, NULL, NULL},
+ /* Note we abuse 'tooltip' message here to store a 'compact' form of some (too) long names. */
+ {0, "NONE", 0, "", ""},
+ {LEFTMOUSE, "LEFTMOUSE", 0, "Left Mouse", "LMB"},
+ {MIDDLEMOUSE, "MIDDLEMOUSE", 0, "Middle Mouse", "MMB"},
+ {RIGHTMOUSE, "RIGHTMOUSE", 0, "Right Mouse", "RMB"},
+ {BUTTON4MOUSE, "BUTTON4MOUSE", 0, "Button4 Mouse", "MB4"},
+ {BUTTON5MOUSE, "BUTTON5MOUSE", 0, "Button5 Mouse", "MB5"},
+ {BUTTON6MOUSE, "BUTTON6MOUSE", 0, "Button6 Mouse", "MB6"},
+ {BUTTON7MOUSE, "BUTTON7MOUSE", 0, "Button7 Mouse", "MB7"},
+ {0, "", 0, NULL, NULL},
+ {TABLET_STYLUS, "PEN", 0, "Pen", ""},
+ {TABLET_ERASER, "ERASER", 0, "Eraser", ""},
+ {0, "", 0, NULL, NULL},
+ {MOUSEMOVE, "MOUSEMOVE", 0, "Mouse Move", "MsMov"},
+ {INBETWEEN_MOUSEMOVE, "INBETWEEN_MOUSEMOVE", 0, "In-between Move", "MsSubMov"},
+ {MOUSEPAN, "TRACKPADPAN", 0, "Mouse/Trackpad Pan", "MsPan"},
+ {MOUSEZOOM, "TRACKPADZOOM", 0, "Mouse/Trackpad Zoom", "MsZoom"},
+ {MOUSEROTATE, "MOUSEROTATE", 0, "Mouse/Trackpad Rotate", "MsRot"},
+ {0, "", 0, NULL, NULL},
+ {WHEELUPMOUSE, "WHEELUPMOUSE", 0, "Wheel Up", "WhUp"},
+ {WHEELDOWNMOUSE, "WHEELDOWNMOUSE", 0, "Wheel Down", "WhDown"},
+ {WHEELINMOUSE, "WHEELINMOUSE", 0, "Wheel In", "WhIn"},
+ {WHEELOUTMOUSE, "WHEELOUTMOUSE", 0, "Wheel Out", "WhOut"},
+ {0, "", 0, NULL, NULL},
+ {EVT_TWEAK_L, "EVT_TWEAK_L", 0, "Tweak Left", "TwkL"},
+ {EVT_TWEAK_M, "EVT_TWEAK_M", 0, "Tweak Middle", "TwkM"},
+ {EVT_TWEAK_R, "EVT_TWEAK_R", 0, "Tweak Right", "TwkR"},
+ {0, "", 0, NULL, NULL},
+ {AKEY, "A", 0, "A", ""},
+ {BKEY, "B", 0, "B", ""},
+ {CKEY, "C", 0, "C", ""},
+ {DKEY, "D", 0, "D", ""},
+ {EKEY, "E", 0, "E", ""},
+ {FKEY, "F", 0, "F", ""},
+ {GKEY, "G", 0, "G", ""},
+ {HKEY, "H", 0, "H", ""},
+ {IKEY, "I", 0, "I", ""},
+ {JKEY, "J", 0, "J", ""},
+ {KKEY, "K", 0, "K", ""},
+ {LKEY, "L", 0, "L", ""},
+ {MKEY, "M", 0, "M", ""},
+ {NKEY, "N", 0, "N", ""},
+ {OKEY, "O", 0, "O", ""},
+ {PKEY, "P", 0, "P", ""},
+ {QKEY, "Q", 0, "Q", ""},
+ {RKEY, "R", 0, "R", ""},
+ {SKEY, "S", 0, "S", ""},
+ {TKEY, "T", 0, "T", ""},
+ {UKEY, "U", 0, "U", ""},
+ {VKEY, "V", 0, "V", ""},
+ {WKEY, "W", 0, "W", ""},
+ {XKEY, "X", 0, "X", ""},
+ {YKEY, "Y", 0, "Y", ""},
+ {ZKEY, "Z", 0, "Z", ""},
+ {0, "", 0, NULL, NULL},
+ {ZEROKEY, "ZERO", 0, "0", ""},
+ {ONEKEY, "ONE", 0, "1", ""},
+ {TWOKEY, "TWO", 0, "2", ""},
+ {THREEKEY, "THREE", 0, "3", ""},
+ {FOURKEY, "FOUR", 0, "4", ""},
+ {FIVEKEY, "FIVE", 0, "5", ""},
+ {SIXKEY, "SIX", 0, "6", ""},
+ {SEVENKEY, "SEVEN", 0, "7", ""},
+ {EIGHTKEY, "EIGHT", 0, "8", ""},
+ {NINEKEY, "NINE", 0, "9", ""},
+ {0, "", 0, NULL, NULL},
+ {LEFTCTRLKEY, "LEFT_CTRL", 0, "Left Ctrl", "CtrlL"},
+ {LEFTALTKEY, "LEFT_ALT", 0, "Left Alt", "AltL"},
+ {LEFTSHIFTKEY, "LEFT_SHIFT", 0, "Left Shift", "ShiftL"},
+ {RIGHTALTKEY, "RIGHT_ALT", 0, "Right Alt", "AltR"},
+ {RIGHTCTRLKEY, "RIGHT_CTRL", 0, "Right Ctrl", "CtrlR"},
+ {RIGHTSHIFTKEY, "RIGHT_SHIFT", 0, "Right Shift", "ShiftR"},
+ {0, "", 0, NULL, NULL},
+ {OSKEY, "OSKEY", 0, "OS Key", "Cmd"},
+ {GRLESSKEY, "GRLESS", 0, "Grless", ""},
+ {ESCKEY, "ESC", 0, "Esc", ""},
+ {TABKEY, "TAB", 0, "Tab", ""},
+ {RETKEY, "RET", 0, "Return", "Enter"},
+ {SPACEKEY, "SPACE", 0, "Spacebar", "Space"},
+ {LINEFEEDKEY, "LINE_FEED", 0, "Line Feed", ""},
+ {BACKSPACEKEY, "BACK_SPACE", 0, "Back Space", "BkSpace"},
+ {DELKEY, "DEL", 0, "Delete", "Del"},
+ {SEMICOLONKEY, "SEMI_COLON", 0, ";", ""},
+ {PERIODKEY, "PERIOD", 0, ".", ""},
+ {COMMAKEY, "COMMA", 0, ",", ""},
+ {QUOTEKEY, "QUOTE", 0, "\"", ""},
+ {ACCENTGRAVEKEY, "ACCENT_GRAVE", 0, "`", ""},
+ {MINUSKEY, "MINUS", 0, "-", ""},
+ {PLUSKEY, "PLUS", 0, "+", ""},
+ {SLASHKEY, "SLASH", 0, "/", ""},
+ {BACKSLASHKEY, "BACK_SLASH", 0, "\\", ""},
+ {EQUALKEY, "EQUAL", 0, "=", ""},
+ {LEFTBRACKETKEY, "LEFT_BRACKET", 0, "[", ""},
+ {RIGHTBRACKETKEY, "RIGHT_BRACKET", 0, "]", ""},
+ {LEFTARROWKEY, "LEFT_ARROW", 0, "Left Arrow", "←"},
+ {DOWNARROWKEY, "DOWN_ARROW", 0, "Down Arrow", "↓"},
+ {RIGHTARROWKEY, "RIGHT_ARROW", 0, "Right Arrow", "→"},
+ {UPARROWKEY, "UP_ARROW", 0, "Up Arrow", "↑"},
+ {PAD2, "NUMPAD_2", 0, "Numpad 2", "Pad2"},
+ {PAD4, "NUMPAD_4", 0, "Numpad 4", "Pad4"},
+ {PAD6, "NUMPAD_6", 0, "Numpad 6", "Pad6"},
+ {PAD8, "NUMPAD_8", 0, "Numpad 8", "Pad8"},
+ {PAD1, "NUMPAD_1", 0, "Numpad 1", "Pad1"},
+ {PAD3, "NUMPAD_3", 0, "Numpad 3", "Pad3"},
+ {PAD5, "NUMPAD_5", 0, "Numpad 5", "Pad5"},
+ {PAD7, "NUMPAD_7", 0, "Numpad 7", "Pad7"},
+ {PAD9, "NUMPAD_9", 0, "Numpad 9", "Pad9"},
+ {PADPERIOD, "NUMPAD_PERIOD", 0, "Numpad .", "Pad."},
+ {PADSLASHKEY, "NUMPAD_SLASH", 0, "Numpad /", "Pad/"},
+ {PADASTERKEY, "NUMPAD_ASTERIX", 0, "Numpad *", "Pad*"},
+ {PAD0, "NUMPAD_0", 0, "Numpad 0", "Pad0"},
+ {PADMINUS, "NUMPAD_MINUS", 0, "Numpad -", "Pad-"},
+ {PADENTER, "NUMPAD_ENTER", 0, "Numpad Enter", "PadEnter"},
+ {PADPLUSKEY, "NUMPAD_PLUS", 0, "Numpad +", "Pad+"},
+ {F1KEY, "F1", 0, "F1", ""},
+ {F2KEY, "F2", 0, "F2", ""},
+ {F3KEY, "F3", 0, "F3", ""},
+ {F4KEY, "F4", 0, "F4", ""},
+ {F5KEY, "F5", 0, "F5", ""},
+ {F6KEY, "F6", 0, "F6", ""},
+ {F7KEY, "F7", 0, "F7", ""},
+ {F8KEY, "F8", 0, "F8", ""},
+ {F9KEY, "F9", 0, "F9", ""},
+ {F10KEY, "F10", 0, "F10", ""},
+ {F11KEY, "F11", 0, "F11", ""},
+ {F12KEY, "F12", 0, "F12", ""},
+ {F13KEY, "F13", 0, "F13", ""},
+ {F14KEY, "F14", 0, "F14", ""},
+ {F15KEY, "F15", 0, "F15", ""},
+ {F16KEY, "F16", 0, "F16", ""},
+ {F17KEY, "F17", 0, "F17", ""},
+ {F18KEY, "F18", 0, "F18", ""},
+ {F19KEY, "F19", 0, "F19", ""},
+ {PAUSEKEY, "PAUSE", 0, "Pause", ""},
+ {INSERTKEY, "INSERT", 0, "Insert", "Ins"},
+ {HOMEKEY, "HOME", 0, "Home", ""},
+ {PAGEUPKEY, "PAGE_UP", 0, "Page Up", "PgUp"},
+ {PAGEDOWNKEY, "PAGE_DOWN", 0, "Page Down", "PgDown"},
+ {ENDKEY, "END", 0, "End", ""},
+ {0, "", 0, NULL, NULL},
+ {MEDIAPLAY, "MEDIA_PLAY", 0, "Media Play/Pause", ">/||"},
+ {MEDIASTOP, "MEDIA_STOP", 0, "Media Stop", "Stop"},
+ {MEDIAFIRST, "MEDIA_FIRST", 0, "Media First", "|<<"},
+ {MEDIALAST, "MEDIA_LAST", 0, "Media Last", ">>|"},
+ {0, "", 0, NULL, NULL},
+ {KM_TEXTINPUT, "TEXTINPUT", 0, "Text Input", "TxtIn"},
+ {0, "", 0, NULL, NULL},
+ {WINDEACTIVATE, "WINDOW_DEACTIVATE", 0, "Window Deactivate", ""},
+ {TIMER, "TIMER", 0, "Timer", "Tmr"},
+ {TIMER0, "TIMER0", 0, "Timer 0", "Tmr0"},
+ {TIMER1, "TIMER1", 0, "Timer 1", "Tmr1"},
+ {TIMER2, "TIMER2", 0, "Timer 2", "Tmr2"},
+ {TIMERJOBS, "TIMER_JOBS", 0, "Timer Jobs", "TmrJob"},
+ {TIMERAUTOSAVE, "TIMER_AUTOSAVE", 0, "Timer Autosave", "TmrSave"},
+ {TIMERREPORT, "TIMER_REPORT", 0, "Timer Report", "TmrReport"},
+ {TIMERREGION, "TIMERREGION", 0, "Timer Region", "TmrReg"},
+ {0, "", 0, NULL, NULL},
+ {NDOF_MOTION, "NDOF_MOTION", 0, "NDOF Motion", "NdofMov"},
+ /* buttons on all 3dconnexion devices */
+ {NDOF_BUTTON_MENU, "NDOF_BUTTON_MENU", 0, "NDOF Menu", "NdofMenu"},
+ {NDOF_BUTTON_FIT, "NDOF_BUTTON_FIT", 0, "NDOF Fit", "NdofFit"},
+ /* view buttons */
+ {NDOF_BUTTON_TOP, "NDOF_BUTTON_TOP", 0, "NDOF Top", "Ndof↑"},
+ {NDOF_BUTTON_BOTTOM, "NDOF_BUTTON_BOTTOM", 0, "NDOF Bottom", "Ndof↓"},
+ {NDOF_BUTTON_LEFT, "NDOF_BUTTON_LEFT", 0, "NDOF Left", "Ndof←"},
+ {NDOF_BUTTON_RIGHT, "NDOF_BUTTON_RIGHT", 0, "NDOF Right", "Ndof→"},
+ {NDOF_BUTTON_FRONT, "NDOF_BUTTON_FRONT", 0, "NDOF Front", "NdofFront"},
+ {NDOF_BUTTON_BACK, "NDOF_BUTTON_BACK", 0, "NDOF Back", "NdofBack"},
+ /* more views */
+ {NDOF_BUTTON_ISO1, "NDOF_BUTTON_ISO1", 0, "NDOF Isometric 1", "NdofIso1"},
+ {NDOF_BUTTON_ISO2, "NDOF_BUTTON_ISO2", 0, "NDOF Isometric 2", "NdofIso2"},
+ /* 90 degree rotations */
+ {NDOF_BUTTON_ROLL_CW, "NDOF_BUTTON_ROLL_CW", 0, "NDOF Roll CW", "NdofRCW"},
+ {NDOF_BUTTON_ROLL_CCW, "NDOF_BUTTON_ROLL_CCW", 0, "NDOF Roll CCW", "NdofRCCW"},
+ {NDOF_BUTTON_SPIN_CW, "NDOF_BUTTON_SPIN_CW", 0, "NDOF Spin CW", "NdofSCW"},
+ {NDOF_BUTTON_SPIN_CCW, "NDOF_BUTTON_SPIN_CCW", 0, "NDOF Spin CCW", "NdofSCCW"},
+ {NDOF_BUTTON_TILT_CW, "NDOF_BUTTON_TILT_CW", 0, "NDOF Tilt CW", "NdofTCW"},
+ {NDOF_BUTTON_TILT_CCW, "NDOF_BUTTON_TILT_CCW", 0, "NDOF Tilt CCW", "NdofTCCW"},
+ /* device control */
+ {NDOF_BUTTON_ROTATE, "NDOF_BUTTON_ROTATE", 0, "NDOF Rotate", "NdofRot"},
+ {NDOF_BUTTON_PANZOOM, "NDOF_BUTTON_PANZOOM", 0, "NDOF Pan/Zoom", "NdofPanZoom"},
+ {NDOF_BUTTON_DOMINANT, "NDOF_BUTTON_DOMINANT", 0, "NDOF Dominant", "NdofDom"},
+ {NDOF_BUTTON_PLUS, "NDOF_BUTTON_PLUS", 0, "NDOF Plus", "Ndof+"},
+ {NDOF_BUTTON_MINUS, "NDOF_BUTTON_MINUS", 0, "NDOF Minus", "Ndof-"},
+ /* keyboard emulation */
+ {NDOF_BUTTON_ESC, "NDOF_BUTTON_ESC", 0, "NDOF Esc", "NdofEsc"},
+ {NDOF_BUTTON_ALT, "NDOF_BUTTON_ALT", 0, "NDOF Alt", "NdofAlt"},
+ {NDOF_BUTTON_SHIFT, "NDOF_BUTTON_SHIFT", 0, "NDOF Shift", "NdofShift"},
+ {NDOF_BUTTON_CTRL, "NDOF_BUTTON_CTRL", 0, "NDOF Ctrl", "NdofCtrl"},
+ /* general-purpose buttons */
+ {NDOF_BUTTON_1, "NDOF_BUTTON_1", 0, "NDOF Button 1", "NdofB1"},
+ {NDOF_BUTTON_2, "NDOF_BUTTON_2", 0, "NDOF Button 2", "NdofB2"},
+ {NDOF_BUTTON_3, "NDOF_BUTTON_3", 0, "NDOF Button 3", "NdofB3"},
+ {NDOF_BUTTON_4, "NDOF_BUTTON_4", 0, "NDOF Button 4", "NdofB4"},
+ {NDOF_BUTTON_5, "NDOF_BUTTON_5", 0, "NDOF Button 5", "NdofB5"},
+ {NDOF_BUTTON_6, "NDOF_BUTTON_6", 0, "NDOF Button 6", "NdofB6"},
+ {NDOF_BUTTON_7, "NDOF_BUTTON_7", 0, "NDOF Button 7", "NdofB7"},
+ {NDOF_BUTTON_8, "NDOF_BUTTON_8", 0, "NDOF Button 8", "NdofB8"},
+ {NDOF_BUTTON_9, "NDOF_BUTTON_9", 0, "NDOF Button 9", "NdofB9"},
+ {NDOF_BUTTON_10, "NDOF_BUTTON_10", 0, "NDOF Button 10", "NdofB10"},
+ {NDOF_BUTTON_A, "NDOF_BUTTON_A", 0, "NDOF Button A", "NdofBA"},
+ {NDOF_BUTTON_B, "NDOF_BUTTON_B", 0, "NDOF Button B", "NdofBB"},
+ {NDOF_BUTTON_C, "NDOF_BUTTON_C", 0, "NDOF Button C", "NdofBC"},
+ /* Action Zones. */
+ {EVT_ACTIONZONE_AREA, "ACTIONZONE_AREA", 0, "ActionZone Area", "AZone Area"},
+ {EVT_ACTIONZONE_REGION, "ACTIONZONE_REGION", 0, "ActionZone Region", "AZone Region"},
+ {EVT_ACTIONZONE_FULLSCREEN,
+ "ACTIONZONE_FULLSCREEN",
+ 0,
+ "ActionZone Fullscreen",
+ "AZone FullScr"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_event_value_items[] = {
- {KM_ANY, "ANY", 0, "Any", ""},
- {KM_NOTHING, "NOTHING", 0, "Nothing", ""},
- {KM_PRESS, "PRESS", 0, "Press", ""},
- {KM_RELEASE, "RELEASE", 0, "Release", ""},
- {KM_CLICK, "CLICK", 0, "Click", ""},
- {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
- {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
- {EVT_GESTURE_N, "NORTH", 0, "North", ""},
- {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
- {EVT_GESTURE_E, "EAST", 0, "East", ""},
- {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
- {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
- {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
- {EVT_GESTURE_W, "WEST", 0, "West", ""},
- {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
- {0, NULL, 0, NULL, NULL},
+ {KM_ANY, "ANY", 0, "Any", ""},
+ {KM_NOTHING, "NOTHING", 0, "Nothing", ""},
+ {KM_PRESS, "PRESS", 0, "Press", ""},
+ {KM_RELEASE, "RELEASE", 0, "Release", ""},
+ {KM_CLICK, "CLICK", 0, "Click", ""},
+ {KM_DBL_CLICK, "DOUBLE_CLICK", 0, "Double Click", ""},
+ {KM_CLICK_DRAG, "CLICK_DRAG", 0, "Click Drag", ""},
+ {EVT_GESTURE_N, "NORTH", 0, "North", ""},
+ {EVT_GESTURE_NE, "NORTH_EAST", 0, "North-East", ""},
+ {EVT_GESTURE_E, "EAST", 0, "East", ""},
+ {EVT_GESTURE_SE, "SOUTH_EAST", 0, "South-East", ""},
+ {EVT_GESTURE_S, "SOUTH", 0, "South", ""},
+ {EVT_GESTURE_SW, "SOUTH_WEST", 0, "South-West", ""},
+ {EVT_GESTURE_W, "WEST", 0, "West", ""},
+ {EVT_GESTURE_NW, "NORTH_WEST", 0, "North-West", ""},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_keymap_propvalue_items[] = {
- {0, "NONE", 0, "", ""},
- {0, NULL, 0, NULL, NULL},
+ {0, "NONE", 0, "", ""},
+ {0, NULL, 0, NULL, NULL},
};
-
/* Mask event types used in keymap items. */
const EnumPropertyItem rna_enum_event_type_mask_items[] = {
- {EVT_TYPE_MASK_KEYBOARD_MODIFIER, "KEYBOARD_MODIFIER", 0, "Keyboard Modifier", ""},
- {EVT_TYPE_MASK_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
- {EVT_TYPE_MASK_MOUSE_WHEEL, "MOUSE_WHEEL", 0, "Mouse Wheel", ""},
- {EVT_TYPE_MASK_MOUSE_GESTURE, "MOUSE_GESTURE", 0, "Mouse Gesture", ""},
- {EVT_TYPE_MASK_MOUSE_BUTTON, "MOUSE_BUTTON", 0, "Mouse Button", ""},
- {EVT_TYPE_MASK_MOUSE, "MOUSE", 0, "Mouse", ""},
- {EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""},
- {EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""},
- {EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""},
- {0, NULL, 0, NULL, NULL},
+ {EVT_TYPE_MASK_KEYBOARD_MODIFIER, "KEYBOARD_MODIFIER", 0, "Keyboard Modifier", ""},
+ {EVT_TYPE_MASK_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
+ {EVT_TYPE_MASK_MOUSE_WHEEL, "MOUSE_WHEEL", 0, "Mouse Wheel", ""},
+ {EVT_TYPE_MASK_MOUSE_GESTURE, "MOUSE_GESTURE", 0, "Mouse Gesture", ""},
+ {EVT_TYPE_MASK_MOUSE_BUTTON, "MOUSE_BUTTON", 0, "Mouse Button", ""},
+ {EVT_TYPE_MASK_MOUSE, "MOUSE", 0, "Mouse", ""},
+ {EVT_TYPE_MASK_NDOF, "NDOF", 0, "NDOF", ""},
+ {EVT_TYPE_MASK_TWEAK, "TWEAK", 0, "Tweak", ""},
+ {EVT_TYPE_MASK_ACTIONZONE, "ACTIONZONE", 0, "Action Zone", ""},
+ {0, NULL, 0, NULL, NULL},
};
#if 0
static const EnumPropertyItem keymap_modifiers_items[] = {
- {KM_ANY, "ANY", 0, "Any", ""},
- {0, "NONE", 0, "None", ""},
- {1, "FIRST", 0, "First", ""},
- {2, "SECOND", 0, "Second", ""},
- {0, NULL, 0, NULL, NULL},
+ {KM_ANY, "ANY", 0, "Any", ""},
+ {0, "NONE", 0, "None", ""},
+ {1, "FIRST", 0, "First", ""},
+ {2, "SECOND", 0, "Second", ""},
+ {0, NULL, 0, NULL, NULL},
};
#endif
-
#ifndef RNA_RUNTIME
static const EnumPropertyItem operator_flag_items[] = {
- {OPTYPE_REGISTER, "REGISTER", 0, "Register", "Display in the info window and support the redo toolbar panel"},
- {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
- {OPTYPE_UNDO_GROUPED, "UNDO_GROUPED", 0, "Grouped Undo", "Push a single undo event for repetead instances of this operator"},
- {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
- {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
- {OPTYPE_GRAB_CURSOR, "GRAB_CURSOR", 0, "Grab Pointer",
- "Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
- "is enabled"},
- {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
- {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
- {OPTYPE_USE_EVAL_DATA, "USE_EVAL_DATA", 0, "Use Evaluated Data",
- "Uses evaluated data (i.e. needs a valid depsgraph for current context)"},
- {0, NULL, 0, NULL, NULL},
+ {OPTYPE_REGISTER,
+ "REGISTER",
+ 0,
+ "Register",
+ "Display in the info window and support the redo toolbar panel"},
+ {OPTYPE_UNDO, "UNDO", 0, "Undo", "Push an undo event (needed for operator redo)"},
+ {OPTYPE_UNDO_GROUPED,
+ "UNDO_GROUPED",
+ 0,
+ "Grouped Undo",
+ "Push a single undo event for repetead instances of this operator"},
+ {OPTYPE_BLOCKING, "BLOCKING", 0, "Blocking", "Block anything else from using the cursor"},
+ {OPTYPE_MACRO, "MACRO", 0, "Macro", "Use to check if an operator is a macro"},
+ {OPTYPE_GRAB_CURSOR,
+ "GRAB_CURSOR",
+ 0,
+ "Grab Pointer",
+ "Use so the operator grabs the mouse focus, enables wrapping when continuous grab "
+ "is enabled"},
+ {OPTYPE_PRESET, "PRESET", 0, "Preset", "Display a preset button with the operators settings"},
+ {OPTYPE_INTERNAL, "INTERNAL", 0, "Internal", "Removes the operator from search results"},
+ {OPTYPE_USE_EVAL_DATA,
+ "USE_EVAL_DATA",
+ 0,
+ "Use Evaluated Data",
+ "Uses evaluated data (i.e. needs a valid depsgraph for current context)"},
+ {0, NULL, 0, NULL, NULL},
};
#endif
const EnumPropertyItem rna_enum_operator_return_items[] = {
- {OPERATOR_RUNNING_MODAL, "RUNNING_MODAL", 0, "Running Modal", "Keep the operator running with blender"},
- {OPERATOR_CANCELLED, "CANCELLED", 0, "Cancelled", "When no action has been taken, operator exits"},
- {OPERATOR_FINISHED, "FINISHED", 0, "Finished", "When the operator is complete, operator exits"},
- /* used as a flag */
- {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
- {OPERATOR_INTERFACE, "INTERFACE", 0, "Interface", "Handled but not executed (popup menus)"},
- {0, NULL, 0, NULL, NULL},
+ {OPERATOR_RUNNING_MODAL,
+ "RUNNING_MODAL",
+ 0,
+ "Running Modal",
+ "Keep the operator running with blender"},
+ {OPERATOR_CANCELLED,
+ "CANCELLED",
+ 0,
+ "Cancelled",
+ "When no action has been taken, operator exits"},
+ {OPERATOR_FINISHED,
+ "FINISHED",
+ 0,
+ "Finished",
+ "When the operator is complete, operator exits"},
+ /* used as a flag */
+ {OPERATOR_PASS_THROUGH, "PASS_THROUGH", 0, "Pass Through", "Do nothing and pass the event on"},
+ {OPERATOR_INTERFACE, "INTERFACE", 0, "Interface", "Handled but not executed (popup menus)"},
+ {0, NULL, 0, NULL, NULL},
};
const EnumPropertyItem rna_enum_operator_property_tags[] = {
- {OP_PROP_TAG_ADVANCED, "ADVANCED", 0, "Advanced", "The property is advanced so UI is suggested to hide it"},
- {0, NULL, 0, NULL, NULL},
+ {OP_PROP_TAG_ADVANCED,
+ "ADVANCED",
+ 0,
+ "Advanced",
+ "The property is advanced so UI is suggested to hide it"},
+ {0, NULL, 0, NULL, NULL},
};
/* flag/enum */
const EnumPropertyItem rna_enum_wm_report_items[] = {
- {RPT_DEBUG, "DEBUG", 0, "Debug", ""},
- {RPT_INFO, "INFO", 0, "Info", ""},
- {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""},
- {RPT_PROPERTY, "PROPERTY", 0, "Property", ""},
- {RPT_WARNING, "WARNING", 0, "Warning", ""},
- {RPT_ERROR, "ERROR", 0, "Error", ""},
- {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},
- {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""},
- {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""},
- {0, NULL, 0, NULL, NULL},
+ {RPT_DEBUG, "DEBUG", 0, "Debug", ""},
+ {RPT_INFO, "INFO", 0, "Info", ""},
+ {RPT_OPERATOR, "OPERATOR", 0, "Operator", ""},
+ {RPT_PROPERTY, "PROPERTY", 0, "Property", ""},
+ {RPT_WARNING, "WARNING", 0, "Warning", ""},
+ {RPT_ERROR, "ERROR", 0, "Error", ""},
+ {RPT_ERROR_INVALID_INPUT, "ERROR_INVALID_INPUT", 0, "Invalid Input", ""},
+ {RPT_ERROR_INVALID_CONTEXT, "ERROR_INVALID_CONTEXT", 0, "Invalid Context", ""},
+ {RPT_ERROR_OUT_OF_MEMORY, "ERROR_OUT_OF_MEMORY", 0, "Out of Memory", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include <assert.h>
+# include <assert.h>
-#include "BLI_string_utils.h"
+# include "BLI_string_utils.h"
-#include "WM_api.h"
+# include "WM_api.h"
-#include "DNA_object_types.h"
-#include "DNA_workspace_types.h"
+# include "DNA_object_types.h"
+# include "DNA_workspace_types.h"
-#include "ED_screen.h"
+# include "ED_screen.h"
-#include "UI_interface.h"
+# include "UI_interface.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
+# include "BKE_global.h"
+# include "BKE_idprop.h"
-#include "MEM_guardedalloc.h"
-
-#ifdef WITH_PYTHON
-# include "BPY_extern.h"
-#endif
+# include "MEM_guardedalloc.h"
+# ifdef WITH_PYTHON
+# include "BPY_extern.h"
+# endif
static wmOperator *rna_OperatorProperties_find_operator(PointerRNA *ptr)
{
- wmWindowManager *wm = ptr->id.data;
+ wmWindowManager *wm = ptr->id.data;
- if (wm) {
- IDProperty *properties = (IDProperty *)ptr->data;
- for (wmOperator *op = wm->operators.last; op; op = op->prev) {
- if (op->properties == properties) {
- return op;
- }
- }
- }
+ if (wm) {
+ IDProperty *properties = (IDProperty *)ptr->data;
+ for (wmOperator *op = wm->operators.last; op; op = op->prev) {
+ if (op->properties == properties) {
+ return op;
+ }
+ }
+ }
- return NULL;
+ return NULL;
}
static StructRNA *rna_OperatorProperties_refine(PointerRNA *ptr)
{
- wmOperator *op = rna_OperatorProperties_find_operator(ptr);
+ wmOperator *op = rna_OperatorProperties_find_operator(ptr);
- if (op)
- return op->type->srna;
- else
- return ptr->type;
+ if (op)
+ return op->type->srna;
+ else
+ return ptr->type;
}
static IDProperty *rna_OperatorProperties_idprops(PointerRNA *ptr, bool create)
{
- if (create && !ptr->data) {
- IDPropertyTemplate val = {0};
- ptr->data = IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
- }
+ if (create && !ptr->data) {
+ IDPropertyTemplate val = {0};
+ ptr->data = IDP_New(IDP_GROUP, &val, "RNA_OperatorProperties group");
+ }
- return ptr->data;
+ return ptr->data;
}
static void rna_Operator_name_get(PointerRNA *ptr, char *value)
{
- wmOperator *op = (wmOperator *)ptr->data;
- strcpy(value, op->type->name);
+ wmOperator *op = (wmOperator *)ptr->data;
+ strcpy(value, op->type->name);
}
static int rna_Operator_name_length(PointerRNA *ptr)
{
- wmOperator *op = (wmOperator *)ptr->data;
- return strlen(op->type->name);
+ wmOperator *op = (wmOperator *)ptr->data;
+ return strlen(op->type->name);
}
static bool rna_Operator_has_reports_get(PointerRNA *ptr)
{
- wmOperator *op = (wmOperator *)ptr->data;
- return (op->reports && op->reports->list.first);
+ wmOperator *op = (wmOperator *)ptr->data;
+ return (op->reports && op->reports->list.first);
}
static PointerRNA rna_Operator_options_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_OperatorOptions, ptr->data);
+ return rna_pointer_inherit_refine(ptr, &RNA_OperatorOptions, ptr->data);
}
static PointerRNA rna_Operator_properties_get(PointerRNA *ptr)
{
- wmOperator *op = (wmOperator *)ptr->data;
- return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
+ wmOperator *op = (wmOperator *)ptr->data;
+ return rna_pointer_inherit_refine(ptr, op->type->srna, op->properties);
}
static PointerRNA rna_OperatorMacro_properties_get(PointerRNA *ptr)
{
- wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro *)ptr->data;
- wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true);
- return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
+ wmOperatorTypeMacro *otmacro = (wmOperatorTypeMacro *)ptr->data;
+ wmOperatorType *ot = WM_operatortype_find(otmacro->idname, true);
+ return rna_pointer_inherit_refine(ptr, ot->srna, otmacro->properties);
}
static void rna_Event_ascii_get(PointerRNA *ptr, char *value)
{
- const wmEvent *event = ptr->data;
- value[0] = event->ascii;
- value[1] = '\0';
+ const wmEvent *event = ptr->data;
+ value[0] = event->ascii;
+ value[1] = '\0';
}
static int rna_Event_ascii_length(PointerRNA *ptr)
{
- const wmEvent *event = ptr->data;
- return (event->ascii) ? 1 : 0;
+ const wmEvent *event = ptr->data;
+ return (event->ascii) ? 1 : 0;
}
static void rna_Event_unicode_get(PointerRNA *ptr, char *value)
{
- /* utf8 buf isn't \0 terminated */
- const wmEvent *event = ptr->data;
- size_t len = 0;
+ /* utf8 buf isn't \0 terminated */
+ const wmEvent *event = ptr->data;
+ size_t len = 0;
- if (event->utf8_buf[0]) {
- BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
- if (len > 0) {
- memcpy(value, event->utf8_buf, len);
- }
- }
+ if (event->utf8_buf[0]) {
+ BLI_str_utf8_as_unicode_and_size(event->utf8_buf, &len);
+ if (len > 0) {
+ memcpy(value, event->utf8_buf, len);
+ }
+ }
- value[len] = '\0';
+ value[len] = '\0';
}
static int rna_Event_unicode_length(PointerRNA *ptr)
{
- const wmEvent *event = ptr->data;
- if (event->utf8_buf[0]) {
- /* invalid value is checked on assignment so we don't need to account for this */
- return BLI_str_utf8_size(event->utf8_buf);
- }
- else {
- return 0;
- }
+ const wmEvent *event = ptr->data;
+ if (event->utf8_buf[0]) {
+ /* invalid value is checked on assignment so we don't need to account for this */
+ return BLI_str_utf8_size(event->utf8_buf);
+ }
+ else {
+ return 0;
+ }
}
static float rna_Event_pressure_get(PointerRNA *ptr)
{
- const wmEvent *event = ptr->data;
- return WM_event_tablet_data(event, NULL, NULL);
+ const wmEvent *event = ptr->data;
+ return WM_event_tablet_data(event, NULL, NULL);
}
static bool rna_Event_is_tablet_get(PointerRNA *ptr)
{
- const wmEvent *event = ptr->data;
- return WM_event_is_tablet(event);
+ const wmEvent *event = ptr->data;
+ return WM_event_is_tablet(event);
}
static void rna_Event_tilt_get(PointerRNA *ptr, float *values)
{
- wmEvent *event = ptr->data;
- WM_event_tablet_data(event, NULL, values);
+ wmEvent *event = ptr->data;
+ WM_event_tablet_data(event, NULL, values);
}
static PointerRNA rna_PopupMenu_layout_get(PointerRNA *ptr)
{
- struct uiPopupMenu *pup = ptr->data;
- uiLayout *layout = UI_popup_menu_layout(pup);
+ struct uiPopupMenu *pup = ptr->data;
+ uiLayout *layout = UI_popup_menu_layout(pup);
- PointerRNA rptr;
- RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
+ PointerRNA rptr;
+ RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
- return rptr;
+ return rptr;
}
static PointerRNA rna_PopoverMenu_layout_get(PointerRNA *ptr)
{
- struct uiPopover *pup = ptr->data;
- uiLayout *layout = UI_popover_layout(pup);
+ struct uiPopover *pup = ptr->data;
+ uiLayout *layout = UI_popover_layout(pup);
- PointerRNA rptr;
- RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
+ PointerRNA rptr;
+ RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
- return rptr;
+ return rptr;
}
static PointerRNA rna_PieMenu_layout_get(PointerRNA *ptr)
{
- struct uiPieMenu *pie = ptr->data;
- uiLayout *layout = UI_pie_menu_layout(pie);
+ struct uiPieMenu *pie = ptr->data;
+ uiLayout *layout = UI_pie_menu_layout(pie);
- PointerRNA rptr;
- RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
+ PointerRNA rptr;
+ RNA_pointer_create(ptr->id.data, &RNA_UILayout, layout, &rptr);
- return rptr;
+ return rptr;
}
static void rna_Window_scene_set(PointerRNA *ptr, PointerRNA value)
{
- wmWindow *win = ptr->data;
+ wmWindow *win = ptr->data;
- if (value.data == NULL) {
- return;
- }
+ if (value.data == NULL) {
+ return;
+ }
- win->new_scene = value.data;
+ win->new_scene = value.data;
}
static void rna_Window_scene_update(bContext *C, PointerRNA *ptr)
{
- Main *bmain = CTX_data_main(C);
- wmWindow *win = ptr->data;
+ Main *bmain = CTX_data_main(C);
+ wmWindow *win = ptr->data;
- /* exception: must use context so notifier gets to the right window */
- if (win->new_scene) {
-#ifdef WITH_PYTHON
- BPy_BEGIN_ALLOW_THREADS;
-#endif
+ /* exception: must use context so notifier gets to the right window */
+ if (win->new_scene) {
+# ifdef WITH_PYTHON
+ BPy_BEGIN_ALLOW_THREADS;
+# endif
- WM_window_set_active_scene(bmain, C, win, win->new_scene);
+ WM_window_set_active_scene(bmain, C, win, win->new_scene);
-#ifdef WITH_PYTHON
- BPy_END_ALLOW_THREADS;
-#endif
+# ifdef WITH_PYTHON
+ BPy_END_ALLOW_THREADS;
+# endif
- WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
+ WM_event_add_notifier(C, NC_SCENE | ND_SCENEBROWSE, win->new_scene);
- if (G.debug & G_DEBUG)
- printf("scene set %p\n", win->new_scene);
+ if (G.debug & G_DEBUG)
+ printf("scene set %p\n", win->new_scene);
- win->new_scene = NULL;
- }
+ win->new_scene = NULL;
+ }
}
static PointerRNA rna_Window_workspace_get(PointerRNA *ptr)
{
- wmWindow *win = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_WorkSpace, BKE_workspace_active_get(win->workspace_hook));
+ wmWindow *win = ptr->data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_WorkSpace, BKE_workspace_active_get(win->workspace_hook));
}
static void rna_Window_workspace_set(PointerRNA *ptr, PointerRNA value)
{
- wmWindow *win = (wmWindow *)ptr->data;
+ wmWindow *win = (wmWindow *)ptr->data;
- /* disallow ID-browsing away from temp screens */
- if (WM_window_is_temp_screen(win)) {
- return;
- }
- if (value.data == NULL) {
- return;
- }
+ /* disallow ID-browsing away from temp screens */
+ if (WM_window_is_temp_screen(win)) {
+ return;
+ }
+ if (value.data == NULL) {
+ return;
+ }
- /* exception: can't set workspaces inside of area/region handlers */
- win->workspace_hook->temp_workspace_store = value.data;
+ /* exception: can't set workspaces inside of area/region handlers */
+ win->workspace_hook->temp_workspace_store = value.data;
}
static void rna_Window_workspace_update(bContext *C, PointerRNA *ptr)
{
- wmWindow *win = ptr->data;
- WorkSpace *new_workspace = win->workspace_hook->temp_workspace_store;
+ wmWindow *win = ptr->data;
+ WorkSpace *new_workspace = win->workspace_hook->temp_workspace_store;
- /* exception: can't set screens inside of area/region handlers,
- * and must use context so notifier gets to the right window */
- if (new_workspace) {
- WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
- win->workspace_hook->temp_workspace_store = NULL;
- }
+ /* exception: can't set screens inside of area/region handlers,
+ * and must use context so notifier gets to the right window */
+ if (new_workspace) {
+ WM_event_add_notifier(C, NC_SCREEN | ND_WORKSPACE_SET, new_workspace);
+ win->workspace_hook->temp_workspace_store = NULL;
+ }
}
PointerRNA rna_Window_screen_get(PointerRNA *ptr)
{
- wmWindow *win = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_Screen, BKE_workspace_active_screen_get(win->workspace_hook));
+ wmWindow *win = ptr->data;
+ return rna_pointer_inherit_refine(
+ ptr, &RNA_Screen, BKE_workspace_active_screen_get(win->workspace_hook));
}
static void rna_Window_screen_set(PointerRNA *ptr, PointerRNA value)
{
- wmWindow *win = ptr->data;
- WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
- WorkSpaceLayout *layout_new;
- const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
+ wmWindow *win = ptr->data;
+ WorkSpace *workspace = BKE_workspace_active_get(win->workspace_hook);
+ WorkSpaceLayout *layout_new;
+ const bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook);
- /* disallow ID-browsing away from temp screens */
- if (screen->temp) {
- return;
- }
- if (value.data == NULL) {
- return;
- }
+ /* disallow ID-browsing away from temp screens */
+ if (screen->temp) {
+ return;
+ }
+ if (value.data == NULL) {
+ return;
+ }
- /* exception: can't set screens inside of area/region handlers */
- layout_new = BKE_workspace_layout_find(workspace, value.data);
- win->workspace_hook->temp_layout_store = layout_new;
+ /* exception: can't set screens inside of area/region handlers */
+ layout_new = BKE_workspace_layout_find(workspace, value.data);
+ win->workspace_hook->temp_layout_store = layout_new;
}
static bool rna_Window_screen_assign_poll(PointerRNA *UNUSED(ptr), PointerRNA value)
{
- bScreen *screen = value.id.data;
- return !screen->temp;
+ bScreen *screen = value.id.data;
+ return !screen->temp;
}
static void rna_workspace_screen_update(bContext *C, PointerRNA *ptr)
{
- wmWindow *win = ptr->data;
- WorkSpaceLayout *layout_new = win->workspace_hook->temp_layout_store;
+ wmWindow *win = ptr->data;
+ WorkSpaceLayout *layout_new = win->workspace_hook->temp_layout_store;
- /* exception: can't set screens inside of area/region handlers,
- * and must use context so notifier gets to the right window */
- if (layout_new) {
- WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
- win->workspace_hook->temp_layout_store = NULL;
- }
+ /* exception: can't set screens inside of area/region handlers,
+ * and must use context so notifier gets to the right window */
+ if (layout_new) {
+ WM_event_add_notifier(C, NC_SCREEN | ND_LAYOUTBROWSE, layout_new);
+ win->workspace_hook->temp_layout_store = NULL;
+ }
}
static PointerRNA rna_Window_view_layer_get(PointerRNA *ptr)
{
- wmWindow *win = ptr->data;
- Scene *scene = WM_window_get_active_scene(win);
- ViewLayer *view_layer = WM_window_get_active_view_layer(win);
- PointerRNA scene_ptr;
+ wmWindow *win = ptr->data;
+ Scene *scene = WM_window_get_active_scene(win);
+ ViewLayer *view_layer = WM_window_get_active_view_layer(win);
+ PointerRNA scene_ptr;
- RNA_id_pointer_create(&scene->id, &scene_ptr);
- return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer);
+ RNA_id_pointer_create(&scene->id, &scene_ptr);
+ return rna_pointer_inherit_refine(&scene_ptr, &RNA_ViewLayer, view_layer);
}
static void rna_Window_view_layer_set(PointerRNA *ptr, PointerRNA value)
{
- wmWindow *win = ptr->data;
- ViewLayer *view_layer = value.data;
+ wmWindow *win = ptr->data;
+ ViewLayer *view_layer = value.data;
- WM_window_set_active_view_layer(win, view_layer);
+ WM_window_set_active_view_layer(win, view_layer);
}
static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = ptr->data;
+ wmKeyMapItem *kmi = ptr->data;
- if (kmi->ptr)
- return *(kmi->ptr);
+ if (kmi->ptr)
+ return *(kmi->ptr);
- /*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */
- return PointerRNA_NULL;
+ /*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */
+ return PointerRNA_NULL;
}
static int rna_wmKeyMapItem_map_type_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = ptr->data;
+ wmKeyMapItem *kmi = ptr->data;
- return WM_keymap_map_type_get(kmi);
+ return WM_keymap_map_type_get(kmi);
}
static void rna_wmKeyMapItem_map_type_set(PointerRNA *ptr, int value)
{
- wmKeyMapItem *kmi = ptr->data;
- int map_type = rna_wmKeyMapItem_map_type_get(ptr);
-
- if (value != map_type) {
- switch (value) {
- case KMI_TYPE_KEYBOARD:
- kmi->type = AKEY;
- kmi->val = KM_PRESS;
- break;
- case KMI_TYPE_TWEAK:
- kmi->type = EVT_TWEAK_L;
- kmi->val = KM_ANY;
- break;
- case KMI_TYPE_MOUSE:
- kmi->type = LEFTMOUSE;
- kmi->val = KM_PRESS;
- break;
- case KMI_TYPE_TEXTINPUT:
- kmi->type = KM_TEXTINPUT;
- kmi->val = KM_NOTHING;
- break;
- case KMI_TYPE_TIMER:
- kmi->type = TIMER;
- kmi->val = KM_NOTHING;
- break;
- case KMI_TYPE_NDOF:
- kmi->type = NDOF_MOTION;
- kmi->val = KM_NOTHING;
- break;
- }
- }
+ wmKeyMapItem *kmi = ptr->data;
+ int map_type = rna_wmKeyMapItem_map_type_get(ptr);
+
+ if (value != map_type) {
+ switch (value) {
+ case KMI_TYPE_KEYBOARD:
+ kmi->type = AKEY;
+ kmi->val = KM_PRESS;
+ break;
+ case KMI_TYPE_TWEAK:
+ kmi->type = EVT_TWEAK_L;
+ kmi->val = KM_ANY;
+ break;
+ case KMI_TYPE_MOUSE:
+ kmi->type = LEFTMOUSE;
+ kmi->val = KM_PRESS;
+ break;
+ case KMI_TYPE_TEXTINPUT:
+ kmi->type = KM_TEXTINPUT;
+ kmi->val = KM_NOTHING;
+ break;
+ case KMI_TYPE_TIMER:
+ kmi->type = TIMER;
+ kmi->val = KM_NOTHING;
+ break;
+ case KMI_TYPE_NDOF:
+ kmi->type = NDOF_MOTION;
+ kmi->val = KM_NOTHING;
+ break;
+ }
+ }
}
/* assumes value to be an enum from rna_enum_event_type_items */
/* function makes sure keymodifiers are only valid keys, ESC keeps it unaltered */
static void rna_wmKeyMapItem_keymodifier_set(PointerRNA *ptr, int value)
{
- wmKeyMapItem *kmi = ptr->data;
-
- /* XXX, this should really be managed in an _itemf function,
- * giving a list of valid enums, then silently changing them when they are set is not
- * a good precedent, don't do this unless you have a good reason! */
- if (value == ESCKEY) {
- /* pass */
- }
- else if (value >= AKEY) {
- kmi->keymodifier = value;
- }
- else {
- kmi->keymodifier = 0;
- }
-}
-
-
-static const EnumPropertyItem *rna_KeyMapItem_type_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
- bool *UNUSED(r_free))
-{
- int map_type = rna_wmKeyMapItem_map_type_get(ptr);
-
- if (map_type == KMI_TYPE_MOUSE) return event_mouse_type_items;
- if (map_type == KMI_TYPE_TWEAK) return event_tweak_type_items;
- if (map_type == KMI_TYPE_TIMER) return event_timer_type_items;
- if (map_type == KMI_TYPE_NDOF) return event_ndof_type_items;
- if (map_type == KMI_TYPE_TEXTINPUT) return event_textinput_type_items;
- else return rna_enum_event_type_items;
-}
-
-static const EnumPropertyItem *rna_KeyMapItem_value_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
- bool *UNUSED(r_free))
-{
- int map_type = rna_wmKeyMapItem_map_type_get(ptr);
-
- if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF)
- return event_keymouse_value_items;
- if (map_type == KMI_TYPE_TWEAK)
- return event_tweak_value_items;
- else
- return rna_enum_event_value_items;
-}
-
-static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(
- bContext *C, PointerRNA *ptr, PropertyRNA *UNUSED(prop),
- bool *UNUSED(r_free))
-{
- wmWindowManager *wm = CTX_wm_manager(C);
- wmKeyConfig *kc;
- wmKeyMap *km;
-
- for (kc = wm->keyconfigs.first; kc; kc = kc->next) {
- for (km = kc->keymaps.first; km; km = km->next) {
- /* only check if it's a modal keymap */
- if (km->modal_items) {
- wmKeyMapItem *kmi;
- for (kmi = km->items.first; kmi; kmi = kmi->next) {
- if (kmi == ptr->data) {
- return km->modal_items;
- }
- }
- }
- }
- }
-
-
- return rna_enum_keymap_propvalue_items; /* ERROR */
+ wmKeyMapItem *kmi = ptr->data;
+
+ /* XXX, this should really be managed in an _itemf function,
+ * giving a list of valid enums, then silently changing them when they are set is not
+ * a good precedent, don't do this unless you have a good reason! */
+ if (value == ESCKEY) {
+ /* pass */
+ }
+ else if (value >= AKEY) {
+ kmi->keymodifier = value;
+ }
+ else {
+ kmi->keymodifier = 0;
+ }
+}
+
+static const EnumPropertyItem *rna_KeyMapItem_type_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ int map_type = rna_wmKeyMapItem_map_type_get(ptr);
+
+ if (map_type == KMI_TYPE_MOUSE)
+ return event_mouse_type_items;
+ if (map_type == KMI_TYPE_TWEAK)
+ return event_tweak_type_items;
+ if (map_type == KMI_TYPE_TIMER)
+ return event_timer_type_items;
+ if (map_type == KMI_TYPE_NDOF)
+ return event_ndof_type_items;
+ if (map_type == KMI_TYPE_TEXTINPUT)
+ return event_textinput_type_items;
+ else
+ return rna_enum_event_type_items;
+}
+
+static const EnumPropertyItem *rna_KeyMapItem_value_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ int map_type = rna_wmKeyMapItem_map_type_get(ptr);
+
+ if (map_type == KMI_TYPE_MOUSE || map_type == KMI_TYPE_KEYBOARD || map_type == KMI_TYPE_NDOF)
+ return event_keymouse_value_items;
+ if (map_type == KMI_TYPE_TWEAK)
+ return event_tweak_value_items;
+ else
+ return rna_enum_event_value_items;
+}
+
+static const EnumPropertyItem *rna_KeyMapItem_propvalue_itemf(bContext *C,
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
+{
+ wmWindowManager *wm = CTX_wm_manager(C);
+ wmKeyConfig *kc;
+ wmKeyMap *km;
+
+ for (kc = wm->keyconfigs.first; kc; kc = kc->next) {
+ for (km = kc->keymaps.first; km; km = km->next) {
+ /* only check if it's a modal keymap */
+ if (km->modal_items) {
+ wmKeyMapItem *kmi;
+ for (kmi = km->items.first; kmi; kmi = kmi->next) {
+ if (kmi == ptr->data) {
+ return km->modal_items;
+ }
+ }
+ }
+ }
+ }
+
+ return rna_enum_keymap_propvalue_items; /* ERROR */
}
static bool rna_KeyMapItem_any_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+ wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
- if (kmi->shift == KM_ANY &&
- kmi->ctrl == KM_ANY &&
- kmi->alt == KM_ANY &&
- kmi->oskey == KM_ANY)
- {
- return 1;
- }
- else {
- return 0;
- }
+ if (kmi->shift == KM_ANY && kmi->ctrl == KM_ANY && kmi->alt == KM_ANY && kmi->oskey == KM_ANY) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
}
static void rna_KeyMapItem_any_set(PointerRNA *ptr, bool value)
{
- wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+ wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
- if (value) {
- kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
- }
- else {
- kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = 0;
- }
+ if (value) {
+ kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = KM_ANY;
+ }
+ else {
+ kmi->shift = kmi->ctrl = kmi->alt = kmi->oskey = 0;
+ }
}
static bool rna_KeyMapItem_shift_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
- return kmi->shift != 0;
+ wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+ return kmi->shift != 0;
}
static bool rna_KeyMapItem_ctrl_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
- return kmi->ctrl != 0;
+ wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+ return kmi->ctrl != 0;
}
static bool rna_KeyMapItem_alt_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
- return kmi->alt != 0;
+ wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+ return kmi->alt != 0;
}
static bool rna_KeyMapItem_oskey_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
- return kmi->oskey != 0;
+ wmKeyMapItem *kmi = (wmKeyMapItem *)ptr->data;
+ return kmi->oskey != 0;
}
static PointerRNA rna_WindowManager_active_keyconfig_get(PointerRNA *ptr)
{
- wmWindowManager *wm = ptr->data;
- wmKeyConfig *kc;
+ wmWindowManager *wm = ptr->data;
+ wmKeyConfig *kc;
- kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
+ kc = BLI_findstring(&wm->keyconfigs, U.keyconfigstr, offsetof(wmKeyConfig, idname));
- if (!kc)
- kc = wm->defaultconf;
+ if (!kc)
+ kc = wm->defaultconf;
- return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
+ return rna_pointer_inherit_refine(ptr, &RNA_KeyConfig, kc);
}
static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA value)
{
- wmWindowManager *wm = ptr->data;
- wmKeyConfig *kc = value.data;
+ wmWindowManager *wm = ptr->data;
+ wmKeyConfig *kc = value.data;
- if (kc)
- WM_keyconfig_set_active(wm, kc->idname);
+ if (kc)
+ WM_keyconfig_set_active(wm, kc->idname);
}
/* -------------------------------------------------------------------- */
@@ -1007,349 +1043,355 @@ static void rna_WindowManager_active_keyconfig_set(PointerRNA *ptr, PointerRNA v
static PointerRNA rna_wmKeyConfig_preferences_get(PointerRNA *ptr)
{
- wmKeyConfig *kc = ptr->data;
- wmKeyConfigPrefType_Runtime *kpt_rt = BKE_keyconfig_pref_type_find(kc->idname, true);
- if (kpt_rt) {
- wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(&U, kc->idname);
- return rna_pointer_inherit_refine(ptr, kpt_rt->ext.srna, kpt->prop);
- }
- else {
- return PointerRNA_NULL;
- }
+ wmKeyConfig *kc = ptr->data;
+ wmKeyConfigPrefType_Runtime *kpt_rt = BKE_keyconfig_pref_type_find(kc->idname, true);
+ if (kpt_rt) {
+ wmKeyConfigPref *kpt = BKE_keyconfig_pref_ensure(&U, kc->idname);
+ return rna_pointer_inherit_refine(ptr, kpt_rt->ext.srna, kpt->prop);
+ }
+ else {
+ return PointerRNA_NULL;
+ }
}
static IDProperty *rna_wmKeyConfigPref_idprops(PointerRNA *ptr, bool create)
{
- if (create && !ptr->data) {
- IDPropertyTemplate val = {0};
- ptr->data = IDP_New(IDP_GROUP, &val, "RNA_KeyConfigPreferences group");
- }
- return ptr->data;
+ if (create && !ptr->data) {
+ IDPropertyTemplate val = {0};
+ ptr->data = IDP_New(IDP_GROUP, &val, "RNA_KeyConfigPreferences group");
+ }
+ return ptr->data;
}
static void rna_wmKeyConfigPref_unregister(Main *UNUSED(bmain), StructRNA *type)
{
- wmKeyConfigPrefType_Runtime *kpt_rt = RNA_struct_blender_type_get(type);
+ wmKeyConfigPrefType_Runtime *kpt_rt = RNA_struct_blender_type_get(type);
- if (!kpt_rt)
- return;
+ if (!kpt_rt)
+ return;
- RNA_struct_free_extension(type, &kpt_rt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &kpt_rt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- /* Possible we're not in the preferences if they have been reset. */
- BKE_keyconfig_pref_type_remove(kpt_rt);
+ /* Possible we're not in the preferences if they have been reset. */
+ BKE_keyconfig_pref_type_remove(kpt_rt);
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
-static StructRNA *rna_wmKeyConfigPref_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_wmKeyConfigPref_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
- wmKeyConfigPref dummy_kpt = {NULL};
- PointerRNA dummy_ptr;
- // int have_function[1];
+ wmKeyConfigPrefType_Runtime *kpt_rt, dummy_kpt_rt = {{'\0'}};
+ wmKeyConfigPref dummy_kpt = {NULL};
+ PointerRNA dummy_ptr;
+ // int have_function[1];
- /* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */
- RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_ptr);
+ /* setup dummy keyconf-prefs & keyconf-prefs type to store static properties in */
+ RNA_pointer_create(NULL, &RNA_KeyConfigPreferences, &dummy_kpt, &dummy_ptr);
- /* validate the python class */
- if (validate(&dummy_ptr, data, NULL /* have_function */ ) != 0)
- return NULL;
+ /* validate the python class */
+ if (validate(&dummy_ptr, data, NULL /* have_function */) != 0)
+ return NULL;
- STRNCPY(dummy_kpt_rt.idname, dummy_kpt.idname);
- if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering key-config preferences class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummy_kpt_rt.idname));
- return NULL;
- }
+ STRNCPY(dummy_kpt_rt.idname, dummy_kpt.idname);
+ if (strlen(identifier) >= sizeof(dummy_kpt_rt.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering key-config preferences class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummy_kpt_rt.idname));
+ return NULL;
+ }
- /* check if we have registered this keyconf-prefs type before, and remove it */
- kpt_rt = BKE_keyconfig_pref_type_find(dummy_kpt.idname, true);
- if (kpt_rt && kpt_rt->ext.srna) {
- rna_wmKeyConfigPref_unregister(bmain, kpt_rt->ext.srna);
- }
+ /* check if we have registered this keyconf-prefs type before, and remove it */
+ kpt_rt = BKE_keyconfig_pref_type_find(dummy_kpt.idname, true);
+ if (kpt_rt && kpt_rt->ext.srna) {
+ rna_wmKeyConfigPref_unregister(bmain, kpt_rt->ext.srna);
+ }
- /* create a new keyconf-prefs type */
- kpt_rt = MEM_mallocN(sizeof(wmKeyConfigPrefType_Runtime), "keyconfigpreftype");
- memcpy(kpt_rt, &dummy_kpt_rt, sizeof(dummy_kpt_rt));
+ /* create a new keyconf-prefs type */
+ kpt_rt = MEM_mallocN(sizeof(wmKeyConfigPrefType_Runtime), "keyconfigpreftype");
+ memcpy(kpt_rt, &dummy_kpt_rt, sizeof(dummy_kpt_rt));
- BKE_keyconfig_pref_type_add(kpt_rt);
+ BKE_keyconfig_pref_type_add(kpt_rt);
- kpt_rt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_KeyConfigPreferences);
- kpt_rt->ext.data = data;
- kpt_rt->ext.call = call;
- kpt_rt->ext.free = free;
- RNA_struct_blender_type_set(kpt_rt->ext.srna, kpt_rt);
+ kpt_rt->ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, identifier, &RNA_KeyConfigPreferences);
+ kpt_rt->ext.data = data;
+ kpt_rt->ext.call = call;
+ kpt_rt->ext.free = free;
+ RNA_struct_blender_type_set(kpt_rt->ext.srna, kpt_rt);
-// kpt_rt->draw = (have_function[0]) ? header_draw : NULL;
+ // kpt_rt->draw = (have_function[0]) ? header_draw : NULL;
- /* update while blender is running */
- WM_main_add_notifier(NC_WINDOW, NULL);
+ /* update while blender is running */
+ WM_main_add_notifier(NC_WINDOW, NULL);
- return kpt_rt->ext.srna;
+ return kpt_rt->ext.srna;
}
/* placeholder, doesn't do anything useful yet */
static StructRNA *rna_wmKeyConfigPref_refine(PointerRNA *ptr)
{
- return (ptr->type) ? ptr->type : &RNA_KeyConfigPreferences;
+ return (ptr->type) ? ptr->type : &RNA_KeyConfigPreferences;
}
/** \} */
-
static void rna_wmKeyMapItem_idname_get(PointerRNA *ptr, char *value)
{
- wmKeyMapItem *kmi = ptr->data;
- WM_operator_py_idname(value, kmi->idname);
+ wmKeyMapItem *kmi = ptr->data;
+ WM_operator_py_idname(value, kmi->idname);
}
static int rna_wmKeyMapItem_idname_length(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = ptr->data;
- char pyname[OP_MAX_TYPENAME];
+ wmKeyMapItem *kmi = ptr->data;
+ char pyname[OP_MAX_TYPENAME];
- WM_operator_py_idname(pyname, kmi->idname);
- return strlen(pyname);
+ WM_operator_py_idname(pyname, kmi->idname);
+ return strlen(pyname);
}
static void rna_wmKeyMapItem_idname_set(PointerRNA *ptr, const char *value)
{
- wmKeyMapItem *kmi = ptr->data;
- char idname[OP_MAX_TYPENAME];
+ wmKeyMapItem *kmi = ptr->data;
+ char idname[OP_MAX_TYPENAME];
- WM_operator_bl_idname(idname, value);
+ WM_operator_bl_idname(idname, value);
- if (!STREQ(idname, kmi->idname)) {
- BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
+ if (!STREQ(idname, kmi->idname)) {
+ BLI_strncpy(kmi->idname, idname, sizeof(kmi->idname));
- WM_keymap_properties_reset(kmi, NULL);
- }
+ WM_keymap_properties_reset(kmi, NULL);
+ }
}
static void rna_wmKeyMapItem_name_get(PointerRNA *ptr, char *value)
{
- wmKeyMapItem *kmi = ptr->data;
- wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
- strcpy(value, ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
+ wmKeyMapItem *kmi = ptr->data;
+ wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
+ strcpy(value, ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
}
static int rna_wmKeyMapItem_name_length(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = ptr->data;
- wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
- return strlen(ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
+ wmKeyMapItem *kmi = ptr->data;
+ wmOperatorType *ot = WM_operatortype_find(kmi->idname, 1);
+ return strlen(ot ? RNA_struct_ui_name(ot->srna) : kmi->idname);
}
static bool rna_KeyMapItem_userdefined_get(PointerRNA *ptr)
{
- wmKeyMapItem *kmi = ptr->data;
- return kmi->id < 0;
+ wmKeyMapItem *kmi = ptr->data;
+ return kmi->id < 0;
}
static void rna_wmClipboard_get(PointerRNA *UNUSED(ptr), char *value)
{
- char *pbuf;
- int pbuf_len;
+ char *pbuf;
+ int pbuf_len;
- pbuf = WM_clipboard_text_get(false, &pbuf_len);
- if (pbuf) {
- memcpy(value, pbuf, pbuf_len + 1);
- MEM_freeN(pbuf);
- }
- else {
- value[0] = '\0';
- }
+ pbuf = WM_clipboard_text_get(false, &pbuf_len);
+ if (pbuf) {
+ memcpy(value, pbuf, pbuf_len + 1);
+ MEM_freeN(pbuf);
+ }
+ else {
+ value[0] = '\0';
+ }
}
static int rna_wmClipboard_length(PointerRNA *UNUSED(ptr))
{
- char *pbuf;
- int pbuf_len;
+ char *pbuf;
+ int pbuf_len;
- pbuf = WM_clipboard_text_get(false, &pbuf_len);
- if (pbuf) {
- MEM_freeN(pbuf);
- }
+ pbuf = WM_clipboard_text_get(false, &pbuf_len);
+ if (pbuf) {
+ MEM_freeN(pbuf);
+ }
- return pbuf_len;
+ return pbuf_len;
}
static void rna_wmClipboard_set(PointerRNA *UNUSED(ptr), const char *value)
{
- WM_clipboard_text_set((void *) value, false);
+ WM_clipboard_text_set((void *)value, false);
}
-#ifdef WITH_PYTHON
+# ifdef WITH_PYTHON
static bool rna_operator_poll_cb(bContext *C, wmOperatorType *ot)
{
- extern FunctionRNA rna_Operator_poll_func;
+ extern FunctionRNA rna_Operator_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, ot->ext.srna, NULL, &ptr); /* dummy */
+ func = &rna_Operator_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- ot->ext.call(C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ ot->ext.call(C, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static int rna_operator_execute_cb(bContext *C, wmOperator *op)
{
- extern FunctionRNA rna_Operator_execute_func;
+ extern FunctionRNA rna_Operator_execute_func;
- PointerRNA opr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- int result;
+ PointerRNA opr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ int result;
- RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
- func = &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
+ RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
+ func = &rna_Operator_execute_func; /* RNA_struct_find_function(&opr, "execute"); */
- RNA_parameter_list_create(&list, &opr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- op->type->ext.call(C, &opr, func, &list);
+ RNA_parameter_list_create(&list, &opr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_get_lookup(&list, "result", &ret);
- result = *(int *)ret;
+ RNA_parameter_get_lookup(&list, "result", &ret);
+ result = *(int *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return result;
+ return result;
}
/* same as execute() but no return value */
static bool rna_operator_check_cb(bContext *C, wmOperator *op)
{
- extern FunctionRNA rna_Operator_check_func;
+ extern FunctionRNA rna_Operator_check_func;
- PointerRNA opr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool result;
+ PointerRNA opr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool result;
- RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
- func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
+ RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
+ func = &rna_Operator_check_func; /* RNA_struct_find_function(&opr, "check"); */
- RNA_parameter_list_create(&list, &opr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- op->type->ext.call(C, &opr, func, &list);
+ RNA_parameter_list_create(&list, &opr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_get_lookup(&list, "result", &ret);
- result = (*(bool *)ret) != 0;
+ RNA_parameter_get_lookup(&list, "result", &ret);
+ result = (*(bool *)ret) != 0;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return result;
+ return result;
}
static int rna_operator_invoke_cb(bContext *C, wmOperator *op, const wmEvent *event)
{
- extern FunctionRNA rna_Operator_invoke_func;
+ extern FunctionRNA rna_Operator_invoke_func;
- PointerRNA opr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- int result;
+ PointerRNA opr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ int result;
- RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
- func = &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
+ RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
+ func = &rna_Operator_invoke_func; /* RNA_struct_find_function(&opr, "invoke"); */
- RNA_parameter_list_create(&list, &opr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "event", &event);
- op->type->ext.call(C, &opr, func, &list);
+ RNA_parameter_list_create(&list, &opr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "event", &event);
+ op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_get_lookup(&list, "result", &ret);
- result = *(int *)ret;
+ RNA_parameter_get_lookup(&list, "result", &ret);
+ result = *(int *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return result;
+ return result;
}
/* same as invoke */
static int rna_operator_modal_cb(bContext *C, wmOperator *op, const wmEvent *event)
{
- extern FunctionRNA rna_Operator_modal_func;
+ extern FunctionRNA rna_Operator_modal_func;
- PointerRNA opr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- int result;
+ PointerRNA opr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ int result;
- RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
- func = &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
+ RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
+ func = &rna_Operator_modal_func; /* RNA_struct_find_function(&opr, "modal"); */
- RNA_parameter_list_create(&list, &opr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "event", &event);
- op->type->ext.call(C, &opr, func, &list);
+ RNA_parameter_list_create(&list, &opr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "event", &event);
+ op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_get_lookup(&list, "result", &ret);
- result = *(int *)ret;
+ RNA_parameter_get_lookup(&list, "result", &ret);
+ result = *(int *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return result;
+ return result;
}
static void rna_operator_draw_cb(bContext *C, wmOperator *op)
{
- extern FunctionRNA rna_Operator_draw_func;
+ extern FunctionRNA rna_Operator_draw_func;
- PointerRNA opr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA opr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
- func = &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
+ RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
+ func = &rna_Operator_draw_func; /* RNA_struct_find_function(&opr, "draw"); */
- RNA_parameter_list_create(&list, &opr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- op->type->ext.call(C, &opr, func, &list);
+ RNA_parameter_list_create(&list, &opr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
/* same as exec(), but call cancel */
static void rna_operator_cancel_cb(bContext *C, wmOperator *op)
{
- extern FunctionRNA rna_Operator_cancel_func;
+ extern FunctionRNA rna_Operator_cancel_func;
- PointerRNA opr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA opr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
- func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
+ RNA_pointer_create(NULL, op->type->ext.srna, op, &opr);
+ func = &rna_Operator_cancel_func; /* RNA_struct_find_function(&opr, "cancel"); */
- RNA_parameter_list_create(&list, &opr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- op->type->ext.call(C, &opr, func, &list);
+ RNA_parameter_list_create(&list, &opr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ op->type->ext.call(C, &opr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type);
@@ -1358,311 +1400,329 @@ static void rna_Operator_unregister(struct Main *bmain, StructRNA *type);
extern void BPY_RNA_operator_wrapper(wmOperatorType *ot, void *userdata);
extern void BPY_RNA_operator_macro_wrapper(wmOperatorType *ot, void *userdata);
-static StructRNA *rna_Operator_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- wmOperatorType dummyot = {NULL};
- wmOperator dummyop = {NULL};
- PointerRNA dummyotr;
- int have_function[7];
-
- struct {
- char idname[OP_MAX_TYPENAME];
- char name[OP_MAX_TYPENAME];
- char description[RNA_DYN_DESCR_MAX];
- char translation_context[RNA_DYN_DESCR_MAX];
- char undo_group[OP_MAX_TYPENAME];
- } temp_buffers;
-
- /* setup dummy operator & operator type to store static properties in */
- dummyop.type = &dummyot;
- dummyot.idname = temp_buffers.idname; /* only assigne the pointer, string is NULL'd */
- dummyot.name = temp_buffers.name; /* only assigne the pointer, string is NULL'd */
- dummyot.description = temp_buffers.description; /* only assigne the pointer, string is NULL'd */
- dummyot.translation_context = temp_buffers.translation_context; /* only assigne the pointer, string is NULL'd */
- dummyot.undo_group = temp_buffers.undo_group; /* only assigne the pointer, string is NULL'd */
- RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
-
- /* clear in case they are left unset */
- temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] = temp_buffers.undo_group[0] = '\0';
- /* We have to set default op context! */
- strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
-
- /* validate the python class */
- if (validate(&dummyotr, data, have_function) != 0)
- return NULL;
-
- /* check if we have registered this operator type before, and remove it */
- {
- wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
- if (ot && ot->ext.srna)
- rna_Operator_unregister(bmain, ot->ext.srna);
- }
-
- if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
- return NULL;
- }
-
- char idname_conv[sizeof(dummyop.idname)];
- WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
-
- if (!RNA_struct_available_or_report(reports, idname_conv)) {
- return NULL;
- }
-
- /* Convert foo.bar to FOO_OT_bar
- * allocate all strings at once. */
- {
- const char *strings[] = {
- idname_conv,
- temp_buffers.name,
- temp_buffers.description,
- temp_buffers.translation_context,
- temp_buffers.undo_group,
- };
- char *strings_table[ARRAY_SIZE(strings)];
- BLI_string_join_array_by_sep_char_with_tableN('\0', strings_table, strings, ARRAY_SIZE(strings));
-
- dummyot.idname = strings_table[0]; /* allocated string stored here */
- dummyot.name = strings_table[1];
- dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
- dummyot.translation_context = strings_table[3];
- dummyot.undo_group = strings_table[4];
- BLI_assert(ARRAY_SIZE(strings) == 5);
- }
-
- /* XXX, this doubles up with the operator name [#29666]
- * for now just remove from dir(bpy.types) */
-
- /* create a new operator type */
- dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
- RNA_def_struct_flag(dummyot.ext.srna, STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
- RNA_def_struct_property_tags(dummyot.ext.srna, rna_enum_operator_property_tags);
- RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
- dummyot.ext.data = data;
- dummyot.ext.call = call;
- dummyot.ext.free = free;
-
- dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
- dummyot.exec = (have_function[1]) ? rna_operator_execute_cb : NULL;
- dummyot.check = (have_function[2]) ? rna_operator_check_cb : NULL;
- dummyot.invoke = (have_function[3]) ? rna_operator_invoke_cb : NULL;
- dummyot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL;
- dummyot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL;
- dummyot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL;
- WM_operatortype_append_ptr(BPY_RNA_operator_wrapper, (void *)&dummyot);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
-
- return dummyot.ext.srna;
+static StructRNA *rna_Operator_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ wmOperatorType dummyot = {NULL};
+ wmOperator dummyop = {NULL};
+ PointerRNA dummyotr;
+ int have_function[7];
+
+ struct {
+ char idname[OP_MAX_TYPENAME];
+ char name[OP_MAX_TYPENAME];
+ char description[RNA_DYN_DESCR_MAX];
+ char translation_context[RNA_DYN_DESCR_MAX];
+ char undo_group[OP_MAX_TYPENAME];
+ } temp_buffers;
+
+ /* setup dummy operator & operator type to store static properties in */
+ dummyop.type = &dummyot;
+ dummyot.idname = temp_buffers.idname; /* only assigne the pointer, string is NULL'd */
+ dummyot.name = temp_buffers.name; /* only assigne the pointer, string is NULL'd */
+ dummyot.description = temp_buffers.description; /* only assigne the pointer, string is NULL'd */
+ dummyot.translation_context =
+ temp_buffers.translation_context; /* only assigne the pointer, string is NULL'd */
+ dummyot.undo_group = temp_buffers.undo_group; /* only assigne the pointer, string is NULL'd */
+ RNA_pointer_create(NULL, &RNA_Operator, &dummyop, &dummyotr);
+
+ /* clear in case they are left unset */
+ temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
+ temp_buffers.undo_group[0] = '\0';
+ /* We have to set default op context! */
+ strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+
+ /* validate the python class */
+ if (validate(&dummyotr, data, have_function) != 0)
+ return NULL;
+
+ /* check if we have registered this operator type before, and remove it */
+ {
+ wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
+ if (ot && ot->ext.srna)
+ rna_Operator_unregister(bmain, ot->ext.srna);
+ }
+
+ if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
+ return NULL;
+ }
+
+ char idname_conv[sizeof(dummyop.idname)];
+ WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
+
+ if (!RNA_struct_available_or_report(reports, idname_conv)) {
+ return NULL;
+ }
+
+ /* Convert foo.bar to FOO_OT_bar
+ * allocate all strings at once. */
+ {
+ const char *strings[] = {
+ idname_conv,
+ temp_buffers.name,
+ temp_buffers.description,
+ temp_buffers.translation_context,
+ temp_buffers.undo_group,
+ };
+ char *strings_table[ARRAY_SIZE(strings)];
+ BLI_string_join_array_by_sep_char_with_tableN(
+ '\0', strings_table, strings, ARRAY_SIZE(strings));
+
+ dummyot.idname = strings_table[0]; /* allocated string stored here */
+ dummyot.name = strings_table[1];
+ dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
+ dummyot.translation_context = strings_table[3];
+ dummyot.undo_group = strings_table[4];
+ BLI_assert(ARRAY_SIZE(strings) == 5);
+ }
+
+ /* XXX, this doubles up with the operator name [#29666]
+ * for now just remove from dir(bpy.types) */
+
+ /* create a new operator type */
+ dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
+ RNA_def_struct_flag(dummyot.ext.srna,
+ STRUCT_NO_IDPROPERTIES); /* operator properties are registered separately */
+ RNA_def_struct_property_tags(dummyot.ext.srna, rna_enum_operator_property_tags);
+ RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
+ dummyot.ext.data = data;
+ dummyot.ext.call = call;
+ dummyot.ext.free = free;
+
+ dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
+ dummyot.exec = (have_function[1]) ? rna_operator_execute_cb : NULL;
+ dummyot.check = (have_function[2]) ? rna_operator_check_cb : NULL;
+ dummyot.invoke = (have_function[3]) ? rna_operator_invoke_cb : NULL;
+ dummyot.modal = (have_function[4]) ? rna_operator_modal_cb : NULL;
+ dummyot.ui = (have_function[5]) ? rna_operator_draw_cb : NULL;
+ dummyot.cancel = (have_function[6]) ? rna_operator_cancel_cb : NULL;
+ WM_operatortype_append_ptr(BPY_RNA_operator_wrapper, (void *)&dummyot);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+
+ return dummyot.ext.srna;
}
static void rna_Operator_unregister(struct Main *bmain, StructRNA *type)
{
- const char *idname;
- wmOperatorType *ot = RNA_struct_blender_type_get(type);
- wmWindowManager *wm;
+ const char *idname;
+ wmOperatorType *ot = RNA_struct_blender_type_get(type);
+ wmWindowManager *wm;
- if (!ot)
- return;
+ if (!ot)
+ return;
- /* update while blender is running */
- wm = bmain->wm.first;
- if (wm) {
- WM_operator_stack_clear(wm);
+ /* update while blender is running */
+ wm = bmain->wm.first;
+ if (wm) {
+ WM_operator_stack_clear(wm);
- WM_operator_handlers_clear(wm, ot);
- }
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+ WM_operator_handlers_clear(wm, ot);
+ }
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
- RNA_struct_free_extension(type, &ot->ext);
+ RNA_struct_free_extension(type, &ot->ext);
- idname = ot->idname;
- WM_operatortype_remove_ptr(ot);
+ idname = ot->idname;
+ WM_operatortype_remove_ptr(ot);
- /* not to be confused with the RNA_struct_free that WM_operatortype_remove calls, they are 2 different srna's */
- RNA_struct_free(&BLENDER_RNA, type);
+ /* not to be confused with the RNA_struct_free that WM_operatortype_remove calls, they are 2 different srna's */
+ RNA_struct_free(&BLENDER_RNA, type);
- MEM_freeN((void *)idname);
+ MEM_freeN((void *)idname);
}
static void **rna_Operator_instance(PointerRNA *ptr)
{
- wmOperator *op = ptr->data;
- return &op->py_instance;
-}
-
-static StructRNA *rna_MacroOperator_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
-{
- wmOperatorType dummyot = {NULL};
- wmOperator dummyop = {NULL};
- PointerRNA dummyotr;
- int have_function[4];
-
- struct {
- char idname[OP_MAX_TYPENAME];
- char name[OP_MAX_TYPENAME];
- char description[RNA_DYN_DESCR_MAX];
- char translation_context[RNA_DYN_DESCR_MAX];
- char undo_group[OP_MAX_TYPENAME];
- } temp_buffers;
-
- /* setup dummy operator & operator type to store static properties in */
- dummyop.type = &dummyot;
- dummyot.idname = temp_buffers.idname; /* only assigne the pointer, string is NULL'd */
- dummyot.name = temp_buffers.name; /* only assigne the pointer, string is NULL'd */
- dummyot.description = temp_buffers.description; /* only assigne the pointer, string is NULL'd */
- dummyot.translation_context = temp_buffers.translation_context; /* only assigne the pointer, string is NULL'd */
- dummyot.undo_group = temp_buffers.undo_group; /* only assigne the pointer, string is NULL'd */
- RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr);
-
- /* clear in case they are left unset */
- temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] = temp_buffers.undo_group[0] = '\0';
- /* We have to set default op context! */
- strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
-
- /* validate the python class */
- if (validate(&dummyotr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(dummyop.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering operator class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(dummyop.idname));
- return NULL;
- }
-
- /* check if we have registered this operator type before, and remove it */
- {
- wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
- if (ot && ot->ext.srna)
- rna_Operator_unregister(bmain, ot->ext.srna);
- }
-
- if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
- return NULL;
- }
-
- char idname_conv[sizeof(dummyop.idname)];
- WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
-
- if (!RNA_struct_available_or_report(reports, idname_conv)) {
- return NULL;
- }
-
- /* Convert foo.bar to FOO_OT_bar
- * allocate all strings at once. */
- {
- const char *strings[] = {
- idname_conv,
- temp_buffers.name,
- temp_buffers.description,
- temp_buffers.translation_context,
- temp_buffers.undo_group,
- };
- char *strings_table[ARRAY_SIZE(strings)];
- BLI_string_join_array_by_sep_char_with_tableN('\0', strings_table, strings, ARRAY_SIZE(strings));
-
- dummyot.idname = strings_table[0]; /* allocated string stored here */
- dummyot.name = strings_table[1];
- dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
- dummyot.translation_context = strings_table[3];
- dummyot.undo_group = strings_table[4];
- BLI_assert(ARRAY_SIZE(strings) == 5);
- }
-
- /* XXX, this doubles up with the operator name [#29666]
- * for now just remove from dir(bpy.types) */
-
- /* create a new operator type */
- dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
- RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
- dummyot.ext.data = data;
- dummyot.ext.call = call;
- dummyot.ext.free = free;
-
- dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
- dummyot.ui = (have_function[3]) ? rna_operator_draw_cb : NULL;
-
- WM_operatortype_append_macro_ptr(BPY_RNA_operator_macro_wrapper, (void *)&dummyot);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
-
- return dummyot.ext.srna;
-}
-#endif /* WITH_PYTHON */
+ wmOperator *op = ptr->data;
+ return &op->py_instance;
+}
+
+static StructRNA *rna_MacroOperator_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
+{
+ wmOperatorType dummyot = {NULL};
+ wmOperator dummyop = {NULL};
+ PointerRNA dummyotr;
+ int have_function[4];
+
+ struct {
+ char idname[OP_MAX_TYPENAME];
+ char name[OP_MAX_TYPENAME];
+ char description[RNA_DYN_DESCR_MAX];
+ char translation_context[RNA_DYN_DESCR_MAX];
+ char undo_group[OP_MAX_TYPENAME];
+ } temp_buffers;
+
+ /* setup dummy operator & operator type to store static properties in */
+ dummyop.type = &dummyot;
+ dummyot.idname = temp_buffers.idname; /* only assigne the pointer, string is NULL'd */
+ dummyot.name = temp_buffers.name; /* only assigne the pointer, string is NULL'd */
+ dummyot.description = temp_buffers.description; /* only assigne the pointer, string is NULL'd */
+ dummyot.translation_context =
+ temp_buffers.translation_context; /* only assigne the pointer, string is NULL'd */
+ dummyot.undo_group = temp_buffers.undo_group; /* only assigne the pointer, string is NULL'd */
+ RNA_pointer_create(NULL, &RNA_Macro, &dummyop, &dummyotr);
+
+ /* clear in case they are left unset */
+ temp_buffers.idname[0] = temp_buffers.name[0] = temp_buffers.description[0] =
+ temp_buffers.undo_group[0] = '\0';
+ /* We have to set default op context! */
+ strcpy(temp_buffers.translation_context, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+
+ /* validate the python class */
+ if (validate(&dummyotr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(dummyop.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering operator class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(dummyop.idname));
+ return NULL;
+ }
+
+ /* check if we have registered this operator type before, and remove it */
+ {
+ wmOperatorType *ot = WM_operatortype_find(dummyot.idname, true);
+ if (ot && ot->ext.srna)
+ rna_Operator_unregister(bmain, ot->ext.srna);
+ }
+
+ if (!WM_operator_py_idname_ok_or_report(reports, identifier, dummyot.idname)) {
+ return NULL;
+ }
+
+ char idname_conv[sizeof(dummyop.idname)];
+ WM_operator_bl_idname(idname_conv, dummyot.idname); /* convert the idname from python */
+
+ if (!RNA_struct_available_or_report(reports, idname_conv)) {
+ return NULL;
+ }
+
+ /* Convert foo.bar to FOO_OT_bar
+ * allocate all strings at once. */
+ {
+ const char *strings[] = {
+ idname_conv,
+ temp_buffers.name,
+ temp_buffers.description,
+ temp_buffers.translation_context,
+ temp_buffers.undo_group,
+ };
+ char *strings_table[ARRAY_SIZE(strings)];
+ BLI_string_join_array_by_sep_char_with_tableN(
+ '\0', strings_table, strings, ARRAY_SIZE(strings));
+
+ dummyot.idname = strings_table[0]; /* allocated string stored here */
+ dummyot.name = strings_table[1];
+ dummyot.description = *strings_table[2] ? strings_table[2] : NULL;
+ dummyot.translation_context = strings_table[3];
+ dummyot.undo_group = strings_table[4];
+ BLI_assert(ARRAY_SIZE(strings) == 5);
+ }
+
+ /* XXX, this doubles up with the operator name [#29666]
+ * for now just remove from dir(bpy.types) */
+
+ /* create a new operator type */
+ dummyot.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummyot.idname, &RNA_Operator);
+ RNA_def_struct_translation_context(dummyot.ext.srna, dummyot.translation_context);
+ dummyot.ext.data = data;
+ dummyot.ext.call = call;
+ dummyot.ext.free = free;
+
+ dummyot.pyop_poll = (have_function[0]) ? rna_operator_poll_cb : NULL;
+ dummyot.ui = (have_function[3]) ? rna_operator_draw_cb : NULL;
+
+ WM_operatortype_append_macro_ptr(BPY_RNA_operator_macro_wrapper, (void *)&dummyot);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+
+ return dummyot.ext.srna;
+}
+# endif /* WITH_PYTHON */
static StructRNA *rna_Operator_refine(PointerRNA *opr)
{
- wmOperator *op = (wmOperator *)opr->data;
- return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Operator;
+ wmOperator *op = (wmOperator *)opr->data;
+ return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Operator;
}
static StructRNA *rna_MacroOperator_refine(PointerRNA *opr)
{
- wmOperator *op = (wmOperator *)opr->data;
- return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Macro;
+ wmOperator *op = (wmOperator *)opr->data;
+ return (op->type && op->type->ext.srna) ? op->type->ext.srna : &RNA_Macro;
}
/* just to work around 'const char *' warning and to ensure this is a python op */
static void rna_Operator_bl_idname_set(PointerRNA *ptr, const char *value)
{
- wmOperator *data = (wmOperator *)(ptr->data);
- char *str = (char *)data->type->idname;
- if (!str[0])
- BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
- else
- assert(!"setting the bl_idname on a non-builtin operator");
+ wmOperator *data = (wmOperator *)(ptr->data);
+ char *str = (char *)data->type->idname;
+ if (!str[0])
+ BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_idname on a non-builtin operator");
}
static void rna_Operator_bl_label_set(PointerRNA *ptr, const char *value)
{
- wmOperator *data = (wmOperator *)(ptr->data);
- char *str = (char *)data->type->name;
- if (!str[0])
- BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
- else
- assert(!"setting the bl_label on a non-builtin operator");
+ wmOperator *data = (wmOperator *)(ptr->data);
+ char *str = (char *)data->type->name;
+ if (!str[0])
+ BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_label on a non-builtin operator");
}
static void rna_Operator_bl_translation_context_set(PointerRNA *ptr, const char *value)
{
- wmOperator *data = (wmOperator *)(ptr->data);
- char *str = (char *)data->type->translation_context;
- if (!str[0])
- BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
- else
- assert(!"setting the bl_translation_context on a non-builtin operator");
+ wmOperator *data = (wmOperator *)(ptr->data);
+ char *str = (char *)data->type->translation_context;
+ if (!str[0])
+ BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_translation_context on a non-builtin operator");
}
static void rna_Operator_bl_description_set(PointerRNA *ptr, const char *value)
{
- wmOperator *data = (wmOperator *)(ptr->data);
- char *str = (char *)data->type->description;
- if (!str[0])
- BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
- else
- assert(!"setting the bl_description on a non-builtin operator");
+ wmOperator *data = (wmOperator *)(ptr->data);
+ char *str = (char *)data->type->description;
+ if (!str[0])
+ BLI_strncpy(str, value, RNA_DYN_DESCR_MAX); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_description on a non-builtin operator");
}
static void rna_Operator_bl_undo_group_set(PointerRNA *ptr, const char *value)
{
- wmOperator *data = (wmOperator *)(ptr->data);
- char *str = (char *)data->type->undo_group;
- if (!str[0])
- BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
- else
- assert(!"setting the bl_undo_group on a non-builtin operator");
+ wmOperator *data = (wmOperator *)(ptr->data);
+ char *str = (char *)data->type->undo_group;
+ if (!str[0])
+ BLI_strncpy(str, value, OP_MAX_TYPENAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_undo_group on a non-builtin operator");
}
static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- wmKeyMapItem *kmi = ptr->data;
- WM_keyconfig_update_tag(NULL, kmi);
+ wmKeyMapItem *kmi = ptr->data;
+ WM_keyconfig_update_tag(NULL, kmi);
}
#else /* RNA_RUNTIME */
@@ -1672,917 +1732,961 @@ static void rna_KeyMapItem_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Poi
*/
static void rna_def_operator_options_runtime(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "OperatorOptions", NULL);
- RNA_def_struct_ui_text(srna, "Operator Options", "Runtime options");
- RNA_def_struct_sdna(srna, "wmOperator");
+ srna = RNA_def_struct(brna, "OperatorOptions", NULL);
+ RNA_def_struct_ui_text(srna, "Operator Options", "Runtime options");
+ RNA_def_struct_sdna(srna, "wmOperator");
- prop = RNA_def_property(srna, "is_grab_cursor", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_GRAB_CURSOR);
- RNA_def_property_ui_text(prop, "Grab Cursor", "True when the cursor is grabbed");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "is_grab_cursor", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_GRAB_CURSOR);
+ RNA_def_property_ui_text(prop, "Grab Cursor", "True when the cursor is grabbed");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "is_invoke", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_INVOKE);
- RNA_def_property_ui_text(prop, "Invoke", "True when invoked (even if only the execute callbacks available)");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "is_invoke", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_INVOKE);
+ RNA_def_property_ui_text(
+ prop, "Invoke", "True when invoked (even if only the execute callbacks available)");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_REPEAT);
- RNA_def_property_ui_text(prop, "Repeat", "True when run from the redo panel");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ prop = RNA_def_property(srna, "is_repeat", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_REPEAT);
+ RNA_def_property_ui_text(prop, "Repeat", "True when run from the redo panel");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_CURSOR_REGION);
- RNA_def_property_ui_text(prop, "Focus Region", "Enable to use the region under the cursor for modal execution");
+ prop = RNA_def_property(srna, "use_cursor_region", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", OP_IS_MODAL_CURSOR_REGION);
+ RNA_def_property_ui_text(
+ prop, "Focus Region", "Enable to use the region under the cursor for modal execution");
}
static void rna_def_operator(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Operator", NULL);
- RNA_def_struct_ui_text(srna, "Operator", "Storage of an operator being executed, or registered after execution");
- RNA_def_struct_sdna(srna, "wmOperator");
- RNA_def_struct_refine_func(srna, "rna_Operator_refine");
-#ifdef WITH_PYTHON
- RNA_def_struct_register_funcs(srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
-#endif
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
- RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "");
-
- prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "OperatorProperties");
- RNA_def_property_ui_text(prop, "Properties", "");
- RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
-
- prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
- RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
- RNA_def_property_ui_text(prop, "Has Reports",
- "Operator has a set of reports (warnings and errors) from last execution");
-
- prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "UILayout");
-
- prop = RNA_def_property(srna, "options", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "OperatorOptions");
- RNA_def_property_pointer_funcs(prop, "rna_Operator_options_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Options", "Runtime options");
-
- /* Registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
- RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME - 3);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->name");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
- RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->description");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
- RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->flag");
- RNA_def_property_enum_items(prop, operator_flag_items);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
-
- prop = RNA_def_property(srna, "macros", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "macro", NULL);
- RNA_def_property_struct_type(prop, "Macro");
- RNA_def_property_ui_text(prop, "Macros", "");
-
- RNA_api_operator(srna);
-
- srna = RNA_def_struct(brna, "OperatorProperties", NULL);
- RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
- RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
- RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
- RNA_def_struct_property_tags(srna, rna_enum_operator_property_tags);
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Operator", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Operator", "Storage of an operator being executed, or registered after execution");
+ RNA_def_struct_sdna(srna, "wmOperator");
+ RNA_def_struct_refine_func(srna, "rna_Operator_refine");
+# ifdef WITH_PYTHON
+ RNA_def_struct_register_funcs(
+ srna, "rna_Operator_register", "rna_Operator_unregister", "rna_Operator_instance");
+# endif
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "");
+
+ prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "OperatorProperties");
+ RNA_def_property_ui_text(prop, "Properties", "");
+ RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
+ RNA_def_property_boolean_funcs(prop, "rna_Operator_has_reports_get", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Has Reports",
+ "Operator has a set of reports (warnings and errors) from last execution");
+
+ prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "UILayout");
+
+ prop = RNA_def_property(srna, "options", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "OperatorOptions");
+ RNA_def_property_pointer_funcs(prop, "rna_Operator_options_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Options", "Runtime options");
+
+ /* Registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ /* else it uses the pointer size!. -3 because '.' -> '_OT_' */
+ RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME - 3);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->name");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
+ RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->description");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
+ RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->flag");
+ RNA_def_property_enum_items(prop, operator_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
+
+ prop = RNA_def_property(srna, "macros", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "macro", NULL);
+ RNA_def_property_struct_type(prop, "Macro");
+ RNA_def_property_ui_text(prop, "Macros", "");
+
+ RNA_api_operator(srna);
+
+ srna = RNA_def_struct(brna, "OperatorProperties", NULL);
+ RNA_def_struct_ui_text(srna, "Operator Properties", "Input properties of an Operator");
+ RNA_def_struct_refine_func(srna, "rna_OperatorProperties_refine");
+ RNA_def_struct_idprops_func(srna, "rna_OperatorProperties_idprops");
+ RNA_def_struct_property_tags(srna, rna_enum_operator_property_tags);
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
static void rna_def_macro_operator(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Macro", NULL);
- RNA_def_struct_ui_text(srna, "Macro Operator",
- "Storage of a macro operator being executed, or registered after execution");
- RNA_def_struct_sdna(srna, "wmOperator");
- RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
-#ifdef WITH_PYTHON
- RNA_def_struct_register_funcs(srna, "rna_MacroOperator_register", "rna_Operator_unregister",
- "rna_Operator_instance");
-#endif
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
- RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "");
-
- prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "OperatorProperties");
- RNA_def_property_ui_text(prop, "Properties", "");
- RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
-
- /* Registration */
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->name");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
- RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->description");
- RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
- RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
- RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
-
- prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->flag");
- RNA_def_property_enum_items(prop, operator_flag_items);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
-
- RNA_api_macro(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Macro", NULL);
+ RNA_def_struct_ui_text(
+ srna,
+ "Macro Operator",
+ "Storage of a macro operator being executed, or registered after execution");
+ RNA_def_struct_sdna(srna, "wmOperator");
+ RNA_def_struct_refine_func(srna, "rna_MacroOperator_refine");
+# ifdef WITH_PYTHON
+ RNA_def_struct_register_funcs(
+ srna, "rna_MacroOperator_register", "rna_Operator_unregister", "rna_Operator_instance");
+# endif
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ RNA_def_struct_flag(srna, STRUCT_PUBLIC_NAMESPACE_INHERIT);
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Operator_name_get", "rna_Operator_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "");
+
+ prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "OperatorProperties");
+ RNA_def_property_ui_text(prop, "Properties", "");
+ RNA_def_property_pointer_funcs(prop, "rna_Operator_properties_get", NULL, NULL, NULL);
+
+ /* Registration */
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_idname_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->name");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_label_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ prop = RNA_def_property(srna, "bl_translation_context", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->translation_context");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_translation_context_set");
+ RNA_def_property_string_default(prop, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_description", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->description");
+ RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_description_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_undo_group", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->undo_group");
+ RNA_def_property_string_maxlength(prop, OP_MAX_TYPENAME); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Operator_bl_undo_group_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+ RNA_def_property_clear_flag(prop, PROP_NEVER_NULL); /* check for NULL */
+
+ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->flag");
+ RNA_def_property_enum_items(prop, operator_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
+
+ RNA_api_macro(srna);
}
static void rna_def_operator_type_macro(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "OperatorMacro", NULL);
- RNA_def_struct_ui_text(srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
- RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
+ srna = RNA_def_struct(brna, "OperatorMacro", NULL);
+ RNA_def_struct_ui_text(
+ srna, "Operator Macro", "Storage of a sub operator in a macro after it has been added");
+ RNA_def_struct_sdna(srna, "wmOperatorTypeMacro");
-/* prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
-/* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
-/* RNA_def_property_string_sdna(prop, NULL, "idname"); */
-/* RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); */
-/* RNA_def_struct_name_property(srna, prop); */
+ /* prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); */
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ /* RNA_def_property_string_sdna(prop, NULL, "idname"); */
+ /* RNA_def_property_ui_text(prop, "Name", "Name of the sub operator"); */
+ /* RNA_def_struct_name_property(srna, prop); */
- prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "OperatorProperties");
- RNA_def_property_ui_text(prop, "Properties", "");
- RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL);
+ prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "OperatorProperties");
+ RNA_def_property_ui_text(prop, "Properties", "");
+ RNA_def_property_pointer_funcs(prop, "rna_OperatorMacro_properties_get", NULL, NULL, NULL);
}
static void rna_def_operator_utils(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
- RNA_def_struct_ui_text(srna, "Operator Mouse Path", "Mouse path values for operators that record such paths");
+ srna = RNA_def_struct(brna, "OperatorMousePath", "PropertyGroup");
+ RNA_def_struct_ui_text(
+ srna, "Operator Mouse Path", "Mouse path values for operators that record such paths");
- prop = RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_array(prop, 2);
- RNA_def_property_ui_text(prop, "Location", "Mouse location");
+ prop = RNA_def_property(srna, "loc", PROP_FLOAT, PROP_XYZ);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_ui_text(prop, "Location", "Mouse location");
- prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Time", "Time of mouse location");
+ prop = RNA_def_property(srna, "time", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Time", "Time of mouse location");
}
static void rna_def_operator_filelist_element(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
- RNA_def_struct_ui_text(srna, "Operator File List Element", "");
+ StructRNA *srna;
+ PropertyRNA *prop;
+ srna = RNA_def_struct(brna, "OperatorFileListElement", "PropertyGroup");
+ RNA_def_struct_ui_text(srna, "Operator File List Element", "");
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
- RNA_def_property_flag(prop, PROP_IDPROPERTY);
- RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_FILENAME);
+ RNA_def_property_flag(prop, PROP_IDPROPERTY);
+ RNA_def_property_ui_text(prop, "Name", "Name of a file or directory within a file list");
}
static void rna_def_event(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Event", NULL);
- RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
- RNA_def_struct_sdna(srna, "wmEvent");
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- /* strings */
- prop = RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL);
- RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event");
-
-
- prop = RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_Event_unicode_get", "rna_Event_unicode_length", NULL);
- RNA_def_property_ui_text(prop, "Unicode", "Single unicode character for this event");
-
- /* enums */
- prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "val");
- RNA_def_property_enum_items(prop, rna_enum_event_value_items);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- RNA_def_property_enum_items(prop, rna_enum_event_type_items);
- RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Type", "");
-
-
- /* mouse */
- prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "x");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse X Position", "The window relative horizontal location of the mouse");
-
- prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "y");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse Y Position", "The window relative vertical location of the mouse");
-
- prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mval[0]");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse X Position", "The region relative horizontal location of the mouse");
-
- prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "mval[1]");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse Y Position", "The region relative vertical location of the mouse");
-
- prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "prevx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse Previous X Position", "The window relative horizontal location of the mouse");
-
- prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "prevy");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse");
-
- prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
-
- prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_XYZ_LENGTH);
- RNA_def_property_array(prop, 2);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_float_funcs(prop, "rna_Event_tilt_get", NULL, NULL);
- RNA_def_property_ui_text(prop, "Tablet Tilt", "The pressure of the tablet or zeroes if no tablet present");
-
- prop = RNA_def_property(srna, "is_tablet", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Event_is_tablet_get", NULL);
- RNA_def_property_ui_text(prop, "Is Tablet", "The event has tablet data");
-
- prop = RNA_def_property(srna, "is_mouse_absolute", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "is_motion_absolute", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Absolute Motion", "The last motion event was an absolute input");
-
- /* modifiers */
- prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held");
-
- prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held");
-
- prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "alt", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held");
-
- prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held");
-
- RNA_define_verify_sdna(1); /* not in sdna */
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Event", NULL);
+ RNA_def_struct_ui_text(srna, "Event", "Window Manager Event");
+ RNA_def_struct_sdna(srna, "wmEvent");
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ /* strings */
+ prop = RNA_def_property(srna, "ascii", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Event_ascii_get", "rna_Event_ascii_length", NULL);
+ RNA_def_property_ui_text(prop, "ASCII", "Single ASCII character for this event");
+
+ prop = RNA_def_property(srna, "unicode", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(prop, "rna_Event_unicode_get", "rna_Event_unicode_length", NULL);
+ RNA_def_property_ui_text(prop, "Unicode", "Single unicode character for this event");
+
+ /* enums */
+ prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "val");
+ RNA_def_property_enum_items(prop, rna_enum_event_value_items);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Value", "The type of event, only applies to some");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ RNA_def_property_enum_items(prop, rna_enum_event_type_items);
+ RNA_def_property_translation_context(prop, BLT_I18NCONTEXT_UI_EVENTS);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Type", "");
+
+ /* mouse */
+ prop = RNA_def_property(srna, "mouse_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "x");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Mouse X Position", "The window relative horizontal location of the mouse");
+
+ prop = RNA_def_property(srna, "mouse_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "y");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Mouse Y Position", "The window relative vertical location of the mouse");
+
+ prop = RNA_def_property(srna, "mouse_region_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mval[0]");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Mouse X Position", "The region relative horizontal location of the mouse");
+
+ prop = RNA_def_property(srna, "mouse_region_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "mval[1]");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Mouse Y Position", "The region relative vertical location of the mouse");
+
+ prop = RNA_def_property(srna, "mouse_prev_x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "prevx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Mouse Previous X Position", "The window relative horizontal location of the mouse");
+
+ prop = RNA_def_property(srna, "mouse_prev_y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "prevy");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "Mouse Previous Y Position", "The window relative vertical location of the mouse");
+
+ prop = RNA_def_property(srna, "pressure", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_Event_pressure_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Tablet Pressure", "The pressure of the tablet or 1.0 if no tablet present");
+
+ prop = RNA_def_property(srna, "tilt", PROP_FLOAT, PROP_XYZ_LENGTH);
+ RNA_def_property_array(prop, 2);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_float_funcs(prop, "rna_Event_tilt_get", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Tablet Tilt", "The pressure of the tablet or zeroes if no tablet present");
+
+ prop = RNA_def_property(srna, "is_tablet", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_boolean_funcs(prop, "rna_Event_is_tablet_get", NULL);
+ RNA_def_property_ui_text(prop, "Is Tablet", "The event has tablet data");
+
+ prop = RNA_def_property(srna, "is_mouse_absolute", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "is_motion_absolute", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Absolute Motion", "The last motion event was an absolute input");
+
+ /* modifiers */
+ prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shift", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Shift", "True when the Shift key is held");
+
+ prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Ctrl", "True when the Ctrl key is held");
+
+ prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "alt", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Alt", "True when the Alt/Option key is held");
+
+ prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "oskey", 1);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "OS Key", "True when the Cmd key is held");
+
+ RNA_define_verify_sdna(1); /* not in sdna */
}
static void rna_def_timer(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "Timer", NULL);
- RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
- RNA_def_struct_sdna(srna, "wmTimer");
+ srna = RNA_def_struct(brna, "Timer", NULL);
+ RNA_def_struct_ui_text(srna, "Timer", "Window event timer");
+ RNA_def_struct_sdna(srna, "wmTimer");
- RNA_define_verify_sdna(0); /* not in sdna */
+ RNA_define_verify_sdna(0); /* not in sdna */
- /* could wrap more, for now this is enough */
- prop = RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "timestep");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Time Step", "");
+ /* could wrap more, for now this is enough */
+ prop = RNA_def_property(srna, "time_step", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "timestep");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Time Step", "");
- prop = RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "delta");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
+ prop = RNA_def_property(srna, "time_delta", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "delta");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
- prop = RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "duration");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
+ prop = RNA_def_property(srna, "time_duration", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "duration");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Delta", "Time since last step in seconds");
- RNA_define_verify_sdna(1); /* not in sdna */
+ RNA_define_verify_sdna(1); /* not in sdna */
}
-static void rna_def_popup_menu_wrapper(
- BlenderRNA *brna, const char *rna_type, const char *c_type, const char *layout_get_fn)
+static void rna_def_popup_menu_wrapper(BlenderRNA *brna,
+ const char *rna_type,
+ const char *c_type,
+ const char *layout_get_fn)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, rna_type, NULL);
- /* UI name isn't visible, name same as type. */
- RNA_def_struct_ui_text(srna, rna_type, "");
- RNA_def_struct_sdna(srna, c_type);
+ srna = RNA_def_struct(brna, rna_type, NULL);
+ /* UI name isn't visible, name same as type. */
+ RNA_def_struct_ui_text(srna, rna_type, "");
+ RNA_def_struct_sdna(srna, c_type);
- RNA_define_verify_sdna(0); /* not in sdna */
+ RNA_define_verify_sdna(0); /* not in sdna */
- /* could wrap more, for now this is enough */
- prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "UILayout");
- RNA_def_property_pointer_funcs(prop, layout_get_fn,
- NULL, NULL, NULL);
+ /* could wrap more, for now this is enough */
+ prop = RNA_def_property(srna, "layout", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "UILayout");
+ RNA_def_property_pointer_funcs(prop, layout_get_fn, NULL, NULL, NULL);
- RNA_define_verify_sdna(1); /* not in sdna */
+ RNA_define_verify_sdna(1); /* not in sdna */
}
static void rna_def_popupmenu(BlenderRNA *brna)
{
- rna_def_popup_menu_wrapper(brna, "UIPopupMenu", "uiPopupMenu", "rna_PopupMenu_layout_get");
+ rna_def_popup_menu_wrapper(brna, "UIPopupMenu", "uiPopupMenu", "rna_PopupMenu_layout_get");
}
static void rna_def_popovermenu(BlenderRNA *brna)
{
- rna_def_popup_menu_wrapper(brna, "UIPopover", "uiPopover", "rna_PopoverMenu_layout_get");
+ rna_def_popup_menu_wrapper(brna, "UIPopover", "uiPopover", "rna_PopoverMenu_layout_get");
}
static void rna_def_piemenu(BlenderRNA *brna)
{
- rna_def_popup_menu_wrapper(brna, "UIPieMenu", "uiPieMenu", "rna_PieMenu_layout_get");
+ rna_def_popup_menu_wrapper(brna, "UIPieMenu", "uiPieMenu", "rna_PieMenu_layout_get");
}
static void rna_def_window_stereo3d(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "Stereo3dDisplay", NULL);
- RNA_def_struct_sdna(srna, "Stereo3dFormat");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Stereo 3D Display", "Settings for stereo 3D display");
+ srna = RNA_def_struct(brna, "Stereo3dDisplay", NULL);
+ RNA_def_struct_sdna(srna, "Stereo3dFormat");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Stereo 3D Display", "Settings for stereo 3D display");
- prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_stereo3d_display_items);
- RNA_def_property_ui_text(prop, "Display Mode", "");
+ prop = RNA_def_property(srna, "display_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_stereo3d_display_items);
+ RNA_def_property_ui_text(prop, "Display Mode", "");
- prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
- RNA_def_property_ui_text(prop, "Anaglyph Type", "");
+ prop = RNA_def_property(srna, "anaglyph_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_stereo3d_anaglyph_type_items);
+ RNA_def_property_ui_text(prop, "Anaglyph Type", "");
- prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
- RNA_def_property_ui_text(prop, "Interlace Type", "");
+ prop = RNA_def_property(srna, "interlace_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_stereo3d_interlace_type_items);
+ RNA_def_property_ui_text(prop, "Interlace Type", "");
- prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
- RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
+ prop = RNA_def_property(srna, "use_interlace_swap", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_INTERLACE_SWAP);
+ RNA_def_property_ui_text(prop, "Swap Left/Right", "Swap left and right stereo channels");
- prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
- RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
+ prop = RNA_def_property(srna, "use_sidebyside_crosseyed", PROP_BOOLEAN, PROP_BOOLEAN);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", S3D_SIDEBYSIDE_CROSSEYED);
+ RNA_def_property_ui_text(prop, "Cross-Eyed", "Right eye should see left image and vice-versa");
}
static void rna_def_window(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "Window", NULL);
- RNA_def_struct_ui_text(srna, "Window", "Open window");
- RNA_def_struct_sdna(srna, "wmWindow");
-
- prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Parent Window", "Active workspace and scene follow this window");
-
- rna_def_window_stereo3d(brna);
-
- prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_scene_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the window");
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_Window_scene_update");
-
- prop = RNA_def_property(srna, "workspace", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "WorkSpace");
- RNA_def_property_ui_text(prop, "Workspace", "Active workspace showing in the window");
- RNA_def_property_pointer_funcs(prop, "rna_Window_workspace_get", "rna_Window_workspace_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_Window_workspace_update");
-
- prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Screen");
- RNA_def_property_ui_text(prop, "Screen", "Active workspace screen showing in the window");
- RNA_def_property_pointer_funcs(prop, "rna_Window_screen_get", "rna_Window_screen_set", NULL,
- "rna_Window_screen_assign_poll");
- RNA_def_property_flag(prop, PROP_NEVER_NULL | PROP_EDITABLE | PROP_CONTEXT_UPDATE);
- RNA_def_property_update(prop, 0, "rna_workspace_screen_update");
-
- prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_pointer_funcs(prop, "rna_Window_view_layer_get", "rna_Window_view_layer_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Active View Layer", "The active workspace view layer showing in the window");
- RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
- RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL);
-
- prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "posx");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "X Position", "Horizontal location of the window");
-
- prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "posy");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Y Position", "Vertical location of the window");
-
- prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "sizex");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Width", "Window width");
-
- prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "sizey");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Height", "Window height");
-
- prop = RNA_def_property(srna, "stereo_3d_display", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "Stereo3dDisplay");
- RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3d display");
-
- RNA_api_window(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "Window", NULL);
+ RNA_def_struct_ui_text(srna, "Window", "Open window");
+ RNA_def_struct_sdna(srna, "wmWindow");
+
+ prop = RNA_def_property(srna, "parent", PROP_POINTER, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Parent Window", "Active workspace and scene follow this window");
+
+ rna_def_window_stereo3d(brna);
+
+ prop = RNA_def_property(srna, "scene", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_pointer_funcs(prop, NULL, "rna_Window_scene_set", NULL, NULL);
+ RNA_def_property_ui_text(prop, "Scene", "Active scene to be edited in the window");
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_Window_scene_update");
+
+ prop = RNA_def_property(srna, "workspace", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "WorkSpace");
+ RNA_def_property_ui_text(prop, "Workspace", "Active workspace showing in the window");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Window_workspace_get", "rna_Window_workspace_set", NULL, NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_Window_workspace_update");
+
+ prop = RNA_def_property(srna, "screen", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Screen");
+ RNA_def_property_ui_text(prop, "Screen", "Active workspace screen showing in the window");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_Window_screen_get",
+ "rna_Window_screen_set",
+ NULL,
+ "rna_Window_screen_assign_poll");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL | PROP_EDITABLE | PROP_CONTEXT_UPDATE);
+ RNA_def_property_update(prop, 0, "rna_workspace_screen_update");
+
+ prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "ViewLayer");
+ RNA_def_property_pointer_funcs(
+ prop, "rna_Window_view_layer_get", "rna_Window_view_layer_set", NULL, NULL);
+ RNA_def_property_ui_text(
+ prop, "Active View Layer", "The active workspace view layer showing in the window");
+ RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
+ RNA_def_property_update(prop, NC_SCREEN | ND_LAYER, NULL);
+
+ prop = RNA_def_property(srna, "x", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "posx");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "X Position", "Horizontal location of the window");
+
+ prop = RNA_def_property(srna, "y", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "posy");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Y Position", "Vertical location of the window");
+
+ prop = RNA_def_property(srna, "width", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "sizex");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Width", "Window width");
+
+ prop = RNA_def_property(srna, "height", PROP_INT, PROP_UNSIGNED);
+ RNA_def_property_int_sdna(prop, NULL, "sizey");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Height", "Window height");
+
+ prop = RNA_def_property(srna, "stereo_3d_display", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "stereo3d_format");
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "Stereo3dDisplay");
+ RNA_def_property_ui_text(prop, "Stereo 3D Display", "Settings for stereo 3d display");
+
+ RNA_api_window(srna);
}
/* curve.splines */
static void rna_def_wm_keyconfigs(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- RNA_def_property_srna(cprop, "KeyConfigurations");
- srna = RNA_def_struct(brna, "KeyConfigurations", NULL);
- RNA_def_struct_sdna(srna, "wmWindowManager");
- RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
-
- prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_pointer_funcs(prop, "rna_WindowManager_active_keyconfig_get",
- "rna_WindowManager_active_keyconfig_set", NULL, NULL);
- RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
-
- prop = RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration");
-
- prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "Add-on Key Configuration",
- "Key configuration that can be extended by add-ons, and is added to the active "
- "configuration when handling events");
-
- prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "userconf");
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "User Key Configuration",
- "Final key configuration that combines keymaps from the active and add-on configurations, "
- "and can be edited by the user");
-
- RNA_api_keyconfigs(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ RNA_def_property_srna(cprop, "KeyConfigurations");
+ srna = RNA_def_struct(brna, "KeyConfigurations", NULL);
+ RNA_def_struct_sdna(srna, "wmWindowManager");
+ RNA_def_struct_ui_text(srna, "KeyConfigs", "Collection of KeyConfigs");
+
+ prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_pointer_funcs(prop,
+ "rna_WindowManager_active_keyconfig_get",
+ "rna_WindowManager_active_keyconfig_set",
+ NULL,
+ NULL);
+ RNA_def_property_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Active KeyConfig", "Active key configuration (preset)");
+
+ prop = RNA_def_property(srna, "default", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "defaultconf");
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_ui_text(prop, "Default Key Configuration", "Default builtin key configuration");
+
+ prop = RNA_def_property(srna, "addon", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "addonconf");
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_ui_text(
+ prop,
+ "Add-on Key Configuration",
+ "Key configuration that can be extended by add-ons, and is added to the active "
+ "configuration when handling events");
+
+ prop = RNA_def_property(srna, "user", PROP_POINTER, PROP_NEVER_NULL);
+ RNA_def_property_pointer_sdna(prop, NULL, "userconf");
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_ui_text(
+ prop,
+ "User Key Configuration",
+ "Final key configuration that combines keymaps from the active and add-on configurations, "
+ "and can be edited by the user");
+
+ RNA_api_keyconfigs(srna);
}
static void rna_def_windowmanager(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "WindowManager", "ID");
- RNA_def_struct_ui_text(srna, "Window Manager",
- "Window manager data-block defining open windows and other user interface data");
- RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
- RNA_def_struct_sdna(srna, "wmWindowManager");
+ srna = RNA_def_struct(brna, "WindowManager", "ID");
+ RNA_def_struct_ui_text(
+ srna,
+ "Window Manager",
+ "Window manager data-block defining open windows and other user interface data");
+ RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
+ RNA_def_struct_sdna(srna, "wmWindowManager");
- prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Operator");
- RNA_def_property_ui_text(prop, "Operators", "Operator registry");
+ prop = RNA_def_property(srna, "operators", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Operator");
+ RNA_def_property_ui_text(prop, "Operators", "Operator registry");
- prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "Window");
- RNA_def_property_ui_text(prop, "Windows", "Open windows");
+ prop = RNA_def_property(srna, "windows", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Window");
+ RNA_def_property_ui_text(prop, "Windows", "Open windows");
- prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyConfig");
- RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
- rna_def_wm_keyconfigs(brna, prop);
+ prop = RNA_def_property(srna, "keyconfigs", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyConfig");
+ RNA_def_property_ui_text(prop, "Key Configurations", "Registered key configurations");
+ rna_def_wm_keyconfigs(brna, prop);
- prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
- RNA_def_property_ui_text(prop, "Text Clipboard", "");
+ prop = RNA_def_property(srna, "clipboard", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_funcs(
+ prop, "rna_wmClipboard_get", "rna_wmClipboard_length", "rna_wmClipboard_set");
+ RNA_def_property_ui_text(prop, "Text Clipboard", "");
- RNA_api_wm(srna);
+ RNA_api_wm(srna);
}
/* keyconfig.items */
static void rna_def_keymap_items(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- RNA_def_property_srna(cprop, "KeyMapItems");
- srna = RNA_def_struct(brna, "KeyMapItems", NULL);
- RNA_def_struct_sdna(srna, "wmKeyMap");
- RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
+ RNA_def_property_srna(cprop, "KeyMapItems");
+ srna = RNA_def_struct(brna, "KeyMapItems", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyMap");
+ RNA_def_struct_ui_text(srna, "KeyMap Items", "Collection of keymap items");
- RNA_api_keymapitems(srna);
+ RNA_api_keymapitems(srna);
}
static void rna_def_wm_keymaps(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
+ StructRNA *srna;
- RNA_def_property_srna(cprop, "KeyMaps");
- srna = RNA_def_struct(brna, "KeyMaps", NULL);
- RNA_def_struct_sdna(srna, "wmKeyConfig");
- RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
+ RNA_def_property_srna(cprop, "KeyMaps");
+ srna = RNA_def_struct(brna, "KeyMaps", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyConfig");
+ RNA_def_struct_ui_text(srna, "Key Maps", "Collection of keymaps");
- RNA_api_keymaps(srna);
+ RNA_api_keymaps(srna);
}
static void rna_def_keyconfig_prefs(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "KeyConfigPreferences", NULL);
- RNA_def_struct_ui_text(srna, "Key-Config Preferences", "");
- RNA_def_struct_sdna(srna, "wmKeyConfigPref"); /* WARNING: only a bAddon during registration */
+ srna = RNA_def_struct(brna, "KeyConfigPreferences", NULL);
+ RNA_def_struct_ui_text(srna, "Key-Config Preferences", "");
+ RNA_def_struct_sdna(srna, "wmKeyConfigPref"); /* WARNING: only a bAddon during registration */
- RNA_def_struct_refine_func(srna, "rna_wmKeyConfigPref_refine");
- RNA_def_struct_register_funcs(srna, "rna_wmKeyConfigPref_register", "rna_wmKeyConfigPref_unregister", NULL);
- RNA_def_struct_idprops_func(srna, "rna_wmKeyConfigPref_idprops");
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); /* Mandatory! */
+ RNA_def_struct_refine_func(srna, "rna_wmKeyConfigPref_refine");
+ RNA_def_struct_register_funcs(
+ srna, "rna_wmKeyConfigPref_register", "rna_wmKeyConfigPref_unregister", NULL);
+ RNA_def_struct_idprops_func(srna, "rna_wmKeyConfigPref_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES); /* Mandatory! */
- /* registration */
- RNA_define_verify_sdna(0);
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_define_verify_sdna(1);
+ /* registration */
+ RNA_define_verify_sdna(0);
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_define_verify_sdna(1);
}
static void rna_def_keyconfig(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem map_type_items[] = {
- {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
- {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
- {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
- {KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
- {KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
- {KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
- {0, NULL, 0, NULL, NULL},
- };
-
- /* KeyConfig */
- srna = RNA_def_struct(brna, "KeyConfig", NULL);
- RNA_def_struct_sdna(srna, "wmKeyConfig");
- RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_ui_text(prop, "Name", "Name of the key configuration");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyMap");
- RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
- rna_def_wm_keymaps(brna, prop);
-
- prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "User Defined", "Indicates that a keyconfig was defined by the user");
-
- /* Collection active property */
- prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "KeyConfigPreferences");
- RNA_def_property_pointer_funcs(prop, "rna_wmKeyConfig_preferences_get", NULL, NULL, NULL);
-
- RNA_api_keyconfig(srna);
-
- /* KeyMap */
- srna = RNA_def_struct(brna, "KeyMap", NULL);
- RNA_def_struct_sdna(srna, "wmKeyMap");
- RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Name", "Name of the key map");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "owner_id");
- RNA_def_property_ui_text(prop, "Owner", "Internal owner");
-
- prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "spaceid");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with");
-
- prop = RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "regionid");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_region_type_items);
- RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with");
-
- prop = RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "items", NULL);
- RNA_def_property_struct_type(prop, "KeyMapItem");
- RNA_def_property_ui_text(prop, "Items", "Items in the keymap, linking an operator to an input event");
- rna_def_keymap_items(brna, prop);
-
- prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED);
- RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user");
-
- prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Modal Keymap",
- "Indicates that a keymap is used for translate modal events for an operator");
-
- prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
- RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- prop = RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_CHILDREN_EXPANDED);
- RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
-
- RNA_api_keymap(srna);
-
- /* KeyMapItem */
- srna = RNA_def_struct(brna, "KeyMapItem", NULL);
- RNA_def_struct_sdna(srna, "wmKeyMapItem");
- RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map");
-
- prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "idname");
- RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
- RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_idname_get", "rna_wmKeyMapItem_idname_length",
- "rna_wmKeyMapItem_idname_set");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- /* this is in fact the operator name, but if the operator can't be found we
- * fallback on the operator ID */
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Name", "Name of operator (translated) to call on input event");
- RNA_def_property_string_funcs(prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
-
- prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "OperatorProperties");
- RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "maptype");
- RNA_def_property_enum_items(prop, map_type_items);
- RNA_def_property_enum_funcs(prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
- RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type");
- 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, NULL, "rna_KeyMapItem_type_itemf");
- RNA_def_property_ui_text(prop, "Type", "Type of event");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "val");
- RNA_def_property_enum_items(prop, rna_enum_event_value_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
- RNA_def_property_ui_text(prop, "Value", "");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "id");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "ID", "ID of the item");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_get", "rna_KeyMapItem_any_set");
- RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
- RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL);
-/* RNA_def_property_enum_sdna(prop, NULL, "shift"); */
-/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
- RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
- RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL);
-/* RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
-/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
- RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
- RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL);
-/* RNA_def_property_enum_sdna(prop, NULL, "alt"); */
-/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
- RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
- RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL);
-/* RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
-/* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
- RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
- 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_wmKeyMapItem_keymodifier_set", NULL);
- RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED);
- RNA_def_property_ui_text(prop, "Expanded", "Show key map event and property details in the user interface");
- RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
-
- prop = RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "propvalue");
- RNA_def_property_enum_items(prop, rna_enum_keymap_propvalue_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
- RNA_def_property_ui_text(prop, "Property Value", "The value this event translates to in a modal keymap");
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
- RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item");
- RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
- RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
-
- prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user");
-
- prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "User Defined",
- "Is this keymap item user defined (doesn't just replace a builtin item)");
- RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
-
- RNA_api_keymapitem(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem map_type_items[] = {
+ {KMI_TYPE_KEYBOARD, "KEYBOARD", 0, "Keyboard", ""},
+ {KMI_TYPE_TWEAK, "TWEAK", 0, "Tweak", ""},
+ {KMI_TYPE_MOUSE, "MOUSE", 0, "Mouse", ""},
+ {KMI_TYPE_NDOF, "NDOF", 0, "NDOF", ""},
+ {KMI_TYPE_TEXTINPUT, "TEXTINPUT", 0, "Text Input", ""},
+ {KMI_TYPE_TIMER, "TIMER", 0, "Timer", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ /* KeyConfig */
+ srna = RNA_def_struct(brna, "KeyConfig", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyConfig");
+ RNA_def_struct_ui_text(srna, "Key Configuration", "Input configuration, including keymaps");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_ui_text(prop, "Name", "Name of the key configuration");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "keymaps", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyMap");
+ RNA_def_property_ui_text(prop, "Key Maps", "Key maps configured as part of this configuration");
+ rna_def_wm_keymaps(brna, prop);
+
+ prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYCONF_USER);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop, "User Defined", "Indicates that a keyconfig was defined by the user");
+
+ /* Collection active property */
+ prop = RNA_def_property(srna, "preferences", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "KeyConfigPreferences");
+ RNA_def_property_pointer_funcs(prop, "rna_wmKeyConfig_preferences_get", NULL, NULL, NULL);
+
+ RNA_api_keyconfig(srna);
+
+ /* KeyMap */
+ srna = RNA_def_struct(brna, "KeyMap", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyMap");
+ RNA_def_struct_ui_text(srna, "Key Map", "Input configuration, including keymaps");
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Name", "Name of the key map");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "owner_id");
+ RNA_def_property_ui_text(prop, "Owner", "Internal owner");
+
+ prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "spaceid");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_ui_text(prop, "Space Type", "Optional space type keymap is associated with");
+
+ prop = RNA_def_property(srna, "region_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "regionid");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_region_type_items);
+ RNA_def_property_ui_text(prop, "Region Type", "Optional region type keymap is associated with");
+
+ prop = RNA_def_property(srna, "keymap_items", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "items", NULL);
+ RNA_def_property_struct_type(prop, "KeyMapItem");
+ RNA_def_property_ui_text(
+ prop, "Items", "Items in the keymap, linking an operator to an input event");
+ rna_def_keymap_items(brna, prop);
+
+ prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_USER_MODIFIED);
+ RNA_def_property_ui_text(prop, "User Defined", "Keymap is defined by the user");
+
+ prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_MODAL);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "Modal Keymap",
+ "Indicates that a keymap is used for translate modal events for an operator");
+
+ prop = RNA_def_property(srna, "show_expanded_items", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_EXPANDED);
+ RNA_def_property_ui_text(prop, "Items Expanded", "Expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ prop = RNA_def_property(srna, "show_expanded_children", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KEYMAP_CHILDREN_EXPANDED);
+ RNA_def_property_ui_text(prop, "Children Expanded", "Children expanded in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ RNA_api_keymap(srna);
+
+ /* KeyMapItem */
+ srna = RNA_def_struct(brna, "KeyMapItem", NULL);
+ RNA_def_struct_sdna(srna, "wmKeyMapItem");
+ RNA_def_struct_ui_text(srna, "Key Map Item", "Item in a Key Map");
+
+ prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "idname");
+ RNA_def_property_ui_text(prop, "Identifier", "Identifier of operator to call on input event");
+ RNA_def_property_string_funcs(prop,
+ "rna_wmKeyMapItem_idname_get",
+ "rna_wmKeyMapItem_idname_length",
+ "rna_wmKeyMapItem_idname_set");
+ RNA_def_struct_name_property(srna, prop);
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ /* this is in fact the operator name, but if the operator can't be found we
+ * fallback on the operator ID */
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Name", "Name of operator (translated) to call on input event");
+ RNA_def_property_string_funcs(
+ prop, "rna_wmKeyMapItem_name_get", "rna_wmKeyMapItem_name_length", NULL);
+
+ prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "OperatorProperties");
+ RNA_def_property_pointer_funcs(prop, "rna_KeyMapItem_properties_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Properties", "Properties to set when the operator is called");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "map_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "maptype");
+ RNA_def_property_enum_items(prop, map_type_items);
+ RNA_def_property_enum_funcs(
+ prop, "rna_wmKeyMapItem_map_type_get", "rna_wmKeyMapItem_map_type_set", NULL);
+ RNA_def_property_ui_text(prop, "Map Type", "Type of event mapping");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type");
+ 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, NULL, "rna_KeyMapItem_type_itemf");
+ RNA_def_property_ui_text(prop, "Type", "Type of event");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "value", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "val");
+ RNA_def_property_enum_items(prop, rna_enum_event_value_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_value_itemf");
+ RNA_def_property_ui_text(prop, "Value", "");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "id", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "id");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "ID", "ID of the item");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "any", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_any_get", "rna_KeyMapItem_any_set");
+ RNA_def_property_ui_text(prop, "Any", "Any modifier keys pressed");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "shift", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "shift", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_shift_get", NULL);
+ /* RNA_def_property_enum_sdna(prop, NULL, "shift"); */
+ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
+ RNA_def_property_ui_text(prop, "Shift", "Shift key pressed");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "ctrl", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "ctrl", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_ctrl_get", NULL);
+ /* RNA_def_property_enum_sdna(prop, NULL, "ctrl"); */
+ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
+ RNA_def_property_ui_text(prop, "Ctrl", "Control key pressed");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "alt", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "alt", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_alt_get", NULL);
+ /* RNA_def_property_enum_sdna(prop, NULL, "alt"); */
+ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
+ RNA_def_property_ui_text(prop, "Alt", "Alt key pressed");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "oskey", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "oskey", 0);
+ RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_oskey_get", NULL);
+ /* RNA_def_property_enum_sdna(prop, NULL, "oskey"); */
+ /* RNA_def_property_enum_items(prop, keymap_modifiers_items); */
+ RNA_def_property_ui_text(prop, "OS Key", "Operating system key pressed");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "key_modifier", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "keymodifier");
+ 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_wmKeyMapItem_keymodifier_set", NULL);
+ RNA_def_property_ui_text(prop, "Key Modifier", "Regular key pressed as a modifier");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_EXPANDED);
+ RNA_def_property_ui_text(
+ prop, "Expanded", "Show key map event and property details in the user interface");
+ RNA_def_property_ui_icon(prop, ICON_DISCLOSURE_TRI_RIGHT, 1);
+
+ prop = RNA_def_property(srna, "propvalue", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "propvalue");
+ RNA_def_property_enum_items(prop, rna_enum_keymap_propvalue_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_KeyMapItem_propvalue_itemf");
+ RNA_def_property_ui_text(
+ prop, "Property Value", "The value this event translates to in a modal keymap");
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "active", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", KMI_INACTIVE);
+ RNA_def_property_ui_text(prop, "Active", "Activate or deactivate item");
+ RNA_def_property_ui_icon(prop, ICON_CHECKBOX_DEHLT, 1);
+ RNA_def_property_update(prop, 0, "rna_KeyMapItem_update");
+
+ prop = RNA_def_property(srna, "is_user_modified", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", KMI_USER_MODIFIED);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "User Modified", "Is this keymap item modified by the user");
+
+ prop = RNA_def_property(srna, "is_user_defined", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(
+ prop,
+ "User Defined",
+ "Is this keymap item user defined (doesn't just replace a builtin item)");
+ RNA_def_property_boolean_funcs(prop, "rna_KeyMapItem_userdefined_get", NULL);
+
+ RNA_api_keymapitem(srna);
}
void RNA_def_wm(BlenderRNA *brna)
{
- rna_def_operator(brna);
- rna_def_operator_options_runtime(brna);
- rna_def_operator_utils(brna);
- rna_def_operator_filelist_element(brna);
- rna_def_macro_operator(brna);
- rna_def_operator_type_macro(brna);
- rna_def_event(brna);
- rna_def_timer(brna);
- rna_def_popupmenu(brna);
- rna_def_popovermenu(brna);
- rna_def_piemenu(brna);
- rna_def_window(brna);
- rna_def_windowmanager(brna);
- rna_def_keyconfig_prefs(brna);
- rna_def_keyconfig(brna);
+ rna_def_operator(brna);
+ rna_def_operator_options_runtime(brna);
+ rna_def_operator_utils(brna);
+ rna_def_operator_filelist_element(brna);
+ rna_def_macro_operator(brna);
+ rna_def_operator_type_macro(brna);
+ rna_def_event(brna);
+ rna_def_timer(brna);
+ rna_def_popupmenu(brna);
+ rna_def_popovermenu(brna);
+ rna_def_piemenu(brna);
+ rna_def_window(brna);
+ rna_def_windowmanager(brna);
+ rna_def_keyconfig_prefs(brna);
+ rna_def_keyconfig(brna);
}
#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_wm_api.c b/source/blender/makesrna/intern/rna_wm_api.c
index 92cef34cc7c..3e7d16c636e 100644
--- a/source/blender/makesrna/intern/rna_wm_api.c
+++ b/source/blender/makesrna/intern/rna_wm_api.c
@@ -21,7 +21,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
@@ -40,1074 +39,1144 @@
#include "wm_cursors.h"
#include "wm_event_types.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
/* confusingm 2 enums mixed up here */
const EnumPropertyItem rna_enum_window_cursor_items[] = {
- {CURSOR_STD, "DEFAULT", 0, "Default", ""},
- {CURSOR_NONE, "NONE", 0, "None", ""},
- {CURSOR_WAIT, "WAIT", 0, "Wait", ""},
- {CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""},
- {CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""},
- {CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""},
-
- /* new */
- {BC_KNIFECURSOR, "KNIFE", 0, "Knife", ""},
- {BC_TEXTEDITCURSOR, "TEXT", 0, "Text", ""},
- {BC_PAINTBRUSHCURSOR, "PAINT_BRUSH", 0, "Paint Brush", ""},
- {BC_HANDCURSOR, "HAND", 0, "Hand", ""},
- {BC_EW_SCROLLCURSOR, "SCROLL_X", 0, "Scroll-X", ""},
- {BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""},
- {BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""},
- {BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""},
- {0, NULL, 0, NULL, NULL},
+ {CURSOR_STD, "DEFAULT", 0, "Default", ""},
+ {CURSOR_NONE, "NONE", 0, "None", ""},
+ {CURSOR_WAIT, "WAIT", 0, "Wait", ""},
+ {CURSOR_EDIT, "CROSSHAIR", 0, "Crosshair", ""},
+ {CURSOR_X_MOVE, "MOVE_X", 0, "Move-X", ""},
+ {CURSOR_Y_MOVE, "MOVE_Y", 0, "Move-Y", ""},
+
+ /* new */
+ {BC_KNIFECURSOR, "KNIFE", 0, "Knife", ""},
+ {BC_TEXTEDITCURSOR, "TEXT", 0, "Text", ""},
+ {BC_PAINTBRUSHCURSOR, "PAINT_BRUSH", 0, "Paint Brush", ""},
+ {BC_HANDCURSOR, "HAND", 0, "Hand", ""},
+ {BC_EW_SCROLLCURSOR, "SCROLL_X", 0, "Scroll-X", ""},
+ {BC_NS_SCROLLCURSOR, "SCROLL_Y", 0, "Scroll-Y", ""},
+ {BC_NSEW_SCROLLCURSOR, "SCROLL_XY", 0, "Scroll-XY", ""},
+ {BC_EYEDROPPER_CURSOR, "EYEDROPPER", 0, "Eyedropper", ""},
+ {0, NULL, 0, NULL, NULL},
};
#ifdef RNA_RUNTIME
-#include "BKE_context.h"
-#include "BKE_undo_system.h"
+# include "BKE_context.h"
+# include "BKE_undo_system.h"
-#include "WM_types.h"
+# include "WM_types.h"
static void rna_KeyMapItem_to_string(wmKeyMapItem *kmi, bool compact, char *result)
{
- WM_keymap_item_to_string(kmi, compact, result, UI_MAX_SHORTCUT_STR);
+ WM_keymap_item_to_string(kmi, compact, result, UI_MAX_SHORTCUT_STR);
}
static wmKeyMap *rna_keymap_active(wmKeyMap *km, bContext *C)
{
- wmWindowManager *wm = CTX_wm_manager(C);
- return WM_keymap_active(wm, km);
+ wmWindowManager *wm = CTX_wm_manager(C);
+ return WM_keymap_active(wm, km);
}
static void rna_keymap_restore_item_to_default(wmKeyMap *km, bContext *C, wmKeyMapItem *kmi)
{
- WM_keymap_restore_item_to_default(C, km, kmi);
+ WM_keymap_restore_item_to_default(C, km, kmi);
}
static void rna_Operator_report(wmOperator *op, int type, const char *msg)
{
- BKE_report(op->reports, type, msg);
+ BKE_report(op->reports, type, msg);
}
static bool rna_Operator_is_repeat(wmOperator *op, bContext *C)
{
- return WM_operator_is_repeat(C, op);
+ return WM_operator_is_repeat(C, op);
}
/* since event isn't needed... */
static void rna_Operator_enum_search_invoke(bContext *C, wmOperator *op)
{
- WM_enum_search_invoke(C, op, NULL);
-
+ WM_enum_search_invoke(C, op, NULL);
}
static bool rna_event_modal_handler_add(struct bContext *C, struct wmOperator *operator)
{
- return WM_event_add_modal_handler(C, operator) != NULL;
+ return WM_event_add_modal_handler(C, operator) != NULL;
}
/* XXX, need a way for python to know event types, 0x0110 is hard coded */
static wmTimer *rna_event_timer_add(struct wmWindowManager *wm, float time_step, wmWindow *win)
{
- return WM_event_add_timer(wm, win, 0x0110, time_step);
+ return WM_event_add_timer(wm, win, 0x0110, time_step);
}
static void rna_event_timer_remove(struct wmWindowManager *wm, wmTimer *timer)
{
- WM_event_remove_timer(wm, timer->win, timer);
+ WM_event_remove_timer(wm, timer->win, timer);
}
-
-static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *reports, const char *idname)
+static wmGizmoGroupType *wm_gizmogrouptype_find_for_add_remove(ReportList *reports,
+ const char *idname)
{
- wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, true);
- if (gzgt == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Gizmo group type '%s' not found!", idname);
- return NULL;
- }
- if (gzgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) {
- BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' has 'PERSISTENT' option set!", idname);
- return NULL;
- }
- return gzgt;
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, true);
+ if (gzgt == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "Gizmo group type '%s' not found!", idname);
+ return NULL;
+ }
+ if (gzgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) {
+ BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' has 'PERSISTENT' option set!", idname);
+ return NULL;
+ }
+ return gzgt;
}
static void rna_gizmo_group_type_ensure(ReportList *reports, const char *idname)
{
- wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
- if (gzgt != NULL) {
- WM_gizmo_group_type_ensure_ptr(gzgt);
- }
+ wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
+ if (gzgt != NULL) {
+ WM_gizmo_group_type_ensure_ptr(gzgt);
+ }
}
static void rna_gizmo_group_type_unlink_delayed(ReportList *reports, const char *idname)
{
- wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
- if (gzgt != NULL) {
- WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
- }
+ wmGizmoGroupType *gzgt = wm_gizmogrouptype_find_for_add_remove(reports, idname);
+ if (gzgt != NULL) {
+ WM_gizmo_group_type_unlink_delayed_ptr(gzgt);
+ }
}
/* placeholder data for final implementation of a true progressbar */
static struct wmStaticProgress {
- float min;
- float max;
- bool is_valid;
+ float min;
+ float max;
+ bool is_valid;
} wm_progress_state = {0, 0, false};
-
static void rna_progress_begin(struct wmWindowManager *UNUSED(wm), float min, float max)
{
- float range = max - min;
- if (range != 0) {
- wm_progress_state.min = min;
- wm_progress_state.max = max;
- wm_progress_state.is_valid = true;
- }
- else {
- wm_progress_state.is_valid = false;
- }
+ float range = max - min;
+ if (range != 0) {
+ wm_progress_state.min = min;
+ wm_progress_state.max = max;
+ wm_progress_state.is_valid = true;
+ }
+ else {
+ wm_progress_state.is_valid = false;
+ }
}
static void rna_progress_update(struct wmWindowManager *wm, float value)
{
- if (wm_progress_state.is_valid) {
- /* Map to cursor_time range [0,9999] */
- wmWindow *win = wm->winactive;
- if (win) {
- int val = (int)(10000 * (value - wm_progress_state.min) / (wm_progress_state.max - wm_progress_state.min));
- WM_cursor_time(win, val);
- }
- }
+ if (wm_progress_state.is_valid) {
+ /* Map to cursor_time range [0,9999] */
+ wmWindow *win = wm->winactive;
+ if (win) {
+ int val = (int)(10000 * (value - wm_progress_state.min) /
+ (wm_progress_state.max - wm_progress_state.min));
+ WM_cursor_time(win, val);
+ }
+ }
}
static void rna_progress_end(struct wmWindowManager *wm)
{
- if (wm_progress_state.is_valid) {
- wmWindow *win = wm->winactive;
- if (win) {
- WM_cursor_modal_restore(win);
- wm_progress_state.is_valid = false;
- }
- }
+ if (wm_progress_state.is_valid) {
+ wmWindow *win = wm->winactive;
+ if (win) {
+ WM_cursor_modal_restore(win);
+ wm_progress_state.is_valid = false;
+ }
+ }
}
/* wrap these because of 'const wmEvent *' */
static int rna_Operator_confirm(bContext *C, wmOperator *op, wmEvent *event)
{
- return WM_operator_confirm(C, op, event);
+ return WM_operator_confirm(C, op, event);
}
static int rna_Operator_props_popup(bContext *C, wmOperator *op, wmEvent *event)
{
- return WM_operator_props_popup(C, op, event);
+ return WM_operator_props_popup(C, op, event);
}
-static wmKeyMapItem *rna_KeyMap_item_new(
- wmKeyMap *km, ReportList *reports, const char *idname, int type, int value,
- bool any, bool shift, bool ctrl, bool alt, bool oskey, int keymodifier, bool head)
+static wmKeyMapItem *rna_KeyMap_item_new(wmKeyMap *km,
+ ReportList *reports,
+ const char *idname,
+ int type,
+ int value,
+ bool any,
+ bool shift,
+ bool ctrl,
+ bool alt,
+ bool oskey,
+ int keymodifier,
+ bool head)
{
-/* wmWindowManager *wm = CTX_wm_manager(C); */
- wmKeyMapItem *kmi = NULL;
- char idname_bl[OP_MAX_TYPENAME];
- int modifier = 0;
-
- /* only on non-modal maps */
- if (km->flag & KEYMAP_MODAL) {
- BKE_report(reports, RPT_ERROR, "Not a non-modal keymap");
- return NULL;
- }
-
- WM_operator_bl_idname(idname_bl, idname);
-
- if (shift) modifier |= KM_SHIFT;
- if (ctrl) modifier |= KM_CTRL;
- if (alt) modifier |= KM_ALT;
- if (oskey) modifier |= KM_OSKEY;
-
- if (any) modifier = KM_ANY;
-
- /* create keymap item */
- kmi = WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier);
-
- /* [#32437] allow scripts to define hotkeys that get added to start of keymap
- * so that they stand a chance against catch-all defines later on
- */
- if (head) {
- BLI_remlink(&km->items, kmi);
- BLI_addhead(&km->items, kmi);
- }
-
- return kmi;
+ /* wmWindowManager *wm = CTX_wm_manager(C); */
+ wmKeyMapItem *kmi = NULL;
+ char idname_bl[OP_MAX_TYPENAME];
+ int modifier = 0;
+
+ /* only on non-modal maps */
+ if (km->flag & KEYMAP_MODAL) {
+ BKE_report(reports, RPT_ERROR, "Not a non-modal keymap");
+ return NULL;
+ }
+
+ WM_operator_bl_idname(idname_bl, idname);
+
+ if (shift)
+ modifier |= KM_SHIFT;
+ if (ctrl)
+ modifier |= KM_CTRL;
+ if (alt)
+ modifier |= KM_ALT;
+ if (oskey)
+ modifier |= KM_OSKEY;
+
+ if (any)
+ modifier = KM_ANY;
+
+ /* create keymap item */
+ kmi = WM_keymap_add_item(km, idname_bl, type, value, modifier, keymodifier);
+
+ /* [#32437] allow scripts to define hotkeys that get added to start of keymap
+ * so that they stand a chance against catch-all defines later on
+ */
+ if (head) {
+ BLI_remlink(&km->items, kmi);
+ BLI_addhead(&km->items, kmi);
+ }
+
+ return kmi;
}
-static wmKeyMapItem *rna_KeyMap_item_new_from_item(
- wmKeyMap *km, ReportList *reports, wmKeyMapItem *kmi_src, bool head)
+static wmKeyMapItem *rna_KeyMap_item_new_from_item(wmKeyMap *km,
+ ReportList *reports,
+ wmKeyMapItem *kmi_src,
+ bool head)
{
-/* wmWindowManager *wm = CTX_wm_manager(C); */
-
- if ((km->flag & KEYMAP_MODAL) == (kmi_src->idname[0] != '\0')) {
- BKE_report(reports, RPT_ERROR, "Can not mix modal/non-modal items");
- return NULL;
- }
-
- /* create keymap item */
- wmKeyMapItem *kmi = WM_keymap_add_item_copy(km, kmi_src);
- if (head) {
- BLI_remlink(&km->items, kmi);
- BLI_addhead(&km->items, kmi);
- }
- return kmi;
+ /* wmWindowManager *wm = CTX_wm_manager(C); */
+
+ if ((km->flag & KEYMAP_MODAL) == (kmi_src->idname[0] != '\0')) {
+ BKE_report(reports, RPT_ERROR, "Can not mix modal/non-modal items");
+ return NULL;
+ }
+
+ /* create keymap item */
+ wmKeyMapItem *kmi = WM_keymap_add_item_copy(km, kmi_src);
+ if (head) {
+ BLI_remlink(&km->items, kmi);
+ BLI_addhead(&km->items, kmi);
+ }
+ return kmi;
}
-static wmKeyMapItem *rna_KeyMap_item_new_modal(
- wmKeyMap *km, ReportList *reports, const char *propvalue_str,
- int type, int value, bool any, bool shift, bool ctrl, bool alt,
- bool oskey, int keymodifier)
+static wmKeyMapItem *rna_KeyMap_item_new_modal(wmKeyMap *km,
+ ReportList *reports,
+ const char *propvalue_str,
+ int type,
+ int value,
+ bool any,
+ bool shift,
+ bool ctrl,
+ bool alt,
+ bool oskey,
+ int keymodifier)
{
- int modifier = 0;
- int propvalue = 0;
-
- /* only modal maps */
- if ((km->flag & KEYMAP_MODAL) == 0) {
- BKE_report(reports, RPT_ERROR, "Not a modal keymap");
- return NULL;
- }
-
- if (shift) modifier |= KM_SHIFT;
- if (ctrl) modifier |= KM_CTRL;
- if (alt) modifier |= KM_ALT;
- if (oskey) modifier |= KM_OSKEY;
-
- if (any) modifier = KM_ANY;
-
- /* not initialized yet, do delayed lookup */
- if (!km->modal_items)
- return WM_modalkeymap_add_item_str(km, type, value, modifier, keymodifier, propvalue_str);
-
- if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0)
- BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
-
- return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
+ int modifier = 0;
+ int propvalue = 0;
+
+ /* only modal maps */
+ if ((km->flag & KEYMAP_MODAL) == 0) {
+ BKE_report(reports, RPT_ERROR, "Not a modal keymap");
+ return NULL;
+ }
+
+ if (shift)
+ modifier |= KM_SHIFT;
+ if (ctrl)
+ modifier |= KM_CTRL;
+ if (alt)
+ modifier |= KM_ALT;
+ if (oskey)
+ modifier |= KM_OSKEY;
+
+ if (any)
+ modifier = KM_ANY;
+
+ /* not initialized yet, do delayed lookup */
+ if (!km->modal_items)
+ return WM_modalkeymap_add_item_str(km, type, value, modifier, keymodifier, propvalue_str);
+
+ if (RNA_enum_value_from_id(km->modal_items, propvalue_str, &propvalue) == 0)
+ BKE_report(reports, RPT_WARNING, "Property value not in enumeration");
+
+ return WM_modalkeymap_add_item(km, type, value, modifier, keymodifier, propvalue);
}
static void rna_KeyMap_item_remove(wmKeyMap *km, ReportList *reports, PointerRNA *kmi_ptr)
{
- wmKeyMapItem *kmi = kmi_ptr->data;
-
- if (WM_keymap_remove_item(km, kmi) == false) {
- BKE_reportf(reports, RPT_ERROR, "KeyMapItem '%s' cannot be removed from '%s'", kmi->idname, km->idname);
- return;
- }
-
- RNA_POINTER_INVALIDATE(kmi_ptr);
+ wmKeyMapItem *kmi = kmi_ptr->data;
+
+ if (WM_keymap_remove_item(km, kmi) == false) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "KeyMapItem '%s' cannot be removed from '%s'",
+ kmi->idname,
+ km->idname);
+ return;
+ }
+
+ RNA_POINTER_INVALIDATE(kmi_ptr);
}
-static PointerRNA rna_KeyMap_item_find_from_operator(
- ID *id,
- wmKeyMap *km,
- const char *idname,
- PointerRNA *properties,
- int include_mask, int exclude_mask)
+static PointerRNA rna_KeyMap_item_find_from_operator(ID *id,
+ wmKeyMap *km,
+ const char *idname,
+ PointerRNA *properties,
+ int include_mask,
+ int exclude_mask)
{
- char idname_bl[OP_MAX_TYPENAME];
- WM_operator_bl_idname(idname_bl, idname);
-
- wmKeyMapItem *kmi = WM_key_event_operator_from_keymap(
- km, idname_bl, properties->data, include_mask, exclude_mask);
- PointerRNA kmi_ptr;
- RNA_pointer_create(id, &RNA_KeyMapItem, kmi, &kmi_ptr);
- return kmi_ptr;
+ char idname_bl[OP_MAX_TYPENAME];
+ WM_operator_bl_idname(idname_bl, idname);
+
+ wmKeyMapItem *kmi = WM_key_event_operator_from_keymap(
+ km, idname_bl, properties->data, include_mask, exclude_mask);
+ PointerRNA kmi_ptr;
+ RNA_pointer_create(id, &RNA_KeyMapItem, kmi, &kmi_ptr);
+ return kmi_ptr;
}
-static wmKeyMap *rna_keymap_new(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal, bool tool)
+static wmKeyMap *rna_keymap_new(
+ wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid, bool modal, bool tool)
{
- wmKeyMap *keymap;
+ wmKeyMap *keymap;
- if (modal == 0) {
- keymap = WM_keymap_ensure(keyconf, idname, spaceid, regionid);
- }
- else {
- keymap = WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
- }
+ if (modal == 0) {
+ keymap = WM_keymap_ensure(keyconf, idname, spaceid, regionid);
+ }
+ else {
+ keymap = WM_modalkeymap_add(keyconf, idname, NULL); /* items will be lazy init */
+ }
- if (keymap && tool) {
- keymap->flag |= KEYMAP_TOOL;
- }
+ if (keymap && tool) {
+ keymap->flag |= KEYMAP_TOOL;
+ }
- return keymap;
+ return keymap;
}
-static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf, const char *idname, int spaceid, int regionid)
+static wmKeyMap *rna_keymap_find(wmKeyConfig *keyconf,
+ const char *idname,
+ int spaceid,
+ int regionid)
{
- return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
+ return WM_keymap_list_find(&keyconf->keymaps, idname, spaceid, regionid);
}
static wmKeyMap *rna_keymap_find_modal(wmKeyConfig *UNUSED(keyconf), const char *idname)
{
- wmOperatorType *ot = WM_operatortype_find(idname, 0);
+ wmOperatorType *ot = WM_operatortype_find(idname, 0);
- if (!ot)
- return NULL;
- else
- return ot->modalkeymap;
+ if (!ot)
+ return NULL;
+ else
+ return ot->modalkeymap;
}
static void rna_KeyMap_remove(wmKeyConfig *keyconfig, ReportList *reports, PointerRNA *keymap_ptr)
{
- wmKeyMap *keymap = keymap_ptr->data;
+ wmKeyMap *keymap = keymap_ptr->data;
- if (WM_keymap_remove(keyconfig, keymap) == false) {
- BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keymap->idname);
- return;
- }
+ if (WM_keymap_remove(keyconfig, keymap) == false) {
+ BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keymap->idname);
+ return;
+ }
- RNA_POINTER_INVALIDATE(keymap_ptr);
+ RNA_POINTER_INVALIDATE(keymap_ptr);
}
static void rna_KeyConfig_remove(wmWindowManager *wm, ReportList *reports, PointerRNA *keyconf_ptr)
{
- wmKeyConfig *keyconf = keyconf_ptr->data;
+ wmKeyConfig *keyconf = keyconf_ptr->data;
- if (WM_keyconfig_remove(wm, keyconf) == false) {
- BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
- return;
- }
+ if (WM_keyconfig_remove(wm, keyconf) == false) {
+ BKE_reportf(reports, RPT_ERROR, "KeyConfig '%s' cannot be removed", keyconf->idname);
+ return;
+ }
- RNA_POINTER_INVALIDATE(keyconf_ptr);
+ RNA_POINTER_INVALIDATE(keyconf_ptr);
}
-static PointerRNA rna_KeyConfig_find_item_from_operator(
- wmWindowManager *wm,
- bContext *C,
- const char *idname,
- int opcontext,
- PointerRNA *properties,
- int include_mask, int exclude_mask,
- PointerRNA *km_ptr)
+static PointerRNA rna_KeyConfig_find_item_from_operator(wmWindowManager *wm,
+ bContext *C,
+ const char *idname,
+ int opcontext,
+ PointerRNA *properties,
+ int include_mask,
+ int exclude_mask,
+ PointerRNA *km_ptr)
{
- char idname_bl[OP_MAX_TYPENAME];
- WM_operator_bl_idname(idname_bl, idname);
-
- wmKeyMap *km = NULL;
- wmKeyMapItem *kmi = WM_key_event_operator(
- C, idname_bl, opcontext, properties->data, include_mask, exclude_mask, &km);
- PointerRNA kmi_ptr;
- RNA_pointer_create(&wm->id, &RNA_KeyMap, km, km_ptr);
- RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &kmi_ptr);
- return kmi_ptr;
+ char idname_bl[OP_MAX_TYPENAME];
+ WM_operator_bl_idname(idname_bl, idname);
+
+ wmKeyMap *km = NULL;
+ wmKeyMapItem *kmi = WM_key_event_operator(
+ C, idname_bl, opcontext, properties->data, include_mask, exclude_mask, &km);
+ PointerRNA kmi_ptr;
+ RNA_pointer_create(&wm->id, &RNA_KeyMap, km, km_ptr);
+ RNA_pointer_create(&wm->id, &RNA_KeyMapItem, kmi, &kmi_ptr);
+ return kmi_ptr;
}
static void rna_KeyConfig_update(wmWindowManager *wm)
{
- WM_keyconfig_update(wm);
+ WM_keyconfig_update(wm);
}
/* popup menu wrapper */
static PointerRNA rna_PopMenuBegin(bContext *C, const char *title, int icon)
{
- PointerRNA r_ptr;
- void *data;
+ PointerRNA r_ptr;
+ void *data;
- data = (void *)UI_popup_menu_begin(C, title, icon);
+ data = (void *)UI_popup_menu_begin(C, title, icon);
- RNA_pointer_create(NULL, &RNA_UIPopupMenu, data, &r_ptr);
+ RNA_pointer_create(NULL, &RNA_UIPopupMenu, data, &r_ptr);
- return r_ptr;
+ return r_ptr;
}
static void rna_PopMenuEnd(bContext *C, PointerRNA *handle)
{
- UI_popup_menu_end(C, handle->data);
+ UI_popup_menu_end(C, handle->data);
}
/* popover wrapper */
static PointerRNA rna_PopoverBegin(bContext *C, int ui_units_x)
{
- PointerRNA r_ptr;
- void *data;
+ PointerRNA r_ptr;
+ void *data;
- data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x);
+ data = (void *)UI_popover_begin(C, U.widget_unit * ui_units_x);
- RNA_pointer_create(NULL, &RNA_UIPopover, data, &r_ptr);
+ RNA_pointer_create(NULL, &RNA_UIPopover, data, &r_ptr);
- return r_ptr;
+ return r_ptr;
}
static void rna_PopoverEnd(bContext *C, PointerRNA *handle, wmKeyMap *keymap)
{
- UI_popover_end(C, handle->data, keymap);
+ UI_popover_end(C, handle->data, keymap);
}
/* pie menu wrapper */
static PointerRNA rna_PieMenuBegin(bContext *C, const char *title, int icon, PointerRNA *event)
{
- PointerRNA r_ptr;
- void *data;
+ PointerRNA r_ptr;
+ void *data;
- data = (void *)UI_pie_menu_begin(C, title, icon, event->data);
+ data = (void *)UI_pie_menu_begin(C, title, icon, event->data);
- RNA_pointer_create(NULL, &RNA_UIPieMenu, data, &r_ptr);
+ RNA_pointer_create(NULL, &RNA_UIPieMenu, data, &r_ptr);
- return r_ptr;
+ return r_ptr;
}
static void rna_PieMenuEnd(bContext *C, PointerRNA *handle)
{
- UI_pie_menu_end(C, handle->data);
+ UI_pie_menu_end(C, handle->data);
}
static void rna_WindowManager_print_undo_steps(wmWindowManager *wm)
{
- BKE_undosys_print(wm->undo_stack);
+ BKE_undosys_print(wm->undo_stack);
}
static PointerRNA rna_WindoManager_operator_properties_last(const char *idname)
{
- wmOperatorType *ot = WM_operatortype_find(idname, true);
-
- if (ot != NULL) {
- PointerRNA ptr;
- WM_operator_last_properties_ensure(ot, &ptr);
- return ptr;
- }
- return PointerRNA_NULL;
+ wmOperatorType *ot = WM_operatortype_find(idname, true);
+
+ if (ot != NULL) {
+ PointerRNA ptr;
+ WM_operator_last_properties_ensure(ot, &ptr);
+ return ptr;
+ }
+ return PointerRNA_NULL;
}
-static wmEvent *rna_Window_event_add_simulate(
- wmWindow *win, ReportList *reports,
- int type, int value, const char *unicode,
- int x, int y,
- bool shift, bool ctrl, bool alt, bool oskey)
+static wmEvent *rna_Window_event_add_simulate(wmWindow *win,
+ ReportList *reports,
+ int type,
+ int value,
+ const char *unicode,
+ int x,
+ int y,
+ bool shift,
+ bool ctrl,
+ bool alt,
+ bool oskey)
{
- if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
- BKE_report(reports, RPT_ERROR, "Not running with '--enable-event-simulate' enabled");
- return NULL;
- }
-
- if (!ELEM(value, KM_PRESS, KM_RELEASE, KM_NOTHING)) {
- BKE_report(reports, RPT_ERROR, "value: only 'PRESS/RELEASE/NOTHING' are supported");
- return NULL;
- }
- if (ISKEYBOARD(type) || ISMOUSE_BUTTON(type)) {
- if (!ELEM(value, KM_PRESS, KM_RELEASE)) {
- BKE_report(reports, RPT_ERROR, "value: must be 'PRESS/RELEASE' for keyboard/buttons");
- return NULL;
- }
- }
- if (ELEM(type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
- if (value != KM_NOTHING) {
- BKE_report(reports, RPT_ERROR, "value: must be 'NOTHING' for motion");
- return NULL;
- }
- }
- if (unicode != NULL) {
- if (value != KM_PRESS) {
- BKE_report(reports, RPT_ERROR, "value: must be 'PRESS' when unicode is set");
- return NULL;
- }
- }
- /* TODO: validate NDOF. */
-
- char ascii = 0;
- if (unicode != NULL) {
- int len = BLI_str_utf8_size(unicode);
- if (len == -1 || unicode[len] != '\0') {
- BKE_report(reports, RPT_ERROR, "Only a single character supported");
- return NULL;
- }
- if (len == 1 && isascii(unicode[0])) {
- ascii = unicode[0];
- }
- }
-
- wmEvent e = *win->eventstate;
- e.type = type;
- e.val = value;
- e.x = x;
- e.y = y;
- /* Note: KM_MOD_FIRST, KM_MOD_SECOND aren't used anywhere, set as bools */
- e.shift = shift;
- e.ctrl = ctrl;
- e.alt = alt;
- e.oskey = oskey;
-
- e.prevx = win->eventstate->x;
- e.prevy = win->eventstate->y;
- e.prevval = win->eventstate->val;
- e.prevtype = win->eventstate->type;
-
- e.ascii = '\0';
- e.utf8_buf[0] = '\0';
- if (unicode != NULL) {
- e.ascii = ascii;
- STRNCPY(e.utf8_buf, unicode);
- }
-
- return WM_event_add_simulate(win, &e);
+ if ((G.f & G_FLAG_EVENT_SIMULATE) == 0) {
+ BKE_report(reports, RPT_ERROR, "Not running with '--enable-event-simulate' enabled");
+ return NULL;
+ }
+
+ if (!ELEM(value, KM_PRESS, KM_RELEASE, KM_NOTHING)) {
+ BKE_report(reports, RPT_ERROR, "value: only 'PRESS/RELEASE/NOTHING' are supported");
+ return NULL;
+ }
+ if (ISKEYBOARD(type) || ISMOUSE_BUTTON(type)) {
+ if (!ELEM(value, KM_PRESS, KM_RELEASE)) {
+ BKE_report(reports, RPT_ERROR, "value: must be 'PRESS/RELEASE' for keyboard/buttons");
+ return NULL;
+ }
+ }
+ if (ELEM(type, MOUSEMOVE, INBETWEEN_MOUSEMOVE)) {
+ if (value != KM_NOTHING) {
+ BKE_report(reports, RPT_ERROR, "value: must be 'NOTHING' for motion");
+ return NULL;
+ }
+ }
+ if (unicode != NULL) {
+ if (value != KM_PRESS) {
+ BKE_report(reports, RPT_ERROR, "value: must be 'PRESS' when unicode is set");
+ return NULL;
+ }
+ }
+ /* TODO: validate NDOF. */
+
+ char ascii = 0;
+ if (unicode != NULL) {
+ int len = BLI_str_utf8_size(unicode);
+ if (len == -1 || unicode[len] != '\0') {
+ BKE_report(reports, RPT_ERROR, "Only a single character supported");
+ return NULL;
+ }
+ if (len == 1 && isascii(unicode[0])) {
+ ascii = unicode[0];
+ }
+ }
+
+ wmEvent e = *win->eventstate;
+ e.type = type;
+ e.val = value;
+ e.x = x;
+ e.y = y;
+ /* Note: KM_MOD_FIRST, KM_MOD_SECOND aren't used anywhere, set as bools */
+ e.shift = shift;
+ e.ctrl = ctrl;
+ e.alt = alt;
+ e.oskey = oskey;
+
+ e.prevx = win->eventstate->x;
+ e.prevy = win->eventstate->y;
+ e.prevval = win->eventstate->val;
+ e.prevtype = win->eventstate->type;
+
+ e.ascii = '\0';
+ e.utf8_buf[0] = '\0';
+ if (unicode != NULL) {
+ e.ascii = ascii;
+ STRNCPY(e.utf8_buf, unicode);
+ }
+
+ return WM_event_add_simulate(win, &e);
}
#else
-#define WM_GEN_INVOKE_EVENT (1 << 0)
-#define WM_GEN_INVOKE_SIZE (1 << 1)
-#define WM_GEN_INVOKE_RETURN (1 << 2)
+# define WM_GEN_INVOKE_EVENT (1 << 0)
+# define WM_GEN_INVOKE_SIZE (1 << 1)
+# define WM_GEN_INVOKE_RETURN (1 << 2)
static void rna_generic_op_invoke(FunctionRNA *func, int flag)
{
- PropertyRNA *parm;
-
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- if (flag & WM_GEN_INVOKE_EVENT) {
- parm = RNA_def_pointer(func, "event", "Event", "", "Event");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- }
-
- if (flag & WM_GEN_INVOKE_SIZE) {
- RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
- RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup", 0, INT_MAX);
- }
-
- if (flag & WM_GEN_INVOKE_RETURN) {
- parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
- }
+ PropertyRNA *parm;
+
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ if (flag & WM_GEN_INVOKE_EVENT) {
+ parm = RNA_def_pointer(func, "event", "Event", "", "Event");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ }
+
+ if (flag & WM_GEN_INVOKE_SIZE) {
+ RNA_def_int(func, "width", 300, 0, INT_MAX, "", "Width of the popup", 0, INT_MAX);
+ RNA_def_int(func, "height", 20, 0, INT_MAX, "", "Height of the popup", 0, INT_MAX);
+ }
+
+ if (flag & WM_GEN_INVOKE_RETURN) {
+ parm = RNA_def_enum_flag(
+ func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
+ RNA_def_function_return(func, parm);
+ }
}
void RNA_api_window(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "cursor_warp", "WM_cursor_warp");
- parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "Set the cursor position");
-
- func = RNA_def_function(srna, "cursor_set", "WM_cursor_set");
- parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "Set the cursor");
-
- func = RNA_def_function(srna, "cursor_modal_set", "WM_cursor_modal_set");
- parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "Set the cursor, so the previous cursor can be restored");
-
- RNA_def_function(srna, "cursor_modal_restore", "WM_cursor_modal_restore");
- RNA_def_function_ui_description(func, "Restore the previous cursor after calling ``cursor_modal_set``");
-
- /* Arguments match 'rna_KeyMap_item_new'. */
- func = RNA_def_function(srna, "event_simulate", "rna_Window_event_add_simulate");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "unicode", NULL, 0, "", "");
- RNA_def_parameter_clear_flags(parm, PROP_NEVER_NULL, 0);
-
- RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
- RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
-
- RNA_def_boolean(func, "shift", 0, "Shift", "");
- RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
- RNA_def_boolean(func, "alt", 0, "Alt", "");
- RNA_def_boolean(func, "oskey", 0, "OS Key", "");
- parm = RNA_def_pointer(func, "event", "Event", "Item", "Added key map item");
- RNA_def_function_return(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "cursor_warp", "WM_cursor_warp");
+ parm = RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "Set the cursor position");
+
+ func = RNA_def_function(srna, "cursor_set", "WM_cursor_set");
+ parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "Set the cursor");
+
+ func = RNA_def_function(srna, "cursor_modal_set", "WM_cursor_modal_set");
+ parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "Set the cursor, so the previous cursor can be restored");
+
+ RNA_def_function(srna, "cursor_modal_restore", "WM_cursor_modal_restore");
+ RNA_def_function_ui_description(
+ func, "Restore the previous cursor after calling ``cursor_modal_set``");
+
+ /* Arguments match 'rna_KeyMap_item_new'. */
+ func = RNA_def_function(srna, "event_simulate", "rna_Window_event_add_simulate");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "unicode", NULL, 0, "", "");
+ RNA_def_parameter_clear_flags(parm, PROP_NEVER_NULL, 0);
+
+ RNA_def_int(func, "x", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
+ RNA_def_int(func, "y", 0, INT_MIN, INT_MAX, "", "", INT_MIN, INT_MAX);
+
+ RNA_def_boolean(func, "shift", 0, "Shift", "");
+ RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
+ RNA_def_boolean(func, "alt", 0, "Alt", "");
+ RNA_def_boolean(func, "oskey", 0, "OS Key", "");
+ parm = RNA_def_pointer(func, "event", "Event", "Item", "Added key map item");
+ RNA_def_function_return(func, parm);
}
void RNA_api_wm(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
- RNA_def_function_ui_description(func, "Opens a file selector with an operator. "
- "The string properties 'filepath', 'filename', 'directory' and a 'files' "
- "collection are assigned when present in the operator");
- rna_generic_op_invoke(func, 0);
-
- func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
- RNA_def_function_ui_description(func, "Add a modal handler to the window manager, for the given modal operator "
- "(called by invoke() with self, just before returning {'RUNNING_MODAL'})");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_return(func, RNA_def_boolean(func, "handle", 1, "", "Whether adding the handler was successful"));
-
-
- func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
- RNA_def_function_ui_description(func, "Add a timer to the given window, to generate periodic 'TIMER' events");
- parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_range(parm, 0.0, FLT_MAX);
- RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
- RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None");
- parm = RNA_def_pointer(func, "result", "Timer", "", "");
- RNA_def_function_return(func, parm);
-
-
- func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
- parm = RNA_def_pointer(func, "timer", "Timer", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
- RNA_def_function_ui_description(func, "Activate an existing widget group (when the persistent option isn't set)");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
- RNA_def_function_ui_description(func, "Unlink a widget group (when the persistent option is set)");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* Progress bar interface */
- func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
- RNA_def_function_ui_description(func, "Start progress report");
- parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
-
- func = RNA_def_function(srna, "progress_update", "rna_progress_update");
- RNA_def_function_ui_description(func, "Update the progress feedback");
- parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_ui_text(parm, "value", "Any value between min and max as set in progress_begin()");
-
- func = RNA_def_function(srna, "progress_end", "rna_progress_end");
- RNA_def_function_ui_description(func, "Terminate progress report");
-
- /* invoke functions, for use with python */
- func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
- RNA_def_function_ui_description(func, "Operator popup invoke "
- "(show operator properties and execute it automatically on changes)");
- rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);
-
- /* invoked dialog opens popup with OK button, does not auto-exec operator. */
- func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
- RNA_def_function_ui_description(func, "Operator dialog (non-autoexec popup) invoke "
- "(show operator properties and only execute it on click on OK button)");
- rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);
-
- /* invoke enum */
- func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
- RNA_def_function_ui_description(
- func,
- "Operator search popup invoke which "
- "searches values of the operator's :class:`bpy.types.Operator.bl_property` "
- "(which must be an EnumProperty), executing it on confirmation");
- rna_generic_op_invoke(func, 0);
-
- /* invoke functions, for use with python */
- func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
- RNA_def_function_ui_description(func, "Operator popup invoke "
- "(only shows operator's properties, without executing it)");
- rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);
-
- func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
- RNA_def_function_ui_description(func, "Operator confirmation popup "
- "(only to let user confirm the execution, no operator properties shown)");
- rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);
-
-
- /* wrap UI_popup_menu_begin */
- func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "title", NULL, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(parm, rna_enum_icon_items);
- /* return */
- parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- /* wrap UI_popup_menu_end */
- func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
-
- /* wrap UI_popover_begin */
- func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED);
- /* return */
- parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- /* wrap UI_popover_end */
- func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
- RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
-
-
- /* wrap uiPieMenuBegin */
- func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "title", NULL, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(parm, rna_enum_icon_items);
- parm = RNA_def_pointer(func, "event", "Event", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- /* return */
- parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- /* wrap uiPieMenuEnd */
- func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
-
- /* access last operator options (optionally create). */
- func = RNA_def_function(srna, "operator_properties_last", "rna_WindoManager_operator_properties_last");
- RNA_def_function_flag(func, FUNC_NO_SELF);
- parm = RNA_def_string(func, "operator", NULL, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return */
- parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "fileselect_add", "WM_event_add_fileselect");
+ RNA_def_function_ui_description(
+ func,
+ "Opens a file selector with an operator. "
+ "The string properties 'filepath', 'filename', 'directory' and a 'files' "
+ "collection are assigned when present in the operator");
+ rna_generic_op_invoke(func, 0);
+
+ func = RNA_def_function(srna, "modal_handler_add", "rna_event_modal_handler_add");
+ RNA_def_function_ui_description(
+ func,
+ "Add a modal handler to the window manager, for the given modal operator "
+ "(called by invoke() with self, just before returning {'RUNNING_MODAL'})");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "operator", "Operator", "", "Operator to call");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_return(
+ func, RNA_def_boolean(func, "handle", 1, "", "Whether adding the handler was successful"));
+
+ func = RNA_def_function(srna, "event_timer_add", "rna_event_timer_add");
+ RNA_def_function_ui_description(
+ func, "Add a timer to the given window, to generate periodic 'TIMER' events");
+ parm = RNA_def_property(func, "time_step", PROP_FLOAT, PROP_NONE);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_range(parm, 0.0, FLT_MAX);
+ RNA_def_property_ui_text(parm, "Time Step", "Interval in seconds between timer events");
+ RNA_def_pointer(func, "window", "Window", "", "Window to attach the timer to, or None");
+ parm = RNA_def_pointer(func, "result", "Timer", "", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "event_timer_remove", "rna_event_timer_remove");
+ parm = RNA_def_pointer(func, "timer", "Timer", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "gizmo_group_type_ensure", "rna_gizmo_group_type_ensure");
+ RNA_def_function_ui_description(
+ func, "Activate an existing widget group (when the persistent option isn't set)");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ func = RNA_def_function(
+ srna, "gizmo_group_type_unlink_delayed", "rna_gizmo_group_type_unlink_delayed");
+ RNA_def_function_ui_description(func,
+ "Unlink a widget group (when the persistent option is set)");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "identifier", NULL, 0, "", "Gizmo group type name");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* Progress bar interface */
+ func = RNA_def_function(srna, "progress_begin", "rna_progress_begin");
+ RNA_def_function_ui_description(func, "Start progress report");
+ parm = RNA_def_property(func, "min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(parm, "min", "any value in range [0,9999]");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "max", PROP_FLOAT, PROP_NONE);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_ui_text(parm, "max", "any value in range [min+1,9998]");
+
+ func = RNA_def_function(srna, "progress_update", "rna_progress_update");
+ RNA_def_function_ui_description(func, "Update the progress feedback");
+ parm = RNA_def_property(func, "value", PROP_FLOAT, PROP_NONE);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_ui_text(
+ parm, "value", "Any value between min and max as set in progress_begin()");
+
+ func = RNA_def_function(srna, "progress_end", "rna_progress_end");
+ RNA_def_function_ui_description(func, "Terminate progress report");
+
+ /* invoke functions, for use with python */
+ func = RNA_def_function(srna, "invoke_props_popup", "rna_Operator_props_popup");
+ RNA_def_function_ui_description(
+ func,
+ "Operator popup invoke "
+ "(show operator properties and execute it automatically on changes)");
+ rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);
+
+ /* invoked dialog opens popup with OK button, does not auto-exec operator. */
+ func = RNA_def_function(srna, "invoke_props_dialog", "WM_operator_props_dialog_popup");
+ RNA_def_function_ui_description(
+ func,
+ "Operator dialog (non-autoexec popup) invoke "
+ "(show operator properties and only execute it on click on OK button)");
+ rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);
+
+ /* invoke enum */
+ func = RNA_def_function(srna, "invoke_search_popup", "rna_Operator_enum_search_invoke");
+ RNA_def_function_ui_description(
+ func,
+ "Operator search popup invoke which "
+ "searches values of the operator's :class:`bpy.types.Operator.bl_property` "
+ "(which must be an EnumProperty), executing it on confirmation");
+ rna_generic_op_invoke(func, 0);
+
+ /* invoke functions, for use with python */
+ func = RNA_def_function(srna, "invoke_popup", "WM_operator_ui_popup");
+ RNA_def_function_ui_description(func,
+ "Operator popup invoke "
+ "(only shows operator's properties, without executing it)");
+ rna_generic_op_invoke(func, WM_GEN_INVOKE_SIZE | WM_GEN_INVOKE_RETURN);
+
+ func = RNA_def_function(srna, "invoke_confirm", "rna_Operator_confirm");
+ RNA_def_function_ui_description(
+ func,
+ "Operator confirmation popup "
+ "(only to let user confirm the execution, no operator properties shown)");
+ rna_generic_op_invoke(func, WM_GEN_INVOKE_EVENT | WM_GEN_INVOKE_RETURN);
+
+ /* wrap UI_popup_menu_begin */
+ func = RNA_def_function(srna, "popmenu_begin__internal", "rna_PopMenuBegin");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "title", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(parm, rna_enum_icon_items);
+ /* return */
+ parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ /* wrap UI_popup_menu_end */
+ func = RNA_def_function(srna, "popmenu_end__internal", "rna_PopMenuEnd");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "menu", "UIPopupMenu", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
+
+ /* wrap UI_popover_begin */
+ func = RNA_def_function(srna, "popover_begin__internal", "rna_PopoverBegin");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ RNA_def_property(func, "ui_units_x", PROP_INT, PROP_UNSIGNED);
+ /* return */
+ parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ /* wrap UI_popover_end */
+ func = RNA_def_function(srna, "popover_end__internal", "rna_PopoverEnd");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "menu", "UIPopover", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
+ RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
+
+ /* wrap uiPieMenuBegin */
+ func = RNA_def_function(srna, "piemenu_begin__internal", "rna_PieMenuBegin");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "title", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "icon", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(parm, rna_enum_icon_items);
+ parm = RNA_def_pointer(func, "event", "Event", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ /* return */
+ parm = RNA_def_pointer(func, "menu_pie", "UIPieMenu", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ /* wrap uiPieMenuEnd */
+ func = RNA_def_function(srna, "piemenu_end__internal", "rna_PieMenuEnd");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "menu", "UIPieMenu", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR | PARM_REQUIRED);
+
+ /* access last operator options (optionally create). */
+ func = RNA_def_function(
+ srna, "operator_properties_last", "rna_WindoManager_operator_properties_last");
+ RNA_def_function_flag(func, FUNC_NO_SELF);
+ parm = RNA_def_string(func, "operator", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ RNA_def_function(srna, "print_undo_steps", "rna_WindowManager_print_undo_steps");
}
void RNA_api_operator(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* utility, not for registering */
- func = RNA_def_function(srna, "report", "rna_Operator_report");
- parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* utility, not for registering */
- func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- /* return */
- parm = RNA_def_boolean(func, "result", 0, "result", "");
- RNA_def_function_return(func, parm);
-
- /* Registration */
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "Test if the operator can be called or not");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* exec */
- func = RNA_def_function(srna, "execute", NULL);
- RNA_def_function_ui_description(func, "Execute the operator");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* better name? */
- parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
-
- /* check */
- func = RNA_def_function(srna, "check", NULL);
- RNA_def_function_ui_description(func, "Check the operator settings, return True to signal a change to redraw");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- parm = RNA_def_boolean(func, "result", 0, "result", ""); /* better name? */
- RNA_def_function_return(func, parm);
-
- /* invoke */
- func = RNA_def_function(srna, "invoke", NULL);
- RNA_def_function_ui_description(func, "Invoke the operator");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "event", "Event", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* better name? */
- parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "modal", NULL); /* same as invoke */
- RNA_def_function_ui_description(func, "Modal operator function");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "event", "Event", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* better name? */
- parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
-
- /* draw */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw function for the operator");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* cancel */
- func = RNA_def_function(srna, "cancel", NULL);
- RNA_def_function_ui_description(func, "Called when the operator is canceled");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* utility, not for registering */
+ func = RNA_def_function(srna, "report", "rna_Operator_report");
+ parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* utility, not for registering */
+ func = RNA_def_function(srna, "is_repeat", "rna_Operator_is_repeat");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ /* return */
+ parm = RNA_def_boolean(func, "result", 0, "result", "");
+ RNA_def_function_return(func, parm);
+
+ /* Registration */
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(func, "Test if the operator can be called or not");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* exec */
+ func = RNA_def_function(srna, "execute", NULL);
+ RNA_def_function_ui_description(func, "Execute the operator");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* better name? */
+ parm = RNA_def_enum_flag(
+ func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
+ RNA_def_function_return(func, parm);
+
+ /* check */
+ func = RNA_def_function(srna, "check", NULL);
+ RNA_def_function_ui_description(
+ func, "Check the operator settings, return True to signal a change to redraw");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ parm = RNA_def_boolean(func, "result", 0, "result", ""); /* better name? */
+ RNA_def_function_return(func, parm);
+
+ /* invoke */
+ func = RNA_def_function(srna, "invoke", NULL);
+ RNA_def_function_ui_description(func, "Invoke the operator");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "event", "Event", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* better name? */
+ parm = RNA_def_enum_flag(
+ func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "modal", NULL); /* same as invoke */
+ RNA_def_function_ui_description(func, "Modal operator function");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "event", "Event", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* better name? */
+ parm = RNA_def_enum_flag(
+ func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
+ RNA_def_function_return(func, parm);
+
+ /* draw */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw function for the operator");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* cancel */
+ func = RNA_def_function(srna, "cancel", NULL);
+ RNA_def_function_ui_description(func, "Called when the operator is canceled");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
}
void RNA_api_macro(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* utility, not for registering */
- func = RNA_def_function(srna, "report", "rna_Operator_report");
- parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
-
- /* Registration */
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "Test if the operator can be called or not");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* draw */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "Draw function for the operator");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* utility, not for registering */
+ func = RNA_def_function(srna, "report", "rna_Operator_report");
+ parm = RNA_def_enum_flag(func, "type", rna_enum_wm_report_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_string(func, "message", NULL, 0, "Report Message", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* Registration */
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(func, "Test if the operator can be called or not");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* draw */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "Draw function for the operator");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
}
void RNA_api_keyconfig(StructRNA *UNUSED(srna))
{
- /* FunctionRNA *func; */
- /* PropertyRNA *parm; */
+ /* FunctionRNA *func; */
+ /* PropertyRNA *parm; */
}
void RNA_api_keymap(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
+ FunctionRNA *func;
+ PropertyRNA *parm;
- func = RNA_def_function(srna, "active", "rna_keymap_active");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
- RNA_def_function_return(func, parm);
+ func = RNA_def_function(srna, "active", "rna_keymap_active");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Active key map");
+ RNA_def_function_return(func, parm);
- func = RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ func = RNA_def_function(srna, "restore_to_default", "WM_keymap_restore_to_default");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- func = RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ func = RNA_def_function(srna, "restore_item_to_default", "rna_keymap_restore_item_to_default");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
}
void RNA_api_keymapitem(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "compare", "WM_keymap_item_compare");
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "result", 0, "Comparison result", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "to_string", "rna_KeyMapItem_to_string");
- RNA_def_boolean(func, "compact", false, "Compact", "");
- parm = RNA_def_string(func, "result", NULL, UI_MAX_SHORTCUT_STR, "result", "");
- RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_function_output(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "compare", "WM_keymap_item_compare");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "result", 0, "Comparison result", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "to_string", "rna_KeyMapItem_to_string");
+ RNA_def_boolean(func, "compact", false, "Compact", "");
+ parm = RNA_def_string(func, "result", NULL, UI_MAX_SHORTCUT_STR, "result", "");
+ RNA_def_parameter_flags(parm, PROP_THICK_WRAP, 0);
+ RNA_def_function_output(func, parm);
}
void RNA_api_keymapitems(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "new", "rna_KeyMap_item_new");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "any", 0, "Any", "");
- RNA_def_boolean(func, "shift", 0, "Shift", "");
- RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
- RNA_def_boolean(func, "alt", 0, "Alt", "");
- RNA_def_boolean(func, "oskey", 0, "OS Key", "");
- RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
- RNA_def_boolean(func, "head", 0, "At Head",
- "Force item to be added at start (not end) of key map so that "
- "it doesn't get blocked by an existing key map item");
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "propvalue", NULL, 0, "Property Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "any", 0, "Any", "");
- RNA_def_boolean(func, "shift", 0, "Shift", "");
- RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
- RNA_def_boolean(func, "alt", 0, "Alt", "");
- RNA_def_boolean(func, "oskey", 0, "OS Key", "");
- RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "new_from_item", "rna_KeyMap_item_new_from_item");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Item to use as a reference");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_boolean(func, "head", 0, "At Head", "");
- parm = RNA_def_pointer(func, "result", "KeyMapItem", "Item", "Added key map item");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
- parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_ui_text(parm, "id", "ID of the item");
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
- RNA_def_function_return(func, parm);
-
- /* Keymap introspection
- * Args follow: KeyConfigs.find_item_from_operator */
- func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID);
- parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_enum_flag(func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
- RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "new", "rna_KeyMap_item_new");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "any", 0, "Any", "");
+ RNA_def_boolean(func, "shift", 0, "Shift", "");
+ RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
+ RNA_def_boolean(func, "alt", 0, "Alt", "");
+ RNA_def_boolean(func, "oskey", 0, "OS Key", "");
+ RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
+ RNA_def_boolean(func,
+ "head",
+ 0,
+ "At Head",
+ "Force item to be added at start (not end) of key map so that "
+ "it doesn't get blocked by an existing key map item");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_modal", "rna_KeyMap_item_new_modal");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "propvalue", NULL, 0, "Property Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "type", rna_enum_event_type_items, 0, "Type", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum(func, "value", rna_enum_event_value_items, 0, "Value", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "any", 0, "Any", "");
+ RNA_def_boolean(func, "shift", 0, "Shift", "");
+ RNA_def_boolean(func, "ctrl", 0, "Ctrl", "");
+ RNA_def_boolean(func, "alt", 0, "Alt", "");
+ RNA_def_boolean(func, "oskey", 0, "OS Key", "");
+ RNA_def_enum(func, "key_modifier", rna_enum_event_type_items, 0, "Key Modifier", "");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Added key map item");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "new_from_item", "rna_KeyMap_item_new_from_item");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "Item to use as a reference");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_boolean(func, "head", 0, "At Head", "");
+ parm = RNA_def_pointer(func, "result", "KeyMapItem", "Item", "Added key map item");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_KeyMap_item_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "from_id", "WM_keymap_item_find_id");
+ parm = RNA_def_property(func, "id", PROP_INT, PROP_NONE);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_ui_text(parm, "id", "ID of the item");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "Item", "");
+ RNA_def_function_return(func, parm);
+
+ /* Keymap introspection
+ * Args follow: KeyConfigs.find_item_from_operator */
+ func = RNA_def_function(srna, "find_from_operator", "rna_KeyMap_item_find_from_operator");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID);
+ parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_enum_flag(
+ func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
+ RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
}
void RNA_api_keymaps(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "new", "rna_keymap_new"); /* add_keymap */
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- RNA_def_boolean(func, "modal", 0, "Modal", "Keymap for modal operators");
- RNA_def_boolean(func, "tool", 0, "Tool", "Keymap for active tools");
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_KeyMap_remove"); /* remove_keymap */
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "find", "rna_keymap_find"); /* find_keymap */
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
- RNA_def_enum(func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); /* find_keymap_modal */
- parm = RNA_def_string(func, "name", NULL, 0, "Operator Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
- RNA_def_function_return(func, parm);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "new", "rna_keymap_new"); /* add_keymap */
+ parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_enum(
+ func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ RNA_def_boolean(func, "modal", 0, "Modal", "Keymap for modal operators");
+ RNA_def_boolean(func, "tool", 0, "Tool", "Keymap for active tools");
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Added key map");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_KeyMap_remove"); /* remove_keymap */
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Removed key map");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "find", "rna_keymap_find"); /* find_keymap */
+ parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_enum(func, "space_type", rna_enum_space_type_items, SPACE_EMPTY, "Space Type", "");
+ RNA_def_enum(
+ func, "region_type", rna_enum_region_type_items, RGN_TYPE_WINDOW, "Region Type", "");
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "find_modal", "rna_keymap_find_modal"); /* find_keymap_modal */
+ parm = RNA_def_string(func, "name", NULL, 0, "Operator Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "Key Map", "Corresponding key map");
+ RNA_def_function_return(func, parm);
}
void RNA_api_keyconfigs(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "new", "WM_keyconfig_new_user"); /* add_keyconfig */
- parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_KeyConfig_remove"); /* remove_keyconfig */
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* Helper functions */
-
- /* Keymap introspection */
- func = RNA_def_function(srna, "find_item_from_operator", "rna_KeyConfig_find_item_from_operator");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_property(func, "context", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(parm, rna_enum_operator_context_items);
- parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_enum_flag(func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
- RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_OUTPUT);
- parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
- RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- RNA_def_function(srna, "update", "rna_KeyConfig_update"); /* WM_keyconfig_update */
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "new", "WM_keyconfig_new_user"); /* add_keyconfig */
+ parm = RNA_def_string(func, "name", NULL, 0, "Name", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(
+ func, "keyconfig", "KeyConfig", "Key Configuration", "Added key configuration");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_KeyConfig_remove"); /* remove_keyconfig */
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_pointer(
+ func, "keyconfig", "KeyConfig", "Key Configuration", "Removed key configuration");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* Helper functions */
+
+ /* Keymap introspection */
+ func = RNA_def_function(
+ srna, "find_item_from_operator", "rna_KeyConfig_find_item_from_operator");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_string(func, "idname", NULL, 0, "Operator Identifier", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_property(func, "context", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(parm, rna_enum_operator_context_items);
+ parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_enum_flag(
+ func, "include", rna_enum_event_type_mask_items, EVT_TYPE_MASK_ALL, "Include", "");
+ RNA_def_enum_flag(func, "exclude", rna_enum_event_type_mask_items, 0, "Exclude", "");
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR | PARM_OUTPUT);
+ parm = RNA_def_pointer(func, "item", "KeyMapItem", "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ RNA_def_function(srna, "update", "rna_KeyConfig_update"); /* WM_keyconfig_update */
}
#endif
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo.c b/source/blender/makesrna/intern/rna_wm_gizmo.c
index 45d664c4522..b5f9f6102de 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo.c
@@ -44,336 +44,327 @@
#ifdef RNA_RUNTIME
-#include <assert.h>
+# include <assert.h>
-#include "BLI_string_utils.h"
+# include "BLI_string_utils.h"
-#include "WM_api.h"
+# include "WM_api.h"
-#include "DNA_workspace_types.h"
+# include "DNA_workspace_types.h"
-#include "ED_screen.h"
+# include "ED_screen.h"
-#include "UI_interface.h"
+# include "UI_interface.h"
-#include "BKE_global.h"
-#include "BKE_idprop.h"
-#include "BKE_workspace.h"
+# include "BKE_global.h"
+# include "BKE_idprop.h"
+# include "BKE_workspace.h"
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#ifdef WITH_PYTHON
-# include "BPY_extern.h"
-#endif
+# ifdef WITH_PYTHON
+# include "BPY_extern.h"
+# endif
/* -------------------------------------------------------------------- */
/** \name Gizmo API
* \{ */
-#ifdef WITH_PYTHON
-static void rna_gizmo_draw_cb(
- const struct bContext *C, struct wmGizmo *gz)
+# ifdef WITH_PYTHON
+static void rna_gizmo_draw_cb(const struct bContext *C, struct wmGizmo *gz)
{
- extern FunctionRNA rna_Gizmo_draw_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "draw"); */
- func = &rna_Gizmo_draw_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_Gizmo_draw_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "draw"); */
+ func = &rna_Gizmo_draw_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ RNA_parameter_list_free(&list);
}
-static void rna_gizmo_draw_select_cb(
- const struct bContext *C, struct wmGizmo *gz, int select_id)
+static void rna_gizmo_draw_select_cb(const struct bContext *C, struct wmGizmo *gz, int select_id)
{
- extern FunctionRNA rna_Gizmo_draw_select_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "draw_select"); */
- func = &rna_Gizmo_draw_select_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "select_id", &select_id);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_Gizmo_draw_select_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "draw_select"); */
+ func = &rna_Gizmo_draw_select_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "select_id", &select_id);
+ gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ RNA_parameter_list_free(&list);
}
-static int rna_gizmo_test_select_cb(
- struct bContext *C, struct wmGizmo *gz, const int location[2])
+static int rna_gizmo_test_select_cb(struct bContext *C, struct wmGizmo *gz, const int location[2])
{
- extern FunctionRNA rna_Gizmo_test_select_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "test_select"); */
- func = &rna_Gizmo_test_select_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "location", location);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
-
- void *ret;
- RNA_parameter_get_lookup(&list, "intersect_id", &ret);
- int intersect_id = *(int *)ret;
-
- RNA_parameter_list_free(&list);
- return intersect_id;
+ extern FunctionRNA rna_Gizmo_test_select_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "test_select"); */
+ func = &rna_Gizmo_test_select_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "location", location);
+ gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+
+ void *ret;
+ RNA_parameter_get_lookup(&list, "intersect_id", &ret);
+ int intersect_id = *(int *)ret;
+
+ RNA_parameter_list_free(&list);
+ return intersect_id;
}
-static int rna_gizmo_modal_cb(
- struct bContext *C, struct wmGizmo *gz, const struct wmEvent *event,
- eWM_GizmoFlagTweak tweak_flag)
+static int rna_gizmo_modal_cb(struct bContext *C,
+ struct wmGizmo *gz,
+ const struct wmEvent *event,
+ eWM_GizmoFlagTweak tweak_flag)
{
- extern FunctionRNA rna_Gizmo_modal_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- const int tweak_flag_int = tweak_flag;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "modal"); */
- func = &rna_Gizmo_modal_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "event", &event);
- RNA_parameter_set_lookup(&list, "tweak", &tweak_flag_int);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
-
- void *ret;
- RNA_parameter_get_lookup(&list, "result", &ret);
- int ret_enum = *(int *)ret;
-
- RNA_parameter_list_free(&list);
- return ret_enum;
+ extern FunctionRNA rna_Gizmo_modal_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ const int tweak_flag_int = tweak_flag;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "modal"); */
+ func = &rna_Gizmo_modal_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "event", &event);
+ RNA_parameter_set_lookup(&list, "tweak", &tweak_flag_int);
+ gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+
+ void *ret;
+ RNA_parameter_get_lookup(&list, "result", &ret);
+ int ret_enum = *(int *)ret;
+
+ RNA_parameter_list_free(&list);
+ return ret_enum;
}
-static void rna_gizmo_setup_cb(
- struct wmGizmo *gz)
+static void rna_gizmo_setup_cb(struct wmGizmo *gz)
{
- extern FunctionRNA rna_Gizmo_setup_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "setup"); */
- func = &rna_Gizmo_setup_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- gzgroup->type->ext.call((bContext *)NULL, &gz_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_Gizmo_setup_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "setup"); */
+ func = &rna_Gizmo_setup_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ gzgroup->type->ext.call((bContext *)NULL, &gz_ptr, func, &list);
+ RNA_parameter_list_free(&list);
}
-
-static int rna_gizmo_invoke_cb(
- struct bContext *C, struct wmGizmo *gz, const struct wmEvent *event)
+static int rna_gizmo_invoke_cb(struct bContext *C, struct wmGizmo *gz, const struct wmEvent *event)
{
- extern FunctionRNA rna_Gizmo_invoke_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "invoke"); */
- func = &rna_Gizmo_invoke_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "event", &event);
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
-
- void *ret;
- RNA_parameter_get_lookup(&list, "result", &ret);
- int ret_enum = *(int *)ret;
-
- RNA_parameter_list_free(&list);
- return ret_enum;
+ extern FunctionRNA rna_Gizmo_invoke_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "invoke"); */
+ func = &rna_Gizmo_invoke_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "event", &event);
+ gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+
+ void *ret;
+ RNA_parameter_get_lookup(&list, "result", &ret);
+ int ret_enum = *(int *)ret;
+
+ RNA_parameter_list_free(&list);
+ return ret_enum;
}
-static void rna_gizmo_exit_cb(
- struct bContext *C, struct wmGizmo *gz, bool cancel)
+static void rna_gizmo_exit_cb(struct bContext *C, struct wmGizmo *gz, bool cancel)
{
- extern FunctionRNA rna_Gizmo_exit_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "exit"); */
- func = &rna_Gizmo_exit_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- {
- int cancel_i = cancel;
- RNA_parameter_set_lookup(&list, "cancel", &cancel_i);
- }
- gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_Gizmo_exit_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "exit"); */
+ func = &rna_Gizmo_exit_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ {
+ int cancel_i = cancel;
+ RNA_parameter_set_lookup(&list, "cancel", &cancel_i);
+ }
+ gzgroup->type->ext.call((bContext *)C, &gz_ptr, func, &list);
+ RNA_parameter_list_free(&list);
}
-static void rna_gizmo_select_refresh_cb(
- struct wmGizmo *gz)
+static void rna_gizmo_select_refresh_cb(struct wmGizmo *gz)
{
- extern FunctionRNA rna_Gizmo_select_refresh_func;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- PointerRNA gz_ptr;
- ParameterList list;
- FunctionRNA *func;
- RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
- /* RNA_struct_find_function(&gz_ptr, "select_refresh"); */
- func = &rna_Gizmo_select_refresh_func;
- RNA_parameter_list_create(&list, &gz_ptr, func);
- gzgroup->type->ext.call((bContext *)NULL, &gz_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ extern FunctionRNA rna_Gizmo_select_refresh_func;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ PointerRNA gz_ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ RNA_pointer_create(NULL, gz->type->ext.srna, gz, &gz_ptr);
+ /* RNA_struct_find_function(&gz_ptr, "select_refresh"); */
+ func = &rna_Gizmo_select_refresh_func;
+ RNA_parameter_list_create(&list, &gz_ptr, func);
+ gzgroup->type->ext.call((bContext *)NULL, &gz_ptr, func, &list);
+ RNA_parameter_list_free(&list);
}
-#endif /* WITH_PYTHON */
+# endif /* WITH_PYTHON */
/* just to work around 'const char *' warning and to ensure this is a python op */
static void rna_Gizmo_bl_idname_set(PointerRNA *ptr, const char *value)
{
- wmGizmo *data = ptr->data;
- char *str = (char *)data->type->idname;
- if (!str[0]) {
- BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
- }
- else {
- assert(!"setting the bl_idname on a non-builtin operator");
- }
+ wmGizmo *data = ptr->data;
+ char *str = (char *)data->type->idname;
+ if (!str[0]) {
+ BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
+ }
+ else {
+ assert(!"setting the bl_idname on a non-builtin operator");
+ }
}
static wmGizmo *rna_GizmoProperties_find_operator(PointerRNA *ptr)
{
-#if 0
- wmWindowManager *wm = ptr->id.data;
-#endif
-
- /* We could try workaruond this lookup, but not trivial. */
- for (bScreen *screen = G_MAIN->screens.first; screen; screen = screen->id.next) {
- IDProperty *properties = ptr->data;
- for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
- for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
- if (ar->gizmo_map) {
- wmGizmoMap *gzmap = ar->gizmo_map;
- for (wmGizmoGroup *gzgroup = WM_gizmomap_group_list(gzmap)->first;
- gzgroup;
- gzgroup = gzgroup->next)
- {
- for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
- if (gz->properties == properties) {
- return gz;
- }
- }
- }
- }
- }
- }
- }
- return NULL;
+# if 0
+ wmWindowManager *wm = ptr->id.data;
+# endif
+
+ /* We could try workaruond this lookup, but not trivial. */
+ for (bScreen *screen = G_MAIN->screens.first; screen; screen = screen->id.next) {
+ IDProperty *properties = ptr->data;
+ for (ScrArea *sa = screen->areabase.first; sa; sa = sa->next) {
+ for (ARegion *ar = sa->regionbase.first; ar; ar = ar->next) {
+ if (ar->gizmo_map) {
+ wmGizmoMap *gzmap = ar->gizmo_map;
+ for (wmGizmoGroup *gzgroup = WM_gizmomap_group_list(gzmap)->first; gzgroup;
+ gzgroup = gzgroup->next) {
+ for (wmGizmo *gz = gzgroup->gizmos.first; gz; gz = gz->next) {
+ if (gz->properties == properties) {
+ return gz;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return NULL;
}
static StructRNA *rna_GizmoProperties_refine(PointerRNA *ptr)
{
- wmGizmo *gz = rna_GizmoProperties_find_operator(ptr);
+ wmGizmo *gz = rna_GizmoProperties_find_operator(ptr);
- if (gz)
- return gz->type->srna;
- else
- return ptr->type;
+ if (gz)
+ return gz->type->srna;
+ else
+ return ptr->type;
}
static IDProperty *rna_GizmoProperties_idprops(PointerRNA *ptr, bool create)
{
- if (create && !ptr->data) {
- IDPropertyTemplate val = {0};
- ptr->data = IDP_New(IDP_GROUP, &val, "RNA_GizmoProperties group");
- }
+ if (create && !ptr->data) {
+ IDPropertyTemplate val = {0};
+ ptr->data = IDP_New(IDP_GROUP, &val, "RNA_GizmoProperties group");
+ }
- return ptr->data;
+ return ptr->data;
}
static PointerRNA rna_Gizmo_properties_get(PointerRNA *ptr)
{
- wmGizmo *gz = ptr->data;
- return rna_pointer_inherit_refine(ptr, gz->type->srna, gz->properties);
+ wmGizmo *gz = ptr->data;
+ return rna_pointer_inherit_refine(ptr, gz->type->srna, gz->properties);
}
/* wmGizmo.float */
-#define RNA_GIZMO_GENERIC_FLOAT_RW_DEF(func_id, member_id) \
-static float rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
-{ \
- wmGizmo *gz = ptr->data; \
- return gz->member_id; \
-} \
-static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, float value) \
-{ \
- wmGizmo *gz = ptr->data; \
- gz->member_id = value; \
-}
-#define RNA_GIZMO_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(func_id, member_id, index) \
-static float rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
-{ \
- wmGizmo *gz = ptr->data; \
- return gz->member_id[index]; \
-} \
-static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, float value) \
-{ \
- wmGizmo *gz = ptr->data; \
- gz->member_id[index] = value; \
-}
+# define RNA_GIZMO_GENERIC_FLOAT_RW_DEF(func_id, member_id) \
+ static float rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ return gz->member_id; \
+ } \
+ static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, float value) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ gz->member_id = value; \
+ }
+# define RNA_GIZMO_GENERIC_FLOAT_ARRAY_INDEX_RW_DEF(func_id, member_id, index) \
+ static float rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ return gz->member_id[index]; \
+ } \
+ static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, float value) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ gz->member_id[index] = value; \
+ }
/* wmGizmo.float[len] */
-#define RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(func_id, member_id, len) \
-static void rna_Gizmo_##func_id##_get(PointerRNA *ptr, float value[len]) \
-{ \
- wmGizmo *gz = ptr->data; \
- memcpy(value, gz->member_id, sizeof(float[len])); \
-} \
-static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, const float value[len]) \
-{ \
- wmGizmo *gz = ptr->data; \
- memcpy(gz->member_id, value, sizeof(float[len])); \
-}
+# define RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(func_id, member_id, len) \
+ static void rna_Gizmo_##func_id##_get(PointerRNA *ptr, float value[len]) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ memcpy(value, gz->member_id, sizeof(float[len])); \
+ } \
+ static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, const float value[len]) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ memcpy(gz->member_id, value, sizeof(float[len])); \
+ }
/* wmGizmo.flag */
-#define RNA_GIZMO_GENERIC_FLAG_RW_DEF(func_id, member_id, flag_value) \
-static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
-{ \
- wmGizmo *gz = ptr->data; \
- return (gz->member_id & flag_value) != 0; \
-} \
-static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, bool value) \
-{ \
- wmGizmo *gz = ptr->data; \
- SET_FLAG_FROM_TEST(gz->member_id, value, flag_value); \
-}
+# define RNA_GIZMO_GENERIC_FLAG_RW_DEF(func_id, member_id, flag_value) \
+ static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ return (gz->member_id & flag_value) != 0; \
+ } \
+ static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, bool value) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ SET_FLAG_FROM_TEST(gz->member_id, value, flag_value); \
+ }
/* wmGizmo.flag (negative) */
-#define RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(func_id, member_id, flag_value) \
-static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
-{ \
- wmGizmo *gz = ptr->data; \
- return (gz->member_id & flag_value) == 0; \
-} \
-static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, bool value) \
-{ \
- wmGizmo *gz = ptr->data; \
- SET_FLAG_FROM_TEST(gz->member_id, !value, flag_value); \
-}
-
-#define RNA_GIZMO_FLAG_RO_DEF(func_id, member_id, flag_value) \
-static int rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
-{ \
- wmGizmo *gz = ptr->data; \
- return (gz->member_id & flag_value) != 0; \
-}
+# define RNA_GIZMO_GENERIC_FLAG_NEG_RW_DEF(func_id, member_id, flag_value) \
+ static bool rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ return (gz->member_id & flag_value) == 0; \
+ } \
+ static void rna_Gizmo_##func_id##_set(PointerRNA *ptr, bool value) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ SET_FLAG_FROM_TEST(gz->member_id, !value, flag_value); \
+ }
+
+# define RNA_GIZMO_FLAG_RO_DEF(func_id, member_id, flag_value) \
+ static int rna_Gizmo_##func_id##_get(PointerRNA *ptr) \
+ { \
+ wmGizmo *gz = ptr->data; \
+ return (gz->member_id & flag_value) != 0; \
+ }
RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(color, color, 3);
RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(color_hi, color_hi, 3);
@@ -387,8 +378,8 @@ RNA_GIZMO_GENERIC_FLOAT_ARRAY_RW_DEF(matrix_offset, matrix_offset, 16);
static void rna_Gizmo_matrix_world_get(PointerRNA *ptr, float value[16])
{
- wmGizmo *gz = ptr->data;
- WM_gizmo_calc_matrix_final(gz, (float (*)[4])value);
+ wmGizmo *gz = ptr->data;
+ WM_gizmo_calc_matrix_final(gz, (float(*)[4])value);
}
RNA_GIZMO_GENERIC_FLOAT_RW_DEF(scale_basis, scale_basis);
@@ -403,7 +394,9 @@ RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide, flag, WM_GIZMO_HIDDEN);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_hide_select, flag, WM_GIZMO_HIDDEN_SELECT);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_grab_cursor, flag, WM_GIZMO_MOVE_CURSOR);
RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_select_background, flag, WM_GIZMO_SELECT_BACKGROUND);
-RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_operator_tool_properties, flag, WM_GIZMO_OPERATOR_TOOL_INIT);
+RNA_GIZMO_GENERIC_FLAG_RW_DEF(flag_use_operator_tool_properties,
+ flag,
+ WM_GIZMO_OPERATOR_TOOL_INIT);
/* wmGizmo.state */
RNA_GIZMO_FLAG_RO_DEF(state_is_highlight, state, WM_GIZMO_STATE_HIGHLIGHT);
@@ -412,132 +405,138 @@ RNA_GIZMO_FLAG_RO_DEF(state_select, state, WM_GIZMO_STATE_SELECT);
static void rna_Gizmo_state_select_set(struct PointerRNA *ptr, bool value)
{
- wmGizmo *gz = ptr->data;
- wmGizmoGroup *gzgroup = gz->parent_gzgroup;
- WM_gizmo_select_set(gzgroup->parent_gzmap, gz, value);
+ wmGizmo *gz = ptr->data;
+ wmGizmoGroup *gzgroup = gz->parent_gzgroup;
+ WM_gizmo_select_set(gzgroup->parent_gzmap, gz, value);
}
static PointerRNA rna_Gizmo_group_get(PointerRNA *ptr)
{
- wmGizmo *gz = ptr->data;
- return rna_pointer_inherit_refine(ptr, &RNA_GizmoGroup, gz->parent_gzgroup);
+ wmGizmo *gz = ptr->data;
+ return rna_pointer_inherit_refine(ptr, &RNA_GizmoGroup, gz->parent_gzgroup);
}
-#ifdef WITH_PYTHON
+# ifdef WITH_PYTHON
static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type);
void BPY_RNA_gizmo_wrapper(wmGizmoType *gzgt, void *userdata);
-static StructRNA *rna_Gizmo_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_Gizmo_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- struct {
- char idname[MAX_NAME];
- } temp_buffers;
-
- wmGizmoType dummygt = {NULL};
- wmGizmo dummymnp = {NULL};
- PointerRNA mnp_ptr;
-
- /* Two sets of functions. */
- int have_function[8];
-
- /* setup dummy gizmo & gizmo type to store static properties in */
- dummymnp.type = &dummygt;
- dummygt.idname = temp_buffers.idname;
- RNA_pointer_create(NULL, &RNA_Gizmo, &dummymnp, &mnp_ptr);
-
- /* Clear so we can detect if it's left unset. */
- temp_buffers.idname[0] = '\0';
-
- /* validate the python class */
- if (validate(&mnp_ptr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering gizmo class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(temp_buffers.idname));
- return NULL;
- }
-
- /* check if we have registered this gizmo type before, and remove it */
- {
- const wmGizmoType *gzt = WM_gizmotype_find(dummygt.idname, true);
- if (gzt && gzt->ext.srna) {
- rna_Gizmo_unregister(bmain, gzt->ext.srna);
- }
- }
- if (!RNA_struct_available_or_report(reports, dummygt.idname)) {
- return NULL;
- }
-
- { /* allocate the idname */
- /* For multiple strings see GizmoGroup. */
- dummygt.idname = BLI_strdup(temp_buffers.idname);
- }
-
- /* create a new gizmo type */
- dummygt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummygt.idname, &RNA_Gizmo);
- /* gizmo properties are registered separately */
- RNA_def_struct_flag(dummygt.ext.srna, STRUCT_NO_IDPROPERTIES);
- dummygt.ext.data = data;
- dummygt.ext.call = call;
- dummygt.ext.free = free;
-
- {
- int i = 0;
- dummygt.draw = (have_function[i++]) ? rna_gizmo_draw_cb : NULL;
- dummygt.draw_select = (have_function[i++]) ? rna_gizmo_draw_select_cb : NULL;
- dummygt.test_select = (have_function[i++]) ? rna_gizmo_test_select_cb : NULL;
- dummygt.modal = (have_function[i++]) ? rna_gizmo_modal_cb : NULL;
-// dummygt.property_update = (have_function[i++]) ? rna_gizmo_property_update : NULL;
-// dummygt.position_get = (have_function[i++]) ? rna_gizmo_position_get : NULL;
- dummygt.setup = (have_function[i++]) ? rna_gizmo_setup_cb : NULL;
- dummygt.invoke = (have_function[i++]) ? rna_gizmo_invoke_cb : NULL;
- dummygt.exit = (have_function[i++]) ? rna_gizmo_exit_cb : NULL;
- dummygt.select_refresh = (have_function[i++]) ? rna_gizmo_select_refresh_cb : NULL;
-
- BLI_assert(i == ARRAY_SIZE(have_function));
- }
-
- WM_gizmotype_append_ptr(BPY_RNA_gizmo_wrapper, (void *)&dummygt);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
-
- return dummygt.ext.srna;
+ struct {
+ char idname[MAX_NAME];
+ } temp_buffers;
+
+ wmGizmoType dummygt = {NULL};
+ wmGizmo dummymnp = {NULL};
+ PointerRNA mnp_ptr;
+
+ /* Two sets of functions. */
+ int have_function[8];
+
+ /* setup dummy gizmo & gizmo type to store static properties in */
+ dummymnp.type = &dummygt;
+ dummygt.idname = temp_buffers.idname;
+ RNA_pointer_create(NULL, &RNA_Gizmo, &dummymnp, &mnp_ptr);
+
+ /* Clear so we can detect if it's left unset. */
+ temp_buffers.idname[0] = '\0';
+
+ /* validate the python class */
+ if (validate(&mnp_ptr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering gizmo class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(temp_buffers.idname));
+ return NULL;
+ }
+
+ /* check if we have registered this gizmo type before, and remove it */
+ {
+ const wmGizmoType *gzt = WM_gizmotype_find(dummygt.idname, true);
+ if (gzt && gzt->ext.srna) {
+ rna_Gizmo_unregister(bmain, gzt->ext.srna);
+ }
+ }
+ if (!RNA_struct_available_or_report(reports, dummygt.idname)) {
+ return NULL;
+ }
+
+ { /* allocate the idname */
+ /* For multiple strings see GizmoGroup. */
+ dummygt.idname = BLI_strdup(temp_buffers.idname);
+ }
+
+ /* create a new gizmo type */
+ dummygt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummygt.idname, &RNA_Gizmo);
+ /* gizmo properties are registered separately */
+ RNA_def_struct_flag(dummygt.ext.srna, STRUCT_NO_IDPROPERTIES);
+ dummygt.ext.data = data;
+ dummygt.ext.call = call;
+ dummygt.ext.free = free;
+
+ {
+ int i = 0;
+ dummygt.draw = (have_function[i++]) ? rna_gizmo_draw_cb : NULL;
+ dummygt.draw_select = (have_function[i++]) ? rna_gizmo_draw_select_cb : NULL;
+ dummygt.test_select = (have_function[i++]) ? rna_gizmo_test_select_cb : NULL;
+ dummygt.modal = (have_function[i++]) ? rna_gizmo_modal_cb : NULL;
+ // dummygt.property_update = (have_function[i++]) ? rna_gizmo_property_update : NULL;
+ // dummygt.position_get = (have_function[i++]) ? rna_gizmo_position_get : NULL;
+ dummygt.setup = (have_function[i++]) ? rna_gizmo_setup_cb : NULL;
+ dummygt.invoke = (have_function[i++]) ? rna_gizmo_invoke_cb : NULL;
+ dummygt.exit = (have_function[i++]) ? rna_gizmo_exit_cb : NULL;
+ dummygt.select_refresh = (have_function[i++]) ? rna_gizmo_select_refresh_cb : NULL;
+
+ BLI_assert(i == ARRAY_SIZE(have_function));
+ }
+
+ WM_gizmotype_append_ptr(BPY_RNA_gizmo_wrapper, (void *)&dummygt);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+
+ return dummygt.ext.srna;
}
static void rna_Gizmo_unregister(struct Main *bmain, StructRNA *type)
{
- wmGizmoType *gzt = RNA_struct_blender_type_get(type);
+ wmGizmoType *gzt = RNA_struct_blender_type_get(type);
- if (!gzt) {
- return;
- }
+ if (!gzt) {
+ return;
+ }
- RNA_struct_free_extension(type, &gzt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &gzt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
- WM_gizmotype_remove_ptr(NULL, bmain, gzt);
+ WM_gizmotype_remove_ptr(NULL, bmain, gzt);
}
static void **rna_Gizmo_instance(PointerRNA *ptr)
{
- wmGizmo *gz = ptr->data;
- return &gz->py_instance;
+ wmGizmo *gz = ptr->data;
+ return &gz->py_instance;
}
-#endif /* WITH_PYTHON */
-
+# endif /* WITH_PYTHON */
static StructRNA *rna_Gizmo_refine(PointerRNA *mnp_ptr)
{
- wmGizmo *gz = mnp_ptr->data;
- return (gz->type && gz->type->ext.srna) ? gz->type->ext.srna : &RNA_Gizmo;
+ wmGizmo *gz = mnp_ptr->data;
+ return (gz->type && gz->type->ext.srna) ? gz->type->ext.srna : &RNA_Gizmo;
}
/** \} */
@@ -547,867 +546,907 @@ static StructRNA *rna_Gizmo_refine(PointerRNA *mnp_ptr)
static wmGizmoGroupType *rna_GizmoGroupProperties_find_gizmo_group_type(PointerRNA *ptr)
{
- IDProperty *properties = (IDProperty *)ptr->data;
- wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(properties->name, false);
- return gzgt;
+ IDProperty *properties = (IDProperty *)ptr->data;
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(properties->name, false);
+ return gzgt;
}
static StructRNA *rna_GizmoGroupProperties_refine(PointerRNA *ptr)
{
- wmGizmoGroupType *gzgt = rna_GizmoGroupProperties_find_gizmo_group_type(ptr);
+ wmGizmoGroupType *gzgt = rna_GizmoGroupProperties_find_gizmo_group_type(ptr);
- if (gzgt)
- return gzgt->srna;
- else
- return ptr->type;
+ if (gzgt)
+ return gzgt->srna;
+ else
+ return ptr->type;
}
static IDProperty *rna_GizmoGroupProperties_idprops(PointerRNA *ptr, bool create)
{
- if (create && !ptr->data) {
- IDPropertyTemplate val = {0};
- ptr->data = IDP_New(IDP_GROUP, &val, "RNA_GizmoGroupProperties group");
- }
+ if (create && !ptr->data) {
+ IDPropertyTemplate val = {0};
+ ptr->data = IDP_New(IDP_GROUP, &val, "RNA_GizmoGroupProperties group");
+ }
- return ptr->data;
+ return ptr->data;
}
-
-static wmGizmo *rna_GizmoGroup_gizmo_new(
- wmGizmoGroup *gzgroup, ReportList *reports, const char *idname)
+static wmGizmo *rna_GizmoGroup_gizmo_new(wmGizmoGroup *gzgroup,
+ ReportList *reports,
+ const char *idname)
{
- const wmGizmoType *gzt = WM_gizmotype_find(idname, true);
- if (gzt == NULL) {
- BKE_reportf(reports, RPT_ERROR, "GizmoType '%s' not known", idname);
- return NULL;
- }
- wmGizmo *gz = WM_gizmo_new_ptr(gzt, gzgroup, NULL);
- return gz;
+ const wmGizmoType *gzt = WM_gizmotype_find(idname, true);
+ if (gzt == NULL) {
+ BKE_reportf(reports, RPT_ERROR, "GizmoType '%s' not known", idname);
+ return NULL;
+ }
+ wmGizmo *gz = WM_gizmo_new_ptr(gzt, gzgroup, NULL);
+ return gz;
}
-static void rna_GizmoGroup_gizmo_remove(
- wmGizmoGroup *gzgroup, bContext *C, wmGizmo *gz)
+static void rna_GizmoGroup_gizmo_remove(wmGizmoGroup *gzgroup, bContext *C, wmGizmo *gz)
{
- WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gz, C);
+ WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gz, C);
}
-static void rna_GizmoGroup_gizmo_clear(
- wmGizmoGroup *gzgroup, bContext *C)
+static void rna_GizmoGroup_gizmo_clear(wmGizmoGroup *gzgroup, bContext *C)
{
- while (gzgroup->gizmos.first) {
- WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gzgroup->gizmos.first, C);
- }
+ while (gzgroup->gizmos.first) {
+ WM_gizmo_unlink(&gzgroup->gizmos, gzgroup->parent_gzmap, gzgroup->gizmos.first, C);
+ }
}
static void rna_GizmoGroup_name_get(PointerRNA *ptr, char *value)
{
- wmGizmoGroup *gzgroup = ptr->data;
- strcpy(value, gzgroup->type->name);
+ wmGizmoGroup *gzgroup = ptr->data;
+ strcpy(value, gzgroup->type->name);
}
static int rna_GizmoGroup_name_length(PointerRNA *ptr)
{
- wmGizmoGroup *gzgroup = ptr->data;
- return strlen(gzgroup->type->name);
+ wmGizmoGroup *gzgroup = ptr->data;
+ return strlen(gzgroup->type->name);
}
/* just to work around 'const char *' warning and to ensure this is a python op */
static void rna_GizmoGroup_bl_idname_set(PointerRNA *ptr, const char *value)
{
- wmGizmoGroup *data = ptr->data;
- char *str = (char *)data->type->idname;
- if (!str[0])
- BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
- else
- assert(!"setting the bl_idname on a non-builtin operator");
+ wmGizmoGroup *data = ptr->data;
+ char *str = (char *)data->type->idname;
+ if (!str[0])
+ BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_idname on a non-builtin operator");
}
static void rna_GizmoGroup_bl_label_set(PointerRNA *ptr, const char *value)
{
- wmGizmoGroup *data = ptr->data;
- char *str = (char *)data->type->name;
- if (!str[0])
- BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
- else
- assert(!"setting the bl_label on a non-builtin operator");
+ wmGizmoGroup *data = ptr->data;
+ char *str = (char *)data->type->name;
+ if (!str[0])
+ BLI_strncpy(str, value, MAX_NAME); /* utf8 already ensured */
+ else
+ assert(!"setting the bl_label on a non-builtin operator");
}
static bool rna_GizmoGroup_has_reports_get(PointerRNA *ptr)
{
- wmGizmoGroup *gzgroup = ptr->data;
- return (gzgroup->reports && gzgroup->reports->list.first);
+ wmGizmoGroup *gzgroup = ptr->data;
+ return (gzgroup->reports && gzgroup->reports->list.first);
}
-#ifdef WITH_PYTHON
+# ifdef WITH_PYTHON
static bool rna_gizmogroup_poll_cb(const bContext *C, wmGizmoGroupType *gzgt)
{
- extern FunctionRNA rna_GizmoGroup_poll_func;
+ extern FunctionRNA rna_GizmoGroup_poll_func;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
- void *ret;
- bool visible;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
+ void *ret;
+ bool visible;
- RNA_pointer_create(NULL, gzgt->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_GizmoGroup_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
+ RNA_pointer_create(NULL, gzgt->ext.srna, NULL, &ptr); /* dummy */
+ func = &rna_GizmoGroup_poll_func; /* RNA_struct_find_function(&ptr, "poll"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- gzgt->ext.call((bContext *)C, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ gzgt->ext.call((bContext *)C, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "visible", &ret);
- visible = *(bool *)ret;
+ RNA_parameter_get_lookup(&list, "visible", &ret);
+ visible = *(bool *)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return visible;
+ return visible;
}
static void rna_gizmogroup_setup_cb(const bContext *C, wmGizmoGroup *gzgroup)
{
- extern FunctionRNA rna_GizmoGroup_setup_func;
+ extern FunctionRNA rna_GizmoGroup_setup_func;
- PointerRNA gzgroup_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA gzgroup_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
- func = &rna_GizmoGroup_setup_func; /* RNA_struct_find_function(&wgroupr, "setup"); */
+ RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ func = &rna_GizmoGroup_setup_func; /* RNA_struct_find_function(&wgroupr, "setup"); */
- RNA_parameter_list_create(&list, &gzgroup_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ RNA_parameter_list_create(&list, &gzgroup_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static wmKeyMap *rna_gizmogroup_setup_keymap_cb(const wmGizmoGroupType *gzgt, wmKeyConfig *config)
{
- extern FunctionRNA rna_GizmoGroup_setup_keymap_func;
- void *ret;
+ extern FunctionRNA rna_GizmoGroup_setup_keymap_func;
+ void *ret;
- PointerRNA ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, gzgt->ext.srna, NULL, &ptr); /* dummy */
- func = &rna_GizmoGroup_setup_keymap_func; /* RNA_struct_find_function(&wgroupr, "setup_keymap"); */
+ RNA_pointer_create(NULL, gzgt->ext.srna, NULL, &ptr); /* dummy */
+ func =
+ &rna_GizmoGroup_setup_keymap_func; /* RNA_struct_find_function(&wgroupr, "setup_keymap"); */
- RNA_parameter_list_create(&list, &ptr, func);
- RNA_parameter_set_lookup(&list, "keyconfig", &config);
- gzgt->ext.call(NULL, &ptr, func, &list);
+ RNA_parameter_list_create(&list, &ptr, func);
+ RNA_parameter_set_lookup(&list, "keyconfig", &config);
+ gzgt->ext.call(NULL, &ptr, func, &list);
- RNA_parameter_get_lookup(&list, "keymap", &ret);
- wmKeyMap *keymap = *(wmKeyMap **)ret;
+ RNA_parameter_get_lookup(&list, "keymap", &ret);
+ wmKeyMap *keymap = *(wmKeyMap **)ret;
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
- return keymap;
+ return keymap;
}
static void rna_gizmogroup_refresh_cb(const bContext *C, wmGizmoGroup *gzgroup)
{
- extern FunctionRNA rna_GizmoGroup_refresh_func;
+ extern FunctionRNA rna_GizmoGroup_refresh_func;
- PointerRNA gzgroup_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA gzgroup_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
- func = &rna_GizmoGroup_refresh_func; /* RNA_struct_find_function(&wgroupr, "refresh"); */
+ RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ func = &rna_GizmoGroup_refresh_func; /* RNA_struct_find_function(&wgroupr, "refresh"); */
- RNA_parameter_list_create(&list, &gzgroup_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ RNA_parameter_list_create(&list, &gzgroup_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_gizmogroup_draw_prepare_cb(const bContext *C, wmGizmoGroup *gzgroup)
{
- extern FunctionRNA rna_GizmoGroup_draw_prepare_func;
+ extern FunctionRNA rna_GizmoGroup_draw_prepare_func;
- PointerRNA gzgroup_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA gzgroup_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
- func = &rna_GizmoGroup_draw_prepare_func; /* RNA_struct_find_function(&wgroupr, "draw_prepare"); */
+ RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ func =
+ &rna_GizmoGroup_draw_prepare_func; /* RNA_struct_find_function(&wgroupr, "draw_prepare"); */
- RNA_parameter_list_create(&list, &gzgroup_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ RNA_parameter_list_create(&list, &gzgroup_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
static void rna_gizmogroup_invoke_prepare_cb(const bContext *C, wmGizmoGroup *gzgroup, wmGizmo *gz)
{
- extern FunctionRNA rna_GizmoGroup_invoke_prepare_func;
+ extern FunctionRNA rna_GizmoGroup_invoke_prepare_func;
- PointerRNA gzgroup_ptr;
- ParameterList list;
- FunctionRNA *func;
+ PointerRNA gzgroup_ptr;
+ ParameterList list;
+ FunctionRNA *func;
- RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
- func = &rna_GizmoGroup_invoke_prepare_func; /* RNA_struct_find_function(&wgroupr, "invoke_prepare"); */
+ RNA_pointer_create(NULL, gzgroup->type->ext.srna, gzgroup, &gzgroup_ptr);
+ func =
+ &rna_GizmoGroup_invoke_prepare_func; /* RNA_struct_find_function(&wgroupr, "invoke_prepare"); */
- RNA_parameter_list_create(&list, &gzgroup_ptr, func);
- RNA_parameter_set_lookup(&list, "context", &C);
- RNA_parameter_set_lookup(&list, "gizmo", &gz);
- gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
+ RNA_parameter_list_create(&list, &gzgroup_ptr, func);
+ RNA_parameter_set_lookup(&list, "context", &C);
+ RNA_parameter_set_lookup(&list, "gizmo", &gz);
+ gzgroup->type->ext.call((bContext *)C, &gzgroup_ptr, func, &list);
- RNA_parameter_list_free(&list);
+ RNA_parameter_list_free(&list);
}
void BPY_RNA_gizmogroup_wrapper(wmGizmoGroupType *gzgt, void *userdata);
static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type);
-static StructRNA *rna_GizmoGroup_register(
- Main *bmain, ReportList *reports, void *data, const char *identifier,
- StructValidateFunc validate, StructCallbackFunc call, StructFreeFunc free)
+static StructRNA *rna_GizmoGroup_register(Main *bmain,
+ ReportList *reports,
+ void *data,
+ const char *identifier,
+ StructValidateFunc validate,
+ StructCallbackFunc call,
+ StructFreeFunc free)
{
- struct {
- char name[MAX_NAME];
- char idname[MAX_NAME];
- } temp_buffers;
-
- wmGizmoGroupType dummywgt = {NULL};
- wmGizmoGroup dummywg = {NULL};
- PointerRNA wgptr;
-
- /* Two sets of functions. */
- int have_function[6];
-
- /* setup dummy gizmogroup & gizmogroup type to store static properties in */
- dummywg.type = &dummywgt;
- dummywgt.name = temp_buffers.name;
- dummywgt.idname = temp_buffers.idname;
-
- RNA_pointer_create(NULL, &RNA_GizmoGroup, &dummywg, &wgptr);
-
- /* Clear so we can detect if it's left unset. */
- temp_buffers.idname[0] = temp_buffers.name[0] = '\0';
-
- /* validate the python class */
- if (validate(&wgptr, data, have_function) != 0)
- return NULL;
-
- if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
- BKE_reportf(reports, RPT_ERROR, "Registering gizmogroup class: '%s' is too long, maximum length is %d",
- identifier, (int)sizeof(temp_buffers.idname));
- return NULL;
- }
-
- /* check if the area supports widgets */
- const struct wmGizmoMapType_Params wmap_params = {
- .spaceid = dummywgt.gzmap_params.spaceid,
- .regionid = dummywgt.gzmap_params.regionid,
- };
-
- wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&wmap_params);
- if (gzmap_type == NULL) {
- BKE_report(reports, RPT_ERROR, "Area type does not support gizmos");
- return NULL;
- }
-
- /* check if we have registered this gizmogroup type before, and remove it */
- {
- wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummywgt.idname, true);
- if (gzgt && gzgt->ext.srna) {
- rna_GizmoGroup_unregister(bmain, gzgt->ext.srna);
- }
- }
- if (!RNA_struct_available_or_report(reports, dummywgt.idname)) {
- return NULL;
- }
-
- { /* allocate the idname */
- const char *strings[] = {
- temp_buffers.idname,
- temp_buffers.name,
- };
- char *strings_table[ARRAY_SIZE(strings)];
- BLI_string_join_array_by_sep_char_with_tableN('\0', strings_table, strings, ARRAY_SIZE(strings));
-
- dummywgt.idname = strings_table[0]; /* allocated string stored here */
- dummywgt.name = strings_table[1];
- BLI_assert(ARRAY_SIZE(strings) == 2);
- }
-
- /* create a new gizmogroup type */
- dummywgt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_GizmoGroup);
- RNA_def_struct_flag(dummywgt.ext.srna, STRUCT_NO_IDPROPERTIES); /* gizmogroup properties are registered separately */
- dummywgt.ext.data = data;
- dummywgt.ext.call = call;
- dummywgt.ext.free = free;
-
- /* We used to register widget group types like this, now we do it similar to
- * operator types. Thus we should be able to do the same as operator types now. */
- dummywgt.poll = (have_function[0]) ? rna_gizmogroup_poll_cb : NULL;
- dummywgt.setup_keymap = (have_function[1]) ? rna_gizmogroup_setup_keymap_cb : NULL;
- dummywgt.setup = (have_function[2]) ? rna_gizmogroup_setup_cb : NULL;
- dummywgt.refresh = (have_function[3]) ? rna_gizmogroup_refresh_cb : NULL;
- dummywgt.draw_prepare = (have_function[4]) ? rna_gizmogroup_draw_prepare_cb : NULL;
- dummywgt.invoke_prepare = (have_function[5]) ? rna_gizmogroup_invoke_prepare_cb : NULL;
-
- wmGizmoGroupType *gzgt = WM_gizmogrouptype_append_ptr(
- BPY_RNA_gizmogroup_wrapper, (void *)&dummywgt);
-
- {
- const char *owner_id = RNA_struct_state_owner_get();
- if (owner_id) {
- BLI_strncpy(gzgt->owner_id, owner_id, sizeof(gzgt->owner_id));
- }
- }
-
- if (gzgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) {
- WM_gizmo_group_type_add_ptr_ex(gzgt, gzmap_type);
-
- /* update while blender is running */
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
- }
-
- return dummywgt.ext.srna;
+ struct {
+ char name[MAX_NAME];
+ char idname[MAX_NAME];
+ } temp_buffers;
+
+ wmGizmoGroupType dummywgt = {NULL};
+ wmGizmoGroup dummywg = {NULL};
+ PointerRNA wgptr;
+
+ /* Two sets of functions. */
+ int have_function[6];
+
+ /* setup dummy gizmogroup & gizmogroup type to store static properties in */
+ dummywg.type = &dummywgt;
+ dummywgt.name = temp_buffers.name;
+ dummywgt.idname = temp_buffers.idname;
+
+ RNA_pointer_create(NULL, &RNA_GizmoGroup, &dummywg, &wgptr);
+
+ /* Clear so we can detect if it's left unset. */
+ temp_buffers.idname[0] = temp_buffers.name[0] = '\0';
+
+ /* validate the python class */
+ if (validate(&wgptr, data, have_function) != 0)
+ return NULL;
+
+ if (strlen(identifier) >= sizeof(temp_buffers.idname)) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Registering gizmogroup class: '%s' is too long, maximum length is %d",
+ identifier,
+ (int)sizeof(temp_buffers.idname));
+ return NULL;
+ }
+
+ /* check if the area supports widgets */
+ const struct wmGizmoMapType_Params wmap_params = {
+ .spaceid = dummywgt.gzmap_params.spaceid,
+ .regionid = dummywgt.gzmap_params.regionid,
+ };
+
+ wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(&wmap_params);
+ if (gzmap_type == NULL) {
+ BKE_report(reports, RPT_ERROR, "Area type does not support gizmos");
+ return NULL;
+ }
+
+ /* check if we have registered this gizmogroup type before, and remove it */
+ {
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(dummywgt.idname, true);
+ if (gzgt && gzgt->ext.srna) {
+ rna_GizmoGroup_unregister(bmain, gzgt->ext.srna);
+ }
+ }
+ if (!RNA_struct_available_or_report(reports, dummywgt.idname)) {
+ return NULL;
+ }
+
+ { /* allocate the idname */
+ const char *strings[] = {
+ temp_buffers.idname,
+ temp_buffers.name,
+ };
+ char *strings_table[ARRAY_SIZE(strings)];
+ BLI_string_join_array_by_sep_char_with_tableN(
+ '\0', strings_table, strings, ARRAY_SIZE(strings));
+
+ dummywgt.idname = strings_table[0]; /* allocated string stored here */
+ dummywgt.name = strings_table[1];
+ BLI_assert(ARRAY_SIZE(strings) == 2);
+ }
+
+ /* create a new gizmogroup type */
+ dummywgt.ext.srna = RNA_def_struct_ptr(&BLENDER_RNA, dummywgt.idname, &RNA_GizmoGroup);
+ RNA_def_struct_flag(
+ dummywgt.ext.srna,
+ STRUCT_NO_IDPROPERTIES); /* gizmogroup properties are registered separately */
+ dummywgt.ext.data = data;
+ dummywgt.ext.call = call;
+ dummywgt.ext.free = free;
+
+ /* We used to register widget group types like this, now we do it similar to
+ * operator types. Thus we should be able to do the same as operator types now. */
+ dummywgt.poll = (have_function[0]) ? rna_gizmogroup_poll_cb : NULL;
+ dummywgt.setup_keymap = (have_function[1]) ? rna_gizmogroup_setup_keymap_cb : NULL;
+ dummywgt.setup = (have_function[2]) ? rna_gizmogroup_setup_cb : NULL;
+ dummywgt.refresh = (have_function[3]) ? rna_gizmogroup_refresh_cb : NULL;
+ dummywgt.draw_prepare = (have_function[4]) ? rna_gizmogroup_draw_prepare_cb : NULL;
+ dummywgt.invoke_prepare = (have_function[5]) ? rna_gizmogroup_invoke_prepare_cb : NULL;
+
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_append_ptr(BPY_RNA_gizmogroup_wrapper,
+ (void *)&dummywgt);
+
+ {
+ const char *owner_id = RNA_struct_state_owner_get();
+ if (owner_id) {
+ BLI_strncpy(gzgt->owner_id, owner_id, sizeof(gzgt->owner_id));
+ }
+ }
+
+ if (gzgt->flag & WM_GIZMOGROUPTYPE_PERSISTENT) {
+ WM_gizmo_group_type_add_ptr_ex(gzgt, gzmap_type);
+
+ /* update while blender is running */
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+ }
+
+ return dummywgt.ext.srna;
}
static void rna_GizmoGroup_unregister(struct Main *bmain, StructRNA *type)
{
- wmGizmoGroupType *gzgt = RNA_struct_blender_type_get(type);
+ wmGizmoGroupType *gzgt = RNA_struct_blender_type_get(type);
- if (!gzgt)
- return;
+ if (!gzgt)
+ return;
- RNA_struct_free_extension(type, &gzgt->ext);
- RNA_struct_free(&BLENDER_RNA, type);
+ RNA_struct_free_extension(type, &gzgt->ext);
+ RNA_struct_free(&BLENDER_RNA, type);
- WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
+ WM_main_add_notifier(NC_SCREEN | NA_EDITED, NULL);
- WM_gizmo_group_type_remove_ptr(bmain, gzgt);
+ WM_gizmo_group_type_remove_ptr(bmain, gzgt);
}
static void **rna_GizmoGroup_instance(PointerRNA *ptr)
{
- wmGizmoGroup *gzgroup = ptr->data;
- return &gzgroup->py_instance;
+ wmGizmoGroup *gzgroup = ptr->data;
+ return &gzgroup->py_instance;
}
-#endif /* WITH_PYTHON */
+# endif /* WITH_PYTHON */
static StructRNA *rna_GizmoGroup_refine(PointerRNA *gzgroup_ptr)
{
- wmGizmoGroup *gzgroup = gzgroup_ptr->data;
- return (gzgroup->type && gzgroup->type->ext.srna) ? gzgroup->type->ext.srna : &RNA_GizmoGroup;
+ wmGizmoGroup *gzgroup = gzgroup_ptr->data;
+ return (gzgroup->type && gzgroup->type->ext.srna) ? gzgroup->type->ext.srna : &RNA_GizmoGroup;
}
static void rna_GizmoGroup_gizmos_begin(CollectionPropertyIterator *iter, PointerRNA *gzgroup_ptr)
{
- wmGizmoGroup *gzgroup = gzgroup_ptr->data;
- rna_iterator_listbase_begin(iter, &gzgroup->gizmos, NULL);
+ wmGizmoGroup *gzgroup = gzgroup_ptr->data;
+ rna_iterator_listbase_begin(iter, &gzgroup->gizmos, NULL);
}
/** \} */
-
#else /* RNA_RUNTIME */
-
/* GizmoGroup.gizmos */
static void rna_def_gizmos(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "Gizmos");
- srna = RNA_def_struct(brna, "Gizmos", NULL);
- RNA_def_struct_sdna(srna, "wmGizmoGroup");
- RNA_def_struct_ui_text(srna, "Gizmos", "Collection of gizmos");
-
- func = RNA_def_function(srna, "new", "rna_GizmoGroup_gizmo_new");
- RNA_def_function_ui_description(func, "Add gizmo");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "type", "Type", 0, "", "Gizmo identifier"); /* optional */
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "New gizmo");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_GizmoGroup_gizmo_remove");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Delete gizmo");
- parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "New gizmo");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- func = RNA_def_function(srna, "clear", "rna_GizmoGroup_gizmo_clear");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Delete all gizmos");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "Gizmos");
+ srna = RNA_def_struct(brna, "Gizmos", NULL);
+ RNA_def_struct_sdna(srna, "wmGizmoGroup");
+ RNA_def_struct_ui_text(srna, "Gizmos", "Collection of gizmos");
+
+ func = RNA_def_function(srna, "new", "rna_GizmoGroup_gizmo_new");
+ RNA_def_function_ui_description(func, "Add gizmo");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "type", "Type", 0, "", "Gizmo identifier"); /* optional */
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "New gizmo");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "remove", "rna_GizmoGroup_gizmo_remove");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Delete gizmo");
+ parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "New gizmo");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ func = RNA_def_function(srna, "clear", "rna_GizmoGroup_gizmo_clear");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Delete all gizmos");
}
-
static void rna_def_gizmo(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "Gizmo");
- srna = RNA_def_struct(brna, "Gizmo", NULL);
- RNA_def_struct_sdna(srna, "wmGizmo");
- RNA_def_struct_ui_text(srna, "Gizmo", "Collection of gizmos");
- RNA_def_struct_refine_func(srna, "rna_Gizmo_refine");
-
-#ifdef WITH_PYTHON
- RNA_def_struct_register_funcs(
- srna,
- "rna_Gizmo_register",
- "rna_Gizmo_unregister",
- "rna_Gizmo_instance");
-#endif
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
-
- prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "GizmoProperties");
- RNA_def_property_ui_text(prop, "Properties", "");
- RNA_def_property_pointer_funcs(prop, "rna_Gizmo_properties_get", NULL, NULL, NULL);
-
- /* -------------------------------------------------------------------- */
- /* Registerable Variables */
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_string_maxlength(prop, MAX_NAME);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Gizmo_bl_idname_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- RNA_define_verify_sdna(1); /* not in sdna */
-
- /* wmGizmo.draw */
- func = RNA_def_function(srna, "draw", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* wmGizmo.draw_select */
- func = RNA_def_function(srna, "draw_select", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "select_id", 0, 0, INT_MAX, "", "", 0, INT_MAX);
-
- /* wmGizmo.test_select */
- func = RNA_def_function(srna, "test_select", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int_array(func, "location", 2, NULL, INT_MIN, INT_MAX, "Location", "Region coordinates", INT_MIN, INT_MAX);
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "intersect_id", -1, -1, INT_MAX, "", "Use -1 to skip this gizmo", -1, INT_MAX);
- RNA_def_function_return(func, parm);
-
- /* wmGizmo.handler */
- static EnumPropertyItem tweak_actions[] = {
- {WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""},
- {WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""},
- {0, NULL, 0, NULL, NULL},
- };
- func = RNA_def_function(srna, "modal", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "event", "Event", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- /* TODO, shuold be a enum-flag */
- parm = RNA_def_enum_flag(func, "tweak", tweak_actions, 0, "Tweak", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
- /* wmGizmo.property_update */
- /* TODO */
-
- /* wmGizmo.setup */
- func = RNA_def_function(srna, "setup", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
-
- /* wmGizmo.invoke */
- func = RNA_def_function(srna, "invoke", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "event", "Event", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_enum_flag(func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
- RNA_def_function_return(func, parm);
-
- /* wmGizmo.exit */
- func = RNA_def_function(srna, "exit", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_boolean(func, "cancel", 0, "Cancel, otherwise confirm", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* wmGizmo.cursor_get */
- /* TODO */
-
- /* wmGizmo.select_refresh */
- func = RNA_def_function(srna, "select_refresh", NULL);
- RNA_def_function_ui_description(func, "");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
-
-
- /* -------------------------------------------------------------------- */
- /* Instance Variables */
-
- prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "GizmoGroup");
- RNA_def_property_pointer_funcs(prop, "rna_Gizmo_group_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "", "Gizmo group this gizmo is a member of");
-
- /* Color & Alpha */
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_Gizmo_color_get", "rna_Gizmo_color_set", NULL);
-
- prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Alpha", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_get", "rna_Gizmo_alpha_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- /* Color & Alpha (highlight) */
- prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_funcs(prop, "rna_Gizmo_color_hi_get", "rna_Gizmo_color_hi_set", NULL);
-
- prop = RNA_def_property(srna, "alpha_highlight", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Alpha", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_hi_get", "rna_Gizmo_alpha_hi_set", NULL);
- RNA_def_property_range(prop, 0.0f, 1.0f);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "matrix_space", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Space Matrix", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_space_get", "rna_Gizmo_matrix_space_set", NULL);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Basis Matrix", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_basis_get", "rna_Gizmo_matrix_basis_set", NULL);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "matrix_offset", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Offset Matrix", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_offset_get", "rna_Gizmo_matrix_offset_set", NULL);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(prop, "Final World Matrix", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_world_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_NONE);
- RNA_def_property_ui_text(prop, "Scale Basis", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_scale_basis_get", "rna_Gizmo_scale_basis_set", NULL);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL);
- RNA_def_property_ui_text(prop, "Line Width", "");
- RNA_def_property_float_funcs(prop, "rna_Gizmo_line_width_get", "rna_Gizmo_line_width_set", NULL);
- RNA_def_property_range(prop, 0.0f, FLT_MAX);
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- /* wmGizmo.flag */
- /* WM_GIZMO_HIDDEN */
- prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_hide_get", "rna_Gizmo_flag_hide_set");
- RNA_def_property_ui_text(prop, "Hide", "");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_HIDDEN_SELECT */
- prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_hide_select_get", "rna_Gizmo_flag_hide_select_set");
- RNA_def_property_ui_text(prop, "Hide Select", "");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_MOVE_CURSOR */
- prop = RNA_def_property(srna, "use_grab_cursor", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_grab_cursor_get", "rna_Gizmo_flag_use_grab_cursor_set");
- RNA_def_property_ui_text(prop, "Grab Cursor", "");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- /* WM_GIZMO_DRAW_HOVER */
- prop = RNA_def_property(srna, "use_draw_hover", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_draw_hover_get", "rna_Gizmo_flag_use_draw_hover_set");
- RNA_def_property_ui_text(prop, "Draw Hover", "");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_DRAW_MODAL */
- prop = RNA_def_property(srna, "use_draw_modal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_draw_modal_get", "rna_Gizmo_flag_use_draw_modal_set");
- RNA_def_property_ui_text(prop, "Draw Active", "Draw while dragging");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_DRAW_VALUE */
- prop = RNA_def_property(srna, "use_draw_value", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_draw_value_get", "rna_Gizmo_flag_use_draw_value_set");
- RNA_def_property_ui_text(prop, "Draw Value", "Show an indicator for the current value while dragging");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_DRAW_OFFSET_SCALE */
- prop = RNA_def_property(srna, "use_draw_offset_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_draw_offset_scale_get", "rna_Gizmo_flag_use_draw_offset_scale_set");
- RNA_def_property_ui_text(prop, "Scale Offset", "Scale the offset matrix (use to apply screen-space offset)");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_DRAW_NO_SCALE (negated) */
- prop = RNA_def_property(srna, "use_draw_scale", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_draw_scale_get", "rna_Gizmo_flag_use_draw_scale_set");
- RNA_def_property_ui_text(prop, "Scale", "Use scale when calculating the matrix");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
- /* WM_GIZMO_SELECT_BACKGROUND */
- prop = RNA_def_property(srna, "use_select_background", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_select_background_get", "rna_Gizmo_flag_use_select_background_set");
- RNA_def_property_ui_text(prop, "Select Background", "Don't write into the depth buffer");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- /* WM_GIZMO_OPERATOR_TOOL_INIT */
- prop = RNA_def_property(srna, "use_operator_tool_properties", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(
- prop, "rna_Gizmo_flag_use_operator_tool_properties_get", "rna_Gizmo_flag_use_operator_tool_properties_set");
- RNA_def_property_ui_text(prop, "Tool Property Init",
- "Merge active tool properties on activation (does not overwrite existing)");
- RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
-
- /* wmGizmo.state (readonly) */
- /* WM_GIZMO_STATE_HIGHLIGHT */
- prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_highlight_get", NULL);
- RNA_def_property_ui_text(prop, "Highlight", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- /* WM_GIZMO_STATE_MODAL */
- prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_modal_get", NULL);
- RNA_def_property_ui_text(prop, "Highlight", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- /* WM_GIZMO_STATE_SELECT */
- /* (note that setting is involved, needs to handle array) */
- prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_select_get", "rna_Gizmo_state_select_set");
- RNA_def_property_ui_text(prop, "Select", "");
-
- RNA_api_gizmo(srna);
-
- srna = RNA_def_struct(brna, "GizmoProperties", NULL);
- RNA_def_struct_ui_text(srna, "Gizmo Properties", "Input properties of an Gizmo");
- RNA_def_struct_refine_func(srna, "rna_GizmoProperties_refine");
- RNA_def_struct_idprops_func(srna, "rna_GizmoProperties_idprops");
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "Gizmo");
+ srna = RNA_def_struct(brna, "Gizmo", NULL);
+ RNA_def_struct_sdna(srna, "wmGizmo");
+ RNA_def_struct_ui_text(srna, "Gizmo", "Collection of gizmos");
+ RNA_def_struct_refine_func(srna, "rna_Gizmo_refine");
+
+# ifdef WITH_PYTHON
+ RNA_def_struct_register_funcs(
+ srna, "rna_Gizmo_register", "rna_Gizmo_unregister", "rna_Gizmo_instance");
+# endif
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+
+ prop = RNA_def_property(srna, "properties", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "GizmoProperties");
+ RNA_def_property_ui_text(prop, "Properties", "");
+ RNA_def_property_pointer_funcs(prop, "rna_Gizmo_properties_get", NULL, NULL, NULL);
+
+ /* -------------------------------------------------------------------- */
+ /* Registerable Variables */
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_string_maxlength(prop, MAX_NAME);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_Gizmo_bl_idname_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ RNA_define_verify_sdna(1); /* not in sdna */
+
+ /* wmGizmo.draw */
+ func = RNA_def_function(srna, "draw", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* wmGizmo.draw_select */
+ func = RNA_def_function(srna, "draw_select", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(func, "select_id", 0, 0, INT_MAX, "", "", 0, INT_MAX);
+
+ /* wmGizmo.test_select */
+ func = RNA_def_function(srna, "test_select", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int_array(func,
+ "location",
+ 2,
+ NULL,
+ INT_MIN,
+ INT_MAX,
+ "Location",
+ "Region coordinates",
+ INT_MIN,
+ INT_MAX);
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(
+ func, "intersect_id", -1, -1, INT_MAX, "", "Use -1 to skip this gizmo", -1, INT_MAX);
+ RNA_def_function_return(func, parm);
+
+ /* wmGizmo.handler */
+ static EnumPropertyItem tweak_actions[] = {
+ {WM_GIZMO_TWEAK_PRECISE, "PRECISE", 0, "Precise", ""},
+ {WM_GIZMO_TWEAK_SNAP, "SNAP", 0, "Snap", ""},
+ {0, NULL, 0, NULL, NULL},
+ };
+ func = RNA_def_function(srna, "modal", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "event", "Event", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ /* TODO, shuold be a enum-flag */
+ parm = RNA_def_enum_flag(func, "tweak", tweak_actions, 0, "Tweak", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ parm = RNA_def_enum_flag(
+ func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
+ RNA_def_function_return(func, parm);
+ /* wmGizmo.property_update */
+ /* TODO */
+
+ /* wmGizmo.setup */
+ func = RNA_def_function(srna, "setup", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+
+ /* wmGizmo.invoke */
+ func = RNA_def_function(srna, "invoke", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "event", "Event", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_enum_flag(
+ func, "result", rna_enum_operator_return_items, OPERATOR_CANCELLED, "result", "");
+ RNA_def_function_return(func, parm);
+
+ /* wmGizmo.exit */
+ func = RNA_def_function(srna, "exit", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_boolean(func, "cancel", 0, "Cancel, otherwise confirm", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* wmGizmo.cursor_get */
+ /* TODO */
+
+ /* wmGizmo.select_refresh */
+ func = RNA_def_function(srna, "select_refresh", NULL);
+ RNA_def_function_ui_description(func, "");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL | FUNC_ALLOW_WRITE);
+
+ /* -------------------------------------------------------------------- */
+ /* Instance Variables */
+
+ prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_struct_type(prop, "GizmoGroup");
+ RNA_def_property_pointer_funcs(prop, "rna_Gizmo_group_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "", "Gizmo group this gizmo is a member of");
+
+ /* Color & Alpha */
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_Gizmo_color_get", "rna_Gizmo_color_set", NULL);
+
+ prop = RNA_def_property(srna, "alpha", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Alpha", "");
+ RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_get", "rna_Gizmo_alpha_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ /* Color & Alpha (highlight) */
+ prop = RNA_def_property(srna, "color_highlight", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_funcs(prop, "rna_Gizmo_color_hi_get", "rna_Gizmo_color_hi_set", NULL);
+
+ prop = RNA_def_property(srna, "alpha_highlight", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Alpha", "");
+ RNA_def_property_float_funcs(prop, "rna_Gizmo_alpha_hi_get", "rna_Gizmo_alpha_hi_set", NULL);
+ RNA_def_property_range(prop, 0.0f, 1.0f);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "matrix_space", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Space Matrix", "");
+ RNA_def_property_float_funcs(
+ prop, "rna_Gizmo_matrix_space_get", "rna_Gizmo_matrix_space_set", NULL);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "matrix_basis", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Basis Matrix", "");
+ RNA_def_property_float_funcs(
+ prop, "rna_Gizmo_matrix_basis_get", "rna_Gizmo_matrix_basis_set", NULL);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "matrix_offset", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Offset Matrix", "");
+ RNA_def_property_float_funcs(
+ prop, "rna_Gizmo_matrix_offset_get", "rna_Gizmo_matrix_offset_set", NULL);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "matrix_world", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(prop, "Final World Matrix", "");
+ RNA_def_property_float_funcs(prop, "rna_Gizmo_matrix_world_get", NULL, NULL);
+
+ prop = RNA_def_property(srna, "scale_basis", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Scale Basis", "");
+ RNA_def_property_float_funcs(
+ prop, "rna_Gizmo_scale_basis_get", "rna_Gizmo_scale_basis_set", NULL);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ prop = RNA_def_property(srna, "line_width", PROP_FLOAT, PROP_PIXEL);
+ RNA_def_property_ui_text(prop, "Line Width", "");
+ RNA_def_property_float_funcs(prop, "rna_Gizmo_line_width_get", "rna_Gizmo_line_width_set", NULL);
+ RNA_def_property_range(prop, 0.0f, FLT_MAX);
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ /* wmGizmo.flag */
+ /* WM_GIZMO_HIDDEN */
+ prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Gizmo_flag_hide_get", "rna_Gizmo_flag_hide_set");
+ RNA_def_property_ui_text(prop, "Hide", "");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_HIDDEN_SELECT */
+ prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_hide_select_get", "rna_Gizmo_flag_hide_select_set");
+ RNA_def_property_ui_text(prop, "Hide Select", "");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_MOVE_CURSOR */
+ prop = RNA_def_property(srna, "use_grab_cursor", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_use_grab_cursor_get", "rna_Gizmo_flag_use_grab_cursor_set");
+ RNA_def_property_ui_text(prop, "Grab Cursor", "");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ /* WM_GIZMO_DRAW_HOVER */
+ prop = RNA_def_property(srna, "use_draw_hover", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_use_draw_hover_get", "rna_Gizmo_flag_use_draw_hover_set");
+ RNA_def_property_ui_text(prop, "Draw Hover", "");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_DRAW_MODAL */
+ prop = RNA_def_property(srna, "use_draw_modal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_use_draw_modal_get", "rna_Gizmo_flag_use_draw_modal_set");
+ RNA_def_property_ui_text(prop, "Draw Active", "Draw while dragging");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_DRAW_VALUE */
+ prop = RNA_def_property(srna, "use_draw_value", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_use_draw_value_get", "rna_Gizmo_flag_use_draw_value_set");
+ RNA_def_property_ui_text(
+ prop, "Draw Value", "Show an indicator for the current value while dragging");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_DRAW_OFFSET_SCALE */
+ prop = RNA_def_property(srna, "use_draw_offset_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop,
+ "rna_Gizmo_flag_use_draw_offset_scale_get",
+ "rna_Gizmo_flag_use_draw_offset_scale_set");
+ RNA_def_property_ui_text(
+ prop, "Scale Offset", "Scale the offset matrix (use to apply screen-space offset)");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_DRAW_NO_SCALE (negated) */
+ prop = RNA_def_property(srna, "use_draw_scale", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(
+ prop, "rna_Gizmo_flag_use_draw_scale_get", "rna_Gizmo_flag_use_draw_scale_set");
+ RNA_def_property_ui_text(prop, "Scale", "Use scale when calculating the matrix");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+ /* WM_GIZMO_SELECT_BACKGROUND */
+ prop = RNA_def_property(srna, "use_select_background", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop,
+ "rna_Gizmo_flag_use_select_background_get",
+ "rna_Gizmo_flag_use_select_background_set");
+ RNA_def_property_ui_text(prop, "Select Background", "Don't write into the depth buffer");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ /* WM_GIZMO_OPERATOR_TOOL_INIT */
+ prop = RNA_def_property(srna, "use_operator_tool_properties", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop,
+ "rna_Gizmo_flag_use_operator_tool_properties_get",
+ "rna_Gizmo_flag_use_operator_tool_properties_set");
+ RNA_def_property_ui_text(
+ prop,
+ "Tool Property Init",
+ "Merge active tool properties on activation (does not overwrite existing)");
+ RNA_def_property_update(prop, NC_SCREEN | NA_EDITED, NULL);
+
+ /* wmGizmo.state (readonly) */
+ /* WM_GIZMO_STATE_HIGHLIGHT */
+ prop = RNA_def_property(srna, "is_highlight", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_highlight_get", NULL);
+ RNA_def_property_ui_text(prop, "Highlight", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ /* WM_GIZMO_STATE_MODAL */
+ prop = RNA_def_property(srna, "is_modal", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_is_modal_get", NULL);
+ RNA_def_property_ui_text(prop, "Highlight", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ /* WM_GIZMO_STATE_SELECT */
+ /* (note that setting is involved, needs to handle array) */
+ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_funcs(prop, "rna_Gizmo_state_select_get", "rna_Gizmo_state_select_set");
+ RNA_def_property_ui_text(prop, "Select", "");
+
+ RNA_api_gizmo(srna);
+
+ srna = RNA_def_struct(brna, "GizmoProperties", NULL);
+ RNA_def_struct_ui_text(srna, "Gizmo Properties", "Input properties of an Gizmo");
+ RNA_def_struct_refine_func(srna, "rna_GizmoProperties_refine");
+ RNA_def_struct_idprops_func(srna, "rna_GizmoProperties_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
static void rna_def_gizmogroup(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "GizmoGroup", NULL);
- RNA_def_struct_ui_text(srna, "GizmoGroup", "Storage of an operator being executed, or registered after execution");
- RNA_def_struct_sdna(srna, "wmGizmoGroup");
- RNA_def_struct_refine_func(srna, "rna_GizmoGroup_refine");
-#ifdef WITH_PYTHON
- RNA_def_struct_register_funcs(
- srna,
- "rna_GizmoGroup_register",
- "rna_GizmoGroup_unregister",
- "rna_GizmoGroup_instance");
-#endif
- RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
-
- /* -------------------------------------------------------------------- */
- /* Registration */
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->idname");
- RNA_def_property_string_maxlength(prop, MAX_NAME);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_idname_set");
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->name");
- RNA_def_property_string_maxlength(prop, MAX_NAME); /* else it uses the pointer size! */
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_label_set");
- /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
- RNA_def_property_flag(prop, PROP_REGISTER);
-
- prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.spaceid");
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in");
-
- prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.regionid");
- RNA_def_property_enum_items(prop, rna_enum_region_type_items);
- RNA_def_property_flag(prop, PROP_REGISTER);
- RNA_def_property_ui_text(prop, "Region Type", "The region where the panel is going to be used in");
-
- prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
- RNA_def_property_string_sdna(prop, NULL, "type->owner_id");
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
-
- /* bl_options */
- static EnumPropertyItem gizmogroup_flag_items[] = {
- {WM_GIZMOGROUPTYPE_3D, "3D", 0, "3D",
- "Use in 3D viewport"},
- {WM_GIZMOGROUPTYPE_SCALE, "SCALE", 0, "Scale",
- "Scale to respect zoom (otherwise zoom independent draw size)"},
- {WM_GIZMOGROUPTYPE_DEPTH_3D, "DEPTH_3D", 0, "Depth 3D",
- "Supports culled depth by other objects in the view"},
- {WM_GIZMOGROUPTYPE_SELECT, "SELECT", 0, "Select",
- "Supports selection"},
- {WM_GIZMOGROUPTYPE_PERSISTENT, "PERSISTENT", 0, "Persistent",
- ""},
- {WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL, "SHOW_MODAL_ALL", 0, "Show Modal All",
- "Show all while interacting"},
- {WM_GIZMOGROUPTYPE_TOOL_INIT, "TOOL_INIT", 0, "Tool Init",
- "Postpone running until tool operator run (when used with a tool)"},
- {0, NULL, 0, NULL, NULL},
- };
- prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "type->flag");
- RNA_def_property_enum_items(prop, gizmogroup_flag_items);
- RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
- RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
-
- RNA_define_verify_sdna(1); /* not in sdna */
-
-
- /* Functions */
-
- /* poll */
- func = RNA_def_function(srna, "poll", NULL);
- RNA_def_function_ui_description(func, "Test if the gizmo group can be called or not");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* setup_keymap */
- func = RNA_def_function(srna, "setup_keymap", NULL);
- RNA_def_function_ui_description(
- func,
- "Initialize keymaps for this gizmo group, use fallback keymap when not present");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- /* return */
- parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
- RNA_def_property_flag(parm, PROP_NEVER_NULL);
- RNA_def_function_return(func, parm);
-
- /* setup */
- func = RNA_def_function(srna, "setup", NULL);
- RNA_def_function_ui_description(func, "Create gizmos function for the gizmo group");
- RNA_def_function_flag(func, FUNC_REGISTER);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* refresh */
- func = RNA_def_function(srna, "refresh", NULL);
- RNA_def_function_ui_description(func, "Refresh data (called on common state changes such as selection)");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "draw_prepare", NULL);
- RNA_def_function_ui_description(func, "Run before each redraw");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "invoke_prepare", NULL);
- RNA_def_function_ui_description(func, "Run before invoke");
- RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
- parm = RNA_def_pointer(func, "context", "Context", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- /* -------------------------------------------------------------------- */
- /* Instance Variables */
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_string_funcs(prop, "rna_GizmoGroup_name_get", "rna_GizmoGroup_name_length", NULL);
- RNA_def_property_ui_text(prop, "Name", "");
-
- prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
- RNA_def_property_boolean_funcs(prop, "rna_GizmoGroup_has_reports_get", NULL);
- RNA_def_property_ui_text(prop, "Has Reports",
- "GizmoGroup has a set of reports (warnings and errors) from last execution");
-
-
- RNA_define_verify_sdna(0); /* not in sdna */
-
- prop = RNA_def_property(srna, "gizmos", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "gizmos", NULL);
- RNA_def_property_struct_type(prop, "Gizmo");
- RNA_def_property_collection_funcs(
- prop, "rna_GizmoGroup_gizmos_begin", "rna_iterator_listbase_next",
- "rna_iterator_listbase_end", "rna_iterator_listbase_get",
- NULL, NULL, NULL, NULL);
-
- RNA_def_property_ui_text(prop, "Gizmos", "List of gizmos in the Gizmo Map");
- rna_def_gizmo(brna, prop);
- rna_def_gizmos(brna, prop);
-
- RNA_define_verify_sdna(1); /* not in sdna */
-
- RNA_api_gizmogroup(srna);
-
- srna = RNA_def_struct(brna, "GizmoGroupProperties", NULL);
- RNA_def_struct_ui_text(srna, "Gizmo Group Properties", "Input properties of a Gizmo Group");
- RNA_def_struct_refine_func(srna, "rna_GizmoGroupProperties_refine");
- RNA_def_struct_idprops_func(srna, "rna_GizmoGroupProperties_idprops");
- RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ srna = RNA_def_struct(brna, "GizmoGroup", NULL);
+ RNA_def_struct_ui_text(
+ srna, "GizmoGroup", "Storage of an operator being executed, or registered after execution");
+ RNA_def_struct_sdna(srna, "wmGizmoGroup");
+ RNA_def_struct_refine_func(srna, "rna_GizmoGroup_refine");
+# ifdef WITH_PYTHON
+ RNA_def_struct_register_funcs(
+ srna, "rna_GizmoGroup_register", "rna_GizmoGroup_unregister", "rna_GizmoGroup_instance");
+# endif
+ RNA_def_struct_translation_context(srna, BLT_I18NCONTEXT_OPERATOR_DEFAULT);
+
+ /* -------------------------------------------------------------------- */
+ /* Registration */
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "bl_idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->idname");
+ RNA_def_property_string_maxlength(prop, MAX_NAME);
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_idname_set");
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "bl_label", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->name");
+ RNA_def_property_string_maxlength(prop, MAX_NAME); /* else it uses the pointer size! */
+ RNA_def_property_string_funcs(prop, NULL, NULL, "rna_GizmoGroup_bl_label_set");
+ /* RNA_def_property_clear_flag(prop, PROP_EDITABLE); */
+ RNA_def_property_flag(prop, PROP_REGISTER);
+
+ prop = RNA_def_property(srna, "bl_space_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.spaceid");
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(prop, "Space type", "The space where the panel is going to be used in");
+
+ prop = RNA_def_property(srna, "bl_region_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->gzmap_params.regionid");
+ RNA_def_property_enum_items(prop, rna_enum_region_type_items);
+ RNA_def_property_flag(prop, PROP_REGISTER);
+ RNA_def_property_ui_text(
+ prop, "Region Type", "The region where the panel is going to be used in");
+
+ prop = RNA_def_property(srna, "bl_owner_id", PROP_STRING, PROP_NONE);
+ RNA_def_property_string_sdna(prop, NULL, "type->owner_id");
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL);
+
+ /* bl_options */
+ static EnumPropertyItem gizmogroup_flag_items[] = {
+ {WM_GIZMOGROUPTYPE_3D, "3D", 0, "3D", "Use in 3D viewport"},
+ {WM_GIZMOGROUPTYPE_SCALE,
+ "SCALE",
+ 0,
+ "Scale",
+ "Scale to respect zoom (otherwise zoom independent draw size)"},
+ {WM_GIZMOGROUPTYPE_DEPTH_3D,
+ "DEPTH_3D",
+ 0,
+ "Depth 3D",
+ "Supports culled depth by other objects in the view"},
+ {WM_GIZMOGROUPTYPE_SELECT, "SELECT", 0, "Select", "Supports selection"},
+ {WM_GIZMOGROUPTYPE_PERSISTENT, "PERSISTENT", 0, "Persistent", ""},
+ {WM_GIZMOGROUPTYPE_DRAW_MODAL_ALL,
+ "SHOW_MODAL_ALL",
+ 0,
+ "Show Modal All",
+ "Show all while interacting"},
+ {WM_GIZMOGROUPTYPE_TOOL_INIT,
+ "TOOL_INIT",
+ 0,
+ "Tool Init",
+ "Postpone running until tool operator run (when used with a tool)"},
+ {0, NULL, 0, NULL, NULL},
+ };
+ prop = RNA_def_property(srna, "bl_options", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "type->flag");
+ RNA_def_property_enum_items(prop, gizmogroup_flag_items);
+ RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL | PROP_ENUM_FLAG);
+ RNA_def_property_ui_text(prop, "Options", "Options for this operator type");
+
+ RNA_define_verify_sdna(1); /* not in sdna */
+
+ /* Functions */
+
+ /* poll */
+ func = RNA_def_function(srna, "poll", NULL);
+ RNA_def_function_ui_description(func, "Test if the gizmo group can be called or not");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ RNA_def_function_return(func, RNA_def_boolean(func, "visible", 1, "", ""));
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* setup_keymap */
+ func = RNA_def_function(srna, "setup_keymap", NULL);
+ RNA_def_function_ui_description(
+ func, "Initialize keymaps for this gizmo group, use fallback keymap when not present");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "keyconfig", "KeyConfig", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_pointer(func, "keymap", "KeyMap", "", "");
+ RNA_def_property_flag(parm, PROP_NEVER_NULL);
+ RNA_def_function_return(func, parm);
+
+ /* setup */
+ func = RNA_def_function(srna, "setup", NULL);
+ RNA_def_function_ui_description(func, "Create gizmos function for the gizmo group");
+ RNA_def_function_flag(func, FUNC_REGISTER);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* refresh */
+ func = RNA_def_function(srna, "refresh", NULL);
+ RNA_def_function_ui_description(
+ func, "Refresh data (called on common state changes such as selection)");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "draw_prepare", NULL);
+ RNA_def_function_ui_description(func, "Run before each redraw");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ func = RNA_def_function(srna, "invoke_prepare", NULL);
+ RNA_def_function_ui_description(func, "Run before invoke");
+ RNA_def_function_flag(func, FUNC_REGISTER_OPTIONAL);
+ parm = RNA_def_pointer(func, "context", "Context", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_pointer(func, "gizmo", "Gizmo", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* -------------------------------------------------------------------- */
+ /* Instance Variables */
+
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_string_funcs(
+ prop, "rna_GizmoGroup_name_get", "rna_GizmoGroup_name_length", NULL);
+ RNA_def_property_ui_text(prop, "Name", "");
+
+ prop = RNA_def_property(srna, "has_reports", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* this is 'virtual' property */
+ RNA_def_property_boolean_funcs(prop, "rna_GizmoGroup_has_reports_get", NULL);
+ RNA_def_property_ui_text(
+ prop,
+ "Has Reports",
+ "GizmoGroup has a set of reports (warnings and errors) from last execution");
+
+ RNA_define_verify_sdna(0); /* not in sdna */
+
+ prop = RNA_def_property(srna, "gizmos", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "gizmos", NULL);
+ RNA_def_property_struct_type(prop, "Gizmo");
+ RNA_def_property_collection_funcs(prop,
+ "rna_GizmoGroup_gizmos_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_iterator_listbase_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+
+ RNA_def_property_ui_text(prop, "Gizmos", "List of gizmos in the Gizmo Map");
+ rna_def_gizmo(brna, prop);
+ rna_def_gizmos(brna, prop);
+
+ RNA_define_verify_sdna(1); /* not in sdna */
+
+ RNA_api_gizmogroup(srna);
+
+ srna = RNA_def_struct(brna, "GizmoGroupProperties", NULL);
+ RNA_def_struct_ui_text(srna, "Gizmo Group Properties", "Input properties of a Gizmo Group");
+ RNA_def_struct_refine_func(srna, "rna_GizmoGroupProperties_refine");
+ RNA_def_struct_idprops_func(srna, "rna_GizmoGroupProperties_idprops");
+ RNA_def_struct_flag(srna, STRUCT_NO_DATABLOCK_IDPROPERTIES);
}
void RNA_def_wm_gizmo(BlenderRNA *brna)
{
- rna_def_gizmogroup(brna);
+ rna_def_gizmogroup(brna);
}
#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_wm_gizmo_api.c b/source/blender/makesrna/intern/rna_wm_gizmo_api.c
index 48957325963..f7335572a14 100644
--- a/source/blender/makesrna/intern/rna_wm_gizmo_api.c
+++ b/source/blender/makesrna/intern/rna_wm_gizmo_api.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
@@ -33,126 +32,150 @@
#include "WM_api.h"
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "UI_interface.h"
-#include "BKE_context.h"
+# include "UI_interface.h"
+# include "BKE_context.h"
-#include "ED_gizmo_library.h"
+# include "ED_gizmo_library.h"
-static void rna_gizmo_draw_preset_box(
- wmGizmo *gz, float matrix[16], int select_id)
+static void rna_gizmo_draw_preset_box(wmGizmo *gz, float matrix[16], int select_id)
{
- ED_gizmo_draw_preset_box(gz, (float (*)[4])matrix, select_id);
+ ED_gizmo_draw_preset_box(gz, (float(*)[4])matrix, select_id);
}
-static void rna_gizmo_draw_preset_arrow(
- wmGizmo *gz, float matrix[16], int axis, int select_id)
+static void rna_gizmo_draw_preset_arrow(wmGizmo *gz, float matrix[16], int axis, int select_id)
{
- ED_gizmo_draw_preset_arrow(gz, (float (*)[4])matrix, axis, select_id);
+ ED_gizmo_draw_preset_arrow(gz, (float(*)[4])matrix, axis, select_id);
}
-static void rna_gizmo_draw_preset_circle(
- wmGizmo *gz, float matrix[16], int axis, int select_id)
+static void rna_gizmo_draw_preset_circle(wmGizmo *gz, float matrix[16], int axis, int select_id)
{
- ED_gizmo_draw_preset_circle(gz, (float (*)[4])matrix, axis, select_id);
+ ED_gizmo_draw_preset_circle(gz, (float(*)[4])matrix, axis, select_id);
}
static void rna_gizmo_draw_preset_facemap(
- wmGizmo *gz, struct bContext *C, struct Object *ob, int facemap, int select_id)
+ wmGizmo *gz, struct bContext *C, struct Object *ob, int facemap, int select_id)
{
- ED_gizmo_draw_preset_facemap(C, gz, ob, facemap, select_id);
+ ED_gizmo_draw_preset_facemap(C, gz, ob, facemap, select_id);
}
/* -------------------------------------------------------------------- */
/** \name Gizmo Property Define
* \{ */
-static void rna_gizmo_target_set_prop(
- wmGizmo *gz, ReportList *reports, const char *target_propname,
- PointerRNA *ptr, const char *propname, int index)
+static void rna_gizmo_target_set_prop(wmGizmo *gz,
+ ReportList *reports,
+ const char *target_propname,
+ PointerRNA *ptr,
+ const char *propname,
+ int index)
{
- const wmGizmoPropertyType *gz_prop_type =
- WM_gizmotype_target_property_find(gz->type, target_propname);
- if (gz_prop_type == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Gizmo target property '%s.%s' not found",
- gz->type->idname, target_propname);
- return;
- }
-
- PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
- if (prop == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Property '%s.%s' not found",
- RNA_struct_identifier(ptr->type), target_propname);
- return;
- }
-
- if (gz_prop_type->data_type != RNA_property_type(prop)) {
- const int gizmo_type_index = RNA_enum_from_value(rna_enum_property_type_items, gz_prop_type->data_type);
- const int prop_type_index = RNA_enum_from_value(rna_enum_property_type_items, RNA_property_type(prop));
- BLI_assert((gizmo_type_index != -1) && (prop_type_index == -1));
-
- BKE_reportf(reports, RPT_ERROR, "Gizmo target '%s.%s' expects '%s', '%s.%s' is '%s'",
- gz->type->idname, target_propname,
- rna_enum_property_type_items[gizmo_type_index].identifier,
- RNA_struct_identifier(ptr->type), propname,
- rna_enum_property_type_items[prop_type_index].identifier);
- return;
- }
-
- if (RNA_property_array_check(prop)) {
- if (index == -1) {
- const int prop_array_length = RNA_property_array_length(ptr, prop);
- if (gz_prop_type->array_length != prop_array_length) {
- BKE_reportf(reports, RPT_ERROR,
- "Gizmo target property '%s.%s' expects an array of length %d, found %d",
- gz->type->idname, target_propname,
- gz_prop_type->array_length,
- prop_array_length);
- return;
- }
- }
- }
- else {
- if (gz_prop_type->array_length != 1) {
- BKE_reportf(reports, RPT_ERROR,
- "Gizmo target property '%s.%s' expects an array of length %d",
- gz->type->idname, target_propname,
- gz_prop_type->array_length);
- return;
- }
- }
-
- if (index >= gz_prop_type->array_length) {
- BKE_reportf(reports, RPT_ERROR, "Gizmo target property '%s.%s', index %d must be below %d",
- gz->type->idname, target_propname, index, gz_prop_type->array_length);
- return;
- }
-
- WM_gizmo_target_property_def_rna_ptr(gz, gz_prop_type, ptr, prop, index);
+ const wmGizmoPropertyType *gz_prop_type = WM_gizmotype_target_property_find(gz->type,
+ target_propname);
+ if (gz_prop_type == NULL) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Gizmo target property '%s.%s' not found",
+ gz->type->idname,
+ target_propname);
+ return;
+ }
+
+ PropertyRNA *prop = RNA_struct_find_property(ptr, propname);
+ if (prop == NULL) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Property '%s.%s' not found",
+ RNA_struct_identifier(ptr->type),
+ target_propname);
+ return;
+ }
+
+ if (gz_prop_type->data_type != RNA_property_type(prop)) {
+ const int gizmo_type_index = RNA_enum_from_value(rna_enum_property_type_items,
+ gz_prop_type->data_type);
+ const int prop_type_index = RNA_enum_from_value(rna_enum_property_type_items,
+ RNA_property_type(prop));
+ BLI_assert((gizmo_type_index != -1) && (prop_type_index == -1));
+
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Gizmo target '%s.%s' expects '%s', '%s.%s' is '%s'",
+ gz->type->idname,
+ target_propname,
+ rna_enum_property_type_items[gizmo_type_index].identifier,
+ RNA_struct_identifier(ptr->type),
+ propname,
+ rna_enum_property_type_items[prop_type_index].identifier);
+ return;
+ }
+
+ if (RNA_property_array_check(prop)) {
+ if (index == -1) {
+ const int prop_array_length = RNA_property_array_length(ptr, prop);
+ if (gz_prop_type->array_length != prop_array_length) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Gizmo target property '%s.%s' expects an array of length %d, found %d",
+ gz->type->idname,
+ target_propname,
+ gz_prop_type->array_length,
+ prop_array_length);
+ return;
+ }
+ }
+ }
+ else {
+ if (gz_prop_type->array_length != 1) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Gizmo target property '%s.%s' expects an array of length %d",
+ gz->type->idname,
+ target_propname,
+ gz_prop_type->array_length);
+ return;
+ }
+ }
+
+ if (index >= gz_prop_type->array_length) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Gizmo target property '%s.%s', index %d must be below %d",
+ gz->type->idname,
+ target_propname,
+ index,
+ gz_prop_type->array_length);
+ return;
+ }
+
+ WM_gizmo_target_property_def_rna_ptr(gz, gz_prop_type, ptr, prop, index);
}
-static PointerRNA rna_gizmo_target_set_operator(
- wmGizmo *gz, ReportList *reports, const char *opname, int part_index)
+static PointerRNA rna_gizmo_target_set_operator(wmGizmo *gz,
+ ReportList *reports,
+ const char *opname,
+ int part_index)
{
- wmOperatorType *ot;
-
- ot = WM_operatortype_find(opname, 0); /* print error next */
- if (!ot || !ot->srna) {
- BKE_reportf(reports, RPT_ERROR, "%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
- return PointerRNA_NULL;
- }
-
- /* For the return value to be usable, we need 'PointerRNA.data' to be set. */
- IDProperty *properties;
- {
- IDPropertyTemplate val = {0};
- properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties");
- }
-
- return *WM_gizmo_operator_set(gz, part_index, ot, properties);
+ wmOperatorType *ot;
+
+ ot = WM_operatortype_find(opname, 0); /* print error next */
+ if (!ot || !ot->srna) {
+ BKE_reportf(
+ reports, RPT_ERROR, "%s '%s'", ot ? "unknown operator" : "operator missing srna", opname);
+ return PointerRNA_NULL;
+ }
+
+ /* For the return value to be usable, we need 'PointerRNA.data' to be set. */
+ IDProperty *properties;
+ {
+ IDPropertyTemplate val = {0};
+ properties = IDP_New(IDP_GROUP, &val, "wmGizmoProperties");
+ }
+
+ return *WM_gizmo_operator_set(gz, part_index, ot, properties);
}
/** \} */
@@ -161,17 +184,20 @@ static PointerRNA rna_gizmo_target_set_operator(
/** \name Gizmo Property Access
* \{ */
-static bool rna_gizmo_target_is_valid(
- wmGizmo *gz, ReportList *reports, const char *target_propname)
+static bool rna_gizmo_target_is_valid(wmGizmo *gz,
+ ReportList *reports,
+ const char *target_propname)
{
- wmGizmoProperty *gz_prop =
- WM_gizmo_target_property_find(gz, target_propname);
- if (gz_prop == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Gizmo target property '%s.%s' not found",
- gz->type->idname, target_propname);
- return false;
- }
- return WM_gizmo_target_property_is_valid(gz_prop);
+ wmGizmoProperty *gz_prop = WM_gizmo_target_property_find(gz, target_propname);
+ if (gz_prop == NULL) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "Gizmo target property '%s.%s' not found",
+ gz->type->idname,
+ target_propname);
+ return false;
+ }
+ return WM_gizmo_target_property_is_valid(gz_prop);
}
/** \} */
@@ -180,107 +206,105 @@ static bool rna_gizmo_target_is_valid(
void RNA_api_gizmo(StructRNA *srna)
{
- /* Utility draw functions, since we don't expose new OpenGL drawing wrappers via Python yet.
- * exactly how these should be exposed isn't totally clear.
- * However it's probably good to have some high level API's for this anyway.
- * Just note that this could be re-worked once tests are done.
- */
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- /* -------------------------------------------------------------------- */
- /* Primitive Shapes */
-
- /* draw_preset_box */
- func = RNA_def_function(srna, "draw_preset_box", "rna_gizmo_draw_preset_box");
- RNA_def_function_ui_description(func, "Draw a box");
- parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The matrix to transform");
- RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
-
- /* draw_preset_box */
- func = RNA_def_function(srna, "draw_preset_arrow", "rna_gizmo_draw_preset_arrow");
- RNA_def_function_ui_description(func, "Draw a box");
- parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The matrix to transform");
- RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation");
- RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
-
- func = RNA_def_function(srna, "draw_preset_circle", "rna_gizmo_draw_preset_circle");
- RNA_def_function_ui_description(func, "Draw a box");
- parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
- RNA_def_property_ui_text(parm, "", "The matrix to transform");
- RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation");
- RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
-
- /* -------------------------------------------------------------------- */
- /* Other Shapes */
-
- /* draw_preset_facemap */
- func = RNA_def_function(srna, "draw_preset_facemap", "rna_gizmo_draw_preset_facemap");
- RNA_def_function_ui_description(func, "Draw the face-map of a mesh object");
- RNA_def_function_flag(func, FUNC_USE_CONTEXT);
- parm = RNA_def_pointer(func, "object", "Object", "", "Object");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_int(func, "face_map", 0, 0, INT_MAX, "Face map index", "", 0, INT_MAX);
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
-
-
- /* -------------------------------------------------------------------- */
- /* Property API */
-
- /* Define Properties */
- /* note, 'target_set_handler' is defined in 'bpy_rna_gizmo.c' */
- func = RNA_def_function(srna, "target_set_prop", "rna_gizmo_target_set_prop");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "");
- parm = RNA_def_string(func, "target", NULL, 0, "", "Target property");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* similar to UILayout.prop */
- parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", -1, -1, INT_MAX, "", "", -1, INT_MAX); /* RNA_NO_INDEX == -1 */
-
- func = RNA_def_function(srna, "target_set_operator", "rna_gizmo_target_set_operator");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(
- func, "Operator to run when activating the gizmo "
- "(overrides property targets)");
- parm = RNA_def_string(func, "operator", NULL, 0, "", "Target operator");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_int(func, "index", 0, 0, 255, "Part index", "", 0, 255);
-
- /* similar to UILayout.operator */
- parm = RNA_def_pointer(func, "properties", "OperatorProperties", "", "Operator properties to fill in");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- /* Access Properties */
- /* note, 'target_get', 'target_set' is defined in 'bpy_rna_gizmo.c' */
- func = RNA_def_function(srna, "target_is_valid", "rna_gizmo_target_is_valid");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "property", NULL, 0, "", "Property identifier");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_function_ui_description(func, "");
- parm = RNA_def_boolean(func, "result", 0, "", "");
- RNA_def_function_return(func, parm);
-
+ /* Utility draw functions, since we don't expose new OpenGL drawing wrappers via Python yet.
+ * exactly how these should be exposed isn't totally clear.
+ * However it's probably good to have some high level API's for this anyway.
+ * Just note that this could be re-worked once tests are done.
+ */
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ /* -------------------------------------------------------------------- */
+ /* Primitive Shapes */
+
+ /* draw_preset_box */
+ func = RNA_def_function(srna, "draw_preset_box", "rna_gizmo_draw_preset_box");
+ RNA_def_function_ui_description(func, "Draw a box");
+ parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The matrix to transform");
+ RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
+
+ /* draw_preset_box */
+ func = RNA_def_function(srna, "draw_preset_arrow", "rna_gizmo_draw_preset_arrow");
+ RNA_def_function_ui_description(func, "Draw a box");
+ parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The matrix to transform");
+ RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation");
+ RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
+
+ func = RNA_def_function(srna, "draw_preset_circle", "rna_gizmo_draw_preset_circle");
+ RNA_def_function_ui_description(func, "Draw a box");
+ parm = RNA_def_property(func, "matrix", PROP_FLOAT, PROP_MATRIX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_multi_array(parm, 2, rna_matrix_dimsize_4x4);
+ RNA_def_property_ui_text(parm, "", "The matrix to transform");
+ RNA_def_enum(func, "axis", rna_enum_object_axis_items, 2, "", "Arrow Orientation");
+ RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
+
+ /* -------------------------------------------------------------------- */
+ /* Other Shapes */
+
+ /* draw_preset_facemap */
+ func = RNA_def_function(srna, "draw_preset_facemap", "rna_gizmo_draw_preset_facemap");
+ RNA_def_function_ui_description(func, "Draw the face-map of a mesh object");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT);
+ parm = RNA_def_pointer(func, "object", "Object", "", "Object");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ parm = RNA_def_int(func, "face_map", 0, 0, INT_MAX, "Face map index", "", 0, INT_MAX);
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "select_id", -1, -1, INT_MAX, "Zero when not selecting", "", -1, INT_MAX);
+
+ /* -------------------------------------------------------------------- */
+ /* Property API */
+
+ /* Define Properties */
+ /* note, 'target_set_handler' is defined in 'bpy_rna_gizmo.c' */
+ func = RNA_def_function(srna, "target_set_prop", "rna_gizmo_target_set_prop");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "");
+ parm = RNA_def_string(func, "target", NULL, 0, "", "Target property");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* similar to UILayout.prop */
+ parm = RNA_def_pointer(func, "data", "AnyType", "", "Data from which to take property");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in data");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", -1, -1, INT_MAX, "", "", -1, INT_MAX); /* RNA_NO_INDEX == -1 */
+
+ func = RNA_def_function(srna, "target_set_operator", "rna_gizmo_target_set_operator");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func,
+ "Operator to run when activating the gizmo "
+ "(overrides property targets)");
+ parm = RNA_def_string(func, "operator", NULL, 0, "", "Target operator");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_int(func, "index", 0, 0, 255, "Part index", "", 0, 255);
+
+ /* similar to UILayout.operator */
+ parm = RNA_def_pointer(
+ func, "properties", "OperatorProperties", "", "Operator properties to fill in");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ /* Access Properties */
+ /* note, 'target_get', 'target_set' is defined in 'bpy_rna_gizmo.c' */
+ func = RNA_def_function(srna, "target_is_valid", "rna_gizmo_target_is_valid");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "property", NULL, 0, "", "Property identifier");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_function_ui_description(func, "");
+ parm = RNA_def_boolean(func, "result", 0, "", "");
+ RNA_def_function_return(func, parm);
}
-
void RNA_api_gizmogroup(StructRNA *UNUSED(srna))
{
- /* nothing yet */
+ /* nothing yet */
}
#endif
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index d075439fcee..5e4791b8b7a 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -37,341 +37,375 @@
#ifdef RNA_RUNTIME
-#include "BLI_listbase.h"
+# include "BLI_listbase.h"
-#include "BKE_global.h"
+# include "BKE_global.h"
-#include "DNA_object_types.h"
-#include "DNA_screen_types.h"
-#include "DNA_space_types.h"
+# include "DNA_object_types.h"
+# include "DNA_screen_types.h"
+# include "DNA_space_types.h"
-#include "RNA_access.h"
+# include "RNA_access.h"
-#include "WM_toolsystem.h"
+# include "WM_toolsystem.h"
-static void rna_window_update_all(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr))
+static void rna_window_update_all(Main *UNUSED(bmain),
+ Scene *UNUSED(scene),
+ PointerRNA *UNUSED(ptr))
{
- WM_main_add_notifier(NC_WINDOW, NULL);
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
void rna_workspace_screens_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
- WorkSpace *workspace = ptr->id.data;
- rna_iterator_listbase_begin(iter, BKE_workspace_layouts_get(workspace), NULL);
+ WorkSpace *workspace = ptr->id.data;
+ rna_iterator_listbase_begin(iter, BKE_workspace_layouts_get(workspace), NULL);
}
static PointerRNA rna_workspace_screens_item_get(CollectionPropertyIterator *iter)
{
- WorkSpaceLayout *layout = rna_iterator_listbase_get(iter);
- bScreen *screen = BKE_workspace_layout_screen_get(layout);
+ WorkSpaceLayout *layout = rna_iterator_listbase_get(iter);
+ bScreen *screen = BKE_workspace_layout_screen_get(layout);
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Screen, screen);
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Screen, screen);
}
/* workspace.owner_ids */
-static wmOwnerID *rna_WorkSpace_owner_ids_new(
- WorkSpace *workspace, const char *name)
+static wmOwnerID *rna_WorkSpace_owner_ids_new(WorkSpace *workspace, const char *name)
{
- wmOwnerID *owner_id = MEM_callocN(sizeof(*owner_id), __func__);
- BLI_addtail(&workspace->owner_ids, owner_id);
- BLI_strncpy(owner_id->name, name, sizeof(owner_id->name));
- WM_main_add_notifier(NC_WINDOW, NULL);
- return owner_id;
+ wmOwnerID *owner_id = MEM_callocN(sizeof(*owner_id), __func__);
+ BLI_addtail(&workspace->owner_ids, owner_id);
+ BLI_strncpy(owner_id->name, name, sizeof(owner_id->name));
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ return owner_id;
}
-static void rna_WorkSpace_owner_ids_remove(
- WorkSpace *workspace, ReportList *reports, PointerRNA *wstag_ptr)
+static void rna_WorkSpace_owner_ids_remove(WorkSpace *workspace,
+ ReportList *reports,
+ PointerRNA *wstag_ptr)
{
- wmOwnerID *owner_id = wstag_ptr->data;
- if (BLI_remlink_safe(&workspace->owner_ids, owner_id) == false) {
- BKE_reportf(reports, RPT_ERROR,
- "wmOwnerID '%s' not in workspace '%s'",
- owner_id->name, workspace->id.name + 2);
- return;
- }
-
- MEM_freeN(owner_id);
- RNA_POINTER_INVALIDATE(wstag_ptr);
-
- WM_main_add_notifier(NC_WINDOW, NULL);
+ wmOwnerID *owner_id = wstag_ptr->data;
+ if (BLI_remlink_safe(&workspace->owner_ids, owner_id) == false) {
+ BKE_reportf(reports,
+ RPT_ERROR,
+ "wmOwnerID '%s' not in workspace '%s'",
+ owner_id->name,
+ workspace->id.name + 2);
+ return;
+ }
+
+ MEM_freeN(owner_id);
+ RNA_POINTER_INVALIDATE(wstag_ptr);
+
+ WM_main_add_notifier(NC_WINDOW, NULL);
}
-static void rna_WorkSpace_owner_ids_clear(
- WorkSpace *workspace)
+static void rna_WorkSpace_owner_ids_clear(WorkSpace *workspace)
{
- BLI_freelistN(&workspace->owner_ids);
- WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, workspace);
+ BLI_freelistN(&workspace->owner_ids);
+ WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, workspace);
}
-static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace, const bToolKey *tkey, bool create)
+static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace,
+ const bToolKey *tkey,
+ bool create)
{
- if (create) {
- bToolRef *tref;
- WM_toolsystem_ref_ensure(workspace, tkey, &tref);
- return tref;
- }
- return WM_toolsystem_ref_find(workspace, tkey);
+ if (create) {
+ bToolRef *tref;
+ WM_toolsystem_ref_ensure(workspace, tkey, &tref);
+ return tref;
+ }
+ return WM_toolsystem_ref_find(workspace, tkey);
}
-static bToolRef *rna_WorkSpace_tools_from_space_view3d_mode(
- WorkSpace *workspace, int mode, bool create)
+static bToolRef *rna_WorkSpace_tools_from_space_view3d_mode(WorkSpace *workspace,
+ int mode,
+ bool create)
{
- return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_VIEW3D, .mode = mode, }, create);
+ return rna_WorkSpace_tools_from_tkey(workspace,
+ &(bToolKey){
+ .space_type = SPACE_VIEW3D,
+ .mode = mode,
+ },
+ create);
}
-static bToolRef *rna_WorkSpace_tools_from_space_image_mode(
- WorkSpace *workspace, int mode, bool create)
+static bToolRef *rna_WorkSpace_tools_from_space_image_mode(WorkSpace *workspace,
+ int mode,
+ bool create)
{
- return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_IMAGE, .mode = mode, }, create);
+ return rna_WorkSpace_tools_from_tkey(workspace,
+ &(bToolKey){
+ .space_type = SPACE_IMAGE,
+ .mode = mode,
+ },
+ create);
}
-static bToolRef *rna_WorkSpace_tools_from_space_node(
- WorkSpace *workspace, bool create)
+static bToolRef *rna_WorkSpace_tools_from_space_node(WorkSpace *workspace, bool create)
{
- return rna_WorkSpace_tools_from_tkey(workspace, &(bToolKey){ .space_type = SPACE_NODE, .mode = 0, }, create);
+ return rna_WorkSpace_tools_from_tkey(workspace,
+ &(bToolKey){
+ .space_type = SPACE_NODE,
+ .mode = 0,
+ },
+ create);
}
-const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(
- bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop), bool *UNUSED(r_free))
+const EnumPropertyItem *rna_WorkSpace_tools_mode_itemf(bContext *UNUSED(C),
+ PointerRNA *ptr,
+ PropertyRNA *UNUSED(prop),
+ bool *UNUSED(r_free))
{
- WorkSpace *workspace = ptr->id.data;
-
- switch (workspace->tools_space_type) {
- case SPACE_VIEW3D:
- return rna_enum_context_mode_items;
- case SPACE_IMAGE:
- return rna_enum_space_image_mode_all_items;
- }
- return DummyRNA_DEFAULT_items;
+ WorkSpace *workspace = ptr->id.data;
+
+ switch (workspace->tools_space_type) {
+ case SPACE_VIEW3D:
+ return rna_enum_context_mode_items;
+ case SPACE_IMAGE:
+ return rna_enum_space_image_mode_all_items;
+ }
+ return DummyRNA_DEFAULT_items;
}
static int rna_WorkSpaceTool_index_get(PointerRNA *ptr)
{
- bToolRef *tref = ptr->data;
- return (tref->runtime) ? tref->runtime->index : 0;
+ bToolRef *tref = ptr->data;
+ return (tref->runtime) ? tref->runtime->index : 0;
}
static int rna_WorkSpaceTool_has_datablock_get(PointerRNA *ptr)
{
- bToolRef *tref = ptr->data;
- return (tref->runtime) ? (tref->runtime->data_block[0] != '\0') : false;
+ bToolRef *tref = ptr->data;
+ return (tref->runtime) ? (tref->runtime->data_block[0] != '\0') : false;
}
static void rna_WorkSpaceTool_widget_get(PointerRNA *ptr, char *value)
{
- bToolRef *tref = ptr->data;
- strcpy(value, tref->runtime ? tref->runtime->gizmo_group : "");
+ bToolRef *tref = ptr->data;
+ strcpy(value, tref->runtime ? tref->runtime->gizmo_group : "");
}
static int rna_WorkSpaceTool_widget_length(PointerRNA *ptr)
{
- bToolRef *tref = ptr->data;
- return tref->runtime ? strlen(tref->runtime->gizmo_group) : 0;
+ bToolRef *tref = ptr->data;
+ return tref->runtime ? strlen(tref->runtime->gizmo_group) : 0;
}
#else /* RNA_RUNTIME */
static void rna_def_workspace_owner(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
+ StructRNA *srna;
+ PropertyRNA *prop;
- srna = RNA_def_struct(brna, "wmOwnerID", NULL);
- RNA_def_struct_sdna(srna, "wmOwnerID");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Work Space UI Tag", "");
+ srna = RNA_def_struct(brna, "wmOwnerID", NULL);
+ RNA_def_struct_sdna(srna, "wmOwnerID");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Work Space UI Tag", "");
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Name", "");
- RNA_def_struct_name_property(srna, prop);
+ prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Name", "");
+ RNA_def_struct_name_property(srna, prop);
}
static void rna_def_workspace_owner_ids(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "wmOwnerIDs");
- srna = RNA_def_struct(brna, "wmOwnerIDs", NULL);
- RNA_def_struct_sdna(srna, "WorkSpace");
- RNA_def_struct_ui_text(srna, "WorkSpace UI Tags", "");
-
- /* add owner_id */
- func = RNA_def_function(srna, "new", "rna_WorkSpace_owner_ids_new");
- RNA_def_function_ui_description(func, "Add ui tag");
- parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the tag");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return type */
- parm = RNA_def_pointer(func, "owner_id", "wmOwnerID", "", "");
- RNA_def_function_return(func, parm);
-
- /* remove owner_id */
- func = RNA_def_function(srna, "remove", "rna_WorkSpace_owner_ids_remove");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Remove ui tag");
- /* owner_id to remove */
- parm = RNA_def_pointer(func, "owner_id", "wmOwnerID", "", "Tag to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-
- /* clear all modifiers */
- func = RNA_def_function(srna, "clear", "rna_WorkSpace_owner_ids_clear");
- RNA_def_function_ui_description(func, "Remove all tags");
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "wmOwnerIDs");
+ srna = RNA_def_struct(brna, "wmOwnerIDs", NULL);
+ RNA_def_struct_sdna(srna, "WorkSpace");
+ RNA_def_struct_ui_text(srna, "WorkSpace UI Tags", "");
+
+ /* add owner_id */
+ func = RNA_def_function(srna, "new", "rna_WorkSpace_owner_ids_new");
+ RNA_def_function_ui_description(func, "Add ui tag");
+ parm = RNA_def_string(func, "name", "Name", 0, "", "New name for the tag");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return type */
+ parm = RNA_def_pointer(func, "owner_id", "wmOwnerID", "", "");
+ RNA_def_function_return(func, parm);
+
+ /* remove owner_id */
+ func = RNA_def_function(srna, "remove", "rna_WorkSpace_owner_ids_remove");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove ui tag");
+ /* owner_id to remove */
+ parm = RNA_def_pointer(func, "owner_id", "wmOwnerID", "", "Tag to remove");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
+ RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
+
+ /* clear all modifiers */
+ func = RNA_def_function(srna, "clear", "rna_WorkSpace_owner_ids_clear");
+ RNA_def_function_ui_description(func, "Remove all tags");
}
static void rna_def_workspace_tool(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "WorkSpaceTool", NULL);
- RNA_def_struct_sdna(srna, "bToolRef");
- RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
- RNA_def_struct_ui_text(srna, "Work Space Tool", "");
-
- prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
- RNA_def_property_ui_text(prop, "Identifier", "");
- RNA_def_struct_name_property(srna, prop);
-
- prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Index", "");
- RNA_def_property_int_funcs(prop, "rna_WorkSpaceTool_index_get", NULL, NULL);
-
- prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "space_type");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_ui_text(prop, "Space Type", "");
-
- prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mode");
- RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_WorkSpace_tools_mode_itemf");
- RNA_def_property_ui_text(prop, "Tool Mode", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- RNA_define_verify_sdna(0);
- prop = RNA_def_property(srna, "has_datablock", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Has Datablock", "");
- RNA_def_property_boolean_funcs(prop, "rna_WorkSpaceTool_has_datablock_get", NULL);
- RNA_define_verify_sdna(1);
-
- prop = RNA_def_property(srna, "widget", PROP_STRING, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Widget", "");
- RNA_def_property_string_funcs(prop, "rna_WorkSpaceTool_widget_get", "rna_WorkSpaceTool_widget_length", NULL);
- RNA_define_verify_sdna(1);
-
- RNA_api_workspace_tool(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "WorkSpaceTool", NULL);
+ RNA_def_struct_sdna(srna, "bToolRef");
+ RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
+ RNA_def_struct_ui_text(srna, "Work Space Tool", "");
+
+ prop = RNA_def_property(srna, "idname", PROP_STRING, PROP_NONE);
+ RNA_def_property_ui_text(prop, "Identifier", "");
+ RNA_def_struct_name_property(srna, prop);
+
+ prop = RNA_def_property(srna, "index", PROP_INT, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Index", "");
+ RNA_def_property_int_funcs(prop, "rna_WorkSpaceTool_index_get", NULL, NULL);
+
+ prop = RNA_def_property(srna, "space_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "space_type");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_ui_text(prop, "Space Type", "");
+
+ prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mode");
+ RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_WorkSpace_tools_mode_itemf");
+ RNA_def_property_ui_text(prop, "Tool Mode", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ RNA_define_verify_sdna(0);
+ prop = RNA_def_property(srna, "has_datablock", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Has Datablock", "");
+ RNA_def_property_boolean_funcs(prop, "rna_WorkSpaceTool_has_datablock_get", NULL);
+ RNA_define_verify_sdna(1);
+
+ prop = RNA_def_property(srna, "widget", PROP_STRING, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+ RNA_def_property_ui_text(prop, "Widget", "");
+ RNA_def_property_string_funcs(
+ prop, "rna_WorkSpaceTool_widget_get", "rna_WorkSpaceTool_widget_length", NULL);
+ RNA_define_verify_sdna(1);
+
+ RNA_api_workspace_tool(srna);
}
static void rna_def_workspace_tools(BlenderRNA *brna, PropertyRNA *cprop)
{
- StructRNA *srna;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "wmTools");
- srna = RNA_def_struct(brna, "wmTools", NULL);
- RNA_def_struct_sdna(srna, "WorkSpace");
- RNA_def_struct_ui_text(srna, "WorkSpace UI Tags", "");
-
- /* add owner_id */
- func = RNA_def_function(srna, "from_space_view3d_mode", "rna_WorkSpace_tools_from_space_view3d_mode");
- RNA_def_function_ui_description(func, "");
- parm = RNA_def_enum(func, "mode", rna_enum_context_mode_items, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "create", false, "Create", "");
- /* return type */
- parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "from_space_image_mode", "rna_WorkSpace_tools_from_space_image_mode");
- RNA_def_function_ui_description(func, "");
- parm = RNA_def_enum(func, "mode", rna_enum_space_image_mode_all_items, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_boolean(func, "create", false, "Create", "");
- /* return type */
- parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "from_space_node", "rna_WorkSpace_tools_from_space_node");
- RNA_def_function_ui_description(func, "");
- RNA_def_boolean(func, "create", false, "Create", "");
- /* return type */
- parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
- RNA_def_function_return(func, parm);
+ StructRNA *srna;
+
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ RNA_def_property_srna(cprop, "wmTools");
+ srna = RNA_def_struct(brna, "wmTools", NULL);
+ RNA_def_struct_sdna(srna, "WorkSpace");
+ RNA_def_struct_ui_text(srna, "WorkSpace UI Tags", "");
+
+ /* add owner_id */
+ func = RNA_def_function(
+ srna, "from_space_view3d_mode", "rna_WorkSpace_tools_from_space_view3d_mode");
+ RNA_def_function_ui_description(func, "");
+ parm = RNA_def_enum(func, "mode", rna_enum_context_mode_items, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "create", false, "Create", "");
+ /* return type */
+ parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(
+ srna, "from_space_image_mode", "rna_WorkSpace_tools_from_space_image_mode");
+ RNA_def_function_ui_description(func, "");
+ parm = RNA_def_enum(func, "mode", rna_enum_space_image_mode_all_items, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_boolean(func, "create", false, "Create", "");
+ /* return type */
+ parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "from_space_node", "rna_WorkSpace_tools_from_space_node");
+ RNA_def_function_ui_description(func, "");
+ RNA_def_boolean(func, "create", false, "Create", "");
+ /* return type */
+ parm = RNA_def_pointer(func, "result", "WorkSpaceTool", "", "");
+ RNA_def_function_return(func, parm);
}
static void rna_def_workspace(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "WorkSpace", "ID");
- RNA_def_struct_sdna(srna, "WorkSpace");
- RNA_def_struct_ui_text(srna, "Workspace", "Workspace data-block, defining the working environment for the user");
- /* TODO: real icon, just to show something */
- RNA_def_struct_ui_icon(srna, ICON_WORKSPACE);
-
- prop = RNA_def_property(srna, "screens", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "layouts", NULL);
- RNA_def_property_struct_type(prop, "Screen");
- RNA_def_property_collection_funcs(prop, "rna_workspace_screens_begin", NULL, NULL,
- "rna_workspace_screens_item_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Screens", "Screen layouts of a workspace");
-
- prop = RNA_def_property(srna, "owner_ids", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_struct_type(prop, "wmOwnerID");
- RNA_def_property_ui_text(prop, "UI Tags", "");
- rna_def_workspace_owner_ids(brna, prop);
-
- prop = RNA_def_property(srna, "tools", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "tools", NULL);
- RNA_def_property_struct_type(prop, "WorkSpaceTool");
- RNA_def_property_ui_text(prop, "Tools", "");
- rna_def_workspace_tools(brna, prop);
-
- prop = RNA_def_property(srna, "tools_space_type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tools_space_type");
- RNA_def_property_enum_items(prop, rna_enum_space_type_items);
- RNA_def_property_ui_text(prop, "Active Tool Space", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "tools_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "tools_mode");
- RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
- RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_WorkSpace_tools_mode_itemf");
- RNA_def_property_ui_text(prop, "Active Tool Mode", "");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "object_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_workspace_object_mode_items);
- RNA_def_property_ui_text(prop, "Object Mode", "Switch to this object mode when activating the workspace");
-
- /* Flags */
- prop = RNA_def_property(srna, "use_filter_by_owner", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_boolean_sdna(prop, NULL, "flags", WORKSPACE_USE_FILTER_BY_ORIGIN);
- RNA_def_property_ui_text(prop, "Use UI Tags",
- "Filter the UI by tags");
- RNA_def_property_update(prop, 0, "rna_window_update_all");
-
- RNA_api_workspace(srna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "WorkSpace", "ID");
+ RNA_def_struct_sdna(srna, "WorkSpace");
+ RNA_def_struct_ui_text(
+ srna, "Workspace", "Workspace data-block, defining the working environment for the user");
+ /* TODO: real icon, just to show something */
+ RNA_def_struct_ui_icon(srna, ICON_WORKSPACE);
+
+ prop = RNA_def_property(srna, "screens", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "layouts", NULL);
+ RNA_def_property_struct_type(prop, "Screen");
+ RNA_def_property_collection_funcs(prop,
+ "rna_workspace_screens_begin",
+ NULL,
+ NULL,
+ "rna_workspace_screens_item_get",
+ NULL,
+ NULL,
+ NULL,
+ NULL);
+ RNA_def_property_ui_text(prop, "Screens", "Screen layouts of a workspace");
+
+ prop = RNA_def_property(srna, "owner_ids", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "wmOwnerID");
+ RNA_def_property_ui_text(prop, "UI Tags", "");
+ rna_def_workspace_owner_ids(brna, prop);
+
+ prop = RNA_def_property(srna, "tools", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_collection_sdna(prop, NULL, "tools", NULL);
+ RNA_def_property_struct_type(prop, "WorkSpaceTool");
+ RNA_def_property_ui_text(prop, "Tools", "");
+ rna_def_workspace_tools(brna, prop);
+
+ prop = RNA_def_property(srna, "tools_space_type", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tools_space_type");
+ RNA_def_property_enum_items(prop, rna_enum_space_type_items);
+ RNA_def_property_ui_text(prop, "Active Tool Space", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "tools_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "tools_mode");
+ RNA_def_property_enum_items(prop, DummyRNA_DEFAULT_items);
+ RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_WorkSpace_tools_mode_itemf");
+ RNA_def_property_ui_text(prop, "Active Tool Mode", "");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE);
+
+ prop = RNA_def_property(srna, "object_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(prop, rna_enum_workspace_object_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Object Mode", "Switch to this object mode when activating the workspace");
+
+ /* Flags */
+ prop = RNA_def_property(srna, "use_filter_by_owner", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flags", WORKSPACE_USE_FILTER_BY_ORIGIN);
+ RNA_def_property_ui_text(prop, "Use UI Tags", "Filter the UI by tags");
+ RNA_def_property_update(prop, 0, "rna_window_update_all");
+
+ RNA_api_workspace(srna);
}
void RNA_def_workspace(BlenderRNA *brna)
{
- rna_def_workspace_owner(brna);
- rna_def_workspace_tool(brna);
+ rna_def_workspace_owner(brna);
+ rna_def_workspace_tool(brna);
- rna_def_workspace(brna);
+ rna_def_workspace(brna);
}
#endif /* RNA_RUNTIME */
diff --git a/source/blender/makesrna/intern/rna_workspace_api.c b/source/blender/makesrna/intern/rna_workspace_api.c
index f82b1ecda60..b8c6a25ace8 100644
--- a/source/blender/makesrna/intern/rna_workspace_api.c
+++ b/source/blender/makesrna/intern/rna_workspace_api.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -31,142 +30,140 @@
#include "DNA_object_types.h"
#include "DNA_windowmanager_types.h"
-#include "RNA_enum_types.h" /* own include */
+#include "RNA_enum_types.h" /* own include */
-#include "rna_internal.h" /* own include */
+#include "rna_internal.h" /* own include */
#ifdef RNA_RUNTIME
-#include "BKE_paint.h"
-
-#include "ED_screen.h"
-
-static void rna_WorkSpaceTool_setup(
- ID *id,
- bToolRef *tref,
- bContext *C,
- const char *name,
- /* Args for: 'bToolRef_Runtime'. */
- int cursor,
- const char *keymap,
- const char *gizmo_group,
- const char *data_block,
- const char *operator,
- int index)
+# include "BKE_paint.h"
+
+# include "ED_screen.h"
+
+static void rna_WorkSpaceTool_setup(ID *id,
+ bToolRef *tref,
+ bContext *C,
+ const char *name,
+ /* Args for: 'bToolRef_Runtime'. */
+ int cursor,
+ const char *keymap,
+ const char *gizmo_group,
+ const char *data_block,
+ const char *
+ operator,
+ int index)
{
- bToolRef_Runtime tref_rt = {0};
+ bToolRef_Runtime tref_rt = {0};
- tref_rt.cursor = cursor;
- STRNCPY(tref_rt.keymap, keymap);
- STRNCPY(tref_rt.gizmo_group, gizmo_group);
- STRNCPY(tref_rt.data_block, data_block);
- STRNCPY(tref_rt.op, operator);
- tref_rt.index = index;
+ tref_rt.cursor = cursor;
+ STRNCPY(tref_rt.keymap, keymap);
+ STRNCPY(tref_rt.gizmo_group, gizmo_group);
+ STRNCPY(tref_rt.data_block, data_block);
+ STRNCPY(tref_rt.op, operator);
+ tref_rt.index = index;
- WM_toolsystem_ref_set_from_runtime(C, (WorkSpace *)id, tref, &tref_rt, name);
+ WM_toolsystem_ref_set_from_runtime(C, (WorkSpace *)id, tref, &tref_rt, name);
}
-static void rna_WorkSpaceTool_refresh_from_context(
- ID *id,
- bToolRef *tref,
- Main *bmain)
+static void rna_WorkSpaceTool_refresh_from_context(ID *id, bToolRef *tref, Main *bmain)
{
- WM_toolsystem_ref_sync_from_context(bmain, (WorkSpace *)id, tref);
+ WM_toolsystem_ref_sync_from_context(bmain, (WorkSpace *)id, tref);
}
-static PointerRNA rna_WorkSpaceTool_operator_properties(
- bToolRef *tref,
- ReportList *reports,
- const char *idname)
+static PointerRNA rna_WorkSpaceTool_operator_properties(bToolRef *tref,
+ ReportList *reports,
+ const char *idname)
{
- wmOperatorType *ot = WM_operatortype_find(idname, true);
-
- if (ot != NULL) {
- PointerRNA ptr;
- WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, &ptr);
- return ptr;
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Operator '%s' not found!", idname);
- }
- return PointerRNA_NULL;
+ wmOperatorType *ot = WM_operatortype_find(idname, true);
+
+ if (ot != NULL) {
+ PointerRNA ptr;
+ WM_toolsystem_ref_properties_ensure_from_operator(tref, ot, &ptr);
+ return ptr;
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Operator '%s' not found!", idname);
+ }
+ return PointerRNA_NULL;
}
-static PointerRNA rna_WorkSpaceTool_gizmo_group_properties(
- bToolRef *tref,
- ReportList *reports,
- const char *idname)
+static PointerRNA rna_WorkSpaceTool_gizmo_group_properties(bToolRef *tref,
+ ReportList *reports,
+ const char *idname)
{
- wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
- if (gzgt != NULL) {
- PointerRNA ptr;
- WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgt, &ptr);
- return ptr;
- }
- else {
- BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' not found!", idname);
- }
- return PointerRNA_NULL;
+ wmGizmoGroupType *gzgt = WM_gizmogrouptype_find(idname, false);
+ if (gzgt != NULL) {
+ PointerRNA ptr;
+ WM_toolsystem_ref_properties_ensure_from_gizmo_group(tref, gzgt, &ptr);
+ return ptr;
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Gizmo group '%s' not found!", idname);
+ }
+ return PointerRNA_NULL;
}
#else
void RNA_api_workspace(StructRNA *srna)
{
- FunctionRNA *func;
- PropertyRNA *parm;
-
- func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text");
- RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Set the status bar text, typically key shortcuts for modal operators");
- parm = RNA_def_string(func, "text", NULL, 0, "Text", "New string for the status bar, None clears the text");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
+ FunctionRNA *func;
+ PropertyRNA *parm;
+
+ func = RNA_def_function(srna, "status_text_set", "ED_workspace_status_text");
+ RNA_def_function_flag(func, FUNC_NO_SELF | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(
+ func, "Set the status bar text, typically key shortcuts for modal operators");
+ parm = RNA_def_string(
+ func, "text", NULL, 0, "Text", "New string for the status bar, None clears the text");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ RNA_def_property_clear_flag(parm, PROP_NEVER_NULL);
}
void RNA_api_workspace_tool(StructRNA *srna)
{
- PropertyRNA *parm;
- FunctionRNA *func;
-
- func = RNA_def_function(srna, "setup", "rna_WorkSpaceTool_setup");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT);
- RNA_def_function_ui_description(func, "Set the tool settings");
-
- parm = RNA_def_string(func, "idname", NULL, MAX_NAME, "Identifier", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
-
- /* 'bToolRef_Runtime' */
- parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
- RNA_def_string(func, "keymap", NULL, KMAP_MAX_NAME, "Key Map", "");
- RNA_def_string(func, "gizmo_group", NULL, MAX_NAME, "Gizmo Group", "");
- RNA_def_string(func, "data_block", NULL, MAX_NAME, "Data Block", "");
- RNA_def_string(func, "operator", NULL, MAX_NAME, "Operator", "");
- RNA_def_int(func, "index", 0, INT_MIN, INT_MAX, "Index", "", INT_MIN, INT_MAX);
-
- /* Access tool operator options (optionally create). */
- func = RNA_def_function(srna, "operator_properties", "rna_WorkSpaceTool_operator_properties");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "operator", NULL, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return */
- parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- /* Access gizmo-group options (optionally create). */
- func = RNA_def_function(srna, "gizmo_group_properties", "rna_WorkSpaceTool_gizmo_group_properties");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_string(func, "group", NULL, 0, "", "");
- RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
- /* return */
- parm = RNA_def_pointer(func, "result", "GizmoGroupProperties", "", "");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "refresh_from_context", "rna_WorkSpaceTool_refresh_from_context");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
+ PropertyRNA *parm;
+ FunctionRNA *func;
+
+ func = RNA_def_function(srna, "setup", "rna_WorkSpaceTool_setup");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_CONTEXT);
+ RNA_def_function_ui_description(func, "Set the tool settings");
+
+ parm = RNA_def_string(func, "idname", NULL, MAX_NAME, "Identifier", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+
+ /* 'bToolRef_Runtime' */
+ parm = RNA_def_property(func, "cursor", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_items(parm, rna_enum_window_cursor_items);
+ RNA_def_string(func, "keymap", NULL, KMAP_MAX_NAME, "Key Map", "");
+ RNA_def_string(func, "gizmo_group", NULL, MAX_NAME, "Gizmo Group", "");
+ RNA_def_string(func, "data_block", NULL, MAX_NAME, "Data Block", "");
+ RNA_def_string(func, "operator", NULL, MAX_NAME, "Operator", "");
+ RNA_def_int(func, "index", 0, INT_MIN, INT_MAX, "Index", "", INT_MIN, INT_MAX);
+
+ /* Access tool operator options (optionally create). */
+ func = RNA_def_function(srna, "operator_properties", "rna_WorkSpaceTool_operator_properties");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "operator", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_pointer(func, "result", "OperatorProperties", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ /* Access gizmo-group options (optionally create). */
+ func = RNA_def_function(
+ srna, "gizmo_group_properties", "rna_WorkSpaceTool_gizmo_group_properties");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ parm = RNA_def_string(func, "group", NULL, 0, "", "");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+ /* return */
+ parm = RNA_def_pointer(func, "result", "GizmoGroupProperties", "", "");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_RNAPTR);
+ RNA_def_function_return(func, parm);
+
+ func = RNA_def_function(srna, "refresh_from_context", "rna_WorkSpaceTool_refresh_from_context");
+ RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
}
#endif
diff --git a/source/blender/makesrna/intern/rna_world.c b/source/blender/makesrna/intern/rna_world.c
index 3fd01a5b8e5..19109dbe3ce 100644
--- a/source/blender/makesrna/intern/rna_world.c
+++ b/source/blender/makesrna/intern/rna_world.c
@@ -18,7 +18,6 @@
* \ingroup RNA
*/
-
#include <float.h>
#include <stdlib.h>
@@ -34,211 +33,219 @@
#ifdef RNA_RUNTIME
-#include "MEM_guardedalloc.h"
+# include "MEM_guardedalloc.h"
-#include "BKE_context.h"
-#include "BKE_main.h"
-#include "BKE_texture.h"
+# include "BKE_context.h"
+# include "BKE_main.h"
+# include "BKE_texture.h"
-#include "DEG_depsgraph.h"
-#include "DEG_depsgraph_build.h"
+# include "DEG_depsgraph.h"
+# include "DEG_depsgraph_build.h"
-#include "ED_node.h"
+# include "ED_node.h"
-#include "WM_api.h"
+# include "WM_api.h"
static PointerRNA rna_World_lighting_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_WorldLighting, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_WorldLighting, ptr->id.data);
}
-
static PointerRNA rna_World_mist_get(PointerRNA *ptr)
{
- return rna_pointer_inherit_refine(ptr, &RNA_WorldMistSettings, ptr->id.data);
+ return rna_pointer_inherit_refine(ptr, &RNA_WorldMistSettings, ptr->id.data);
}
static void rna_World_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- World *wo = ptr->id.data;
+ World *wo = ptr->id.data;
- DEG_id_tag_update(&wo->id, 0);
- WM_main_add_notifier(NC_WORLD | ND_WORLD, wo);
+ DEG_id_tag_update(&wo->id, 0);
+ WM_main_add_notifier(NC_WORLD | ND_WORLD, wo);
}
-#if 0
+# if 0
static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- World *wo = ptr->id.data;
+ World *wo = ptr->id.data;
- DEG_id_tag_update(&wo->id, 0);
- WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, wo);
+ DEG_id_tag_update(&wo->id, 0);
+ WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, wo);
}
-#endif
+# endif
static void rna_World_draw_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr)
{
- World *wo = ptr->id.data;
+ World *wo = ptr->id.data;
- DEG_id_tag_update(&wo->id, 0);
- WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, wo);
- WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
+ DEG_id_tag_update(&wo->id, 0);
+ WM_main_add_notifier(NC_WORLD | ND_WORLD_DRAW, wo);
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
}
static void rna_World_use_nodes_update(bContext *C, PointerRNA *ptr)
{
- World *wrld = (World *)ptr->data;
- Main *bmain = CTX_data_main(C);
- Scene *scene = CTX_data_scene(C);
+ World *wrld = (World *)ptr->data;
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
- if (wrld->use_nodes && wrld->nodetree == NULL)
- ED_node_shader_default(C, &wrld->id);
+ if (wrld->use_nodes && wrld->nodetree == NULL)
+ ED_node_shader_default(C, &wrld->id);
- DEG_relations_tag_update(bmain);
- rna_World_update(bmain, scene, ptr);
- rna_World_draw_update(bmain, scene, ptr);
+ DEG_relations_tag_update(bmain);
+ rna_World_update(bmain, scene, ptr);
+ rna_World_draw_update(bmain, scene, ptr);
}
#else
static void rna_def_lighting(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- srna = RNA_def_struct(brna, "WorldLighting", NULL);
- RNA_def_struct_sdna(srna, "World");
- RNA_def_struct_nested(brna, srna, "World");
- RNA_def_struct_ui_text(srna, "Lighting", "Lighting for a World data-block");
-
- /* ambient occlusion */
- prop = RNA_def_property(srna, "use_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC);
- RNA_def_property_ui_text(prop, "Use Ambient Occlusion",
- "Use Ambient Occlusion to add shadowing based on distance between objects");
- RNA_def_property_update(prop, 0, "rna_World_update");
-
- prop = RNA_def_property(srna, "ao_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "aoenergy");
- RNA_def_property_range(prop, 0, INT_MAX);
- RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
- RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
- RNA_def_property_update(prop, 0, "rna_World_update");
-
- prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "aodist");
- RNA_def_property_ui_text(prop, "Distance",
- "Length of rays, defines how far away other faces give occlusion effect");
- RNA_def_property_update(prop, 0, "rna_World_update");
-
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ srna = RNA_def_struct(brna, "WorldLighting", NULL);
+ RNA_def_struct_sdna(srna, "World");
+ RNA_def_struct_nested(brna, srna, "World");
+ RNA_def_struct_ui_text(srna, "Lighting", "Lighting for a World data-block");
+
+ /* ambient occlusion */
+ prop = RNA_def_property(srna, "use_ambient_occlusion", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_AMB_OCC);
+ RNA_def_property_ui_text(
+ prop,
+ "Use Ambient Occlusion",
+ "Use Ambient Occlusion to add shadowing based on distance between objects");
+ RNA_def_property_update(prop, 0, "rna_World_update");
+
+ prop = RNA_def_property(srna, "ao_factor", PROP_FLOAT, PROP_FACTOR);
+ RNA_def_property_float_sdna(prop, NULL, "aoenergy");
+ RNA_def_property_range(prop, 0, INT_MAX);
+ RNA_def_property_ui_range(prop, 0, 1, 0.1, 2);
+ RNA_def_property_ui_text(prop, "Factor", "Factor for ambient occlusion blending");
+ RNA_def_property_update(prop, 0, "rna_World_update");
+
+ prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "aodist");
+ RNA_def_property_ui_text(
+ prop, "Distance", "Length of rays, defines how far away other faces give occlusion effect");
+ RNA_def_property_update(prop, 0, "rna_World_update");
}
static void rna_def_world_mist(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static const EnumPropertyItem falloff_items[] = {
- {WO_MIST_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Use quadratic progression"},
- {WO_MIST_LINEAR, "LINEAR", 0, "Linear", "Use linear progression"},
- {WO_MIST_INVERSE_QUADRATIC, "INVERSE_QUADRATIC", 0, "Inverse Quadratic", "Use inverse quadratic progression"},
- {0, NULL, 0, NULL, NULL},
- };
-
- srna = RNA_def_struct(brna, "WorldMistSettings", NULL);
- RNA_def_struct_sdna(srna, "World");
- RNA_def_struct_nested(brna, srna, "World");
- RNA_def_struct_ui_text(srna, "World Mist", "Mist settings for a World data-block");
-
- prop = RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST);
- RNA_def_property_ui_text(prop, "Use Mist", "Occlude objects with the environment color as they are further away");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
-
- prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
- RNA_def_property_float_sdna(prop, NULL, "misi");
- RNA_def_property_range(prop, 0, 1);
- RNA_def_property_ui_text(prop, "Minimum", "Overall minimum intensity of the mist effect");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
-
- prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "miststa");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
- RNA_def_property_ui_text(prop, "Start", "Starting distance of the mist, measured from the camera");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
-
- prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "mistdist");
- RNA_def_property_range(prop, 0, FLT_MAX);
- RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
- RNA_def_property_ui_text(prop, "Depth", "Distance over which the mist effect fades in");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
-
- prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
- RNA_def_property_float_sdna(prop, NULL, "misthi");
- RNA_def_property_range(prop, 0, 100);
- RNA_def_property_ui_text(prop, "Height", "Control how much mist density decreases with height");
- RNA_def_property_update(prop, 0, "rna_World_update");
-
- prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "mistype");
- RNA_def_property_enum_items(prop, falloff_items);
- RNA_def_property_ui_text(prop, "Falloff", "Type of transition used to fade mist");
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static const EnumPropertyItem falloff_items[] = {
+ {WO_MIST_QUADRATIC, "QUADRATIC", 0, "Quadratic", "Use quadratic progression"},
+ {WO_MIST_LINEAR, "LINEAR", 0, "Linear", "Use linear progression"},
+ {WO_MIST_INVERSE_QUADRATIC,
+ "INVERSE_QUADRATIC",
+ 0,
+ "Inverse Quadratic",
+ "Use inverse quadratic progression"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
+ srna = RNA_def_struct(brna, "WorldMistSettings", NULL);
+ RNA_def_struct_sdna(srna, "World");
+ RNA_def_struct_nested(brna, srna, "World");
+ RNA_def_struct_ui_text(srna, "World Mist", "Mist settings for a World data-block");
+
+ prop = RNA_def_property(srna, "use_mist", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "mode", WO_MIST);
+ RNA_def_property_ui_text(
+ prop, "Use Mist", "Occlude objects with the environment color as they are further away");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
+
+ prop = RNA_def_property(srna, "intensity", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "misi");
+ RNA_def_property_range(prop, 0, 1);
+ RNA_def_property_ui_text(prop, "Minimum", "Overall minimum intensity of the mist effect");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
+
+ prop = RNA_def_property(srna, "start", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "miststa");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
+ RNA_def_property_ui_text(
+ prop, "Start", "Starting distance of the mist, measured from the camera");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
+
+ prop = RNA_def_property(srna, "depth", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "mistdist");
+ RNA_def_property_range(prop, 0, FLT_MAX);
+ RNA_def_property_ui_range(prop, 0, 10000, 10, 2);
+ RNA_def_property_ui_text(prop, "Depth", "Distance over which the mist effect fades in");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
+
+ prop = RNA_def_property(srna, "height", PROP_FLOAT, PROP_DISTANCE);
+ RNA_def_property_float_sdna(prop, NULL, "misthi");
+ RNA_def_property_range(prop, 0, 100);
+ RNA_def_property_ui_text(prop, "Height", "Control how much mist density decreases with height");
+ RNA_def_property_update(prop, 0, "rna_World_update");
+
+ prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "mistype");
+ RNA_def_property_enum_items(prop, falloff_items);
+ RNA_def_property_ui_text(prop, "Falloff", "Type of transition used to fade mist");
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
}
void RNA_def_world(BlenderRNA *brna)
{
- StructRNA *srna;
- PropertyRNA *prop;
-
- static float default_world_color[] = {0.05f, 0.05f, 0.05f};
-
- srna = RNA_def_struct(brna, "World", "ID");
- RNA_def_struct_ui_text(srna, "World",
- "World data-block describing the environment and ambient lighting of a scene");
- RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
-
- rna_def_animdata_common(srna);
-
- /* colors */
- prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
- RNA_def_property_float_sdna(prop, NULL, "horr");
- RNA_def_property_array(prop, 3);
- RNA_def_property_float_array_default(prop, default_world_color);
- RNA_def_property_ui_text(prop, "Color", "Color of the background");
- /* RNA_def_property_update(prop, 0, "rna_World_update"); */
- /* render-only uses this */
- RNA_def_property_update(prop, 0, "rna_World_draw_update");
-
- /* nested structs */
- prop = RNA_def_property(srna, "light_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "WorldLighting");
- RNA_def_property_pointer_funcs(prop, "rna_World_lighting_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Lighting", "World lighting settings");
-
- prop = RNA_def_property(srna, "mist_settings", PROP_POINTER, PROP_NONE);
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_struct_type(prop, "WorldMistSettings");
- RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Mist", "World mist settings");
-
- /* nodes */
- prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
- RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
- RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based worlds");
-
- prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
- RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world");
- RNA_def_property_update(prop, 0, "rna_World_use_nodes_update");
-
- rna_def_lighting(brna);
- rna_def_world_mist(brna);
+ StructRNA *srna;
+ PropertyRNA *prop;
+
+ static float default_world_color[] = {0.05f, 0.05f, 0.05f};
+
+ srna = RNA_def_struct(brna, "World", "ID");
+ RNA_def_struct_ui_text(
+ srna,
+ "World",
+ "World data-block describing the environment and ambient lighting of a scene");
+ RNA_def_struct_ui_icon(srna, ICON_WORLD_DATA);
+
+ rna_def_animdata_common(srna);
+
+ /* colors */
+ prop = RNA_def_property(srna, "color", PROP_FLOAT, PROP_COLOR);
+ RNA_def_property_float_sdna(prop, NULL, "horr");
+ RNA_def_property_array(prop, 3);
+ RNA_def_property_float_array_default(prop, default_world_color);
+ RNA_def_property_ui_text(prop, "Color", "Color of the background");
+ /* RNA_def_property_update(prop, 0, "rna_World_update"); */
+ /* render-only uses this */
+ RNA_def_property_update(prop, 0, "rna_World_draw_update");
+
+ /* nested structs */
+ prop = RNA_def_property(srna, "light_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "WorldLighting");
+ RNA_def_property_pointer_funcs(prop, "rna_World_lighting_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Lighting", "World lighting settings");
+
+ prop = RNA_def_property(srna, "mist_settings", PROP_POINTER, PROP_NONE);
+ RNA_def_property_flag(prop, PROP_NEVER_NULL);
+ RNA_def_property_struct_type(prop, "WorldMistSettings");
+ RNA_def_property_pointer_funcs(prop, "rna_World_mist_get", NULL, NULL, NULL);
+ RNA_def_property_ui_text(prop, "Mist", "World mist settings");
+
+ /* nodes */
+ prop = RNA_def_property(srna, "node_tree", PROP_POINTER, PROP_NONE);
+ RNA_def_property_pointer_sdna(prop, NULL, "nodetree");
+ RNA_def_property_ui_text(prop, "Node Tree", "Node tree for node based worlds");
+
+ prop = RNA_def_property(srna, "use_nodes", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "use_nodes", 1);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
+ RNA_def_property_ui_text(prop, "Use Nodes", "Use shader nodes to render the world");
+ RNA_def_property_update(prop, 0, "rna_World_use_nodes_update");
+
+ rna_def_lighting(brna);
+ rna_def_world_mist(brna);
}
#endif